/* ==========================================================================
   Buzón — design tokens
   ========================================================================== */
:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-sunken: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ink: #1e40af;
  --on-primary: #ffffff;
  --success: #16a34a;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --teal: #0d9488;
  --teal-soft: #f0fdfa;
  --unread-bg: #f5f9ff;
  --selected-bg: #eaf1ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 64px -16px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --chart-a: #2563eb;
  --chart-b: #0d9488;
  --sidebar-w: 272px;
  --list-w: 400px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --bg-soft: #171717;
    --bg-sunken: #232323;
    --surface: #1a1a1a;
    --surface-2: #202020;
    --border: #2a2a2a;
    --border-strong: #3a3a3a;
    --text: #ededed;
    --text-2: #a3a3a3;
    --text-3: #6e6e6e;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: rgba(59, 130, 246, .13);
    --primary-ink: #9ec5ff;
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, .12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, .1);
    --warning-border: rgba(251, 191, 36, .28);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .12);
    --violet: #a78bfa;
    --violet-soft: rgba(167, 139, 250, .14);
    --teal: #2dd4bf;
    --teal-soft: rgba(45, 212, 191, .12);
    --unread-bg: rgba(255, 255, 255, .025);
    --selected-bg: rgba(255, 255, 255, .07);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, .7);
    --chart-a: #3b82f6;
    --chart-b: #0d9488;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212;
  --bg-soft: #171717;
  --bg-sunken: #232323;
  --surface: #1a1a1a;
  --surface-2: #202020;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --text: #ededed;
  --text-2: #a3a3a3;
  --text-3: #6e6e6e;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, .13);
  --primary-ink: #9ec5ff;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, .12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .1);
  --warning-border: rgba(251, 191, 36, .28);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .14);
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, .12);
  --unread-bg: rgba(255, 255, 255, .025);
  --selected-bg: rgba(255, 255, 255, .07);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, .7);
  --chart-a: #3b82f6;
  --chart-b: #0d9488;
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--selected-bg); }

/* ==========================================================================
   Shell
   ========================================================================== */
.app { display: flex; height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  transition: width .2s ease, transform .25s ease;
  position: relative;
  z-index: 30;
}
.app.collapsed .sidebar { width: 76px; }
.app.collapsed .sidebar .hide-collapsed { display: none !important; }
.app.collapsed .nav-item { justify-content: center; padding: 10px; }
.app.collapsed .brand { justify-content: center; padding-inline: 0; }
.app.collapsed .compose-btn { padding: 0; width: 44px; margin-inline: auto; }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-logo { width: 38px; height: 38px; border-radius: 11px; flex: none; box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .5); }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: -.03em; line-height: 1; }
.brand-sub { font-size: 11px; font-weight: 600; letter-spacing: .16em; color: var(--text-2); margin-top: 4px; }

.collapse-btn {
  position: absolute; top: 74px; right: -13px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--text-2);
  box-shadow: var(--shadow-sm); z-index: 2;
}
.collapse-btn:hover { color: var(--text); }
.app.collapsed .collapse-btn svg { transform: rotate(180deg); }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 16px 14px 12px; scrollbar-width: thin; }
.compose-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 44px; border-radius: 12px;
  background: var(--primary); color: var(--on-primary); font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .6);
  transition: background .15s, transform .1s;
  margin-bottom: 14px;
}
.compose-btn:hover { background: var(--primary-hover); }
.compose-btn:active { transform: scale(.98); }

