/* MIAB web app. Layout follows the familiar webmail pattern (rail, sidebar,
   list, reading pane, floating compose); colours are MIAB's own. */

:root {
  --navy: #0B2438;
  --teal: #164E63;
  --seaglass: #A8D4DF;
  --parchment: #F5E8CB;

  --bg: #F6F8FC;
  --surface: #FFFFFF;
  --surface-2: #EEF3F6;
  --text: #1F1F1F;
  --text-2: #444746;
  --text-3: #6B7275;
  --line: #E1E5EA;
  --hover: #E9EEF2;
  --selected: #D4EAF0;
  --accent: #164E63;       /* fills: primary buttons, today */
  --accent-text: #FFFFFF;  /* text on an --accent fill */
  --accent-ink: #164E63;   /* links, active tabs, focus rings, icons */
  --compose: #CDE7EE;
  --unread-row: #FFFFFF;
  --read-row: #F2F6FA;
  --star: #E8A317;
  --danger: #B3261E;
  --shadow: 0 1px 3px rgba(11, 36, 56, .14), 0 4px 12px rgba(11, 36, 56, .10);
  --radius: 16px;
  --row-h: 40px;           /* message list rows; Settings > General > Density */
  --nav-h: 32px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* Theme (Settings > General). app.js sets data-scheme to light or dark,
   following the device when the choice is System, plus data-accent and
   data-density. Message bodies keep their own colours on white. */
:root[data-accent="navy"] { --accent: #0B2438; --accent-ink: #0B2438; --selected: #D6DFEA; --compose: #D3DDE8; }
:root[data-accent="seaglass"] { --accent: #A8D4DF; --accent-text: #0B2438; --accent-ink: #23697C; --selected: #DCEFF4; --compose: #CFE9F0; }
:root[data-accent="parchment"] { --accent: #EEDCB0; --accent-text: #0B2438; --accent-ink: #7A5A1E; --selected: #F5ECD6; --compose: #F5E8CB; }

:root[data-scheme="dark"] {
  color-scheme: dark;
  --bg: #0A1A27;
  --surface: #0F2333;
  --surface-2: #142C3F;
  --text: #E6EDF1;
  --text-2: #C3CFD6;
  --text-3: #8FA1AC;
  --line: #1F3A4F;
  --hover: #18344A;
  --selected: #1E4A5E;
  --accent: #A8D4DF;
  --accent-text: #0B2438;
  --accent-ink: #A8D4DF;
  --compose: #1E4A5E;
  --unread-row: #0F2333;
  --read-row: #0C1E2C;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .4);
}
:root[data-scheme="dark"][data-accent="navy"] { --accent: #2B5C8A; --accent-text: #FFFFFF; --accent-ink: #9FC1E6; --selected: #1C3A57; --compose: #1C3A57; }
:root[data-scheme="dark"][data-accent="teal"] { --accent: #1F6C87; --accent-text: #FFFFFF; --accent-ink: #7CC4D8; --selected: #17465A; --compose: #17465A; }
:root[data-scheme="dark"][data-accent="parchment"] { --accent: #F5E8CB; --accent-text: #0B2438; --accent-ink: #F5E8CB; --selected: #3A3628; --compose: #3A3628; }

:root[data-density="compact"] { --row-h: 32px; --nav-h: 28px; }

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
[hidden] { display: none !important; }

/* ---------- generic controls ---------- */
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2); flex: none;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 18px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 8px; align-items: center;
}
.btn:hover { background: var(--hover); }
.btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .6; cursor: default; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-ink); outline-offset: -1px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.field input, .field select { min-width: 0; width: 100%; }
fieldset { min-width: 0; }
.muted { color: var(--text-3); }
.error { color: var(--danger); min-height: 1.4em; }
.spacer { flex: 1; }

.toast {
  position: fixed; left: 24px; bottom: 24px; background: #313335; color: #F1F3F4; padding: 12px 20px;
  border-radius: 6px; box-shadow: var(--shadow); z-index: 100; max-width: 420px;
}

/* ---------- sign-in screens ---------- */
.auth {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% 120%, var(--seaglass), transparent 60%), var(--bg);
}
.auth-card {
  width: min(440px, 100%); background: var(--surface); border-radius: 28px; padding: 40px;
  box-shadow: var(--shadow);
}
.auth-card .logo { width: 56px; height: 56px; }
.auth-card h1 { font-weight: 400; font-size: 28px; margin: 12px 0 4px; }
.auth-card p.lead { margin: 0 0 24px; color: var(--text-2); }
.auth-card .actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.tagline { font-style: italic; color: var(--text-3); margin-top: 24px; text-align: center; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 72px auto minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr); height: 100%; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 12px; }
.brand { display: flex; align-items: center; gap: 8px; width: 214px; text-decoration: none; color: var(--text-2); }
.brand img { width: 36px; height: 36px; }
.brand span { font-size: 22px; letter-spacing: .5px; }
.brand b { color: var(--text); font-weight: 600; }
.search {
  flex: 1; min-width: 0; max-width: 720px; display: flex; align-items: center; gap: 4px; background: var(--surface-2);
  border-radius: 999px; height: 48px; padding: 0 8px;
}
.search:focus-within { background: var(--surface); box-shadow: var(--shadow); }
.search input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; outline: 0; font-size: 16px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-weight: 500; font-size: 14px; flex: none; user-select: none;
}
.avatar.lg { width: 40px; height: 40px; font-size: 18px; }
.avatar.xl { width: 72px; height: 72px; font-size: 32px; }
.avatar-btn { border: 0; background: transparent; padding: 4px; border-radius: 50%; cursor: pointer; }
.avatar-btn:hover { background: var(--hover); }

.rail { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 4px; }
.rail a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; text-decoration: none; color: var(--text-2); }
.rail a .pill { width: 56px; height: 32px; border-radius: 999px; display: grid; place-items: center; }
.rail a:hover .pill { background: var(--hover); }
.rail a.active .pill { background: var(--selected); }
.rail a.active { color: var(--text); font-weight: 600; }
.rail svg { width: 22px; height: 22px; fill: currentColor; }

