/* Skien Mails — Material 3 inspired styles. Light + dark themes via [data-theme]. */
@font-face {
  font-family: 'Google Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(../fonts/google-sans-latin-ext-wght-normal.woff2) format('woff2-variations'), url(../fonts/google-sans-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Google Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(../fonts/google-sans-latin-wght-normal.woff2) format('woff2-variations'), url(../fonts/google-sans-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: 'Google Sans', 'Segoe UI', Roboto, system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, 'Roboto Mono', monospace;
  --radius-xs: 8px;
  --radius-s: 12px;
  --radius-m: 16px;
  --radius-l: 24px;
  --radius-xl: 28px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(.05, .7, .1, 1);
  --topbar-h: 64px;
  --drawer-w: 256px;
  color-scheme: light;

  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-1: #f8fafd;
  --surface-2: #f2f6fc;
  --surface-3: #e9eef6;
  --surface-4: #dde3ea;
  --row-read: #f2f6fc;
  --row-unread: #ffffff;
  --row-hover-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --row-selected: #c2dbff;
  --on: #1f1f1f;
  --on-2: #444746;
  --on-3: #747775;
  --outline: #c4c7c5;
  --outline-2: #e1e3e1;
  --primary: #0b57d0;
  --primary-hover: #0842a0;
  --on-primary: #ffffff;
  --primary-container: #d3e3fd;
  --on-primary-container: #041e49;
  --title: #0b57d0;
  --nav-active: #d3e3fd;
  --on-nav-active: #001d35;
  --nav-hover: rgba(68, 71, 70, .08);
  --compose: #c2e7ff;
  --on-compose: #001d35;
  --compose-shadow: 0 1px 3px rgba(0,0,0,.08);
  --state-hover: rgba(31, 31, 31, .08);
  --state-press: rgba(31, 31, 31, .12);
  --danger: #b3261e;
  --danger-container: #f9dedc;
  --on-danger-container: #410e0b;
  --success: #146c2e;
  --success-container: #c4eed0;
  --warning: #7a5900;
  --warning-container: #ffefc9;
  --star: #e6a700;
  --chip-green: #0f5223;
  --chip-green-bg: #c4eed0;
  --chip-blue: #0842a0;
  --chip-blue-bg: #d3e3fd;
  --chip-red: #8c1d18;
  --chip-red-bg: #f9dedc;
  --scrim: rgba(0, 0, 0, .32);
  --shadow-1: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-2: 0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
  --shadow-3: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  --tooltip-bg: #3c4043;
  --tooltip-on: #fff;
  --snackbar: #303030;
  --on-snackbar: #f2f2f2;
  --snackbar-action: #a8c7fa;
  --mail-paper: #ffffff;
  --card-border: transparent;
  --search: #e9eef6;
  --search-focus: #ffffff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0f0f10;
  --surface-1: #141415;
  --surface-2: #1b1b1c;
  --surface-3: #232325;
  --surface-4: #2d2e30;
  --row-read: #0f0f10;
  --row-unread: #18181a;
  --row-hover-shadow: inset 1px 0 0 #2d2e30, inset -1px 0 0 #2d2e30, 0 1px 3px 0 rgba(0,0,0,.6);
  --row-selected: #173a74;
  --on: #e3e3e3;
  --on-2: #c4c7c5;
  --on-3: #8e918f;
  --outline: #444746;
  --outline-2: #262628;
  --primary: #a8c7fa;
  --primary-hover: #d3e3fd;
  --on-primary: #062e6f;
  --primary-container: #0842a0;
  --on-primary-container: #d3e3fd;
  --title: #a8c7fa;
  --nav-active: #0b57d0;
  --on-nav-active: #ffffff;
  --nav-hover: rgba(227, 227, 227, .08);
  --compose: #1e1f20;
  --on-compose: #e3e3e3;
  --compose-shadow: 0 0 0 1px #2d2e30;
  --state-hover: rgba(227, 227, 227, .08);
  --state-press: rgba(227, 227, 227, .12);
  --danger: #f2b8b5;
  --danger-container: #601410;
  --on-danger-container: #f9dedc;
  --success: #6dd58c;
  --success-container: #0f5223;
  --warning: #ffd36b;
  --warning-container: #4a3700;
  --star: #fdd663;
  --chip-green: #6dd58c;
  --chip-green-bg: #0b3a1a;
  --chip-blue: #a8c7fa;
  --chip-blue-bg: #0c2b5c;
  --chip-red: #f2b8b5;
  --chip-red-bg: #4f1512;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-1: 0 1px 3px rgba(0,0,0,.6);
  --shadow-2: 0 2px 8px rgba(0,0,0,.6);
  --shadow-3: 0 8px 28px rgba(0,0,0,.7), 0 0 0 1px #2d2e30;
  --tooltip-bg: #e3e3e3;
  --tooltip-on: #1f1f1f;
  --snackbar: #e3e3e3;
  --on-snackbar: #1f1f1f;
  --snackbar-action: #0b57d0;
  --mail-paper: #ffffff;
  --card-border: #232325;
  --search: #1b1b1c;
  --search-focus: #232325;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.43;
  color: var(--on);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.ic { width: 20px; height: 20px; fill: currentColor; flex: none; vertical-align: middle; }
.ic.s { width: 18px; height: 18px; }
.ic.xs { width: 16px; height: 16px; }
.ic.l { width: 24px; height: 24px; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--outline) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- buttons */
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--on-2);
  cursor: pointer;
  flex: none;
  transition: background-color .15s var(--ease);
}
.icon-btn:hover { background: var(--state-hover); color: var(--on); }
.icon-btn:active { background: var(--state-press); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn[disabled] { opacity: .38; pointer-events: none; }
.icon-btn.on { color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px;
  border-radius: 20px; border: 0;
  font-weight: 500; font-size: 14px; letter-spacing: .1px;
  cursor: pointer; white-space: nowrap;
  background: transparent; color: var(--primary);
  transition: background-color .15s var(--ease), box-shadow .15s var(--ease);
  text-decoration: none;
}
.btn .ic { width: 18px; height: 18px; margin-left: -6px; }
.btn:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.filled:hover { background: var(--primary-hover); box-shadow: var(--shadow-1); }
.btn.tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn.tonal:hover { box-shadow: var(--shadow-1); }
.btn.outlined { border: 1px solid var(--outline); color: var(--primary); }
.btn.outlined:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn.danger { color: var(--danger); }
.btn.danger.filled { background: var(--danger); color: var(--surface); }
.btn.sm { height: 32px; padding: 0 16px; font-size: 13px; }
.btn[disabled], .btn.busy { opacity: .5; pointer-events: none; }
.btn.block { width: 100%; }

/* ---------------------------------------------------------------- layout */
.app {
  display: grid;
  grid-template-columns: var(--drawer-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh; height: 100dvh;
  transition: grid-template-columns .25s var(--ease);
}
.app.collapsed { grid-template-columns: 72px 1fr; }

.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 12px;
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--on); padding: 0 8px 0 4px; width: calc(var(--drawer-w) - 64px); min-width: 0; }
.brand img { width: 36px; height: 36px; }
.brand span { font-size: 22px; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--on-2); }
.brand b { font-weight: 500; color: var(--on); }

