/* Corebyte Mail — interface (Gmail-like, marca Corebyte) */

:root {
  --primary: #2563EB;
  --primary-hover: #1D4FD8;
  --primary-soft: rgba(37, 99, 235, .10);
  --primary-softer: rgba(37, 99, 235, .06);
  --on-primary: #fff;
  --bg: #fff;
  --bg-soft: #f6f8fd;
  --bg-muted: #eef2fa;
  --surface: #fff;
  --text: #0f172a;
  --text-soft: #475569;
  --text-dim: #64748b;
  --border: #e4ecfc;
  --border-strong: #d3e0f7;
  --star: #f4b400;
  --danger: #d93025;
  --ok: #188038;
  --shadow-1: 0 1px 2px rgba(15,23,42,.10), 0 1px 3px rgba(15,23,42,.06);
  --shadow-2: 0 6px 18px rgba(15,23,42,.14), 0 2px 6px rgba(15,23,42,.08);
  --shadow-3: 0 18px 50px rgba(15,23,42,.22);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --sidebar: 258px; --topbar: 64px;
  --font: "Inter", "Plus Jakarta Sans", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --primary: #60a5fa; --primary-hover: #93c5fd;
  --primary-soft: rgba(96,165,250,.16); --primary-softer: rgba(96,165,250,.10);
  --on-primary: #06152b;
  --bg: #0b1220; --bg-soft: #111a2c; --bg-muted: #16213a; --surface: #0f1729;
  --text: #e8eefc; --text-soft: #a7b4cc; --text-dim: #8494ad;
  --border: #1f2c47; --border-strong: #2a3a5c;
  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 8px 24px rgba(0,0,0,.55);
  --shadow-3: 0 22px 60px rgba(0,0,0,.65);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--primary); text-decoration: none; }
::selection { background: rgba(37,99,235,.22); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,.35); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 20% 0%, #e0ebff, transparent), var(--bg-soft);
  padding: 24px;
}
[data-theme="dark"] .login { background: radial-gradient(1200px 600px at 20% 0%, #14224d, transparent), var(--bg); }
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-3);
  padding: 30px 28px;
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.login-mark {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 16px;
}
.login-brand h1 { margin: 0; font-size: 21px; letter-spacing: -.4px; }
.login-brand h1 em { font-style: normal; color: var(--primary); }
.login-brand p { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 12px; font-weight: 700; color: var(--text-soft); margin-top: 6px; }
.login-form input {
  height: 44px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); padding: 0 13px; font-size: 14px; outline: 0;
}
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.login-error { color: var(--danger); background: rgba(217,48,37,.08); padding: 9px 11px; border-radius: 8px; font-size: 12.5px; }
.btn-primary {
  margin-top: 14px; height: 44px; border-radius: var(--r-pill);
  background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 14px;
}
.btn-primary:hover { background: var(--primary-hover); }
.login-hint { margin: 14px 0 0; font-size: 11.5px; color: var(--text-dim); text-align: center; }
.login-hint code { background: var(--bg-muted); padding: 1px 5px; border-radius: 4px; }

/* App shell */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* Topbar */
.topbar {
  flex: 0 0 var(--topbar); height: var(--topbar);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; background: var(--bg-soft);
  border-bottom: 1px solid var(--border); position: relative; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: var(--r-pill); color: var(--text); }
.brand:hover { background: var(--primary-softer); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: grid; place-items: center; flex: 0 0 auto;
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.3px; }
.brand-name em { font-style: normal; color: var(--primary); }