.sidebar { width: 256px; padding: 0 8px 16px 0; overflow-y: auto; }
.shell.collapsed .sidebar { width: 72px; }
.shell.collapsed .sidebar .label, .shell.collapsed .sidebar .count, .shell.collapsed .sidebar h3,
.shell.collapsed .sidebar .compose span, .shell.collapsed .sidebar .cal-list, .shell.collapsed .sidebar .mini { display: none; }
.compose {
  display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 24px 0 16px; margin: 0 0 16px 8px;
  border-radius: 16px; border: 0; background: var(--compose); font-weight: 500; cursor: pointer; box-shadow: none;
  transition: box-shadow .15s;
}
.compose:hover { box-shadow: var(--shadow); }
.compose svg { width: 24px; height: 24px; fill: currentColor; }
.nav a {
  display: flex; align-items: center; gap: 18px; height: var(--nav-h); padding: 0 12px 0 26px; border-radius: 0 999px 999px 0;
  text-decoration: none; color: var(--text); font-size: 14px;
}
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--selected); font-weight: 700; }
.nav a svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.nav a .label { flex: 1; }
.nav a .count { font-size: 12px; font-weight: 700; }
.sidebar h3 { font-size: 14px; font-weight: 500; margin: 20px 0 6px 26px; display: flex; align-items: center; }
.acct-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

.main {
  background: var(--surface); border-radius: var(--radius); margin: 0 16px 16px 0; overflow: hidden;
  display: flex; flex-direction: column; min-width: 0;
}
.toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 12px; min-height: 48px; border-bottom: 1px solid var(--line); }
.toolbar .pager { font-size: 12px; color: var(--text-3); }