.search {
  flex: 1; max-width: 720px; min-width: 0;
  height: 48px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 4px;
  background: var(--search);
  border-radius: 24px;
  transition: background-color .15s var(--ease), box-shadow .15s var(--ease);
  position: relative;
}
.search:focus-within { background: var(--search-focus); box-shadow: var(--shadow-1); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; height: 100%; font-size: 16px; min-width: 0; }
.search input::placeholder { color: var(--on-2); }
.search-help {
  position: absolute; left: 0; right: 0; top: 52px; z-index: 30;
  background: var(--surface-1); border-radius: var(--radius-m); box-shadow: var(--shadow-3);
  padding: 12px 16px; color: var(--on-2); font-size: 13px;
  display: none;
}
.search:focus-within .search-help.show { display: block; }
.search-help code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; color: var(--on); }
.search-help .ops { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.avatar-btn { border: 0; padding: 4px; background: transparent; border-radius: 50%; cursor: pointer; }
.avatar-btn:hover { background: var(--state-hover); }

.drawer {
  overflow-y: auto; overflow-x: hidden;
  padding: 8px 12px 16px 8px;
  display: flex; flex-direction: column;
}
.compose-btn {
  display: inline-flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 20px 0 16px; margin: 0 0 16px 0;
  border: 0; border-radius: var(--radius-m);
  background: var(--compose); color: var(--on-compose);
  font-size: 14px; font-weight: 500;
  cursor: pointer; align-self: flex-start;
  box-shadow: var(--compose-shadow);
  transition: box-shadow .2s var(--ease), background-color .2s;
}
.compose-btn:hover { box-shadow: var(--shadow-2); }
.compose-btn .ic { width: 24px; height: 24px; }
.app.collapsed .compose-btn { width: 56px; padding: 0; justify-content: center; }
.app.collapsed .compose-btn span, .app.collapsed .nav-item span, .app.collapsed .nav-item .count, .app.collapsed .nav-section { display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  height: 36px; padding: 0 12px 0 16px;
  border-radius: 18px;
  color: var(--on); text-decoration: none;
  font-size: 14px; letter-spacing: .1px;
  cursor: pointer; user-select: none;
  position: relative;
}
.app.collapsed .nav-item { width: 48px; padding: 0 12px; justify-content: center; }
.nav-item:hover { background: var(--nav-hover); }
.nav-item .ic { color: var(--on-2); }
.nav-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.nav-item.active { background: var(--nav-active); color: var(--on-nav-active); font-weight: 700; }
.nav-item.active .ic { color: var(--on-nav-active); }
.nav-item.unread span { font-weight: 700; }
.nav-section { margin: 16px 0 6px 16px; font-size: 13px; font-weight: 500; color: var(--on-2); letter-spacing: .1px; display: flex; align-items: center; justify-content: space-between; }
.drawer-foot { margin-top: auto; padding: 16px 12px 0 16px; color: var(--on-3); font-size: 12px; line-height: 1.6; }
.app.collapsed .drawer-foot { display: none; }
.storage-mini .bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin: 6px 0 4px; }
.storage-mini .bar i { display: block; height: 100%; background: var(--primary); border-radius: 2px; }