.search-wrap { position: relative; flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.search-box {
  width: 100%; max-width: 720px; height: 44px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 6px 0 16px; background: var(--bg-muted);
  border-radius: var(--r-pill); color: var(--text-dim);
  transition: background .15s, box-shadow .15s;
}
.search-box:focus-within { background: var(--surface); box-shadow: var(--shadow-2); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; min-width: 0; }
.search-box input::placeholder { color: var(--text-dim); opacity: 1; }
.topbar-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center;
  color: var(--text-soft); transition: background .15s, color .15s; flex: 0 0 auto;
}
.icon-btn:hover { background: rgba(100,116,139,.14); color: var(--text); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.danger { color: var(--danger); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; font-weight: 800; font-size: 13px;
  display: inline-grid; place-items: center; margin-left: 6px;
}

/* Layout */
.layout { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }

/* Sidebar */
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: var(--bg-soft); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 12px 10px 18px;
  transition: transform .22s ease;
}
.compose-btn {
  height: 56px; border-radius: 16px;
  background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; gap: 12px;
  padding: 0 20px; font-weight: 700; font-size: 14.5px;
  box-shadow: var(--shadow-2); margin: 4px 4px 14px; align-self: flex-start;
}
.compose-btn:hover { background: var(--primary-hover); box-shadow: 0 10px 24px rgba(37,99,235,.35); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  height: 36px; border-radius: var(--r-pill);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; color: var(--text-soft);
  font-weight: 500; font-size: 14px; text-align: left;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: rgba(100,116,139,.12); color: var(--text); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav-ic { width: 18px; display: inline-grid; place-items: center; flex: 0 0 auto; font-size: 15px; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--primary); color: var(--on-primary);
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center;
}
.nav-sep { height: 1px; background: var(--border); margin: 12px 10px 8px; }
.nav-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 10px 6px 14px; font-size: 11px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase; color: var(--text-dim);
}
.mini-btn {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--text-dim); font-size: 16px;
}
.mini-btn:hover { background: rgba(100,116,139,.16); color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.label-item { padding-left: 12px; }
.storage { margin-top: auto; padding: 18px 12px 4px; }
.storage-bar { height: 6px; border-radius: var(--r-pill); background: var(--border-strong); overflow: hidden; }
.storage-bar span { display: block; height: 100%; background: var(--primary); border-radius: var(--r-pill); }
.storage-text { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }

/* Main */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--surface); min-height: 0; }
.toolbar {
  flex: 0 0 50px; height: 50px; display: flex; align-items: center;
  gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--border); color: var(--text-soft);
}
.toolbar .spacer { flex: 1; }
.count-label { font-size: 12.5px; color: var(--text-dim); padding: 0 6px; }
.cb { width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 3px; display: inline-block; opacity: .75; }
.sel-actions { display: flex; gap: 0; }