/* ---------- message list ---------- */
.list { flex: 1; overflow-y: auto; }
.msg {
  display: grid; grid-template-columns: 28px 28px 200px 1fr auto; align-items: center; gap: 4px;
  height: var(--row-h); padding: 0 16px 0 12px; border-bottom: 1px solid var(--line); cursor: pointer;
  background: var(--read-row); position: relative;
}
.msg.unread { background: var(--unread-row); font-weight: 700; }
.msg:hover { box-shadow: inset 1px 0 0 var(--line), inset -1px 0 0 var(--line), 0 1px 2px rgba(11,36,56,.2), 0 1px 3px 1px rgba(11,36,56,.1); z-index: 1; }
.msg.checked { background: var(--selected); }
.msg input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-ink); }
.star { border: 0; background: none; cursor: pointer; padding: 0; width: 24px; height: 24px; color: var(--text-3); }
.star svg { width: 20px; height: 20px; fill: currentColor; }
.star.on { color: var(--star); }
.from { display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 16px; }
.from .name { overflow: hidden; text-overflow: ellipsis; }
.subject { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.subject .snippet { color: var(--text-3); font-weight: 400; }
.date { font-size: 12px; text-align: right; min-width: 64px; }
.msg .hover-actions { display: none; position: absolute; right: 8px; background: inherit; }
.msg:hover .hover-actions { display: flex; }
.msg:hover .date { visibility: hidden; }
.hover-actions .icon-btn { width: 36px; height: 36px; }
.empty { padding: 64px 24px; text-align: center; color: var(--text-3); }
.empty img { width: 96px; opacity: .8; }
.sync-banner { padding: 8px 16px; background: #FCE8E6; color: #8C1D18; font-size: 13px; border-bottom: 1px solid var(--line); }
[data-scheme="dark"] .sync-banner { background: #3B1714; color: #F2B8B5; }

/* ---------- reading view ---------- */
.reader { flex: 1; overflow-y: auto; padding: 8px 24px 40px 72px; }
.reader h1 { font-size: 22px; font-weight: 400; margin: 12px 0 20px -56px; padding-left: 56px; }
.reader .hdr { display: flex; gap: 16px; align-items: flex-start; margin-left: -56px; }
.reader .hdr .who { flex: 1; min-width: 0; }
.reader .hdr .who b { font-weight: 600; }
.reader .hdr .to { font-size: 12px; color: var(--text-3); }
.reader .body { margin: 20px 0; }
.reader iframe { width: 100%; border: 0; min-height: 120px; background: #fff; border-radius: 8px; }
.reader pre.text { white-space: pre-wrap; word-wrap: break-word; font: inherit; margin: 0; }
.reader .reply-bar { display: flex; gap: 12px; margin-top: 24px; }
.label-chip { font-size: 12px; background: var(--surface-2); border-radius: 4px; padding: 1px 6px; color: var(--text-2); vertical-align: middle; font-weight: 400; }

/* ---------- compose window ---------- */
.compose-win {
  position: fixed; right: 24px; bottom: 0; width: 540px; max-width: calc(100vw - 16px); height: 560px; max-height: calc(100vh - 80px);
  background: var(--surface); border-radius: 12px 12px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 50;
}
.compose-win.min { height: 44px; }
.compose-win .head {
  background: var(--surface-2); border-radius: 12px 12px 0 0; padding: 0 8px 0 16px; height: 44px;
  display: flex; align-items: center; font-weight: 500; cursor: pointer;
}
.compose-win .head .icon-btn { width: 32px; height: 32px; }
.compose-win .line { display: flex; align-items: center; border-bottom: 1px solid var(--line); margin: 0 16px; min-height: 40px; gap: 8px; }
.compose-win .line label { color: var(--text-3); }
.compose-win .line input, .compose-win .line select { flex: 1; border: 0; background: transparent; outline: 0; padding: 8px 0; }
.compose-win .line .link { border: 0; background: none; color: var(--text-3); cursor: pointer; }
.compose-win .scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.compose-win .editor { flex: 1; min-height: 120px; padding: 12px 16px; outline: 0; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.compose-win .editor img { max-width: 100%; height: auto; vertical-align: bottom; border-radius: 4px; }
.compose-win .att-list { display: flex; flex-direction: column; gap: 4px; padding: 0 16px 8px; }
.att-row { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 4px; padding: 2px 4px 2px 8px; max-width: 440px; font-size: 13px; position: relative; overflow: hidden; }
.att-row .fname { color: var(--accent-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-row .size { color: var(--text-3); white-space: nowrap; flex: 1; }
.att-row .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.att-row .bar div { height: 100%; background: var(--accent-ink); transition: width .15s; }
.att-row.reading .fname { color: var(--text-3); }
.att-ic { display: inline-flex; flex: none; }
.att-ic svg { width: 18px; height: 18px; fill: currentColor; }
.send-progress { height: 3px; margin: 0 16px; background: var(--line); border-radius: 2px; overflow: hidden; }
.send-progress div { height: 100%; width: 0; background: var(--accent-ink); transition: width .2s; }
.compose-win .foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.compose-win .drop-zone { display: none; }
.compose-win.dragging .drop-zone {
  display: flex; position: absolute; inset: 44px 0 0; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--seaglass) 55%, var(--surface)); border: 2px dashed var(--accent-ink); border-radius: 8px;
  color: var(--navy); font-size: 18px; font-weight: 500; pointer-events: none; z-index: 2;
}
[data-scheme="dark"] .compose-win.dragging .drop-zone { background: color-mix(in srgb, var(--teal) 70%, var(--surface)); color: var(--text); }

/* ---------- attachments ---------- */
.attachments { border-top: 1px solid var(--line); padding: 16px 0 4px; margin-top: 8px; }
.attachments > .muted { display: flex; align-items: center; gap: 4px; }
.attachments > .muted svg { width: 18px; height: 18px; fill: currentColor; }
.att-head { display: flex; align-items: center; gap: 2px; font-weight: 500; margin-bottom: 12px; }
.att-head .muted { font-weight: 400; color: var(--text-3); }
.att-head .icon-btn { margin-left: 8px; color: var(--text-2); }
a.icon-btn { display: inline-flex; align-items: center; justify-content: center; color: inherit; }
.att-cards { display: flex; flex-wrap: wrap; gap: 12px; }
.att-card {
  width: 180px; height: 122px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative;
  cursor: pointer; background: var(--surface); display: flex; flex-direction: column;
}
.att-card .thumb { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--surface-2); overflow: hidden; }
.att-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-card .thumb .big svg { width: 48px; height: 48px; fill: currentColor; opacity: .85; }
.att-card .cap { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 12px; border-top: 1px solid var(--line); }
.att-card .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-card .over {
  position: absolute; inset: 0; background: rgba(11, 36, 56, .78); color: #fff; padding: 10px; display: none;
  flex-direction: column; font-size: 13px;
}
.att-card .over .fname { font-weight: 600; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.att-card .over .size { opacity: .8; font-size: 12px; flex: 1; }
.att-card .over .icon-btn { align-self: flex-end; color: #fff; background: rgba(255, 255, 255, .15); width: 34px; height: 34px; }
.att-card:hover .over, .att-card:focus-visible .over { display: flex; }
.msg .clip { display: inline-flex; vertical-align: middle; margin-right: 6px; color: var(--text-3); }
.msg .clip svg { width: 16px; height: 16px; fill: currentColor; transform: rotate(45deg); }
.msg.has-files { height: auto; min-height: 40px; padding-top: 6px; padding-bottom: 8px; row-gap: 4px; }
.msg .files { grid-column: 3 / -1; display: flex; gap: 8px; align-items: center; overflow: hidden; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 200px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); padding: 3px 10px 3px 6px; font-size: 12px; font-weight: 400; cursor: pointer; color: var(--text-2);
}
.file-chip:hover { background: var(--hover); }
.file-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .att-ic svg { width: 16px; height: 16px; }
.more-files { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* full-screen preview */
.viewer { background: rgba(0, 0, 0, .86) !important; display: flex; align-items: center; justify-content: center; z-index: 90; }
.viewer .bar { position: absolute; top: 0; left: 0; right: 0; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 12px; color: #fff; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.viewer .bar .name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; }
.viewer .bar .name > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .bar .muted { color: rgba(255,255,255,.7); font-weight: 400; white-space: nowrap; }
.viewer .icon-btn { color: #fff; }
.viewer .icon-btn svg { fill: #fff; }
.viewer .stage { position: absolute; inset: 64px 72px 24px; display: flex; align-items: center; justify-content: center; }
.viewer .stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 4px 24px rgba(0,0,0,.5); background: #fff; }
.viewer .stage iframe { width: min(100%, 960px); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.viewer .stage .text-view { width: min(100%, 900px); max-height: 100%; overflow: auto; margin: 0; padding: 24px; background: #fff; color: #1f1f1f; border-radius: 4px; white-space: pre-wrap; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.viewer .stage .none { background: var(--surface); color: var(--text); border-radius: 12px; padding: 32px 48px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.viewer .stage .none .att-ic svg { width: 48px; height: 48px; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; background: rgba(255,255,255,.12); z-index: 1; }
.viewer .nav.prev { left: 12px; }
.viewer .nav.next { right: 12px; }
.viewer .nav:hover { background: rgba(255,255,255,.25); }

/* ---------- popovers & dialogs ---------- */
.popover {
  position: fixed; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); z-index: 60;
  padding: 16px; width: 360px; max-width: calc(100vw - 16px);
}
.switcher .me { text-align: center; padding: 8px 0 16px; }
.switcher .me .avatar { margin: 0 auto 8px; }
.switcher .acct {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 12px; cursor: pointer; background: var(--surface-2); margin-bottom: 2px;
}
.switcher .acct:hover { background: var(--hover); }
.switcher .acct.active { background: var(--selected); }
.switcher .acct .info { flex: 1; min-width: 0; }
.switcher .acct .info div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher .acct .info .sub { font-size: 12px; color: var(--text-3); }
.switcher .foot { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.backdrop { position: fixed; inset: 0; z-index: 55; }
.backdrop.dim { background: rgba(11, 36, 56, .4); display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: 28px; padding: 24px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.dialog h2 { font-weight: 400; margin: 0 0 16px; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- calendar ---------- */
.cal-side .mini { padding: 0 12px 0 20px; user-select: none; }
.mini .mhead { display: flex; align-items: center; justify-content: space-between; font-weight: 500; padding-left: 6px; }
.mini .mhead .icon-btn { width: 28px; height: 28px; }
.mini table { width: 100%; border-collapse: collapse; text-align: center; font-size: 11px; }
.mini th { color: var(--text-3); font-weight: 500; height: 24px; }
.mini td { height: 28px; }
.mini td button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: none; cursor: pointer; font-size: 11px; }
.mini td button:hover { background: var(--hover); }
.mini td button.other { color: var(--text-3); }
.mini td button.today { background: var(--accent); color: var(--accent-text); }
.mini td button.sel:not(.today) { background: var(--selected); }
.cal-list { padding: 0 8px 0 20px; }
.cal-list label { display: flex; align-items: center; gap: 12px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.cal-list label:hover { background: var(--hover); }
.cal-list input { width: 18px; height: 18px; margin: 0; }
.cal-list .sub { font-size: 11px; color: var(--text-3); }
.cal-list button.who { all: unset; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 6px; cursor: pointer; width: 100%; box-sizing: border-box; }
.cal-list button.who:hover { background: var(--hover); }
.cal-list button.who.active { background: var(--selected); font-weight: 600; }

.cal-head { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.cal-head h2 { font-size: 22px; font-weight: 400; margin: 0 8px; }
.cal-head .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.cal-head .seg button { border: 0; background: none; padding: 6px 14px; cursor: pointer; }
.cal-head .seg button.on { background: var(--selected); font-weight: 600; }
.viewing-as { padding: 6px 16px; background: var(--selected); font-size: 13px; }

.week { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.week .days { display: grid; grid-template-columns: 56px repeat(var(--n), 1fr); border-bottom: 1px solid var(--line); }
.week .days .d { text-align: center; padding: 6px 0; }
.week .days .d .dow { font-size: 11px; color: var(--text-3); text-transform: uppercase; font-weight: 500; }
.week .days .d .num { font-size: 24px; width: 44px; height: 44px; line-height: 44px; border-radius: 50%; margin: 0 auto; }
.week .days .d.today .num { background: var(--accent); color: var(--accent-text); }
.week .days .d.today .dow { color: var(--accent-ink); }
.week .allday { display: grid; grid-template-columns: 56px repeat(var(--n), 1fr); border-bottom: 1px solid var(--line); min-height: 8px; }
.week .allday .cell { padding: 2px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.week .grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: 56px repeat(var(--n), 1fr); position: relative; }
.week .hours div { height: 48px; font-size: 10px; color: var(--text-3); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.week .col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 48px; cursor: cell; }
.ev {
  position: absolute; left: 2px; right: 4px; border-radius: 6px; padding: 2px 6px; font-size: 12px; color: #fff; overflow: hidden;
  cursor: pointer; border: 1px solid var(--surface); line-height: 1.25;
}
.ev b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { border-radius: 4px; padding: 1px 6px; font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: #EA4335; z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: #EA4335; }

.month { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; min-height: 0; }
.month .dow { text-align: center; font-size: 11px; color: var(--text-3); font-weight: 500; padding-top: 6px; text-transform: uppercase; }
.month .cell { border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; cursor: cell; }
.month .cell .n { white-space: nowrap; text-align: center; font-size: 12px; font-weight: 500; }
.month .cell .n span { display: inline-block; width: 24px; height: 24px; line-height: 24px; border-radius: 50%; }
.month .cell.today .n span { background: var(--accent); color: var(--accent-text); }
.month .cell.other .n { color: var(--text-3); }
.month .more { font-size: 11px; color: var(--text-2); padding-left: 4px; }

/* ---------- settings ---------- */
.settings { flex: 1; overflow-y: auto; }
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }
.tabs a { padding: 14px 16px; text-decoration: none; color: var(--text-2); border-bottom: 3px solid transparent; font-weight: 500; }
.tabs a.active { color: var(--accent-ink); border-color: var(--accent-ink); }
.settings .pane { padding: 24px; max-width: 880px; }
.settings table { width: 100%; border-collapse: collapse; }
.settings td, .settings th { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.settings th { font-size: 12px; color: var(--text-3); font-weight: 500; }
.settings h2 { font-weight: 400; font-size: 20px; margin: 0 0 4px; }
.settings p.help { color: var(--text-3); margin: 0 0 20px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.presets button.on { background: var(--selected); border-color: var(--accent-ink); }
/* Settings > Admin */
.settings tr.disabled td:not(:last-child) { opacity: .6; }
.tag { display: inline-block; margin-top: 2px; padding: 0 8px; border-radius: 10px; font-size: 12px; background: var(--line); color: var(--text-2); }
.tag.off { background: #FCE8E6; color: var(--danger); }
[data-scheme="dark"] .tag.off { background: #3B1714; color: #F2B8B5; }
.settings table.health th { width: 140px; font-size: 14px; color: var(--text-2); }
.settings h3 { font-weight: 500; font-size: 15px; margin: 20px 0 4px; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-fill:disabled { opacity: .5; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 16px; padding: 12px 16px 4px; }
legend { padding: 0 6px; font-weight: 500; }

/* ---------- small screens: the same app works on phones ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr) 64px; }
  .topbar { padding: 8px 4px; gap: 2px; }
  .topbar > .icon-btn[title=Settings] { display: none; }
  .rail { grid-row: 3; flex-direction: row; justify-content: space-around; border-top: 1px solid var(--line); background: var(--surface); padding: 6px 0; }
  .brand span { display: none; }
  .brand { width: auto; }
  .sidebar { position: fixed; top: 64px; bottom: 64px; left: 0; z-index: 40; background: var(--bg); box-shadow: var(--shadow); width: 280px; }
  .shell:not(.drawer) .sidebar { display: none; }
  .shell .sidebar .compose { display: none; }
  .main { margin: 0; border-radius: 0; grid-row: 2; }
  .msg { grid-template-columns: 0 0 minmax(0, 1fr) auto; height: auto; padding: 10px 12px; row-gap: 2px; }
  .msg input[type=checkbox] { display: none; }
  .msg .star { grid-column: 4; grid-row: 2; justify-self: end; }
  .msg .from { grid-column: 3; grid-row: 1; }
  .msg .date { grid-column: 4; grid-row: 1; }
  .msg .subject { grid-column: 3; grid-row: 2; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .msg .hover-actions { display: none !important; }
  .msg .files { grid-column: 3 / -1; grid-row: 3; }
  .viewer .stage { inset: 64px 8px 72px; }
  .viewer .nav { top: auto; bottom: 12px; transform: none; }
  .att-card { width: calc(50% - 6px); }
  .reader { padding: 8px 16px 40px; }
  .reader h1, .reader .hdr { margin-left: 0; padding-left: 0; }
  .fab { position: fixed; right: 16px; bottom: 80px; z-index: 30; display: inline-flex !important; }
  .compose-win { right: 0; width: 100%; height: 100%; max-height: 100%; border-radius: 0; top: 0; }
  .search { height: 44px; }
  .cal-head { flex-wrap: wrap; padding: 8px; }
  .cal-head h2 { font-size: 18px; order: 5; flex-basis: 100%; margin: 4px 8px 0; }
}
.fab { display: none; }

/* ---------- sign-in with a provider ---------- */
.auth-card .btn.sso, .signin-btns .btn { display: flex; justify-content: center; width: 100%; text-decoration: none; margin-bottom: 8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 13px; margin: 12px 0 16px; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.redirect { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.redirect code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--bg); padding: 6px 8px; border-radius: 6px; font-size: 13px; }
label.check { display: flex; gap: 8px; align-items: center; margin: 4px 0 8px; }
.settings .actions { display: flex; justify-content: flex-end; }

/* ---------- labels, search options, filters ---------- */
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.sidebar h3 .icon-btn { margin-right: 4px; }
.nav.labels a { gap: 14px; }
.nav.labels a .more { visibility: hidden; margin-right: -8px; }
.nav.labels a:hover .more, .nav.labels a:focus-within .more { visibility: visible; }
.nav.labels a:hover .count { display: none; }
.lic { display: inline-grid; place-items: center; flex: none; }
.lic svg { width: 18px; height: 18px; fill: currentColor; }
.lrow { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.lchip {
  display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; line-height: 18px;
  padding: 0 6px; margin-right: 6px; border-radius: 4px; vertical-align: middle; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: color-mix(in srgb, var(--c) 75%, var(--text));
}
.lchip button { border: 0; background: none; padding: 0 0 0 2px; cursor: pointer; color: inherit; font-size: 14px; line-height: 1; }
.reader h1 .lchip { font-size: 13px; }
.subject .label-chip { margin-right: 6px; }
.msg.cursor { box-shadow: inset 4px 0 0 var(--accent-ink); }
.btn.small { padding: 4px 12px; font-size: 13px; margin-left: 8px; }
.btn.small svg { width: 16px; height: 16px; }

.popover.picker, .popover.menu { width: 280px; padding: 12px 0; border-radius: 8px; }
.pick-head { padding: 0 16px 8px; font-weight: 500; }
.picker > input { margin: 0 16px 8px; width: calc(100% - 32px); border: 0; border-bottom: 1px solid var(--line); padding: 6px 0; background: transparent; outline: 0; }
.pick-list { max-height: 260px; overflow-y: auto; }
.pick-list label.check { margin: 0; padding: 4px 16px; cursor: pointer; }
.pick-list label.check:hover { background: var(--hover); }
.pick-list input { accent-color: var(--accent-ink); }
.pick-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 10px 16px 0; }
.menu-item { display: block; width: 100%; border: 0; background: none; text-align: left; padding: 8px 16px; cursor: pointer; }
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.dialog .swatches { padding: 0; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--surface); }

.popover.search-opts { border-radius: 8px; padding: 16px 20px; }
.criteria .crit { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; margin-bottom: 6px; }
.criteria .crit label { color: var(--text-2); font-size: 13px; }
.criteria .crit input { border: 0; border-bottom: 1px solid var(--line); padding: 6px 0; background: transparent; outline: 0; min-width: 0; }
.criteria .crit input:focus { border-bottom-color: var(--accent-ink); }
.criteria .size { display: flex; gap: 8px; }
.criteria .size select { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 4px; }
.criteria .size input { width: 80px; flex: none; }
.link-btn { border: 0; background: none; color: var(--accent-ink); cursor: pointer; font-weight: 500; padding: 8px; margin-right: auto; }
.filter-dlg h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; }
.filter-dlg .act { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.filter-dlg .act label.check { margin: 0; flex: none; }
.filter-dlg .act select, .filter-dlg .act input[type=email] { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--surface); min-width: 0; flex: 1; }
.filter-dlg .also { margin-top: 12px; }
@media (max-width: 860px) {
  .criteria .crit { grid-template-columns: 96px 1fr; }
  .nav.labels a .more { visibility: visible; }
  .search .icon-btn[title="Show search options"], .toolbar .results { display: none; }
  .toolbar .btn.small { margin-left: 0; }
}

/* ---------- contacts ---------- */
.compose-win .line { position: relative; }
.suggest {
  position: absolute; top: 100%; left: 24px; right: 0; z-index: 70; background: var(--surface); border-radius: 8px;
  box-shadow: var(--shadow); padding: 6px 0; max-height: 320px; overflow-y: auto;
}
.suggest .opt { display: flex; align-items: center; gap: 12px; padding: 6px 16px; cursor: pointer; }
.suggest .opt.on { background: var(--hover); }
.suggest .who { min-width: 0; }
.suggest .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .n { font-weight: 500; }
.suggest .e { font-size: 12px; color: var(--text-3); }
.list-title { font-size: 18px; font-weight: 400; margin: 0 8px; }
.toolbar .hint { font-size: 13px; margin-left: 8px; }
.crow {
  display: grid; grid-template-columns: 40px minmax(140px, 1.2fr) minmax(140px, 1.2fr) minmax(100px, .8fr) minmax(100px, 1fr) 96px;
  align-items: center; gap: 12px; padding: 6px 16px; min-height: 52px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.crow:hover { background: var(--hover); }
.crow:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -2px; }
.crow > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow.chead { min-height: 40px; cursor: default; font-size: 12px; font-weight: 500; color: var(--text-3); }
.crow.chead:hover { background: none; }
.crow .cname .label-chip { margin-left: 8px; }
.crow .row-actions { display: flex; justify-content: flex-end; visibility: hidden; }
.crow:hover .row-actions, .crow:focus-within .row-actions { visibility: visible; }
.contacts-list .crow:not(.chead) .avatar { width: 32px; height: 32px; }
.nav a .sub { font-size: 11px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a .lic { color: var(--text-3); }
.contact-dlg .dlg-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.contact-dlg .dlg-head h2 { margin: 0; }
.contact-dlg .row.multi { align-items: center; margin-bottom: 6px; }
.contact-dlg .row.multi > select { flex: 0 0 110px; }
.contact-dlg .row.multi > .icon-btn { flex: none; }
.contact-dlg .link-btn { padding: 4px 0; }
.contact-dlg textarea { resize: vertical; }
.field input:disabled, .field textarea:disabled, .field select:disabled { background: transparent; border-color: transparent; color: var(--text); opacity: 1; }
@media (max-width: 860px) {
  .crow { grid-template-columns: 40px minmax(0, 1fr) auto; row-gap: 0; }
  .crow .cmail { grid-column: 2; grid-row: 2; font-size: 12px; color: var(--text-3); }
  .crow .cname { grid-column: 2; grid-row: 1; }
  .crow .avatar { grid-row: 1 / 3; }
  .crow .cextra, .crow .cjob, .crow.chead { display: none; }
  .crow .row-actions { visibility: visible; grid-column: 3; grid-row: 1 / 3; }
  .toolbar .hint { display: none; }
  .suggest { left: 0; }
}
.avatar svg { width: 60%; height: 60%; fill: currentColor; }

/* ---------- events: guests, repeats, reminders, invitations ---------- */
.avatar.sm { width: 24px; height: 24px; font-size: 12px; }
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.chip.pending, .ev.pending { border: 1px dashed; }
.chip.declined, .ev.declined { border: 1px solid; text-decoration: line-through; opacity: .75; }
.ev.tentative, .chip.tentative { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.22) 0 6px, transparent 6px 12px); }
.event-dialog .row.wrap { align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.event-dialog label.inline { display: flex; gap: 8px; align-items: center; flex: none; }
.event-dialog label.inline.grow { flex: 1; }
.event-dialog label.inline svg, .ev-sec > svg, .reminder > svg { width: 20px; height: 20px; fill: var(--text-3); flex: none; }
.event-dialog label.inline select { flex: 1; min-width: 0; }
.ev-sec { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.ev-sec > svg { margin-top: 10px; }
.guests .guest { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.guests .guest .who { flex: 1; min-width: 0; }
.guests .guest .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guests .guest .sub { font-size: 12px; color: var(--text-3); }
.guests .rsvp { font-size: 12px; color: var(--text-3); }
.guests .accepted .rsvp { color: #188038; }
.guests .declined .rsvp { color: var(--danger); }
.guests .declined .who { text-decoration: line-through; }
.reminders { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.reminder { display: flex; align-items: center; gap: 8px; }
.reminder input { width: 72px; }
.reminders .btn.small { margin-left: 0; }
.rsvp-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
.rsvp-row > span:first-child { margin-right: 8px; font-weight: 500; }
.rsvp-row .btn.small { margin-left: 0; }
.btn.on { background: var(--selected); border-color: var(--accent-ink); font-weight: 600; }
.dialog.ask { width: min(400px, 100%); }
.invite-card { display: flex; gap: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 16px; }
.invite-card .date-tile { width: 56px; flex: none; text-align: center; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); align-self: flex-start; }
.invite-card .date-tile .mon { background: var(--accent); color: var(--accent-text); font-size: 11px; text-transform: uppercase; padding: 2px 0; }
.invite-card .date-tile .day { font-size: 22px; font-weight: 500; }
.invite-card .date-tile .dow { font-size: 11px; color: var(--text-3); padding-bottom: 4px; }
.invite-card .what { font-size: 16px; font-weight: 500; margin-bottom: 2px; }
.invite-card .what.canceled { text-decoration: line-through; }
.invite-card .note { margin: 8px 0 4px; }
.invite-card .btn.small { margin-left: 0; }
.invite-card a { font-size: 13px; }
.reminder-toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(360px, calc(100vw - 32px)); }
.reminder-toast { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); box-shadow: var(--shadow); border-radius: 12px; padding: 12px 8px 12px 16px; cursor: pointer; }
.reminder-toast > svg { width: 22px; height: 22px; fill: var(--accent-ink); flex: none; margin-top: 2px; }
.notify-ask { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface-2); border-radius: 12px; margin: 0 16px 8px; flex-wrap: wrap; }
.notify-ask > svg { width: 20px; height: 20px; fill: var(--accent-ink); }
.notify-ask .btn.small { margin-left: 0; }
@media (max-width: 860px) { .reminder-toasts { right: 16px; left: 16px; width: auto; bottom: 88px; } }
.event-dialog .row.wrap select, .ev-sec input, .reminder input, .reminder select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.ev-sec input { width: 100%; box-sizing: border-box; }
.field .reminder input { width: 80px; flex: none; padding: 8px 6px 8px 10px; }
.field .reminder select { width: auto; }

/* ---------- snooze, schedule send, undo send, signatures ---------- */
.toast { display: flex; align-items: center; gap: 16px; }
.toast-act { background: none; border: 0; color: var(--seaglass); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 8px; margin: -4px -8px -4px 0; border-radius: 4px; }
.toast-act:hover { background: rgba(255, 255, 255, .1); }
.popover.times { width: 300px; }
.menu-item.time { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.menu-item.time svg { width: 18px; height: 18px; fill: currentColor; color: var(--text-3); }
.menu-item.on { font-weight: 600; background: var(--selected); }
.menu-sep { height: 1px; background: var(--line); margin: 8px 0; }
.when-row { display: flex; gap: 12px; }
.when-row .field { flex: 1; }
.compose-win .split { display: inline-flex; }
.compose-win .btn.send { border-radius: 999px 0 0 999px; }
.compose-win .btn.send-more { border-radius: 0 999px 999px 0; padding: 0 8px; margin-left: 1px; }
.compose-win .btn.send-more svg { width: 20px; height: 20px; }
.when-note { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose-win .editor .sig { color: var(--text-2); white-space: normal; cursor: default; }
.compose-win .editor .sig img { max-width: 100%; }
.date.snoozed, .date.sched { color: var(--accent-ink); font-weight: 600; }
.sched-ic { display: inline-grid; place-items: center; }
.sched-ic svg { width: 18px; height: 18px; fill: var(--text-3); }
.label-chip.failed { background: #FCE8E6; color: #8C1D18; }
.msg.scheduled .label-chip { margin-right: 6px; }
.msg .files.error { font-size: 12px; }
.snooze-banner { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: 8px; padding: 6px 8px 6px 12px; margin: 0 0 16px; }
.snooze-banner svg { width: 20px; height: 20px; fill: var(--accent-ink); flex: none; }
.snooze-banner .btn.small { margin-left: 0; }
.settings .gen { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.settings .gen select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.sig-card { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 8px; margin-bottom: 12px; background: var(--surface); }
.sig-head { display: flex; gap: 8px; align-items: center; }
.sig-name { flex: 1; border: 0; font: inherit; font-weight: 500; font-size: 15px; background: transparent; padding: 8px 0; color: var(--text); outline: 0; }
.sig-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.sig-edit { min-height: 72px; padding: 8px 4px; outline: 0; overflow-wrap: anywhere; }
.sig-edit img { max-width: 100%; }
.sig-defaults { margin-top: 8px; }
.sig-defaults select { width: 100%; }
.radios { display: flex; column-gap: 24px; flex-wrap: wrap; margin-bottom: 8px; }
.radios label.check { margin: 4px 0; }
label.check.inline { margin: 0; flex-direction: row; }
.field label.check input[type=checkbox] { width: auto; margin: 0; }
.settings .gen input[type=date]:disabled { opacity: .5; border-color: var(--line); }
.sig-edit img, .compose-win .editor .sig img { max-height: 160px; width: auto; }
.settings p.help.note { margin: 12px 0 0; }
.gen-save { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; display: flex; gap: 12px; align-items: center; }
@media (max-width: 860px) { .when-row { flex-direction: column; gap: 0; } }
.import-jobs { margin-top: 12px; display: grid; gap: 10px; }
.import-job { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.import-job details { margin-top: 6px; }
.import-job ul { margin: 6px 0 0; padding-left: 18px; }

/* Settings > Security and the 2-Step Verification sign-in step */
.settings .sec { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.settings .sec:last-child { border-bottom: 0; }
.settings .sec table { margin-bottom: 12px; }
.settings .sec td .muted { font-size: 13px; }
.settings .sec svg { width: 20px; height: 20px; fill: var(--text-3); vertical-align: middle; }
.state { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 500; background: var(--surface-2); color: var(--text-2); }
.state.on { background: var(--selected); color: var(--accent-ink); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.recovery-codes { columns: 2; padding-left: 24px; margin: 8px 0 0; font-size: 15px; line-height: 2; }
.recovery-codes code, .secret { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.dialog .qr { display: block; margin: 8px auto; width: 200px; height: 200px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 8px; }
.dialog .steps { padding-left: 20px; margin: 0 0 8px; }
.dialog a.btn { text-decoration: none; }
.auth-card .btn.sso svg { width: 18px; height: 18px; fill: currentColor; margin-right: 8px; }
.settings .sec .btn { white-space: nowrap; }

/* ---------- density ---------- */
/* Default shows attachment cards in the list; Comfortable and Compact
   keep each message on one line, Compact with shorter rows, as in Gmail. */
:root:is([data-density="comfortable"], [data-density="compact"]) .msg .files { display: none; }
:root:is([data-density="comfortable"], [data-density="compact"]) .msg.has-files { height: var(--row-h); min-height: 0; padding-top: 0; padding-bottom: 0; }
:root[data-density="compact"] .toolbar { min-height: 40px; padding-top: 2px; padding-bottom: 2px; }
:root[data-density="compact"] .compose { height: 48px; margin-bottom: 8px; }

/* ---------- theme picker (Settings > General) ---------- */
.theme-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 16px; }
.theme-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 2px solid var(--line);
  border-radius: 12px; background: var(--surface); cursor: pointer; min-width: 112px; font-size: 13px;
}
.theme-opt:hover { background: var(--hover); }
.theme-opt[aria-checked="true"] { border-color: var(--accent-ink); font-weight: 600; }
.theme-opt:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.theme-opt .swatch { width: 96px; height: 60px; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; display: grid; grid-template-columns: 30% 1fr; }
.theme-opt .swatch i { display: block; }
.theme-opt .dot { width: 36px; height: 36px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--text-3) 60%, transparent); display: grid; place-items: center; }
.theme-opt .dot svg { width: 20px; height: 20px; fill: currentColor; }
.theme-opt .lines { width: 96px; height: 60px; display: flex; flex-direction: column; justify-content: center; gap: var(--gap); padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.theme-opt .lines i { display: block; height: 6px; border-radius: 3px; background: var(--text-3); opacity: .5; }
.theme-h { font-size: 14px; font-weight: 500; margin: 12px 0 0; color: var(--text-2); }
/* The logo is drawn with navy outlines; trace it in sea glass on dark. */
[data-scheme="dark"] img[src="logo.svg"] { filter: drop-shadow(0 0 .6px #A8D4DF) drop-shadow(0 0 .6px #A8D4DF); }