.nav-section { margin-top: 18px; }
.nav-label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-2); padding: 0 12px 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 12px; border-radius: 10px;
  color: var(--text); font-weight: 500; text-align: left;
  position: relative; transition: background .12s;
}
.nav-item:hover { background: var(--bg-sunken); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px;
  width: 4px; border-radius: 0 4px 4px 0; background: var(--primary);
}
.nav-item .i { color: var(--text-2); }
.nav-item.active .i { color: var(--primary); }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count {
  font-size: 12px; font-weight: 600; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--bg-sunken); color: var(--text-2);
}
.nav-item.active .count, .count.hot { background: var(--primary); color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.nav-domain { font-weight: 600; }
.nav-edit { font-size: 11.5px; letter-spacing: 0; text-transform: none; font-weight: 600; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.pick-bar {
  position: sticky; top: -32px; z-index: 5; margin: 0 -40px 18px; padding: 14px 40px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pick-bar .search { flex: 1 1 280px; max-width: 520px; }
.pick-bar .pick-count { font-weight: 700; white-space: nowrap; }
.pick-bar .pick-count small { display: block; font-weight: 500; color: var(--text-2); font-size: 12.5px; }
.pick-bar .grow { flex: 1; }
.pick-section { margin-bottom: 22px; }
.pick-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pick-section-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.pick-section-head .faint { font-size: 13px; }
.pick-section-head .links { margin-left: auto; font-size: 13px; }
.grid.notif { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); align-items: start; }
@media (max-width: 1024px) { .grid.notif { grid-template-columns: 1fr; } }
.pick-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); cursor: pointer; transition: border-color .12s, background .12s; min-width: 0;
}
.pick-item:hover { border-color: var(--border-strong); background: var(--bg-soft); }
.pick-item .grow { flex: 1; min-width: 0; }
.pick-item:has(input:not(:checked)) { opacity: .55; }
.nav-domain .chev { margin-left: auto; transition: transform .15s; color: var(--text-3); }
.nav-domain.open .chev { transform: rotate(180deg); }
.nav-mailboxes { padding-left: 10px; display: none; }
.nav-mailboxes.open { display: block; }
.nav-mailboxes .nav-item { padding-block: 7px; font-size: 13.5px; }
.nav-mailboxes .nav-item .label { color: var(--text-2); }
.nav-mailboxes .nav-item.unread .label { color: var(--text); font-weight: 600; }

.user-card {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 14px 14px; padding: 12px; border-radius: 14px;
  border-top: 1px solid var(--border);
  text-align: left; width: calc(100% - 28px);
}
.user-card:hover { background: var(--bg-sunken); }
.user-card .meta { flex: 1; min-width: 0; }
.user-card .name { font-weight: 600; font-size: 14px; }
.user-card .email { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
  background: var(--primary); letter-spacing: .02em;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; }
.avatar.xs { width: 26px; height: 26px; font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.topbar {
  height: 72px; flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.topbar .menu-btn { display: none; }
.search {
  flex: 1; max-width: 560px; position: relative;
}
.search input {
  width: 100%; height: 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg-soft);
  padding: 0 14px 0 42px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.search input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.search .i { position: absolute; left: 14px; top: 12px; color: var(--text-3); }
.search kbd {
  position: absolute; right: 10px; top: 10px; font: 600 11px var(--font); color: var(--text-3);
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; background: var(--surface);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px;
  display: inline-grid; place-items: center; color: var(--text-2);
  transition: background .12s, color .12s; position: relative;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon-btn.active { color: var(--primary); background: var(--primary-soft); }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.live-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
  padding: 6px 11px; border-radius: 999px; color: var(--success); background: var(--success-soft);
}
.live-pill .pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
.live-pill.off { color: var(--text-2); background: var(--bg-sunken); }
.live-pill.off .pulse { animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }

.view { flex: 1; min-height: 0; overflow: auto; }
/* Pages use the full width of the content area with a consistent gutter;
   no centered max-width column (it left big empty bands on wide screens). */
.page { width: 100%; margin: 0; padding: 32px 40px 64px; }
.page-narrow { max-width: none; }
.mute-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); column-gap: 28px; }
.mute-grid > .row { border-bottom: 1px solid var(--border); }
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 16px; align-items: start; }
.conn-grid > .card { margin-bottom: 0 !important; }
@media (max-width: 860px) { .conn-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Page header / common blocks
   ========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: var(--bg-sunken); color: var(--text-2); border: 1px solid var(--border);
}
.chip.primary { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-head h1 { font-size: 32px; letter-spacing: -.035em; line-height: 1.15; margin: 12px 0 6px; font-weight: 800; }
.page-head p { color: var(--text-2); margin: 0; font-size: 15px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 34px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .12s, border-color .12s, transform .1s, box-shadow .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-sunken); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .6); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-sunken); }
.btn.sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn.square { border-radius: 11px; }
.link-btn { color: var(--primary); font-weight: 600; font-size: 14px; }
.link-btn:hover { text-decoration: underline; }