.content { flex: 1 1 auto; display: flex; min-height: 0; min-width: 0; }
.list-pane {
  width: 392px; max-width: 392px; flex: 0 0 392px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border); background: var(--surface); min-height: 0;
}
.list-head {
  flex: 0 0 44px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; padding: 0 8px 0 14px;
}
.list-head-text { min-width: 0; display: flex; flex-direction: column; justify-content: center; line-height: 1.18; }
.list-title { font-size: 13px; font-weight: 700; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-account { font-size: 11px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-tools { display: flex; }
.items { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }
.load-more {
  flex: 0 0 42px; border-top: 1px solid var(--border);
  color: var(--primary); font-weight: 700; font-size: 13px; background: var(--surface);
}
.load-more:hover { background: var(--primary-softer); }

/* Row */
.row {
  position: relative; display: flex; align-items: flex-start; gap: 6px;
  padding: 10px 10px 10px 6px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s, box-shadow .12s;
  background: var(--surface); touch-action: pan-y;
}
.row:hover { background: var(--bg-soft); box-shadow: inset 3px 0 0 var(--primary); }
.row.is-selected { background: var(--primary-softer); box-shadow: inset 3px 0 0 var(--primary); }
.row.is-unread { background: var(--bg-soft); }
.row.is-unread .row-from, .row.is-unread .row-subject { font-weight: 800; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex: 0 0 auto; }
.row-check {
  width: 26px; height: 26px; margin-top: 6px; border-radius: 6px;
  display: grid; place-items: center; flex: 0 0 auto; opacity: 0;
  transition: opacity .12s, background .12s;
}
.row:hover .row-check, .row.is-selected .row-check, .row.is-unread .row-check { opacity: 1; }
.row-check:hover { background: rgba(100,116,139,.16); }
.row-check span { width: 15px; height: 15px; border: 2px solid var(--text-dim); border-radius: 3px; display: block; }
.row-check.is-on span { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 2.5px var(--surface); }
.row-star {
  width: 26px; height: 26px; margin-top: 6px; border-radius: 50%;
  display: grid; place-items: center; color: rgba(140,152,168,.6);
  flex: 0 0 auto; font-size: 15px; transition: color .12s, transform .12s, background .12s;
}
.row-star:hover { transform: scale(1.14); color: var(--star); background: rgba(244,180,0,.12); }
.row-star.is-on { color: var(--star); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 4px 0; }
.row-line1 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.row-from { font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row-date { font-size: 11.5px; color: var(--text-dim); flex: 0 0 auto; }
.row-line2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-subject { font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.is-unread .row-subject { font-weight: 800; }
.row-clip { color: var(--text-dim); flex: 0 0 auto; font-size: 12px; }
.row-line3 { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-chips { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 19px; padding: 0 8px;
  border-radius: 5px; background: var(--bg-muted); color: var(--text-soft);
  font-size: 10.5px; font-weight: 600; max-width: 140px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.acct-tag { font-size: 10px; font-weight: 700; opacity: .9; }

/* Reading */
.reading-pane { flex: 1 1 auto; min-width: 0; background: var(--surface); overflow-y: auto; position: relative; }
.reading-empty {
  height: 100%; min-height: 420px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: var(--text-dim); text-align: center; padding: 32px;
}
.reading-empty .art {
  width: 96px; height: 96px; border-radius: 50%; background: var(--bg-muted);
  display: grid; place-items: center; color: var(--text-dim); font-size: 40px; margin-bottom: 8px;
}
.reading-empty h2 { margin: 0; font-size: 17px; color: var(--text-soft); }
.reading-empty p { margin: 0; max-width: 340px; font-size: 13px; }
.reading-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  padding: 8px 10px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.reading-crumbs { font-size: 12px; font-weight: 600; color: var(--text-dim); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reading-actions { margin-left: auto; display: flex; align-items: center; }
.back-btn { display: none; }
.reading-scroll { padding: 22px 30px 60px; max-width: 900px; }
.reading-subject { font-size: 22px; line-height: 1.28; font-weight: 600; margin: 0 0 18px; letter-spacing: -.4px; }
.msg { padding: 2px 0 16px; }
.msg + .msg { border-top: 1px solid var(--border); padding-top: 16px; }
.msg-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.msg-who { flex: 1; min-width: 0; font-size: 13px; color: var(--text-soft); padding-top: 2px; }
.msg-who strong { color: var(--text); font-weight: 700; }
.msg-mail { color: var(--text-dim); }
.msg-recipients { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--text-soft); overflow-wrap: anywhere; }
.msg-recipients .rc-label { display: inline-block; min-width: 32px; font-weight: 700; color: var(--text-dim); }
.msg-recipients .rc-addr { margin-right: 6px; }
.msg-when { font-size: 11.5px; color: var(--text-dim); flex: 0 0 auto; padding-top: 3px; white-space: nowrap; }
.msg-body { padding-left: 44px; font-size: 14px; line-height: 1.62; color: var(--text); word-wrap: break-word; }
.msg-body img { max-width: 100%; height: auto; }
.attachments { margin-top: 16px; }
.att-title { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.att-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-soft); min-width: 230px; max-width: 300px; cursor: pointer;
  transition: border-color .14s, background .14s;
}
.att-card:hover { border-color: var(--primary); background: var(--primary-softer); }
.att-ic {
  width: 38px; height: 42px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--border); display: grid; place-items: center;
  color: var(--primary); flex: 0 0 auto;
}
.att-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.att-name { font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-size { font-size: 11px; color: var(--text-dim); }
.reply-box { margin-top: 22px; }
.reply-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px;
  padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-soft); font-size: 13px; font-weight: 600;
}
.pill:hover { background: var(--primary-softer); border-color: var(--primary); color: var(--primary); }

/* Compose */
.compose {
  position: fixed; right: 24px; bottom: 0;
  width: var(--cw, min(540px, calc(100vw - 48px)));
  height: var(--ch, min(600px, calc(100vh - 90px)));
  background: var(--surface); border: 1px solid var(--border);
  border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-3); display: flex; flex-direction: column;
  z-index: 80; overflow: hidden;
}
.compose.is-min { height: 52px; }
.compose.is-full { right: 0; top: 0; bottom: 0; width: 100vw; height: 100vh; border-radius: 0; }

/* Alça de redimensionamento no canto superior esquerdo */
.compose-resizer {
  position: absolute; top: 0; left: 0; width: 24px; height: 24px;
  z-index: 3; cursor: nwse-resize; touch-action: none;
  display: flex; align-items: flex-start; justify-content: flex-start;
}
.compose-resizer::before {
  content: ''; width: 14px; height: 14px; margin: 2px 0 0 2px;
  border-left: 2px solid var(--text-dim); border-top: 2px solid var(--text-dim);
  border-top-left-radius: 8px; opacity: .8;
}
.compose-resizer:hover::before { opacity: 1; border-color: var(--primary); }
.compose.is-min .compose-resizer, .compose.is-full .compose-resizer { display: none; }
.compose-head {
  flex: 0 0 50px; display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 18px; background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.compose-title { font-size: 13.5px; font-weight: 800; }
.compose-body { flex: 1 1 auto; overflow-y: auto; padding: 0 18px; display: flex; flex-direction: column; min-height: 0; }
.field { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.field label { width: 62px; flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--text-dim); }
.field input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 13.5px; min-width: 0; }
.field textarea#cSubject {
  flex: 1; min-width: 0; resize: none; overflow: hidden; height: 22px;
  border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 13.5px; line-height: 1.5;
  overflow-wrap: anywhere; word-break: break-word;
}
.field textarea#cSubject::placeholder { color: var(--text-dim); }
.addr-field { align-items: flex-start; }
.addr-field > label { padding-top: 7px; }
.addr-wrap { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.addr-chips { display: contents; }
.addr-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 6px 4px 9px; border-radius: 999px; background: rgba(37,99,235,.14); color: var(--primary); font-size: 12px; font-weight: 600; }
.addr-chip button { width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; line-height: 1; font-size: 13px; }
.addr-chip button:hover { background: rgba(37,99,235,.2); }
.addr-wrap input { flex: 1 1 190px; min-width: 120px; padding: 6px 0; }
.addr-field .mini-btn { flex: 0 0 auto; }
.compose-editor { flex: 1 1 auto; min-height: 190px; padding: 14px 0; outline: 0; font-size: 14px; line-height: 1.6; overflow-y: auto; overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; min-width: 0; }
.compose-editor:empty::before { content: attr(data-placeholder); color: var(--text-dim); pointer-events: none; }
.compose-editor blockquote {
  margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg-soft); color: var(--text-soft);
  white-space: pre-wrap;
}
.compose-errors { padding-bottom: 8px; }
.err { font-size: 12.5px; color: var(--danger); padding: 7px 10px; border-radius: 8px; background: rgba(217,48,37,.08); margin-bottom: 6px; }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.att-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: var(--r-pill); background: var(--bg-muted); font-size: 12px; color: var(--text-soft);
}
.att-chip button { color: var(--text-dim); font-size: 14px; line-height: 1; }
.compose-foot {
  flex: 0 0 56px; display: flex; align-items: center; gap: 2px;
  padding: 0 10px; border-top: 1px solid var(--border); background: var(--bg-soft);
}
.send-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px;
  padding: 0 22px; border-radius: var(--r-pill);
  background: var(--primary); color: var(--on-primary);
  font-size: 13.5px; font-weight: 700; margin-right: 6px;
}
.send-btn:hover { background: var(--primary-hover); }

