:root{
  color-scheme:light;
  --bg:#f6f8fc;--surface:#fff;--surface-2:#f2f6fc;--surface-3:#eef3f8;
  --text:#1f1f1f;--muted:#5f6368;--line:#e0e3e7;--line-soft:#edf0f3;
  --blue:#0b57d0;--blue-hover:#0842a0;--blue-soft:#d3e3fd;--blue-soft-2:#eaf1fb;
  --teal:#0f766e;--pink:#f16077;--shadow:0 12px 34px rgba(31,35,41,.08);
  --danger:#b3261e;--warning:#8a5a00;--success:#137333;
  --sidebar-w:256px;--row-h:44px;--radius:18px;
  --font-ui:"Google Sans",Roboto,RobotoDraft,Helvetica,Arial,sans-serif;--font-google:"Google Sans",Roboto,RobotoDraft,Helvetica,Arial,sans-serif;
  font-family:var(--font-ui);
}
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#111318;--surface:#1b1d22;--surface-2:#22252b;--surface-3:#2a2e35;
  --text:#e8eaed;--muted:#a8adb5;--line:#383c43;--line-soft:#2b2f35;
  --blue:#a8c7fa;--blue-hover:#c2d7ff;--blue-soft:#29415f;--blue-soft-2:#1d2b3d;
  --shadow:0 12px 34px rgba(0,0,0,.28);--danger:#f28b82;--warning:#fdd663;--success:#81c995;
}
html[data-density="comfortable"]{--row-h:52px}
html[data-density="compact"]{--row-h:36px}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text)}body{overflow:hidden}
button,input,select,textarea{font:inherit}button{color:inherit}.hidden{display:none!important}.desktop-only{display:inline-flex}
.icon-slot{display:inline-flex;width:20px;height:20px;align-items:center;justify-content:center;flex:0 0 auto}.icon-slot svg{width:100%;height:100%;display:block}
.icon-button{width:40px;height:40px;border:0;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;background:transparent;cursor:pointer;color:var(--muted);transition:.15s}
.icon-button:hover{background:var(--surface-3);color:var(--text)}.icon-button.small{width:32px;height:32px}.icon-button.tiny{width:30px;height:30px;border-radius:7px}.icon-button:disabled{opacity:.38;cursor:default}
.primary-button,.send-button{border:0;background:var(--blue);color:#fff;border-radius:999px;font-weight:700;cursor:pointer;transition:.15s}.primary-button:hover,.send-button:hover{background:var(--blue-hover)}
.outline-button{border:1px solid var(--line);background:transparent;border-radius:999px;padding:10px 18px;font-weight:600;display:inline-flex;align-items:center;gap:8px;cursor:pointer}.outline-button:hover{background:var(--surface-2)}.outline-button.full{width:100%;justify-content:center}
.text-button{border:0;background:transparent;color:var(--muted);font-size:13px;cursor:pointer;padding:4px}.text-button:hover{color:var(--blue)}
.app-loading{position:fixed;inset:0;background:var(--bg);display:flex;align-items:center;justify-content:center;gap:12px;z-index:1000;color:var(--muted)}.loading-logo{width:42px;height:42px;object-fit:contain}

/* Login */
.login-view{position:fixed;inset:0;display:grid;place-items:center;padding:28px;overflow:auto;background:#fbf7ee}.login-background{position:absolute;inset:0;background:url('login-map.svg') center/cover no-repeat;opacity:.98}.login-view::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(251,247,238,.14),rgba(251,247,238,.42) 48%,rgba(251,247,238,.72));pointer-events:none}.login-glow{position:absolute;border-radius:50%;filter:blur(5px);pointer-events:none}.login-glow-a{width:420px;height:420px;left:-90px;top:-120px;background:radial-gradient(circle,rgba(45,212,191,.12),transparent 68%)}.login-glow-b{width:520px;height:520px;right:-140px;bottom:-180px;background:radial-gradient(circle,rgba(99,102,241,.1),transparent 68%)}
.login-card{position:relative;z-index:2;width:min(440px,100%);margin-left:min(40vw,620px);background:rgba(255,255,255,.94);backdrop-filter:blur(14px);border:1px solid rgba(15,23,42,.09);border-radius:26px;padding:34px 34px 26px;box-shadow:0 30px 80px rgba(15,23,42,.14)}
.brand-lockup{display:flex;align-items:center;gap:12px;margin-bottom:34px}.brand-logo{width:58px;height:52px;object-fit:contain}.brand-name{font-size:23px;font-weight:800;letter-spacing:-.04em}.brand-product{font-size:15px;color:#667085;font-weight:650;margin-top:-2px}.login-copy h1{font-size:28px;line-height:1.15;letter-spacing:-.035em;margin:0 0 9px}.login-copy p{margin:0;color:#687386;font-size:14px;line-height:1.55}.admin-notice{display:flex;gap:10px;align-items:flex-start;margin:22px 0;padding:12px 13px;border-radius:13px;background:rgba(15,118,110,.07);color:#365a58;font-size:13px;line-height:1.45;border:1px solid rgba(15,118,110,.12)}.admin-notice .icon-slot{width:17px;height:17px;margin-top:1px;color:#0f766e}.login-form{display:grid;gap:15px}.login-form label>span{display:block;font-size:13px;font-weight:700;margin-bottom:7px;color:#3f4652}.login-form input{width:100%;height:48px;border:1px solid #d7dce3;border-radius:12px;padding:0 14px;background:#fff;color:#202124;outline:none;transition:.15s}.login-form input:focus{border-color:#7baaf7;box-shadow:0 0 0 3px rgba(11,87,208,.09)}.password-wrap{position:relative}.password-wrap input{padding-right:50px}.password-wrap .icon-button{position:absolute;right:4px;top:4px}.login-submit{height:46px;margin-top:4px}.form-error{margin:0;padding:10px 12px;border-radius:10px;background:#fce8e6;color:#b3261e;font-size:13px}.login-foot{text-align:center;color:#8a919c;font-size:12px;margin-top:24px}

/* App shell */
.mail-view{position:fixed;inset:0;background:var(--bg)}.topbar{height:64px;display:grid;grid-template-columns:minmax(260px,1fr) minmax(340px,720px) minmax(190px,1fr);align-items:center;padding:8px 12px;gap:12px}.topbar-left,.topbar-right{display:flex;align-items:center;gap:6px}.topbar-right{justify-content:flex-end}.mail-brand{display:flex;align-items:center;gap:9px;text-decoration:none;color:var(--text);font-size:20px;white-space:nowrap}.mail-brand-logo{width:36px;height:34px;object-fit:contain}.mail-brand b{font-weight:500;color:var(--muted)}.search-box{height:48px;border-radius:24px;background:var(--surface-2);display:flex;align-items:center;padding:0 12px;gap:9px;border:1px solid transparent;transition:.15s}.search-box:focus-within{background:var(--surface);box-shadow:var(--shadow);border-color:var(--line)}.search-box>.icon-slot{color:var(--muted)}.search-box input{flex:1;border:0;outline:0;background:transparent;color:var(--text);min-width:0;font-size:16px}.avatar-button{width:36px;height:36px;border:0;border-radius:50%;background:var(--pink);color:#fff;font-size:12px;font-weight:800;cursor:pointer;box-shadow:inset 0 0 0 2px rgba(255,255,255,.85)}
.mail-layout{height:calc(100% - 64px);display:flex}.sidebar{width:var(--sidebar-w);flex:0 0 var(--sidebar-w);padding:8px 10px 14px;display:flex;flex-direction:column;transition:width .18s,flex-basis .18s;overflow:hidden}.sidebar.collapsed{width:74px;flex-basis:74px}.compose-button{width:146px;height:56px;border:0;border-radius:16px;background:var(--blue-soft);color:var(--text);display:flex;align-items:center;gap:12px;padding:0 20px;font-weight:600;cursor:pointer;margin:0 0 14px 0;box-shadow:0 1px 2px rgba(0,0,0,.06);transition:.15s}.compose-button:hover{box-shadow:0 4px 10px rgba(0,0,0,.09)}.compose-button .icon-slot{width:24px;height:24px}.sidebar.collapsed .compose-button{width:56px;padding:0;justify-content:center;border-radius:16px}.sidebar.collapsed .compose-label,.sidebar.collapsed .folder-label,.sidebar.collapsed .folder-count,.sidebar.collapsed .sidebar-logout span:last-child{display:none}
.folder-list{display:flex;flex-direction:column;gap:1px;overflow:auto}.folder-item{height:32px;border:0;background:transparent;border-radius:0 16px 16px 0;display:flex;align-items:center;gap:16px;padding:0 14px;cursor:pointer;color:var(--text);text-align:left;white-space:nowrap}.folder-item:hover{background:var(--surface-3)}.folder-item.active{background:var(--blue-soft);font-weight:700}.folder-item .icon-slot{width:19px;height:19px;color:var(--muted)}.folder-item.active .icon-slot{color:var(--blue)}.folder-label{flex:1;overflow:hidden;text-overflow:ellipsis}.folder-count{font-size:12px}.sidebar.collapsed .folder-item{width:44px;border-radius:50%;padding:0;justify-content:center;margin:0 auto}.sidebar-bottom{margin-top:auto;border-top:1px solid var(--line-soft);padding-top:8px}.sidebar-logout{height:36px;width:100%;border:0;background:transparent;border-radius:18px;display:flex;align-items:center;gap:16px;padding:0 14px;color:var(--muted);cursor:pointer}.sidebar-logout:hover{background:var(--surface-3);color:var(--text)}.sidebar.collapsed .sidebar-logout{width:44px;padding:0;justify-content:center;margin:auto}
.content-shell{flex:1;min-width:0;background:var(--surface);border-radius:18px 18px 0 0;margin-right:12px;overflow:hidden;position:relative}.list-view,.thread-view{height:100%;overflow:hidden}.mail-toolbar{height:48px;display:flex;align-items:center;justify-content:space-between;padding:0 10px;border-bottom:1px solid var(--line-soft)}.toolbar-left,.toolbar-right,.selection-actions{display:flex;align-items:center;gap:2px}.check-wrap{display:inline-flex;width:40px;height:40px;align-items:center;justify-content:center;cursor:pointer}.check-wrap input{width:16px;height:16px;accent-color:var(--blue)}.pagination-label{font-size:12px;color:var(--muted);margin-right:6px}.folder-heading-row{height:42px;display:flex;align-items:center;padding:0 18px;border-bottom:1px solid var(--line-soft);gap:12px}.folder-heading-row h2{font-size:14px;margin:0;font-weight:650}.search-state{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.message-list{height:calc(100% - 90px);overflow:auto}
.message-row{
  height:var(--row-h);
  display:grid;
  grid-template-columns:36px 34px 34px minmax(180px,250px) minmax(0,1fr) 132px;
  align-items:center;
  border-bottom:1px solid var(--line-soft);
  padding:0 8px 0 2px;
  background:var(--surface);
  cursor:pointer;
  box-shadow:inset 0 -1px 0 rgba(100,121,143,.02)
}
.message-row:hover{box-shadow:inset 2px 0 0 var(--blue),0 1px 4px rgba(60,64,67,.12);position:relative;z-index:1}
.message-row.unread{background:color-mix(in srgb,var(--surface) 92%,var(--blue-soft) 8%);color:var(--text)}
.message-row.read{color:var(--muted)}
.row-check{display:flex;justify-content:center}
.row-check input{width:16px;height:16px;accent-color:var(--blue)}
.star-button,.importance-button{
  width:32px;height:32px;border:0;background:transparent;border-radius:50%;cursor:pointer;
  color:#a8aeb7;display:flex;align-items:center;justify-content:center;padding:6px
}
.star-button svg,.importance-button svg{width:20px;height:20px}
.star-button:hover,.importance-button:hover{background:var(--surface-3)}
.star-button.starred{color:#f9ab00}
.importance-button.important{color:#f9ab00}
.sender{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:18px;font-size:14px;min-width:0}
.sender-name{overflow:hidden;text-overflow:ellipsis}
.message-row.unread .sender-name,.message-row.unread .subject-text{font-weight:700;color:var(--text)}
.thread-count{font-size:12px;margin-left:4px;color:inherit;font-weight:500}
.subject-snippet{display:flex;align-items:baseline;min-width:0;font-size:14px;overflow:hidden;white-space:nowrap}
.subject-text{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}
.message-row.read .subject-text{color:var(--text);font-weight:400}
.snippet-separator{flex:0 0 auto;color:var(--muted);font-weight:400}
.snippet{flex:1 1 auto;min-width:0;font-weight:400;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-end{height:100%;min-width:132px;display:flex;align-items:center;justify-content:flex-end;position:relative}
.row-date{font-size:12px;white-space:nowrap;text-align:right;font-weight:inherit}
.message-row.unread .row-date{font-weight:700;color:var(--text)}
.row-hover-actions{display:none;align-items:center;justify-content:flex-end;gap:0}
.message-row:hover .row-date{display:none}
.message-row:hover .row-hover-actions{display:flex}
.empty-state{height:calc(100% - 90px);display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--muted);text-align:center}.empty-state .empty-icon{width:48px;height:48px;opacity:.45}.empty-state h3{margin:14px 0 4px;color:var(--text)}.empty-state p{margin:0;font-size:14px}

/* Thread */
.thread-view{overflow:auto}.thread-toolbar{position:sticky;top:0;background:var(--surface);z-index:4}.thread-content{max-width:920px;margin:0 auto;padding:22px 34px 80px}.thread-title-row{display:flex;align-items:flex-start;gap:12px;margin-bottom:20px}.thread-title-row h1{font-size:22px;line-height:1.3;font-weight:500;margin:3px 0 0;flex:1}.thread-messages{display:grid;gap:10px}.thread-message{border:1px solid var(--line);border-radius:14px;background:var(--surface);overflow:hidden}.thread-message-head{display:grid;grid-template-columns:44px 1fr auto;gap:12px;padding:14px 16px;align-items:start}.sender-avatar{width:40px;height:40px;border-radius:50%;background:var(--surface-3);display:grid;place-items:center;font-size:12px;font-weight:800;color:var(--muted)}.thread-sender{font-size:14px;font-weight:700}.thread-recipients,.thread-date{font-size:12px;color:var(--muted);margin-top:2px}.thread-date{white-space:nowrap}.message-remote-note{margin:0 16px 12px;padding:8px 10px;border-radius:8px;background:var(--surface-2);font-size:12px;color:var(--muted);display:flex;align-items:center;justify-content:space-between;gap:10px}.message-body{padding:4px 16px 18px;font-size:14px;line-height:1.6;overflow-wrap:anywhere}.message-body img{max-width:100%;height:auto}.message-body table{max-width:100%}.message-body pre{white-space:pre-wrap;font-family:inherit}.attachment-list{display:flex;flex-wrap:wrap;gap:8px;padding:0 16px 16px}.attachment-chip{border:1px solid var(--line);background:var(--surface-2);border-radius:10px;padding:9px 11px;display:flex;align-items:center;gap:8px;text-decoration:none;color:var(--text);font-size:13px}.attachment-chip:hover{border-color:var(--blue)}.thread-reply-actions{display:flex;gap:10px;margin-top:22px}

/* Composer */
.composer{position:fixed;right:22px;bottom:0;width:min(560px,calc(100vw - 30px));height:600px;max-height:calc(100vh - 80px);background:var(--surface);border-radius:10px 10px 0 0;box-shadow:0 10px 38px rgba(0,0,0,.24);z-index:70;display:flex;flex-direction:column;overflow:visible}.composer.expanded{inset:40px 8vw 24px;width:auto;height:auto;max-height:none;border-radius:14px}.composer.minimized{height:42px;width:320px}.composer.minimized .composer-fields,.composer.minimized .compose-body,.composer.minimized .composer-footer,.composer.minimized .compose-attachments{display:none}.composer-head{height:42px;flex:0 0 42px;background:#40444b;color:#fff;border-radius:10px 10px 0 0;display:flex;align-items:center;justify-content:space-between;padding:0 8px 0 14px;font-size:13px;font-weight:700}.composer-window-actions{display:flex}.composer-window-actions .icon-button{color:#e8eaed}.composer-window-actions .icon-button:hover{background:rgba(255,255,255,.12)}.composer-fields{flex:0 0 auto}.recipient-row,.subject-row{min-height:38px;border-bottom:1px solid var(--line-soft);display:flex;align-items:center;position:relative;padding:0 12px;gap:8px}.recipient-row>span{font-size:13px;color:var(--muted);width:28px}.recipient-row input,.subject-row input{border:0;outline:0;background:transparent;color:var(--text);flex:1;min-width:0;font-size:14px}.suggestions{position:absolute;top:36px;left:45px;right:10px;background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:10px;z-index:80;max-height:220px;overflow:auto}.suggestion{padding:9px 11px;display:flex;flex-direction:column;cursor:pointer}.suggestion:hover{background:var(--surface-2)}.suggestion b{font-size:13px}.suggestion span{font-size:12px;color:var(--muted)}.compose-body{flex:1;min-height:180px;padding:14px 16px;outline:0;overflow:auto;font-size:14px;line-height:1.55}.compose-body:empty:before{content:"Escreva uma mensagem";color:var(--muted)}.compose-attachments{display:flex;gap:7px;flex-wrap:wrap;padding:0 12px}.compose-file{display:flex;align-items:center;gap:6px;background:var(--surface-2);border-radius:8px;padding:6px 8px;font-size:12px}.compose-file button{border:0;background:transparent;cursor:pointer;color:var(--muted)}.composer-footer{height:54px;flex:0 0 54px;display:flex;align-items:center;justify-content:space-between;padding:7px 10px}.composer-send-side,.composer-end-side{display:flex;align-items:center;gap:4px}.send-button{height:36px;padding:0 20px;border-radius:18px}.draft-state{font-size:11px;color:var(--muted);margin-right:4px}

/* Settings / menus */
.settings-panel{position:fixed;top:64px;right:0;bottom:0;width:min(390px,94vw);background:var(--surface);z-index:90;box-shadow:-10px 0 30px rgba(0,0,0,.12);padding:18px;overflow:auto}.settings-head{display:flex;align-items:center;justify-content:space-between}.settings-head h2{font-size:18px;margin:0}.settings-section{padding:18px 0;border-bottom:1px solid var(--line-soft)}.settings-section h3{font-size:13px;margin:0 0 12px;color:var(--muted)}.segmented{display:flex;border:1px solid var(--line);border-radius:12px;overflow:hidden}.segmented button{flex:1;border:0;border-right:1px solid var(--line);background:var(--surface);padding:10px;cursor:pointer}.segmented button:last-child{border-right:0}.segmented button.active{background:var(--blue-soft);color:var(--blue);font-weight:700}.segmented.vertical{display:grid}.segmented.vertical button{border-right:0;border-bottom:1px solid var(--line);text-align:left}.segmented.vertical button:last-child{border-bottom:0}.toggle-line{display:flex;align-items:center;justify-content:space-between;gap:15px;font-size:14px;margin:10px 0}.toggle-line input{accent-color:var(--blue);width:18px;height:18px}.settings-note{font-size:12px;color:var(--muted);line-height:1.5;padding-top:18px}.panel-scrim,.sidebar-scrim{position:fixed;inset:0;background:rgba(0,0,0,.18);z-index:85}.account-popover{position:fixed;right:12px;top:58px;width:290px;background:var(--surface);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);z-index:95;padding:20px;text-align:center}.account-avatar{width:64px;height:64px;border-radius:50%;background:var(--pink);color:white;display:grid;place-items:center;margin:0 auto 12px;font-weight:800}.account-name{font-weight:700}.account-email{font-size:13px;color:var(--muted);margin:4px 0 18px}.floating-menu{position:fixed;z-index:110;min-width:210px;max-height:320px;overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);padding:6px}.floating-menu button{width:100%;height:36px;border:0;background:transparent;text-align:left;border-radius:7px;padding:0 10px;cursor:pointer}.floating-menu button:hover{background:var(--surface-2)}.toast-region{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:140;display:grid;gap:8px}.toast{background:#303134;color:#fff;padding:11px 16px;border-radius:6px;box-shadow:var(--shadow);font-size:13px;min-width:220px;max-width:min(520px,90vw)}.toast.error{background:#8c1d18}.toast.success{background:#1e5e38}

@media(max-width:900px){
  .topbar{grid-template-columns:auto 1fr auto}.mail-brand span{display:none}.topbar-left{min-width:48px}.sidebar{position:fixed;top:64px;bottom:0;left:0;background:var(--surface);z-index:88;transform:translateX(-105%);box-shadow:var(--shadow);width:270px;flex-basis:270px}.sidebar.mobile-open{transform:translateX(0)}.sidebar.collapsed{width:270px;flex-basis:270px}.sidebar.collapsed .compose-label,.sidebar.collapsed .folder-label,.sidebar.collapsed .folder-count,.sidebar.collapsed .sidebar-logout span:last-child{display:inline}.sidebar.collapsed .compose-button{width:146px;padding:0 20px;justify-content:flex-start}.sidebar.collapsed .folder-item{width:auto;border-radius:0 16px 16px 0;padding:0 14px;justify-content:flex-start;margin:0}.content-shell{margin:0 8px 0 8px}.desktop-only{display:none}.thread-content{padding:18px 22px 70px}.login-card{margin-left:auto}.login-view::after{background:rgba(251,247,238,.42)}
}
@media(max-width:640px){
  body{overflow:hidden}.topbar{height:58px;padding:6px 8px;gap:6px}.mail-layout{height:calc(100% - 58px)}.sidebar{top:58px}.search-box{height:42px;border-radius:21px;padding:0 10px}.search-box input{font-size:14px}.topbar-right{gap:0}.topbar-right #settings-button{display:inline-flex}.content-shell{margin:0;border-radius:14px 14px 0 0}.folder-heading-row{display:none}.mail-toolbar{height:46px}.message-list{height:calc(100% - 46px)}.message-row{
  min-height:66px;height:auto;
  grid-template-columns:32px 32px minmax(0,1fr) auto;
  grid-template-areas:"star important sender date" "star important subject subject";
  padding:8px 10px
}
.row-check{display:none}
.star-button{grid-area:star;align-self:start}
.importance-button{grid-area:important;align-self:start}
.sender{grid-area:sender;font-size:14px;padding-right:8px}
.subject-snippet{grid-area:subject;display:flex;min-width:0;font-size:13px}
.subject-text{display:block;max-width:none;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis}
.snippet-separator{display:inline}
.snippet{display:block;font-size:12px;margin-top:0;min-width:0}
.row-end{grid-area:date;min-width:0;height:auto;align-self:start}
.row-date{margin-left:8px}
.row-hover-actions{display:none!important}
.message-row:hover .row-date{display:block}.pagination-label{display:none}.thread-content{padding:14px 12px 70px}.thread-title-row h1{font-size:19px}.thread-message{border-left:0;border-right:0;border-radius:0}.thread-message-head{grid-template-columns:38px 1fr auto;padding:12px 4px}.sender-avatar{width:34px;height:34px}.message-body{padding:4px 4px 18px}.attachment-list{padding-left:4px;padding-right:4px}.composer,.composer.expanded{inset:0;width:100%;height:100%;max-height:none;border-radius:0}.composer-head{border-radius:0;height:48px;flex-basis:48px}.composer.minimized{inset:auto 8px 0 8px;width:auto;height:48px;max-height:48px}.login-view{padding:18px;align-items:center}.login-background{opacity:.58}.login-view::after{background:linear-gradient(rgba(251,247,238,.45),rgba(251,247,238,.62))}.login-card{padding:26px 22px 22px;border-radius:22px;margin:0}.brand-lockup{margin-bottom:26px}.brand-logo{width:50px;height:46px}.login-copy h1{font-size:25px}.account-popover{right:8px;left:8px;width:auto}.settings-panel{top:58px}
}

/* ===== AcervoMED Mail V2 ===== */
.sidebar-tools{margin-top:10px;padding-top:8px;border-top:1px solid var(--line-soft)}.folder-item.utility{color:var(--muted)}.folder-item.drag-target{background:var(--blue-soft);outline:1px dashed var(--blue)}
.mini-select,.identity-row select,.select-line select,.form-grid input,.form-grid select,.form-grid textarea,.resource-toolbar input,.schedule-panel input{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:9px;padding:8px 10px;outline:none}.mini-select{padding:6px 8px;font-size:12px}.mini-select:focus,.form-grid input:focus,.form-grid select:focus,.form-grid textarea:focus,.resource-toolbar input:focus,.schedule-panel input:focus{border-color:var(--blue);box-shadow:0 0 0 2px color-mix(in srgb,var(--blue) 15%,transparent)}
.message-row.current{box-shadow:inset 3px 0 0 var(--blue);background:var(--blue-soft-2)}.draft-label{color:var(--pink)}.scheduled-label{color:var(--teal)}.skeleton{opacity:.45}.rule-state{width:10px;height:10px;border-radius:50%;background:var(--line);display:block}.rule-state.on{background:var(--success)}
.content-shell.pane-right{display:grid;grid-template-columns:minmax(350px,45%) 1fr}.content-shell.pane-bottom{display:grid;grid-template-rows:minmax(260px,45%) 1fr}.content-shell.pane-right>.list-view,.content-shell.pane-bottom>.list-view,.content-shell.pane-right>.thread-view,.content-shell.pane-bottom>.thread-view{display:block!important;min-width:0;min-height:0}.content-shell.pane-right>.thread-view{border-left:1px solid var(--line)}.content-shell.pane-bottom>.thread-view{border-top:1px solid var(--line)}.content-shell.pane-right .thread-content{padding:18px 20px 60px}.content-shell.pane-bottom .thread-content{padding:18px 28px 60px}.content-shell.pane-right .thread-title-row h1{font-size:18px}.content-shell.pane-right .thread-message-head{grid-template-columns:38px 1fr}.content-shell.pane-right .thread-date{grid-column:2}.content-shell.pane-right .thread-toolbar #back-to-list,.content-shell.pane-bottom .thread-toolbar #back-to-list{display:inline-flex}
.identity-row{min-height:38px;border-bottom:1px solid var(--line-soft);display:flex;align-items:center;padding:0 12px;gap:8px}.identity-row>span{font-size:13px;color:var(--muted);width:28px}.identity-row select{flex:1;border:0;border-radius:0;padding:4px 0;background:transparent}
.split-send{display:flex}.split-send .send-button{border-radius:18px 0 0 18px;padding-right:16px}.send-options{height:36px;min-width:30px;border:0;border-left:1px solid rgba(255,255,255,.3);border-radius:0 18px 18px 0;background:var(--blue);color:#fff;cursor:pointer}.send-options:hover{background:var(--blue-hover)}.format-divider{width:1px;height:24px;background:var(--line);margin:0 3px}.compose-dropzone{position:absolute;inset:42px 0 54px;z-index:91;background:color-mix(in srgb,var(--blue-soft) 88%,transparent);border:3px dashed var(--blue);display:grid;place-items:center;font-weight:700;color:var(--blue);pointer-events:none}.composer-menu{position:absolute;bottom:52px;left:10px;z-index:94;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);padding:6px;min-width:190px}.composer-menu button{width:100%;display:flex;align-items:center;gap:9px;border:0;background:transparent;padding:9px;border-radius:7px;cursor:pointer;text-align:left}.composer-menu button:hover{background:var(--surface-2)}.schedule-panel{position:absolute;bottom:58px;left:10px;width:min(370px,calc(100% - 20px));z-index:95;background:var(--surface);border:1px solid var(--line);border-radius:13px;box-shadow:var(--shadow);padding:14px}.schedule-panel strong{font-size:14px}.schedule-panel p{font-size:12px;color:var(--muted);line-height:1.45;margin:6px 0 12px}.schedule-panel input{width:100%;margin-bottom:10px}.small-button{padding:8px 13px!important;font-size:12px}.danger-button{border:0;background:color-mix(in srgb,var(--danger) 12%,transparent);color:var(--danger);border-radius:999px;padding:10px 17px;font-weight:700;cursor:pointer}
.settings-scroll{overflow:auto;max-height:calc(100vh - 120px)}.select-line{display:flex;align-items:center;justify-content:space-between;gap:14px;font-size:14px;margin:10px 0}.select-line select{min-width:140px}.toggle-line.compact{border:1px solid var(--line);border-radius:10px;padding:8px 10px;margin:0}.version-tag{display:inline-block;margin:0 0 14px;padding:4px 8px;border-radius:999px;background:var(--surface-2);font-size:11px;color:var(--muted)}
.modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.38);display:grid;place-items:center;padding:18px;z-index:150;backdrop-filter:blur(2px)}.modal-card{width:min(540px,100%);max-height:min(86vh,820px);overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:18px;box-shadow:0 24px 80px rgba(0,0,0,.22);padding:20px}.modal-card.wide{width:min(820px,100%)}.modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.modal-head>div{display:flex;align-items:center;gap:6px}.modal-head h2{font-size:19px;margin:0}.modal-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:16px}.form-grid{display:grid;gap:13px}.form-grid.two{grid-template-columns:1fr 1fr}.form-grid label{display:grid;gap:6px;font-size:12px;font-weight:700;color:var(--muted)}.form-grid textarea{resize:vertical;min-height:80px}.resource-toolbar{display:flex;gap:8px;align-items:center;margin-bottom:14px}.resource-toolbar input{flex:1;min-width:130px}.resource-list{display:grid;border-top:1px solid var(--line-soft)}.resource-row{width:100%;min-height:60px;border:0;border-bottom:1px solid var(--line-soft);background:transparent;color:var(--text);display:grid;grid-template-columns:42px 1fr auto;align-items:center;gap:10px;padding:8px 6px;text-align:left;cursor:pointer}.resource-row:hover{background:var(--surface-2)}.resource-row>span:nth-child(2){min-width:0}.resource-row b,.resource-row small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.resource-row b{font-size:14px}.resource-row small{font-size:12px;color:var(--muted);margin-top:3px}.resource-avatar{width:36px;height:36px;border-radius:50%;display:grid!important;place-items:center;background:var(--surface-3);font-weight:800;font-size:11px}.resource-actions{display:flex!important;align-items:center}.resource-note,.resource-empty{font-size:13px;color:var(--muted);padding:18px 6px;line-height:1.5}.preview-card{width:min(1000px,96vw);height:min(86vh,820px);display:flex;flex-direction:column;overflow:hidden}.preview-body{flex:1;min-height:0;background:var(--surface-2);border-radius:12px;overflow:auto;display:grid;place-items:center}.preview-body img{max-width:100%;max-height:100%;object-fit:contain}.preview-body iframe{border:0;width:100%;height:100%;background:#fff}.inline-actions{padding:0 16px 16px;margin-top:0}.quoted-meta{color:var(--muted);font-size:12px}.quoted-mail blockquote{margin:8px 0 0 8px;padding-left:12px;border-left:1px solid var(--line)}
.undo-send-bar{position:fixed;left:24px;bottom:24px;z-index:210;min-width:320px;max-width:calc(100vw - 48px);background:#303134;color:#fff;border-radius:7px;box-shadow:var(--shadow);padding:12px 14px;display:flex;align-items:center;gap:16px;font-size:13px}.undo-send-bar button{border:0;background:transparent;color:#8ab4f8;font-weight:800;cursor:pointer;margin-left:auto}.undo-send-bar span:last-child{color:#c6c8cc;min-width:24px;text-align:right}
@media(max-width:900px){.content-shell.pane-right,.content-shell.pane-bottom{display:block}.resource-toolbar{flex-wrap:wrap}.resource-toolbar input{flex-basis:100%}.settings-scroll{max-height:calc(100vh - 105px)}}
@media(max-width:640px){.mini-select{display:none}.form-grid.two{grid-template-columns:1fr}.modal-backdrop{padding:0}.modal-card,.modal-card.wide{width:100%;height:100%;max-height:none;border-radius:0;padding:16px}.preview-card{width:100%;height:100%;max-height:none}.resource-row{grid-template-columns:38px 1fr auto}.undo-send-bar{left:10px;right:10px;bottom:10px;min-width:0;max-width:none}.composer-menu,.schedule-panel{bottom:56px}.format-divider,.format-button:nth-of-type(n+5){display:none}.mobile-settings{display:block}.topbar-right #contacts-button{display:none}}

/* V2 — contas adicionais temporárias */
.account-switch-list{width:100%;display:grid;gap:5px;margin:14px 0 10px;padding-top:12px;border-top:1px solid var(--line,#e3e6ea)}
.account-switch-row{display:flex;align-items:center;gap:4px;border-radius:12px}
.account-switch-row.active{background:var(--surface-2)}
.account-switch-main{min-width:0;flex:1;display:flex;align-items:center;gap:9px;border:0;background:transparent;color:inherit;padding:8px 7px;border-radius:12px;text-align:left;cursor:pointer}
.account-switch-main:not(:disabled):hover{background:var(--surface-2)}
.account-switch-main:disabled{cursor:default;opacity:1}
.mini-avatar{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--blue-soft);color:var(--blue);font-size:11px;font-weight:700;flex:0 0 auto}
.account-switch-email{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;flex:1}
.account-active-mark{font-weight:700;color:var(--blue)}
.account-remove{width:30px;height:30px;border:0;border-radius:50%;background:transparent;color:var(--muted,#5f6368);font-size:20px;cursor:pointer;line-height:1}
.account-remove:hover{background:var(--surface-2);color:var(--text)}
.compact-modal{max-width:460px}


/* V2.0.2 — leitura Gmail-like: o conteúdo da mensagem permanece claro em qualquer tema */
html[data-theme="dark"] .thread-view{
  background:#fff;
  color:#202124;
}
html[data-theme="dark"] .thread-view .thread-toolbar{
  background:var(--surface);
  color:var(--text);
  border-bottom-color:var(--line-soft);
}
html[data-theme="dark"] .thread-view .thread-content{
  background:#fff;
  color:#202124;
}
html[data-theme="dark"] .thread-view .thread-title-row h1,
html[data-theme="dark"] .thread-view .thread-sender,
html[data-theme="dark"] .thread-view .message-body{
  color:#202124;
}
html[data-theme="dark"] .thread-view .thread-recipients,
html[data-theme="dark"] .thread-view .thread-date{
  color:#5f6368;
}
html[data-theme="dark"] .thread-view .thread-message{
  background:#fff;
  border-color:#dadce0;
}
html[data-theme="dark"] .thread-view .sender-avatar{
  background:#f1f3f4;
  color:#5f6368;
}
html[data-theme="dark"] .thread-view .message-remote-note{
  background:#f1f3f4;
  color:#5f6368;
}
html[data-theme="dark"] .thread-view .attachment-chip{
  background:#fff;
  border-color:#dadce0;
  color:#202124;
}
html[data-theme="dark"] .thread-view .outline-button{
  background:#fff;
  color:#202124;
  border-color:#dadce0;
}
html[data-theme="dark"] .content-shell.pane-right>.thread-view{
  border-left-color:#3c4043;
}
html[data-theme="dark"] .content-shell.pane-bottom>.thread-view{
  border-top-color:#3c4043;
}

/* Editor de assinatura */
.settings-action-button{margin-top:12px}
.settings-inline-note{font-size:11px;color:var(--muted);line-height:1.45;margin:8px 0 0}
.signature-modal-card{width:min(720px,94vw)}
.signature-toolbar{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.signature-editor{
  min-height:220px;
  max-height:46vh;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px;
  outline:none;
  background:#fff;
  color:#202124;
  font-size:14px;
  line-height:1.55;
}
.signature-editor:focus{border-color:var(--blue);box-shadow:0 0 0 2px color-mix(in srgb,var(--blue) 18%,transparent)}
.signature-editor img{max-width:100%;height:auto}
.signature-editor a{color:#0b57d0}

html[data-theme="dark"] .thread-view .thread-content .icon-button{color:#5f6368}
html[data-theme="dark"] .thread-view .thread-content .icon-button:hover{background:#f1f3f4;color:#202124}


/* V2.0.5 — toolbar de leitura compacta no padrão Gmail */
.thread-toolbar{
  height:56px;
  min-height:56px;
  padding:0 16px;
  border-bottom:1px solid var(--line-soft);
}
.thread-toolbar-left{
  gap:0;
  min-width:0;
}
.thread-toolbar .thread-back{
  margin-right:22px;
}
.thread-tool-group{
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.thread-toolbar .thread-tool,
.thread-toolbar .thread-nav-button{
  width:36px;
  height:36px;
  flex:0 0 36px;
  border-radius:50%;
}
.thread-toolbar .thread-tool .icon-slot,
.thread-toolbar .thread-nav-button .icon-slot{
  width:19px;
  height:19px;
}
.thread-toolbar-separator{
  width:1px;
  height:24px;
  background:var(--line);
  margin:0 9px;
  flex:0 0 1px;
  opacity:.85;
}
.thread-toolbar-right{
  gap:3px;
  margin-left:auto;
}
.thread-pagination-label{
  min-width:76px;
  margin-right:10px;
  color:var(--muted);
  font-size:12px;
  line-height:1;
  text-align:right;
  white-space:nowrap;
}
.thread-toolbar .icon-button:hover{
  background:var(--surface-3);
}
.thread-toolbar .icon-button:disabled{
  opacity:.32;
  background:transparent;
}

/* O assunto começa com o mesmo respiro horizontal da mensagem, como no Gmail. */
.thread-content{
  max-width:none;
  margin:0;
  padding:24px 28px 80px 90px;
}
.thread-title-row{
  align-items:center;
  gap:8px;
  margin-bottom:20px;
}
.thread-title-row h1{
  margin:0;
  font-size:22px;
  line-height:1.35;
}

@media(max-width:900px){
  .thread-toolbar{padding:0 10px}
  .thread-toolbar .thread-back{margin-right:10px}
  .thread-toolbar-separator{margin:0 5px}
  .thread-pagination-label{min-width:auto;margin-right:4px}
  .thread-content{padding:18px 20px 70px}
}
@media(max-width:640px){
  .thread-toolbar{height:52px;min-height:52px;padding:0 4px}
  .thread-toolbar .thread-tool,
  .thread-toolbar .thread-nav-button{width:34px;height:34px;flex-basis:34px}
  .thread-toolbar .thread-back{margin-right:2px}
  .thread-tool-group{gap:0}
  .thread-toolbar-separator{margin:0 2px;height:22px}
  .thread-pagination-label{display:none}
  .thread-toolbar-right{gap:0}
  .thread-content{padding:14px 12px 70px}
}


/* V2.1.0 — tipografia e gerenciamento inspirados no Gmail */
body,.message-row,.message-body,.thread-message,.composer{font-family:var(--font-ui)}
.mail-brand,.search-box,.compose-button,.folder-item,.mail-toolbar,.folder-heading-row,.account-popover,.modal-head,.primary-button,.outline-button{font-family:var(--font-google)}
.folder-item{font-size:14px;font-weight:400;letter-spacing:.005em}
.folder-item.active{font-weight:700}
.message-row{font-size:14px}
.sender,.subject-snippet{font-family:var(--font-ui)}

.folder-manager-head{height:30px;display:flex;align-items:center;justify-content:space-between;padding:0 8px 0 14px;margin:0 0 2px;color:var(--muted)}
.folder-manager-title{font-size:12px;font-weight:500;letter-spacing:.02em}
.folder-manager-head-actions{display:flex;align-items:center}
.folder-manager-actions{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:3px 6px 7px 10px;border-bottom:1px solid var(--line-soft);margin-bottom:3px}
.folder-manager-add{display:inline-flex;align-items:center;gap:5px;color:var(--blue);font-weight:500}
.folder-manager-add .icon-slot{width:16px;height:16px}
.folder-manager-save-group{display:flex;align-items:center;gap:4px}
.folder-save-button{border:0;border-radius:999px;background:var(--blue);color:#fff;font-weight:600;padding:6px 12px;cursor:pointer}
.folder-save-button:disabled{opacity:.55}
.folder-edit-row{position:relative;display:flex;align-items:center;min-width:0}
.folder-edit-row>.folder-item{flex:1;min-width:0;padding-left:calc(14px + var(--folder-depth,0)*12px)}
.folder-edit-controls{display:flex;align-items:center;gap:0;padding-right:2px}
.folder-inline-action.delete,.folder-edit-controls .delete{color:var(--danger)}
.folder-edit-row.pending-delete>.folder-item{opacity:.48;text-decoration:line-through}
.folder-edit-row.pending-delete{background:color-mix(in srgb,var(--danger) 7%,transparent)}
.folder-edit-row.pending-create>.folder-item{color:var(--blue)}
.folder-pending-badge{font-size:10px;border-radius:999px;padding:2px 6px;background:var(--blue-soft);color:var(--blue);margin-left:auto}
.sidebar.collapsed .folder-manager-title,.sidebar.collapsed .folder-manager-actions{display:none}
.sidebar.collapsed .folder-manager-head{justify-content:center;padding:0}
.sidebar.collapsed .folder-edit-controls{display:none}

.google-account-action{width:100%;min-height:40px;border:1px solid var(--line);border-radius:999px;background:transparent;color:var(--blue);display:flex;align-items:center;justify-content:center;gap:8px;font-weight:500;cursor:pointer;margin:0 0 14px;padding:8px 14px}
.google-account-action:hover{background:var(--blue-soft-2)}
.google-account-action .icon-slot{width:17px;height:17px}
.account-switch-list{margin-top:4px}
.identity-modal-card{width:min(620px,94vw)}
.identity-note{padding-top:0}
.identity-standard-row{font-size:13px!important;color:var(--text)!important;font-weight:500!important}
.identity-signature-link{justify-content:center}
.compact-note{padding:4px 0 0;min-height:20px}
.folder-safe-note{padding:0;margin:0}

@media(max-width:900px){.folder-manager-head{padding-left:14px}.sidebar.collapsed .folder-manager-title{display:inline}.sidebar.collapsed .folder-manager-head{justify-content:space-between;padding:0 8px 0 14px}.sidebar.collapsed .folder-manager-actions{display:flex}.sidebar.collapsed .folder-edit-controls{display:flex}}


/* V2.1.1 — tipografia calibrada pelos valores medidos no Gmail */
body{
  font-family:var(--font-google);
  font-weight:400;
}
.folder-item,
.message-row,
.sender,
.subject-snippet,
.folder-heading-row,
.search-modal,
.search-modal input,
.search-modal label{
  font-family:var(--font-google);
  font-size:14px;
  line-height:20px;
  font-weight:400;
}
.folder-item.active,
.message-row.unread .sender-name,
.message-row.unread .subject-text{
  font-weight:700;
}
.pagination-label,
.thread-pagination-label{
  font-family:var(--font-google);
  font-size:12px;
  line-height:normal;
  font-weight:400;
}
.thread-title-row h1{
  font-family:var(--font-google);
  font-size:22px;
  line-height:28px;
  font-weight:400;
  letter-spacing:0;
}
.thread-sender{
  font-family:var(--font-google);
  font-size:14px;
  line-height:20px;
  font-weight:700;
}
.thread-recipients,
.thread-date{
  font-family:var(--font-google);
  font-size:12px;
  line-height:20px;
  font-weight:400;
}
.search-suggestions,
.search-suggestions button,
.resource-row{
  font-family:var(--font-google);
  font-size:14px;
  line-height:normal;
  font-weight:400;
}

/* Hover card de contato, exibido após 1 segundo */
.contact-hover-target{cursor:pointer}
.contact-hover-card{
  position:fixed;
  z-index:180;
  width:360px;
  max-width:calc(100vw - 24px);
  background:var(--surface);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 8px 28px rgba(60,64,67,.24);
  overflow:hidden;
  font-family:var(--font-google);
}
.contact-hover-main{
  display:flex;
  align-items:flex-start;
  gap:16px;
  padding:20px 20px 16px;
}
.contact-hover-avatar{
  width:56px;
  height:56px;
  flex:0 0 56px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:var(--blue-soft);
  color:var(--blue);
  font-size:18px;
  line-height:24px;
  font-weight:700;
}
.contact-hover-copy{
  min-width:0;
  flex:1;
  padding-top:2px;
}
.contact-hover-name{
  font-size:18px;
  line-height:24px;
  font-weight:500;
  color:var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.contact-hover-email{
  margin-top:2px;
  font-size:13px;
  line-height:20px;
  font-weight:400;
  color:var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.contact-hover-meta{
  margin-top:5px;
  font-size:12px;
  line-height:18px;
  color:var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.contact-hover-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  border-top:1px solid var(--line-soft);
}
.contact-hover-action{
  min-height:54px;
  border:0;
  background:transparent;
  color:var(--blue);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  font-family:var(--font-google);
  font-size:13px;
  line-height:18px;
  font-weight:500;
}
.contact-hover-action+ .contact-hover-action{
  border-left:1px solid var(--line-soft);
}
.contact-hover-action:hover{background:var(--surface-2)}
.contact-hover-action svg{
  width:18px;
  height:18px;
  flex:0 0 18px;
}
html[data-theme="dark"] .contact-hover-card{
  background:#fff;
  color:#1f1f1f;
  border-color:#dadce0;
}
html[data-theme="dark"] .contact-hover-card .contact-hover-name{color:#1f1f1f}
html[data-theme="dark"] .contact-hover-card .contact-hover-email,
html[data-theme="dark"] .contact-hover-card .contact-hover-meta{color:#5f6368}
html[data-theme="dark"] .contact-hover-card .contact-hover-actions{border-top-color:#e8eaed}
html[data-theme="dark"] .contact-hover-card .contact-hover-action+ .contact-hover-action{border-left-color:#e8eaed}
html[data-theme="dark"] .contact-hover-card .contact-hover-action:hover{background:#f8fafd}
html[data-theme="dark"] .contact-hover-card .contact-hover-avatar{background:#d3e3fd;color:#0b57d0}

@media(max-width:640px){
  .thread-title-row h1{
    font-size:20px;
    line-height:26px;
  }
  .contact-hover-card{display:none!important}
}


/* =========================================================
   V2.1.2 — revisão responsiva
   ========================================================= */

/* Tablet / mobile: o login nunca fica ancorado à direita. */
@media (max-width:900px){
  .login-view{
    display:grid;
    place-items:center;
    justify-items:center;
    padding-inline:max(0.4mm, env(safe-area-inset-left));
  }
  .login-card{
    width:min(520px, calc(100vw - 0.8mm));
    max-width:calc(100vw - 0.8mm);
    margin:0 auto!important;
    justify-self:center;
  }

  .sidebar{
    width:min(270px, calc(100vw - 38px));
    flex-basis:min(270px, calc(100vw - 38px));
  }
  .sidebar.collapsed{
    width:min(270px, calc(100vw - 38px));
    flex-basis:min(270px, calc(100vw - 38px));
  }

  .topbar{
    min-width:0;
  }
  .topbar>*{
    min-width:0;
  }
  .search-box{
    min-width:0;
    width:100%;
  }
}

/* Celulares em retrato. */
@media (max-width:640px){
  .login-view{
    padding:
      max(8px, env(safe-area-inset-top))
      max(0.4mm, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(0.4mm, env(safe-area-inset-left));
    align-items:center;
    justify-items:center;
  }
  .login-card{
    width:calc(100vw - 0.8mm);
    max-width:calc(100vw - 0.8mm);
    margin:0 auto!important;
    padding:26px clamp(20px,6vw,28px) 22px;
    border-radius:22px;
  }
  .login-form input{
    min-height:50px;
    font-size:16px; /* evita zoom automático do iOS */
  }
  .login-submit{
    min-height:48px;
    font-size:15px;
  }

  .topbar{
    grid-template-columns:auto minmax(0,1fr) auto;
    width:100%;
    overflow:hidden;
  }
  .topbar-left,
  .topbar-right{
    min-width:0;
    flex:0 0 auto;
  }
  .search-box{
    min-width:0;
    max-width:none;
  }
  .search-box input{
    width:100%;
    min-width:0;
  }

  .settings-panel{
    width:100%;
    max-width:100vw;
    left:0;
    right:0;
    padding-left:max(16px, env(safe-area-inset-left));
    padding-right:max(16px, env(safe-area-inset-right));
  }

  .sidebar{
    width:min(286px, calc(100vw - 32px));
    max-width:calc(100vw - 32px);
  }
  .sidebar.collapsed{
    width:min(286px, calc(100vw - 32px));
    max-width:calc(100vw - 32px);
  }

  .mail-toolbar{
    min-width:0;
  }
  .toolbar-left,
  .toolbar-right,
  .selection-actions{
    min-width:0;
  }

  .thread-toolbar{
    gap:2px;
    overflow:hidden;
  }
  .thread-toolbar-left{
    flex:1 1 auto;
    overflow:hidden;
  }
  .thread-toolbar-right{
    flex:0 0 auto;
  }

  .modal-card,
  .modal-card.wide{
    padding-left:max(16px, env(safe-area-inset-left));
    padding-right:max(16px, env(safe-area-inset-right));
    padding-bottom:max(16px, env(safe-area-inset-bottom));
  }

  .resource-toolbar{
    width:100%;
  }
  .resource-toolbar>*{
    min-width:0;
  }

  .form-grid input,
  .form-grid select,
  .form-grid textarea,
  .resource-toolbar input,
  .schedule-panel input{
    width:100%;
    max-width:100%;
  }
}

/* Celulares estreitos: mantém controles sem estouro horizontal. */
@media (max-width:480px){
  .brand-lockup{
    margin-bottom:22px;
  }
  .brand-logo{
    width:48px;
    height:44px;
  }
  .brand-name{
    font-size:21px;
  }
  .login-copy h1{
    font-size:24px;
  }
  .admin-notice{
    margin:18px 0;
  }

  .topbar{
    padding-inline:4px;
    gap:3px;
  }
  .topbar .icon-button{
    width:36px;
    height:36px;
  }
  .avatar-button{
    width:34px;
    height:34px;
  }
  .search-box{
    height:40px;
    padding:0 7px;
    gap:5px;
  }
  .search-box>.icon-slot{
    width:18px;
    height:18px;
  }
  .search-box input{
    font-size:14px;
  }
  #advanced-search-button{
    width:30px;
    height:30px;
  }

  .message-row{
    grid-template-columns:29px 29px minmax(0,1fr) auto;
    padding-left:5px;
    padding-right:7px;
  }
  .star-button,
  .importance-button{
    width:29px;
    height:29px;
    padding:5px;
  }
  .sender{
    padding-right:4px;
  }
  .row-date{
    margin-left:5px;
  }

  .thread-toolbar{
    padding-inline:2px;
  }
  .thread-toolbar .thread-tool,
  .thread-toolbar .thread-nav-button{
    width:31px;
    height:31px;
    flex-basis:31px;
  }
  .thread-toolbar .thread-back{
    margin-right:0;
  }
  .thread-toolbar-separator{
    margin:0 1px;
  }
  .thread-tool-group{
    gap:0;
  }

  .thread-message-head{
    grid-template-columns:34px minmax(0,1fr) auto;
    gap:7px;
  }
  .thread-date{
    max-width:90px;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .thread-recipients{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .account-popover{
    left:4px;
    right:4px;
    width:auto;
    max-height:calc(100vh - 70px);
    overflow:auto;
  }

  .modal-actions{
    flex-wrap:wrap;
  }
  .modal-actions>*{
    min-height:42px;
  }

  .folder-manager-actions{
    flex-wrap:wrap;
  }
  .folder-manager-save-group{
    margin-left:auto;
  }

  .select-line{
    align-items:flex-start;
    flex-direction:column;
    gap:6px;
  }
  .select-line select{
    width:100%;
    min-width:0;
  }
}

/* Telefones muito estreitos (320–360 CSS px). */
@media (max-width:360px){
  .login-card{
    padding-left:18px;
    padding-right:18px;
  }

  .topbar{
    grid-template-columns:36px minmax(0,1fr) 72px;
  }
  .mail-brand{
    display:none;
  }
  .topbar-left{
    width:36px;
  }
  .topbar-right{
    width:72px;
    justify-content:flex-end;
  }
  .topbar-right #settings-button{
    width:34px;
    height:34px;
  }
  .avatar-button{
    width:32px;
    height:32px;
  }

  .thread-toolbar .thread-tool,
  .thread-toolbar .thread-nav-button{
    width:29px;
    height:29px;
    flex-basis:29px;
  }
  .thread-toolbar .thread-tool .icon-slot,
  .thread-toolbar .thread-nav-button .icon-slot{
    width:17px;
    height:17px;
  }

  .message-row{
    grid-template-columns:27px 27px minmax(0,1fr) auto;
  }
  .star-button,
  .importance-button{
    width:27px;
    height:27px;
  }
}

/* Celular deitado / telas de pouca altura: login continua utilizável e rolável. */
@media (max-height:560px) and (max-width:900px){
  .login-view{
    place-items:start center;
    padding-top:max(8px, env(safe-area-inset-top));
  }
  .login-card{
    margin-block:8px!important;
  }
  .brand-lockup{
    margin-bottom:16px;
  }
  .admin-notice{
    margin:14px 0;
  }
  .login-foot{
    margin-top:14px;
  }
}


/* V2.1.3 — confirmação de fechamento do compositor */
.composer-close-confirm-card{
  max-width:440px;
}
.composer-close-confirm-card .modal-head{
  padding-bottom:4px;
}
.composer-close-confirm-card .resource-note{
  margin:6px 0 20px;
  font-size:14px;
  line-height:20px;
  color:var(--text);
}
.composer-close-actions{
  justify-content:flex-end;
  gap:8px;
}
@media(max-width:640px){
  .composer-close-confirm-card{
    width:calc(100vw - 24px);
    max-width:calc(100vw - 24px);
    border-radius:18px;
  }
  .composer-close-actions{
    display:grid;
    grid-template-columns:1fr;
  }
  .composer-close-actions button{
    width:100%;
  }
}


/* =========================================================
   V2.2.0 — experiência mobile Gmail-like
   ========================================================= */

/* Estruturas novas são neutras no desktop. */
.message-row-shell{display:contents}
.mobile-avatar,.mobile-compose-button,.swipe-trash{display:none}

/* Mantém desktop exatamente com a grade anterior. */
@media(min-width:641px){
  .mobile-avatar{display:none!important}
}

@media(max-width:640px){
  /* Área geral semelhante ao Gmail mobile */
  .mail-view{background:var(--bg)}
  .topbar{
    height:72px;
    padding:10px 12px;
    gap:8px;
    background:var(--bg);
  }
  .mail-layout{height:calc(100% - 72px)}
  .sidebar{top:72px}
  .content-shell{
    margin:0;
    border-radius:0;
    background:var(--bg);
  }
  .list-view{
    height:100%;
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }

  /* Pesquisa em cápsula, com menu à esquerda e avatar à direita */
  .topbar-left{
    min-width:44px;
    width:44px;
  }
  .mail-brand{display:none}
  .search-box{
    height:52px;
    border-radius:28px;
    background:var(--surface);
    box-shadow:0 1px 2px rgba(60,64,67,.08);
    padding:0 14px;
  }
  .search-box input{
    font-size:16px;
    font-weight:400;
  }
  #advanced-search-button{display:none}
  .topbar-right #settings-button{display:none}
  .topbar-right{
    min-width:46px;
    width:46px;
  }
  .avatar-button{
    width:42px;
    height:42px;
    font-size:13px;
  }

  /* Cabeçalho da pasta; toolbar só aparece quando há seleção */
  .folder-heading-row{
    display:flex;
    flex:0 0 54px;
    height:54px;
    border:0;
    padding:10px 20px 6px;
    background:var(--bg);
  }
  .folder-heading-row h2{
    font-size:18px;
    line-height:24px;
    font-weight:500;
  }
  .list-view>.mail-toolbar{
    display:none;
    flex:0 0 48px;
    height:48px;
    background:var(--surface);
    border-bottom:1px solid var(--line-soft);
  }
  .list-view.has-selection>.mail-toolbar{display:flex}
  .list-view.has-selection>.folder-heading-row{display:none}
  .list-view.has-selection>.mail-toolbar .check-wrap,
  .list-view.has-selection>.mail-toolbar #toolbar-refresh,
  .list-view.has-selection>.mail-toolbar .toolbar-right{display:none}
  .list-view.has-selection>.mail-toolbar .toolbar-left{width:100%}
  .list-view.has-selection>.mail-toolbar .selection-actions{
    display:flex!important;
    width:100%;
    justify-content:flex-end;
  }

  .message-list{
    flex:1 1 auto;
    min-height:0;
    height:auto;
    overflow:auto;
    padding:0 8px 96px;
    background:var(--bg);
    overscroll-behavior-y:contain;
  }

  /* Wrapper segura o fundo do gesto enquanto o cartão desliza. */
  .message-row-shell{
    display:block;
    position:relative;
    margin:3px 0;
    border-radius:18px;
    overflow:hidden;
    background:color-mix(in srgb,var(--danger) 13%,var(--surface));
  }
  .swipe-trash{
    position:absolute;
    top:0;bottom:0;
    width:76px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--danger);
    opacity:0;
    transition:opacity .12s ease,transform .12s ease;
    pointer-events:none;
  }
  .swipe-trash svg{width:24px;height:24px}
  .swipe-trash-left{right:0;transform:scale(.8)}
  .swipe-trash-right{left:0;transform:scale(.8)}
  .message-row-shell.swipe-left .swipe-trash-left,
  .message-row-shell.swipe-right .swipe-trash-right{opacity:1;transform:scale(1)}
  .message-row-shell.swipe-ready{background:color-mix(in srgb,var(--danger) 20%,var(--surface))}

  /* Cartão de e-mail semelhante ao print do Gmail */
  .message-row{
    position:relative;
    min-height:108px;
    height:auto;
    display:grid;
    grid-template-columns:54px 28px minmax(0,1fr) auto;
    grid-template-rows:28px 28px 28px;
    grid-template-areas:
      "avatar important sender date"
      "avatar . subject star"
      "avatar . subject star";
    align-items:center;
    column-gap:5px;
    padding:12px 14px 12px 10px;
    border:0;
    border-radius:18px;
    background:var(--surface);
    box-shadow:none;
    transition:transform .18s ease,background .12s ease,box-shadow .12s ease;
    touch-action:pan-y;
    will-change:transform;
  }
  .message-row:hover{
    box-shadow:none;
    position:relative;
    z-index:auto;
  }
  .message-row.unread,
  .message-row.read{
    background:var(--surface);
  }
  .message-row.selected{
    background:var(--blue-soft-2);
  }

  .row-check{display:none}

  .mobile-avatar{
    grid-area:avatar;
    display:grid;
    place-items:center;
    width:48px;
    height:48px;
    align-self:start;
    margin-top:1px;
    border:0;
    border-radius:50%;
    background:hsl(var(--avatar-h) 62% 62%);
    color:#fff;
    font-family:var(--font-google);
    font-size:20px;
    line-height:1;
    font-weight:500;
    cursor:pointer;
    box-shadow:none;
  }
  .mobile-avatar.selected{
    background:var(--blue);
  }
  .mobile-avatar svg{
    width:24px;height:24px;
    stroke-width:2.4;
  }
  .mobile-avatar-check{
    width:100%;height:100%;
    display:grid;place-items:center;
  }

  .importance-button{
    grid-area:important;
    width:28px;height:28px;
    padding:4px;
    align-self:center;
  }
  .importance-button svg{width:19px;height:19px}

  .sender{
    grid-area:sender;
    min-width:0;
    padding:0;
    font-size:16px;
    line-height:22px;
    font-weight:400;
    color:var(--text);
  }
  .message-row.unread .sender-name{
    font-weight:700;
  }
  .thread-count{
    font-size:12px;
    line-height:18px;
  }

  .subject-snippet{
    grid-area:subject;
    display:grid;
    grid-template-rows:24px 24px;
    min-width:0;
    align-self:start;
    overflow:hidden;
    font-size:15px;
    line-height:22px;
    white-space:normal;
  }
  .subject-text{
    display:block;
    min-width:0;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:var(--text);
  }
  .message-row.unread .subject-text{font-weight:700}
  .snippet-separator{display:none}
  .snippet{
    display:block;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    margin:0;
    color:var(--muted);
    font-size:14px;
    line-height:22px;
    font-weight:400;
  }

  .row-end{
    grid-area:date;
    min-width:74px;
    height:28px;
    align-self:center;
  }
  .row-date{
    margin:0;
    font-size:12px;
    line-height:18px;
    color:var(--text);
  }
  .message-row.unread .row-date{font-weight:700}
  .row-hover-actions{display:none!important}

  .star-button{
    grid-area:star;
    width:36px;height:36px;
    padding:7px;
    align-self:center;
    justify-self:end;
  }
  .star-button svg{width:23px;height:23px}

  /* Botão flutuante Escrever */
  .mobile-compose-button{
    position:fixed;
    right:max(16px, env(safe-area-inset-right));
    bottom:max(18px, calc(env(safe-area-inset-bottom) + 14px));
    z-index:82;
    height:58px;
    padding:0 20px;
    border:0;
    border-radius:18px;
    background:var(--blue-soft);
    color:var(--text);
    display:flex;
    align-items:center;
    gap:11px;
    font-family:var(--font-google);
    font-size:15px;
    font-weight:600;
    box-shadow:0 5px 14px rgba(60,64,67,.24);
    cursor:pointer;
  }
  .mobile-compose-button.hidden{display:none!important}
  .mobile-compose-button .icon-slot{
    width:24px;height:24px;
    color:var(--blue);
  }

  /* Empty state também respeita o espaço do FAB */
  .empty-state{
    flex:1 1 auto;
    height:auto;
    background:var(--bg);
  }
}

@media(max-width:420px){
  .message-list{padding-left:5px;padding-right:5px}
  .message-row{
    min-height:104px;
    grid-template-columns:50px 24px minmax(0,1fr) auto;
    column-gap:3px;
    padding:10px 10px 10px 8px;
  }
  .mobile-avatar{width:44px;height:44px;font-size:18px}
  .importance-button{width:24px;height:24px;padding:3px}
  .sender{font-size:15px}
  .subject-snippet{font-size:14px}
  .row-end{min-width:66px}
  .mobile-compose-button{
    height:54px;
    padding:0 17px;
    right:12px;
  }
}


/* =========================================================
   V2.2.1 — login mobile como no print de referência
   ========================================================= */
@media(max-width:640px){
  .login-view{
    place-items:start center;
    padding:
      max(12px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
    background:#f5f2ea;
  }
  .login-background{opacity:.78;background-position:center top;background-size:cover}
  .login-view::after{background:linear-gradient(180deg,rgba(245,242,234,.2),rgba(245,242,234,.36) 30%,rgba(245,242,234,.62) 100%)}
  .login-card{
    width:calc(100vw - 28px);
    max-width:calc(100vw - 28px);
    margin:22px auto 24px!important;
    padding:28px 28px 36px;
    border-radius:30px;
    border:1px solid rgba(15,23,42,.07);
    background:rgba(255,255,255,.95);
    box-shadow:0 14px 30px rgba(15,23,42,.08);
    min-height:min(820px, calc(100vh - 80px));
  }
  .brand-lockup{gap:12px;margin-bottom:36px}
  .brand-logo{width:56px;height:56px}
  .brand-name{font-size:25px;letter-spacing:-.035em;font-weight:800;line-height:1}
  .brand-product{font-size:15px;line-height:1.1;margin-top:1px;color:#667085;font-weight:700}
  .login-copy h1{font-size:31px;line-height:1.12;letter-spacing:-.045em;margin:0 0 18px}
  .login-copy p{font-size:14px;line-height:1.6;color:#6b7280;max-width:320px}
  .admin-notice{
    margin:26px 0 28px;
    padding:17px 16px;
    border-radius:17px;
    gap:12px;
    background:rgba(15,118,110,.075);
    color:#4f6468;
    font-size:13px;
    line-height:1.55;
  }
  .admin-notice .icon-slot{width:18px;height:18px;margin-top:1px}
  .login-form{gap:19px}
  .login-form label>span{font-size:13px;font-weight:700;margin-bottom:10px;color:#394150}
  .login-form input{
    height:72px;
    min-height:72px;
    border-radius:18px;
    padding:0 19px;
    font-size:16px;
    border:1px solid #d7dde5;
    box-shadow:none;
  }
  .password-wrap input{padding-right:56px}
  .password-wrap .icon-button{right:8px;top:8px;width:40px;height:40px}
  .login-submit{
    height:68px;
    min-height:68px;
    margin-top:10px;
    border-radius:999px;
    font-size:18px;
    font-weight:700;
    box-shadow:inset 0 -2px 0 rgba(0,0,0,.06);
  }
  .login-foot{margin-top:32px;font-size:12px;color:#969ca7}
}
@media(max-width:420px){
  .login-view{
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .login-card{
    width:calc(100vw - 24px);
    max-width:calc(100vw - 24px);
    margin:18px auto 20px!important;
    padding:24px 22px 30px;
    border-radius:28px;
    min-height:min(760px, calc(100vh - 54px));
  }
  .brand-lockup{margin-bottom:28px}
  .brand-logo{width:52px;height:52px}
  .brand-name{font-size:23px}
  .brand-product{font-size:14px}
  .login-copy h1{font-size:28px;margin-bottom:14px}
  .login-copy p{max-width:none}
  .admin-notice{margin:22px 0 24px;padding:15px 14px;border-radius:16px}
  .login-form input{height:66px;min-height:66px;border-radius:17px}
  .login-submit{height:62px;min-height:62px;font-size:17px}
  .login-foot{margin-top:26px}
}
@media(max-width:360px){
  .login-card{width:calc(100vw - 20px);max-width:calc(100vw - 20px);padding:22px 18px 26px;border-radius:26px}
  .brand-logo{width:48px;height:48px}
  .brand-name{font-size:21px}
  .login-copy h1{font-size:26px}
  .login-form input{height:62px;min-height:62px;padding:0 16px}
  .login-submit{height:58px;min-height:58px;font-size:16px}
}