.main { min-width: 0; min-height: 0; display: flex; gap: 16px; padding: 0 16px 16px 0; }
.surface {
  flex: 1; min-width: 0; min-height: 0;
  background: var(--surface);
  border-radius: var(--radius-m);
  border: 1px solid var(--card-border);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
.rail { width: 300px; flex: none; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
@media (max-width: 1360px) { .rail { display: none; } }

/* ---------------------------------------------------------------- cards (rail, admin) */
.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-l);
  padding: 20px;
}
[data-theme="dark"] .card { background: #0f0f10; }
.card h3 { margin: 0; font-size: 16px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 .pct { color: #d7aefb; font-weight: 700; font-size: 15px; }
[data-theme="light"] .card h3 .pct { color: #8430ce; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin: 14px 0 16px; }
.progress i { display: block; height: 100%; border-radius: 4px; background: #7cacf8; transition: width .6s var(--ease); }
[data-theme="light"] .progress i { background: var(--primary); }
.progress.warn i { background: #f6ae2d; }
.progress.full i { background: var(--danger); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 4px; }
.stats3 b { display: block; font-size: 24px; font-weight: 400; line-height: 1.2; }
.stats3 small { font-size: 12px; color: var(--on-2); }
.stats3 .g b { color: var(--success); }
.stats3 .r b { color: #f28b82; }
[data-theme="light"] .stats3 .r b { color: var(--danger); }
.card .link { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: var(--primary); font-weight: 500; text-decoration: none; cursor: pointer; background: none; border: 0; width: 100%; }

/* ---------------------------------------------------------------- page header (greeting) */
.page-head { padding: 20px 24px 8px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .greet { font-size: 13px; color: var(--on-2); margin: 0 0 2px; }
.page-head h1 { margin: 0; font-size: 32px; line-height: 40px; font-weight: 400; color: var(--title); letter-spacing: -.3px; }
.page-head .sub { margin: 2px 0 0; color: var(--on); font-size: 15px; }
.page-head .grow { flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--outline);
  background: transparent; color: var(--on);
  font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s;
}
.chip:hover { background: var(--state-hover); }
.chip.on { background: var(--nav-active); color: var(--on-nav-active); border-color: transparent; }
.chip .ic { width: 18px; height: 18px; margin-left: -4px; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.blue { background: var(--chip-blue-bg); color: var(--chip-blue); }
.pill.green { background: var(--chip-green-bg); color: var(--chip-green); }
.pill.red { background: var(--chip-red-bg); color: var(--chip-red); }
.pill.gray { background: var(--surface-3); color: var(--on-2); }
.pill.amber { background: var(--warning-container); color: var(--warning); }

/* ---------------------------------------------------------------- list */
.toolbar {
  display: flex; align-items: center; gap: 2px;
  min-height: 48px; padding: 4px 8px 4px 12px;
  border-bottom: 1px solid var(--outline-2);
  flex: none;
}
.toolbar .spacer { flex: 1; }
.toolbar .range { color: var(--on-2); font-size: 12px; padding: 0 8px; white-space: nowrap; }
.toolbar h2 { margin: 0 8px; font-size: 18px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; margin: 0;
  border: 2px solid var(--on-2); border-radius: 2px;
  display: inline-grid; place-content: center;
  cursor: pointer; flex: none;
  transition: background-color .1s;
}
.cb::before { content: ''; width: 10px; height: 10px; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: var(--on-primary); transform: scale(0); transition: transform .1s; }
.cb:checked, .cb:indeterminate { background: var(--primary); border-color: var(--primary); }
.cb:checked::before { transform: scale(1); }
.cb:indeterminate::before { clip-path: none; height: 2px; transform: scale(1); }
.cb-wrap { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; flex: none; }
.cb-wrap:hover { background: var(--state-hover); }

.list { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }
.row {
  display: flex; align-items: center;
  height: 40px; padding: 0 16px 0 4px;
  background: var(--row-read);
  border-bottom: 1px solid var(--outline-2);
  cursor: pointer;
  position: relative;
  font-size: 14px;
  contain: layout style;
}
.row.unread { background: var(--row-unread); }
.row.unread .who, .row.unread .subj, .row.unread .date { font-weight: 700; color: var(--on); }
.row:hover { box-shadow: var(--row-hover-shadow); z-index: 1; }
.row.selected { background: var(--row-selected); }
.row.focus::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.row .star-btn { color: var(--on-3); }
.row .star-btn.on { color: var(--star); }
.row .who { width: 200px; flex: none; padding-right: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--on); }
.row .who .n { color: var(--on-3); font-weight: 400; font-size: 12px; margin-left: 4px; }
.row .mid { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; }
.row .subj { color: var(--on); overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 70%; }
.row .snip { color: var(--on-3); overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.row .folder-tag { flex: none; }
.row .att { color: var(--on-3); flex: none; }
.row .date { width: 80px; flex: none; text-align: right; font-size: 12px; color: var(--on-2); }
.row .hover-acts { display: none; position: absolute; right: 8px; top: 0; bottom: 0; align-items: center; gap: 0; background: inherit; padding-left: 8px; }
.row:hover .hover-acts { display: flex; }
.row:hover .date { visibility: hidden; }
.row.selected .hover-acts, .row.unread .hover-acts { background: inherit; }

.empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--on-2); text-align: center; padding: 48px 24px;
}
.empty .ic { width: 64px; height: 64px; color: var(--outline); }
.empty h3 { margin: 0; font-weight: 400; font-size: 20px; color: var(--on); }
.empty p { margin: 0; max-width: 380px; }

.skeleton .row { cursor: default; }
.skel { display: inline-block; height: 10px; border-radius: 5px; background: var(--surface-3); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------------------------------------------------------------- thread view */
.thread { flex: 1; overflow-y: auto; padding: 0 0 48px; }
.thread-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px 8px 72px; }
.thread-head h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 400; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.thread-head .pill { margin-left: 8px; vertical-align: 3px; }
.msg { padding: 0 24px 0 16px; border-bottom: 1px solid var(--outline-2); }
.msg:last-of-type { border-bottom: 0; }
.msg-head { display: flex; gap: 12px; padding: 16px 0 8px; align-items: flex-start; cursor: pointer; }
.msg.open .msg-head { cursor: default; }
.msg-head .meta { flex: 1; min-width: 0; }
.msg-head .from { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.msg-head .from b { font-weight: 700; font-size: 14px; }
.msg-head .from .addr { color: var(--on-2); font-size: 12px; }
.msg-head .to { color: var(--on-2); font-size: 12px; display: flex; align-items: center; gap: 2px; }
.msg-head .to .icon-btn { width: 24px; height: 24px; }
.msg-head .to .icon-btn .ic { width: 16px; height: 16px; }
.msg-head .when { color: var(--on-2); font-size: 12px; white-space: nowrap; padding-top: 2px; }
.msg-head .acts { display: flex; align-items: center; margin-top: -8px; }
.msg:not(.open) .snippet { color: var(--on-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg:not(.open) .to, .msg:not(.open) .acts .hide-closed { display: none; }
.msg-body { padding: 0 0 20px 52px; }
.msg-details { margin: 0 0 12px 52px; padding: 12px 16px; border-radius: var(--radius-s); background: var(--surface-2); font-size: 12px; color: var(--on-2); display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.msg-details dt { text-align: right; color: var(--on-3); }
.msg-details dd { margin: 0; color: var(--on); overflow-wrap: anywhere; }
.mail-frame-wrap { border-radius: var(--radius-s); overflow: hidden; }
[data-theme="dark"] .mail-frame-wrap.html { background: var(--mail-paper); padding: 4px; }
.mail-frame { width: 100%; border: 0; display: block; min-height: 40px; background: transparent; }
.mail-frame.inverted { filter: invert(1) hue-rotate(180deg); }
.fld { min-width: 0; }
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 55;
  height: 56px; padding: 0 20px 0 16px; border: 0; border-radius: var(--radius-m);
  display: none; align-items: center; gap: 12px;
  background: var(--compose); color: var(--on-compose); font-weight: 500; font-size: 15px;
  box-shadow: var(--shadow-3); cursor: pointer;
}
.fab .ic { width: 24px; height: 24px; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; margin: 0; font-family: var(--font); }
.mail-text .q { color: var(--on-3); }
.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px; margin: 0 0 12px;
  border-radius: var(--radius-s);
  background: var(--surface-2); color: var(--on-2); font-size: 13px;
}
.banner.warn { background: var(--warning-container); color: var(--warning); }
.banner.danger { background: var(--danger-container); color: var(--on-danger-container); }
.banner.info { background: var(--primary-container); color: var(--on-primary-container); }
.banner .grow { flex: 1; }
.banner .btn { height: 32px; padding: 0 12px; }
.atts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--outline-2); }
.att-card {
  width: 196px; border: 1px solid var(--outline-2); border-radius: var(--radius-s);
  overflow: hidden; text-decoration: none; color: var(--on); background: var(--surface-1);
  display: flex; flex-direction: column;
  transition: box-shadow .15s;
}
.att-card:hover { box-shadow: var(--shadow-1); }
.att-card .thumb { height: 104px; display: grid; place-items: center; background: var(--surface-3); color: var(--on-3); overflow: hidden; }
.att-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-card .thumb .ic { width: 40px; height: 40px; }
.att-card .meta { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; }
.att-card .meta div { flex: 1; min-width: 0; }
.att-card .name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-card .size { font-size: 11px; color: var(--on-3); }
.reply-bar { display: flex; gap: 12px; padding: 16px 24px 24px 68px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- avatars */
.av {
  --s: 40px;
  width: var(--s); height: var(--s); border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  font-size: calc(var(--s) * .42); font-weight: 500; color: #fff;
  background: #5f6368; overflow: hidden; user-select: none;
  text-transform: uppercase;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.s32 { --s: 32px; }
.av.s28 { --s: 28px; }
.av.s24 { --s: 24px; }
.av.s64 { --s: 64px; }
.av.s96 { --s: 96px; }

/* ---------------------------------------------------------------- menus & popovers */
.menu {
  position: fixed; z-index: 80;
  min-width: 200px; max-width: 320px;
  background: var(--surface-2); color: var(--on);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-3);
  padding: 8px 0;
  animation: pop .14s var(--ease-out);
  transform-origin: top right;
}
[data-theme="dark"] .menu { background: #232325; }
.menu button, .menu a {
  display: flex; align-items: center; gap: 12px; width: 100%;
  height: 40px; padding: 0 16px; border: 0; background: none; text-align: left;
  cursor: pointer; text-decoration: none; color: var(--on); font-size: 14px;
}
.menu button:hover, .menu a:hover, .menu .hl { background: var(--state-hover); }
.menu .ic { color: var(--on-2); }
.menu hr { border: 0; border-top: 1px solid var(--outline-2); margin: 8px 0; }
.menu .head { padding: 12px 16px; display: flex; gap: 12px; align-items: center; }
.menu .head b { display: block; font-weight: 500; }
.menu .head small { color: var(--on-2); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

.account-card { min-width: 320px; padding: 16px; border-radius: var(--radius-xl); background: var(--surface-2); text-align: center; }
[data-theme="dark"] .account-card { background: #1b1b1c; }
.account-card .email { color: var(--on-2); margin-bottom: 16px; }
.account-card .hi { font-size: 22px; margin: 8px 0 16px; }
.account-card .grp { background: var(--surface); border-radius: var(--radius-m); padding: 4px 0; text-align: left; margin-top: 8px; overflow: hidden; }
[data-theme="dark"] .account-card .grp { background: #0f0f10; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--tooltip-bg); color: var(--tooltip-on);
  font-size: 12px; padding: 4px 8px; border-radius: 4px;
  white-space: nowrap; opacity: 0; transition: opacity .1s;
}
.tooltip.show { opacity: .92; }

/* ---------------------------------------------------------------- dialogs */
dialog.dlg {
  border: 0; padding: 0;
  border-radius: var(--radius-xl);
  background: var(--surface-1); color: var(--on);
  box-shadow: var(--shadow-3);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
}
[data-theme="dark"] dialog.dlg { background: #1b1b1c; }
dialog.dlg.wide { width: min(760px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: var(--scrim); animation: fade .2s; }
dialog.dlg[open] { animation: rise .22s var(--ease-out); display: flex; flex-direction: column; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.dlg-head { padding: 24px 24px 8px; }
.dlg-head .ic.l { color: var(--primary); display: block; margin: 0 auto 16px; }
.dlg-head h2 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 400; }
.dlg-head p { margin: 8px 0 0; color: var(--on-2); }
.dlg-body { padding: 8px 24px 8px; overflow-y: auto; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; flex-wrap: wrap; }
.dlg-actions .left { margin-right: auto; }

/* ---------------------------------------------------------------- forms */
.field { position: relative; margin: 12px 0 4px; }
.field label {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  padding: 0 4px; color: var(--on-2); background: var(--fld-bg, var(--surface-1));
  pointer-events: none; transition: all .15s var(--ease); font-size: 15px;
  max-width: calc(100% - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.field textarea ~ label { top: 22px; }
.field input, .field select, .field textarea {
  width: 100%; height: 52px; padding: 0 16px;
  border: 1px solid var(--outline); border-radius: 6px;
  background: transparent; outline: 0;
  font-size: 15px; transition: border-color .15s;
}
.field textarea { height: auto; min-height: 120px; padding: 14px 16px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; }
.field select option { background: var(--surface-1); color: var(--on); }
.field .sel-ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--on-2); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--on); }
.field input:focus, .field select:focus, .field textarea:focus { border: 2px solid var(--primary); padding-left: 15px; }
.field input:focus ~ label, .field input:not(:placeholder-shown) ~ label,
.field textarea:focus ~ label, .field textarea:not(:placeholder-shown) ~ label,
.field select ~ label, .field.filled label {
  top: 0; font-size: 12px;
}
.field input:focus ~ label, .field textarea:focus ~ label, .field select:focus ~ label { color: var(--primary); }
.field .suffix { position: absolute; right: 6px; top: 6px; }
.field .addon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--on-2); pointer-events: none; }
.field.with-suffix input { padding-right: 52px; }
.field.has-addon input { padding-right: 160px; }
.hint { font-size: 12px; color: var(--on-2); margin: 4px 16px 0; }
.hint.err { color: var(--danger); }
.form-err { color: var(--danger); font-size: 13px; min-height: 20px; margin: 8px 0 0; display: flex; gap: 6px; align-items: flex-start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.check { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; padding: 8px 0; }
.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 16px; border: 2px solid var(--outline); background: var(--surface-3); position: relative; cursor: pointer; flex: none; transition: all .2s var(--ease); margin: 0; }
.switch::before { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--on-3); top: 6px; left: 6px; transition: all .2s var(--ease); }
.switch:checked { background: var(--primary); border-color: var(--primary); }
.switch:checked::before { width: 24px; height: 24px; top: 2px; left: 22px; background: var(--on-primary); }
.seg { display: inline-flex; border: 1px solid var(--outline); border-radius: 20px; overflow: hidden; }
.seg button { border: 0; background: transparent; height: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--on); }
.seg button + button { border-left: 1px solid var(--outline); }
.seg button.on { background: var(--primary-container); color: var(--on-primary-container); }
.seg button:hover:not(.on) { background: var(--state-hover); }

/* ---------------------------------------------------------------- settings / admin pages */
.page { flex: 1; overflow-y: auto; }
.page-inner { max-width: 1040px; padding: 8px 24px 64px; }
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--outline-2); overflow-x: auto; flex: none; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 16px; border: 0; background: none; cursor: pointer;
  color: var(--on-2); font-weight: 500; position: relative; white-space: nowrap; text-decoration: none;
  border-radius: 8px 8px 0 0;
}
.tab:hover { background: var(--state-hover); color: var(--on); }
.tab.on { color: var(--primary); }
.tab.on::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.section { margin: 24px 0; }
.section > h2 { font-size: 18px; font-weight: 500; margin: 0 0 4px; }
.section > p.lead { margin: 0 0 16px; color: var(--on-2); }
.panel { background: var(--surface-1); border: 1px solid var(--outline-2); border-radius: var(--radius-m); padding: 8px 20px; --fld-bg: var(--surface-1); }
[data-theme="dark"] .panel { background: #141415; --fld-bg: #141415; }
.panel + .panel { margin-top: 16px; }
.kv { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--outline-2); }
.kv:last-child { border-bottom: 0; }
.kv .k { width: 200px; flex: none; color: var(--on-2); font-weight: 500; }
.kv .v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 0 8px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat { background: var(--surface-1); border: 1px solid var(--outline-2); border-radius: var(--radius-l); padding: 18px 20px; }
[data-theme="dark"] .stat { background: #141415; }
.stat .lbl { color: var(--on-2); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat .lbl .ic { color: var(--primary); }
.stat .num { font-size: 32px; line-height: 40px; margin-top: 8px; }
.stat .sm { color: var(--on-3); font-size: 12px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 8px 4px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; height: 100%; position: relative; }
.chart .col i { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; display: block; min-height: 2px; }
.chart .col i.in { background: #7cacf8; }
.chart .col i.out { background: #6dd58c; }
.chart .col small { position: absolute; bottom: -20px; font-size: 10px; color: var(--on-3); }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--on-2); margin-top: 28px; }
.chart-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: #7cacf8; }
.chart-legend span.out::before { background: #6dd58c; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--on-2); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--outline-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--outline-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--state-hover); }
.tbl .ellip { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--outline-2); border-radius: var(--radius-m); }
[data-theme="dark"] .tbl-wrap { background: #141415; }
.who-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.who-cell b { font-weight: 500; display: block; }
.who-cell small { color: var(--on-2); }
.mini-bar { width: 90px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.mini-bar i { display: block; height: 100%; background: var(--primary); }
.dns-val { font-family: var(--mono); font-size: 12px; background: var(--surface-3); border-radius: 6px; padding: 6px 8px; display: flex; align-items: flex-start; gap: 6px; max-width: 520px; }
.dns-val code { flex: 1; overflow-wrap: anywhere; white-space: pre-wrap; }
.dns-val .icon-btn { width: 28px; height: 28px; margin: -4px -4px -4px 0; }
.dns-val .icon-btn .ic { width: 16px; height: 16px; }
.cred-box { font-family: var(--mono); font-size: 13px; background: var(--surface-3); border-radius: var(--radius-s); padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.person { background: var(--surface-1); border: 1px solid var(--outline-2); border-radius: var(--radius-l); padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
[data-theme="dark"] .person { background: #141415; }
.person b { font-weight: 500; font-size: 16px; margin-top: 8px; }
.person small { color: var(--on-2); }
.person .btn { margin-top: 12px; }
.members { max-height: 280px; overflow-y: auto; border: 1px solid var(--outline-2); border-radius: var(--radius-s); margin-top: 12px; }
.member { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--outline-2); }
.member:last-child { border-bottom: 0; }
.member .grow { flex: 1; min-width: 0; }
.member small { color: var(--on-2); display: block; }

/* ---------------------------------------------------------------- compose */
.compose {
  position: fixed; right: 24px; bottom: 0; z-index: 60;
  width: 560px; height: min(640px, calc(100dvh - 80px));
  background: var(--surface); border-radius: var(--radius-m) var(--radius-m) 0 0;
  box-shadow: 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12), 0 5px 5px -3px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  animation: slideup .22s var(--ease-out);
  overflow: hidden;
}
[data-theme="dark"] .compose { background: #1b1b1c; box-shadow: 0 8px 32px rgba(0,0,0,.8), 0 0 0 1px #2d2e30; }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }
.compose.min { height: 48px; width: 320px; }
.compose.min .c-body { display: none; }
.compose.full { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(1100px, calc(100vw - 96px)); height: calc(100dvh - 96px); border-radius: var(--radius-m); animation: none; }
.compose-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 59; }
.c-head { display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 8px 0 16px; background: var(--surface-2); cursor: pointer; flex: none; }
[data-theme="dark"] .c-head { background: #232325; }
.c-head b { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-head .icon-btn { width: 32px; height: 32px; }
.c-head .icon-btn .ic { width: 18px; height: 18px; }
.c-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.c-line { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--outline-2); position: relative; }
.c-line > label { color: var(--on-2); flex: none; min-width: 28px; }
.c-line input.subject, .c-line select { flex: 1; border: 0; outline: 0; background: transparent; height: 40px; font-size: 14px; min-width: 0; }
.c-line select { cursor: pointer; }
.c-line select option { background: var(--surface-1); }
.c-line .toggles { display: flex; gap: 2px; }
.c-line .toggles button { border: 0; background: none; color: var(--on-2); cursor: pointer; padding: 4px 6px; border-radius: 4px; font-size: 14px; }
.c-line .toggles button:hover { background: var(--state-hover); color: var(--on); }
.rcpts { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 0; min-width: 0; cursor: text; }
.rcpts input { flex: 1; min-width: 120px; border: 0; outline: 0; background: transparent; height: 30px; font-size: 14px; }
.rchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 2px; border-radius: 14px; background: var(--surface-3); font-size: 13px; max-width: 100%; border: 1px solid transparent; }
.rchip .av { --s: 24px; font-size: 11px; }
.rchip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rchip button { width: 20px; height: 20px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--on-2); padding: 0; }
.rchip button:hover { background: var(--state-hover); }
.rchip button .ic { width: 14px; height: 14px; }
.rchip.bad { background: var(--danger-container); color: var(--on-danger-container); border-color: var(--danger); }
.suggest { position: absolute; left: 48px; top: 100%; z-index: 5; min-width: 340px; max-width: calc(100% - 56px); background: var(--surface-1); border-radius: var(--radius-xs); box-shadow: var(--shadow-3); padding: 6px 0; }
[data-theme="dark"] .suggest { background: #232325; }
.suggest button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 6px 16px; cursor: pointer; text-align: left; }
.suggest button.on, .suggest button:hover { background: var(--state-hover); }
.suggest b { display: block; font-weight: 500; font-size: 14px; }
.suggest small { color: var(--on-2); font-size: 12px; }
.editor-wrap { flex: 1; overflow-y: auto; padding: 12px 16px; cursor: text; min-height: 80px; }
.editor { outline: 0; min-height: 100%; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.editor:empty::before { content: attr(data-ph); color: var(--on-3); }
.editor blockquote, .mail-text blockquote { margin: 0 0 0 .8ex; border-left: 2px solid var(--outline); padding-left: 1ex; color: var(--on-2); }
.editor img { max-width: 100%; }
.editor .sig { color: var(--on-2); }
.c-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.c-file { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 10px; border-radius: 8px; background: var(--surface-3); font-size: 13px; max-width: 260px; }
.c-file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-file small { color: var(--on-3); }
.c-file .bar { width: 48px; height: 4px; border-radius: 2px; background: var(--outline-2); overflow: hidden; }
.c-file .bar i { display: block; height: 100%; background: var(--primary); }
.fmt-bar { display: flex; align-items: center; gap: 0; padding: 4px 8px; margin: 0 12px 4px; border-radius: 20px; background: var(--surface-2); flex-wrap: wrap; }
[data-theme="dark"] .fmt-bar { background: #232325; }
.fmt-bar .icon-btn { width: 32px; height: 32px; }
.fmt-bar .icon-btn .ic { width: 18px; height: 18px; }
.fmt-bar .sep { width: 1px; height: 20px; background: var(--outline); margin: 0 4px; }
.c-foot { display: flex; align-items: center; gap: 4px; padding: 8px 12px 12px 16px; flex: none; }
.c-foot .grow { flex: 1; }
.c-foot .saved { color: var(--on-3); font-size: 12px; margin-right: 4px; }
.send-btn { height: 40px; padding: 0 22px; }
.drop-overlay { position: absolute; inset: 48px 0 0; background: color-mix(in srgb, var(--primary-container) 90%, transparent); border: 2px dashed var(--primary); border-radius: 0 0 var(--radius-m) var(--radius-m); display: none; place-items: center; font-size: 18px; color: var(--on-primary-container); z-index: 4; }
.compose.drag .drop-overlay { display: grid; }

/* ---------------------------------------------------------------- snackbar */
.snackbar {
  position: fixed; left: 24px; bottom: 24px; z-index: 120;
  min-width: 288px; max-width: min(568px, calc(100vw - 48px));
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 16px; min-height: 48px;
  background: var(--snackbar); color: var(--on-snackbar);
  border-radius: 4px; box-shadow: var(--shadow-3);
  font-size: 14px;
  animation: snack .2s var(--ease-out);
}
.snackbar span { flex: 1; padding: 8px 0; }
.snackbar .btn { color: var(--snackbar-action); height: 36px; padding: 0 12px; }
.snackbar .icon-btn { color: var(--on-snackbar); width: 36px; height: 36px; }
@keyframes snack { from { transform: translateY(16px); opacity: 0; } }

/* ---------------------------------------------------------------- auth screens */
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px; overflow-y: auto; height: 100%;
}
.auth-card {
  width: min(1040px, 100%);
  background: var(--surface-1);
  border-radius: var(--radius-xl);
  border: 1px solid var(--card-border);
  padding: 36px 40px 32px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px 48px;
  --fld-bg: var(--surface-1);
}
[data-theme="dark"] .auth-card { background: #0f0f10; --fld-bg: #0f0f10; }
.auth-card.narrow { width: min(480px, 100%); grid-template-columns: 1fr; }
.auth-card .logo { width: 48px; height: 48px; }
.auth-card h1 { font-size: 36px; line-height: 44px; font-weight: 400; margin: 20px 0 12px; letter-spacing: -.3px; }
.auth-card .lead { font-size: 16px; color: var(--on-2); margin: 0; }
.auth-card form { padding-top: 64px; }
.auth-card.narrow form { padding-top: 8px; }
.auth-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 32px; }
.auth-actions .left { margin-right: auto; }
.auth-foot { display: flex; justify-content: space-between; width: min(1040px, 100%); margin: 12px auto 0; color: var(--on-2); font-size: 12px; padding: 0 12px; }
.auth-foot button { background: none; border: 0; color: var(--on-2); cursor: pointer; padding: 6px 8px; border-radius: 4px; display: inline-flex; gap: 6px; align-items: center; }
.auth-foot button:hover { background: var(--state-hover); }
.steps { display: flex; gap: 8px; margin-top: 28px; }
.steps i { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-3); }
.steps i.on { background: var(--primary); }
.step-title { font-size: 13px; color: var(--primary); font-weight: 500; margin: 0 0 4px; }
.checklist { margin: 20px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; color: var(--on-2); }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .ic { color: var(--success); margin-top: 1px; }

/* ---------------------------------------------------------------- misc */
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s; }
.loading-bar.on { opacity: 1; }
.loading-bar::before { content: ''; position: absolute; height: 100%; width: 40%; background: var(--primary); animation: indet 1.1s var(--ease) infinite; }
@keyframes indet { from { left: -40%; } to { left: 100%; } }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-fill { flex: 1; display: grid; place-items: center; }
.kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--outline); border-bottom-width: 2px; border-radius: 4px; padding: 0 6px; background: var(--surface-2); }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 32px; }
.shortcuts div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--outline-2); }
.muted { color: var(--on-2); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.offline-pill { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 110; }

/* ---------------------------------------------------------------- responsive */
.mobile-only { display: none; }
@media (max-width: 1100px) {
  .row .who { width: 160px; }
  .rail { display: none; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 56px; }
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .drawer {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 70;
    width: 300px; background: var(--surface-1); padding-top: 16px;
    transform: translateX(-105%); transition: transform .25s var(--ease);
    box-shadow: var(--shadow-3);
  }
  [data-theme="dark"] .drawer { background: #111112; }
  .app.drawer-open .drawer { transform: none; }
  .app.collapsed .compose-btn { width: auto; padding: 0 20px 0 16px; }
  .app.collapsed .compose-btn span, .app.collapsed .nav-item span, .app.collapsed .nav-item .count, .app.collapsed .nav-section, .app.collapsed .drawer-foot { display: revert; }
  .app.collapsed .nav-item { width: auto; padding: 0 12px 0 16px; justify-content: flex-start; }
  .drawer-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 69; display: none; }
  .app.drawer-open .drawer-scrim { display: block; }
  .main { padding: 0; }
  .surface { border-radius: 0; border: 0; }
  .brand { width: auto; }
  .brand span { display: none; }
  .row { height: auto; min-height: 72px; padding: 10px 12px 10px 4px; align-items: flex-start; flex-wrap: wrap; }
  .row .cb-wrap { display: none; }
  .row .av-cell { display: block; margin: 2px 12px 0 8px; }
  .row .who { width: auto; flex: 1; padding-right: 8px; order: 1; }
  .row .date { order: 2; width: auto; }
  .row .mid { order: 3; flex-basis: calc(100% - 60px); flex-direction: column; align-items: flex-start; gap: 0; margin-left: 52px; margin-top: -24px; }
  .row .subj { max-width: 100%; }
  .row .snip { width: 100%; }
  .row .star-btn { order: 4; position: absolute; right: 4px; bottom: 4px; }
  .row .mid { padding-right: 28px; }
  .row .dash { display: none; }
  .fab { display: inline-flex; }
  .page-head .chips[role=tablist] { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; padding-bottom: 2px; }
  .page-head .chips[role=tablist]::-webkit-scrollbar { display: none; }
  .row .att { display: none; }
  .row:hover .hover-acts { display: none; }
  .row:hover .date { visibility: visible; }
  .compose, .compose.full { right: 0; left: 0; bottom: 0; top: 0; width: auto; height: auto; border-radius: 0; transform: none; }
  .compose.min { top: auto; height: 48px; width: auto; }
  .thread-head { padding-left: 16px; }
  .msg { padding: 0 12px; }
  .msg-head .from .addr { display: none; }
  .msg-head .to { flex-wrap: wrap; }
  .msg-body, .msg-details { padding-left: 0; margin-left: 0; }
  .reply-bar { padding-left: 16px; }
  .page-head { padding: 16px 16px 4px; }
  .page-head h1 { font-size: 28px; }
  .auth-card { grid-template-columns: 1fr; padding: 28px 24px; }
  .auth-card form { padding-top: 0; }
  .row2 { grid-template-columns: 1fr; }
  .kv { flex-direction: column; align-items: flex-start; gap: 4px; }
  .kv .k { width: auto; }
  .snackbar { left: 12px; right: 12px; bottom: 12px; }
  .mobile-only { display: revert; }
  .desktop-only { display: none !important; }
  .shortcuts { grid-template-columns: 1fr; }
}
.av-cell { display: none; }
.drawer-scrim { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