/* Mobile nav */
.mobile-nav { display: none; }

/* Snackbar */
.snackbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  min-width: 320px; max-width: min(560px, calc(100vw - 32px));
  background: #1f2937; color: #f8fafc; border-radius: 10px;
  box-shadow: var(--shadow-3); display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; z-index: 120;
}
.snack-msg { flex: 1; font-size: 13px; }
.snack-action { color: #93c5fd; font-weight: 800; font-size: 12.5px; text-transform: uppercase; padding: 4px 6px; border-radius: 6px; }
.snack-action:hover { background: rgba(147,197,253,.16); }
.snack-close { color: inherit; opacity: .7; width: 26px; height: 26px; border-radius: 50%; font-size: 14px; }
.snack-close:hover { opacity: 1; background: rgba(148,163,184,.2); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: grid; place-items: center; padding: 24px; z-index: 200;
}
.modal {
  width: min(520px, 100%); max-height: min(80vh, 720px);
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  flex: 0 0 56px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 10px 0 20px;
  border-bottom: 1px solid var(--border); background: var(--bg-soft);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.modal-body { padding: 18px 20px 20px; overflow-y: auto; }
.form { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 700; color: var(--text-soft); margin-top: 6px; }
.form-input {
  height: 38px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); padding: 0 11px; font-size: 13.5px; outline: 0;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.btn {
  height: 34px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-soft); font-size: 12.5px; font-weight: 700;
}
.btn:hover { background: var(--bg-soft); color: var(--text); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.danger { color: var(--danger); border-color: rgba(217,48,37,.4); }
.opt-list { display: flex; flex-direction: column; gap: 2px; }
.opt {
  display: flex; align-items: center; gap: 11px; height: 44px;
  padding: 0 12px; border-radius: var(--r-sm); text-align: left; font-size: 13.5px;
}
.opt:hover { background: var(--primary-softer); color: var(--primary); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.help-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-soft); }
kbd { font-family: ui-monospace, monospace; font-size: 11px; background: var(--bg-muted); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }
.acct-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-bottom: 1px solid var(--border); }
.acct-row > div { flex: 1; }
.acct-mail { font-size: 11.5px; color: var(--text-dim); }