.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 14px;
  background: var(--warning-soft); border: 1px solid var(--warning-border); color: var(--text);
  margin-bottom: 14px;
}
.banner .i { color: var(--warning); }
.banner b { color: var(--warning); }
.banner.info { background: var(--primary-soft); border-color: transparent; }
.banner.info .i, .banner.info b { color: var(--primary-ink); }
.banner .grow { flex: 1; }
.banner .link-btn { white-space: nowrap; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px 26px; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; padding: 22px 26px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.card-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.card-body { padding: 8px 26px 18px; }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.grid.two { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }

.stat { display: flex; gap: 16px; padding: 22px; align-items: flex-start; }
.stat-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.teal { background: var(--teal-soft); color: var(--teal); }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-label { color: var(--text-2); font-size: 14px; }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13px; color: var(--text-2); }
button.card.stat { text-align: left; width: 100%; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.card.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }

.row-list > * + * { border-top: 1px solid var(--border); }
.row {
  display: flex; align-items: center; gap: 14px; padding: 15px 0;
}
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--text-2); font-size: 13.5px; }
.row-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.row-icon.ok { background: var(--success-soft); color: var(--success); }
.row-icon.warn { background: var(--warning-soft); color: var(--warning); }
.row-icon.info { background: var(--primary-soft); color: var(--primary); }
.row-icon.err { background: var(--danger-soft); color: var(--danger); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.empty { padding: 28px 0; color: var(--text-2); text-align: center; }
.empty-big { padding: 72px 24px; text-align: center; color: var(--text-2); }
.empty-big .art {
  width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 18px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
}
.empty-big h3 { color: var(--text); margin: 0 0 6px; font-size: 18px; }

.recent-item { display: flex; gap: 12px; padding: 13px 0; align-items: center; width: 100%; text-align: left; }
.recent-item:hover .title { color: var(--primary); }

/* Activity chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 180px; overflow: visible; }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .bar-a { fill: var(--chart-a); }
.chart .bar-b { fill: var(--chart-b); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--bg-sunken); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--text); color: var(--bg); border-radius: 10px; padding: 8px 11px;
  font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow-lg); white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}
.tooltip b { font-weight: 700; }

/* ==========================================================================
   Mail
   ========================================================================== */
.mail { display: flex; height: 100%; min-height: 0; }
.list-pane {
  width: var(--list-w); flex: none; display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--border); background: var(--bg);
}
.list-head { padding: 18px 18px 12px; border-bottom: 1px solid var(--border); }
.list-title { display: flex; align-items: center; gap: 10px; }
.list-title h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; flex: 1; min-width: 0; }
.list-title .sub { font-size: 13px; color: var(--text-2); }
.seg {
  display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  height: 32px; padding: 0 11px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none;
}
.seg button:hover { background: var(--bg-sunken); color: var(--text); }
.seg button.on { background: var(--text); color: var(--bg); }
.seg button .i { display: none; }
.list-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.msg {
  display: flex; gap: 12px; width: 100%; text-align: left;
  padding: 14px 18px 14px 16px; border-bottom: 1px solid var(--border);
  position: relative; transition: background .1s; border-left: 3px solid transparent;
}
.msg:hover { background: var(--bg-soft); }
.msg.unread { background: var(--unread-bg); }
.msg.unread::after {
  content: ""; position: absolute; left: 6px; top: 26px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
}
.msg.selected { background: var(--selected-bg); border-left-color: var(--primary); }
.msg .body { flex: 1; min-width: 0; }
.msg .top { display: flex; align-items: baseline; gap: 8px; }
.msg .from { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.unread .from { font-weight: 700; }
.msg .date { font-size: 12.5px; color: var(--text-2); flex: none; font-variant-numeric: tabular-nums; }
.msg.unread .date { color: var(--primary); font-weight: 600; }
.msg .subject { font-size: 13.8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.msg.unread .subject { font-weight: 600; }
.msg .snippet { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 2px; }
.msg .meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; color: var(--text-3); }
.mb-tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px 2px 6px; border-radius: 6px; background: var(--bg-sunken); color: var(--text-2);
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mb-tag .dot { width: 7px; height: 7px; }
.msg .star { color: #f59e0b; }
.msg .star svg { fill: currentColor; }
.load-more { padding: 16px; text-align: center; }
.skeleton { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.skeleton div { height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-sunken), var(--border), var(--bg-sunken)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 7px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

.reader-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--bg-soft); }
.reader-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--text-2); padding: 24px; }
.reader-toolbar {
  display: flex; align-items: center; gap: 4px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--bg); flex: none;
}
.reader-toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.reader-toolbar .back-btn { display: none; }
.reader-scroll { flex: 1; overflow-y: auto; padding: 26px 30px 40px; }
.reader-card { max-width: 920px; margin: 0 auto; }
.reader-subject { font-size: 23px; font-weight: 750; letter-spacing: -.025em; line-height: 1.3; margin: 0 0 14px; word-break: break-word; }
.reader-from { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.reader-from .grow { flex: 1; min-width: 0; }
.reader-from .name { font-weight: 700; }
.reader-from .addr { color: var(--text-2); font-weight: 400; font-size: 13.5px; }
.reader-from .to { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.reader-from .when { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.body-frame-wrap {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 22px 24px; box-shadow: var(--shadow-sm); overflow: hidden;
}
.body-frame-wrap iframe { width: 100%; border: 0; display: block; min-height: 60px; background: #fff; }
.plain-body { white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; color: #1f2937; }
.remote-banner { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px dashed var(--border-strong); }
.remote-banner .grow { flex: 1; }
.attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 16px; }
.att {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 13px;
  border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.att:hover { border-color: var(--primary); box-shadow: var(--shadow); text-decoration: none; }
.att .ficon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.att .grow { min-width: 0; flex: 1; }
.att .fname { font-weight: 600; font-size: 13.3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .fsize { font-size: 12px; color: var(--text-2); }
.thread { margin-top: 24px; }
.thread h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); margin: 0 0 10px; }
.thread-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); width: 100%; text-align: left; margin-bottom: 8px;
}
.thread-item:hover { border-color: var(--border-strong); }
.quick-reply {
  margin-top: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s;
}
.quick-reply:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.quick-reply textarea {
  width: 100%; border: 0; outline: none; resize: none; background: transparent; padding: 16px 18px 6px; min-height: 64px; display: block;
}
.quick-reply .qr-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px 16px; }
.quick-reply .qr-foot .grow { flex: 1; font-size: 12.5px; color: var(--text-3); }

/* ==========================================================================
   Forms, toggles, tables
   ========================================================================== */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.field small { display: block; color: var(--text-2); font-size: 12.5px; margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); padding: 0 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.form-error { color: var(--danger); font-size: 13.5px; margin: -4px 0 14px; min-height: 0; }
.toggle { position: relative; width: 42px; height: 24px; flex: none; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; cursor: pointer; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.toggle input:checked + span { background: var(--primary); }
.toggle input:checked + span::after { transform: translateX(18px); }
.check-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--primary); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-soft); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.status.ok { background: var(--success-soft); color: var(--success); }
.status.warn { background: var(--warning-soft); color: var(--warning); }
.status.err { background: var(--danger-soft); color: var(--danger); }
.status.off { background: var(--bg-sunken); color: var(--text-2); }
.color-input { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border); padding: 0; cursor: pointer; background: none; }
.color-input::-webkit-color-swatch-wrapper { padding: 3px; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 6px; }
.steps { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 7px 0; color: var(--text-2); font-size: 14px; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; flex: none; }
.steps b { color: var(--text); }
.access-domain { border: 1px solid var(--border); border-radius: 12px; padding: 4px 14px; margin-bottom: 10px; }
.access-domain .mbs { padding-left: 27px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 10px; }
.access-domain .mbs .check-row { font-size: 13.5px; }

