/* spayot — design system: tokens, base styles and the components every page shares.
   Precision over decoration: a 4/8px spacing grid, 13px interface text, 16px icons, 32px controls,
   6px corners, hairlines instead of cards, and 120–180ms transitions. One accent colour. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin.woff2") format("woff2-variations"), url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-ext.woff2") format("woff2-variations"), url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Noto Sans Arabic", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r-1: 4px; --r-2: 6px; --r-3: 6px; --r-4: 8px; --r-5: 8px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --t-fast: 120ms; --t: 150ms; --t-slow: 180ms;
}

:root {
  --bg: #FFFFFF;
  --side-bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #F4F5F7;
  --surface-3: #F1F2F5;
  --overlay: #FFFFFF;
  --hover: #F1F2F5;
  --press: #E8E9EE;
  --border: #E5E7EB;
  --border-strong: #D4D7DD;
  --text: #18181B;
  --text-2: #3F3F46;
  --muted: #71717A;
  --faint: #A1A1AA;
  --brand: #5E6AD2;
  --brand-hover: #515CC4;
  --brand-text: #5E6AD2;
  --brand-soft: #EEF0FC;
  --brand-ink: #4651B8;
  --on-brand: #FFFFFF;
  --focus: rgba(94, 106, 210, .32);
  --star: #E5A50A;
  --danger: #D1344B;
  --danger-fill: #D93F55;
  --danger-soft: #FCEDEF;
  --warn: #A15C07;
  --warn-soft: #FCF3E0;
  --ok: #1A7F4B;
  --ok-soft: #E8F5EE;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .05);
  --shadow-md: 0 4px 16px rgba(24, 24, 27, .08), 0 1px 2px rgba(24, 24, 27, .04);
  --shadow-lg: 0 16px 48px rgba(24, 24, 27, .14), 0 2px 6px rgba(24, 24, 27, .05);
  --scrim: rgba(24, 24, 27, .32);
  --tip-bg: #27272A;
  --tip-fg: #FAFAFA;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #141518;
  --side-bg: #191A1E;
  --surface: #141518;
  --surface-2: #222328;
  --surface-3: #292B34;
  --overlay: #222328;
  --hover: #292B34;
  --press: #32343F;
  --border: #2C2D33;
  --border-strong: #3B3D46;
  --text: #F4F4F5;
  --text-2: #D4D4D8;
  --muted: #A1A1AA;
  --faint: #6C6E78;
  --brand: #5E6AD2;
  --brand-hover: #6C78E0;
  --brand-text: #9399FF;
  --brand-soft: #292C40;
  --brand-ink: #C5C9FF;
  --on-brand: #FFFFFF;
  --focus: rgba(147, 153, 255, .42);
  --star: #F0B840;
  --danger: #FF7A8A;
  --danger-fill: #D93F55;
  --danger-soft: rgba(255, 122, 138, .13);
  --warn: #F2B455;
  --warn-soft: rgba(242, 180, 85, .13);
  --ok: #4CC38A;
  --ok-soft: rgba(76, 195, 138, .13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .03);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04);
  --scrim: rgba(0, 0, 0, .55);
  --tip-bg: #32343F;
  --tip-fg: #F4F4F5;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #141518;
    --side-bg: #191A1E;
    --surface: #141518;
    --surface-2: #222328;
    --surface-3: #292B34;
    --overlay: #222328;
    --hover: #292B34;
    --press: #32343F;
    --border: #2C2D33;
    --border-strong: #3B3D46;
    --text: #F4F4F5;
    --text-2: #D4D4D8;
    --muted: #A1A1AA;
    --faint: #6C6E78;
    --brand: #5E6AD2;
    --brand-hover: #6C78E0;
    --brand-text: #9399FF;
    --brand-soft: #292C40;
    --brand-ink: #C5C9FF;
    --on-brand: #FFFFFF;
    --focus: rgba(147, 153, 255, .42);
    --star: #F0B840;
    --danger: #FF7A8A;
    --danger-fill: #D93F55;
    --danger-soft: rgba(255, 122, 138, .13);
    --warn: #F2B455;
    --warn-soft: rgba(242, 180, 85, .13);
    --ok: #4CC38A;
    --ok-soft: rgba(76, 195, 138, .13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .03);
    --shadow-lg: 0 20px 56px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04);
    --scrim: rgba(0, 0, 0, .55);
    --tip-bg: #32343F;
    --tip-fg: #F4F4F5;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss03", "calt";
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.012em; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }
* { scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: var(--border-strong); background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }

.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
[dir="rtl"] .icon.is-mirrored { transform: scaleX(-1); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.center { text-align: center; }

/* ---------- brand: symbol + lowercase wordmark + product ("spayot / mail") ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 18px; height: 18px; flex: none; }
.brand-mark .a { fill: var(--brand-text); }
.brand-mark .b { fill: var(--text); }
.brand span b { font-weight: 600; }
.brand span i { font-style: normal; font-weight: 450; color: var(--muted); }
.brand span i::before { content: "/"; margin-inline: 5px; color: var(--faint); font-weight: 400; }
/* The symbol breathing, one bar after the other, is the loading indicator. */
.brand-load .a { animation: brand-pulse 1s ease-in-out infinite; }
.brand-load .b { animation: brand-pulse 1s ease-in-out .5s infinite; }
@keyframes brand-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px; padding: 0 12px; border-radius: var(--r-2); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: 13px; line-height: 1;
  white-space: nowrap; user-select: none; box-shadow: var(--shadow-sm);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