/* Tradução */
.translate-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 16px;
  border-radius: var(--r-md);
  background: var(--primary-softer);
  color: var(--primary);
  font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
}
.tb-ic { font-size: 16px; }
.tb-action {
  margin-left: auto;
  height: 30px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
  background: var(--surface); color: var(--primary);
  font-size: 12px; font-weight: 700;
}
.tb-action:hover { background: var(--primary); color: var(--on-primary); }
.translated-text { white-space: normal; }
.translate-hint {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 16px;
  border-radius: var(--r-md);
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 13px;
  border: 1px dashed var(--border-strong);
}
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(37,99,235,.25);
  border-top-color: var(--primary);
  display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ Ícones SVG ============================ */
.ic {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.ic.fill { fill: currentColor; stroke: none; }

.nav-ic { display: inline-grid; place-items: center; color: inherit; }
.nav-ic .ic { width: 18px; height: 18px; }

.row-star .ic { width: 16px; height: 16px; }

.icon-btn .ic { pointer-events: none; }

/* ============================ Logo Corebyte ============================ */
.login-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--surface);
  object-fit: contain;
  padding: 6px;
  box-shadow: var(--shadow-2);
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--surface);
  display: grid; place-items: center;
  flex: 0 0 auto;
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.brand-logo img { width: 28px; height: 28px; object-fit: contain; }
[data-theme="dark"] .brand-logo { background: #0b1220; }

/* Ajustes de ícones em elementos existentes */
.att-ic .ic { width: 20px; height: 20px; }
.att-chip .ic { width: 14px; height: 14px; }
.att-card .att-ic { display: grid; place-items: center; }
.tb-ic .ic, .tb-ic { display: inline-flex; align-items: center; }
.reading-empty .art { color: var(--text-dim); }

/* ============================ Responsivo base ============================ */
@media (max-width: 1180px) {
  :root { --sidebar: 232px; }
  .list-pane { width: 348px; max-width: 348px; flex-basis: 348px; }
  .reading-scroll { padding: 18px 20px 60px; }
}

@media (max-width: 860px) {
  :root { --topbar: 58px; }
  .topbar { padding: 0 8px; gap: 8px; }
  .brand-name { display: none; }
  .search-box { height: 42px; padding-left: 12px; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 286px; max-width: 86vw;
    transform: translateX(-102%); z-index: 90; box-shadow: var(--shadow-3);
  }
  .app.is-sidebar-open .sidebar { transform: translateX(0); }
  .app.is-sidebar-open .scrim { display: block; }
  .toolbar { display: none; }
  .list-pane { width: 100%; max-width: none; flex: 1 1 100%; border-right: 0; }
  .list-head { display: flex; flex: 0 0 40px; padding: 0 6px 0 12px; }
  .reading-pane { position: fixed; inset: 0; z-index: 100; display: none; background: var(--surface); }
  .app.has-open-msg .reading-pane { display: block; }
  .back-btn { display: inline-grid; }
  .reading-scroll { padding: 14px 16px 80px; }
  .reading-subject { font-size: 19px; }
  .msg-body { padding-left: 0; }
  .msg-when { display: none; }
  .row { padding: 12px 10px 12px 4px; }
  .row-check { opacity: 1; }
  .mobile-nav {
    display: flex; flex: 0 0 62px; height: 62px; align-items: center;
    justify-content: space-around; gap: 2px; background: var(--surface);
    border-top: 1px solid var(--border); padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    position: relative; z-index: 40;
  }
  .mnav-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; min-width: 56px; min-height: 48px; color: var(--text-dim);
    font-size: 10px; font-weight: 600; border-radius: 12px; font-size: 16px;
  }
  .mnav-btn span { font-size: 10px; }
  .mnav-btn.is-active { color: var(--primary); }
  .mnav-btn.compose {
    width: 52px; height: 52px; min-width: 52px; min-height: 52px; border-radius: 50%;
    background: var(--primary); color: var(--on-primary);
    box-shadow: 0 6px 18px rgba(37,99,235,.4); font-size: 20px;
  }
  .compose { right: 0; left: 0; bottom: 0; width: 100%; height: 100vh; max-height: none; border-radius: 0; border: 0; }
  .compose-resizer { display: none; }
  .compose.is-min { height: 56px; }
  .snackbar { bottom: 78px; min-width: 0; }
  .att-card { min-width: 0; width: 100%; max-width: none; }
  .help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .brand-mark { width: 32px; height: 32px; }
  .search-input { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .topbar, .sidebar, .toolbar, .list-pane, .mobile-nav, .snackbar, .compose, .reading-bar, .reply-box { display: none !important; }
  .app, .layout, .main, .content, .reading-pane { display: block !important; height: auto !important; overflow: visible !important; position: static !important; }
  .reading-scroll { padding: 0; max-width: none; }
}

/* ============================ Correções mobile ============================ */
@media (max-width: 860px) {
  .hide-mobile { display: none !important; }

  .topbar-actions { gap: 0; }
  .topbar-actions .avatar {
    display: inline-grid;
    width: 36px; height: 36px;
    margin-left: 2px;
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow-1);
  }
  .topbar-actions .avatar img { width: 28px; height: 28px; object-fit: contain; }

  .search-box { padding-left: 12px; gap: 6px; }
  .search-ic { width: 17px; height: 17px; }

  /* Sem checkbox no mobile: ganha espaço e fica como o Gmail */
  .row-check { display: none !important; }
  .row { padding: 12px 8px 12px 4px; gap: 4px; }
  .row-star { width: 30px; height: 30px; margin-top: 4px; }
  .row-main { padding-right: 2px; }
  .row-from { font-size: 14px; }
  .row-subject { font-size: 13.5px; }
  .row-line3 { font-size: 12.5px; }

  /* Barra de leitura sem estouro */
  .reading-bar { padding: 6px 6px; gap: 0; }
  .reading-crumbs { flex: 1; min-width: 0; padding: 0 4px; font-size: 11.5px; }
  .reading-actions { gap: 0; flex: 0 0 auto; }
  .reading-actions .icon-btn { width: 36px; height: 36px; }
  .reading-scroll { padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); }

  /* Navegação inferior */
  .mobile-nav { padding-bottom: calc(6px + env(safe-area-inset-bottom)); height: auto; flex-basis: 62px; }
  .mnav-btn { min-width: 52px; min-height: 46px; gap: 2px; }
  .mnav-btn .ic { width: 22px; height: 22px; }
  .mnav-btn span { font-size: 10px; line-height: 1; }
  .mnav-btn.compose { width: 50px; height: 50px; min-width: 50px; min-height: 50px; }
  .mnav-btn.compose .ic { width: 22px; height: 22px; }

  /* Compose em tela cheia com área segura */
  .compose {
    height: 100dvh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .compose-foot { padding-bottom: env(safe-area-inset-bottom); }

  .snackbar { bottom: calc(74px + env(safe-area-inset-bottom)); }
}