/* Cuentas de correo */
.acct-domains { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.acct-domain {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); text-align: left; transition: border-color .12s, background .12s;
}
.acct-domain:hover { border-color: var(--border-strong); }
.acct-domain.on { border-color: var(--primary); background: var(--primary-soft); }
.acct-domain span { display: flex; flex-direction: column; }
.acct-domain small { font-size: 12px; color: var(--text-2); }
.acct-picker { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.acct-plan { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 16px; }
.seat-bar { height: 8px; border-radius: 6px; background: var(--bg-sunken); overflow: hidden; margin: 6px 0 4px; }
.seat-bar.sm { height: 6px; }
.seat-bar i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.acct-tabs { margin: 0 0 16px; }
.acct-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.acct-head h3 { margin: 0; font-size: 18px; }
.acct-head p { margin: 4px 0 0; font-size: 13.5px; max-width: 720px; }
.addr-input { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.addr-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.addr-input .input { border: 0; box-shadow: none !important; border-radius: 0; }
.addr-input span { padding: 0 14px; color: var(--text-2); white-space: nowrap; background: var(--bg-soft); align-self: stretch; display: flex; align-items: center; border-left: 1px solid var(--border); }
.secret-box { display: grid; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--bg-sunken); margin-bottom: 12px; }
.secret-box small { display: block; font-size: 12px; color: var(--text-2); }
.secret-box b { font-size: 15px; word-break: break-all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.log-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.log-filters .input { width: auto; min-width: 170px; height: 38px; }

/* ==========================================================================
   Modals, composer, toasts, menus
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); overflow: auto;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 4px; }
.modal-head h3 { margin: 0; font-size: 19px; flex: 1; letter-spacing: -.015em; }
.modal-body { padding: 14px 24px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 24px 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.composer {
  position: fixed; right: 24px; bottom: 0; width: 640px; max-width: calc(100vw - 32px);
  height: min(680px, calc(100dvh - 60px)); z-index: 90;
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slideup .2s ease;
}
.composer.min { height: 52px; overflow: hidden; }
@keyframes slideup { from { transform: translateY(30px); opacity: 0; } }
.composer-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--border); cursor: default; }
.composer-head h4 { margin: 0; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-fields { padding: 0 20px; }
.cf-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); min-height: 46px; padding: 4px 0; }
.cf-row > label { font-size: 13px; color: var(--text-2); width: 48px; flex: none; }
.cf-row input, .cf-row select { border: 0; outline: none; background: transparent; flex: 1; min-width: 0; height: 36px; }
.cf-row .cc-toggle { font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 4px 8px; border-radius: 8px; }
.cf-row .cc-toggle:hover { background: var(--bg-sunken); }
.recips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.recips input { min-width: 140px; }
.recip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); color: var(--primary-ink); border-radius: 8px; padding: 3px 4px 3px 9px; font-size: 13px; font-weight: 500; }
.recip.bad { background: var(--danger-soft); color: var(--danger); }
.recip button { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 5px; }
.recip button:hover { background: rgba(0, 0, 0, .08); }
.editor-tools { display: flex; gap: 2px; padding: 6px 14px; border-bottom: 1px solid var(--border); }
.editor-tools button { width: 34px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); }
.editor-tools button:hover { background: var(--bg-sunken); color: var(--text); }
.editor { flex: 1; overflow-y: auto; padding: 16px 20px; outline: none; line-height: 1.6; word-wrap: break-word; }
.editor:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.editor blockquote, .quote { border-left: 3px solid var(--border-strong); margin: 10px 0 0; padding: 2px 0 2px 14px; color: var(--text-2); }
.editor .sig { color: var(--text-2); }
.editor img { max-width: 100%; }
.composer-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 8px; }
.composer-atts .att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-radius: 10px; background: var(--bg-sunken); font-size: 12.5px; }
.composer-atts .att-chip button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.composer-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.composer-foot .grow { flex: 1; font-size: 12px; color: var(--text-3); }
.track-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); border: 1px dashed var(--border-strong);
}
.track-toggle:hover:not(:disabled) { color: var(--text); background: var(--bg-sunken); }
.track-toggle.on { color: var(--primary-ink); background: var(--primary-soft); border: 1px solid transparent; }
.track-toggle:disabled { opacity: .45; cursor: not-allowed; }
.track-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.track-badge.seen { color: var(--success); }
.track-banner { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: var(--bg-sunken); color: var(--text-2); }
.track-banner.seen { background: var(--success-soft); color: var(--text); }
.track-banner.seen .i { color: var(--success); }
@media (max-width: 860px) { .track-toggle span { display: none; } }

.menu {
  position: fixed; z-index: 120; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: pop .12s ease;
}
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: 9px; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--bg-sunken); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: pop .18s ease; max-width: calc(100vw - 32px);
}
.toast.err { background: var(--danger); color: #fff; }
.toast button { color: inherit; font-weight: 700; text-decoration: underline; margin-left: 6px; }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth {
  min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  position: relative; overflow: auto; isolation: isolate; color: #fff;
  background: #070b18;
}
/* Animated aurora: four blurred blobs drifting slowly. */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; filter: blur(70px) saturate(130%); }
.aurora i { position: absolute; border-radius: 50%; opacity: .75; mix-blend-mode: screen; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 55vw; height: 55vw; left: -12vw; top: -18vw; background: #2563eb; }
.aurora i:nth-child(2) { width: 45vw; height: 45vw; right: -10vw; top: 10vh; background: #7c3aed; animation-duration: 26s; animation-delay: -6s; opacity: .55; }
.aurora i:nth-child(3) { width: 40vw; height: 40vw; left: 20vw; bottom: -20vw; background: #0d9488; animation-duration: 30s; animation-delay: -12s; opacity: .6; }
.aurora i:nth-child(4) { width: 25vw; height: 25vw; left: 38vw; top: 30vh; background: #db2777; animation-duration: 24s; animation-delay: -3s; opacity: .14; }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6vw, 4vh) scale(1.12); } 100% { transform: translate(-4vw, 8vh) scale(.95); } }
.auth-grid-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}
@media (prefers-reduced-motion: reduce) { .aurora i, .auth-notif, .auth-preview-row { animation: none !important; } }

.auth-hero { padding: 56px clamp(32px, 6vw, 96px); display: flex; flex-direction: column; justify-content: center; }
.auth-hero .brand { border: 0; padding: 0 0 44px; }
.auth-hero .brand-sub { color: rgba(255, 255, 255, .6); }
.auth .brand-logo { box-shadow: 0 10px 30px -6px rgba(37, 99, 235, .7); }
.auth-hero h2 { font-size: clamp(38px, 4.2vw, 60px); line-height: 1.04; letter-spacing: -.045em; margin: 0 0 18px; font-weight: 800; }
.auth-hero .grad { background: linear-gradient(90deg, #93c5fd, #c4b5fd 45%, #5eead4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { font-size: 17px; line-height: 1.6; color: rgba(255, 255, 255, .72); margin: 0 0 36px; max-width: 460px; }

.auth-stage { position: relative; max-width: 500px; padding-top: 34px; margin-bottom: 30px; }
.auth-notif {
  position: absolute; top: 0; right: -28px; z-index: 2; width: 330px; display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px; border-radius: 18px; color: #0f172a;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .55); animation: notifin .6s cubic-bezier(.2, .9, .3, 1.2) both .9s;
}
.auth-notif.in { animation: notifin .6s cubic-bezier(.2, .9, .3, 1.2) both; }
.auth-notif img { width: 38px; height: 38px; border-radius: 10px; flex: none; }
.auth-notif > div { min-width: 0; flex: 1; }
.auth-notif .n-top { display: flex; justify-content: space-between; font-size: 12px; color: #64748b; }
.auth-notif .n-top b { color: #0f172a; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; }
.auth-notif .n-title { font-weight: 700; font-size: 13.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-notif .n-body { font-size: 13px; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes notifin { from { opacity: 0; transform: translateY(-14px) scale(.96); } }

.auth-preview {
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); border-radius: 22px;
  padding: 10px; backdrop-filter: blur(16px); box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .6);
  transform: perspective(1200px) rotateX(4deg) rotateY(-6deg); transform-origin: left center;
}
.auth-preview-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px 12px; font-size: 13px; }
.auth-preview-head span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.auth-preview-head span:nth-child(1) { background: #f87171; } .auth-preview-head span:nth-child(2) { background: #fbbf24; } .auth-preview-head span:nth-child(3) { background: #34d399; }
.auth-preview-head b { margin-left: 8px; }
.auth-preview-head em { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 700; background: #f97316; color: #fff; padding: 3px 10px; border-radius: 999px; }
.auth-preview-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; background: rgba(255, 255, 255, .95); color: #0f172a;
  margin-top: 7px; animation: rowin .5s ease both;
}
.auth-preview-row > i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.auth-preview-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.auth-preview-row b { font-size: 14px; }
.auth-preview-row span { font-size: 12.5px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-preview-row small { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: #64748b; margin-top: 3px; }
.auth-preview-row small em { width: 6px; height: 6px; border-radius: 50%; }
.auth-preview-row time { font-size: 12px; color: #2563eb; font-weight: 700; align-self: flex-start; }
@keyframes rowin { from { opacity: 0; transform: translateY(10px); } }
.auth-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-chips span {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; padding: 7px 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .88);
}

.auth-side { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px 24px; gap: 18px; }
.auth-card {
  width: 100%; max-width: 440px; padding: 38px 36px 30px; border-radius: 28px;
  background: rgba(17, 17, 20, .62); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(28px) saturate(160%); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .08);
  animation: pop .4s ease both;
}
.auth-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: rgba(59, 130, 246, .16); color: #93c5fd; margin-bottom: 16px; }
.auth-card h1 { font-size: 30px; letter-spacing: -.035em; margin: 0 0 8px; font-weight: 800; color: #fff; }
.auth-card p.lead { color: rgba(255, 255, 255, .62); margin: 0 0 26px; font-size: 15px; }
.auth-card .field > span { color: rgba(255, 255, 255, .85); }
.auth-card .input {
  background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: #fff;
}
.auth-card .input::placeholder { color: rgba(255, 255, 255, .35); }
.auth-card .input:focus { border-color: #3b82f6; background: rgba(255, 255, 255, .09); box-shadow: 0 0 0 4px rgba(59, 130, 246, .22); }
.auth-card .input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 1000px #1b2236 inset; transition: background-color 9999s; }
.auth-card .form-error { color: #fca5a5; }
.auth-submit {
  width: 100%; height: 50px; margin-top: 8px; border-radius: 14px !important; font-size: 15px;
  background: linear-gradient(135deg, #3b82f6, #6366f1) !important; border: 0 !important;
  box-shadow: 0 12px 28px -10px rgba(99, 102, 241, .8) !important; position: relative; overflow: hidden;
}
.auth-submit::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .28) 50%, transparent 65%); transform: translateX(-100%); transition: transform .6s; }
.auth-submit:hover::after { transform: translateX(100%); }
.auth-submit .i { transition: transform .15s; }
.auth-submit:hover .i { transform: translateX(3px); }
.auth-mobile-brand { display: none; border: 0; padding: 0 0 24px; }
.auth .brand-name { color: #fff; }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: rgba(255, 255, 255, .4); pointer-events: none; }
.input-icon .input { height: 50px; padding-left: 42px; border-radius: 13px; }
.input-icon:focus-within > .i { color: #60a5fa; }
.pass-toggle { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: rgba(255, 255, 255, .45); }
.pass-toggle:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 22px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .45); }
.auth-copy { font-size: 12px; color: rgba(255, 255, 255, .35); margin: 0; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ==========================================================================
   Responsive
   ========================================================================== */
.scrim { display: none; }
.fab { display: none; }

@media (max-width: 1200px) {
  :root { --list-w: 360px; }
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid.two { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-card { padding: 30px 22px 24px; border-radius: 24px; }
  .aurora i:nth-child(1) { width: 110vw; height: 110vw; }
  .aurora i:nth-child(2) { width: 90vw; height: 90vw; }
  .page { padding: 28px 24px 56px; }
}
@media (max-width: 860px) {
  body { font-size: 15px; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); box-shadow: var(--shadow-lg);
    width: min(300px, 86vw) !important; padding-top: env(safe-area-inset-top);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 25; animation: fade .15s; }
  .collapse-btn { display: none; }
  .app.collapsed .sidebar .hide-collapsed { display: revert !important; }
  .topbar { height: auto; min-height: 60px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 6px; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar .live-pill { display: none; }
  .search kbd { display: none; }
  .search input { height: 40px; }
  .page { padding: 22px 16px calc(88px + env(safe-area-inset-bottom)); }
  .pick-bar { margin: 0 -16px 16px; padding: 12px 16px; top: -22px; }
  .pick-bar { gap: 8px; }
  .pick-bar .pick-count { flex-basis: 100%; }
  .pick-bar .grow { display: none; }
  .pick-bar .btn.primary { margin-left: auto; }
  .pick-bar .search { flex-basis: 100%; max-width: none; order: 3; }
  .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pick-item { padding: 10px; gap: 8px; }
  .pick-item .toggle { transform: scale(.85); transform-origin: right center; }
  .page-head { flex-direction: column; gap: 4px; }
  .page-head h1 { font-size: 26px; }
  .page-head .actions { padding-top: 6px; }
  .grid.stats { gap: 12px; }
  .stat { padding: 16px; gap: 12px; flex-direction: column; }
  .stat-icon { width: 40px; height: 40px; }
  .stat-value { font-size: 26px; }
  .card-head, .card-body { padding-left: 18px; padding-right: 18px; }
  .list-pane { width: 100%; border-right: 0; }
  .reader-pane { display: none; }
  .mail.has-reader .list-pane { display: none; }
  .mail.has-reader .reader-pane { display: flex; }
  .reader-toolbar { padding: 8px 8px; overflow-x: auto; }
  .reader-toolbar .back-btn { display: inline-grid; }
  .reader-toolbar .hide-mobile { display: none; }
  .reader-scroll { padding: 18px 14px calc(40px + env(safe-area-inset-bottom)); }
  .reader-subject { font-size: 20px; }
  .body-frame-wrap { padding: 14px; border-radius: 14px; }
  .list-scroll { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .fab {
    display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; border-radius: 18px; background: var(--primary); color: #fff; z-index: 40;
    box-shadow: 0 10px 24px -6px rgba(37, 99, 235, .6);
  }
  .fab.hidden, .fab.reading { display: none; }
  .composer { right: 0; left: 0; bottom: 0; top: 0; width: 100%; max-width: none; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .composer.min { top: auto; height: calc(56px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; padding-top: 0; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); }
  .table .hide-sm { display: none; }
  .table td, .table th { padding: 10px 8px; }
  #toast-root { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-sub { display: none; }
}
