/* Sandy Mail production client. No network imports: fonts fall back to the system stack. */
:root {
  /* Light (default): black text on white. */
  --bg: #f6f6f4;
  --panel: #ffffff;
  --header: #fafaf9;
  --soft: #f0f0ed;
  --hover: #f2f2ef;
  --active: #e9e9e5;
  --line: #ddddd8;
  --line-soft: #ebebe7;
  --ink: #111111;
  --ink-2: #3a3a38;
  --muted: #6f6f69;
  --faint: #a2a29a;
  --primary: #1a1a1a;
  --on-primary: #ffffff;
  --accent: #1f5fd1;
  --unread: #1f5fd1;
  --flag: #d9902a;
  --danger: #c2412d;
  --danger-soft: #fbeae6;
  --warn-soft: #fdf4e1;
  --ok: #2e8b57;
  --focus: #5b8def;
  --shadow: 0 10px 40px rgba(20, 20, 15, .14), 0 2px 8px rgba(20, 20, 15, .06);
  --radius: 9px;
  --row-pad: 14px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
/* Night mode: white text on black. */
:root[data-theme="dark"] {
    --bg: #0b0b0b; --panel: #121212; --header: #0f0f0f; --soft: #1f1f1f; --hover: #1a1a1a; --active: #262626;
    --line: #2e2e2e; --line-soft: #222; --ink: #f5f5f5; --ink-2: #d6d6d6; --muted: #9c9c9c; --faint: #6c6c6c;
    --primary: #f5f5f5; --on-primary: #111; --accent: #7aa7ff; --unread: #7aa7ff; --flag: #f0b45c;
    --danger: #ff8a73; --danger-soft: #3a211c; --warn-soft: #3a2f16; --ok: #6fcf97; --shadow: 0 10px 40px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0b0b0b; --panel: #121212; --header: #0f0f0f; --soft: #1f1f1f; --hover: #1a1a1a; --active: #262626;
    --line: #2e2e2e; --line-soft: #222; --ink: #f5f5f5; --ink-2: #d6d6d6; --muted: #9c9c9c; --faint: #6c6c6c;
    --primary: #f5f5f5; --on-primary: #111; --accent: #7aa7ff; --unread: #7aa7ff; --flag: #f0b45c;
    --danger: #ff8a73; --danger-soft: #3a211c; --warn-soft: #3a2f16; --ok: #6fcf97; --shadow: 0 10px 40px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-density="comfortable"] { --row-pad: 8px; }
:root[data-density="compact"] { --row-pad: 4px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sprite { display: none; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--panel); padding: 8px 12px; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); font-weight: 550; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary); opacity: .9; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--ink-2); }
/* Hover only where there is a real pointer: on iPhone a tapped button otherwise stays "hovered" (grey box,
   and the hover colour hides a starred state) until something else is tapped. Touch gets a press flash. */