/* ============================ Logo por tema ============================ */
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

.brand-logo { background: var(--surface); }
.avatar { background: var(--surface); overflow: hidden; }
.avatar img { object-fit: contain; display: block; }
.avatar .logo-light, .avatar .logo-dark { width: 24px; height: 24px; }

/* Garante que o ícone do mobile não use emoji */
.mnav-btn, .mnav-btn * { font-family: var(--font); }

/* ====================================================================
   Correções de mobile (rodada 3) — aplicadas por último para vencer
   as regras anteriores de mesmo seletor.
   ==================================================================== */
@media (max-width: 860px) {
  /* 1) Leitura não deve cobrir a barra superior */
  .reading-pane {
    top: var(--topbar);
    bottom: 0;
    height: auto;
    padding-top: 0;
  }
  .reading-bar {
    top: 0;
    background: var(--surface);
  }
  .reading-scroll {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  /* 2) Alvos de toque confortáveis (mínimo 44px) */
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn.small { width: 38px; height: 38px; }

  .topbar { gap: 6px; }
  .topbar-actions .avatar,
  .avatar {
    width: 44px;
    height: 44px;
    margin-left: 0;
    background: var(--surface);
    overflow: hidden;
  }
  .avatar .logo-light, .avatar .logo-dark { width: 26px; height: 26px; }

  .search-box { height: 44px; border-radius: 22px; }
  .search-box input { height: 100%; font-size: 15px; }

  .brand-logo { width: 40px; height: 40px; border-radius: 12px; }

  /* 3) Drawer: itens com altura de toque */
  .sidebar { padding-top: 10px; }
  .sidebar .nav-item,
  .sidebar .label-item { height: 44px; }
  .sidebar .mini-btn { width: 34px; height: 34px; }
  .sidebar .compose-btn { height: 52px; }

  /* 4) Lista: estrela e linha com área de toque maior */
  .row { min-height: 76px; padding: 10px 6px 10px 4px; }
  .row-star { width: 40px; height: 40px; margin-top: 2px; }
  .row-star .ic { width: 18px; height: 18px; }
  .row-main { padding: 6px 2px 6px 0; }

  /* 5) Barra de leitura: botões 44px sem estourar */
  .reading-actions .icon-btn { width: 40px; height: 40px; }
  .reading-actions .icon-btn .ic { width: 19px; height: 19px; }
  .reading-crumbs { font-size: 11px; }

  /* 6) Navegação inferior */
  .mobile-nav { flex-basis: 64px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .mnav-btn { min-height: 50px; min-width: 54px; }
  .mnav-btn .ic { width: 23px; height: 23px; }

  /* 7) Compose: respeita topo e base, sem cobrir a barra inferior */
  .compose {
    top: 0;
    bottom: 0;
    height: 100dvh;
  }
  .compose-head { height: 52px; }
  .compose-foot { flex-wrap: nowrap; }
  .compose-foot .icon-btn.small { width: 40px; height: 40px; }
  .send-btn { height: 40px; padding: 0 20px; }

  /* 8) Modal: rolagem interna e margem segura */
  .modal { max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .modal-backdrop { padding: 16px; }

  /* 9) Chips e etiquetas não estouram a linha */
  .row-chips { flex-wrap: wrap; }
  .chip { max-width: 100%; }
}

/* 10) Texto pequeno: sobe 1px no mobile para leitura confortável */
@media (max-width: 860px) {
  .row-line3 { font-size: 13px; }
  .row-date { font-size: 11.5px; }
  .reading-meta, .msg-when { font-size: 11.5px; }
}

/* ====================================================================
   Correções de mobile (rodada 4)
   ==================================================================== */
@media (max-width: 860px) {
  /* Pílulas de resposta com altura de toque */
  .pill { height: 44px; padding: 0 18px; }
  .reply-tabs { gap: 8px; }
  .reply-tabs .pill { flex: 1 1 auto; justify-content: center; }

  /* Cabeçalho do compose: botões 40px */
  .compose-head { height: 54px; }
  .compose-head .icon-btn.small { width: 40px; height: 40px; }

  /* Enquanto escreve, a navegação inferior sai da frente */
  body.compose-open .mobile-nav { display: none; }
  body.compose-open .compose { bottom: 0; height: 100dvh; }
}

/* Em telas maiores o compose continua flutuante */
@media (min-width: 861px) {
  body.compose-open .mobile-nav { display: none; }
}

/* ============================ Assinatura ============================ */
.sig-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; margin-bottom: 8px;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--bg-soft);
}
.sig-editor {
  min-height: 200px;
  border: 1px solid var(--border-strong);
  border-radius: 0 0 10px 10px;
  padding: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  outline: 0;
  color: var(--text);
  background: var(--surface);
}
.sig-editor:empty::before { content: attr(data-placeholder); color: var(--text-dim); }
.sig-editor img { max-width: 100%; height: auto; }
.sig-editor table { border-collapse: collapse; }
.sig-editor td, .sig-editor th { padding: 0 6px 0 0; vertical-align: top; }
.sig-preview-wrap {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface);
}
.sig-preview-label {
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px;
}
.sig-hint { margin: 8px 0 0; font-size: 12px; color: var(--text-dim); }