.btn:active { transform: translateY(.5px); box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn .icon { color: var(--muted); }
.btn-primary { background: var(--brand); border-color: transparent; color: var(--on-brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-hover); border-color: transparent; }
.btn-primary .icon, .btn-danger .icon { color: inherit; }
.btn-danger { background: var(--danger-fill); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--danger-fill); border-color: transparent; filter: brightness(.93); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--text); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); box-shadow: none; }
.btn-soft:hover { background: var(--brand-soft); border-color: transparent; filter: brightness(.97); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-lg { height: 36px; padding: 0 16px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--on-brand); border-inline-end-color: transparent; animation: spin .7s linear infinite;
}
.btn:not(.btn-primary):not(.btn-danger).is-loading::after { border-color: var(--text); border-inline-end-color: transparent; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: var(--r-2); border: 0; flex: none;
  background: transparent; color: var(--muted); transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.icon-btn:active { background: var(--press); }
.icon-btn[aria-pressed="true"], .icon-btn.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.icon-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.icon-btn.sm { width: 28px; height: 28px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .row > label, .label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 32px; padding: 0 10px; border-radius: var(--r-2); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { height: auto; min-height: 96px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-inline-end: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23808799' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
[dir="rtl"] .select { background-position: left 10px center; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input.is-invalid { border-color: var(--danger); }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--r-2); background: var(--surface); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.input-group:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.input-group .input, .input-group .select { border: 0; box-shadow: none; background-color: transparent; min-width: 0; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; color: var(--muted); border-inline-start: 1px solid var(--border); white-space: nowrap; font-size: 13.5px; }
.input-group .select { width: auto; border-inline-start: 1px solid var(--border); border-radius: 0; color: var(--text-2); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input, .msg-check input { appearance: none; width: 16px; height: 16px; margin: 0; flex: none; border-radius: var(--r-1); border: 1.5px solid var(--faint); background: var(--surface); cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast); }
.check input:hover, .msg-check input:hover { border-color: var(--brand); }
.check input:checked, .msg-check input:checked { border-color: var(--brand); background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17 19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.check input:indeterminate { border-color: var(--brand); background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E") center / 12px no-repeat; }
.check input:focus-visible, .msg-check input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background var(--t); }
.switch span::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform var(--t) var(--ease); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(14px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-14px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-2); background: var(--surface-2); gap: 2px; }
.seg button { height: 26px; padding: 0 10px; border: 0; border-radius: var(--r-1); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; transition: background var(--t-fast), color var(--t-fast); }
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--overlay); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.alert { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: var(--r-2); font-size: 13px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.alert-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-success { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert .icon { margin-top: 2px; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--r-1); font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); }
.card-pad { padding: 24px; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.kbd { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: var(--r-1); border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-family: var(--font); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; white-space: nowrap; }

/* ---------- avatars: eight deterministic colours, kept small ---------- */
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none; font-size: 10px; font-weight: 600; letter-spacing: .01em; color: #fff; user-select: none; text-transform: uppercase; background: var(--brand); }
.avatar.lg { width: 32px; height: 32px; font-size: 12px; }
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }
.avatar.c0 { background: #5E6AD2; } .avatar.c1 { background: #3B82C4; } .avatar.c2 { background: #2A9D8F; } .avatar.c3 { background: #4A9C5D; }
.avatar.c4 { background: #B7791F; } .avatar.c5 { background: #C8643B; } .avatar.c6 { background: #C2557E; } .avatar.c7 { background: #71717A; }

/* ---------- meter (ratio against a limit) ---------- */
.meter { height: 3px; border-radius: 999px; background: var(--border); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .3s var(--ease); }
.meter.is-warn > i { background: var(--warn); }
.meter.is-danger > i { background: var(--danger); }

/* ---------- toasts ---------- */
.toasts { position: fixed; inset-inline-start: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; align-items: flex-start; pointer-events: none; width: max-content; max-width: calc(100vw - 48px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; min-height: 36px; padding-block: 6px; padding-inline: 12px 6px; border-radius: var(--r-2); background: var(--tip-bg); color: var(--tip-fg); box-shadow: var(--shadow-md); font-size: 13px; font-weight: 500; animation: toast-in var(--t-slow) var(--ease); max-width: min(480px, 100%); }
.toast > span { padding-inline-end: 4px; }
.toast > .icon { color: #8FE3B4; }
.toast.is-error > .icon { color: #FF9AA6; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--t), transform var(--t); }
.toast button { height: 26px; background: rgba(255, 255, 255, .10); border: 0; color: inherit; font-size: 12.5px; font-weight: 600; padding: 0 10px; border-radius: var(--r-2); transition: background var(--t-fast); }
.toast button:hover { background: rgba(255, 255, 255, .20); }
.toast .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; flex: none; opacity: .8; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- dialogs ---------- */
.backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 900; display: grid; place-items: center; padding: 16px; animation: fade var(--t) ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(420px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--overlay); border: 1px solid var(--border); border-radius: var(--r-4); box-shadow: var(--shadow-lg); animation: pop var(--t) var(--ease); }
.modal.wide { width: min(640px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.modal-head { display: flex; align-items: center; gap: 8px; padding-block: 16px 2px; padding-inline: 20px 12px; }
.modal-head h2 { font-size: 14.5px; flex: 1; }
.modal-body { padding: 8px 20px 8px; overflow: auto; display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.modal-body p.muted { color: var(--text-2); line-height: 1.55; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 16px; }

/* ---------- menus ---------- */
.menu { position: fixed; z-index: 950; min-width: 200px; max-width: 320px; max-height: min(440px, calc(100dvh - 16px)); overflow: auto; padding: 4px; background: var(--overlay); border: 1px solid var(--border); border-radius: var(--r-2); box-shadow: var(--shadow-md); animation: menu-in var(--t-fast) var(--ease); transform-origin: top; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 28px; padding: 0 8px; border: 0; background: transparent; border-radius: var(--r-1); text-align: start; font-size: 13px; color: var(--text); transition: background var(--t-fast); }
.menu-item:hover, .menu-item:focus-visible, .menu-item.is-on { background: var(--hover); outline: none; text-decoration: none; }
.menu-item:disabled { opacity: .5; cursor: default; background: transparent; }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover, .menu-item.is-danger:focus-visible { background: var(--danger-soft); }
.menu-item .icon { color: var(--muted); }
.menu-item.is-danger .icon { color: inherit; }
.menu-item .menu-check { margin-inline-start: auto; color: var(--brand-text); }
.menu-item .muted { font-size: 12px; }
.menu-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.menu-label { padding: 6px 8px 4px; font-size: 11.5px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-user { display: flex; align-items: center; gap: 10px; padding: 8px; }
.menu-user b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-user small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-user > div { min-width: 0; }

/* ---------- tooltips ---------- */
.tip { position: fixed; z-index: 1100; display: flex; align-items: center; gap: 8px; max-width: 280px; padding: 4px 8px; border-radius: var(--r-2); background: var(--tip-bg); color: var(--tip-fg); font-size: 12px; font-weight: 500; line-height: 18px; pointer-events: none; box-shadow: var(--shadow-md); animation: tip-in var(--t-fast) ease-out; }
.tip kbd { padding: 0 4px; border-radius: 3px; background: rgba(255, 255, 255, .14); font-family: var(--font); font-size: 11px; font-weight: 600; line-height: 16px; }
@keyframes tip-in { from { opacity: 0; transform: translateY(2px); } }

/* ---------- loading ---------- */
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: spin .7s linear infinite; }
.skeleton { display: block; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-1); }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---------- empty states ---------- */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; padding: 40px 24px; color: var(--muted); min-height: 240px; }
.empty svg.art { width: 40px; height: 40px; margin-bottom: 12px; color: var(--faint); }
.empty h2 { font-size: 14px; color: var(--text); font-weight: 600; }
.empty p { max-width: 32em; font-size: 13px; }

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

/* ---------- a message on screen (shared by the mailbox and the temporary inbox) ---------- */
.banner { display: flex; align-items: center; gap: 8px; margin-top: 16px; min-height: 36px; padding-block: 4px; padding-inline: 12px 4px; border-radius: var(--r-2); background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.banner > .icon { color: var(--muted); }
.banner .spacer { flex: 1; }
.banner.is-warn { padding-inline-end: 12px; background: var(--warn-soft); color: var(--warn); }
.banner.is-warn > .icon { color: inherit; }
.mail-body { margin-top: 20px; }
.mail-body.is-paper { background: #fff; border-radius: var(--r-2); overflow: hidden; }
.mail-frame { display: block; width: 100%; min-height: 80px; border: 0; }
.attachments { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.attachments h3, .attachments-head h3 { font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.attachments > h3 { margin-bottom: 8px; }
.attachments-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-height: 28px; }
.attachments-head h3 { flex: 1; }
.attachments-head h3 span { font-variant-numeric: tabular-nums; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.att { display: flex; align-items: center; gap: 10px; min-width: 0; height: 44px; padding: 0 10px 0 6px; border-radius: var(--r-2); border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: border-color var(--t-fast), background var(--t-fast); }
.att:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.att > .icon { color: var(--faint); transition: color var(--t-fast); }
.att:hover > .icon { color: var(--text); }
.att-icon { width: 32px; height: 32px; border-radius: var(--r-1); display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .03em; overflow: hidden; text-transform: uppercase; }
.att-icon img { width: 100%; height: 100%; object-fit: cover; }
.att-icon.t-pdf { background: var(--danger-soft); color: var(--danger); } .att-icon.t-doc { background: var(--brand-soft); color: var(--brand-text); }
.att-icon.t-xls { background: var(--ok-soft); color: var(--ok); } .att-icon.t-zip { background: var(--warn-soft); color: var(--warn); }
.att-info { flex: 1; min-width: 0; line-height: 1.3; }
.att-name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.btn.is-danger { color: var(--danger); }
.btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.is-danger .icon { color: inherit; }
.when-dark { display: none; }
:root[data-theme="dark"] .when-dark { display: block; } :root[data-theme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .when-dark { display: block; } :root[data-theme="system"] .when-light { display: none; } }