@media (hover: hover) { .icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); } }
.icon-btn:active:not(:disabled) { background: var(--hover); }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn.small svg { width: 15px; height: 15px; }
.icon-btn[aria-pressed="true"], .icon-btn[aria-pressed="true"]:hover:not(:disabled) { color: var(--flag); }
/* Download buttons: a clear press, a spinner while the file is fetched, a green tick once the browser has it. */
.att-dl, .att-acts .icon-btn, .icon-btn.dl-busy, .icon-btn.dl-done { transition: transform .08s ease, background-color .12s ease, color .12s ease; }
.att-dl:active:not(:disabled), .att-acts .icon-btn:active:not(:disabled) { transform: scale(.88); background: var(--hover); color: var(--accent); }
.att .att-dl:active:not(:disabled) svg { color: inherit; }
.icon-btn.dl-busy, .icon-btn.dl-busy:hover:not(:disabled) { background: var(--hover); color: var(--accent); cursor: progress; }
.icon-btn.dl-done, .icon-btn.dl-done:hover:not(:disabled) { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
/* The icon follows the button (attachment chips colour their icons grey otherwise). */
.dl-busy svg, .dl-done svg, .att .dl-done svg, .att .dl-busy svg { color: inherit; }
.dl-done svg { stroke-width: 3; }
.dl-done svg { animation: dl-pop .25s ease-out; }
.dl-spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: img-spin .7s linear infinite; vertical-align: -2px; }
.text-btn .dl-spin { width: 12px; height: 12px; }
@keyframes dl-pop { from { transform: scale(.5); opacity: .3; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dl-spin { animation-duration: 2s; } .dl-done svg { animation: none; } .att-dl:active, .att-acts .icon-btn:active { transform: none; } }
#reader-flag[aria-pressed="true"] svg { fill: var(--flag); } /* flagged: a solid star, as in the message list */
.text-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.text-btn:hover { background: var(--hover); color: var(--ink); }
.text-btn svg { width: 15px; height: 15px; }

/* Login */
.login-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 28px; overflow: auto; height: 100%; }
.login-brand, .brand { font-size: 26px; letter-spacing: -1.3px; white-space: nowrap; font-weight: 400; color: var(--ink); }
.login-brand b, .brand b { font-weight: 750; }
.login-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 36px 32px; box-shadow: 0 3px 15px rgba(0,0,0,.03); }
.login-card .eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--muted); font-weight: 500; }
.login-card h1 { font-size: 27px; font-weight: 650; letter-spacing: -.8px; line-height: 1.3; margin: 12px 0 10px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card form { display: grid; gap: 16px; }
.login-card label { display: grid; gap: 6px; font-weight: 500; color: var(--ink-2); font-size: 13px; }
.login-card input { height: 44px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; background: var(--panel); font-size: 15px; }
.login-card .btn { height: 46px; margin-top: 4px; }
.form-message { color: var(--danger); font-size: 13px; min-height: 18px; }
.login-footer { color: var(--muted); font-size: 13px; }

/* App shell */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 24px; padding: 0 18px 0 24px; background: var(--header); border-bottom: 1px solid var(--line); }
.brand { width: 196px; flex-shrink: 0; }
.search { flex: 1; min-width: 0; max-width: 680px; position: relative; display: flex; align-items: center; background: var(--soft); border-radius: 11px; height: 42px; padding: 0 8px 0 14px; gap: 8px; border: 1px solid transparent; }
.search:focus-within { background: var(--panel); border-color: var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.search-icon { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; height: 100%; font-size: 14px; }
.search input::-webkit-search-cancel-button { display: none; }
kbd { font: 11px var(--font); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--muted); background: var(--panel); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.avatar-btn { border-radius: 50%; margin-left: 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 13px; color: #fff; background: #6b6b63; flex-shrink: 0; text-transform: uppercase; }
.avatar.lg { width: 38px; height: 38px; font-size: 14px; }
.account-menu { position: relative; }
.popover { position: absolute; z-index: 40; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 220px; }
/* A menu opened from inside a dialog (a rule's ⋯ in Settings, say) sits above the dialog (.modal-wrap is 70). */
.popover.menu {
  z-index: 80; padding: 4px; min-width: min(220px, var(--menu-max-width, calc(100vw - 16px)));
  max-width: var(--menu-max-width, calc(100vw - 16px)); max-height: var(--menu-max-height, calc(100vh - 16px));
  overflow: hidden auto; overscroll-behavior-y: contain;
}
.popover.menu .pop-item { min-height: 28px; padding: 4px 10px; gap: 8px; }
.popover.menu .divider { margin-block: 2px; }
.popover.menu .pop-heading { padding-block: 5px 2px; }
.popover.menu .pi-sub { max-width: 56%; overflow: hidden; text-overflow: ellipsis; margin-left: 4px; }
@media (pointer: coarse) { .popover.menu .pop-item { min-height: 38px; } }
#account-pop { right: 0; top: 44px; }
.pop-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.pop-name { font-weight: 600; }
.pop-mail { color: var(--muted); font-size: 13px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; text-align: left; }
.pop-item:hover, .pop-item.active { background: var(--hover); }
.pop-item svg { width: 16px; height: 16px; color: var(--muted); }
.popover .divider { height: 1px; background: var(--line-soft); margin: 4px 6px; }
.toast[data-error="1"] { background: var(--danger); color: #fff; }

.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px minmax(320px, 400px) 1fr; position: relative; }
.sidebar { background: var(--header); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 14px; gap: 6px; min-height: 0; overflow: auto; }
.compose-btn { height: 46px; margin: 0 4px 14px; font-size: 14px; }
.folders { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.folder { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: var(--radius); color: var(--ink-2); text-align: left; min-height: 38px; }
.folder:hover { background: var(--hover); color: var(--ink); }
.folder.active { background: var(--active); color: var(--ink); font-weight: 600; }
.folder.drop-target { background: var(--soft); box-shadow: inset 0 0 0 2px var(--accent); }
/* Folder tree: fold arrow, and the line showing where a dragged folder will land. */
.folder-twisty { display: inline-grid; place-items: center; width: 14px; height: 18px; margin-right: -5px; flex: none; color: var(--muted); border-radius: 4px; cursor: pointer; }
.folder-twisty.none { cursor: default; }
.folder-twisty:not(.none):hover { background: var(--hover); color: var(--ink); }
.folder .folder-twisty svg { width: 12px; height: 12px; transform: rotate(-90deg); transition: transform .15s; }
.folder.open > .folder-twisty svg { transform: rotate(0); }
.folder.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.folder.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.folder.dragging { opacity: .45; }
.folder[draggable="true"] { -webkit-user-drag: element; }
.folder svg { width: 17px; height: 17px; color: var(--muted); }
.folder .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.folder.unread .name { font-weight: 650; color: var(--ink); }
.folders .divider { height: 1px; background: var(--line-soft); margin: 8px 12px; }
.sidebar .text-btn { margin: 4px 2px; align-self: flex-start; }
.sidebar-foot { margin-top: auto; padding: 16px 12px 4px; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* List */
.list-pane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.list-head { padding: 18px 16px 10px 14px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 12px; position: relative; }
.list-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list-title-row h1 { font-size: 20px; font-weight: 650; letter-spacing: -.5px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); background: var(--panel); }
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.bulk-bar { position: absolute; inset: 0; background: var(--panel); display: flex; align-items: center; gap: 6px; padding: 0 10px 0 16px; z-index: 2; border-bottom: 1px solid var(--line-soft); }
.bulk-bar > span { font-weight: 600; font-size: 13px; margin-right: auto; white-space: nowrap; }
.bulk-actions { display: flex; flex-wrap: wrap; }
.select-split { display: inline-flex; align-items: center; flex-shrink: 0; border-radius: 6px; }
.select-split:hover { background: var(--hover); }
.select-menu-btn { display: inline-grid; place-items: center; width: 18px; height: 26px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 4px; }
.select-menu-btn svg { width: 14px; height: 14px; }
.select-menu-btn:hover { color: var(--ink); }
.select-menu-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.bulk-bar .select-split { margin-left: -6px; }
.select-banner { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; padding: 8px 16px; font-size: 13px; color: var(--ink-2); background: var(--soft); border-bottom: 1px solid var(--line-soft); text-align: center; }
.select-banner .text-btn { padding: 4px 6px; color: var(--focus); font-weight: 600; }
.select-menu .pi-sub { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unsub-lines { margin: 8px 0 12px; padding-left: 20px; display: grid; gap: 6px; }
.unsub-who summary { cursor: pointer; color: var(--focus); font-size: 13px; }
.unsub-who ul, .unsub-links { max-height: 220px; overflow-y: auto; margin: 8px 0 0; padding-left: 20px; font-size: 13px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.check { position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; flex-shrink: 0; cursor: pointer; }
.check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.check span { width: 16px; height: 16px; border: 1.5px solid var(--faint); border-radius: 4px; background: var(--panel); display: grid; place-items: center; }
.check input:checked + span { background: var(--primary); border-color: var(--primary); }
.check input:checked + span::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--on-primary); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input:indeterminate + span::after { content: ""; width: 8px; height: 2px; background: var(--primary); }
.check input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.message-list { flex: 1; overflow-y: auto; outline: none; overscroll-behavior: contain; }
.row { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: var(--row-pad) 16px var(--row-pad) 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; user-select: none; }
@media (hover: hover) { .row:hover { background: var(--hover); } } /* touch screens: no sticky hover after a tap */
.row.selected { background: var(--active); }
.row.checked { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.row.focused { box-shadow: inset 3px 0 0 var(--ink); }
.row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.row .check { margin-top: 1px; opacity: .55; }
.row.checked .check, .list-pane.selecting .row .check { opacity: 1; }
@media (hover: hover) { .row:hover .check { opacity: 1; } }
.row-main { min-width: 0; display: grid; gap: 3px; }
.row-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--ink-2); }
.row-lead { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.row-star, .row-expand { display: grid; place-items: center; width: 24px; border-radius: 6px; color: var(--faint); }
.row-star { height: 22px; }
.row-star svg { width: 16px; height: 16px; }
@media (hover: hover) { .row-star:hover { color: var(--ink-2); background: var(--hover); } } /* touch screens: no sticky hover after a tap */
.row-star.on { color: var(--flag); }
.row-star.on svg { fill: var(--flag); }
.row-expand { min-height: 30px; padding: 1px 0 0; gap: 0; color: var(--muted); border: 1px solid var(--line); background: var(--panel); font-size: 11px; font-weight: 650; line-height: 1.1; }
.row-expand:hover { color: var(--ink); border-color: var(--faint); }
.row-expand svg { width: 12px; height: 12px; transition: transform .15s; }
.row-expand[aria-expanded="true"] { color: var(--ink); border-color: var(--ink-2); }
.row-expand[aria-expanded="true"] svg { transform: rotate(90deg); }
.row-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row-done { display: inline-grid; color: var(--muted); align-self: center; }
.row-done svg { width: 13px; height: 13px; }
.row-subject { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.row-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-preview="off"] .row-preview { display: none; }
.row.unread .row-from, .row.unread .row-subject { font-weight: 680; color: var(--ink); }
.row.unread::before { content: ""; position: absolute; left: 5px; top: calc(var(--row-pad) + 7px); width: 6px; height: 6px; border-radius: 50%; background: var(--unread); }
.row-meta { display: flex; align-items: center; gap: 6px; min-height: 0; }
.row-meta:empty { display: none; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.row-meta svg { width: 14px; height: 14px; color: var(--muted); }
.row-meta .flagged { color: var(--flag); fill: var(--flag); }
.row-actions { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: none; gap: 2px; background: var(--hover); border-radius: 8px; padding: 2px; box-shadow: -12px 0 12px var(--hover); }
.row.selected .row-actions { background: var(--active); box-shadow: -12px 0 12px var(--active); }
@media (hover: hover) { .row:hover .row-actions { display: flex; } } /* touch screens: no sticky hover after a tap */
.row-actions .icon-btn { width: 30px; height: 30px; }
.row-actions svg { width: 16px; height: 16px; }
.row.leaving { opacity: 0; transition: opacity .18s; }
/* Compact: one line per email — sender, subject – preview, tags, date. */
:root[data-density="compact"] .row { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px; }
:root[data-density="compact"] .row-lead { display: grid; grid-template-columns: 22px 24px 30px; align-items: center; justify-items: center; gap: 0; }
:root[data-density="compact"] .row-star { height: 24px; }
:root[data-density="compact"] .row-expand { min-height: 22px; width: auto; min-width: 26px; padding: 0 4px; flex-direction: row; gap: 1px; }
:root[data-density="compact"] .row-main { display: flex; align-items: center; gap: 10px; min-height: 28px; }
:root[data-density="compact"] .row-top { display: contents; }
:root[data-density="compact"] .row-from { flex: 0 0 clamp(90px, 24%, 190px); order: 1; }
:root[data-density="compact"] .row-subject { flex: 0 1 auto; max-width: 45%; min-width: 0; order: 2; }
:root[data-density="compact"] .row-preview { flex: 1 1 0; min-width: 0; order: 3; }
:root[data-density="compact"] .row-preview:not(:empty)::before { content: "– "; }
:root[data-density="compact"] .row-meta { order: 4; flex: 0 1 auto; max-width: 30%; min-width: 0; overflow: hidden; flex-wrap: nowrap; }
:root[data-density="compact"] .row-done { order: 5; }
:root[data-density="compact"] .row-date { order: 6; flex: none; }
:root[data-density="compact"] .row.unread::before { top: 50%; transform: translateY(-50%); }

.empty-list { padding: 64px 24px; text-align: center; color: var(--muted); }
.list-section { padding: 10px 16px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.empty-list strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.skeleton { padding: 16px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 8px; }
.skeleton i { display: block; height: 10px; border-radius: 4px; background: var(--soft); animation: pulse 1.2s ease-in-out infinite; }
.skeleton i:nth-child(1) { width: 40%; } .skeleton i:nth-child(2) { width: 75%; } .skeleton i:nth-child(3) { width: 90%; }
@keyframes pulse { 50% { opacity: .5; } }
.list-foot { padding: 0 16px; }
.list-foot .btn { margin: 12px auto; display: flex; }

/* Reader */
.reader-pane { min-width: 0; min-height: 0; overflow-y: auto; background: var(--panel); }
.reader-empty { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 24px; }
.reader-empty h2 { color: var(--ink); font-size: 18px; margin: 14px 0 4px; font-weight: 600; }
.reader-empty p { margin: 0; }
.empty-icon { width: 44px; height: 44px; margin: auto; color: var(--faint); stroke-width: 1.2; }
.reader-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 2px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line-soft); min-height: 56px; }
.reader-toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.reader-toolbar .spacer { flex: 1; }
.reader-toolbar .pos { color: var(--muted); font-size: 12.5px; margin-right: 4px; white-space: nowrap; }
.reader-toolbar .reader-unsub { margin-left: 6px; gap: 6px; white-space: nowrap; }
.reader-toolbar .reader-unsub svg { width: 16px; height: 16px; }
@media (max-width: 380px) { .reader-toolbar .reader-unsub .label { display: none; } .reader-toolbar .reader-unsub { padding: 0 8px; } }
.reader-flow { max-width: 900px; padding: 26px 40px 60px; }
.reader-subject { font-size: 24px; line-height: 1.3; font-weight: 650; letter-spacing: -.6px; margin: 0 0 6px; overflow-wrap: anywhere; }
.reader-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.msg { border: 1px solid var(--line-soft); border-radius: 12px; margin-bottom: 12px; background: var(--panel); }
.msg-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 16px 18px; cursor: pointer; }
.msg.open .msg-head { cursor: default; padding-bottom: 6px; }
.msg.draft-card, .msg.draft-card .msg-head { cursor: pointer; }
.msg.draft-card:hover { border-color: var(--accent); }
.msg-who { min-width: 0; }
.msg-from { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-from .addr { color: var(--muted); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
.msg-to { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 0; border: 0; background: none; font: inherit; color: var(--muted); font-size: 12.5px; cursor: pointer; text-align: left; }
.msg-to > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.msg-to:hover > span, .msg-to:focus-visible > span { text-decoration: underline; }
.msg-to svg { width: 12px; height: 12px; flex: none; transition: transform .15s; }
.msg-to[aria-expanded="true"] svg { transform: rotate(180deg); }
.msg-addrs { margin: 0 18px 10px 68px; max-width: 640px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; display: grid; gap: 4px; }
.msg-addrs[hidden] { display: none; }
.msg-addr-row { display: flex; gap: 8px; min-width: 0; }
.msg-addr-label { flex: none; width: 56px; color: var(--muted); }
.msg-addr-list { display: flex; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
.msg-addr { padding: 0; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; text-align: left; overflow-wrap: anywhere; user-select: text; }
.msg-addr:hover .msg-addr-email, .msg-addr:focus-visible .msg-addr-email { text-decoration: underline; }
.msg-addr-email { color: var(--muted); }
.msg-snippet { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-side { display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.msg-side .date { margin-right: 6px; }
.msg.open .msg-head { row-gap: 2px; }
.msg-open-date { grid-column: 2 / -1; min-width: 0; text-align: end; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.msg-body { padding: 4px 18px 18px 68px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.7; color: var(--ink); }
.msg-text a, .msg-html-note a { color: var(--accent); }
.quote-toggle { margin-top: 8px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.quote-toggle:hover { background: var(--hover); }
.msg-quote { white-space: pre-wrap; color: var(--muted); border-left: 2px solid var(--line); padding-left: 12px; margin-top: 8px; font-size: 13.5px; }
.msg-frame { width: 100%; border: 0; display: block; min-height: 40px; background: #fff; border-radius: 6px; color-scheme: light; }
.msg-frame.invert { filter: invert(1) hue-rotate(180deg); background: #ededed; }
.notice { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--soft); border-radius: 8px; padding: 7px 10px; margin-bottom: 10px; }
.notice svg { width: 15px; height: 15px; }
.notice .text-btn { padding: 2px 6px; margin-left: auto; }
.att-all { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.att-all-btn { display: inline-flex; align-items: center; gap: 6px; }
.att-all-btn svg { width: 15px; height: 15px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
/* File-type label on attachment chips (PDF, DOC, XLS…) */
.ftype { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 28px; height: 16px; padding: 0 4px; border-radius: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; line-height: 1; color: #fff; background: #7a7a73; }
.ft-pdf { background: #d0362b; }
.ft-word { background: #2b5fb4; }
.ft-sheet { background: #1f7a45; }
.ft-slides { background: #c8551e; }
.ft-text { background: #6b6b65; }
.ft-image { background: #7a4fb0; }
.ft-archive { background: #a3741a; }
.ft-mail { background: #1f6f8b; }
.ft-signed { background: #2f7f7a; }
.ft-audio, .ft-video { background: #8a3e6e; }
.att { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font-size: 13px; max-width: 280px; background: var(--panel); }
.att:hover { background: var(--hover); }
.att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .sz { color: var(--muted); font-size: 12px; white-space: nowrap; }
.att svg { width: 15px; height: 15px; color: var(--muted); }
.reply-bar { display: flex; gap: 8px; margin: 4px 0 16px; flex-wrap: wrap; align-items: center; }
.reply-bar .btn { height: 40px; border-radius: 20px; }
.reply-prompt { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); background: var(--panel); text-align: left; }
.reply-prompt:hover { border-color: var(--faint); color: var(--ink-2); }
.reply-slot:empty { display: none; }
.reply-slot { margin: 4px 0 16px; }
.collapsed-group { display: block; width: 100%; text-align: center; color: var(--muted); font-size: 12.5px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 12px; }
.collapsed-group:hover { background: var(--hover); }

/* Composer */
.composer-dock { position: fixed; right: 24px; bottom: 0; z-index: 30; display: flex; align-items: flex-end; gap: 12px; pointer-events: none; }
.composer { pointer-events: auto; width: 560px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 90px)); background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.composer.min { height: auto; width: 300px; }
.composer.min .c-body, .composer.min .c-foot, .composer.min .c-fields, .composer.min .c-toolbar, .composer.min .c-atts { display: none; }
.composer.max { position: fixed; inset: 5vh 8vw; width: auto; height: auto; max-width: none; border-radius: 12px; border-bottom: 1px solid var(--line); }
.c-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 16px; background: var(--header); border-bottom: 1px solid var(--line-soft); cursor: pointer; min-height: 44px; }
.c-title { flex: 1; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-status { color: var(--muted); font-size: 12px; margin-right: 6px; white-space: nowrap; }
.c-fields { border-bottom: 1px solid var(--line-soft); }
.c-field { display: flex; align-items: flex-start; gap: 8px; padding: 4px 12px 4px 16px; border-bottom: 1px solid var(--line-soft); min-height: 40px; }
.c-field:last-child { border-bottom: 0; }
.c-field > label { color: var(--muted); font-size: 13px; width: 52px; flex-shrink: 0; padding-top: 8px; }
.c-field select, .c-field .subject { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; height: 32px; font-size: 14px; }
.c-field .cc-toggle { font-size: 12.5px; color: var(--muted); padding: 8px 6px; }
.c-field .cc-toggle:hover { color: var(--ink); }
.recips { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 32px; position: relative; min-width: 0; padding: 3px 0; }
.recips input { flex: 1; min-width: 120px; border: 0; outline: none; background: transparent; height: 26px; font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; max-width: 100%; }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill button { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.pill button:hover { background: var(--active); }
.pill svg { width: 12px; height: 12px; }
.suggest { position: absolute; left: 0; top: 100%; z-index: 5; min-width: 280px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; max-height: 320px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.suggest button { display: grid; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px; }
.suggest button.active, .suggest button:hover { background: var(--hover); }
.suggest .s-name { font-size: 13.5px; }
.suggest .s-mail { font-size: 12px; color: var(--muted); }
.suggest button { position: relative; }
.suggest .s-hide { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 15px; line-height: 1; color: var(--muted); opacity: 0; cursor: pointer; }
.suggest button:hover .s-hide, .suggest button.active .s-hide, .suggest .s-hide:focus-visible { opacity: .8; }
.suggest .s-hide:hover { background: var(--border, rgba(0,0,0,.08)); color: var(--text, inherit); opacity: 1; }
@media (hover: none) { .suggest .s-hide { opacity: .6; } }
.c-toolbar { display: flex; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.c-toolbar .icon-btn { width: 30px; height: 30px; }
.c-toolbar svg { width: 16px; height: 16px; }
.c-body { flex: 1; min-height: 80px; overflow-y: auto; padding: 14px 16px; outline: none; font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.c-body:empty::before { content: attr(data-placeholder); color: var(--faint); }
.c-body blockquote { margin: 8px 0; padding-left: 12px; border-left: 2px solid var(--line); color: var(--muted); }
.c-body a { color: var(--accent); }
.c-body img { max-width: 100%; height: auto; }
.c-body .sig { color: var(--ink-2); }
.c-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line-soft); }
.c-atts:empty { display: none; }
.c-atts .att { padding: 4px 4px 4px 10px; }
.c-atts .att.uploading { opacity: .6; }
.att-mode { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font: inherit; font-size: 11.5px; color: var(--muted, inherit); cursor: pointer; white-space: nowrap; }
.att-mode.on { border-color: var(--accent); color: var(--accent); }
.att-open-c { display: inline-flex; align-items: center; gap: 8px; min-width: 0; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.att-open-c .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .att-open-c:hover .nm { text-decoration: underline; } }
.att-open-c:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.c-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.c-foot .spacer { flex: 1; }
.composer.dragover::after { content: "Drop files to attach"; position: absolute; inset: 44px 0 0; display: grid; place-items: center; background: color-mix(in srgb, var(--panel) 85%, transparent); border: 2px dashed var(--accent); font-weight: 600; }
.composer { position: relative; }

/* Toast, modal, menus */
.toast-region { position: fixed; left: 24px; bottom: 24px; z-index: 60; }
.toast { display: flex; align-items: center; gap: 12px; background: #252525; color: #f3f3ee; border-radius: 10px; padding: 10px 8px 10px 16px; box-shadow: var(--shadow); max-width: min(460px, calc(100vw - 32px)); font-size: 13.5px; }
:root[data-theme="dark"] .toast { background: #ecece6; color: #161615; }
.toast-action { font-weight: 700; color: #8fb6ff; padding: 4px 8px; border-radius: 6px; }
:root[data-theme="dark"] .toast-action { color: #2f6fdf; }
.toast .icon-btn { color: inherit; }
.toast .icon-btn:hover { background: rgba(255,255,255,.12); }
.move-pop { position: fixed; width: 260px; max-height: 360px; display: flex; flex-direction: column; }
.move-filter { border: 0; border-bottom: 1px solid var(--line-soft); outline: none; padding: 9px 10px; background: transparent; }
.move-list { overflow-y: auto; padding-top: 4px; }
.modal-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(15, 15, 12, .38); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; padding: 16px 16px 8px 22px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 650; }
.modal-body { padding: 8px 22px 16px; }
.modal-body p { margin: 0 0 12px; color: var(--ink-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 22px 20px; }
.modal-foot:empty { display: none; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-weight: 550; font-size: 13px; }
.field small { color: var(--muted); font-size: 12px; }
.field input[type="text"], .field input[type="email"], .field input[type="date"], .field select, .files-save-modal .field { grid-template-columns: minmax(0, 1fr); }
.files-save-modal .field :is(input, select) { width: 100%; min-width: 0; max-width: 100%; }
.files-save-modal .field select { text-overflow: ellipsis; }
.field textarea { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); outline: none; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.toggle-row:first-child { border-top: 0; }
.toggle-row span small { display: block; color: var(--muted); font-size: 12px; }
.junk-check:empty { display: none; }
.junk-check { padding: 0 0 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.junk-check p { margin: 0; flex: 1 1 260px; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { padding: 5px 11px; border-radius: 7px; font-size: 13px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--active); color: var(--ink); font-weight: 600; }
.keys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 28px; }
.keys div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.keys kbd { white-space: nowrap; }
.keys h3 { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 12px 0 2px; }

.mobile-only { display: none !important; }
.scrim { position: fixed; inset: 0; background: rgba(15, 15, 12, .35); z-index: 19; }
.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow); place-items: center; z-index: 15; }

/* Medium screens: reading pane takes over the list area */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 220px minmax(300px, 360px) 1fr; }
  .brand { width: auto; }
  .reader-flow { padding: 22px 26px 50px; }
  .msg-body { padding-left: 18px; } .msg-addrs { margin-left: 18px; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: 220px 1fr; }
  .reader-pane { display: none; }
  .app.reading .list-pane { display: none; }
  .app.reading .reader-pane { display: block; }
  .reader-pane { grid-column: 2; }
}
@media (max-width: 760px) {
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  .topbar { height: 56px; gap: 8px; padding: 0 8px; }
  .brand { display: none; }
  .topbar > * { min-width: 0; }
  .search { height: 38px; }
  .top-actions { gap: 0; }
  .top-actions #refresh-btn { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; left: 0; top: 0; bottom: 0; width: min(300px, 84vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); padding-top: calc(18px + env(safe-area-inset-top)); }
  .sidebar.open { transform: none; }
  .sidebar .compose-btn { display: none; }
  .reader-pane, .app.reading .reader-pane { grid-column: 1; }
  .list-head { padding: 14px 12px 10px; }
  .row { padding-left: 12px; padding-right: 12px; }
  .row-actions { display: none !important; }
  .reader-toolbar { padding: 6px 8px; min-height: 52px; }
  .reader-flow { padding: 18px 16px 90px; }
  .reader-subject { font-size: 20px; }
  .msg-head { padding: 12px; gap: 10px; }
  .msg-body { padding: 0 12px 14px; } .msg-addrs { margin: 0 12px 10px; }
  .composer-dock { right: 0; left: 0; bottom: 0; top: 0; pointer-events: none; }
  .composer, .composer.max { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; border: 0; }
  .composer.min { inset: auto 0 0 0; height: auto; width: 100%; }
  .toast-region { left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .keys { grid-template-columns: 1fr; }
  .app.reading .fab { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .topbar, .sidebar, .list-pane, .reader-toolbar, .reply-bar, .composer-dock, .fab, .toast-region { display: none !important; }
  .workspace { display: block; } .reader-pane { overflow: visible; } body { overflow: visible; }
}

.printed-mail { display: none; }
@media print {
  body.printing-mail > :not(.printed-mail) { display: none !important; }
  body.printing-mail { margin: 0; background: #fff; color: #111; }
  .printed-mail { display: block; color: #111; font: 11pt/1.45 system-ui, sans-serif; }
  .printed-mail h1 { font-size: 17pt; margin: 0 0 10pt; }
  .printed-mail pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin-top: 14pt; }
}

/* ---- conversations in the list ---- */
.row.expanded { background: var(--hover); }
.subrows { border-bottom: 1px solid var(--line-soft); background: var(--soft); padding: 2px 0 6px; }
.subrow { display: grid; grid-template-columns: auto minmax(70px, 30%) 1fr auto; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 7px 16px 7px 14px; font-size: 12.5px; color: var(--ink-2); }
.subrow:hover { background: var(--hover); }
.subrow.selected { background: var(--active); box-shadow: inset 3px 0 0 var(--ink); }
.subrow.unread .sr-from { font-weight: 700; color: var(--ink); }
.sr-from, .sr-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-preview { color: var(--muted); }
.sr-date { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
#threads-toggle[aria-pressed="true"] { color: var(--ink); background: var(--active); }
mark { background: #ffe58f; color: inherit; border-radius: 2px; padding: 0 1px; }
:root[data-theme="dark"] mark { background: #6b5a14; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] mark { background: #6b5a14; } }
.tag.accent { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); }

/* ---- labels ---- */
.label-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: color-mix(in srgb, var(--lc) 16%, var(--panel)); color: var(--ink-2); white-space: nowrap; max-width: 160px; }
.lc-dot, .label-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lc); flex-shrink: 0; }
.label-dot { width: 10px; height: 10px; margin: 0 4px; }
.lc-name { overflow: hidden; text-overflow: ellipsis; }
.lc-x { display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; color: var(--muted); }
.lc-x:hover { background: var(--active); color: var(--ink); }
.lc-x svg { width: 10px; height: 10px; }
.reader-tags .tag.add-label { display: inline-flex; align-items: center; gap: 3px; border: 1px dashed var(--line); background: transparent; cursor: pointer; }
.reader-tags .tag.add-label svg { width: 11px; height: 11px; }
.reader-tags .label-chip { font-size: 12px; padding: 2px 8px; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 14px 6px 4px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav-empty { padding: 4px 12px 8px; font-size: 12px; color: var(--faint); }
.contacts-link { margin-top: 2px; }

/* ---- menus & pickers ---- */
.pop-heading { padding: 8px 12px 4px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.pop-item .pi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item .pi-sub { color: var(--muted); font-size: 12px; margin-left: 12px; white-space: nowrap; }
.pop-item:disabled { opacity: .55; }
.pop-item.create { color: var(--accent); }
.pop-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.pi-check { width: 16px; height: 16px; border: 1.5px solid var(--faint); border-radius: 4px; display: grid; place-items: center; flex-shrink: 0; }
.pi-check svg { width: 12px; height: 12px; opacity: 0; }
.pi-check.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pi-check.on svg { opacity: 1; }
.snooze-menu { min-width: 260px; }

/* ---- reader extras ---- */
.msg.focused { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.msg-name { font-weight: 620; color: var(--ink); padding: 0; }
button.msg-name:hover { text-decoration: underline; }
.msg-from { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; white-space: normal; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; border-radius: 5px; padding: 1px 6px; }
.badge svg { width: 14px; height: 14px; }
.badge.ok { color: var(--ok); padding: 0; }
.badge.bad { color: var(--danger); background: var(--danger-soft); }
.badge.ext { color: var(--muted); background: var(--soft); font-weight: 500; }
.badge.snoozed { color: var(--accent); background: var(--soft); font-weight: 500; gap: 4px; }
.badge.snoozed svg { width: 12px; height: 12px; }
.safety { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 13px; line-height: 1.5; }
.safety.danger { background: var(--danger-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.safety.danger > svg { color: var(--danger); width: 20px; height: 20px; margin-top: 1px; }
.safety strong { display: block; color: var(--danger); margin-bottom: 2px; }
.safety .hint { color: var(--muted); margin-top: 4px; font-size: 12.5px; }
.msg-text a.phone-link, .msg-text a.mail-link { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.att.risk-high { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); background: var(--danger-soft); }
.att.risk-high > svg:first-child { color: var(--danger); }
.att .tag { font-size: 10.5px; }

/* ---- invites ---- */
.invite { display: flex; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: var(--panel); }
.invite.loading { color: var(--muted); align-items: center; gap: 8px; font-size: 13px; }
.invite.cancelled .inv-title { text-decoration: line-through; color: var(--muted); }
.inv-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); flex-shrink: 0; }
.inv-icon svg { width: 22px; height: 22px; }
.inv-main { min-width: 0; flex: 1; display: grid; gap: 3px; }
.inv-title { font-weight: 650; font-size: 15px; }
.inv-when { color: var(--ink-2); font-size: 13.5px; }
.inv-where, .inv-who { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.inv-where a { color: var(--accent); }
.inv-status { font-size: 13px; font-weight: 600; color: var(--ok); min-height: 0; }
.inv-status:empty { display: none; }
.inv-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.inv-q { font-size: 13px; color: var(--muted); margin-right: 4px; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.small.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ---- inline (chat-style) reply composer ---- */
.composer.inline { position: static; width: 100%; max-width: none; height: auto; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 14px rgba(0,0,0,.06); }
.composer.inline .c-head { display: none; }
.composer:not(.inline) .c-replyto, .composer:not(.inline) .c-summary { display: none; }
.composer.inline:not(.expanded) .c-fields { display: none; }
.composer.inline.expanded .c-summary { display: none; }
.composer.inline .c-body { min-height: 110px; max-height: 50vh; flex: none; }
.c-replyto { display: flex; align-items: flex-start; gap: 4px; margin: 10px 10px 0; padding: 8px 6px 8px 12px; border-radius: 10px; background: var(--soft); border-left: 3px solid var(--accent); }
.rt-main { flex: 1; min-width: 0; }
.rt-who { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--accent); }
.rt-who svg { width: 14px; height: 14px; }
.rt-snip { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.c-replyto .icon-btn { width: 30px; height: 30px; }
.c-summary { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 16px 2px; font-size: 13px; color: var(--muted); }
.c-summary .cs-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.c-summary .cs-edit { color: var(--accent); font-size: 12.5px; flex-shrink: 0; }
.c-summary:hover .cs-edit { text-decoration: underline; }
.c-toolbar .tb-sep { width: 1px; height: 18px; background: var(--line); margin: 6px 4px; }
.composer > .quote-toggle { align-self: flex-start; margin: 0 16px 8px; }
.send-group { display: inline-flex; }
.send-group .btn.primary { border-radius: var(--radius) 0 0 var(--radius); }
.send-group .send-more { width: 32px; height: 38px; border-radius: 0 var(--radius) var(--radius) 0; background: var(--primary); color: var(--on-primary); border-left: 1px solid color-mix(in srgb, var(--on-primary) 25%, transparent); }
.send-group .send-more:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); opacity: .9; }
.c-foot .c-status { font-size: 12px; color: var(--muted); margin-left: 4px; }

/* ---- search suggestions ---- */
.search-suggest { left: 0; right: 0; top: calc(100% + 4px); max-width: none; min-width: 0; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px; }
.sg-heading { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px 4px; }
.sg-item, .suggest button.sg-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; }
.sg-item svg { width: 16px; height: 16px; color: var(--muted); }
.sg-item.active, .sg-item:hover { background: var(--hover); }
.sg-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }

/* ---- banner ---- */
.app-banner { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: var(--warn-soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.app-banner svg { color: var(--flag); }
.app-banner span { flex: 1; }
.offline-banner { background: var(--soft); }
.offline-banner svg { color: var(--muted); }

/* ---- installed app (PWA) ---- */
@media (display-mode: standalone) {
  .topbar { height: auto; min-height: 64px; padding-top: env(safe-area-inset-top); }
  .workspace { padding-bottom: env(safe-area-inset-bottom); }
  /* No browser chrome to drag: let the header move the window where the platform allows it. */
  .topbar { -webkit-app-region: drag; app-region: drag; }
  .topbar button, .topbar input, .topbar [role="button"], .topbar .popover { -webkit-app-region: no-drag; app-region: no-drag; }
}
@media (display-mode: window-controls-overlay) {
  .topbar { padding-left: env(titlebar-area-x, 0); padding-right: calc(100% - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100%)); min-height: env(titlebar-area-height, 48px); }
}
ol.steps { margin: 4px 0 12px 18px; padding: 0; line-height: 1.6; }
ol.steps li + li { margin-top: 6px; }

/* ---- settings, contacts ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); margin: -4px 0 14px; overflow-x: auto; }
.tabs button { padding: 9px 12px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.settings-modal .tabs { flex-wrap: wrap; overflow-x: visible; } /* every tab stays visible (“Shared files” was cut off) */
.settings-panel { min-height: 300px; }
.ai-conn-url { display: flex; gap: 8px; align-items: center; }
.ai-conn-url code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--header); font-size: 13px; }
.ai-conn-list { border: 1px solid var(--line); border-radius: var(--radius); }
.ai-conn-list > p { margin: 0; padding: 12px; }
.ai-conn-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.ai-conn-row:first-child { border-top: 0; }
.ai-conn-avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; background: var(--soft); border: 1px solid var(--line); flex: none; }
.ai-conn-text { display: grid; gap: 2px; min-width: 0; }
.ai-conn-text small { color: var(--muted); font-size: 12px; }
.settings-modal .modal-body, .contacts-modal .modal-body { padding-bottom: 22px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field input[type="datetime-local"], .field input[type="password"], .field input[type="search"] { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); outline: none; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.form-actions > .btn { max-width: 100%; }
.two-step-note { margin-top: 14px; }
/* A row of choices (e.g. how to turn on two-step sign-in) stacks full width on a phone, first choice on top. */
@media (max-width: 640px) { .form-actions.choices { flex-direction: column; align-items: stretch; } .form-actions.choices > .btn { width: 100%; justify-content: center; text-align: center; } }
.form-message { min-height: 0; margin: 4px 0; }
.form-message.ok { color: var(--ok); }
.sig-preview { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); min-height: 44px; }
.panel-h { font-size: 14px; margin: 18px 0 10px; }
.account-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--soft); }
.rule-list { display: grid; gap: 6px; margin: 8px 0; }
.rule { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.rule-main { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 13px; }
.rule-main .muted { overflow: hidden; text-overflow: ellipsis; }
.conds { display: grid; gap: 6px; margin: 6px 0; }
.cond { display: flex; gap: 6px; align-items: center; }
.cond select, .cond input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); }
.cond input { flex: 1; min-width: 0; }
.field > span select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--panel); font-weight: 400; }
.act { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13.5px; }
.act select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--panel); }
.rule-label-pick, .rule-new-label { display: inline-flex; align-items: center; gap: 6px; }
.rule-new-label[hidden] { display: none; }
.rule-new-label input { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--panel); color: inherit; min-width: 160px; }
.contacts-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.contacts-bar input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); outline: none; }
.contact-list { max-height: 55vh; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
.contact { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.contact:last-child { border-bottom: 0; }
.ct-main { flex: 1; min-width: 0; display: grid; text-align: left; }
.ct-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
  .reply-bar .btn .lbl { display: none; }
  .reply-bar .btn { width: 40px; padding: 0; }
  .subrow { padding-left: 10px; grid-template-columns: auto minmax(60px, 35%) 1fr auto; }
  .composer.inline { border-radius: 12px; }
  .search-suggest { position: fixed; left: 8px; right: 8px; top: 52px; }
  .app-banner { padding: 8px 12px; }
}
@media print { .reply-slot, .app-banner { display: none !important; } }

.features { display: grid; border: 1px solid var(--line-soft); border-radius: 10px; }
.feat-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; min-width: 0; overflow-wrap: anywhere; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.feat-row:last-child { border-bottom: 0; }
.feat { text-align: right; }
.feat.on { color: var(--ok); }
.feat.off { color: var(--muted); }

.rt-mode { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; align-self: center; }
.rt-mode:hover { border-color: var(--faint); color: var(--ink); }
.rt-mode svg { width: 14px; height: 14px; }
@media (max-width: 760px) { .rt-mode span { display: none; } .rt-mode { padding: 0 7px; } }

/* ---- v3: message view switch, source, delete chooser ---- */
.view-note { display: flex; align-items: center; gap: 8px; margin: -2px 0 10px; font-size: 12.5px; color: var(--muted); }
.view-seg { padding: 1px; border-radius: 8px; }
.view-seg button { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.msg-html .notice .text-btn { margin-left: auto; white-space: nowrap; }
.source-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.source-tools { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); background: var(--soft); }
.source-tools .muted { margin-right: auto; }
.msg-source { margin: 0; padding: 12px; max-height: 70vh; overflow: auto; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); color: var(--ink); }
.modal .source-wrap .msg-source { max-height: 62vh; }
.switch-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.hint { color: var(--muted); font-size: 13px; }
.pick-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pick-tools .hint { margin-left: auto; }
.pick-list { border: 1px solid var(--line); border-radius: 10px; max-height: 50vh; overflow-y: auto; }
.pick-list + .field { margin-top: 14px; }
.act.rep-unsub { margin-top: 10px; align-items: flex-start; }
.act.rep-unsub input { margin-top: 3px; }
/* The "Make a rule?" preview: a shorter list so the choices and buttons stay in view; buttons wrap on a phone. */
.modal.rep-rule .pick-list { max-height: 30vh; }
.modal.rep-rule .modal-foot { flex-wrap: wrap; }
.pick-row { display: grid; grid-template-columns: auto minmax(70px, 28%) 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; font-size: 13px; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--hover); }
.pr-from, .pr-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-from { font-weight: 600; color: var(--ink); }
.pr-preview { color: var(--muted); }
.pr-date { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---- v3: search ---- */
.search-mode { display: inline-flex; flex-shrink: 0; border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; background: var(--panel); }
.search-mode button { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.search-mode button svg { width: 13px; height: 13px; }
.search-mode button:hover { color: var(--ink); }
.search-mode button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.adv-search { right: 0; top: calc(100% + 4px); width: min(560px, calc(100vw - 24px)); padding: 0; }
.adv-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 16px; }
.adv-form { display: grid; gap: 8px; padding: 4px 16px 14px; }
.adv-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.adv-row input[type=text], .adv-row select, .adv-date select { height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--panel); color: var(--ink); min-width: 0; width: 100%; }
.adv-date { display: grid; gap: 6px; }
.adv-range { display: flex; align-items: center; gap: 6px; }
.adv-range[hidden] { display: none; }
.adv-range input { height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--panel); color: var(--ink); min-width: 0; flex: 1; }
.adv-checks { display: flex; flex-wrap: wrap; gap: 16px; padding-left: 130px; font-size: 13px; }
.adv-check { display: inline-flex; align-items: center; gap: 6px; }
.adv-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.adv-foot .muted { margin-right: auto; }
.search-interp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.search-interp[hidden] { display: none; }
.q-via { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }
.q-via svg { width: 14px; height: 14px; }
.q-via.ai { color: var(--accent); }
.q-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 3px 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--soft); color: var(--ink-2); max-width: 100%; }
.q-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-chip.exact { border-style: dashed; }
.q-x { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--muted); }
.q-x:hover { background: var(--hover); color: var(--ink); }
.q-x svg { width: 11px; height: 11px; }
.text-btn.small { font-size: 12.5px; }

/* ---- v3: mail brief ---- */
.reader-empty.has-brief { display: block; place-content: initial; text-align: left; color: var(--ink); padding: 0; height: auto; }
.brief-idle { display: grid; justify-items: center; text-align: center; color: var(--muted); }
.reader-empty.has-brief .brief { max-width: 760px; margin: 0 auto; padding: 28px 32px 48px; }
.brief-head { display: flex; align-items: flex-start; gap: 10px; }
.bh-text { flex: 1; min-width: 0; }
.brief-head h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.4px; color: var(--ink); }
.brief-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.brief-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; }
.bstat { padding: 6px 12px; border-radius: 999px; background: var(--soft); font-size: 13px; color: var(--ink-2); }
.bstat b { color: var(--ink); }
.bstat.zero { color: var(--muted); }
.bstat.zero b { color: var(--muted); }
.brief-ai { margin: 14px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--accent) 5%, var(--panel)); }
.brief-ai p { margin: 4px 0 0; font-size: 14px; line-height: 1.55; }
.ba-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .4px; }
.ba-label svg { width: 14px; height: 14px; }
.brief-sec { margin-top: 22px; }
.brief-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.bs-count { font-size: 12px; font-weight: 650; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 1px 8px; }
.bs-hint { margin: 2px 0 8px; color: var(--muted); font-size: 12.5px; }
.bs-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.brief-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 6px; }
.brief-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.brief-item:last-child { border-bottom: 0; }
.brief-item:hover { background: var(--hover); }
.brief-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.bi-main { min-width: 0; display: grid; gap: 1px; }
.bi-top { display: flex; gap: 8px; align-items: baseline; }
.bi-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--ink-2); }
.brief-item.unread .bi-from, .brief-item.unread .bi-subject { font-weight: 680; color: var(--ink); }
.bi-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.bi-subject { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bi-why { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.bi-why span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-ai svg { width: 12px; height: 12px; color: var(--accent); }
.bi-acts { display: flex; gap: 2px; align-items: center; opacity: .75; }
.brief-item:hover .bi-acts, .brief-item:focus-within .bi-acts { opacity: 1; }
.brief-clear { margin: 30px 0 10px; text-align: center; color: var(--muted); }
.brief-clear svg { width: 34px; height: 34px; color: var(--ok); }
.brief-clear h3 { margin: 8px 0 2px; color: var(--ink); font-size: 16px; }
.brief-clear p { margin: 0; }
.brief-foot { margin-top: 26px; color: var(--muted); font-size: 12px; }
.brief-sec.resolved { display: grid; gap: 8px; }
.brief-resolved { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--soft); font-size: 13px; line-height: 1.5; }
.br-mark { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 10px; background: var(--ok); color: #fff; flex-shrink: 0; }
.br-mark svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.5; }
.br-text { flex: 1; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.br-text b { color: var(--ink); font-weight: 650; }
.br-acts { display: flex; gap: 10px; flex-shrink: 0; }
.br-acts .text-btn { font-size: 12.5px; font-weight: 600; }
@media (max-width: 760px) { .brief-resolved { flex-wrap: wrap; } .br-acts { width: 100%; justify-content: flex-end; } }
.brief-loading { padding: 32px; }
@media (max-width: 960px) {
  .app.briefing .list-pane { display: none; }
  .app.briefing .reader-pane { display: block; }
}
@media (max-width: 760px) {
  .search-mode { display: none; }
  .reader-empty.has-brief .brief { padding: 16px 14px 40px; }
  .adv-row { grid-template-columns: 1fr; gap: 4px; }
  .adv-checks { padding-left: 0; }
  .adv-search { position: fixed; left: 8px; right: 8px; top: 52px; width: auto; max-height: calc(100vh - 70px); overflow-y: auto; }
  .adv-foot .muted { display: none; }
  .view-seg button { padding: 3px 7px; }
  .pick-row { grid-template-columns: auto 1fr auto; }
  .pr-preview { display: none; }
}

/* ---- tags: editor, groups, legal hold ---- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; background: var(--lc); border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch[aria-checked="true"] { border-color: var(--panel); box-shadow: 0 0 0 2px var(--ink); }
.swatch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.beh { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.beh:first-of-type { border-top: 0; }
.beh input[type=checkbox] { margin-top: 3px; }
.beh > span:first-of-type { display: grid; gap: 1px; flex: 1; min-width: 0; }
.beh small { color: var(--muted); font-size: 12.5px; }
.beh .years { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink-2); font-size: 13px; }
.beh .years input { width: 64px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--panel); color: var(--ink); }
.folder .hold-mark { display: inline-grid; color: var(--muted); }
.folder .hold-mark svg { width: 13px; height: 13px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* A field with its button beside it (Connect an account: email + Continue): the button sits level with the box. */
.field-row.with-action { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.field-row.with-action > .btn { margin-bottom: 16px; height: 40px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

/* ---- rules: modes, activity, suggestions ---- */
.mode-chip { margin-left: 8px; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); vertical-align: 1px; }
.mode-chip.ask { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); }
.settings-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
.activity { border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.activity > p { margin: 10px 12px; }
.act-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.act-row:last-child { border-bottom: 0; }
.act-row.undone { opacity: .55; }
.act-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.act-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-suggest { margin: 6px 0 10px; }
.rule-suggest .text-btn { margin-left: 4px; }
.rules-banner { border-top: 1px solid var(--line-soft); }
/* ask your inbox */
.ask-list { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.ask-q { margin: 0 0 6px; font-weight: 600; color: var(--ink); font-size: 14.5px; }
.ask-a { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border: 1px solid var(--line-soft); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.ask-a > svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); width: 16px; height: 16px; }
.ask-a p { margin: 0; white-space: pre-wrap; }
.ask-a.not-found { background: var(--soft); }
.ask-a.muted { color: var(--muted); }
.ask-cites { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.ask-cite { font: inherit; font-size: 12px; text-align: left; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-cite:hover, .ask-cite:focus-visible { border-color: var(--accent); color: var(--ink); }
.ask-cite b { display: inline-grid; place-items: center; min-width: 16px; height: 16px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 10.5px; margin-right: 2px; }
.ask-input { margin-top: 16px; }
.ask-input input { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
/* suggested tags */
.tag-suggest { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 4px 1px 8px; border-radius: 5px; border: 1px dashed color-mix(in srgb, var(--lc) 60%, var(--line)); color: var(--muted); white-space: nowrap; }
.tag-suggest button { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.tag-suggest button:hover, .tag-suggest button:focus-visible { background: var(--soft); color: var(--ink); }
.tag-suggest button svg { width: 12px; height: 12px; }
/* mailboxes (accounts) */
.accounts .folder.account .tag { margin-left: auto; }
.accounts .folder.account .tag + .count { margin-left: 6px; }
.accounts .folder .name { overflow: hidden; text-overflow: ellipsis; }
.all-sec h3 { display: flex; align-items: center; gap: 6px; }
.all-sec h3 .text-btn { margin-left: auto; }
.add-account-result { min-height: 24px; margin: 10px 0; }
.add-account-result .provider { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); }
.add-account-result .provider p { margin: 6px 0 0; }
.add-account-result .provider .btn { margin-top: 10px; }
.add-account-result .error { color: var(--danger, #c0392b); }
/* shared mailboxes */
.shared-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; margin: 10px 0 4px; border: 1px solid var(--line-soft); border-radius: 10px; background: color-mix(in srgb, var(--accent) 5%, var(--panel)); font-size: 13px; }
.shared-bar .sb-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.shared-bar .sb-label svg { width: 16px; height: 16px; }
.shared-bar .sb-assign { display: inline-flex; align-items: center; gap: 6px; }
.shared-bar select { font: inherit; padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); max-width: 240px; }
.shared-bar .sb-rights { margin-left: auto; }
.status-seg button { padding: 3px 10px; }
.tag.assignee { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); }
.tag.status-done { background: color-mix(in srgb, #2e9d5b 16%, var(--panel)); color: #2e7d4f; }
.tag.status-waiting { background: color-mix(in srgb, #d98e04 18%, var(--panel)); color: #9a6500; }
.shared-notes { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.note-card { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #f2c94c 22%, var(--panel)); border: 1px solid color-mix(in srgb, #f2c94c 50%, var(--line)); font-size: 13.5px; }
.note-card .note-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.note-card .note-head svg { width: 14px; height: 14px; }
.note-card p { margin: 6px 0 0; white-space: pre-wrap; color: var(--ink-2); }
.note-form textarea { width: 100%; box-sizing: border-box; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
.note-form .note-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* conversations / messages switch in the list header */
.view-toggle { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.view-toggle svg { width: 15px; height: 15px; }
.view-toggle:hover { border-color: var(--faint); color: var(--ink); }
.view-toggle[aria-pressed="true"] { background: var(--active); color: var(--ink); }
@media (max-width: 520px) { .view-toggle .vt-label { display: none; } .view-toggle { padding: 0 7px; } }

/* labels on each message of an expanded conversation */
.subrow .sr-tags { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin-top: -2px; }

/* message checkboxes in an expanded conversation */
.subrow { cursor: pointer; }
.subrow .sr-check { width: 18px; }
.subrow .sr-date { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.subrow .sr-clip { display: inline-flex; color: var(--ink-3, var(--ink-2)); }
.subrow .sr-clip svg { width: 13px; height: 13px; }
.subrow.checked { background: var(--active); }
.subrow .sr-tags { grid-column: 3 / -1; }
/* tag group: sub-tags included or only this tag */
.subtags-chip { margin-left: auto; }
.subtags-chip[aria-pressed="false"] { border-style: dashed; }
.hint.inherited { margin: 0 0 6px; }

/* contact suggestions in search options (From / To) */
.adv-row { position: relative; --ps-left: 130px; }
@media (max-width: 960px) { .adv-row { --ps-left: 0px; } }
.people-suggest { position: absolute; z-index: 30; left: var(--ps-left, 130px); right: 0; top: 100%; margin-top: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; max-height: 240px; overflow: auto; }
.people-suggest .ps-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 6px 10px; border-radius: 7px; text-align: left; font: inherit; background: none; border: 0; color: var(--ink); cursor: pointer; }
.people-suggest .ps-item:hover, .people-suggest .ps-item.active { background: var(--hover); }
.people-suggest .ps-name { font-size: 13.5px; font-weight: 600; }
.people-suggest .ps-mail { font-size: 12px; color: var(--muted); }

/* Devices: mail-app setup, phone code, signed-in browsers */
.setup-steps { margin: 8px 0 4px; padding-left: 20px; display: grid; gap: 6px; }
.setup-qr { display: flex; gap: 16px; align-items: center; margin: 16px 0 8px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 12px; }
.setup-qr img { width: 160px; height: 160px; flex: none; border-radius: 8px; background: #fff; }
.setup-qr p { margin: 4px 0 0; }
.setup-details { margin: 12px 0; }
.setup-details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.setup-manual .form-actions { margin-top: 8px; }
.copy-val, .copy-inline { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 0; text-align: right; }
.copy-val svg, .copy-inline svg { width: 14px; height: 14px; opacity: .6; }
.copy-val:hover svg, .copy-inline:hover svg { opacity: 1; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 14px; }
@media (max-width: 640px) { .setup-qr { flex-direction: column; text-align: center; } }

/* Extra addresses */
.aliases .alias-row span { word-break: break-all; }
.alias-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.alias-input { display: flex; align-items: center; flex: 1 1 260px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); }
.alias-input input { flex: 1; min-width: 0; border: 0; background: none; padding: 9px 0; font: inherit; color: inherit; outline: none; }
.alias-input:focus-within { outline: 2px solid var(--focus, currentColor); outline-offset: 1px; }
.alias-input select { border: 0; background: none; font: inherit; color: inherit; }
.alias-domain { color: var(--muted, inherit); opacity: .8; }
.alias-status { min-height: 20px; font-size: 13px; margin-top: 6px; }
.alias-status.ok { color: var(--ok, #1d7a3e); }
.alias-status.bad { color: var(--danger, #b3261e); }
.alias-confirm { display: inline-flex; gap: 8px; align-items: center; }

/* Images loading in a message */
.img-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 4px 2px 8px; }
.img-status svg { width: 14px; height: 14px; }
.img-status .spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: img-spin .8s linear infinite; }
@keyframes img-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .img-status .spinner { animation: none; } }

/* Attachments: preview or download straight away */
.att { padding: 3px 3px 3px 10px; }
.att .att-main { display: inline-flex; align-items: center; gap: 8px; min-width: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 4px 0; text-align: left; }
.att .att-main:hover .nm { text-decoration: underline; }
.att .att-hint { font-size: 11px; color: var(--accent); white-space: nowrap; }
.att .att-dl { flex: none; }
.preview-modal .modal-body { padding: 0; }
.preview-modal .modal-head h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-modal .modal-head > button { flex-shrink: 0; }
.preview-modal .att-expand[aria-pressed="true"] { background: var(--soft); color: var(--accent); }
.preview-modal:has(.kind-pdf) { max-width: 1120px; height: min(88dvh, calc(100dvh - 32px)); }
.preview-modal:has(.kind-pdf), .preview-modal.is-expanded { display: flex; flex-direction: column; overflow: hidden; }
.preview-modal.is-expanded { position: absolute; inset: 0; max-width: none; max-height: none; height: 100%; border: 0; border-radius: 0; }
.preview-modal :is(.modal-head, .modal-foot, .att-nav, .zip-inner-bar) { flex-shrink: 0; }
.preview-modal:has(.kind-pdf) :is(.modal-body, .att-preview-cycle, .att-preview-slot, .att-preview-wrap, .zip-view, .kind-pdf) {
  display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; min-width: 0; max-height: none;
}
.preview-modal:has(.kind-pdf) .kind-pdf { position: relative; }
/* Chrome's built-in page sidebar is a fixed width. This panel sizes to the thumbnails instead. */
.att-pdf-viewer { display: flex; align-self: stretch; flex: 1 1 0; min-width: 0; min-height: 0; }
.preview-modal .att-pdf-viewer iframe { flex: 1 1 0; min-width: 0; min-height: 0; height: auto; }
.att-pdf-rail {
  box-sizing: border-box; flex: 0 0 min(var(--att-pdf-width, 104px), 40%); min-height: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; padding: 5px; border-inline-end: 1px solid var(--line); background: var(--soft);
}
.att-pdf-rail[hidden], .att-pdf-divider[hidden] { display: none; }
.att-pdf-divider {
  position: relative; flex: 0 0 6px; cursor: col-resize; touch-action: none;
  background: var(--soft); border-inline-end: 1px solid var(--line);
}
.att-pdf-divider::after {
  content: ''; position: absolute; top: calc(50% - 16px); width: 2px; height: 32px;
  inset-inline-start: 1px; border-radius: 2px; background: var(--muted);
}
.att-pdf-divider:hover, .att-pdf-divider:focus-visible, .att-pdf-viewer.is-resizing .att-pdf-divider { background: var(--active); }
.att-pdf-viewer.is-resizing { user-select: none; cursor: col-resize; }
.att-pdf-viewer.is-resizing iframe { pointer-events: none; }
.att-pdf-rail-controls {
  display: flex; justify-content: center; margin-bottom: 4px;
}
.att-pdf-rail-controls .icon-btn { width: 28px; height: 28px; }
.att-pdf-rail-controls .icon-btn svg { width: 15px; height: 15px; }
.att-pdf-rail.is-wide .att-pdf-page canvas { max-height: 220px; }
.att-pdf-page {
  display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; padding: 5px 2px;
  margin: 0 0 4px; border: 1px solid transparent; border-radius: 5px; background: transparent;
  color: var(--muted); font: inherit; font-size: 11px; cursor: pointer;
}
.att-pdf-page:hover, .att-pdf-page[aria-current="page"] { border-color: var(--accent); color: var(--ink); }
.att-pdf-page canvas { display: block; max-width: 100%; max-height: 92px; height: auto; object-fit: contain; background: #fff; }
.att-pdf-page:not(:has(canvas)) { min-height: 90px; justify-content: flex-end; }
@media (max-width: 480px) {
  .att-pdf-rail { flex-basis: min(var(--att-pdf-width, 76px), 40%); padding: 3px; }
  .att-pdf-page canvas { max-height: 72px; }
  .att-pdf-rail.is-wide .att-pdf-page canvas { max-height: 160px; }
}
.preview-modal.is-expanded .modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
@media (max-width: 760px) {
  .preview-modal .modal-head { padding: 8px 8px 6px 12px; }
  .preview-modal .modal-head h2 { font-size: 15px; }
  .preview-modal .modal-foot { padding: 8px 12px; }
}

.att-nav { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.att-nav-count { min-width: 60px; text-align: center; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.zip-view { min-height: 240px; max-height: 76vh; overflow: auto; background: var(--soft); }
.zip-view > .att-preview-loading { justify-content: center; padding: 40px 0; }
.zip-head { margin: 0; padding: 10px 14px 6px; }
.zip-list { display: flex; flex-direction: column; padding: 0 8px 10px; }
.zip-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.zip-row.ok:hover { background: var(--pane); }
.zip-row.no { opacity: .78; }
.zip-row.risky .zip-why { color: var(--danger, #c0392b); }
.zip-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.zip-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zip-why { color: var(--muted); }
.zip-row .sz { flex: none; font-variant-numeric: tabular-nums; }
.zip-inner-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--pane); }
.zip-inner-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; text-align: center; }
.zip-view .att-preview { max-height: 68vh; }
.zip-view .att-preview iframe { height: 68vh; }
.att-preview { display: flex; align-items: center; justify-content: center; min-height: 240px; max-height: 72vh; overflow: auto; background: var(--soft); }
.att-preview img { max-width: 100%; max-height: 72vh; object-fit: contain; }
.att-preview iframe { width: 100%; height: 72vh; border: 0; background: #fff; }
.att-preview video { max-width: 100%; max-height: 72vh; }
.att-preview .att-text { align-self: stretch; width: 100%; margin: 0; padding: 14px 16px; white-space: pre-wrap; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel); }
.att-preview-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.att-preview-loading .spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: img-spin .8s linear infinite; }
.att-preview:has(img, iframe, video, audio, pre) .att-preview-loading { position: absolute; }

/* Calendar (read only): week of day columns; overlaps and free/held time are marked, not hidden. */
/* ---- Calendar page: Mail · Calendar · Tasks rail, time grid, Sandy rail ---- */
:root { --cal-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif; --cal-paper: #fbfaf7; --cal-line: #e6e4de; --cal-ev: #e3e3dc; }
:root[data-theme="dark"] { --cal-paper: #101010; --cal-line: #262626; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cal-paper: #101010; --cal-line: #262626; } }
.app.calendar-open .workspace { display: none; }
.app.calendar-open .search { visibility: hidden; }
.app.calendar-open .fab { display: none !important; }
#calendar-btn[aria-pressed="true"], #tasks-btn[aria-pressed="true"] { background: var(--active); color: var(--ink); }
.calendar-page { position: relative; flex: 1; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 236px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); background: var(--cal-paper); }
.cal-side { background: var(--header); border-right: 1px solid var(--line); padding: 18px 14px 14px; display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow: auto; }
.cal-nav { display: flex; flex-direction: column; gap: 4px; }
.cal-nav-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; text-align: left; font-weight: 550; color: var(--ink-2); }
.cal-nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cal-nav-item:hover:not(:disabled) { background: var(--hover); }
.cal-nav-item.active { background: var(--primary); color: var(--on-primary); }
.cal-nav-item:disabled { color: var(--faint); cursor: default; }
.cal-soon { margin-left: auto; font-size: 10.5px; font-weight: 650; letter-spacing: .3px; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.cal-mini-h { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; font-size: 13.5px; }
.cal-mini-nav { display: inline-flex; gap: 2px; }
.cal-mini-nav .icon-btn.small, .cal-side-h .icon-btn.small { width: 26px; height: 26px; }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-mini-dow { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0 4px; }
.cal-mini-day { position: relative; height: 28px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-mini-day:hover { background: var(--hover); }
.cal-mini-day.other { color: var(--faint); }
.cal-mini-day.in-range { background: var(--soft); }
.cal-mini-day.today { background: var(--primary); color: var(--on-primary); font-weight: 650; }
.cal-mini-day.has-events::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 2px; background: currentColor; opacity: .55; }
.cal-mini-day.today.has-events::after { background: var(--on-primary); }
.cal-side-h { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; font-weight: 600; padding: 0 4px 6px; }
.cal-mycal { display: flex; align-items: center; gap: 10px; padding: 7px 4px; }
.cal-mycal-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.cal-dot { width: 12px; height: 12px; border-radius: 6px; flex-shrink: 0; border: 1px solid rgba(0,0,0,.08); }
.cal-dot.hold { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--muted) 2px 3px) !important; }
.cal-switch { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--line); transition: background .15s; flex-shrink: 0; }
.cal-switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.cal-switch.on { background: var(--primary); }
.cal-switch.on i { left: 18px; }
.cal-side .sidebar-foot { margin-top: auto; white-space: pre-line; }

.cal-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 18px 24px 18px; container-type: inline-size; }
.cal-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cal-title { margin: 0; font-family: var(--cal-serif); font-weight: 500; font-size: 30px; letter-spacing: -.3px; outline: none; }
.cal-head-nav { display: flex; align-items: center; gap: 6px; }
.cal-head-nav .btn.small { height: 34px; padding: 0 14px; }
.cal-arrows { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.cal-arrows .icon-btn { width: 34px; height: 34px; border-radius: 0; }
.cal-arrows .icon-btn + .icon-btn { border-left: 1px solid var(--line); }
.cal-head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.cal-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 2px; }
.cal-seg-btn { height: 30px; padding: 0 14px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--muted); }
.cal-seg-btn.active { background: var(--soft); color: var(--ink); }
.cal-head-right .btn.primary { height: 36px; }
.cal-head-right .btn.primary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.cal-sub { display: flex; align-items: baseline; gap: 14px; margin: 8px 0 12px; font-size: 14.5px; }
.cal-sub-range { color: var(--ink-2); }
.cal-status { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: var(--hover); font-size: 13px; }
.cal-status.incomplete, .cal-status.error { background: var(--warn-soft); }
.cal-status.loading { background: transparent; color: var(--muted); padding-left: 0; }

/* Time grid (day & week) */
.cal-timegrid { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--cal-line); border-radius: 12px; background: var(--panel); overflow: hidden; --gutter: 64px; }
.cal-tg-head, .cal-tg-allday { display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--cal-line); }
.cal-tg-gutter { font-size: 11.5px; color: var(--muted); padding: 8px 8px; text-align: right; }
.cal-tg-day { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 12px 6px; border-left: 1px solid var(--cal-line); font-size: 14px; color: var(--ink-2); }
.cal-tg-day:hover { background: var(--hover); }
.cal-tg-dow { font-size: 13px; }
.cal-tg-num { font-family: var(--cal-serif); font-size: 19px; color: var(--ink); }
.cal-tg-day.today { background: var(--soft); }
.cal-tg-day.today .cal-tg-num { color: var(--accent); }
.cal-tg-allday-cell { border-left: 1px solid var(--cal-line); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-height: 30px; }
.cal-tg-scroll { flex: 1; min-height: 0; overflow: auto; }
.cal-tg-grid { position: relative; display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr)); }
.cal-tg-hours { position: relative; }
.cal-tg-hour { position: absolute; right: 8px; transform: translateY(-50%); }
.cal-tg-hour.first { transform: none; top: 4px !important; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-tg-col { position: relative; border-left: 1px solid var(--cal-line); min-width: 0; }
.cal-tg-col.weekend { background: var(--cal-paper); }
.cal-tg-col.today { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.cal-tg-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--cal-line); }
.cal-tg-line.half { border-top-style: dashed; opacity: .55; }
.cal-tg-line.first { border-top: 0; }
.cal-tg-now { position: absolute; left: 0; right: 0; border-top: 2px solid #d93025; z-index: 2; pointer-events: none; }
.cal-tg-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 5px; background: #d93025; }
.cal-tg-now span { position: absolute; left: 10px; top: -22px; font-size: 11px; font-weight: 600; background: var(--panel); padding: 1px 5px; border-radius: 4px; }

/* Events */
.cal-event { --ev: var(--cal-ev); position: absolute; box-sizing: border-box; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; overflow: hidden; text-align: left; padding: 6px 9px; border-radius: 8px; font-size: 12.5px; line-height: 1.3; background: color-mix(in srgb, var(--ev) 26%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ev) 45%, var(--panel)); border-left: 3px solid var(--ev); color: var(--ink); z-index: 1; }
.cal-event:hover { filter: brightness(.97); }
.cal-event.selected { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 3; }
.cal-event.hold { background: repeating-linear-gradient(135deg, var(--panel) 0 5px, var(--soft) 5px 9px); border: 1px dashed var(--muted); border-left-width: 1px; color: var(--ink-2); }
.cal-event.free:not(.hold) { background: transparent; border: 1px dashed color-mix(in srgb, var(--ev) 50%, var(--muted)); color: var(--ink-2); }
.cal-event.pending { border-style: dashed; }
.cal-event.declined, .cal-event.cancelled { opacity: .5; }
.cal-event.cancelled .cal-event-title { text-decoration: line-through; }
.cal-event-when { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; flex: none; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-title { font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.cal-event-where { font-size: 11.5px; color: var(--ink-2); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.cal-event-flag { font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--accent); flex: none; }
.cal-event.short { flex-direction: row; align-items: center; gap: 6px; padding: 0 8px; }
.cal-event.short .cal-event-when, .cal-event.short .cal-event-where { display: none; }
.cal-event.compact { position: static; flex: none; width: 100%; padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.cal-hide { display: none !important; }
.cal-month-more { flex: none; }
.cal-rail-toggle, .cal-rail-close { display: none !important; }
.cal-rail-brand .cal-rail-close { margin-left: auto; }
/* The header compacts to one row instead of wrapping when the calendar pane is narrow. */
@container (max-width: 900px) {
  .cal-head { gap: 10px; flex-wrap: nowrap; }
  .cal-title { font-size: 24px; white-space: nowrap; }
  .cal-head-right { gap: 6px; }
  .cal-seg-btn { padding: 0 10px; }
  .cal-head-right .btn.primary { width: 36px; padding: 0; }
  .cal-new-label { display: none; }
}
@container (max-width: 660px) {
  .cal-head { flex-wrap: wrap; }
  .cal-head-right { margin-left: 0; width: 100%; justify-content: space-between; }
}

/* Month */
.cal-month { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(6, minmax(0, 1fr)); border: 1px solid var(--cal-line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.cal-month-dow { padding: 10px 10px 8px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--cal-line); }
.cal-month-cell { border-top: 1px solid var(--cal-line); border-left: 1px solid var(--cal-line); padding: 4px 6px 5px; display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
.cal-month-cell .cal-event.compact { padding: 2px 7px; font-size: 11.5px; line-height: 1.3; }
.cal-month-cell:nth-child(7n+1) { border-left: 0; }
.cal-month-cell.other { background: var(--cal-paper); }
.cal-month-cell.other .cal-month-num { color: var(--faint); }
.cal-month-h { display: flex; align-items: center; justify-content: space-between; gap: 4px; flex: none; min-height: 24px; }
.cal-month-num { font-family: var(--cal-serif); font-size: 15px; width: 24px; height: 24px; border-radius: 12px; color: var(--ink-2); flex: none; }
.cal-month-num:hover { background: var(--hover); }
.cal-month-cell.today .cal-month-num { background: var(--primary); color: var(--on-primary); }
.cal-month-more { font-size: 11.5px; color: var(--muted); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.cal-month-more:hover { background: var(--hover); }

/* Agenda */
.cal-agenda { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 18px; padding: 4px 0 24px; }
.cal-agenda-day { display: grid; gap: 6px; max-width: 760px; }
.cal-agenda-h { margin: 0 0 4px; display: flex; align-items: baseline; gap: 12px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.cal-agenda-num { font-family: var(--cal-serif); font-size: 26px; color: var(--ink); min-width: 34px; }
.cal-agenda-day.today .cal-agenda-num { color: var(--accent); }
.cal-agenda .cal-event { position: static; flex-direction: row; align-items: center; gap: 14px; padding: 10px 14px; }
.cal-agenda .cal-event-when { min-width: 120px; }
.cal-agenda-empty { padding: 24px 0; }

/* Right rail: Sandy */
.cal-rail { background: var(--header); border-left: 1px solid var(--line); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: auto; }
.cal-rail-brand { display: flex; align-items: center; gap: 4px; font-family: var(--cal-serif); font-size: 26px; letter-spacing: -.3px; }
.cal-rail-brand svg { width: 20px; height: 20px; margin-left: 4px; fill: none; stroke: #b48ad8; stroke-width: 1.6; }
.cal-rail-intro h2 { margin: 4px 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.cal-rail-intro p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.cal-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.cal-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.cal-card p { margin: 0; line-height: 1.5; }
.cal-card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cal-field select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font: inherit; }
.cal-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-slot { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 12.5px; text-align: left; }
.cal-slot:hover { background: var(--hover); }
.cal-slot b { font-weight: 650; }
.cal-today-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-radius: 8px; text-align: left; width: 100%; }
.cal-today-item:hover { background: var(--hover); }
.cal-today-item.past { opacity: .55; }
.cal-today-item .cal-dot { margin-top: 4px; }
.cal-today-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-today-when { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-today-title { font-weight: 600; font-size: 13.5px; }
.cal-ask { margin-top: auto; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 8px 10px 8px 12px; }
.cal-ask svg { width: 16px; height: 16px; fill: none; stroke: #b48ad8; stroke-width: 1.6; flex-shrink: 0; }
.cal-ask input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--ink); }
.cal-ask input:disabled { color: var(--muted); }

/* Event panel in the rail */
.cal-panel { display: flex; flex-direction: column; gap: 10px; }
.cal-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; }
.cal-back svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.cal-panel-kind { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.cal-panel-swatch { width: 12px; height: 12px; border-radius: 4px; }
.cal-panel-swatch.hold { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--muted) 2px 3px) !important; border: 1px dashed var(--muted); }
.cal-panel-title { margin: 0; font-family: var(--cal-serif); font-weight: 500; font-size: 24px; line-height: 1.2; overflow-wrap: anywhere; }
.cal-panel-when { margin: 0; font-size: 14px; }
.cal-panel-where { margin: 0; font-size: 13px; }
.cal-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.cal-actions .btn { height: 38px; text-decoration: none; }
.cal-options { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-options:empty { display: none; }
.cal-options h4, .cal-people h4 { width: 100%; margin: 6px 0 2px; font-size: 11px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.cal-people { display: flex; flex-direction: column; gap: 6px; }
.cal-person { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.cal-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-pdot { width: 8px; height: 8px; border-radius: 4px; background: var(--line); flex-shrink: 0; }
.cal-pdot.accepted { background: var(--ok); }
.cal-pdot.tentative { background: var(--flag); }
.cal-pdot.declined { background: var(--danger); }
.cal-panel-meta { border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 6px; line-height: 1.5; }
.cal-unknown { color: var(--ink-2); }
.cal-unavailable { display: grid; justify-items: center; gap: 6px; padding: 48px 8px; text-align: center; }
.cal-unavailable svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.cal-editor-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.cal-editor .field input[type="time"] { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); }
.cal-check { display: flex; align-items: center; gap: 8px; margin: -6px 0 14px; font-size: 13.5px; }
.cal-search-results { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; }
.cal-search-hit { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; text-align: left; }
.cal-search-hit:hover { background: var(--hover); }

@media (max-width: 1180px) and (min-width: 961px) {
  .calendar-page { grid-template-columns: 210px minmax(0, 1fr); }
  .cal-rail { position: absolute; top: 0; right: 0; bottom: 0; width: 320px; z-index: 20; box-shadow: var(--shadow); transform: translateX(100%); visibility: hidden; transition: transform .18s ease, visibility .18s; }
  .calendar-page.rail-open .cal-rail, .calendar-page.has-panel .cal-rail { transform: none; visibility: visible; }
  .cal-rail-toggle, .cal-rail-close { display: inline-grid !important; }
}
@media (max-width: 960px) {
  .calendar-page { grid-template-columns: minmax(0, 1fr); }
  .cal-side { display: none; }
  .cal-rail { display: none; }
  .calendar-page.has-panel .cal-main, .calendar-page.rail-open .cal-main { display: none; }
  .calendar-page.has-panel .cal-rail, .calendar-page.rail-open .cal-rail { display: flex; border-left: 0; }
  .cal-rail-toggle, .cal-rail-close { display: inline-grid !important; }
  .cal-main { padding: 12px 14px 14px; }
  .cal-title { font-size: 24px; }
  .cal-head-right { width: 100%; margin-left: 0; justify-content: space-between; flex-wrap: wrap; }
  .cal-timegrid { --gutter: 48px; }
  .cal-timegrid.week .cal-tg-head, .cal-timegrid.week .cal-tg-allday, .cal-timegrid.week .cal-tg-grid { min-width: 820px; }
  .cal-timegrid.week { overflow-x: auto; }
  .cal-timegrid.week .cal-tg-scroll { overflow-x: hidden; min-width: 820px; }
  .cal-tg-dow { display: none; }
  .cal-month-cell .cal-event.compact .cal-event-title { font-size: 10.5px; }
  .cal-editor-row { grid-template-columns: 1fr; }
}

/* Connected accounts */
.conn-list { display: grid; gap: 8px; margin: 10px 0; }
.conn-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.conn-main { min-width: 0; flex: 1 1 260px; }
.conn-main strong { word-break: break-all; }
.conn-status { color: var(--muted); margin-top: 2px; }
.conn-row.status-auth .conn-status, .conn-row.status-action_required .conn-status, .conn-row.status-error .conn-status { color: var(--danger); }
.conn-row.status-importing .conn-status, .conn-row.status-connecting .conn-status { color: var(--accent); }
.conn-acts { display: flex; gap: 2px 4px; flex-wrap: wrap; flex-basis: 100%; margin-left: -8px; }
.conn-acts > .text-btn { padding: 5px 8px; }
.conn-pw, .conn-confirm { flex-basis: 100%; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.conn-pw input { flex: 1 1 200px; }
.connect-form { display: grid; gap: 8px; margin-top: 8px; }
.connect-form p { margin: 0; }
.connect-adv summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.connect-grid { display: grid; grid-template-columns: 1fr 90px; gap: 8px; margin-top: 8px; }
.connect-grid .field.small:nth-child(5) { grid-column: 1 / -1; }
@media (max-width: 640px) { .connect-grid { grid-template-columns: 1fr; } }
.report-outcome.outcome-complete strong, .report-outcome.outcome-complete_with_exclusions strong { color: var(--ok); }
.report-outcome.outcome-incomplete strong { color: var(--accent); }

/* ---------- several accounts: one group per account, All accounts on top ---------- */
/* Denser sidebar (smaller type, tighter rows) so long folder names and counts fit in the same width. */
.sidebar .folder { gap: 9px; padding: 5px 8px 5px 10px; min-height: 30px; font-size: 13px; }
.sidebar .folder svg { width: 15px; height: 15px; }
.sidebar .folder .count { font-size: 11.5px; flex: none; min-width: 2ch; text-align: right; }
.sidebar .nav-heading { padding: 12px 6px 3px 10px; font-size: 10.5px; }
.acct-head { display: flex; align-items: center; gap: 2px; margin-top: 6px; border-radius: var(--radius); color: var(--ink); min-width: 0; }
.acct-head:hover { background: var(--hover); }
.acct-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 5px 6px 5px 2px; min-height: 30px; font-weight: 650; font-size: 12.5px; text-align: left; color: inherit; }
.acct-toggle > svg:first-child { width: 14px; height: 14px; color: var(--muted); flex: none; transform: rotate(-90deg); transition: transform .15s; }
.acct-head.open .acct-toggle > svg:first-child { transform: rotate(0); }
.acct-head.all .acct-toggle { text-transform: uppercase; letter-spacing: .07em; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.acct-head .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head .count { font-size: 11.5px; font-weight: 600; color: var(--ink-2); flex: none; text-transform: none; letter-spacing: 0; }
.acct-more { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); opacity: 0; }
.acct-more svg { width: 15px; height: 15px; }
.acct-head:hover .acct-more, .acct-more:focus-visible, .acct-head:focus-within .acct-more { opacity: 1; }
.acct-more:hover { background: var(--active); color: var(--ink); }
.acct-head.current .acct-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--acct) 25%, transparent); }
.acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acct); flex: none; }
.acct-warn svg { width: 13px; height: 13px; color: var(--danger, #d9534f); }
.acct-primary { flex: none; display: inline-flex; color: var(--muted); }
.acct-primary svg { width: 12px; height: 12px; fill: currentColor; }
.primary-account { margin-bottom: 16px; }
.primary-account select { max-width: 100%; }
/* one indent only: the group's rule sits under the arrow */
.acct-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-left: 8px; padding-left: 4px; border-left: 2px solid color-mix(in srgb, var(--acct, var(--line)) 40%, transparent); }
.acct-body.all { border-left-color: var(--line); }
.acct-body .folder { padding-left: 8px; }
.folder.quiet { color: var(--muted); }
.folder.quiet .name { font-weight: 400; }
/* the account a folder view belongs to, under its name */
/* The folder's account and its size, on their own full-width line under the title: the address is
   always shown in full (never ellipsized); only an address longer than the whole line wraps. */
.list-sub { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 2px; margin: -4px 0 0 34px; min-width: 0; font-size: 12px; color: var(--muted); }
.list-sub .list-count { font-size: 12px; white-space: nowrap; }
.list-sub:empty, .list-sub:has(.list-account[hidden]):has(.list-count:empty) { display: none; }
.list-account { min-width: 0; max-width: 100%; color: var(--ink-2); overflow-wrap: anywhere; }
.list-account::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--acct); margin-right: 6px; vertical-align: 1px; }
.list-account[hidden] { display: none; }
.list-sub .list-account:not([hidden]) + .list-count::before { content: '· '; }
/* touch screens keep comfortable targets */
@media (pointer: coarse) {
  .sidebar .folder, .acct-toggle { min-height: 40px; }
  .acct-more { opacity: 1; }
  .folder-twisty { width: 24px; height: 32px; margin: -6px -6px -6px -8px; }
}
/* rows that mix accounts: a colour stripe and the account as a chip */
.row.acct-row { box-shadow: inset 3px 0 0 var(--acct); }
.row.acct-row.focused { box-shadow: inset 3px 0 0 var(--acct), inset 6px 0 0 var(--ink); }
.tag.acct-chip { color: var(--acct); border: 1px solid color-mix(in srgb, var(--acct) 45%, transparent); background: color-mix(in srgb, var(--acct) 8%, transparent); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the sending account in the inline reply summary and the From row */
.cs-from { color: var(--ink-2); flex-shrink: 0; white-space: nowrap; }
.cs-from b { font-weight: 600; color: var(--ink); }
.c-field.c-from { box-shadow: inset 3px 0 0 var(--acct); }
.c-field.c-from select { max-width: 100%; }
/* search scope */
.q-scope { font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; }
.q-scope[style*="--acct"] { border-color: color-mix(in srgb, var(--acct) 50%, transparent); color: var(--acct); }
.q-scope:hover { background: var(--hover); }
.q-field { display: inline-flex; align-items: center; gap: 3px; font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; min-width: 0; }
.q-field > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-field svg { width: 11px; height: 11px; flex: none; opacity: .7; }
.q-field:hover > span { text-decoration: underline; }
.q-all { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--accent, var(--line)); background: var(--panel); color: var(--accent, var(--ink-2)); cursor: pointer; }
.q-all svg { width: 12px; height: 12px; }
.q-all:hover { background: var(--hover); }

/* ---------- tasks ---------- */
/* Tasks is Sandy Agenda in a frame (see TASKS.md); Sandy Mail adds only the sign-in banner. */
.app.tasks-open .workspace { display: none; }
.app.tasks-open .search { visibility: hidden; }
.app.tasks-open .fab { display: none !important; }
#sidebar-tasks-btn[aria-current="page"] { background: var(--active); color: var(--ink); }
.tasks-page { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.tasks-page[hidden] { display: none; }
.tk-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--header); font-size: 13.5px; }
.tk-banner[hidden] { display: none; }
.tk-banner.attention { background: color-mix(in srgb, #b7791f 10%, var(--panel)); }
.tk-banner-text { flex: 1; min-width: 0; line-height: 1.4; }
.tk-banner-text.warn { color: #8a5a10; }
.tk-newtab { margin-left: auto; padding: 4px 6px; }
.tk-frame-wrap { flex: 1; min-height: 0; display: flex; }
.tk-frame { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
/* Keep the new-tab escape visible on phones when a browser blocks embedded storage. */

/* Settings → Addresses: default sending address */
.alias-acts { display: inline-flex; align-items: center; gap: 4px; }
.alias-default { font-size: 12px; font-weight: 600; color: var(--ok); padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 12%, transparent); }
/* Settings → Accounts: Your domains / Bring to Sandy */
.domains { margin-top: 22px; }
.settings-sub { font-size: 14px; margin: 0 0 4px; }
.dc-domain { border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 12px; margin-top: 8px; }
.dc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dc-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.dc-row { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: baseline; }
.dc-mark { font-weight: 700; text-align: center; }
.dc-row.ok .dc-mark { color: var(--ok); }
.dc-row.bad .dc-mark { color: var(--danger); }
.dc-row.unknown .dc-mark { color: var(--muted); }
.dc-sum { margin: 6px 0 0; font-weight: 600; }
.dc-sum.ok { color: var(--ok); }
.adopt .dc-list { margin: 10px 0; }
.adopt-progress { font-variant-numeric: tabular-nums; }
.adopt-archive { border: 1px solid var(--line, #ddd); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.adopt-archive legend { font-weight: 600; padding: 0 4px; }
.adopt-choice { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.adopt-choice input { margin-top: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Attachments view: every attachment across your accounts */
#app.attachments-view #filters, #app.attachments-view .select-all, #app.attachments-view #threads-toggle, #app.attachments-view .list-foot { display: none; }
#app.attachments-view .list-sub .list-count { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.att-head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 10px 14px 8px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 8px; }
.att-find { display: flex; gap: 6px; align-items: center; }
.att-filter { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface, var(--bg)); color: var(--ink); }
.att-toggle { position: relative; flex: none; }
.att-toggle[aria-expanded="true"] { background: var(--hover); }
.att-toggle-n { position: absolute; top: 0; right: 0; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; line-height: 15px; text-align: center; }
.att-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.att-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.att-panel[hidden], .att-selbar[hidden] { display: none; }
.att-sel { min-width: 0; font: inherit; font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.att-sys { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.att-reset { justify-self: start; padding: 2px 6px; }
/* The selection bar covers the find row instead of pushing the list down under your pointer. */
.att-selbar { position: absolute; top: 0; left: 0; right: 0; z-index: 1; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-height: 54px; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line-soft); }
.att-selbar .btn, .att-selbar .att-clear { flex: none; }
.att-seln { font-size: 12.5px; font-weight: 600; margin-right: auto; font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-selbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.att-selbar .btn svg { width: 14px; height: 14px; }
.att-stale .att-row, .att-stale .att-group { opacity: .45; }
.att-row { display: grid; grid-template-columns: 18px 34px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line-soft); box-shadow: inset 3px 0 0 var(--acct, transparent); }
.att-row:hover { background: var(--hover, color-mix(in srgb, var(--ink) 4%, transparent)); }
.att-row.selected { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.att-check { display: inline-grid; place-items: center; cursor: pointer; }
.att-check input { margin: 0; }
.att-ico { display: inline-grid; place-items: center; color: var(--muted); width: 34px; height: 34px; }
.att-ico svg { width: 18px; height: 18px; }
.att-ico.risk { color: var(--danger); }
.att-thumb { object-fit: cover; border-radius: 7px; background: var(--soft); }
.att-open { display: grid; gap: 1px; min-width: 0; text-align: left; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.att-nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-meta, .att-subj { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-acts { display: inline-flex; gap: 0; }
.att-group { display: flex; align-items: baseline; gap: 8px; padding: 12px 14px 6px; font-size: 12.5px; background: var(--bg); border-bottom: 1px solid var(--line-soft); }
.att-group-nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.att-group-n { color: var(--muted); white-space: nowrap; margin-left: auto; }
.att-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 14px 16px 18px; color: var(--muted); font-size: 12.5px; text-align: center; }
.att-status:empty { display: none; }
.att-status .spinner { width: 13px; height: 13px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: img-spin .8s linear infinite; }
/* Two-step sign-in */
.text-btn { background: none; border: 0; padding: 0; color: var(--focus); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.text-btn:disabled { opacity: .5; cursor: default; }
.login-card .two-step-lead { margin: 0; }
.login-card .check-row { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.login-card .check-row input { height: auto; padding: 0; }
.two-step-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.recovery-codes { font: 14px/1.9 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; columns: 2; padding: 12px 16px; margin: 8px 0; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--panel); white-space: pre-wrap; user-select: all; }
.two-step .copy-inline code { font-size: 13px; }

.login-card form[hidden] { display: none; }
.two-step-stage { display: grid; gap: 14px; }
.login-card .two-step-stage p { margin: 0; }
.login-card .two-step-title { font-size: 19px; font-weight: 650; margin: 0; }
.two-step-say code { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 10px; font: 600 15px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; user-select: all; }
.two-step-alt { display: flex; gap: 14px; flex-wrap: wrap; }
.login-card .setup-qr { margin: 0; }
.login-card a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.two-step-lost { text-align: center; }
.two-step-alert { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.two-step-alert p { margin: 6px 0 10px; }
.mail-app-made { margin: 8px 0; }
.step-up { display: grid; gap: 10px; border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px; margin: 8px 0 12px; background: var(--panel); }
.step-up p { margin: 0; }
.step-up-area:empty { display: none; }

.step-up .form-message:empty { display: none; }

.att-signed-note { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--soft); color: var(--ink-2); font-size: 12.5px; }
.att-signed-note svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
/* Sandy's files: the third panel while Attachments is open */
.files-panel { display: flex; flex-direction: column; gap: 14px; }
.files-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.files-crumbs .linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.files-crumbs .linklike:hover { text-decoration: underline; }
.files-here { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.files-find { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--panel); }
.files-find svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.files-search { flex: 1; min-width: 0; border: 0; background: none; padding: 9px 0; font: inherit; color: var(--ink); outline: none; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.files-tile { display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.files-tile:hover, .files-tile:focus-visible { background: var(--hover); border-color: var(--accent); }
.files-tile.muted-tile { color: var(--muted); }
.files-tile-ico { grid-row: 1 / span 2; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--hover); color: var(--accent); }
.files-tile-ico svg { width: 18px; height: 18px; }
.files-tile-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-tile-count { font-size: 12.5px; color: var(--muted); }
.files-sub { margin: 8px 0 0; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.files-note { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.files-folders, .files-rows { display: flex; flex-direction: column; border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.files-folder, .files-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: var(--panel); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.files-folder:last-child, .files-row:last-child { border-bottom: 0; }
.files-folder:hover, .files-row:hover, .files-folder:focus-visible, .files-row:focus-visible { background: var(--hover); }
.files-folder > svg, .files-row > svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.files-folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-folder-count { font-size: 12.5px; color: var(--muted); }
.files-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.files-row-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-row-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-row-badge { flex: none; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.files-line { display: flex; align-items: center; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.files-line:last-child { border-bottom: 0; }
.files-line > .files-row { border-bottom: 0; flex: 1; min-width: 0; }
.files-details { margin-right: 12px; border: 0; cursor: pointer; font: inherit; font-size: 11.5px; }
.files-details:hover, .files-details:focus-visible { color: var(--ink); }
.files-list-head { align-items: center; justify-content: space-between; }
.files-sort { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.files-title { word-break: break-word; }
.files-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
.files-facts dt { color: var(--muted); }
.files-facts dd { margin: 0; color: var(--ink); }

/* Compact list: one tidy line per email at any list width.
   - the conversation count is a single small pill (no stacked chevron)
   - the account chip is dropped: the coloured bar at the left of each row already shows the account
   - when the list is narrow the preview gives its space to the subject */
#message-list { container-type: inline-size; container-name: maillist; }
:root[data-density="compact"] .row-expand { display: inline-flex; align-items: center; justify-content: center; min-height: 20px; height: 20px; min-width: 24px; padding: 0 5px; border-radius: 6px; }
:root[data-density="compact"] .row-expand svg { display: none; }
:root[data-density="compact"] .row-meta .acct-chip { display: none; }
:root[data-density="compact"] .row-meta { flex: none; max-width: none; gap: 4px; }
:root[data-density="compact"] .row-meta:empty { display: none; }
:root[data-density="compact"] .row-from { flex: 0 0 clamp(84px, 26%, 190px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-density="compact"] .row-subject { flex: 1 1 auto; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container maillist (max-width: 640px) {
  :root[data-density="compact"] .row-preview { display: none; }
  :root[data-density="compact"] .row-subject { max-width: none; }
}

.provider-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.provider-note { margin: 0 0 10px; color: var(--ink-2); font-size: 13px; }
/* Rules: runs over existing mail */
.run-accounts { display: grid; gap: 4px; margin: 0 0 8px 2px; }
.run-accounts .acct-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.run-count { margin: 10px 0 4px; }
.run-sample { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.run-sample li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-sample .run-from { font-weight: 600; }
.rule-runs { display: grid; gap: 6px; margin: 8px 0; }
.rule-run { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.rule-run.incomplete, .rule-run.failed { border-color: var(--danger, #c0392b); }
/* Tidy up: rule suggestions on the Rules page */
.tidy-panel { display: grid; gap: 8px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 12px; }
.tidy-panel .settings-sub { margin-top: 0; }
.tidy-summary { margin: 0; font-weight: 600; }
.tidy-card { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.tidy-card .rule-main { display: grid; gap: 3px; flex: 1; min-width: 0; }
.tidy-card .run-sample { margin: 2px 0; color: var(--muted, #666); }
.tidy-actions { display: flex; flex-direction: column; align-items: stretch; gap: 4px; flex: none; }
.tidy-batches { display: grid; gap: 6px; }
@media (max-width: 640px) { .tidy-card { flex-direction: column; } .tidy-actions { flex-direction: row; flex-wrap: wrap; } }
/* Rules: the editor (sentence, live panel) and the list */
.modal.rule-editor { max-width: 980px; }
.rule-editor-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.rule-live { position: sticky; top: 0; border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px; background: var(--soft); font-size: 13px; }
.rule-live h4 { margin: 0 0 6px; font-size: 13px; }
.rule-live-count { margin: 0 0 6px; }
.rule-live-warn { margin: 0 0 8px; color: var(--danger, #b3261e); font-weight: 600; }
.rule-live-list { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.rule-live-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.rule-live-row .rl-from { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-live-row .rl-subj { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-live-row .rl-fate { grid-column: 1 / -1; }
.rule-sentence.big { font-size: 15px; line-height: 1.45; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.rule-starts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.chip-btn { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--panel); font-size: 12.5px; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--panel); }
.cond select[hidden], .cond input[hidden], .cond span[hidden] { display: none; }
.rule.off { opacity: .6; }
.rule-sentence { color: var(--ink-2); }
.rule-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.rule-pos { display: inline-block; min-width: 18px; margin-right: 6px; color: var(--muted); font-weight: 500; }
.stop-mark { margin-left: 6px; font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 760px) { .rule-editor-grid { grid-template-columns: 1fr; } .rule-live { position: static; } }

/* ---- sign-in: keep me signed in; signed-in devices ---- */
#login-form label.remember-row { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: -2px 0 14px; cursor: pointer; }
#login-form label.remember-row input { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }
.session-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; }
.session-row .muted.small { display: block; }
/* Where a message is (search results and the open message): account · folder; clicking opens the folder */
.tag.loc-chip { font: inherit; font-size: inherit; cursor: pointer; max-width: 320px; }
button.tag.loc-chip:hover { text-decoration: underline; }
:root[data-density="compact"] .row-meta .loc-chip { display: inline-block; max-width: 220px; }
/* Rules page: "New rule" at the top right, above Tidy up */
.rules-head { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.tidy-learned { font-style: italic; }
.rule-hint { margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft, rgba(90, 140, 255, 0.12)); }

/* Phones and tablets: typing fields at 16px or more, so iOS doesn't zoom the page when the draft is tapped
   (the zoom swallows the second tap of a double-tap, so the word wasn't selected), and no double-tap-to-zoom
   inside the composer, so a double-tap always selects the word. */
@media (pointer: coarse) {
  .composer { touch-action: manipulation; }
  .composer .c-body, .composer input, .composer textarea, .composer select { font-size: 16px; }
}

/* Tidy up: "See the emails" on a suggestion card */
.tidy-see-wrap { display: grid; gap: 6px; justify-items: start; }
.tidy-examples { display: grid; gap: 6px; width: 100%; max-height: 360px; overflow: auto; }
.tidy-example { border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 8px; display: grid; gap: 2px; }
.tidy-example.unread .te-subj { font-weight: 600; }
.tidy-example .te-head { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.tidy-example .te-from { flex: none; max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tidy-example .te-subj { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tidy-example .te-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tidy-example .te-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Snooze and other date pickers: one-tap choices, then a date and a time (22 Nov 2026). */
.dt-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.dt-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--line, rgba(127,127,127,.3)); border-radius: 10px; background: transparent; color: inherit; cursor: pointer; text-align: left; font: inherit; }
.dt-pick:hover, .dt-pick:focus-visible { border-color: var(--accent, #5b8def); background: var(--hover, rgba(127,127,127,.08)); }
.dt-or { margin: 4px 0 8px; }
.dt-row { display: flex; gap: 12px; flex-wrap: wrap; }
.dt-row .field { flex: 1 1 160px; }
.dt-said { min-height: 1.4em; margin-top: 6px; }


/* Composer: spelling and grammar suggestions (under the formatting bar). */
.c-proof { border-bottom: 1px solid var(--line-soft); background: var(--soft); font-size: 13px; max-height: 38vh; overflow-y: auto; }
.c-proof[hidden] { display: none; }
.composer.min .c-proof { display: none; }
.proof-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 16px; position: sticky; top: 0; background: var(--soft); }
.proof-title { flex: 1; color: var(--muted); }
.proof-title.busy::after { content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 8px; border: 2px solid var(--line); border-top-color: var(--muted); border-radius: 50%; vertical-align: -1px; animation: proof-spin .8s linear infinite; }
@keyframes proof-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .proof-title.busy::after { animation: none; } }
.proof-close { width: 26px; height: 26px; }
.proof-close svg { width: 14px; height: 14px; }
.proof-list { list-style: none; margin: 0; padding: 0 8px 6px 16px; }
.proof-row { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; border-top: 1px solid var(--line-soft); }
.proof-kind { flex: none; width: 104px; color: var(--muted); font-size: 12px; }
.proof-change { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.proof-change del { color: var(--danger); background: var(--danger-soft); text-decoration: line-through; border-radius: 3px; padding: 0 2px; }
.proof-change ins { color: var(--ok); text-decoration: none; font-weight: 600; border-radius: 3px; padding: 0 2px; margin-left: 2px; }
.proof-actions { flex: none; display: flex; gap: 2px; }
.proof-actions .text-btn, .proof-head .text-btn { padding: 3px 8px; }
.proof-fix { color: var(--ink); font-weight: 600; }
.proof-btn[aria-busy="true"] { opacity: .5; }
@media (max-width: 640px) { .proof-row { flex-wrap: wrap; gap: 2px 10px; } .proof-kind { width: auto; } .proof-change { flex-basis: 100%; order: 3; } .proof-actions { margin-left: auto; } }

/* Spelling and grammar as you type: underlines on the browser's highlight layer, a count on the button, a one-click fix. */
::highlight(sandy-proof) { text-decoration: underline wavy #2f6fed; text-decoration-thickness: 1.5px; }
.proof-btn { position: relative; }
.proof-btn[data-count]::after { content: attr(data-count); position: absolute; top: 0; right: -2px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: #2f6fed; color: #fff; font-size: 10px; font-weight: 600; line-height: 14px; text-align: center; }
.proof-tip { position: fixed; z-index: 1200; display: flex; align-items: center; gap: 8px; max-width: min(420px, calc(100vw - 16px)); padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); font-size: 13px; }
.proof-tip-kind { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-tip-fix { flex: none; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.att.link { max-width: none; }
.att.link .nm { max-width: 160px; }
.att.link .link-ic { font-size: 13px; }
.att .link-days { font: inherit; font-size: 12px; background: var(--panel); color: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 1px 4px; }
.file-links { display: grid; gap: 12px; }
.file-link-row { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--panel); display: grid; gap: 6px; }
.file-link-row[data-state="off"], .file-link-row[data-state="expired"] { background: transparent; }
.file-link-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.file-link-head strong { word-break: break-word; font-size: 15px; }
.file-link-pill { flex: none; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.file-link-pill[data-state="live"] { color: var(--ok); border-color: var(--ok); }
.file-link-sub, .file-link-mail { font-size: 13px; }
.file-link-open { font: inherit; font-weight: 600; color: var(--accent); text-align: left; padding: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; overflow-wrap: anywhere; }
.file-link-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 4px; }
.file-link-stat { display: flex; align-items: baseline; gap: 6px; padding: 5px 12px; border-radius: 8px; background: var(--hover); font-size: 13px; }
.file-link-stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.file-link-stat[data-zero="true"] { color: var(--muted); }
.file-link-last { font-size: 13px; margin-left: 4px; }
.file-link-stats .text-btn { margin-left: auto; padding: 4px 8px; }
.file-link-history { margin: 2px 0 0; padding: 0; list-style: none; font-size: 13px; border-top: 1px solid var(--line-soft, var(--line)); }
.file-link-history li { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 6px 0; border-bottom: 1px solid var(--line-soft, var(--line)); }
.file-link-history .ev-when { min-width: 118px; font-variant-numeric: tabular-nums; }
.file-link-history .ev-what { min-width: 150px; font-weight: 600; }
.file-link-history .ev-page .ev-what { font-weight: 400; }
.file-link-actions { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 4px; font-size: 13px; }
.file-link-actions > .btn { margin-left: auto; }
.file-link-actions input[type=date] { font: inherit; font-size: 13px; background: var(--panel); color: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.file-link-note { font-size: 12.5px; margin-top: 14px; }

/* Settings → Accounts → Import a mail file */
.mail-file { margin-top: 24px; }
.mail-file-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; display: grid; gap: 6px; }
.mail-file-row .features { margin: 4px 0; }
.mail-file-pick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; display: grid; gap: 6px; max-height: 360px; overflow-y: auto; }
.mail-file-pick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line); }
.mail-file-pick-row:first-of-type { border-top: 0; }
.mail-file-pick-name { min-width: 0; overflow-wrap: anywhere; }
.mail-file-pick-row .btn { flex: none; }
.mail-file-pick-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.mail-file-crumbs { min-width: 0; overflow-wrap: anywhere; }
.mail-file-crumbs .linklike { background: none; border: 0; padding: 0; color: var(--accent, inherit); text-decoration: underline; cursor: pointer; font: inherit; }
button.mail-file-pick-folder { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 0; }
button.mail-file-pick-folder:first-of-type { border-top: 0; }
button.mail-file-pick-folder:hover { background: var(--hover, rgba(127,127,127,.08)); }
.mail-file-pick-folder .icon, .mail-file-pick-folder svg { vertical-align: -3px; }
/* Attach from Sandy Files (compose paperclip). */
.sf-pick-field { display: block; margin: 0 0 8px; }
.sf-pick-search { width: 100%; box-sizing: border-box; }
.sf-pick { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; display: grid; gap: 2px; max-height: min(52vh, 420px); overflow-y: auto; }
.sf-pick .mail-file-pick-head { padding: 4px 0; }
.sf-pick-file { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 0; border-top: 1px solid var(--line); cursor: pointer; }
.sf-pick-file input { flex: none; width: 18px; height: 18px; margin: 0; }
.sf-pick-file.disabled { cursor: default; opacity: .6; }
.sf-pick button.mail-file-pick-folder { min-height: 44px; }
.sf-pick-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (max-width: 600px) { .sf-pick { max-height: 56vh; } .sf-pick-actions .btn { flex: 1; min-height: 44px; } }
.mail-file-into { margin-top: 10px; }
.mail-file-also { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; cursor: pointer; }
.mail-file-also input { margin: 2px 0 0; flex: none; }
.mail-file-into select, .mail-file-newfolder select, .mail-file-newfolder input { width: min(420px, 100%); max-width: 100%; }
.mail-file-newfolder { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border, rgba(127,127,127,.3)); border-radius: 8px; }
.mail-file-newfolder .field { margin-bottom: 8px; }
.mail-file-progress { width: min(320px, 100%); height: 8px; vertical-align: middle; accent-color: var(--accent, currentColor); }

/* ---------- Sandy Files: the Files page (shown instead of the mail panes, like Calendar) ---------- */
.app.files-open .workspace { display: none; }
.app.files-open .search { visibility: hidden; }
.app.files-open .fab { display: none !important; }
.files-page { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-items: stretch; background: var(--bg); overflow: auto; scrollbar-gutter: stable; }
.files-page[hidden] { display: none; }
.files-page.fp-dropping { outline: 2px dashed var(--accent); outline-offset: -8px; }
.fp-side { flex: 1 1 220px; max-width: 260px; box-sizing: border-box; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.fp-upload { margin: 0 4px 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fp-nav { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.fp-nav:hover { background: var(--hover); color: var(--ink); }
.fp-nav.on { background: var(--active); color: var(--ink); font-weight: 600; }
.fp-nav.fp-muted { color: var(--muted); }
.fp-nav svg { width: 16px; height: 16px; }
.fp-nav-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-nav-n { font-size: 12px; color: var(--muted); }
.fp-side-label { margin: 14px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fp-side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.fp-used { margin: 8px 10px 0; }
.fp-main { flex: 999 1 520px; min-width: 0; box-sizing: border-box; padding: 16px 16px 28px 4px; display: flex; flex-direction: column; gap: 12px; }
.fp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fp-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; flex: 1 1 auto; }
.fp-find { display: flex; align-items: center; gap: 8px; flex: 0 1 320px; height: 40px; padding: 0 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.fp-find svg { width: 16px; height: 16px; color: var(--muted); }
.fp-search { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); }
.fp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fp-note { margin: 0; font-size: 13px; }
.fp-table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.fp-row { display: grid; grid-template-columns: minmax(200px, 2.6fr) minmax(90px, 1.2fr) minmax(110px, 1.4fr) 104px 80px; gap: 12px; align-items: center; width: 100%; min-width: 640px; min-height: 48px; padding: 0 16px; border: 0; border-top: 1px solid var(--line-soft); background: transparent; color: var(--ink-2); font: inherit; font-size: 14px; text-align: left; cursor: pointer; box-sizing: border-box; }
.fp-row:hover { background: var(--header); }
.fp-row.sel { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.fp-row.fp-th { border-top: 0; min-height: 38px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: default; }
.fp-row.fp-th:hover { background: transparent; }
.fp-sort-head { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.fp-sort-head:hover, .fp-sort-head.on { color: var(--ink); }
.fp-sort-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.fp-sort-arrow { font-size: 9px; line-height: 1; }
.fp-name { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); }
.fp-name-text, .fp-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fp-size { text-align: right; }
.fp-empty { padding: 24px 16px; margin: 0; }
.fp-uploads { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.fp-upload-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 240px); gap: 12px; align-items: center; font-size: 13px; }
.fp-upload-line progress { width: 100%; }
.fp-links { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.fp-links-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Failures stay in sight until fixed or cleared (Nick, 28 Nov 2026). */
.fp-links.has-failed { border-color: color-mix(in srgb, var(--danger, #c62828) 45%, var(--line)); }
.fp-links-failed { color: var(--danger, #c62828); font-weight: 600; margin-left: 6px; }
.fp-link-failed .small.error { color: var(--danger); }
@media (max-width: 600px) { .fp-links-toggle { flex-wrap: wrap; text-align: left; } }
.fp-links-toggle { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 2px 0; color: inherit; font: inherit; cursor: pointer; }
.fp-links-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.fp-link-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, 200px) auto; gap: 12px; align-items: center; font-size: 13px; }
.fp-link-name { display: flex; flex-direction: column; min-width: 0; }
.fp-link-name .fp-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-link-line progress { width: 100%; }
.fp-link-actions { display: flex; gap: 6px; justify-content: flex-end; }
.od-browser { display: flex; flex-direction: column; gap: 8px; min-height: 240px; }
.od-head { display: flex; align-items: center; gap: 10px; }
.od-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.od-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.od-row:last-child { border-bottom: 0; }
.od-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.od-browser .linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.fp-links-input { width: 100%; font-family: var(--mono, ui-monospace, monospace); font-size: 13px; }
@media (max-width: 640px) { .fp-link-line { grid-template-columns: minmax(0, 1fr) auto; } .fp-link-line progress { grid-column: 1 / -1; grid-row: 2; } }
.fp-detail { flex: 1 1 280px; max-width: 340px; box-sizing: border-box; margin: 16px 16px 24px 0; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 12px; align-self: flex-start; }
.fp-detail[hidden] { display: none; }
.fp-detail-head { display: flex; align-items: flex-start; gap: 10px; }
.fp-detail-name { flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.fp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fp-sub { margin: 8px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.fp-places { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.fp-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fp-tag { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--soft); font-size: 12px; color: var(--ink-2); }
.fp-tag-input { height: 30px; width: 120px; padding: 0 10px; border: 1px dashed var(--faint); border-radius: 999px; background: transparent; font: inherit; font-size: 12px; color: var(--ink); }
/* The details panel floats over the right of the page instead of taking room from the grid, so opening it (a click,
   a right-click, Get info) doesn't narrow the grid and move every card (Nick, 3 Dec 2026). Its negative left margin
   cancels its own width, so the grid is laid out as if it weren't there; sticky keeps it in view while scrolling. It starts
   below the search, view and sort controls so they stay usable while it's open. */
@media (min-width: 961px) {
  .fp-detail { position: sticky; top: 16px; z-index: 6; flex: 0 0 340px; width: 340px; max-width: 340px; margin: 68px 16px 24px -356px; max-height: calc(100vh - 110px); overflow: auto; box-shadow: 0 10px 36px rgba(0,0,0,.28); }
}
@media (max-width: 960px) { .fp-side { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; } .fp-side-label, .fp-side-foot { flex-basis: 100%; } .fp-nav { width: auto; } .fp-detail { max-width: none; margin: 0 16px 24px; flex-basis: 100%; } }
.check-line { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; }

/* Sandy Files: a search that matched words inside a file shows them under its name. */
.fp-name-col { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.fp-match { font-size: 12px; line-height: 1.35; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fp-match mark { background: color-mix(in srgb, var(--accent, #1a73e8) 18%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* Sandy Files: dropping files or dragging a file onto a place in the side list; a file with no preview. */
.files-page.fp-dropping::after { content: 'Drop to upload'; position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 600; pointer-events: none; z-index: 50; }
.fp-nav.fp-drop-here { outline: 2px dashed var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
body.fp-dragging-file .fp-nav:not(.fp-muted) { transition: background .1s; }
.fp-row[draggable="true"] { cursor: grab; }
.fp-no-preview img { max-height: 36vh; }
.fp-no-preview:has(img) { padding: 24px 16px; }
.fp-no-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 16px; text-align: center; }
/* Google Drive move panel (Files) */
.fp-check { display: flex; gap: .6rem; align-items: flex-start; margin: .7rem 0; cursor: pointer; }
.fp-check input { margin-top: .25rem; }
#modal-body progress { width: 100%; height: .6rem; }

/* Translate (an email in another language than the reader's) */
.translate-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; padding: 7px 10px; border-radius: 8px; background: var(--hover, rgba(11, 92, 173, .06)); font-size: 13px; color: var(--muted); }
.translate-bar .icon { width: 15px; height: 15px; }
.translate-bar.on { color: var(--text, inherit); }
.translated-subject { font-weight: 600; margin: 0 0 10px; }
.od-whole:empty { display: none; }
.od-whole { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.od-whole p { margin: 0; }
.od-whole progress { width: 100%; }
.od-whole-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.od-whole-actions:empty { display: none; }

/* The Files app at files.email.com.au (Files redesign F1): the same page, opened on Files, with Mail as the way back. */
.app-name { font-weight: 600; font-size: 17px; color: var(--ink-2); margin-left: -4px; margin-right: 8px; white-space: nowrap; }
.app-name[hidden] { display: none; }
.app-mail-btn { display: inline-flex; align-items: center; gap: 6px; }
.app-mail-btn svg { width: 18px; height: 18px; }
.app-mail-btn[hidden] { display: none; }
body.files-app .app .search { display: none; }
@media (max-width: 760px) { body.files-app .app-name { font-size: 15px; } }
body.files-app .topbar .brand { width: auto; margin-right: 10px; }
body.files-app .top-actions { margin-left: auto; }
body.files-app #menu-btn, body.files-app #tasks-btn, body.files-app #files-btn, body.files-app #refresh-btn { display: none !important; }

/* Sandy Files, Finder-style (Files redesign phase 2): folders in the list and the side tree, icons view, a path
   at the top, several selected at once, named in place, right-click menus, and a phone layout without sideways
   scrolling. */
.fp-new { margin: 0 4px 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fp-folder-icon { color: var(--fp-folder, #5b8def); fill: color-mix(in srgb, var(--fp-folder, #5b8def) 22%, transparent); }
.fp-c-red { --fp-folder: #e5484d; } .fp-c-orange { --fp-folder: #f2811d; } .fp-c-yellow { --fp-folder: #d6a700; } .fp-c-green { --fp-folder: #30a46c; }
.fp-c-blue { --fp-folder: #3e63dd; } .fp-c-purple { --fp-folder: #8e4ec6; } .fp-c-grey { --fp-folder: #8b8d98; }
.fp-tree { display: flex; flex-direction: column; }
.fp-tree-row { display: flex; align-items: center; gap: 0; padding-left: calc(var(--depth, 1) * 12px); }
.fp-tree-row .fp-nav { min-height: 34px; padding: 0 8px; }
.fp-tree-twisty { flex: 0 0 22px; width: 22px; height: 26px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--muted); padding: 0; cursor: pointer; border-radius: 6px; }
.fp-tree-twisty svg { width: 14px; height: 14px; transition: transform .12s; }
.fp-tree-row[aria-expanded="true"] > .fp-tree-twisty svg { transform: rotate(90deg); }
.fp-tree-twisty:hover { background: var(--hover); color: var(--ink); }
.fp-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; min-width: 0; }
.fp-crumb { border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--muted); padding: 4px 8px; border-radius: 8px; cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-crumb:hover { background: var(--hover); color: var(--ink); }
.fp-crumb.fp-drop-here, .fp-row.fp-drop-here, .fp-tile.fp-drop-here { outline: 2px dashed var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.fp-crumb-sep svg { width: 14px; height: 14px; color: var(--faint, var(--muted)); }
.fp-crumb-here { flex: 0 1 auto; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-views { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.fp-views .icon-btn { border-radius: 0; width: 38px; height: 38px; }
.fp-views .icon-btn[aria-pressed="true"] { background: var(--active); color: var(--ink); }
.fp-body { display: flex; flex-direction: column; min-height: 160px; }
.fp-row { grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.5fr) 112px 80px 36px; min-width: 0; }
.fp-row:focus-visible, .fp-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fp-row.sel { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.fp-table { overflow-x: hidden; }
.fp-more { width: 32px; height: 32px; opacity: 0; }
.fp-row:hover .fp-more, .fp-row:focus-within .fp-more, .fp-row.sel .fp-more, .fp-tile:hover .fp-more, .fp-tile:focus-within .fp-more, .fp-tile.sel .fp-more { opacity: 1; }
@media (hover: none) { .fp-more { opacity: 1; } }
.fp-star svg { width: 14px; height: 14px; color: #d6a700; fill: #d6a700; }
.fp-folder-row .fp-name { font-weight: 500; }
.fp-folder-row .fp-folder-icon, .fp-detail-head .fp-folder-icon { width: 22px; height: 22px; }
.fp-rename { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--accent); border-radius: 6px; font: inherit; font-size: 14px; background: var(--panel); color: var(--ink); }
.fp-tree-renaming { cursor: default; min-width: 0; padding-right: 6px; }
.fp-tree-renaming .fp-tree-rename { width: 100%; box-sizing: border-box; }
.fp-tree-rename { height: 26px; padding: 0 6px; font-size: 14px; }
.fp-title .fp-title-rename { height: auto; padding: 2px 6px; font-size: inherit; font-weight: inherit; letter-spacing: inherit; width: 100%; max-width: 420px; }
.fp-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: var(--radius); }
.fp-selbar-n { font-weight: 600; font-size: 14px; margin-right: auto; padding-left: 4px; }
.fp-selbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.fp-selbar .btn svg { width: 15px; height: 15px; }
.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.fp-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px 10px; border-radius: 12px; border: 1px solid transparent; background: var(--panel); cursor: pointer; min-width: 0; text-align: center; }
.fp-tile:hover { border-color: var(--line); }
.fp-tile.sel { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.fp-tile-art { position: relative; width: 100%; height: 96px; display: grid; place-items: center; border-radius: 8px; overflow: hidden; }
.fp-tile-art .fp-folder-icon { width: 72px; height: 72px; stroke-width: 1.2; }
.fp-tile-art .att-badge, .fp-tile-art > :not(img):not(.fp-play-badge):not(svg):not(.fp-thumb):not(.fp-art-wait) { transform: scale(1.6); }
.fp-art-wait { display: grid; place-items: center; width: 100%; height: 100%; }
.fp-art-wait > * { transform: scale(1.6); }
/* Drive-style grid: a row of compact folder cards, then file cards showing what is inside each file. */
.fp-cards { display: flex; flex-direction: column; gap: 8px; }
.fp-grid-head { margin: 4px 2px 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.fp-grid-head:not(:first-child) { margin-top: 14px; }
.fp-grid.fp-grid-folders { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.fp-grid-folders .fp-tile { flex-direction: row; align-items: center; gap: 10px; min-height: 52px; padding: 8px 44px 8px 12px; text-align: left; background: var(--soft); }
.fp-grid-folders .fp-tile-art { width: 28px; height: 28px; flex: none; overflow: visible; }
.fp-grid-folders .fp-tile-art .fp-folder-icon { width: 24px; height: 24px; stroke-width: 1.6; }
.fp-grid-folders .fp-tile-name { flex: 1 1 auto; width: auto; min-width: 0; font-weight: 500; -webkit-line-clamp: 1; }
.fp-grid-folders .fp-tile-meta { display: none; }
.fp-grid-folders .fp-place-tile { padding-right: 12px; }
.fp-grid-folders .fp-tile .fp-more { top: 50%; right: 6px; transform: translateY(-50%); opacity: 1; }
.fp-grid.fp-grid-files { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.fp-card { align-items: stretch; gap: 8px; padding: 6px 8px 8px; text-align: left; background: var(--soft); }
.fp-card-top { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 34px; padding: 0 32px 0 4px; }
.fp-card-top .ftype { flex: none; }
.fp-card-top .fp-tile-name { flex: 1 1 auto; width: auto; min-width: 0; font-weight: 500; -webkit-line-clamp: 1; }
.fp-card-top .fp-edit { flex: none; padding: 2px 10px; min-height: 0; color: inherit; text-decoration: none; }
.fp-card .fp-card-top .fp-more { top: 50%; right: -4px; transform: translateY(-50%); opacity: 1; }
.fp-card-art { height: 168px; background: var(--panel); }
.fp-card-art.fp-playing { position: relative; background: #000; }
.fp-card-art .fp-card-player { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.fp-card-art.fp-playing .fp-play-badge, .fp-card-art.fp-playing .fp-thumb { visibility: hidden; }
.fp-thumb-page { object-position: top center; background: #fff; }
video.fp-thumb { pointer-events: none; }
.fp-thumb { width: 100%; height: 100%; object-fit: cover; background: var(--soft); }
.fp-play-badge { position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; }
.fp-play-badge svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.fp-tile-name { width: 100%; font-size: 13px; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fp-tile-meta { font-size: 12px; }
.fp-tile .fp-more { position: absolute; top: 4px; right: 4px; }
.fp-tile .fp-name { width: 100%; }
.fp-zip-progress { display: grid; grid-template-columns: minmax(80px, 1fr) auto auto; gap: 8px; align-items: center; }
.fp-in { margin: -6px 0 0; }
.fp-pick { display: flex; flex-direction: column; max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; min-width: min(420px, 80vw); }
.fp-pick-row { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px 0 calc(10px + var(--depth, 0) * 16px); border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer; }
.fp-pick-row:hover { background: var(--hover); }
.fp-pick-row[aria-selected="true"] { background: var(--active); font-weight: 600; }
.fp-pick-row:disabled { opacity: .4; cursor: not-allowed; }
.fp-pick-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-color-menu .pop-item .fp-folder-icon { color: var(--fp-folder, #5b8def); }
.fp-color-menu .pop-item > svg:last-child:not(.fp-folder-icon) { margin-left: auto; }
.fp-player-video { width: 100%; max-height: 72vh; background: #000; border-radius: 8px; }
.fp-player-audio { width: min(560px, 100%); margin: 32px auto; display: block; }
@media (max-width: 1100px) { .fp-row { grid-template-columns: minmax(0, 2.6fr) 104px 76px 36px; } .fp-row .fp-where { display: none; } }
@media (max-width: 760px) {
  .files-page { flex-direction: column; flex-wrap: nowrap; overflow-x: hidden; }
  .fp-side { flex: 0 0 auto; max-width: none; width: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 10px 12px; scrollbar-width: none; }
  .fp-side::-webkit-scrollbar { display: none; }
  .fp-side .fp-tree, .fp-side .fp-used, .fp-side .fp-nav-n { display: none; }
  .fp-side-foot { display: contents; }
  .fp-side .fp-nav { width: auto; flex: 0 0 auto; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); white-space: nowrap; }
  .fp-side .fp-nav.on { background: var(--active); border-color: transparent; }
  .fp-new { margin: 0; flex: 0 0 auto; min-height: 36px; padding: 0 14px; }
  .fp-main { padding: 4px 12px 88px; flex: 1 1 auto; }
  .fp-head { gap: 8px; }
  .fp-find { flex: 1 1 100%; order: 3; }
  .fp-crumbs, .fp-head > .fp-title { flex: 1 1 auto; }
  .fp-title { font-size: 20px; }
  .fp-row.fp-th { display: none; }
  .fp-row { grid-template-columns: minmax(0, 1fr) auto 36px; grid-template-areas: "name size more" "name date more"; row-gap: 0; min-height: 56px; padding: 6px 4px 6px 12px; }
  .fp-row .fp-name { grid-area: name; } .fp-row .fp-size { grid-area: size; font-size: 12px; } .fp-row .fp-date { grid-area: date; font-size: 12px; text-align: right; color: var(--muted); }
  .fp-row .fp-more-cell { grid-area: more; } .fp-row .fp-where { display: none; }
  .fp-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .fp-tile-art { height: 76px; }
  .fp-grid.fp-grid-files { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .fp-grid.fp-grid-folders { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .fp-card-art { height: 120px; }
  .fp-card-top { gap: 6px; padding-left: 2px; } .fp-card-top .ftype { display: none; }
  .fp-grid-folders .fp-tile { gap: 8px; padding-left: 10px; }
  .fp-selbar { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 40; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
  .fp-detail { margin: 0 12px 24px; max-width: none; flex: 0 0 auto; }
  .fp-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}
/* Sandy Files, Shared (phase F3): links to files and folders, and the link badge on shared items. */
.fp-shared { display: inline-flex; color: var(--accent); margin-left: 6px; flex: none; }
.fp-shared svg { width: 14px; height: 14px; }
.fp-shared-page .fp-sub { font-size: 14px; margin: 20px 0 6px; color: var(--muted); font-weight: 600; }
.fp-share-row .fp-name-col { display: flex; flex-direction: column; min-width: 0; }
.fp-share-row .linklike { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-share-row .linklike:hover { text-decoration: underline; }
.fp-share-row .muted.small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-share-row.off { opacity: .65; }
.fp-share-row .fp-size, .fp-share-row .fp-more-cell { overflow: visible; justify-self: end; }
.fp-row.fp-share-row { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, 1fr) 76px 96px; grid-template-areas: none; cursor: default; }
.fp-row.fp-share-row .fp-where { display: block; }
.fp-share-row .fp-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .fp-row.fp-share-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 76px 96px; } .fp-row.fp-share-row .fp-date { display: none; } }
@media (max-width: 760px) {
  .fp-row.fp-share-row { grid-template-columns: minmax(0, 1fr) 96px; grid-template-areas: none; padding: 8px 12px; }
  .fp-row.fp-share-row > * { grid-area: auto; }
  .fp-row.fp-share-row .fp-where, .fp-row.fp-share-row .fp-date, .fp-row.fp-share-row .fp-size { display: none; }
}
/* Sandy Files, getting around (Nick, 29 Nov 2026): Back, Forward and Up beside the path; the open folder's menu; Go to folder. */
.fp-gos { display: inline-flex; gap: 2px; flex: none; }
.fp-go { width: 34px; height: 34px; border-radius: 8px; }
.fp-go:disabled { opacity: .35; cursor: default; background: transparent; }
.fp-go-up svg { transform: rotate(90deg); }
.fp-crumbs { flex-wrap: nowrap; overflow: hidden; }
.fp-crumb { flex: 0 1 auto; min-width: 0; }
.fp-crumb-more { flex: none; letter-spacing: .1em; }
.fp-crumb-sep { flex: none; display: inline-flex; }
.fp-here-btn { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; border: 0; background: transparent; color: inherit; font: inherit; padding: 2px 6px; border-radius: 8px; cursor: pointer; }
.fp-here-btn:hover { background: var(--hover); }
.fp-here-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-here-btn svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.fp-crumb-here { min-width: 0; }
.fp-goto .fp-goto-list { max-height: min(50vh, 420px); overflow: auto; margin-top: 10px; display: flex; flex-direction: column; }
.fp-goto input[type=search] { width: 100%; box-sizing: border-box; }
.fp-goto-item { display: grid; grid-template-columns: 20px minmax(0, 1fr); grid-template-areas: "icon name" "icon path"; column-gap: 10px; align-items: center; text-align: left; border: 0; background: transparent; color: inherit; font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.fp-goto-item > svg { grid-area: icon; width: 18px; height: 18px; }
.fp-goto-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-goto-path { grid-area: path; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-goto-item:hover, .fp-goto-item.on { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
@media (max-width: 760px) {
  .fp-head > .fp-gos { order: 0; }
  .fp-go { width: 32px; height: 32px; }
  .fp-crumb { max-width: 120px; }
}
@media (max-width: 760px) { .fp-head > .fp-crumbs { flex: 1 1 200px; min-width: 0; } .fp-head > .fp-title { flex: 1 1 200px; min-width: 0; } .fp-crumb-here .fp-here-btn { font-size: 20px; } }
/* Sandy Files: places that fill themselves (Sent to Sandy, Saved from links, Email attachments) and folders kept in step with Google Drive or OneDrive. */
.fp-place-icon { color: var(--accent); }
.fp-place-row { cursor: pointer; }
.fp-place-tag { margin-left: 8px; flex: none; }
.fp-place-nav .fp-place-icon { width: 18px; height: 18px; flex: none; }
.fp-sync { display: inline-flex; color: var(--accent); margin-left: 6px; flex: none; }
.fp-sync svg { width: 13px; height: 13px; }
.fp-sync.off { color: var(--muted); }
@media (max-width: 760px) { .fp-place-tag { display: none; } }

/* Mail folder sharing */
.folder-share-modal .modal-body { display: grid; gap: 12px; }
.folder-share-modal fieldset { margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.folder-share-modal textarea { resize: vertical; }
.folder-share-modal .form-message:empty, .share-rows:empty { display: none; }
.share-rows { display: grid; gap: 8px; }
.share-row { display: flex; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.share-row-details { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.share-row-details .tag { margin-inline-start: 6px; }
.share-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.share-mark { display: inline-flex; color: var(--accent); }
.share-mark svg, .share-folder-row svg { width: 15px; height: 15px; }
.shared-folders { margin-block: 12px; }
.share-folder-row { display: flex; align-items: center; }
.share-folder-row .folder { flex: 1; min-width: 0; }
.share-invitation { padding: 8px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.share-invitation .share-actions { flex-basis: 100%; justify-content: flex-start; }
@media (max-width: 600px) {
  .modal-wrap:has(.folder-share-modal) { padding: 0; }
  .modal.folder-share-modal { max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
}
@media print {
  #app.shared-no-copy { display: none !important; }
}
@media (hover: hover) {
  .owner-folder-row:not(:hover):not(:focus-within) > .icon-btn { opacity: 0; }
}
.folder-share-modal .switch-row { margin-top: 2px; }
.shared-folders .folder { min-height: 40px; padding-block: 5px; }
.shared-folders .folder .name { white-space: normal; overflow-wrap: anywhere; }
.share-owner { display: block; font-size: 11px; color: var(--ink-2); }

.fp-smart-row { display: flex; align-items: center; min-width: 0; }
.fp-smart-row .fp-nav { flex: 1; min-width: 0; }
.fp-smart-more { flex: 0 0 auto; }
.modal.fp-smart-modal { display: flex; flex-direction: column; overflow: hidden; }
.fp-smart-modal .modal-body { overflow: auto; }
.fp-smart-modal .modal-head, .fp-smart-modal .modal-foot { flex: 0 0 auto; }
.fp-smart-form .form-message:empty { display: none; }
.fp-smart-form { display: grid; gap: 14px; }
.fp-smart-form .field { margin-bottom: 0; min-width: 0; }
.fp-smart-form input[type="number"] { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); }
.fp-smart-form input[type="number"]:focus { border-color: var(--focus); }
.fp-smart-picks { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 960px) {
  .fp-smart-section { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
}
@media (max-width: 760px) {
  .fp-smart-section { flex: 0 0 auto; flex-wrap: nowrap; }
  .fp-smart-section .fp-side-label { flex-basis: auto; margin: 0 4px; white-space: nowrap; }
  .fp-smart-row .fp-nav { flex: 0 0 auto; }
}

/* A sandboxed, document-width print surface. It never replaces the displayed message. */
.mail-print-frame { position:fixed;left:-10000px;top:0;width:794px;height:100vh;border:0;pointer-events:none; }
.mail-print-options label { display:flex;align-items:flex-start;gap:8px;padding:5px 0;overflow-wrap:anywhere; }
.mail-print-options label small { color:var(--muted);margin-left:auto;flex-shrink:0; }

.fp-site-changes {
  max-height: 35vh;
  overflow: auto;
  overflow-wrap: anywhere;
}

/* Self-filling smart folders: shared by Files and webmail. */
.fp-life-row { display:flex; align-items:center; min-width:0; }
.fp-life-row .fp-life-name { flex:1; min-width:0; padding-left:4px; }
.fp-life-row > .icon-btn { flex-shrink:0; }
.fp-life-spacer { width:24px; flex-shrink:0; }
.fp-life-icon { width:20px; flex-shrink:0; }
.fp-life-empty > .fp-life-row .fp-nav-name, .fp-life-hidden > .fp-life-row { opacity:.6; }
.fp-life-dot { width:7px; height:7px; border-radius:50%; background:#c44a40; flex-shrink:0; }
.fp-life-crumbs { flex-wrap:nowrap; gap:5px; }
.fp-life-crumbs .fp-title { font-size:inherit; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.fp-life-crumbs > .icon-btn, .fp-life-crumbs > .fp-crumb-more { flex-shrink:0; }
.fp-life-coverage { margin:12px 0; padding:12px; border:1px solid var(--border, #ddd); border-radius:10px; }
.fp-life-coverage-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.fp-life-months { display:flex; flex-wrap:wrap; gap:6px; }
.fp-life-months + .btn { margin-top:10px; }
.fp-life-month { border:1px solid #d7a09a; border-radius:5px; padding:7px; font-size:11px; background:#fbe5e3; color:#7c2921; cursor:pointer; }
.fp-life-have { background:#e3f2e7; color:#235c37; border-color:#98bfa3; }
.fp-life-not_needed { background:#eee; color:#555; border-color:#ccc; }
.fp-life-searching { border-style:dashed; }
.fp-life-month-menu .pop-heading { white-space:normal; overflow-wrap:anywhere; text-overflow:clip; text-transform:none; }
.fp-life-picker { max-height:55vh; overflow:auto; }
.fp-life-picker .fp-goto-item { width:100%; white-space:normal; text-align:left; overflow-wrap:anywhere; }
.fp-life-why { overflow-wrap:anywhere; }
@media(max-width:600px) { .fp-life-coverage { margin:8px 0; padding:10px; } .fp-life-month { flex:1 0 60px; } }

.fp-life-tree .fp-life-tree { margin-left:12px; }

.fp-life-drawer-button { display:none; }
.fp-life-drawer { overflow:auto; max-height:65vh; }
.fp-life-drawer .fp-nav { width:100%; white-space:normal; text-align:left; }
@media(max-width:760px) {
  .fp-life-drawer-button { display:inline-flex; }
  .fp-smart-section > .fp-life-tree, .fp-smart-section > .btn { display:none; }
}

@media(max-width:760px) {
  .fp-detail.fp-life-detail { position:fixed; z-index:45; left:8px; right:8px; bottom:8px; margin:0; max-height:70vh; overflow:auto; box-shadow:0 6px 30px #0003; }
}

.fp-life-picker .fp-goto-name { white-space:normal; overflow:visible; text-overflow:clip; }

/* Files one-click actions and the share receipt. Keep the name readable beside touch targets. */
.fp-link-row { display: flex; gap: 8px; align-items: center; }
.fp-link-box { flex: 1; min-width: 0; width: 100%; }
.fp-share-email { margin-top: 20px; }
.fp-share-email .field { margin-bottom: 12px; }
.fp-share-email input { width: 100%; }
.fp-quick-actions { display: inline-flex; flex: none; align-items: center; gap: 0; }
.fp-quick-actions .icon-btn { width: 30px; height: 32px; }
.fp-quick-actions .fp-more { position: static; transform: none; }
.fp-quick { opacity: 0; }
.fp-row:hover .fp-quick, .fp-row:focus-within .fp-quick,
.fp-tile:hover .fp-quick, .fp-tile:focus-within .fp-quick,
.fp-detail-head .fp-quick, .fp-preview-actions .fp-quick, .fp-quick.on { opacity: 1; }
.fp-quick.on { color: var(--accent); }
.fp-quick-star.on svg { fill: currentColor; }
.fp-row { grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.5fr) 112px 80px 124px; }
.fp-more-cell { overflow: visible; }
.fp-preview-actions { display: flex; justify-content: flex-end; }
@media (hover: none), (max-width: 760px) {
  .fp-quick { opacity: 1; }
  .fp-quick-actions .icon-btn { width: 40px; height: 40px; }
}
@media (max-width: 760px) {
  .fp-row:not(.fp-share-row) { grid-template-columns: minmax(0, 1fr) 160px; grid-template-areas: "name more" "size more" "date more"; }
  .fp-row:not(.fp-share-row) .fp-date, .fp-row:not(.fp-share-row) .fp-size { text-align: left; }
}
.fp-link-ready input { min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
.fp-link-ready input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Card view: the one-click buttons sit on the picture's top-right corner, so the grid keeps its size and the type badge. */
.fp-card-art { position: relative; }
.fp-tile-art > .fp-card-quick { transform: none !important; } /* not the 1.6x zoom other art children get */
.fp-card-quick { position: absolute; top: 6px; right: 6px; z-index: 2; padding: 2px; border-radius: 10px; background: rgba(20, 20, 20, .62); color: #fff; }
.fp-card-quick .icon-btn { color: #fff; }
.fp-card-quick .fp-quick.on { color: #ffd34d; }
.fp-card-quick:not(:has(.fp-quick.on)) { opacity: 0; transition: opacity .12s; }
.fp-tile:hover .fp-card-quick, .fp-tile:focus-within .fp-card-quick { opacity: 1; }
.fp-detail-quick { margin: 4px 0 2px; }
.fp-detail-quick .fp-quick { opacity: 1; }
@media (hover: none), (max-width: 760px) {
  .fp-card-quick:not(:has(.fp-quick.on)) { opacity: 1; }
  .fp-card-quick .icon-btn { width: 34px; height: 34px; }
  .fp-card-quick .fp-quick-download { display: none; }
}
/* A draft opened from Files sits above the phone selection bar, so its Send and Save draft stay reachable. */
@media (max-width: 760px) { .composer-dock { z-index: 45; } }

.att-email-preview{width:100%;min-width:0;padding:16px;box-sizing:border-box;overflow:auto;max-height:75vh}.att-email-headers{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:6px 12px}.att-email-headers dt{font-weight:600}.att-email-headers dd{margin:0;overflow-wrap:anywhere}.att-email-parts{display:flex;flex-direction:column;gap:8px;margin-top:16px}.att-email-part{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px;border:1px solid var(--border);border-radius:8px}.att-email-part>span{flex:1 1 180px;overflow-wrap:anywhere}.att-email-preview .att-text{white-space:pre-wrap;overflow-wrap:anywhere}.att-email-preview .att-preview{height:60vh}
/* The pdf.js scroll container must be absolute; its parent owns the flex size. */
.att-preview.kind-pdf { display: flex; flex-direction: column; min-height: 0; }
.att-pdf-tools { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; padding: 5px; }
.att-pdf-tools input[type=number] { width: 4em; }
.att-pdf-tools input[type=search] { width: 10em; min-width: 0; }
.att-pdf-stage { position: relative; flex: 1 1 0; min-width: 0; min-height: 0; }
.att-pdf-pages { position: absolute; inset: 0; overflow: auto; background: var(--surface, #888); }
.att-pdf-pages .popupAnnotation .popup { max-width: min(280px, 65vw); max-height: 240px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
.att-pdf-pages .popupAnnotation[hidden] { display: none; }
.att-pdf-pages .fileAttachmentAnnotation .att-pdf-file { font: 11px sans-serif; position: absolute; top: 100%; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 448px) { .att-pdf-tools { gap: 3px; } .att-pdf-tools input[type=search] { width: 7em; } }
.att-pdf-tools .icon-btn { width: 30px; height: 30px; }
.att-pdf-tools .btn { min-height: 30px; padding: 3px 7px; }

.fp-comment-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.fp-comment-input { box-sizing:border-box; width:100%; resize:vertical; min-height:5em; max-height:22em; }
.fp-comment-mark { flex:none; color:var(--muted); font-size:15px; }
.fp-preview-comment { display:block; width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-align:left; padding:4px 12px; }
.fp-comment-section { margin:12px 0; }

.fp-comment-mark svg { width:16px;height:16px;vertical-align:middle; }

/* Files panes own their scrolling, including a long smart-folder sidebar. */
.files-page { overflow: hidden; flex-wrap: nowrap; }
.fp-side, .fp-main, .fp-detail { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.fp-row, .fp-card, .fp-crumbs { user-select: none; }
.fp-rename { user-select: text; }
.fp-life-icon svg { width: 18px; height: 18px; }
@media (min-width: 761px) and (max-width: 960px) {
  .fp-side { flex: 0 0 210px; max-width: 210px; flex-direction: column; flex-wrap: nowrap; }
}
@media (max-width: 760px) {
  .fp-main { min-height: 0; overflow-y: auto; }
}

@media (min-width: 761px) { .fp-life-folder-count { display: none; } }
/* Webmail Files uses the mail panes; the standalone Files layout stays independent. */
.sidebar-files-row { display: flex; align-items: center; }
.sidebar-files-row > .folder { flex: 1; min-width: 0; }
#sidebar-files-btn::before { content: '▸'; width: 10px; font-size: 11px; }
#sidebar-files-btn[aria-expanded="true"]::before { content: '▾'; }
#sidebar-files-new { flex: none; width: 28px; height: 28px; }
#sidebar-files-tree .fp-nav { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }
#sidebar-files-tree .fp-nav > svg { width: 18px; height: 18px; }
#sidebar-files-tree .fp-side-foot { margin-top: 8px; }
/* Any app docked in the three mail panes (dockPanes in app.js): the mail list and reader step aside. */
.docked .list-pane > .list-head, .docked #message-list, .docked .list-pane > .list-foot, .docked .list-pane > .select-banner,
.docked #reader > #reader-empty, .docked #reader > #reader-view, .docked .fab { display: none !important; }
.docked.docked-span .reader-pane { display: none; }
.docked.docked-span .list-pane { flex: 1 1 auto; max-width: none; width: auto; }
.files-docked #files-main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px; }
.files-docked .fp-head { gap: 8px; }
.files-docked .fp-crumbs { min-width: 0; flex: 1 1 120px; overflow-wrap: anywhere; }
.files-docked .fp-find { flex: 1 1 100%; min-width: 0; }
.files-docked .fp-search { min-width: 0; width: 100%; }
.files-docked .fp-row:not(.fp-share-row) { grid-template-columns: auto auto minmax(0, 1fr) 32px; grid-template-areas: "name name name more" "size date where more"; gap: 3px 8px; padding: 8px 4px; }
.files-docked .fp-row .fp-name { grid-area: name; }
.files-docked .fp-row .fp-size { grid-area: size; }
.files-docked .fp-row .fp-date { grid-area: date; }
.files-docked .fp-row .fp-where { grid-area: where; display: block; }
.files-docked .fp-row .fp-more-cell { grid-area: more; }
.files-docked .fp-row .fp-size, .files-docked .fp-row .fp-date, .files-docked .fp-row .fp-where { font-size: 11px; text-align: left; }
.files-docked .fp-th { display: none; }
.files-docked .fp-more-cell .fp-quick { display: none; }
.files-docked .fp-more { opacity: 1; }
.files-docked .fp-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.files-docked #files-detail { position: static; max-width: none; width: 100%; margin: 0; border: 0; border-radius: 0; min-width: 0; }
.files-docked #files-detail > .att-preview { position: relative; min-width: 0; width: 100%; height: 380px; max-height: 60vh; flex: none; overflow: auto; }
.files-docked #files-detail .att-preview img, .files-docked #files-detail .fp-player { max-width: 100%; max-height: 100%; object-fit: contain; }
.files-docked #files-detail .att-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.files-docked #files-detail .fp-places { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .files-docked #files-main { padding-bottom: 24px; }
  .files-docked #files-detail { padding: 12px; }
  .files-docked #files-detail > .att-preview { height: 48vh; }
}
.files-docked .search { visibility: hidden; }
/* Shared context-menu metadata; all colours follow the current theme. */
.menu .pi-kbd { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.menu .pi-badge { margin-left: auto; padding: 1px 6px; border-radius: 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-size: 11px; }
.menu .pi-chevron { margin-left: auto; }
.menu-submenu { z-index: 1; }
.menu-submenu.fp-smart-submenu { max-height: min(60vh, 420px); overflow-y: auto; }

/* Smart folders is one collapsible parent in the Files sidebar. */
.fp-smart-head { display: flex; }
.fp-smart-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; margin-left: -4px; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; border-radius: 6px; }
.fp-smart-toggle:hover { background: var(--hover, color-mix(in srgb, var(--muted) 12%, transparent)); }
.fp-smart-toggle svg { width: 14px; height: 14px; }
/* Desktop sidebar: nothing squashes when the smart-folder list is long, and names get the row's
   width; a folder's "…" button appears over its count on hover or keyboard focus. */
@media (min-width: 761px) {
  .fp-side > * { flex-shrink: 0; }
}
@media (min-width: 761px) and (hover: hover) {
  .fp-life-row { position: relative; }
  .fp-life-row > .icon-btn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); opacity: 0; background: var(--bg); }
  .fp-life-row:hover > .icon-btn, .fp-life-row:focus-within > .icon-btn { opacity: 1; }
  .fp-life-row .fp-life-name { padding-right: 6px; }
}