/* Bloco de assinatura dentro do compose */
.sig-block {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
  user-select: none;
}
.sig-block img { max-width: 240px; height: auto; display: block; margin-top: 6px; }

@media (max-width: 860px) {
  .sig-block img { max-width: 60vw; }
}

/* Prévia da assinatura (bloco separado, não editável) */
.sig-preview { display: none; }
.sig-preview.is-on {
  display: block;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sig-preview table { border-collapse: collapse; }
.sig-preview td, .sig-preview th { padding: 0 6px 0 0; vertical-align: top; }
.sig-preview img { max-width: 100%; height: auto; }
.sig-preview a { color: var(--primary); }

/* ========================= Editor de assinatura (foto + dados) ========================= */
.sig-build { display: flex; flex-direction: column; gap: 6px; }
.sig-photo-row { display: flex; align-items: center; gap: 14px; padding-bottom: 8px; }
.sig-photo {
  width: 84px; height: 84px; border-radius: 50%;
  overflow: hidden; background: #E8EEFC; color: #2563EB;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; flex: 0 0 auto;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(37,99,235,.18);
}
.sig-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sig-photo-actions { display: flex; align-items: center; flex-wrap: wrap; }
@media (max-width: 860px) {
  .sig-photo { width: 72px; height: 72px; }
}
