/* Peep — dark-first webmail UI */

/* Dark: navy with the Peep brand red */
:root, [data-theme="dark"] {
  --bg: #0a0e17;
  --grid: rgba(148, 163, 184, .035);
  --panel: #0d121d;
  --card: #121826;
  --card-2: #171e2e;
  --thead: #1a2131;
  --line: #1e2636;
  --line-2: #2b3549;
  --text: #e6e9ef;
  --text-2: #b1b8c8;
  --muted: #737d92;
  --cyan: #ff3b2b;          /* accent: Peep brand red */
  --green: #4ade80;
  --purple: #8b5cf6;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --pink: #ec4899;
  --orange: #f97316;
  --lavender: #a78bfa;
  --red: #f87171;
  --on-accent: #ffffff;
  --sel: rgba(255, 59, 43, .09);
  --hover: rgba(148, 163, 184, .06);
  --shadow: 0 calc(24px * var(--z)) calc(60px * var(--z)) -12px rgba(0, 0, 0, .65);
  --scrim: rgba(3, 6, 12, .66);
  color-scheme: dark;
}

/* Classic: the original Peep navy with cyan */
[data-theme="classic"] {
  --bg: #0a0e17;
  --grid: rgba(148, 163, 184, .035);
  --panel: #0d121d;
  --card: #121826;
  --card-2: #171e2e;
  --thead: #1a2131;
  --line: #1e2636;
  --line-2: #2b3549;
  --text: #e6e9ef;
  --text-2: #b1b8c8;
  --muted: #737d92;
  --cyan: #22d3ee;
  --green: #4ade80;
  --purple: #8b5cf6;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --pink: #ec4899;
  --orange: #f97316;
  --lavender: #a78bfa;
  --red: #f87171;
  --on-accent: #04161c;
  --sel: rgba(34, 211, 238, .075);
  --hover: rgba(148, 163, 184, .06);
  --shadow: 0 calc(24px * var(--z)) calc(60px * var(--z)) -12px rgba(0, 0, 0, .65);
  --scrim: rgba(3, 6, 12, .66);
  color-scheme: dark;
}

/* Grey: neutral, Gmail-like */
[data-theme="grey"] {
  --bg: #eceef1;
  --grid: transparent;
  --panel: #f6f7f9;
  --card: #ffffff;
  --card-2: #f4f5f7;
  --thead: #e8eaed;
  --line: #dfe1e5;
  --line-2: #c8cbd0;
  --text: #1f1f1f;
  --text-2: #3c4043;
  --muted: #6b6f74;
  --cyan: #3c4043;
  --green: #188038;
  --purple: #6a4bc4;
  --amber: #b06000;
  --blue: #0b57d0;
  --pink: #b3266f;
  --orange: #c5480f;
  --lavender: #6a4bc4;
  --red: #c5221f;
  --on-accent: #ffffff;
  --sel: rgba(60, 64, 67, .09);
  --hover: rgba(60, 64, 67, .05);
  --shadow: 0 calc(18px * var(--z)) calc(50px * var(--z)) -14px rgba(32, 33, 36, .28);
  --scrim: rgba(32, 33, 36, .32);
  color-scheme: light;
}

/* Sky: the classic forum look — pale blue bars, bright blue headers, white cards */
[data-theme="sky"] {
  --bg: #f5f7fa;
  --grid: transparent;
  --panel: #cadceb;
  --card: #ffffff;
  --card-2: #ecf3f7;
  --thead: #1294d8;
  --line: #d1dfea;
  --line-2: #b4c9db;
  --text: #333333;
  --text-2: #47536a;
  --muted: #536482;
  --cyan: #0076b1;
  --green: #2e8b2e;
  --purple: #6a4b9c;
  --amber: #bc7a00;
  --blue: #105289;
  --pink: #b0306a;
  --orange: #c25a10;
  --lavender: #6a4b9c;
  --red: #aa0000;
  --on-accent: #ffffff;
  --sel: rgba(0, 118, 177, .12);
  --hover: rgba(16, 82, 137, .06);
  --shadow: 0 calc(18px * var(--z)) calc(50px * var(--z)) -14px rgba(16, 60, 100, .28);
  --scrim: rgba(16, 40, 70, .35);
  color-scheme: light;
}

/* Light (id "white"): plain white panes, grey lines, Office blue — like Outlook */
[data-theme="white"] {
  --bg: #ffffff;
  --grid: transparent;
  --panel: #f8f8f8;
  --card: #ffffff;
  --card-2: #f3f3f3;
  --thead: #ffffff;
  --line: #e1e1e1;
  --line-2: #c8c8c8;
  --text: #262626;
  --text-2: #444444;
  --muted: #6e6e6e;
  --cyan: #0072c6;
  --green: #107c10;
  --purple: #5c2d91;
  --amber: #986f0b;
  --blue: #106ebe;
  --pink: #b4009e;
  --orange: #ca5010;
  --lavender: #5c2d91;
  --red: #c50f1f;
  --on-accent: #ffffff;
  --sel: #cde6f7;
  --hover: #e5f1fb;
  --shadow: 0 calc(12px * var(--z)) calc(36px * var(--z)) -10px rgba(0, 0, 0, .22);
  --scrim: rgba(0, 0, 0, .3);
  color-scheme: light;
}

/* Cream (id "light"): warm paper + oxblood, like poofa.net */
[data-theme="light"] {
  --bg: #efe9e1;
  --grid: transparent;
  --panel: #f4efe7;
  --card: #faf6ef;
  --card-2: #f3ede3;
  --thead: #ebe4d8;
  --line: #e0d8cb;
  --line-2: #cfc4b3;
  --text: #2a2420;
  --text-2: #4a413a;
  --muted: #857a6e;
  --cyan: #d0150f;
  --green: #3f6b3a;
  --purple: #6b4a7a;
  --amber: #a6782f;
  --blue: #2f5a7a;
  --pink: #9a3355;
  --orange: #a5521f;
  --lavender: #6b4a7a;
  --red: #a3201f;
  --on-accent: #ffffff;
  --sel: rgba(208, 21, 15, .08);
  --hover: rgba(42, 36, 32, .045);
  --shadow: 0 calc(18px * var(--z)) calc(50px * var(--z)) -14px rgba(60, 40, 20, .25);
  --scrim: rgba(42, 36, 32, .35);
  color-scheme: light;
}

:root {
  --z: 1;   /* text size (the A / A / A buttons): every size below is multiplied by it */
  --mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: calc(10px * var(--z));
  --r-sm: calc(6px * var(--z));
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: calc(44px * var(--z)) calc(44px * var(--z));
  color: var(--text);
  font: calc(15px * var(--z))/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
select option, select optgroup { background-color: var(--card); color: var(--text); }   /* the open list of a select (Windows draws it from these; a transparent select left it white) */
a { color: var(--cyan); }
code, pre, .mono { font-family: var(--mono); }
::selection { background: color-mix(in srgb, var(--cyan) 28%, transparent); }
:focus-visible { outline: calc(2px * var(--z)) solid var(--cyan); outline-offset: calc(2px * var(--z)); }
.hidden { display: none !important; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: calc(10px * var(--z)); height: calc(10px * var(--z)); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: calc(10px * var(--z)); border: calc(3px * var(--z)) solid transparent; background-clip: padding-box; }

/* ---------- shared atoms ---------- */

.eyebrow {
  display: flex; align-items: center; gap: calc(12px * var(--z));
  font: 700 calc(11px * var(--z))/1 var(--mono);
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--cyan);
}
.eyebrow::before { content: ""; width: calc(28px * var(--z)); height: 1px; background: currentColor; opacity: .8; flex: none; }
.eyebrow.rule::before { display: none; }
.eyebrow.rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.brand { font: 700 calc(28px * var(--z))/1 var(--mono); letter-spacing: -.02em; margin: 0; color: var(--text); }
.brand .u { color: var(--cyan); }

.muted { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: calc(8px * var(--z));
  height: calc(36px * var(--z)); padding: 0 calc(14px * var(--z));
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--card); color: var(--text);
  font: 600 calc(13.5px * var(--z))/1 var(--sans);
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--card-2); border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); flex: none; }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: var(--on-accent); }
.btn-primary:hover { background: var(--cyan); filter: brightness(1.08); border-color: var(--cyan); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 10%, transparent); border-color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { height: calc(30px * var(--z)); padding: 0 calc(10px * var(--z)); font-size: calc(12.5px * var(--z)); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: calc(34px * var(--z)); height: calc(34px * var(--z)); border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--line); }
.icon-btn.on { color: var(--amber); }
.icon-btn svg { width: calc(18px * var(--z)); height: calc(18px * var(--z)); }

.chip {
  display: inline-flex; align-items: center; gap: calc(6px * var(--z));
  height: calc(26px * var(--z)); padding: 0 calc(10px * var(--z));
  border: 1px solid currentColor; border-radius: calc(4px * var(--z));
  font: 400 calc(12px * var(--z))/1 var(--mono); color: var(--cyan);
  background: color-mix(in srgb, currentColor 7%, transparent);
  white-space: nowrap; max-width: 100%;
}
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip.green { color: var(--green); }
.chip.grey { color: var(--muted); }
.chip.amber { color: var(--amber); }
.chip.purple { color: var(--lavender); }

.pill {
  display: inline-grid; place-items: center;
  min-width: calc(22px * var(--z)); height: calc(18px * var(--z)); padding: 0 calc(7px * var(--z)); border-radius: calc(9px * var(--z));
  font: 700 calc(10.5px * var(--z))/1 var(--mono);
  color: var(--cyan); background: color-mix(in srgb, var(--cyan) 15%, transparent);
}
.pill.dim { color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }

.note {
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
  border-left: calc(3px * var(--z)) solid var(--cyan);
  background: color-mix(in srgb, var(--cyan) 5%, var(--card));
  border-radius: var(--r-sm);
  padding: calc(12px * var(--z)) calc(16px * var(--z));
  font-size: calc(14px * var(--z)); color: var(--text-2);
}
.note b { display: block; font: 700 calc(11.5px * var(--z))/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); margin-bottom: calc(2px * var(--z)); }
.note-danger { border-color: color-mix(in srgb, var(--red) 25%, transparent); border-left-color: var(--red); background: color-mix(in srgb, var(--red) 6%, var(--card)); }
.note-danger b { color: var(--red); }
.note code { font-size: calc(12.5px * var(--z)); color: var(--text); }

.input, .select, .textarea {
  width: 100%; height: calc(38px * var(--z)); padding: 0 calc(12px * var(--z));
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  color: var(--text); font-size: calc(14.5px * var(--z));
}
.textarea { height: auto; padding: calc(10px * var(--z)) calc(12px * var(--z)); line-height: 1.55; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 calc(3px * var(--z)) color-mix(in srgb, var(--cyan) 18%, transparent); }
.select { appearance: none; padding-right: calc(30px * var(--z));
  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='%23737d92' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right calc(10px * var(--z)) center; }

.check { width: calc(16px * var(--z)); height: calc(16px * var(--z)); accent-color: var(--cyan); cursor: pointer; margin: 0; flex: none; }

.spinner { width: calc(18px * var(--z)); height: calc(18px * var(--z)); border: calc(2px * var(--z)) solid var(--line-2); border-top-color: var(--cyan); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.refresh-btn.spin svg { animation: spin .8s linear infinite; animation-delay: var(--spin-at, 0ms); color: var(--cyan); }
.refresh-btn.done svg { color: var(--green, #34d399); animation: tickin .25s ease-out; }
.refresh-btn.err svg { color: var(--red, #f87171); }
@keyframes tickin { from { transform: scale(.6); opacity: .3; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .refresh-btn.spin svg { animation-duration: 2.4s; } }

/* ---------- PIN gate ---------- */

.gate { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px * var(--z)); overflow: auto; height: 100%; }
.gate-card {
  width: min(calc(380px * var(--z)), 100%);
  background: var(--card); border: 1px solid var(--line); border-radius: calc(12px * var(--z));
  border-top: calc(3px * var(--z)) solid var(--cyan);
  padding: calc(32px * var(--z)) calc(28px * var(--z)) calc(26px * var(--z));
  display: grid; gap: calc(16px * var(--z));
  box-shadow: var(--shadow);
}
.gate-card .brand { font-size: calc(40px * var(--z)); margin-bottom: calc(6px * var(--z)); }
.gate-card.gate-wide { width: min(calc(680px * var(--z)), 100%); }
.gate-card .gs-step { display: grid; grid-template-columns: calc(26px * var(--z)) 1fr; gap: calc(10px * var(--z)); align-items: start; font-size: calc(14px * var(--z)); line-height: 1.45; color: var(--text); }
.gate-card .gs-step b { width: calc(24px * var(--z)); height: calc(24px * var(--z)); border-radius: 50%; display: grid; place-items: center; background: var(--cyan); color: var(--bg); font: 700 calc(12px * var(--z)) var(--mono); }
.gate-card code { font: calc(12px * var(--z)) var(--mono); color: var(--text-2); }
.gate-card .code { margin: 0; padding: calc(12px * var(--z)); background: var(--panel); border: 1px solid var(--line); border-radius: calc(6px * var(--z)); font-size: calc(12px * var(--z)); white-space: pre-wrap; word-break: break-all; color: var(--text-2); }
.pin-label { font: 700 calc(11px * var(--z))/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.pin-input {
  height: calc(58px * var(--z)); width: 100%; text-align: center;
  font: 700 calc(28px * var(--z))/1 var(--mono); letter-spacing: .45em;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: calc(8px * var(--z));
}
.pin-input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 calc(3px * var(--z)) color-mix(in srgb, var(--cyan) 18%, transparent); }
.pin-msg { margin: 0; min-height: 1.4em; text-align: center; font: calc(12px * var(--z)) var(--mono); color: var(--amber); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(calc(8px * var(--z))); } }

/* ---------- app layout ---------- */

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--side-w, calc(264px * var(--z))) var(--list-w, calc(400px * var(--z))) minmax(0, 1fr);
  grid-template-areas: "side list read";
}

.side {
  grid-area: side;
  display: flex; flex-direction: column; min-height: 0;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-right: 1px solid var(--line);
}
.side-head { padding: calc(20px * var(--z)) calc(18px * var(--z)) calc(14px * var(--z)); display: grid; gap: calc(16px * var(--z)); }
.side-head .brand { font-size: calc(24px * var(--z)); }
.side-scroll { flex: 1; overflow-y: auto; padding: calc(4px * var(--z)) calc(10px * var(--z)) calc(14px * var(--z)); }
.side-foot { display: flex; gap: calc(4px * var(--z)); padding: calc(10px * var(--z)) calc(12px * var(--z)); border-top: 1px solid var(--line); align-items: center; }
.side-foot .ver { margin-left: auto; font: calc(10.5px * var(--z)) var(--mono); color: var(--muted); }

.acct { margin-top: calc(10px * var(--z)); border-radius: var(--r); }
.acct-head {
  display: flex; align-items: center; gap: calc(10px * var(--z));
  width: 100%; padding: calc(10px * var(--z)) calc(8px * var(--z)) calc(8px * var(--z)); border: 0; background: none; cursor: pointer; text-align: left;
  border-radius: var(--r-sm);
}
.acct-head:hover { background: var(--hover); }
.acct-bar { width: calc(3px * var(--z)); align-self: stretch; border-radius: calc(3px * var(--z)); background: var(--acct, var(--cyan)); flex: none; }
.acct-txt { min-width: 0; flex: 1; }
.acct-name { display: block; font: 700 calc(11px * var(--z))/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--acct, var(--cyan)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-mail { display: block; font-size: calc(12px * var(--z)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-caret { color: var(--muted); transition: transform .15s; flex: none; }
.acct-caret svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); display: block; }
.acct.collapsed .acct-caret { transform: rotate(-90deg); }
.acct.collapsed .folders { display: none; }
.acct-err { margin: calc(2px * var(--z)) calc(8px * var(--z)) calc(6px * var(--z)) calc(21px * var(--z)); font: calc(11px * var(--z))/1.4 var(--mono); color: var(--red); }

.folders { list-style: none; margin: calc(2px * var(--z)) 0 0; padding: 0 0 0 calc(13px * var(--z)); }
.folder {
  display: flex; align-items: center; gap: calc(10px * var(--z));
  height: calc(34px * var(--z)); padding: 0 calc(10px * var(--z)); border-radius: var(--r-sm);
  color: var(--text-2); cursor: pointer; font-size: calc(14.5px * var(--z)); user-select: none;
  border: 1px solid transparent;
}
.folder svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); flex: none; opacity: .85; }
.folder .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder:hover { background: var(--hover); color: var(--text); }
.folder.active { background: var(--sel); color: var(--text); border-color: color-mix(in srgb, var(--cyan) 20%, transparent); }
.folder.active svg { color: var(--cyan); opacity: 1; }
.folder.has-unread .fname { color: var(--text); font-weight: 600; }
.folder.drop-target { border-color: var(--cyan); background: var(--sel); }
.folder.more { font: 700 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); height: calc(30px * var(--z)); }
.folder.more svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); }
.folder.sub { padding-left: calc(22px * var(--z)); font-size: calc(13.5px * var(--z)); }

/* ---------- message list ---------- */

.list {
  grid-area: list; display: flex; flex-direction: column; min-height: 0; min-width: 0;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}
.list-head { padding: calc(18px * var(--z)) calc(16px * var(--z)) calc(10px * var(--z)); display: grid; gap: calc(12px * var(--z)); border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: center; gap: calc(10px * var(--z)); min-width: 0; }
.list-title h2 { margin: 0; font: 700 calc(20px * var(--z))/1.2 var(--mono); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.list-title .count { font: calc(12px * var(--z)) var(--mono); color: var(--muted); white-space: nowrap; }
.search { position: relative; }
.search svg { position: absolute; left: calc(11px * var(--z)); top: 50%; translate: 0 -50%; width: calc(16px * var(--z)); height: calc(16px * var(--z)); color: var(--muted); pointer-events: none; }
.search .input { padding-left: calc(34px * var(--z)); padding-right: calc(34px * var(--z)); }
.search .clear { position: absolute; right: calc(4px * var(--z)); top: 50%; translate: 0 -50%; width: calc(30px * var(--z)); height: calc(30px * var(--z)); }
.toolbar { display: flex; align-items: center; gap: calc(2px * var(--z)); min-height: calc(34px * var(--z)); }
.toolbar .sep { width: 1px; height: calc(20px * var(--z)); background: var(--line); margin: 0 calc(6px * var(--z)); }
.toolbar .grow { flex: 1; }
.toolbar .sel-count { font: calc(12px * var(--z)) var(--mono); color: var(--cyan); margin-left: calc(6px * var(--z)); white-space: nowrap; }

.thead {
  display: grid; grid-template-columns: calc(26px * var(--z)) 1fr auto; gap: calc(10px * var(--z)); align-items: center;
  padding: calc(9px * var(--z)) calc(16px * var(--z)); background: var(--thead); border-bottom: 1px solid var(--line);
  font: 700 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cyan);
}

.rows { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.row {
  position: relative;
  display: grid; grid-template-columns: calc(26px * var(--z)) minmax(0, 1fr) auto; gap: calc(2px * var(--z)) calc(10px * var(--z));
  padding: calc(11px * var(--z)) calc(16px * var(--z)) calc(12px * var(--z)); border-bottom: 1px solid var(--line);
  cursor: pointer; user-select: none;
}
.row:hover { background: var(--hover); }
.row.selected { background: var(--sel); }
.row.selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(3px * var(--z)); background: var(--cyan); }
.row .cb { grid-row: 1 / span 2; display: flex; align-items: flex-start; padding-top: calc(3px * var(--z)); }
.row .from { font-size: calc(14.5px * var(--z)); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .date { font: calc(11.5px * var(--z))/1.9 var(--mono); color: var(--muted); white-space: nowrap; text-align: right; }
.row .subj { font-size: calc(13.5px * var(--z)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .icons { display: flex; gap: calc(6px * var(--z)); justify-content: flex-end; align-items: center; color: var(--muted); }
.row .icons svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); }
.row .icons .flag { color: var(--amber); }
.row.unread .from { color: var(--text); font-weight: 700; }
.row.unread .subj { color: var(--text-2); font-weight: 500; }
.row.unread .from::before { content: ""; display: inline-block; width: calc(7px * var(--z)); height: calc(7px * var(--z)); border-radius: 50%; background: var(--cyan); margin-right: calc(8px * var(--z)); vertical-align: calc(2px * var(--z)); box-shadow: 0 0 calc(8px * var(--z)) color-mix(in srgb, var(--cyan) 60%, transparent); }
.row.checked { background: color-mix(in srgb, var(--cyan) 5%, transparent); }
.row.removing { opacity: .35; pointer-events: none; }

.list-foot { display: flex; align-items: center; gap: calc(8px * var(--z)); padding: calc(8px * var(--z)) calc(12px * var(--z)); border-top: 1px solid var(--line); font: calc(12px * var(--z)) var(--mono); color: var(--muted); }
.list-foot .grow { flex: 1; }
.empty { display: grid; place-items: center; gap: calc(10px * var(--z)); padding: calc(60px * var(--z)) calc(20px * var(--z)); text-align: center; color: var(--muted); font-size: calc(14px * var(--z)); }
.empty svg { width: calc(36px * var(--z)); height: calc(36px * var(--z)); opacity: .5; }
.loading-bar { height: calc(2px * var(--z)); background: linear-gradient(90deg, transparent, var(--cyan), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: lb 1s linear infinite; }
@keyframes lb { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---------- reader ---------- */

.read { grid-area: read; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.read-bar { display: flex; align-items: center; gap: calc(2px * var(--z)); padding: calc(12px * var(--z)) calc(18px * var(--z)); border-bottom: 1px solid var(--line); min-height: calc(59px * var(--z)); }
.read-bar .grow { flex: 1; }
.read-scroll { flex: 1; overflow-y: auto; padding: calc(22px * var(--z)) clamp(calc(14px * var(--z)), 3vw, calc(36px * var(--z))) calc(40px * var(--z)); }
.read-card {
  max-width: calc(980px * var(--z)); margin: 0 auto;
  background: var(--card); border: 1px solid var(--line); border-radius: calc(12px * var(--z));
  border-top: calc(3px * var(--z)) solid var(--acct, var(--cyan));
  overflow: hidden;
}
.read-head { padding: calc(22px * var(--z)) calc(26px * var(--z)) calc(18px * var(--z)); display: grid; gap: calc(14px * var(--z)); border-bottom: 1px solid var(--line); }
.read-subject { margin: 0; font: 600 calc(23px * var(--z))/1.3 var(--sans); letter-spacing: -.01em; overflow-wrap: anywhere; }
.read-meta { display: grid; grid-template-columns: auto 1fr auto; gap: calc(14px * var(--z)); align-items: start; }
.avatar {
  width: calc(42px * var(--z)); height: calc(42px * var(--z)); border-radius: calc(10px * var(--z)); display: grid; place-items: center;
  font: 700 calc(16px * var(--z)) var(--mono); color: var(--acct, var(--cyan));
  background: color-mix(in srgb, var(--acct, var(--cyan)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--acct, var(--cyan)) 35%, transparent);
}
.read-from { min-width: 0; }
.read-from .name { font-weight: 700; font-size: calc(15.5px * var(--z)); }
.read-from .addr { font: calc(12.5px * var(--z)) var(--mono); color: var(--muted); margin-left: calc(6px * var(--z)); overflow-wrap: anywhere; }
.read-from .rcpt { font-size: calc(13px * var(--z)); color: var(--muted); margin-top: calc(2px * var(--z)); overflow-wrap: anywhere; }
.read-from .rcpt b { font: 700 calc(10.5px * var(--z)) var(--mono); letter-spacing: .12em; color: var(--text-2); margin-right: calc(4px * var(--z)); }
.read-date { font: calc(12px * var(--z))/1.6 var(--mono); color: var(--muted); text-align: right; white-space: nowrap; }
.read-tags { display: flex; gap: calc(8px * var(--z)); flex-wrap: wrap; }
.read-body { padding: calc(20px * var(--z)) calc(26px * var(--z)) calc(26px * var(--z)); display: grid; gap: calc(16px * var(--z)); }
.read-body .note { display: flex; gap: calc(14px * var(--z)); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.plain-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: calc(15.5px * var(--z)); line-height: 1.65; color: var(--text); }
.plain-body a { overflow-wrap: anywhere; }
.paper { background: #ffffff; border-radius: calc(8px * var(--z)); padding: calc(6px * var(--z)); }
.paper.inverted { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.mail-frame { display: block; width: 100%; border: 0; min-height: calc(120px * var(--z)); background: transparent; }
.atts { display: flex; flex-wrap: wrap; gap: calc(8px * var(--z)); padding-bottom: calc(12px * var(--z)); margin-bottom: calc(14px * var(--z)); border-bottom: 1px solid var(--line); }
.att { text-decoration: none; height: calc(32px * var(--z)); cursor: pointer; }
.att:hover { filter: brightness(1.2); }
.att svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); flex: none; }
.att .size { opacity: .65; }
.read-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: calc(40px * var(--z)); }
.read-empty .brand { font-size: calc(52px * var(--z)); opacity: .14; }
.read-empty p { font: calc(12px * var(--z)) var(--mono); letter-spacing: .1em; }
.kbd { font: calc(11px * var(--z)) var(--mono); padding: 1px calc(5px * var(--z)); border: 1px solid var(--line-2); border-radius: calc(4px * var(--z)); color: var(--text-2); }

/* ---------- modal / compose / settings ---------- */

.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(calc(3px * var(--z))); z-index: 40; display: grid; place-items: center; padding: calc(20px * var(--z)); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(calc(860px * var(--z)), 100%); max-height: calc(100dvh - calc(40px * var(--z)));
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-top: calc(3px * var(--z)) solid var(--cyan);
  border-radius: calc(12px * var(--z)); box-shadow: var(--shadow); overflow: hidden;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(calc(8px * var(--z))) scale(.99); opacity: 0; } }
.modal-head, .tabs, .modal-foot { flex: none; }
.modal-head { display: flex; align-items: center; gap: calc(10px * var(--z)); padding: calc(14px * var(--z)) calc(16px * var(--z)) calc(14px * var(--z)) calc(22px * var(--z)); border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font: 700 calc(15px * var(--z))/1 var(--mono); letter-spacing: .02em; flex: 1; }
.modal-body { overflow-y: auto; padding: calc(18px * var(--z)) calc(22px * var(--z)); }
.modal-foot { display: flex; gap: calc(8px * var(--z)); align-items: center; padding: calc(12px * var(--z)) calc(16px * var(--z)) calc(12px * var(--z)) calc(22px * var(--z)); border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.modal-foot .grow { flex: 1; }

.compose .modal-body { display: grid; gap: 0; padding: 0; }
.cf-row { display: grid; grid-template-columns: calc(74px * var(--z)) 1fr auto; align-items: center; gap: calc(8px * var(--z)); padding: calc(6px * var(--z)) calc(16px * var(--z)) calc(6px * var(--z)) calc(22px * var(--z)); border-bottom: 1px solid var(--line); }
.cf-row label { font: 700 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); }
.cf-pick { justify-self: start; padding: calc(6px * var(--z)) calc(8px * var(--z)); margin-left: -8px; border: 1px solid transparent; border-radius: var(--r-sm); background: none; cursor: pointer;
  font: 700 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); }
.cf-pick:hover, .cf-pick:focus-visible { border-color: var(--line-2); background: var(--card-2); }
.cf-row .input, .cf-row .select { border-color: transparent; background: transparent; padding: 0 calc(4px * var(--z)); height: calc(36px * var(--z)); }
.cf-row .input:focus, .cf-row .select:focus { box-shadow: none; border-color: transparent; }
.cf-toggles { display: flex; gap: calc(4px * var(--z)); }
.cf-toggles button { background: none; border: 0; font: 700 calc(11px * var(--z)) var(--mono); color: var(--muted); cursor: pointer; padding: calc(4px * var(--z)) calc(6px * var(--z)); border-radius: calc(4px * var(--z)); }
.cf-toggles button:hover { color: var(--cyan); background: var(--hover); }
.cf-body { min-height: calc(300px * var(--z)); height: 44vh; border: 0; border-radius: 0; background: transparent; padding: calc(16px * var(--z)) calc(22px * var(--z)); font-size: calc(15px * var(--z)); resize: none; }
.cf-body:focus { box-shadow: none; }

/* formatted mail: the toolbar and the editor (assets/rich.js; the same file runs in the phone apps) */
.cf-rich { display: flex; flex-direction: column; min-height: calc(300px * var(--z)); height: 48vh; }
.rich-bar { display: flex; flex-wrap: wrap; gap: calc(2px * var(--z)); align-items: center; padding: calc(6px * var(--z)) calc(16px * var(--z)); border-bottom: 1px solid var(--line); background: var(--panel); }
.rich-btn { display: grid; place-items: center; width: calc(32px * var(--z)); height: calc(30px * var(--z)); border: 1px solid transparent; border-radius: var(--r-sm); background: none; color: var(--text-2); cursor: pointer; }
.rich-btn:hover, .rich-btn:focus-visible { background: var(--hover); color: var(--text); }
.rich-btn.on { background: var(--sel); color: var(--cyan); border-color: var(--line-2); }
.rich-sep { width: 1px; height: calc(18px * var(--z)); background: var(--line-2); margin: 0 calc(6px * var(--z)); }
.rich-body { flex: 1; overflow-y: auto; padding: calc(16px * var(--z)) calc(22px * var(--z)); font-size: calc(15px * var(--z)); line-height: 1.5; color: var(--text); outline: none; word-wrap: break-word; overflow-wrap: anywhere; }
.rich-body:empty::before { content: attr(data-placeholder); color: var(--muted); }
.rich-body p { margin: 0; }
.rich-body ul, .rich-body ol { margin: 0; padding-left: calc(28px * var(--z)); }
.rich-body blockquote { margin: 0 0 0 .8ex; border-left: calc(2px * var(--z)) solid var(--line-2); padding-left: 1ex; color: var(--text-2); }
.rich-body a { color: var(--cyan); }
.rich-body img { max-width: 100%; height: auto; border-radius: calc(4px * var(--z)); vertical-align: bottom; }
.rich-body img:hover { outline: calc(2px * var(--z)) solid var(--line-2); }
.sig-rich { border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.sig-rich .cf-rich, .sig-rich { min-height: 0; height: auto; }
.sig-rich .rich-body { min-height: calc(90px * var(--z)); max-height: calc(260px * var(--z)); padding: calc(10px * var(--z)) calc(12px * var(--z)); }
.cf-atts { display: flex; flex-wrap: wrap; gap: calc(8px * var(--z)); padding: calc(10px * var(--z)) calc(22px * var(--z)); border-top: 1px solid var(--line); }
.cf-atts:empty { display: none; }
.cf-atts .chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; display: grid; place-items: center; opacity: .7; }
.cf-atts .chip button:hover { opacity: 1; }
.cf-atts .chip svg { width: calc(12px * var(--z)); height: calc(12px * var(--z)); }
.compose.dragover { border-color: var(--cyan); box-shadow: 0 0 0 calc(3px * var(--z)) color-mix(in srgb, var(--cyan) 30%, transparent), var(--shadow); }

.tabs { display: flex; gap: calc(2px * var(--z)); padding: 0 calc(16px * var(--z)); border-bottom: 1px solid var(--line); background: var(--panel); overflow-x: auto; }
.tab { border: 0; background: none; padding: calc(12px * var(--z)) calc(12px * var(--z)) calc(11px * var(--z)); font: 700 calc(11px * var(--z))/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); cursor: pointer; border-bottom: calc(2px * var(--z)) solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: calc(14px * var(--z)) calc(14px * var(--z)); }
.field { display: grid; gap: calc(6px * var(--z)); grid-column: span 6; min-width: 0; }
.field.s3 { grid-column: span 3; } .field.s2 { grid-column: span 2; } .field.s4 { grid-column: span 4; } .field.s1 { grid-column: span 1; }
.field > span { font: 700 calc(10.5px * var(--z))/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field .hint { font-size: calc(12.5px * var(--z)); color: var(--muted); }
.field-check { display: flex; align-items: center; gap: calc(10px * var(--z)); grid-column: span 6; font-size: calc(14px * var(--z)); color: var(--text-2); cursor: pointer; }
.form-section { grid-column: span 6; margin-top: calc(8px * var(--z)); }

.acct-list { display: grid; gap: calc(10px * var(--z)); }
.acct-card { display: flex; align-items: center; gap: calc(14px * var(--z)); padding: calc(14px * var(--z)) calc(16px * var(--z)); border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); border-left: calc(3px * var(--z)) solid var(--acct); }
.acct-card .t { flex: 1; min-width: 0; }
.acct-card .t b { display: block; font: 700 calc(12px * var(--z))/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--acct); }
.acct-card .t span { font-size: calc(13px * var(--z)); color: var(--muted); overflow-wrap: anywhere; }
.acct-card .chips { display: flex; gap: calc(6px * var(--z)); flex-wrap: wrap; }

.test-res { display: grid; gap: calc(6px * var(--z)); font: calc(12px * var(--z))/1.5 var(--mono); }
.test-res .ok { color: var(--green); }
.test-res .bad { color: var(--red); }
.test-res .login-err { font-family: var(--sans, inherit); line-height: 1.6; }
.test-res .login-err .btn { margin-left: calc(4px * var(--z)); vertical-align: middle; }
.test-res .login-err details { margin-top: calc(4px * var(--z)); color: var(--muted); }
.test-res .login-err summary { cursor: pointer; }
.test-res .login-err code { display: block; white-space: pre-wrap; word-break: break-word; font: calc(11.5px * var(--z))/1.4 var(--mono); }

.dev { display: flex; align-items: center; gap: calc(12px * var(--z)); padding: calc(12px * var(--z)) 0; border-bottom: 1px solid var(--line); font-size: calc(13.5px * var(--z)); }
.dev .t { flex: 1; min-width: 0; }
.dev .t small { display: block; color: var(--muted); font: calc(11.5px * var(--z))/1.6 var(--mono); overflow-wrap: anywhere; }

.swatches { display: flex; gap: calc(8px * var(--z)); flex-wrap: wrap; }
.swatch { width: calc(26px * var(--z)); height: calc(26px * var(--z)); border-radius: calc(6px * var(--z)); border: calc(2px * var(--z)) solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); }

/* ---------- toasts & menus ---------- */

.toasts { position: fixed; left: 50%; bottom: calc(22px * var(--z)); translate: -50% 0; display: grid; gap: calc(8px * var(--z)); z-index: 60; width: min(calc(480px * var(--z)), calc(100% - calc(24px * var(--z)))); }
.toast {
  display: flex; align-items: center; gap: calc(12px * var(--z));
  padding: calc(11px * var(--z)) calc(14px * var(--z)); border-radius: calc(8px * var(--z));
  background: var(--card); border: 1px solid var(--line-2); border-left: calc(3px * var(--z)) solid var(--cyan);
  box-shadow: var(--shadow); font-size: calc(14px * var(--z)); animation: pop .16s ease-out;
}
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
.toast .msg { flex: 1; overflow-wrap: anywhere; }
.toast button { background: none; border: 0; color: var(--cyan); font: 700 calc(12px * var(--z)) var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }

.menu {
  position: fixed; z-index: 50; min-width: calc(200px * var(--z)); max-width: calc(300px * var(--z)); max-height: 60vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line-2); border-radius: calc(8px * var(--z)); box-shadow: var(--shadow); padding: calc(6px * var(--z));
}
.menu button { display: flex; align-items: center; gap: calc(10px * var(--z)); width: 100%; padding: calc(8px * var(--z)) calc(10px * var(--z)); border: 0; background: none; border-radius: calc(5px * var(--z)); cursor: pointer; text-align: left; font-size: calc(14px * var(--z)); color: var(--text-2); }
.menu button:hover { background: var(--hover); color: var(--text); }
.menu button svg { width: calc(15px * var(--z)); height: calc(15px * var(--z)); }
.menu .mh { padding: calc(8px * var(--z)) calc(10px * var(--z)) calc(4px * var(--z)); font: 700 calc(10px * var(--z)) var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.mob-only { display: none !important; }

/* peepd isn't running */
body.has-bar { display: flex; flex-direction: column; height: 100dvh; }
body.has-bar .app { height: auto; flex: 1; min-height: 0; }
.daemon-bar {
  display: flex; align-items: center; gap: calc(10px * var(--z)); flex-wrap: wrap;
  padding: calc(7px * var(--z)) calc(14px * var(--z)); font-size: calc(13px * var(--z)); line-height: 1.4;
  background: color-mix(in srgb, var(--amber) 16%, var(--panel)); color: var(--text);
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line));
}
.daemon-bar > svg { width: calc(17px * var(--z)); height: calc(17px * var(--z)); color: var(--amber); flex: none; }
.daemon-bar .msg { flex: 1 1 calc(320px * var(--z)); min-width: 0; }
.daemon-bar .msg b { margin-right: calc(4px * var(--z)); }
.daemon-bar .btn { flex: none; }

/* Microsoft sign-in in the mailbox form */
.ms-box { grid-column: 1 / -1; }
.ms-box[hidden], .field[hidden] { display: none !important; }
.ms-row { display: flex; align-items: center; gap: calc(12px * var(--z)); flex-wrap: wrap; }
.ms-code { margin-top: calc(10px * var(--z)); padding: calc(14px * var(--z)) calc(16px * var(--z)); border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); display: grid; gap: calc(10px * var(--z)); font-size: calc(14px * var(--z)); }
.ms-code-row { display: flex; align-items: center; gap: calc(10px * var(--z)); flex-wrap: wrap; }
.ms-code-row a.btn { text-decoration: none; }
.ms-code-row b { font: 700 calc(24px * var(--z)) var(--mono); letter-spacing: .12em; color: var(--text); margin-right: calc(6px * var(--z)); }

/* developer console (~) */
.dev-console {
  position: fixed; left: 0; right: 0; top: 0; height: min(46vh, calc(460px * var(--z))); z-index: 90;
  display: flex; flex-direction: column;
  background: #070a10; color: #d6deeb;
  border-bottom: 1px solid #2a3344; box-shadow: 0 calc(10px * var(--z)) calc(30px * var(--z)) rgba(0, 0, 0, .45);
  font: calc(12px * var(--z))/1.5 var(--mono);
}
.dev-head { display: flex; align-items: center; gap: calc(12px * var(--z)); padding: calc(7px * var(--z)) calc(12px * var(--z)); border-bottom: 1px solid #1d2532; }
.dev-head b { font: 700 calc(12px * var(--z)) var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #8fb3ff; }
.dev-state { font-size: calc(11.5px * var(--z)); color: #8b97a8; }
.dev-state.good { color: #5fd38d; }
.dev-state.bad { color: #ffb44c; }
.dev-hint { margin-left: auto; font-size: calc(11px * var(--z)); color: #6b7686; }
.dev-head .btn { color: #d6deeb; }
.dev-head .icon-btn { color: #9aa6b8; }
.dev-list { flex: 1; overflow-y: auto; padding: calc(4px * var(--z)) 0 calc(8px * var(--z)); }
.dev-row { display: grid; grid-template-columns: calc(70px * var(--z)) calc(130px * var(--z)) minmax(0, 1fr) calc(72px * var(--z)); gap: calc(10px * var(--z)); padding: 1px calc(12px * var(--z)); }
.dev-row:hover { background: rgba(255, 255, 255, .04); }
.dev-t { color: #6b7686; }
.dev-src { color: #8fb3ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-msg { white-space: pre-wrap; word-break: break-word; }
.dev-ms { color: #6b7686; text-align: right; }
.dev-row.lv-ok .dev-msg { color: #7fe0a6; }
.dev-row.lv-warn .dev-msg { color: #ffc46b; }
.dev-row.lv-error .dev-msg { color: #ff7b7b; }
.dev-empty { padding: calc(12px * var(--z)); color: #6b7686; }
@media (max-width: 700px) {
  .dev-row { grid-template-columns: calc(62px * var(--z)) minmax(0, 1fr); }
  .dev-src, .dev-ms { display: none; }
  .dev-hint { display: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 1280px) {
  .app { grid-template-columns: var(--side-w, calc(236px * var(--z))) var(--list-w, calc(340px * var(--z))) minmax(0, 1fr); }
}

@media (max-width: 920px) {
  body { font-size: calc(15.5px * var(--z)); }
  .mob-only { display: inline-grid !important; }
  .desk-only { display: none !important; }
  .app { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .list, .read { grid-area: main; border-right: 0; }
  .app.view-list .read { display: none; }
  .app.view-read .list { display: none; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(calc(300px * var(--z)), 86vw); z-index: 30;
    transform: translateX(-102%); transition: transform .2s ease;
    background: var(--panel); box-shadow: var(--shadow);
  }
  .app.side-open .side { transform: none; }
  .side-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 29; }
  .list-head { padding: calc(12px * var(--z)) calc(12px * var(--z)) calc(10px * var(--z)); }
  .row { padding: calc(12px * var(--z)) calc(12px * var(--z)) calc(13px * var(--z)); grid-template-columns: calc(24px * var(--z)) minmax(0, 1fr) auto; }
  .thead { display: none; }
  .read-bar { padding: calc(8px * var(--z)) calc(8px * var(--z)); min-height: calc(52px * var(--z)); }
  .read-scroll { padding: 0 0 calc(30px * var(--z)); }
  .read-card { border-radius: 0; border-left: 0; border-right: 0; }
  .read-head { padding: calc(18px * var(--z)) calc(16px * var(--z)) calc(14px * var(--z)); }
  .read-body { padding: calc(16px * var(--z)) calc(12px * var(--z)) calc(20px * var(--z)); }
  .read-meta { grid-template-columns: auto 1fr; }
  .read-date { grid-column: 2; text-align: left; }
  .scrim { padding: 0; }
  .modal { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; border-left: 0; border-right: 0; }
  .cf-body { height: auto; flex: 1; min-height: 40vh; }
  .cf-rich { height: auto; flex: 1; min-height: 40vh; }
  .compose .modal-body { flex: 1; display: flex; flex-direction: column; }
  .field.s3, .field.s4 { grid-column: span 6; } .field.s2 { grid-column: span 3; } .field.s1 { grid-column: span 3; }
  .toasts { bottom: calc(14px * var(--z)); }
}

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

/* ---------- column dividers ---------- */
.list { position: relative; }
@media (min-width: 921px) { .side { position: relative; } }
.resizer { position: absolute; top: 0; bottom: 0; right: -5px; width: calc(10px * var(--z)); z-index: 6; cursor: col-resize; touch-action: none; outline: none; }
.resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(4px * var(--z)); width: calc(2px * var(--z)); background: transparent; transition: background .12s; }
.resizer:hover::after, .resizer:focus-visible::after { background: color-mix(in srgb, var(--cyan) 55%, transparent); }
.resizer.dragging::after { background: var(--cyan); box-shadow: 0 0 calc(10px * var(--z)) color-mix(in srgb, var(--cyan) 60%, transparent); }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
body.resizing iframe { pointer-events: none; }
@media (max-width: 920px) { .resizer { display: none; } }


/* ---------- theme switch (replaces the wordmark) ---------- */

.theme-btn {
  display: flex; align-items: center; gap: calc(10px * var(--z)); width: 100%;
  height: calc(40px * var(--z)); padding: 0 calc(12px * var(--z));
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--card); color: var(--text); cursor: pointer;
  font: 700 calc(11.5px * var(--z))/1 var(--mono); letter-spacing: .18em; text-transform: uppercase;
  transition: border-color .12s, background .12s;
}
.theme-btn:hover { border-color: var(--cyan); background: var(--card-2); }
.theme-btn svg { width: calc(17px * var(--z)); height: calc(17px * var(--z)); color: var(--cyan); flex: none; }
.theme-btn .theme-name { flex: 1; text-align: left; }
.theme-dots { display: flex; gap: calc(5px * var(--z)); }
.theme-dots i { width: calc(6px * var(--z)); height: calc(6px * var(--z)); border-radius: 50%; background: var(--line-2); }
.theme-dots i.on { background: var(--cyan); }

/* ---------- theme-specific type & shape ---------- */

/* mailbox colors are tuned for dark; ink them down on light backgrounds */
.acct, .acct-card, .read-card, .list-head .eyebrow { --acct-ink: var(--acct, var(--cyan)); }
[data-theme="grey"] .acct, [data-theme="grey"] .acct-card, [data-theme="grey"] .read-card, [data-theme="grey"] .list-head .eyebrow,
[data-theme="light"] .acct, [data-theme="light"] .acct-card, [data-theme="light"] .read-card, [data-theme="light"] .list-head .eyebrow,
[data-theme="sky"] .acct, [data-theme="sky"] .acct-card, [data-theme="sky"] .read-card, [data-theme="sky"] .list-head .eyebrow,
[data-theme="white"] .acct, [data-theme="white"] .acct-card, [data-theme="white"] .read-card, [data-theme="white"] .list-head .eyebrow {
  --acct-ink: color-mix(in srgb, var(--acct, var(--cyan)) 58%, #000);
}
.acct-name, .acct-card .t b, .avatar, .list-head .eyebrow { color: var(--acct-ink); }

[data-theme="sky"] {
  --mono: "Trebuchet MS", "Lucida Grande", Helvetica, Arial, sans-serif;
  --sans: Verdana, "Lucida Grande", Helvetica, Arial, sans-serif;
  --r: calc(7px * var(--z));
  --r-sm: calc(5px * var(--z));
}
[data-theme="sky"] .side { background: #cadceb; border-right-color: #a9c0d4; }
[data-theme="sky"] .side .folder { color: #105289; }
[data-theme="sky"] .side .folder.active { background: #ffffff; border-color: #a9c0d4; color: #105289; }
[data-theme="sky"] .thead { background: linear-gradient(to bottom, #0f8bcc, #12a3eb); color: #ffffff; border-bottom-color: #0076b1; }
[data-theme="sky"] .row { background: #ecf3f7; border-bottom-color: #ffffff; }
[data-theme="sky"] .row:nth-child(even) { background: #e1ebf2; }
[data-theme="sky"] .row:hover { background: #f6f4d0; }
[data-theme="sky"] .row.selected { background: #cfe2f0; }
[data-theme="sky"] .row .from { color: #105289; }
[data-theme="sky"] .row.unread .from { color: #105289; }
[data-theme="sky"] .read-card { border-top: calc(3px * var(--z)) solid #12a3eb; }
[data-theme="sky"] .brand .u { color: #aa0000; }
[data-theme="sky"] .btn-primary { background: linear-gradient(to bottom, #12a3eb, #0076b1); border-color: #0076b1; }
[data-theme="sky"] .modal-head, [data-theme="sky"] .list-head { background: linear-gradient(to bottom, #ffffff, #f5f7fa); }
[data-theme="sky"] a { color: #105289; }

[data-theme="grey"] {
  --mono: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-theme="grey"] .brand { letter-spacing: -.03em; }
[data-theme="grey"] .brand .u { color: #e8291c; }
[data-theme="grey"] .row.unread .from::before { box-shadow: none; }
[data-theme="grey"] .side { background: var(--bg); border-right-color: transparent; }
[data-theme="grey"] .folder.active { background: #d3d6db; border-color: transparent; font-weight: 600; }
[data-theme="grey"] .folder { border-radius: 0 calc(18px * var(--z)) calc(18px * var(--z)) 0; }
[data-theme="grey"] .btn-primary { border-radius: calc(16px * var(--z)); height: calc(44px * var(--z)); }

[data-theme="light"] {
  --mono: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: calc(2px * var(--z));
  --r-sm: calc(2px * var(--z));
}
[data-theme="light"] body {
  background-image: repeating-linear-gradient(176deg, transparent 0 calc(78px * var(--z)), rgba(120, 100, 80, .07) calc(78px * var(--z)) calc(79px * var(--z)));
}
[data-theme="light"] .brand { text-transform: uppercase; letter-spacing: .01em; font-weight: 700; }
[data-theme="light"] .list-title h2 { text-transform: uppercase; font-weight: 700; letter-spacing: .02em; }
[data-theme="light"] .read-subject { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; }
[data-theme="light"] .plain-body { font-family: "Source Serif 4", Georgia, serif; font-size: calc(16.5px * var(--z)); }
[data-theme="light"] .btn { text-transform: uppercase; letter-spacing: .14em; font: 500 calc(12.5px * var(--z))/1 var(--mono); }
[data-theme="light"] .read-card, [data-theme="light"] .modal, [data-theme="light"] .gate-card,
[data-theme="light"] .paper, [data-theme="light"] .toast, [data-theme="light"] .menu { border-radius: calc(3px * var(--z)); }
[data-theme="light"] .read-card { border-top-color: var(--cyan); }
[data-theme="light"] .row.unread .from::before { box-shadow: none; }
[data-theme="light"] .chip { border-radius: calc(2px * var(--z)); }
[data-theme="light"] .row .date, [data-theme="light"] .read-date { letter-spacing: .04em; }


/* ---------- reading pane off (per folder) ---------- */

.list-title h2 { flex: 0 1 auto; }
.list-title .count { margin-left: auto; }
.pane-btn {
  display: inline-flex; align-items: center; gap: calc(6px * var(--z)); height: calc(26px * var(--z)); padding: 0 calc(9px * var(--z)); flex: none;
  border: 1px solid var(--line-2); border-radius: calc(13px * var(--z)); background: transparent; cursor: pointer;
  font: 700 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.pane-btn svg { width: calc(15px * var(--z)); height: calc(15px * var(--z)); }
.pane-btn:hover { color: var(--text); border-color: var(--muted); }
.pane-btn.on { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 45%, transparent); }
@media (min-width: 921px) {
  .app.no-pane { grid-template-columns: var(--side-w, calc(264px * var(--z))) minmax(0, 1fr); grid-template-areas: "side main"; }
  .app.no-pane .list, .app.no-pane .read { grid-area: main; border-right: 0; }
  .app.no-pane.view-list .read, .app.no-pane.view-read .list { display: none; }
  .app.no-pane .list .resizer { display: none; }
  .app.no-pane .read-bar .back-btn { display: inline-grid !important; }
}
.thead.wide, .rows.wide .row { grid-template-columns: calc(26px * var(--z)) minmax(calc(120px * var(--z)), calc(220px * var(--z))) minmax(0, 1fr) auto calc(76px * var(--z)); gap: 0 calc(14px * var(--z)); }
.rows.wide .row { align-items: center; padding: calc(9px * var(--z)) calc(16px * var(--z)); }
.rows.wide .row .cb { grid-row: auto; padding-top: 0; align-items: center; }
.rows.wide .line { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(14px * var(--z)); }
.rows.wide .line .subj { display: inline; font-size: calc(14px * var(--z)); color: var(--text-2); }
.rows.wide .line .prev { color: var(--muted); }
.rows .day-head {
  position: sticky; top: 0; z-index: 1; padding: calc(14px * var(--z)) calc(16px * var(--z)) calc(6px * var(--z)); background: var(--bg);
  font: 700 calc(11px * var(--z))/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--cyan);
  border-bottom: 1px solid var(--line);
}
.rows .day-head:not(:first-child) { margin-top: calc(10px * var(--z)); border-top: 1px solid var(--line); }
.rows .row-gap { height: calc(14px * var(--z)); border-bottom: 1px solid var(--line); background: var(--thead); opacity: .45; }
.rows.wide .row.unread .line .subj { color: var(--text); font-weight: 700; }
.rows.wide .row .date { text-align: right; line-height: 1.4; }
.thead.wide span:last-child { text-align: right; }


/* ---------- grey: dark chrome, light mail area (Gmail-style) ---------- */

[data-theme="grey"] body { background: #2b2d31; }
[data-theme="grey"] .side {
  background: transparent; border-right-color: transparent;
  --text: #e8eaed; --text-2: #d2d5da; --muted: #a3a8ae;
  --line: #3f4247; --line-2: #5a5e64;
  --card: #3a3d42; --card-2: #44474c;
  --hover: rgba(255, 255, 255, .07); --sel: rgba(255, 255, 255, .14);
  --cyan: #f1f3f4; --on-accent: #1f1f1f;
  color-scheme: dark;
}
[data-theme="grey"] .side .acct { --acct-ink: color-mix(in srgb, var(--acct, #8ab4f8) 70%, #fff); }
[data-theme="grey"] .side .folder.active { background: rgba(255, 255, 255, .16); color: #fff; }
[data-theme="grey"] .side .pill { color: #e8eaed; background: rgba(255, 255, 255, .14); }
[data-theme="grey"] .side .pill.dim { color: #c4c7cc; background: rgba(255, 255, 255, .08); }
[data-theme="grey"] .side .btn-primary { background: #fff; border-color: #fff; color: #1f1f1f; box-shadow: 0 1px calc(3px * var(--z)) rgba(0, 0, 0, .35); }
[data-theme="grey"] .side .theme-btn { background: rgba(255, 255, 255, .06); }
[data-theme="grey"] .side .resizer:hover::after { background: rgba(255, 255, 255, .35); }

@media (min-width: 921px) {
  [data-theme="grey"] .list { background: #f8f9fa; margin-top: calc(10px * var(--z)); border-radius: calc(16px * var(--z)) 0 0 0; border-right-color: var(--line); overflow: hidden; }
  [data-theme="grey"] .read { background: #f1f3f4; margin: calc(10px * var(--z)) calc(10px * var(--z)) 0 0; border-radius: 0 calc(16px * var(--z)) 0 0; overflow: hidden; }
  [data-theme="grey"] .app.no-pane .list,
  [data-theme="grey"] .app.no-pane .read { margin-right: calc(10px * var(--z)); border-radius: calc(16px * var(--z)) calc(16px * var(--z)) 0 0; }
  [data-theme="grey"] .list .resizer { right: 0; }
}
@media (max-width: 920px) {
  [data-theme="grey"] .side { background: #2b2d31; }
  [data-theme="grey"] .list, [data-theme="grey"] .read { background: #f8f9fa; }
}


/* ---------- readability fixes (also for browsers without color-mix support) ---------- */

.side, .list, .read, .modal, .menu, .toast { color: var(--text); }
[data-theme="grey"] .side .acct { --acct-ink: var(--acct, #8ab4f8); }
[data-theme="grey"] .side .acct-mail { color: #c4c7cc; }
[data-theme="grey"] .side .folder { color: #e8eaed; }
[data-theme="grey"] .side .folder.more { color: #a3a8ae; }


/* ---------- folders & rules ---------- */

.folder.add { color: var(--muted); font-size: calc(13px * var(--z)); height: calc(30px * var(--z)); }
.folder.add svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); }
.folder.add:hover { color: var(--text); }
.rule-card { gap: calc(10px * var(--z)); flex-wrap: wrap; }
.rule-card .t span { color: var(--text-2); font-size: calc(14px * var(--z)); }
.rule-card.off { opacity: .55; }


/* ---------- grey v2: darker, closer to Gmail ---------- */

[data-theme="grey"] {
  --panel: #dfe1e4; --card: #e8eaed; --card-2: #dcdfe2; --thead: #c7cacf;
  --line: #bcc0c5; --line-2: #a7acb2;
  --text: #1b1c1e; --text-2: #2e3033; --muted: #53575c;
  --hover: rgba(0, 0, 0, .05); --sel: rgba(0, 0, 0, .1);
}
[data-theme="grey"] body { background: #1c1d20; }
[data-theme="grey"] .list, [data-theme="grey"] .read { background: #d0d2d5; }
[data-theme="grey"] .list-head, [data-theme="grey"] .list-foot { background: #d0d2d5; }
[data-theme="grey"] .search .input { background: #e6e8eb; border-color: #b4b8bd; }
[data-theme="grey"] .row { background: #cfd1d4; border-bottom-color: #bcc0c5; }
[data-theme="grey"] .row.unread { background: #e4e6e9; }
[data-theme="grey"] .row:hover { background: #dadcdf; box-shadow: inset 0 1px 0 #a7acb2, inset 0 -1px 0 #a7acb2; }
[data-theme="grey"] .row.selected { background: #c2c6cb; }
[data-theme="grey"] .row.checked { background: #c6d2e1; }
[data-theme="grey"] .read-card { background: #f1f2f4; border-color: #bcc0c5; }
[data-theme="grey"] .read-bar { background: #d0d2d5; }


/* ---------- grey v3: top bars dark like the sidebar ---------- */

[data-theme="grey"] .list, [data-theme="grey"] .read { background: transparent; border-right-color: transparent; margin-top: 0; border-radius: 0; overflow: visible; }
[data-theme="grey"] .list-head, [data-theme="grey"] .read-bar {
  background: transparent; border-bottom-color: transparent; color: var(--text);
  --text: #e8eaed; --text-2: #d2d5da; --muted: #a3a8ae; --line: #3f4247; --line-2: #5a5e64;
  --card: #3a3d42; --card-2: #44474c; --hover: rgba(255, 255, 255, .08); --sel: rgba(255, 255, 255, .14);
  --cyan: #f1f3f4; --on-accent: #1f1f1f; color-scheme: dark;
}
[data-theme="grey"] .list-head .search .input { background: rgba(255, 255, 255, .1); border-color: transparent; color: #e8eaed; border-radius: calc(24px * var(--z)); }
[data-theme="grey"] .list-head .search .input::placeholder { color: #a3a8ae; }
[data-theme="grey"] .list-head .search .input:focus { background: #f1f3f4; color: #1b1c1e; }
[data-theme="grey"] .list-head .eyebrow { --acct-ink: var(--acct, #8ab4f8); }
[data-theme="grey"] .list-head .check { accent-color: #e8eaed; }
[data-theme="grey"] .thead { border-radius: calc(14px * var(--z)) 0 0 0; }
[data-theme="grey"] .rows, [data-theme="grey"] .list-foot, [data-theme="grey"] .read-scroll, [data-theme="grey"] .read-empty { background: #d0d2d5; }
[data-theme="grey"] .read-scroll, [data-theme="grey"] .read-empty { border-radius: 0 calc(14px * var(--z)) 0 0; margin-right: calc(10px * var(--z)); }
@media (min-width: 921px) {
  [data-theme="grey"] .app.no-pane .thead { border-radius: calc(14px * var(--z)) calc(14px * var(--z)) 0 0; }
  [data-theme="grey"] .app.no-pane .thead, [data-theme="grey"] .app.no-pane .rows, [data-theme="grey"] .app.no-pane .list-foot { margin-right: calc(10px * var(--z)); }
  [data-theme="grey"] .app.no-pane .read-scroll { border-radius: calc(14px * var(--z)) calc(14px * var(--z)) 0 0; }
}
@media (max-width: 920px) {
  [data-theme="grey"] .thead, [data-theme="grey"] .read-scroll, [data-theme="grey"] .read-empty { border-radius: 0; margin-right: 0; }
}


/* ---------- grey v4: message header in the dark top band (pane on) ---------- */

[data-theme="grey"] .read-top {
  flex: none; padding: 0 calc(28px * var(--z)) calc(14px * var(--z)) calc(28px * var(--z));
  --text: #e8eaed; --text-2: #d2d5da; --muted: #a3a8ae; --line: #3f4247; --line-2: #5a5e64;
  --card: #3a3d42; --card-2: #44474c; --cyan: #f1f3f4; color: var(--text); color-scheme: dark;
}
[data-theme="grey"] .read-top .read-head { padding: calc(4px * var(--z)) 0 0; border-bottom: 0; gap: calc(10px * var(--z)); }
[data-theme="grey"] .read-top .read-subject { font-size: calc(21px * var(--z)); }
[data-theme="grey"] .read-top .avatar { --acct-ink: var(--acct, #8ab4f8); background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #e8eaed; }
[data-theme="grey"] .read-top .chip.grey { color: #c4c7cc; }
[data-theme="grey"] .read-top + .read-scroll { padding-top: calc(18px * var(--z)); }


/* ---------- message header in the top band, all themes (pane on) ---------- */

.read-top { flex: none; padding: 0 calc(28px * var(--z)) calc(16px * var(--z)); border-bottom: 1px solid var(--line); }
.read-top .read-head { padding: calc(6px * var(--z)) 0 0; border-bottom: 0; gap: calc(10px * var(--z)); }
.read-top .read-subject { font-size: calc(21px * var(--z)); }
.read-top + .read-scroll { padding-top: calc(18px * var(--z)); }
.read.head-top .read-bar { border-bottom-color: transparent; }
[data-theme="grey"] .read-top { border-bottom: 0; }

/* ---------- compact top band (pane on): search beside refresh, reader actions in the header ---------- */
.list-head.compact .toolbar { min-height: calc(38px * var(--z)); }
.list-head.compact .toolbar .search { flex: 1 1 calc(140px * var(--z)); min-width: calc(120px * var(--z)); margin-left: calc(8px * var(--z)); }
.read.head-top .read-top { padding: calc(13px * var(--z)) calc(22px * var(--z)) calc(10px * var(--z)) calc(28px * var(--z)); }
.read.head-top .read-top .read-head { padding: 0; gap: calc(6px * var(--z)); }
.read-subj-row { display: flex; align-items: center; gap: calc(12px * var(--z)); min-height: calc(36px * var(--z)); }
.read-subj-row .read-subject { flex: 1; min-width: 0; line-height: 1.25; }
.read-subj-row .read-tags { flex: none; flex-wrap: nowrap; gap: calc(6px * var(--z)); }
.read-acts, .read-replies { display: flex; align-items: center; gap: calc(2px * var(--z)); flex: none; }
.read-side { display: flex; flex-direction: column; align-items: flex-end; gap: calc(4px * var(--z)); }
.read-replies { margin-right: -6px; }
.read-top .read-from .rcpt { margin-top: 0; line-height: 1.5; }
[data-theme="grey"] .read-top { --hover: rgba(255, 255, 255, .08); --sel: rgba(255, 255, 255, .14); }

/* ===== v1.1: desktop parity (Peep for Windows) ===== */

/* pop-out message window */
.app.popout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "read"; }
.app.popout .side, .app.popout .list { display: none !important; }
.app.popout .read { display: flex !important; grid-area: read; }
.app.popout .back-btn { display: none !important; }

/* menus: contact card + separators */
.menu button.has-sub .ml { flex: 1; }
.menu button.has-sub > svg:last-child { width: calc(13px * var(--z)); height: calc(13px * var(--z)); opacity: .6; }
.menu button.has-sub.open { background: var(--hover); color: var(--text); }
.menu.sub { z-index: 51; }
.menu .msep { height: 1px; background: var(--line); margin: calc(5px * var(--z)) calc(4px * var(--z)); }
.menu .mcard { display: flex; gap: calc(12px * var(--z)); align-items: center; padding: calc(10px * var(--z)) calc(10px * var(--z)) calc(12px * var(--z)); margin-bottom: calc(4px * var(--z)); border-bottom: 1px solid var(--line); }
.menu .mcard .avatar { width: calc(40px * var(--z)); height: calc(40px * var(--z)); flex: none; font-size: calc(15px * var(--z)); }
.menu .mcard .t { min-width: 0; display: grid; gap: 1px; }
.menu .mcard b { font-size: calc(15px * var(--z)); color: var(--text); overflow-wrap: anywhere; }
.menu .mcard span { font: calc(12px * var(--z)) var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.menu .mcard small { font-size: calc(12.5px * var(--z)); color: var(--text-2); overflow-wrap: anywhere; }
.menu:has(.mcard) { max-width: calc(340px * var(--z)); }
.icon-btn.dim { opacity: .35; }

/* clickable people in the reader header */
.person { cursor: pointer; border-radius: calc(3px * var(--z)); }
.person:hover, .person:focus-visible { text-decoration: underline; text-underline-offset: calc(3px * var(--z)); color: var(--text); }
.read-from .person.addr:hover { color: var(--text-2); }
.person-av { cursor: pointer; }
.person-av:hover { filter: brightness(1.15); }

/* server search banner */
.srv-banner { display: flex; align-items: center; gap: calc(10px * var(--z)); padding: calc(9px * var(--z)) calc(16px * var(--z)); font-size: calc(13.5px * var(--z)); color: var(--text-2);
  background: color-mix(in srgb, var(--cyan) 8%, transparent); border-bottom: 1px solid var(--line); }
.srv-banner svg { width: calc(15px * var(--z)); height: calc(15px * var(--z)); color: var(--cyan); flex: none; }
.srv-banner span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-banner button { border: 0; background: none; color: var(--cyan); font: 700 calc(12px * var(--z)) var(--mono); letter-spacing: .06em; cursor: pointer; }

/* address book */
.book-modal { width: min(calc(940px * var(--z)), 100%); height: min(calc(680px * var(--z)), calc(100dvh - calc(40px * var(--z)))); }
.book-modal .modal-head .btn { flex: none; }
.book-modal .modal-head h3 { flex: none; }
.book-modal .modal-head .grow { flex: 1; }
.book-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(calc(240px * var(--z)), calc(320px * var(--z))) minmax(0, 1fr); }
.book-left { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.book-left .search { padding: calc(12px * var(--z)); }
.book-left .search svg { left: calc(23px * var(--z)); }
.book-list { flex: 1; overflow-y: auto; padding: 0 calc(6px * var(--z)) calc(10px * var(--z)); }
.book-row { display: flex; gap: calc(10px * var(--z)); align-items: center; padding: calc(8px * var(--z)) calc(10px * var(--z)); border-radius: calc(8px * var(--z)); cursor: pointer; }
.book-row:hover { background: var(--hover); }
.book-row.selected { background: var(--sel); }
.book-row .avatar, .suggest .avatar { width: calc(32px * var(--z)); height: calc(32px * var(--z)); font-size: calc(12px * var(--z)); border-radius: calc(8px * var(--z)); flex: none; }
.book-row .t, .suggest .t { min-width: 0; display: grid; }
.book-row b, .suggest b { font-size: calc(14px * var(--z)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-row span, .suggest .t span { font: calc(11.5px * var(--z)) var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-form { overflow-y: auto; padding: calc(18px * var(--z)) calc(22px * var(--z)); }
.book-acts { display: flex; gap: calc(8px * var(--z)); margin-top: calc(18px * var(--z)); flex-wrap: wrap; }
.book-acts .grow { flex: 1; }
.book-status { font: calc(11.5px * var(--z)) var(--mono); }
@media (max-width: 920px) {
  .book-body { grid-template-columns: 1fr; grid-template-rows: minmax(calc(160px * var(--z)), 40%) 1fr; }
  .book-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .book-modal { height: 100dvh; }
  .book-modal .modal-head .btn .lbl { display: none; }
  .book-modal .modal-head { gap: calc(6px * var(--z)); padding-left: calc(16px * var(--z)); }
}

/* address suggestions */
.suggest { position: fixed; z-index: 70; background: var(--card); border: 1px solid var(--line-2); border-radius: calc(8px * var(--z)); box-shadow: var(--shadow); padding: calc(5px * var(--z)); max-width: calc(460px * var(--z)); }
.suggest .sg { display: flex; gap: calc(10px * var(--z)); align-items: center; padding: calc(7px * var(--z)) calc(9px * var(--z)); border-radius: calc(6px * var(--z)); cursor: pointer; }
.suggest .sg.on, .suggest .sg:hover { background: var(--sel); }
.suggest .sg-book { margin-left: auto; color: var(--muted); display: inline-flex; }
.suggest .sg-book svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); }
.cf-status { font: calc(11px * var(--z)) var(--mono); }

/* keyboard cheat sheet */
.keys-modal { width: min(calc(880px * var(--z)), 100%); }
.keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: calc(6px * var(--z)) calc(36px * var(--z)); }
.keys-grid .eyebrow { margin: calc(14px * var(--z)) 0 calc(8px * var(--z)); }
.keys-grid > div > .eyebrow:first-child { margin-top: 0; }
.keys { display: grid; grid-template-columns: calc(190px * var(--z)) 1fr; gap: calc(7px * var(--z)) calc(16px * var(--z)); font-size: calc(14px * var(--z)); color: var(--text-2); align-items: center; }
@media (max-width: 920px) { .keys-grid { grid-template-columns: 1fr; } }

/* rules grouped per mailbox */
.rule-group { display: flex; align-items: center; gap: calc(10px * var(--z)); margin-top: calc(8px * var(--z)); padding: calc(2px * var(--z)) calc(2px * var(--z)) 0; }
.rule-group b { font: 700 calc(12px * var(--z)) var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--acct); }
.rule-group span { font-size: calc(13px * var(--z)); }
.rule-group .grow { flex: 1; }
.rule-card .t b { text-transform: none; letter-spacing: 0; font: 600 calc(14px * var(--z)) var(--sans); color: var(--text); }

.search input::-webkit-search-cancel-button { display: none; }

/* ---------- notes ---------- */

.notes { display: none; grid-area: notes; min-width: 0; min-height: 0; flex-direction: column; background: color-mix(in srgb, var(--bg) 80%, transparent); }
.app.notes-mode { grid-template-columns: var(--side-w, calc(264px * var(--z))) minmax(0, 1fr); grid-template-areas: "side notes"; }
.app.notes-mode .list, .app.notes-mode .read { display: none !important; }
.app.notes-mode .notes { display: flex; }
.notes-top { display: flex; align-items: center; gap: calc(8px * var(--z)); }
.notes-top .eyebrow { margin-left: auto; }
.notes-back svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); }
.notes-scroll { padding-top: calc(2px * var(--z)); }
.notes-empty { white-space: pre-line; color: var(--muted); font-size: calc(13.5px * var(--z)); text-align: center; padding: calc(40px * var(--z)) calc(12px * var(--z)); }
.note-row {
  display: grid; gap: calc(3px * var(--z)); width: 100%; text-align: left; padding: calc(9px * var(--z)) calc(12px * var(--z)); margin: 1px 0;
  border: 1px solid transparent; border-radius: calc(8px * var(--z)); background: none; color: var(--text-2); cursor: pointer; font: inherit;
}
.note-row:hover { background: var(--hover); color: var(--text); }
.note-row.active { background: var(--sel); color: var(--text); border-color: color-mix(in srgb, var(--cyan) 20%, transparent); }
.note-row-top { display: flex; align-items: baseline; gap: calc(8px * var(--z)); min-width: 0; }
.note-row-title { flex: 1; min-width: 0; font-weight: 600; font-size: calc(14px * var(--z)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-row-title.auto { font-weight: 500; }
.note-row-date { font: calc(10.5px * var(--z)) var(--mono); color: var(--muted); white-space: nowrap; }
.note-row-snip { display: flex; align-items: center; gap: calc(5px * var(--z)); min-width: 0; font-size: calc(12.5px * var(--z)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-row-mail { display: inline-flex; color: var(--cyan); flex: none; }
.note-row-mail svg { width: calc(12px * var(--z)); height: calc(12px * var(--z)); }
.notes-trash-link { margin-left: auto; height: calc(30px * var(--z)); padding: 0 calc(10px * var(--z)); gap: calc(6px * var(--z)); color: var(--muted); }
.notes-trash-link svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); }
.notes-bar { display: flex; align-items: center; gap: calc(6px * var(--z)); padding: calc(12px * var(--z)) calc(18px * var(--z)); border-bottom: 1px solid var(--line); min-height: calc(59px * var(--z)); }
.notes-bar .grow { flex: 1; }
.notes-status { font: calc(11px * var(--z)) var(--mono); color: var(--muted); letter-spacing: .04em; }
.note-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; container-type: inline-size; }
/* editing: just the text, full width */
.note-split { flex: 1; display: flex; min-height: 0; }
.note-split > .note-body { flex: 1; min-width: 0; }
.note-page { flex: 1; max-width: calc(860px * var(--z)); margin: 0 auto; width: 100%; display: flex; flex-direction: column; padding: calc(26px * var(--z)) clamp(calc(16px * var(--z)), 4vw, calc(48px * var(--z))) calc(30px * var(--z)); }
.note-title {
  border: 0; outline: 0; background: none; color: var(--text); width: 100%;
  font: 600 calc(26px * var(--z))/1.3 var(--sans); letter-spacing: -.01em; padding: calc(4px * var(--z)) 0 calc(10px * var(--z)); border-bottom: 1px solid var(--line);
}
.note-title::placeholder, .note-body::placeholder { color: var(--muted); opacity: .7; }
.note-body {
  flex: 1; min-height: 50vh; border: 0; outline: 0; resize: none; background: none; color: var(--text);
  font: calc(15.5px * var(--z))/1.65 var(--sans); padding: calc(16px * var(--z)) 0 0; tab-size: 4; white-space: pre-wrap;
}
/* formatted notes (Markdown shown formatted) */
.note-md { flex: 1; min-height: 50vh; padding: calc(14px * var(--z)) 0 0; outline: 0; color: var(--text); font: calc(15.5px * var(--z))/1.65 var(--sans); overflow-wrap: anywhere; cursor: text; }
.note-md:focus-visible { box-shadow: none; }
.note-md > :first-child { margin-top: 0; }
.note-md h1, .note-md h2, .note-md h3, .note-md h4, .note-md h5, .note-md h6 { font-family: var(--sans); color: var(--text); line-height: 1.3; margin: 1.1em 0 .45em; }
.note-md h1 { font-size: calc(24px * var(--z)); } .note-md h2 { font-size: calc(20px * var(--z)); } .note-md h3 { font-size: calc(17px * var(--z)); } .note-md h4, .note-md h5, .note-md h6 { font-size: calc(15.5px * var(--z)); }
.note-md p { margin: 0 0 .8em; }
.note-md ul, .note-md ol { margin: 0 0 .8em; padding-left: 1.5em; }
.note-md li { margin: .15em 0; }
.note-md li > ul, .note-md li > ol { margin: .15em 0; }
.note-md li.md-task { list-style: none; margin-left: -1.4em; }
.note-md li.md-task > input { width: calc(16px * var(--z)); height: calc(16px * var(--z)); margin: 0 .45em 0 0; vertical-align: -3px; accent-color: var(--accent); cursor: pointer; }
.note-md li.md-task.done { color: var(--muted); }
.note-md li.md-task.done > input + * , .note-md li.md-task.done { text-decoration-color: var(--muted); }
.note-md a { color: var(--accent); }
.note-md code { font: calc(13.5px * var(--z)) var(--mono); background: var(--card); border: 1px solid var(--line); border-radius: calc(5px * var(--z)); padding: 1px calc(5px * var(--z)); }
.note-md pre { background: var(--card); border: 1px solid var(--line); border-radius: calc(8px * var(--z)); padding: calc(10px * var(--z)) calc(12px * var(--z)); overflow-x: auto; margin: 0 0 .9em; }
.note-md pre code { border: 0; padding: 0; background: none; }
.note-md blockquote { margin: 0 0 .9em; padding: calc(2px * var(--z)) 0 calc(2px * var(--z)) calc(14px * var(--z)); border-left: calc(3px * var(--z)) solid var(--line); color: var(--text-2); }
.note-md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.note-md img { max-width: 100%; height: auto; border-radius: calc(8px * var(--z)); border: 1px solid var(--line); cursor: zoom-in; display: block; margin: .3em 0; }
.note-md .md-table { overflow-x: auto; margin: 0 0 1em; }
.note-md table { border-collapse: collapse; font-size: calc(14.5px * var(--z)); min-width: 50%; }
.note-md th, .note-md td { border: 1px solid var(--line); padding: calc(6px * var(--z)) calc(10px * var(--z)); text-align: left; vertical-align: top; }
.note-md th { background: var(--card); font-weight: 600; }
.note-md-empty { color: var(--muted); }
.note-mail {
  display: flex; align-items: center; gap: calc(8px * var(--z)); margin-top: calc(12px * var(--z)); padding: calc(7px * var(--z)) calc(8px * var(--z)) calc(7px * var(--z)) calc(12px * var(--z)); min-width: 0;
  border: 1px solid var(--line); border-radius: calc(10px * var(--z)); background: var(--card); font-size: calc(13.5px * var(--z)); color: var(--text-2);
}
.note-mail > svg { width: calc(15px * var(--z)); height: calc(15px * var(--z)); color: var(--cyan); flex: none; }
.note-mail-k { font: 700 calc(10px * var(--z)) var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.note-mail-from { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.note-mail-date { font: calc(11px * var(--z)) var(--mono); color: var(--muted); white-space: nowrap; }
.note-mail .grow { flex: 1; }
.note-mail .btn { height: calc(28px * var(--z)); }
.note-mail-off { font-size: calc(12px * var(--z)); color: var(--muted); white-space: nowrap; }
@media (max-width: 920px) {
  .app.notes-mode { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .notes { grid-area: main; }
  .notes-bar { padding: calc(8px * var(--z)); min-height: calc(52px * var(--z)); }
  .note-page { padding: calc(16px * var(--z)) calc(16px * var(--z)) calc(24px * var(--z)); }
  .note-title { font-size: calc(22px * var(--z)); }
}
.note-row-snip-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Peep brand ---------- */
.brand { font-family: var(--sans); font-weight: 700; letter-spacing: -.035em; }
.brand .u { color: var(--cyan); }
[data-theme="light"] .brand { text-transform: none; letter-spacing: -.035em; }
.brand-mark { display: block; width: calc(96px * var(--z)); height: auto; margin: 0 auto calc(10px * var(--z)); }
.gate-card .brand-mark { margin: calc(4px * var(--z)) auto calc(8px * var(--z)); }
.gate-card .brand { text-align: center; }
.read-empty .brand-mark { width: calc(120px * var(--z)); opacity: .55; margin-bottom: calc(4px * var(--z)); }

/* ---------- calendar ---------- */

.cal { display: none; grid-area: notes; min-width: 0; min-height: 0; flex-direction: column; background: color-mix(in srgb, var(--bg) 80%, transparent); }
.app.cal-mode { grid-template-columns: var(--side-w, calc(264px * var(--z))) minmax(0, 1fr); grid-template-areas: "side notes"; }
.app.cal-mode .list, .app.cal-mode .read, .app.cal-mode .notes { display: none !important; }
.app.cal-mode .cal { display: flex; }
.cal-bar { display: flex; align-items: center; gap: calc(6px * var(--z)); padding: calc(12px * var(--z)) calc(18px * var(--z)); border-bottom: 1px solid var(--line); min-height: calc(59px * var(--z)); flex-wrap: wrap; }
.cal-bar .grow { flex: 1; }
.cal-title { margin: 0 0 0 calc(8px * var(--z)); font: 700 calc(20px * var(--z))/1.2 var(--sans); letter-spacing: -.02em; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: calc(9px * var(--z)); overflow: hidden; }
.seg button { background: none; border: 0; color: var(--text-2); font: 600 calc(13px * var(--z)) var(--sans); padding: calc(7px * var(--z)) calc(12px * var(--z)); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--sel); color: var(--text); }
.seg button:hover { color: var(--text); }
.cal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* month */
.month-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.month-head div { padding: calc(8px * var(--z)) calc(10px * var(--z)); font: 700 calc(10.5px * var(--z)) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.month-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); min-height: 0; }
.mcell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: calc(4px * var(--z)) calc(4px * var(--z)) calc(2px * var(--z)); min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: calc(2px * var(--z)); cursor: pointer; }
.mcell:nth-child(7n) { border-right: 0; }
.mcell:hover { background: var(--hover); }
.mcell.out { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.mcell.out .mday { color: var(--muted); opacity: .6; }
.mday { align-self: flex-start; background: none; border: 0; color: var(--text-2); font: 600 calc(12.5px * var(--z)) var(--sans); width: calc(26px * var(--z)); height: calc(24px * var(--z)); border-radius: calc(12px * var(--z)); cursor: pointer; padding: 0; }
.mday:hover { background: var(--hover); color: var(--text); }
.mcell.today .mday { background: var(--cyan); color: var(--on-accent); }
.ev { display: flex; align-items: center; gap: calc(5px * var(--z)); width: 100%; min-width: 0; text-align: left; font: 500 calc(12.5px * var(--z))/1.3 var(--sans); color: var(--text); background: none; border: 0; border-radius: calc(5px * var(--z)); padding: calc(2px * var(--z)) calc(5px * var(--z)); cursor: pointer; }
.ev::before { content: ""; width: calc(7px * var(--z)); height: calc(7px * var(--z)); border-radius: 50%; background: var(--ev); flex: none; }
.ev:hover { background: color-mix(in srgb, var(--ev) 16%, transparent); }
.ev-all { background: color-mix(in srgb, var(--ev) 24%, transparent); }
.ev-all::before { display: none; }
.ev-time { color: var(--muted); font-size: calc(11.5px * var(--z)); flex: none; }
.ev-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ev svg { width: calc(11px * var(--z)); height: calc(11px * var(--z)); flex: none; opacity: .6; }
.ev-maybe { background-image: repeating-linear-gradient(-45deg, transparent 0 calc(5px * var(--z)), color-mix(in srgb, var(--ev) 14%, transparent) calc(5px * var(--z)) calc(10px * var(--z))); }
.more { background: none; border: 0; color: var(--muted); font: 600 calc(11.5px * var(--z)) var(--sans); text-align: left; padding: 1px calc(6px * var(--z)); cursor: pointer; }
.more:hover { color: var(--text); }

/* week / day */
.tv-head, .tv-all { display: grid; grid-template-columns: calc(58px * var(--z)) repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.tv-gutter { font: calc(10.5px * var(--z)) var(--mono); color: var(--muted); text-align: right; padding: calc(6px * var(--z)) calc(8px * var(--z)) 0 0; }
.tv-dh { background: none; border: 0; color: var(--text-2); display: flex; align-items: baseline; justify-content: center; gap: calc(6px * var(--z)); padding: calc(8px * var(--z)) calc(4px * var(--z)); cursor: pointer; border-left: 1px solid var(--line); }
.tv-dh span { font: 700 calc(10.5px * var(--z)) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tv-dh b { font: 600 calc(18px * var(--z)) var(--sans); }
.tv-dh.today b { color: var(--on-accent); background: var(--cyan); border-radius: calc(14px * var(--z)); padding: 0 calc(8px * var(--z)); }
.tv-allcell { border-left: 1px solid var(--line); padding: calc(3px * var(--z)); min-height: calc(30px * var(--z)); display: flex; flex-direction: column; gap: calc(2px * var(--z)); cursor: pointer; }
.tv-scroll { flex: 1; overflow-y: auto; position: relative; }
.tv-grid { position: relative; display: grid; grid-template-columns: calc(58px * var(--z)) repeat(var(--days), minmax(0, 1fr));
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-size: 100% calc(48px * var(--z)); }
.tv-hours { position: relative; }
.tv-hour { position: absolute; right: calc(8px * var(--z)); transform: translateY(-50%); font: calc(10.5px * var(--z)) var(--mono); color: var(--muted); }
.tv-col { position: relative; border-left: 1px solid var(--line); cursor: crosshair; }
.tv-col.today { background: color-mix(in srgb, var(--cyan) 4%, transparent); }
.tv-ev { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; overflow: hidden; text-align: left; cursor: pointer;
  background: color-mix(in srgb, var(--ev) 22%, var(--card)); border: 0; border-left: calc(3px * var(--z)) solid var(--ev); border-radius: calc(6px * var(--z)); padding: calc(3px * var(--z)) calc(6px * var(--z)); color: var(--text); font: calc(12px * var(--z))/1.25 var(--sans); }
.tv-ev:hover { background: color-mix(in srgb, var(--ev) 32%, var(--card)); z-index: 2; }
.tv-ev b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tv-ev span { color: var(--text-2); font-size: calc(11px * var(--z)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tv-ev.short { flex-direction: row; gap: calc(6px * var(--z)); align-items: center; }
.tv-now { position: absolute; left: 0; right: 0; height: calc(2px * var(--z)); background: var(--red); z-index: 3; pointer-events: none; }
.tv-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: calc(10px * var(--z)); height: calc(10px * var(--z)); border-radius: 50%; background: var(--red); }
.tv-ghost { position: absolute; left: calc(2px * var(--z)); right: calc(2px * var(--z)); background: color-mix(in srgb, var(--cyan) 30%, transparent); border: 1px dashed var(--cyan); border-radius: calc(6px * var(--z)); font: 600 calc(11px * var(--z)) var(--sans); padding: calc(3px * var(--z)) calc(6px * var(--z)); pointer-events: none; z-index: 4; }

/* agenda */
.cal-agenda { overflow-y: auto; padding: calc(8px * var(--z)) 0 calc(30px * var(--z)); }
.ag-day { display: grid; grid-template-columns: calc(90px * var(--z)) minmax(0, 1fr); gap: calc(10px * var(--z)); padding: calc(10px * var(--z)) calc(22px * var(--z)); border-bottom: 1px solid var(--line); }
.ag-date { display: flex; flex-direction: column; align-items: flex-start; }
.ag-date b { font: 700 calc(26px * var(--z))/1 var(--sans); letter-spacing: -.03em; }
.ag-date span { font: 700 calc(10.5px * var(--z)) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: calc(4px * var(--z)); }
.ag-day.today .ag-date b { color: var(--cyan); }
.ag-items { display: grid; gap: calc(4px * var(--z)); }
.ag-ev { display: grid; grid-template-columns: calc(80px * var(--z)) calc(4px * var(--z)) minmax(0, 1fr) auto; align-items: center; gap: calc(12px * var(--z)); padding: calc(8px * var(--z)) calc(10px * var(--z)); border-radius: calc(10px * var(--z)); background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.ag-ev:hover { background: var(--hover); }
.ag-time { font: calc(12px * var(--z)) var(--mono); color: var(--muted); }
.ag-bar { width: calc(4px * var(--z)); align-self: stretch; border-radius: calc(2px * var(--z)); background: var(--ev); }
.ag-t { display: grid; min-width: 0; }
.ag-t b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-t small { color: var(--muted); font-size: calc(12.5px * var(--z)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-ev svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); color: var(--muted); }
.ag-more { display: flex; justify-content: center; padding: calc(16px * var(--z)); }

/* calendar sidebar */
.cal-side { padding-top: calc(4px * var(--z)); }
.mini-wrap { padding: calc(4px * var(--z)) calc(6px * var(--z)) calc(10px * var(--z)); }
.mini-head { display: flex; align-items: center; gap: calc(4px * var(--z)); margin-bottom: calc(6px * var(--z)); }
.mini-head b { flex: 1; text-align: center; font-size: calc(14px * var(--z)); }
.mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-dow { font: 700 calc(9.5px * var(--z)) var(--mono); color: var(--muted); text-align: center; padding: calc(4px * var(--z)) 0; letter-spacing: .08em; }
.mini-day { position: relative; aspect-ratio: 1; background: none; border: 0; border-radius: 50%; color: var(--text-2); font: 500 calc(12px * var(--z)) var(--sans); cursor: pointer; padding: 0; }
.mini-day:hover { background: var(--hover); color: var(--text); }
.mini-day.out { color: var(--muted); opacity: .55; }
.mini-day.in { background: color-mix(in srgb, var(--cyan) 7%, transparent); border-radius: 0; }
.mini-day.sel { outline: calc(1.5px * var(--z)) solid var(--cyan); border-radius: 50%; }
.mini-day.today { background: var(--cyan); color: var(--on-accent); border-radius: 50%; }
.mini-day.has::after { content: ""; position: absolute; left: 50%; bottom: calc(3px * var(--z)); width: calc(4px * var(--z)); height: calc(4px * var(--z)); margin-left: -2px; border-radius: 50%; background: var(--cyan); }
.mini-day.today.has::after { background: var(--on-accent); }
.cal-up { margin: calc(10px * var(--z)) calc(8px * var(--z)) calc(6px * var(--z)); }
.up-row { display: grid; grid-template-columns: calc(4px * var(--z)) minmax(0, 1fr); gap: calc(10px * var(--z)); width: 100%; text-align: left; background: none; border: 0; border-radius: calc(8px * var(--z)); padding: calc(7px * var(--z)) calc(8px * var(--z)); color: var(--text); cursor: pointer; font: inherit; }
.up-row:hover { background: var(--hover); }
.up-bar { border-radius: calc(2px * var(--z)); background: var(--ev); }
.up-t { display: grid; min-width: 0; }
.up-t b { font-size: calc(13.5px * var(--z)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-t small { font-size: calc(12px * var(--z)); color: var(--muted); }

/* event details + editor */
.ev-modal { width: min(calc(520px * var(--z)), 100%); }
.evd-head { gap: calc(10px * var(--z)); }
.evd-head h3 { flex: 1; }
.evd-dot { width: calc(14px * var(--z)); height: calc(14px * var(--z)); border-radius: calc(4px * var(--z)); background: var(--ev); flex: none; }
.evd-body { display: grid; gap: calc(14px * var(--z)); }
.evd-row { display: grid; grid-template-columns: calc(20px * var(--z)) minmax(0, 1fr); gap: calc(12px * var(--z)); align-items: start; color: var(--text); }
.evd-row > svg { width: calc(18px * var(--z)); height: calc(18px * var(--z)); color: var(--muted); margin-top: calc(2px * var(--z)); }
.evd-row small { display: block; color: var(--muted); }
.evd-row a { color: var(--cyan); word-break: break-all; }
.evd-notes { white-space: pre-wrap; color: var(--text-2); overflow-wrap: anywhere; }
.evd-notes a { color: var(--cyan); word-break: break-all; }
.evd-people { display: grid; gap: calc(8px * var(--z)); }
.evd-p { display: flex; align-items: center; gap: calc(10px * var(--z)); }
.evd-p .avatar { width: calc(30px * var(--z)); height: calc(30px * var(--z)); font-size: calc(11px * var(--z)); }
.evd-p small { display: block; color: var(--muted); font-size: calc(12px * var(--z)); }
.ps-accepted small { color: var(--green); }
.ps-declined small { color: var(--red); }
.ps-tentative small { color: var(--amber); }
.evd-acts { display: flex; align-items: center; gap: calc(8px * var(--z)); padding: calc(14px * var(--z)) calc(22px * var(--z)) calc(18px * var(--z)); border-top: 1px solid var(--line); flex-wrap: wrap; }
.evd-acts .grow, .modal-foot .grow, .inv-acts .grow { flex: 1; }
.rsvp, .inv-acts { display: flex; align-items: center; gap: calc(6px * var(--z)); flex-wrap: wrap; }
.rsvp > span, .inv-q { font-weight: 600; margin-right: calc(4px * var(--z)); }
.btn.on { background: var(--sel); border-color: var(--cyan); color: var(--text); }
.ev-edit { width: min(calc(640px * var(--z)), 100%); }
.ev-form { display: flex; flex-direction: column; gap: calc(14px * var(--z)); }
.ev-form > .field, .ev-form > .input { grid-column: auto; width: 100%; }
.ev-title-in { font: 600 calc(20px * var(--z)) var(--sans); padding: calc(12px * var(--z)) calc(14px * var(--z)); width: 100%; }
.ev-when { display: flex; flex-wrap: wrap; gap: calc(10px * var(--z)) calc(18px * var(--z)); align-items: center; }
.ev-dt { display: flex; align-items: center; gap: calc(6px * var(--z)); }
.ev-dt .lbl { font: 700 calc(10.5px * var(--z)) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); width: calc(54px * var(--z)); }
.ev-dt .input { width: auto; }
.ev-custom { display: grid; gap: calc(8px * var(--z)); }
.ev-custom:empty { display: none; }
.ev-custom-row { display: flex; align-items: center; gap: calc(8px * var(--z)); flex-wrap: wrap; }
.ev-custom-row .input[type=number] { width: calc(80px * var(--z)); }
.ev-custom-row .select, .ev-custom-row .input[type=date] { width: auto; }
.ev-days { display: flex; gap: calc(6px * var(--z)); flex-wrap: wrap; }
.dchip { position: relative; }
.dchip input { position: absolute; opacity: 0; }
.dchip span { display: inline-grid; place-items: center; width: calc(36px * var(--z)); height: calc(32px * var(--z)); border: 1px solid var(--line); border-radius: calc(8px * var(--z)); font: 600 calc(12.5px * var(--z)) var(--sans); cursor: pointer; }
.dchip input:checked + span { background: var(--cyan); border-color: var(--cyan); color: var(--on-accent); }
.dchip input:focus-visible + span { outline: calc(2px * var(--z)) solid var(--cyan); }
.ev-alarms { display: flex; flex-wrap: wrap; gap: calc(6px * var(--z)); align-items: center; }
.ev-alarms .chip { display: inline-flex; align-items: center; gap: calc(6px * var(--z)); }
.ev-alarms .chip svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); }
.ev-alarms .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: calc(16px * var(--z)); line-height: 1; padding: 0 calc(2px * var(--z)); }
.ev-alarms .add-alarm { width: auto; }
.ev-people { display: grid; gap: calc(6px * var(--z)); }
.ev-people:empty { display: none; }
.ev-person { display: flex; align-items: center; gap: calc(10px * var(--z)); }
.ev-person .avatar { width: calc(30px * var(--z)); height: calc(30px * var(--z)); font-size: calc(11px * var(--z)); }
.ev-person .t { flex: 1; min-width: 0; }
.ev-person small { display: block; color: var(--muted); font-size: calc(12px * var(--z)); }
.ev-colors .swatch.auto { background: conic-gradient(var(--cyan), #8b5cf6, #22c55e, var(--cyan)); }
.ev-status { color: var(--muted); font-size: calc(13px * var(--z)); }

.ask-modal { width: min(calc(420px * var(--z)), 100%); }
.ask-list { display: grid; gap: calc(8px * var(--z)); }

/* invitation card in a message */
.invite { display: grid; gap: calc(12px * var(--z)); margin: 0 0 calc(16px * var(--z)); padding: calc(14px * var(--z)) calc(16px * var(--z)); border: 1px solid var(--line); border-left: calc(3px * var(--z)) solid var(--ev); border-radius: calc(12px * var(--z)); background: var(--card); }
.inv-head { display: grid; grid-template-columns: calc(56px * var(--z)) minmax(0, 1fr); gap: calc(14px * var(--z)); align-items: start; }
.inv-cal { display: grid; place-items: center; width: calc(56px * var(--z)); border: 1px solid var(--line); border-radius: calc(10px * var(--z)); overflow: hidden; background: var(--panel); }
.inv-cal span { width: 100%; text-align: center; background: var(--ev); color: var(--on-accent); font: 700 calc(10.5px * var(--z)) var(--mono); letter-spacing: .12em; text-transform: uppercase; padding: calc(3px * var(--z)) 0; }
.inv-cal b { font: 700 calc(24px * var(--z))/1.4 var(--sans); }
.inv-t { display: grid; gap: calc(2px * var(--z)); min-width: 0; }
.inv-t .eyebrow { margin: 0 0 calc(2px * var(--z)); }
.inv-t b { font-size: calc(17px * var(--z)); }
.inv-t span { color: var(--text-2); font-size: calc(14px * var(--z)); }
.inv-t .muted { color: var(--muted); font-size: calc(13px * var(--z)); }
.inv-state { color: var(--muted); font-size: calc(13px * var(--z)); }
.inv-acts .btn svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); }

@media (max-width: 920px) {
  .app.cal-mode { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .cal { grid-area: main; }
  .cal-bar { padding: calc(8px * var(--z)); }
  .cal-title { font-size: calc(16px * var(--z)); width: 100%; order: 10; margin: calc(4px * var(--z)) 0 0; }
  .month-head div { padding: calc(6px * var(--z)) calc(4px * var(--z)); font-size: calc(9.5px * var(--z)); letter-spacing: .06em; }
  .ev-time, .ev svg { display: none; }
  .ev { font-size: calc(11px * var(--z)); padding: 1px calc(3px * var(--z)); }
  .tv-head, .tv-all, .tv-grid { grid-template-columns: calc(44px * var(--z)) repeat(var(--days), minmax(0, 1fr)); }
  .ag-day { grid-template-columns: calc(56px * var(--z)) minmax(0, 1fr); padding: calc(10px * var(--z)) calc(12px * var(--z)); }
  .ag-ev { grid-template-columns: calc(4px * var(--z)) minmax(0, 1fr) auto; }
  .ag-time { display: none; }
}

/* ---------- grey: calendar like the mail list (dark bar, light page) ---------- */
[data-theme="grey"] .cal { background: transparent; }
[data-theme="grey"] .cal-bar {
  border-bottom-color: transparent; color: var(--text);
  --text: #e8eaed; --text-2: #d2d5da; --muted: #a3a8ae; --line: #5a5e64; --line-2: #6b6f75;
  --card: #3a3d42; --card-2: #44474c; --hover: rgba(255, 255, 255, .08); --sel: rgba(255, 255, 255, .16);
  --cyan: #f1f3f4; --on-accent: #1f1f1f; color-scheme: dark;
}
[data-theme="grey"] .cal-bar .seg button.on { background: rgba(255, 255, 255, .16); color: #fff; }
[data-theme="grey"] .cal-body { background: #d0d2d5; border-radius: calc(14px * var(--z)) calc(14px * var(--z)) 0 0; margin-right: calc(10px * var(--z)); }
[data-theme="grey"] .cal-body .mcell.out { background: rgba(0, 0, 0, .04); }
[data-theme="grey"] .cal-body .tv-ev { background: color-mix(in srgb, var(--ev) 26%, #f1f2f4); }
[data-theme="grey"] .cal-body .tv-ev:hover { background: color-mix(in srgb, var(--ev) 38%, #f1f2f4); }
[data-theme="grey"] .cal-body .mcell.today .mday,
[data-theme="grey"] .cal-body .tv-dh.today b { background: #1f1f1f; color: #fff; }
[data-theme="grey"] .cal-body .ag-day.today .ag-date b { color: #c5221f; }
@media (max-width: 920px) { [data-theme="grey"] .cal-body { border-radius: 0; margin-right: 0; } }

/* ---------- tasks ---------- */
.tasks { display: none; grid-area: notes; min-width: 0; min-height: 0; flex-direction: column; background: color-mix(in srgb, var(--bg) 80%, transparent); }
.app.tasks-mode { grid-template-columns: var(--side-w, calc(264px * var(--z))) minmax(0, 1fr); grid-template-areas: "side notes"; }
.app.tasks-mode .list, .app.tasks-mode .read, .app.tasks-mode .notes, .app.tasks-mode .cal { display: none !important; }
.app.tasks-mode .tasks { display: flex; }
.task-filter.warn .pill { background: var(--red); color: #fff; }
.tasks-body { flex: 1; min-height: 0; overflow-y: auto; }
.tasks-page { max-width: calc(820px * var(--z)); margin: 0 auto; padding: calc(18px * var(--z)) clamp(calc(14px * var(--z)), 4vw, calc(40px * var(--z))) calc(40px * var(--z)); display: flex; flex-direction: column; gap: calc(2px * var(--z)); }
.task-quick { height: calc(44px * var(--z)); font-size: calc(15px * var(--z)); margin-bottom: calc(12px * var(--z)); }
.task-sec { display: flex; align-items: center; gap: calc(8px * var(--z)); margin: calc(16px * var(--z)) calc(4px * var(--z)) calc(6px * var(--z)); }
.task-sec span { font-weight: 600; opacity: .8; }
.task-sec.late { color: var(--red); }
.task-row { display: flex; align-items: flex-start; gap: calc(12px * var(--z)); padding: calc(10px * var(--z)) calc(12px * var(--z)); border-radius: calc(10px * var(--z)); cursor: pointer; color: var(--text); border: 1px solid transparent; }
.task-row:hover { background: var(--hover); }
.task-row:focus-visible { outline: none; border-color: var(--cyan); }
.task-row.compact { padding: calc(6px * var(--z)) calc(8px * var(--z)); gap: calc(9px * var(--z)); }
.task-check {
  flex: none; width: calc(20px * var(--z)); height: calc(20px * var(--z)); margin-top: 1px; border-radius: 50%; border: calc(2px * var(--z)) solid var(--line-2); background: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--on-accent);
}
.task-check:hover { border-color: var(--cyan); }
.task-check.on { background: var(--cyan); border-color: var(--cyan); }
.task-check svg { width: calc(12px * var(--z)); height: calc(12px * var(--z)); stroke-width: 3; }
.task-row.compact .task-check { width: calc(17px * var(--z)); height: calc(17px * var(--z)); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: calc(3px * var(--z)); }
.task-title { font-size: calc(15px * var(--z)); font-weight: 500; overflow-wrap: anywhere; }
.task-row.compact .task-title { font-size: calc(13.5px * var(--z)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: calc(10px * var(--z)); font-size: calc(12.5px * var(--z)); color: var(--muted); }
.task-meta svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); }
.task-due { display: inline-flex; align-items: center; gap: calc(4px * var(--z)); }
.task-due.late { color: var(--red); font-weight: 600; }
.task-bell { display: inline-flex; color: var(--muted); }
.task-mail { display: inline-flex; align-items: center; gap: calc(5px * var(--z)); max-width: calc(280px * var(--z)); background: none; border: 0; padding: 0; color: var(--cyan); font: inherit; cursor: pointer; }
.task-mail span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-mail:hover span { text-decoration: underline; }
.task-notes { font-size: calc(13px * var(--z)); color: var(--text-2); white-space: pre-line; }
.task-hint { margin: -6px 0 calc(4px * var(--z)); font-size: calc(12.5px * var(--z)); color: var(--muted); }
.link-btn { margin-left: auto; background: none; border: 0; color: var(--cyan); font: 600 calc(11px * var(--z)) var(--sans); letter-spacing: 0; text-transform: none; cursor: pointer; padding: 0; }
.cal-up { display: flex; align-items: center; }
/* tasks on the calendar: a tick box, struck through when done */
.ev-tick { flex: none; width: calc(13px * var(--z)); height: calc(13px * var(--z)); border-radius: 50%; border: calc(1.5px * var(--z)) solid var(--ev, var(--cyan)); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; margin-right: calc(3px * var(--z)); vertical-align: -2px; }
.ev-tick.on { background: var(--ev, var(--cyan)); }
.ev-tick svg { width: calc(9px * var(--z)); height: calc(9px * var(--z)); stroke-width: 3.5; color: #fff; }
.ev.ev-task::before { display: none; }
.ev-done .ev-title, .tv-ev.ev-done b, .ag-ev.ev-done b { text-decoration: line-through; opacity: .6; }
.tv-ev.ev-task { border-style: dashed; }
.tv-ev b { display: inline-flex; align-items: center; }
@media (max-width: 920px) {
  .app.tasks-mode { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .tasks { grid-area: main; }
  .tasks-page { padding: calc(12px * var(--z)) calc(12px * var(--z)) calc(30px * var(--z)); }
}
[data-theme="grey"] .tasks { background: transparent; }
[data-theme="grey"] .tasks .cal-bar {
  border-bottom-color: transparent; color: var(--text);
  --text: #e8eaed; --text-2: #d2d5da; --muted: #a3a8ae; --line: #5a5e64; --line-2: #6b6f75;
  --card: #3a3d42; --card-2: #44474c; --hover: rgba(255, 255, 255, .08); --sel: rgba(255, 255, 255, .16);
  --cyan: #f1f3f4; --on-accent: #1f1f1f; color-scheme: dark;
}
[data-theme="grey"] .tasks-body { background: #d0d2d5; border-radius: calc(14px * var(--z)) calc(14px * var(--z)) 0 0; margin-right: calc(10px * var(--z)); }
@media (max-width: 920px) { [data-theme="grey"] .tasks-body { border-radius: 0; margin-right: 0; } }

/* ---------- server check (Settings → Server, welcome) ---------- */
.srv-sum { display: flex; align-items: center; gap: calc(10px * var(--z)); padding: calc(12px * var(--z)) calc(14px * var(--z)); border-radius: calc(10px * var(--z)); font-weight: 600; margin-bottom: calc(14px * var(--z)); }
.srv-sum svg { width: calc(18px * var(--z)); height: calc(18px * var(--z)); flex: none; }
.srv-sum.ok { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--text); }
.srv-sum.ok svg { color: var(--green); }
.srv-sum.warn { background: color-mix(in srgb, var(--amber) 16%, transparent); }
.srv-sum.warn svg { color: var(--amber); }
.srv-sum.bad { background: color-mix(in srgb, var(--red) 14%, transparent); }
.srv-sum.bad svg { color: var(--red); }
.srv-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: calc(4px * var(--z)) calc(16px * var(--z)); margin: 0 0 calc(14px * var(--z)); font-size: calc(13px * var(--z)); }
.srv-facts dt { font: 700 calc(10.5px * var(--z)) var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: calc(2px * var(--z)); }
.srv-facts dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.srv-how { font-size: calc(12.5px * var(--z)); margin: 0 0 calc(8px * var(--z)); }
.srv-checks { display: flex; flex-direction: column; gap: calc(8px * var(--z)); }
.srv-check { display: flex; gap: calc(12px * var(--z)); padding: calc(10px * var(--z)) calc(12px * var(--z)); border: 1px solid var(--line); border-radius: calc(10px * var(--z)); background: var(--card); }
.srv-ic { flex: none; width: calc(22px * var(--z)); height: calc(22px * var(--z)); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.srv-ic svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); stroke-width: 3; }
.st-ok .srv-ic { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.st-warn .srv-ic { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.st-fail .srv-ic { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.st-fail { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.srv-t { flex: 1; min-width: 0; }
.srv-t b { font-size: calc(14px * var(--z)); }
.srv-t p { margin: calc(3px * var(--z)) 0 0; font-size: calc(13px * var(--z)); color: var(--text-2); line-height: 1.45; }
.srv-cmd { position: relative; margin-top: calc(8px * var(--z)); }
.srv-cmd pre { margin: 0; padding: calc(10px * var(--z)) calc(70px * var(--z)) calc(10px * var(--z)) calc(12px * var(--z)); border-radius: calc(8px * var(--z)); background: var(--bg); border: 1px solid var(--line); font: calc(12px * var(--z))/1.5 var(--mono); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.srv-cmd .btn { position: absolute; top: calc(6px * var(--z)); right: calc(6px * var(--z)); height: calc(26px * var(--z)); }
.srv-again { margin-top: calc(12px * var(--z)); }
.welcome { max-width: calc(760px * var(--z)); }
.welcome-lead { margin: 0 0 calc(12px * var(--z)); color: var(--text-2); }
.welcome-pc { margin-top: calc(16px * var(--z)); }
.welcome-pc code { font-size: calc(12px * var(--z)); }

/* ---------- sidebar: settings top-left beside the theme, one bottom row everywhere ---------- */
.side-top { display: flex; align-items: center; gap: calc(8px * var(--z)); min-width: 0; }
.side-top .theme-btn { flex: 1; width: auto; min-width: 0; letter-spacing: .12em; }
.side-top .theme-btn .theme-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-btn { width: calc(40px * var(--z)); height: calc(40px * var(--z)); border: 1px solid var(--line-2); background: var(--card); color: var(--text-2); }
.set-btn:hover { border-color: var(--cyan); color: var(--text); background: var(--card-2); }
.set-btn svg { width: calc(18px * var(--z)); height: calc(18px * var(--z)); }
.notes-top .set-btn { width: calc(34px * var(--z)); height: calc(34px * var(--z)); }
[data-theme="grey"] .side .set-btn { background: rgba(255, 255, 255, .06); }
.side-foot { gap: calc(2px * var(--z)); padding: calc(10px * var(--z)) calc(10px * var(--z)); }
.side-foot .icon-btn.on { color: var(--cyan); background: var(--sel); }

/* lock sits beside settings: the theme button keeps its name (the dots go), the notes / calendar / tasks header stays one line */
.side-top .theme-btn .theme-dots { display: none; }
.notes-top { min-width: 0; }
.notes-top .eyebrow { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.notes-top .eyebrow::before { display: none; }
.side-foot .ver { white-space: nowrap; }

/* Settings → Server: the server's own copy of the mail */
.store-box { margin: 0 0 calc(20px * var(--z)); padding: 0 0 calc(16px * var(--z)); border-bottom: 1px solid var(--line); }
.store-box h4 { margin: 0 0 calc(6px * var(--z)); font-size: calc(14px * var(--z)); }
.store-box > p { margin: 0 0 calc(10px * var(--z)); font-size: calc(13px * var(--z)); }
.store-box .field { max-width: calc(260px * var(--z)); margin-bottom: calc(8px * var(--z)); }
.store-row { display: grid; gap: calc(2px * var(--z)); padding: calc(8px * var(--z)) 0; border-top: 1px solid var(--line); font-size: calc(13px * var(--z)); }
.store-row .muted { font-size: calc(12px * var(--z)); }
.store-bar { height: calc(4px * var(--z)); border-radius: calc(2px * var(--z)); background: var(--line); overflow: hidden; margin: calc(4px * var(--z)) 0 calc(2px * var(--z)); }
.store-bar i { display: block; height: 100%; background: var(--accent); }

/* Light (id "white"): Outlook-style — Segoe UI, square corners, white panes, blue selection */
[data-theme="white"] {
  --mono: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --r: calc(3px * var(--z));
  --r-sm: calc(2px * var(--z));
}
[data-theme="white"] .eyebrow { letter-spacing: .04em; font-weight: 600; }
[data-theme="white"] .eyebrow::before { display: none; }
[data-theme="white"] .brand .u { color: #0072c6; }
[data-theme="white"] .side { background: #f8f8f8; border-right-color: #e1e1e1; }
[data-theme="white"] .side .folder { color: #262626; border-color: transparent; }
[data-theme="white"] .side .folder:hover { background: #e5f1fb; }
[data-theme="white"] .side .folder.active { background: #cde6f7; border-color: transparent; color: #000000; font-weight: 600; }
[data-theme="white"] .thead { background: #ffffff; color: #444444; border-bottom-color: #e1e1e1; letter-spacing: .02em; }
[data-theme="white"] .row { background: #ffffff; border-bottom-color: #ededed; }
[data-theme="white"] .row:hover { background: #e5f1fb; }
[data-theme="white"] .row.selected { background: #cde6f7; }
[data-theme="white"] .row.unread .from { color: #262626; font-weight: 700; }
[data-theme="white"] .row.unread .subj { color: #0072c6; font-weight: 600; }
[data-theme="white"] .row.unread .from::before { box-shadow: none; }
[data-theme="white"] .btn-primary { background: #0072c6; border-color: #0072c6; color: #ffffff; }
[data-theme="white"] .btn-primary:hover { background: #106ebe; border-color: #106ebe; }
[data-theme="white"] .read-card { border-top: 0; box-shadow: none; }
[data-theme="white"] .modal-head { background: #106ebe; color: #ffffff; border-bottom-color: #106ebe; }
[data-theme="white"] .modal-head .icon-btn { color: #ffffff; }
[data-theme="white"] .chip { border-radius: calc(2px * var(--z)); }
[data-theme="white"] a { color: #0072c6; }

/* To / Cc / Bcc picker */
.addr-pick { width: min(calc(560px * var(--z)), calc(100vw - calc(32px * var(--z)))); max-height: min(calc(640px * var(--z)), calc(100vh - calc(48px * var(--z)))); display: flex; flex-direction: column; }
.ap-search { display: grid; gap: calc(8px * var(--z)); padding: calc(12px * var(--z)) calc(16px * var(--z)); border-bottom: 1px solid var(--line); }
.ap-scope { font-size: calc(13px * var(--z)); }
.ap-list { flex: 1; min-height: calc(160px * var(--z)); overflow: auto; padding: calc(4px * var(--z)) calc(8px * var(--z)) calc(8px * var(--z)); }
.ap-head { font: 700 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: calc(12px * var(--z)) calc(8px * var(--z)) calc(6px * var(--z)); }
.ap-row { display: grid; grid-template-columns: auto calc(32px * var(--z)) minmax(0, 1fr) auto; align-items: center; gap: calc(10px * var(--z)); padding: calc(6px * var(--z)) calc(8px * var(--z)); border-radius: var(--r-sm); cursor: pointer; }
.ap-row:hover { background: var(--hover); }
.ap-row:has(input:checked:not(:disabled)) { background: var(--sel); }
.ap-row.on { opacity: .6; cursor: default; }
.ap-row .avatar { width: calc(32px * var(--z)); height: calc(32px * var(--z)); font-size: calc(12px * var(--z)); }
.ap-row .t { min-width: 0; display: grid; }
.ap-row .t b, .ap-row .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-row .t span { font-size: calc(12.5px * var(--z)); color: var(--muted); }
.ap-note { font-size: calc(12px * var(--z)); }

/* colour categories */
.cats { display: inline-flex; gap: calc(4px * var(--z)); align-items: center; min-width: 0; }
.cat { display: inline-flex; align-items: center; gap: calc(4px * var(--z)); max-width: calc(120px * var(--z)); padding: 1px calc(6px * var(--z)) 1px calc(4px * var(--z)); border-radius: calc(9px * var(--z)); cursor: pointer;
  background: color-mix(in srgb, var(--cat) 18%, transparent); color: var(--text-2); font-size: calc(11px * var(--z)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat i { width: calc(8px * var(--z)); height: calc(8px * var(--z)); border-radius: 50%; background: var(--cat); flex: none; }
.cats:not(.big) .cat:only-child { }
.cats .cat:hover { background: color-mix(in srgb, var(--cat) 30%, transparent); }
.cats.big .cat { font-size: calc(12px * var(--z)); padding: calc(3px * var(--z)) calc(9px * var(--z)) calc(3px * var(--z)) calc(7px * var(--z)); max-width: calc(200px * var(--z)); }
.menu .mdot { width: calc(12px * var(--z)); height: calc(12px * var(--z)); border-radius: calc(3px * var(--z)); background: var(--dot); flex: none; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.menu .mdot.on::after { content: ""; position: absolute; left: calc(3.5px * var(--z)); top: 1px; width: calc(3px * var(--z)); height: calc(7px * var(--z)); border: solid #fff; border-width: 0 calc(2px * var(--z)) calc(2px * var(--z)) 0; transform: rotate(45deg); }

.wide-set, .cat-editor { margin-top: calc(22px * var(--z)); padding-top: calc(16px * var(--z)); border-top: 1px solid var(--line); }
.set-h { margin: 0 0 calc(6px * var(--z)); font-size: calc(14px * var(--z)); grid-column: 1 / -1; }
.cat-editor > p { margin: 0 0 calc(10px * var(--z)); font-size: calc(13px * var(--z)); }
.cat-row { display: grid; grid-template-columns: calc(30px * var(--z)) minmax(0, calc(320px * var(--z))) auto; gap: calc(8px * var(--z)); align-items: center; margin-bottom: calc(6px * var(--z)); }
.cat-swatch { width: calc(28px * var(--z)); height: calc(28px * var(--z)); border-radius: calc(6px * var(--z)); border: 1px solid var(--line-2); cursor: pointer; }
.cat-actions { display: flex; gap: calc(8px * var(--z)); margin-top: calc(8px * var(--z)); }

/* undo send / scheduled */
.toast.undo { display: flex; align-items: center; gap: calc(10px * var(--z)); }
.toast.undo svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); flex: none; }
.sched-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: calc(12px * var(--z)); align-items: center; padding: calc(12px * var(--z)) calc(4px * var(--z)); border-bottom: 1px solid var(--line); }
.sched-row .t { display: grid; gap: calc(2px * var(--z)); min-width: 0; }
.sched-row .t b, .sched-row .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-row .t span { font-size: calc(13px * var(--z)); color: var(--muted); }
.sched-row .when { display: inline-flex; align-items: center; gap: calc(5px * var(--z)); color: var(--cyan) !important; font-weight: 600; }
.sched-row .when svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); }
.sched-row .err { color: var(--red) !important; white-space: normal !important; }
.sched-row.unsure .err { color: var(--amber, #f59e0b) !important; }
.sched-row .acts { display: flex; gap: calc(6px * var(--z)); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sched .empty { display: grid; justify-items: center; gap: calc(8px * var(--z)); padding: calc(30px * var(--z)); color: var(--muted); }

/* conversation view */
.conv-n { display: inline-block; margin-left: calc(6px * var(--z)); padding: 0 calc(6px * var(--z)); border-radius: calc(8px * var(--z)); background: var(--card-2); border: 1px solid var(--line); color: var(--muted); font-size: calc(11px * var(--z)); font-weight: 700; vertical-align: 1px; }
.conv { margin: 0 0 calc(14px * var(--z)); border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overflow: hidden; }
.conv-h { display: flex; align-items: center; gap: calc(8px * var(--z)); padding: calc(9px * var(--z)) calc(14px * var(--z)); font: 700 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.conv-h svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); }
.conv-row { display: grid; grid-template-columns: calc(130px * var(--z)) minmax(0, 1fr) auto; gap: calc(10px * var(--z)); align-items: center; width: 100%; padding: calc(8px * var(--z)) calc(14px * var(--z)); border: 0; border-bottom: 1px solid var(--line);
  background: none; color: var(--text-2); font-size: calc(13px * var(--z)); text-align: left; cursor: pointer; }
.conv-row:last-child { border-bottom: 0; }
.conv-row:hover { background: var(--hover); }
.conv-row.on { background: var(--sel); color: var(--text); cursor: default; }
.conv-row.unread .who { font-weight: 700; color: var(--text); }
.conv-row .who, .conv-row .snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-row .snip { color: var(--muted); }
.conv-row .date { color: var(--muted); font-size: calc(12px * var(--z)); }

/* Settings → Backups */
.bk > p { font-size: calc(13px * var(--z)); margin: calc(6px * var(--z)) 0 calc(10px * var(--z)); }
.bk .set-h { margin-top: calc(18px * var(--z)); }
.bk-acts { display: flex; gap: calc(8px * var(--z)); flex-wrap: wrap; margin: calc(12px * var(--z)) 0 calc(4px * var(--z)); }
.bk-files { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-sm); }
.bk-files > p { margin: calc(10px * var(--z)) calc(12px * var(--z)); }
.bk-file { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: calc(8px * var(--z)); align-items: center; padding: calc(8px * var(--z)) calc(10px * var(--z)); border-bottom: 1px solid var(--line); }
.bk-file:last-child { border-bottom: 0; }
.bk-file .t { display: grid; min-width: 0; }
.bk-file .t span { font-size: calc(12.5px * var(--z)); color: var(--muted); }

/* ---- encryption ---- */
.crypto-lock .ic { opacity: .8; }
.crypto-lock.on { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.crypto-lock.off { color: var(--muted); }
.crypto-lock.warn { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.enc { display: flex; flex-direction: column; gap: calc(14px * var(--z)); }
.enc-card { border: 1px solid var(--line); border-left: calc(3px * var(--z)) solid var(--acct, var(--accent)); border-radius: var(--r); padding: calc(14px * var(--z)) calc(16px * var(--z)); display: flex; flex-direction: column; gap: calc(10px * var(--z)); }
.enc-head { display: flex; gap: calc(10px * var(--z)); align-items: baseline; flex-wrap: wrap; }
.enc-row { display: flex; gap: calc(8px * var(--z)); align-items: center; flex-wrap: wrap; }
.enc-k { flex: 1 1 calc(260px * var(--z)); display: flex; flex-direction: column; gap: calc(2px * var(--z)); min-width: 0; }
.enc-k .mono { font-family: var(--mono, monospace); font-size: calc(11.5px * var(--z)); word-break: break-all; }
.enc-import { display: flex; flex-direction: column; gap: calc(8px * var(--z)); padding: calc(10px * var(--z)); background: var(--card); border-radius: var(--r-sm); }
.enc-import.hidden { display: none; }
.enc-peers { display: flex; flex-direction: column; gap: calc(4px * var(--z)); }
.enc-peer { display: flex; gap: calc(8px * var(--z)); align-items: center; padding: calc(4px * var(--z)) 0; border-bottom: 1px solid var(--line); }
.enc-add { display: flex; gap: calc(8px * var(--z)); align-items: flex-start; }
.enc-add textarea { flex: 1; }

/* setup page (lib/install_page.php) */
.ins { display: grid; gap: calc(14px * var(--z)); }
.ins .ins-step { display: grid; gap: calc(12px * var(--z)); padding-top: calc(14px * var(--z)); border-top: 1px solid var(--line); }
.ins .ins-step.ins-past .ins-choice .btn:not(.btn-primary) { opacity: .5; }
.ins-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(6px * var(--z)); font-size: calc(14px * var(--z)); }
.ins-checks li { display: grid; grid-template-columns: calc(22px * var(--z)) 1fr; gap: calc(8px * var(--z)); align-items: start; color: var(--text-2); }
.ins-checks li b { color: var(--text); font-weight: 600; }
.ins-checks i, .ins-done i, .ins-push i { font-style: normal; font: 700 calc(13px * var(--z))/calc(22px * var(--z)) var(--mono); text-align: center; }
.ins-ok i, .ins-done i, .ins-push.on i { color: var(--green, #22c55e); }
.ins-warn i { color: var(--amber, #f59e0b); }
.ins-fail i { color: var(--red); }
.ins-choice { display: flex; flex-wrap: wrap; gap: calc(8px * var(--z)); }
.ins-pins { display: grid; grid-template-columns: 1fr 1fr; gap: calc(10px * var(--z)); }
.ins-pins .pin-input { font-size: calc(18px * var(--z)); letter-spacing: .3em; }
.ins-pins .pin-input::placeholder { font-size: calc(13px * var(--z)); letter-spacing: normal; }
.ins-small { font-size: calc(13px * var(--z)); line-height: 1.5; margin: calc(6px * var(--z)) 0; }
.ins-code { position: relative; }
.ins-code .code { padding-right: calc(70px * var(--z)) !important; }
.ins-copy { position: absolute; top: calc(6px * var(--z)); right: calc(6px * var(--z)); height: calc(28px * var(--z)); padding: 0 calc(10px * var(--z)); font-size: calc(12px * var(--z)); }
.ins-list { margin: 0; padding-left: calc(22px * var(--z)); font-size: calc(14px * var(--z)); line-height: 1.7; color: var(--text); }
.ins-done { display: flex; gap: calc(8px * var(--z)); align-items: center; margin: 0; font-size: calc(14px * var(--z)); color: var(--text); }
.ins-push { display: flex; gap: calc(8px * var(--z)); align-items: center; margin: calc(4px * var(--z)) 0; font-size: calc(13.5px * var(--z)); color: var(--muted); }
.ins-push.on { color: var(--text); }
.ins-later { text-align: center; }
@media (max-width: 520px) { .ins-pins { grid-template-columns: 1fr; } }
.ins [hidden] { display: none !important; }

/* ---------- reading pane narrower than its header wants (e.g. 1000–calc(1100px * var(--z)) window with the list showing) ----------
   the subject keeps room for words (the buttons drop to their own line), and sender / date stack, as on phones */
.read { container: readpane / inline-size; }
.read-head { grid-template-columns: minmax(0, 1fr); }
.read-subj-row, .read-meta { min-width: 0; }
.read-subj-row { flex-wrap: wrap; }
.read-subj-row .read-subject { flex: 1 1 calc(240px * var(--z)); }
@container readpane (max-width: 620px) {
  .read-meta { grid-template-columns: auto minmax(0, 1fr); }
  .read-meta > .read-side, .read-meta > .read-date { grid-column: 2; align-items: flex-start; text-align: left; }
  .read-top, .read.head-top .read-top { padding-left: calc(16px * var(--z)); padding-right: calc(12px * var(--z)); }
}
/* phones: the reader's button row fits calc(375px * var(--z)) (it was calc(29px * var(--z)) too wide and scrolled the page sideways) */
@media (max-width: 420px) {
  .read-bar { gap: 0; padding-left: calc(4px * var(--z)); padding-right: calc(4px * var(--z)); overflow-x: auto; scrollbar-width: none; }
  .read-bar .icon-btn { width: calc(32px * var(--z)); }
}
/* month view, narrow days (a 1000–calc(1200px * var(--z)) window): the time goes, the title gets the room and up to two lines
   (the full title and time are on hover, and one click opens the event) */
.mcell { container: mcell / inline-size; }
@container mcell (max-width: 130px) {
  .ev { gap: calc(4px * var(--z)); padding: 1px calc(3px * var(--z)); font-size: calc(12px * var(--z)); align-items: flex-start; }
  .ev::before { margin-top: calc(4px * var(--z)); }
  .ev-time, .ev svg { display: none; }
  .ev-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.25; }
}

/* the reader's Back: a labelled pill (chevron + the folder's name), with a divider before Reply / Reply all / Forward,
   so it can't be mistaken for Reply's arrow */
.read-bar .back-btn {
  grid-auto-flow: column; align-items: center; gap: calc(4px * var(--z));
  height: calc(32px * var(--z)); max-width: calc(170px * var(--z)); padding: 0 calc(12px * var(--z)) 0 calc(6px * var(--z)); margin-right: calc(19px * var(--z)); position: relative;
  border: 1px solid var(--line); border-radius: calc(999px * var(--z)); background: var(--card); color: var(--text);
  font: 500 calc(13px * var(--z))/1 var(--sans); cursor: pointer; flex: none;
}
.read-bar .back-btn:hover { background: var(--hover); border-color: var(--text-2); }
.read-bar .back-btn svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); }
.read-bar .back-btn .back-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.read-bar .back-btn::after { content: ''; position: absolute; right: -11px; top: calc(4px * var(--z)); bottom: calc(4px * var(--z)); width: 1px; background: var(--line); }
@media (max-width: 420px) {
  .read-bar .back-btn { width: calc(32px * var(--z)); padding: 0; justify-content: center; margin-right: calc(13px * var(--z)); }
  .read-bar .back-btn .back-label { display: none; }
  .read-bar .back-btn::after { right: -8px; }
}

/* ---------- reminders ---------- */
.rem-modal { width: min(calc(600px * var(--z)), 100%); }
.rem-modal .modal-head > svg { width: calc(18px * var(--z)); height: calc(18px * var(--z)); color: var(--cyan); flex: none; }
.rem-modal .modal-head h3 { flex: none; }
.rem-count { flex: 1; color: var(--muted); font: 400 calc(12px * var(--z))/1 var(--mono); }
.rem-body { display: grid; gap: calc(10px * var(--z)); padding: calc(14px * var(--z)) calc(16px * var(--z)) calc(18px * var(--z)); overflow-y: auto; max-height: min(70vh, calc(640px * var(--z))); }
.rem-body .empty { display: grid; justify-items: center; gap: calc(8px * var(--z)); padding: calc(40px * var(--z)) 0; color: var(--muted); }
.rem-h { font: 700 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); margin: calc(6px * var(--z)) calc(2px * var(--z)) 0; }
.rem-card { border: 1px solid var(--line); border-radius: calc(10px * var(--z)); background: var(--card); padding: calc(12px * var(--z)) calc(14px * var(--z)); display: grid; gap: calc(10px * var(--z)); }
.rem-card.ahead { opacity: .85; }
.rem-top { display: grid; grid-template-columns: calc(20px * var(--z)) minmax(0, 1fr) auto; gap: calc(12px * var(--z)); align-items: start; }
.rem-top > svg { width: calc(18px * var(--z)); height: calc(18px * var(--z)); margin-top: calc(2px * var(--z)); color: var(--cyan); }
.rem-card.ahead .rem-top > svg { color: var(--muted); }
.rem-card.late .rem-top > svg, .rem-card.late .rem-due, .rem-card.late .rem-t small { color: var(--red); }
.rem-t { display: grid; gap: calc(3px * var(--z)); min-width: 0; }
.rem-t b { font-weight: 600; overflow-wrap: anywhere; }
.rem-t small { color: var(--muted); }
.rem-due { font-size: calc(12.5px * var(--z)); font-weight: 600; color: var(--muted); white-space: nowrap; }
.rem-due.now { color: var(--cyan); }
.rem-btns { display: flex; justify-content: flex-end; gap: calc(8px * var(--z)); flex-wrap: wrap; }
.rem-row { display: flex; align-items: center; gap: calc(10px * var(--z)); width: calc(100% - calc(16px * var(--z))); margin: calc(4px * var(--z)) calc(8px * var(--z)) calc(10px * var(--z)); padding: calc(8px * var(--z)) calc(10px * var(--z)); border: 0; border-radius: calc(8px * var(--z));
  background: transparent; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.rem-row:hover { background: var(--hover); }
.rem-row.due { background: color-mix(in srgb, var(--cyan) 12%, transparent); }
.rem-row svg { width: calc(17px * var(--z)); height: calc(17px * var(--z)); color: var(--muted); flex: none; }
.rem-row.due svg, .rem-row b { color: var(--cyan); }
.rem-row span { flex: 1; font-weight: 600; }
.rem-row b { font-size: calc(12px * var(--z)); }
.evd-join { margin-bottom: calc(2px * var(--z)); }
.evd-join .btn { display: inline-flex; align-items: center; gap: calc(8px * var(--z)); text-decoration: none; }
.evd-join .btn svg { width: calc(18px * var(--z)); height: calc(18px * var(--z)); }

/* unsubscribe: the button by the subject, and the message's own links made obvious (senders shrink and grey them out) */
.unsub-chip { font: 700 calc(12.5px * var(--z))/1 var(--sans, inherit); color: #1a1a1a; background: #ffd60a; border: calc(1.5px * var(--z)) solid #b45309; border-radius: calc(6px * var(--z));
  padding: calc(5px * var(--z)) calc(10px * var(--z)); cursor: pointer; white-space: nowrap; }
.unsub-chip:hover { background: #ffe14d; }
.plain-body a.peep-unsub { display: inline-block; font-weight: 700; font-size: calc(15px * var(--z)); color: #1a1a1a !important; background: #ffd60a;
  border: calc(2px * var(--z)) solid #b45309; border-radius: calc(6px * var(--z)); padding: calc(3px * var(--z)) calc(10px * var(--z)); margin: calc(4px * var(--z)) calc(2px * var(--z)); text-decoration: none; }
.plain-body a.peep-unsub.peep-flash { outline: calc(4px * var(--z)) solid #f97316; outline-offset: calc(3px * var(--z)); }

/* Settings → About: updates */
.upd-box { display: grid; gap: calc(8px * var(--z)); max-width: calc(640px * var(--z)); }
.upd-box:empty { display: none; }
.upd-cmdrow { display: flex; gap: calc(8px * var(--z)); align-items: center; }
.upd-cmd { flex: 1; font: calc(12.5px * var(--z))/1.4 var(--mono, monospace); padding: calc(8px * var(--z)) calc(10px * var(--z)); border-radius: calc(6px * var(--z)); background: var(--bg2, rgba(127,127,127,.12)); overflow-x: auto; white-space: nowrap; }
.upd-box svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); vertical-align: -3px; flex: none; }
.upd-box .btn svg { width: calc(15px * var(--z)); height: calc(15px * var(--z)); }

/* Categories: views under the Inbox */
.folder.cat-head .fname { font-size: calc(12.5px * var(--z)); }
.cat-caret { display: inline-flex; transform: rotate(-90deg); transition: transform .15s; }
.cat-caret.open { transform: none; }
.folder.cat-view { padding-left: calc(36px * var(--z)); }
.cat-dot { width: calc(9px * var(--z)); height: calc(9px * var(--z)); border-radius: 50%; flex: none; margin: 0 calc(5px * var(--z)) 0 calc(4px * var(--z)); display: inline-block; }
/* Grey: the search / category banner sits on the light list, so dark text on it */
[data-theme="grey"] .srv-banner { background: #e3e5e8; color: #3c4043; border-bottom: 1px solid #c4c7cc; }
[data-theme="grey"] .srv-banner svg, [data-theme="grey"] .srv-banner button { color: #1a73e8; }

/* Peep folders under the Inbox */
.folder.pf-view { padding-left: calc(36px * var(--z)); }

/* ---- snooze, follow-up, All Mail (1.19) ---- */
.row.back { background: color-mix(in srgb, var(--cyan) 7%, transparent); }
.row.back:hover { background: color-mix(in srgb, var(--cyan) 11%, transparent); }
.row .row-done { display: inline-flex; align-items: center; justify-content: center; width: calc(24px * var(--z)); height: calc(22px * var(--z)); padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--card); color: var(--text-2); cursor: pointer; }
.row .row-done:hover { border-color: var(--cyan); color: var(--cyan); }
.row .row-done svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); }
.row .date.snz { display: inline-flex; align-items: center; gap: calc(4px * var(--z)); color: var(--cyan); }
.row .date.snz svg { width: calc(12px * var(--z)); height: calc(12px * var(--z)); }
.day-head.back-head { color: var(--cyan); }
/* All Mail: whose Inbox. Thin (default): a bar at the edge. Thick (Settings → Appearance): a band behind the checkbox, rows from one
   mailbox reading as one block. Either way the selected row keeps its mailbox's colour (no accent bar over it). */
.row.mixed::after { content: ""; position: absolute; left: 0; top: calc(8px * var(--z)); bottom: calc(8px * var(--z)); width: calc(3px * var(--z));
  border-radius: calc(2px * var(--z)); background: var(--acct, var(--muted)); pointer-events: none; }
.row.mixed.selected::before { display: none; }
.band-thick .row.mixed::after { top: 0; bottom: 0; width: calc(46px * var(--z)); border-radius: 0;
  background: linear-gradient(to right, var(--acct, var(--muted)) 0 calc(5px * var(--z)), color-mix(in srgb, var(--acct, var(--muted)) 14%, transparent) calc(5px * var(--z))); }
.band-thick .row.mixed.selected::after, .band-thick .row.mixed.checked::after {
  background: linear-gradient(to right, var(--acct, var(--muted)) 0 calc(5px * var(--z)), color-mix(in srgb, var(--acct, var(--muted)) 22%, transparent) calc(5px * var(--z))); }
[data-theme="grey"].band-thick .row.mixed::after {
  background: linear-gradient(to right, var(--acct, var(--muted)) 0 calc(5px * var(--z)), color-mix(in srgb, var(--acct, var(--muted)) 30%, transparent) calc(5px * var(--z))); }
.row.mixed .cb { position: relative; z-index: 1; }
.folders.all-mail { margin-bottom: calc(6px * var(--z)); }
.search.grow-only { flex: 1; }
.fu-box { display: grid; gap: calc(8px * var(--z)); padding: calc(10px * var(--z)) calc(12px * var(--z)); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--amber) 6%, transparent); }
.fu-card { display: grid; grid-template-columns: calc(18px * var(--z)) minmax(0, 1fr) auto; gap: calc(10px * var(--z)); align-items: center; }
.fu-card > svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); color: var(--amber); }
.fu-txt { display: grid; min-width: 0; }
.fu-k { font: 700 calc(10px * var(--z)) var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.fu-subj { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fu-to { font-size: calc(12.5px * var(--z)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fu-acts { display: flex; gap: calc(6px * var(--z)); align-items: center; }
.fu-acts .btn svg { width: calc(12px * var(--z)); height: calc(12px * var(--z)); }
.btn.fu-btn.on { border-color: var(--amber); color: var(--amber); }

/* spelling: a backdrop behind the textarea carries the squiggles (the text itself stays the textarea's) */
.spell-wrap { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.spell-back { position: absolute; z-index: 0; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; color: transparent; pointer-events: none; box-sizing: border-box; }
.spell-back mark.sp { background: none; color: transparent; text-decoration: underline wavy var(--red, #e74c3c); text-decoration-thickness: calc(1.5px * var(--z)); text-underline-offset: calc(3px * var(--z)); text-decoration-skip-ink: none; }
.spell-wrap > textarea { position: relative; z-index: 1; }

/* address book: typed phone numbers, 1 to 4 */
.phone-rows { display: flex; flex-direction: column; gap: calc(6px * var(--z)); }
.phone-row { display: flex; gap: calc(6px * var(--z)); align-items: center; }
.phone-row .phone-kind { width: calc(92px * var(--z)); flex: 0 0 auto; }
.phone-row .input { flex: 1; min-width: 0; }
.phone-add { align-self: flex-start; }
.field.check-line { flex-direction: row; align-items: center; gap: calc(8px * var(--z)); }

/* the reader's "Update Jessica's cell number?" bar */
.rcpt-line { display: flex; align-items: center; gap: calc(8px * var(--z)); margin: calc(12px * var(--z)) calc(16px * var(--z)) 0; font-size: calc(13.5px * var(--z)); }
.rcpt-line svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); color: var(--ok, #22c55e); flex: none; }
.sig-bar { display: flex; align-items: center; gap: calc(12px * var(--z)); flex-wrap: wrap; margin: calc(12px * var(--z)) calc(16px * var(--z)) 0; }
.sig-bar .sig-text { flex: 1; min-width: calc(200px * var(--z)); display: flex; flex-direction: column; gap: calc(2px * var(--z)); }
.sig-bar .sig-text b { font: 600 calc(14px * var(--z))/1.4 var(--sans, inherit); letter-spacing: 0; text-transform: none; color: var(--text); margin: 0; }
.sig-bar .sig-text .muted { font-size: calc(12.5px * var(--z)); overflow-wrap: anywhere; }
.sig-bar .sig-acts { display: flex; gap: calc(6px * var(--z)); flex-wrap: wrap; }

/* Settings: read receipt senders (Always send / Never send) */
.rcpt-lists { grid-column: 1 / -1; display: flex; flex-direction: column; gap: calc(8px * var(--z)); }
.rcpt-lists:empty { display: none; }
.rcpt-list { display: flex; flex-wrap: wrap; align-items: center; gap: calc(6px * var(--z)); font-size: calc(13px * var(--z)); }
.rcpt-list > .muted { margin-right: calc(4px * var(--z)); }
.rcpt-list .chip { display: inline-flex; align-items: center; gap: calc(4px * var(--z)); padding: calc(3px * var(--z)) calc(4px * var(--z)) calc(3px * var(--z)) calc(10px * var(--z)); border: 1px solid var(--line); border-radius: calc(999px * var(--z)); background: var(--card); color: var(--text); }
.rcpt-list .chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: calc(2px * var(--z)); display: inline-flex; border-radius: 50%; }
.rcpt-list .chip-x:hover { color: var(--danger, #e5484d); }
.rcpt-list .chip-x svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); }
/* Forest: dark, in the deep greens of macOS Sequoia's redwood wallpaper (moss-green accent) */
[data-theme="forest"] {
  --bg: #141b15;
  --grid: rgba(160, 190, 140, .03);
  --panel: #1a221b;
  --card: #202a21;
  --card-2: #263127;
  --thead: #24301f;
  --line: #2b362b;
  --line-2: #3a473a;
  --text: #e4e9df;
  --text-2: #b9c4b0;
  --muted: #849178;
  --cyan: #5c9e3c;          /* accent: moss green */
  --green: #7bcf6a;
  --purple: #a78bfa;
  --amber: #f0a830;
  --blue: #6aa8f0;
  --pink: #ec7fb5;
  --orange: #f08a4b;
  --lavender: #b9a4f5;
  --red: #f38b7f;
  --on-accent: #ffffff;
  --sel: rgba(120, 190, 80, .12);
  --hover: rgba(180, 205, 160, .06);
  --shadow: 0 calc(24px * var(--z)) calc(60px * var(--z)) -12px rgba(0, 0, 0, .65);
  --scrim: rgba(4, 8, 4, .66);
  color-scheme: dark;
}
[data-theme="forest"] .thead { background: #2c4426; color: #e4f0da; }
[data-theme="forest"] .brand .u { color: #8fcf55; }
[data-theme="forest"] { --mono: var(--sans); }
.rcpt-bar .rcpt-warn { color: var(--red); font-weight: 600; }
/* pictures held back: what to do about it; the safe senders in Settings */
.pics-note { display: flex; align-items: center; gap: calc(12px * var(--z)); flex-wrap: wrap; }
.pics-note > div:first-child { flex: 1 1 calc(260px * var(--z)); }
.pics-acts { display: flex; gap: calc(8px * var(--z)); flex-wrap: wrap; }
.safe-senders .chips { display: flex; gap: calc(6px * var(--z)); flex-wrap: wrap; margin-top: calc(6px * var(--z)); }
.safe-senders .chip { display: inline-flex; align-items: center; gap: calc(4px * var(--z)); }
.safe-senders .chip-x { -webkit-appearance: none; appearance: none; border: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--muted); cursor: pointer; padding: calc(2px * var(--z)) !important; min-width: 0; height: auto; display: inline-flex; border-radius: 50%; }
.safe-senders .chip-x:hover { color: var(--red); }
.safe-senders .chip-x svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); }

/* Settings → Devices: Stay unlocked / Lock when idle */
.lock-prefs { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(240px * var(--z)), 1fr)); gap: calc(14px * var(--z)); margin-bottom: calc(14px * var(--z)); }
.lock-prefs .field { display: flex; flex-direction: column; gap: calc(6px * var(--z)); }
.lock-prefs .field > span { font-weight: 600; }
.lock-prefs small { font-size: calc(12.5px * var(--z)); line-height: 1.4; }

/* ---------- text size: A / A / A beside the theme (one A that steps through them when the sidebar is narrow) ---------- */
.side-top { container: sidetop / inline-size; }
.size-btns { display: flex; align-items: center; gap: calc(2px * var(--z)); flex: none; }
.size-btn, .size-one {
  display: grid; place-items: center; padding: 0; cursor: pointer;
  height: calc(40px * var(--z)); border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; color: var(--text-2); font-family: var(--sans); font-weight: 700; line-height: 1;
}
.size-btn { width: calc(26px * var(--z)); }
.size-btn:hover, .size-one:hover { color: var(--text); background: var(--card-2); }
.size-btn.on { color: var(--cyan); border-color: var(--cyan); background: var(--card); }
.size-btn.sz0, .size-one .sz0 { font-size: calc(11px * var(--z)); }
.size-btn.sz1, .size-one .sz1 { font-size: calc(14px * var(--z)); }
.size-btn.sz2, .size-one .sz2 { font-size: calc(17px * var(--z)); }
.size-one { display: none; width: calc(40px * var(--z)); border-color: var(--line-2); background: var(--card); }
[data-theme="grey"] .side .size-one { background: rgba(255, 255, 255, .06); }
/* too narrow for three: the one A (the widths are the three at each size, so the theme button keeps room for its name) */
@container sidetop (max-width: 330px) { .size-btns[data-z="0"] .size-btn { display: none; } .size-btns[data-z="0"] .size-one { display: grid; } }
@container sidetop (max-width: 380px) { .size-btns[data-z="1"] .size-btn { display: none; } .size-btns[data-z="1"] .size-one { display: grid; } }
@container sidetop (max-width: 430px) { .size-btns[data-z="2"] .size-btn { display: none; } .size-btns[data-z="2"] .size-one { display: grid; } }

/* ---------- notes: the formatted editor, always ready to type ---------- */
.note-rich { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-top: calc(10px * var(--z)); }
.note-rich .rich-bar { position: sticky; top: 0; z-index: 2; padding: calc(4px * var(--z)) 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.note-rich .rich-body { flex: 1; min-height: 55vh; overflow: visible; padding: calc(14px * var(--z)) 0 calc(40px * var(--z)); font-size: calc(15.5px * var(--z)); line-height: 1.65; }
.note-rich .rich-body p { margin: 0 0 .55em; }
.note-rich .rich-body li { margin: .15em 0; }
.note-rich .rich-body img { max-width: 100%; border: 1px solid var(--line); border-radius: calc(6px * var(--z)); cursor: zoom-in; }
/* tick boxes: the box is drawn left of the words; a click there ticks it */
.rich-body li.md-task { list-style: none; position: relative; }
.rich-body li.md-task::before {
  content: ''; position: absolute; left: -1.45em; top: .3em; width: 1em; height: 1em; box-sizing: border-box;
  border: 1.5px solid var(--text-2); border-radius: .22em; background: var(--card); cursor: pointer;
}
.rich-body li.md-task.done::before { background: var(--cyan); border-color: var(--cyan); }
.rich-body li.md-task.done::after {
  content: ''; position: absolute; left: -1.12em; top: .42em; width: .32em; height: .58em; pointer-events: none;
  border: solid var(--on-accent); border-width: 0 .14em .14em 0; transform: rotate(45deg);
}
.rich-body li.md-task.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }

/* the reader: which mailbox a message is in */
.mbox-line { display: inline-flex; align-items: center; gap: calc(6px * var(--z)); }
.mbox-dot { display: inline-block; width: calc(8px * var(--z)); height: calc(8px * var(--z)); border-radius: 50%; }

/* attachment preview in the reading pane (1.25.26): documents always sit on white paper, in the dark themes too */
.pv-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pv-bar { display: flex; align-items: center; gap: calc(4px * var(--z)); padding: calc(8px * var(--z)) calc(14px * var(--z)); border-bottom: 1px solid var(--line); }
.pv-bar [hidden] { display: none; }
.pv-title { flex: 1; min-width: 0; display: grid; margin-left: calc(4px * var(--z)); }
.pv-name { font-weight: 600; font-size: calc(14.5px * var(--z)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-sub, .pv-count { font: calc(11.5px * var(--z)) var(--mono); color: var(--muted); }
.pv-count { padding: 0 calc(2px * var(--z)); }
.em-body { flex: 1; min-height: 0; overflow: auto; padding: calc(14px * var(--z)) calc(18px * var(--z)); display: grid; gap: calc(12px * var(--z)); align-content: start; }
.em-head { display: grid; gap: calc(3px * var(--z)); font-size: calc(13.5px * var(--z)); color: var(--text-2); overflow-wrap: anywhere; }
.em-head b { color: var(--muted); font-weight: 600; }
.em-wait { padding: calc(20px * var(--z)); }
.pec-note { margin-bottom: calc(12px * var(--z)); }
.pec-note .btn { margin-top: calc(8px * var(--z)); }
.pv-stage { flex: 1; position: relative; min-height: 0; background: #e9eaee; }
.pv-frame { display: block; width: 100%; height: 100%; border: 0; background: #e9eaee; }
.pv-frame.pv-hide { visibility: hidden; position: absolute; inset: 0; }
.pv-wait { position: absolute; inset: 0; display: grid; place-items: center; }
.pv-pic { position: absolute; inset: 0; display: grid; place-items: center; overflow: auto; padding: calc(16px * var(--z)); }
.pv-pic img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 2px 14px rgba(0,0,0,.18); background: #fff; }
.pv-fail { height: 100%; display: grid; place-content: center; justify-items: center; gap: calc(6px * var(--z)); padding: calc(24px * var(--z)); text-align: center; color: #374151; font-size: calc(14px * var(--z)); }
.pv-fail p { margin: 0; }
.pv-fail .pv-fail-t { font-weight: 600; font-size: calc(16px * var(--z)); color: #111827; }
.pv-fail .btn { margin-top: calc(10px * var(--z)); }

/* ---------- Drive (1.25.27) ---------- */
.drive { display: none; grid-area: notes; min-width: 0; min-height: 0; flex-direction: column; background: color-mix(in srgb, var(--bg) 80%, transparent); }
.app.drive-mode { grid-template-columns: var(--side-w, calc(264px * var(--z))) minmax(0, 1fr); grid-template-areas: "side notes"; }
.app.drive-mode .list, .app.drive-mode .read, .app.drive-mode .notes, .app.drive-mode .cal, .app.drive-mode .tasks { display: none !important; }
.app.drive-mode .drive { display: flex; }
.drive-bar { gap: calc(8px * var(--z)); flex-wrap: wrap; }
.drive-crumbs { display: flex; align-items: center; gap: calc(6px * var(--z)); min-width: 0; flex-wrap: wrap; font-size: calc(15px * var(--z)); }
.drive-crumbs b { font-weight: 600; }
.drive-crumbs .crumb { background: none; border: 0; padding: calc(2px * var(--z)) calc(4px * var(--z)); color: var(--text-2); font: inherit; cursor: pointer; border-radius: calc(5px * var(--z)); }
.drive-crumbs .crumb:hover { background: var(--hover); color: var(--text); }
.drive-crumbs .sep { color: var(--muted); }
.drive-q { width: min(calc(240px * var(--z)), 40vw); }
.drive-body { flex: 1; min-height: 0; overflow-y: auto; padding: calc(10px * var(--z)) clamp(calc(10px * var(--z)), 3vw, calc(28px * var(--z))) calc(30px * var(--z)); position: relative; }
.drive-body.dragover { outline: 2px dashed var(--cyan); outline-offset: -8px; }
.drive-note { margin: 0 0 calc(8px * var(--z)); }
.drive-list { display: flex; flex-direction: column; }
.drive-row { display: grid; grid-template-columns: calc(30px * var(--z)) minmax(0, 1fr) calc(150px * var(--z)) calc(90px * var(--z)) calc(36px * var(--z)); align-items: center;
  gap: calc(8px * var(--z)); padding: calc(7px * var(--z)) calc(8px * var(--z)); border-bottom: 1px solid var(--line); border-radius: calc(6px * var(--z)); cursor: pointer; }
.drive-row:hover, .drive-row:focus-visible { background: var(--hover); outline: 0; }
.drive-row.drive-head { cursor: default; font: 600 calc(11px * var(--z)) var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.drive-row.drive-head:hover { background: none; }
.drive-row .ic { color: var(--cyan); display: grid; place-items: center; }
.drive-row .nm { display: flex; flex-direction: column; min-width: 0; }
.drive-row .nm b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-row .nm small { color: var(--muted); font-size: calc(12px * var(--z)); }
.drive-row .when, .drive-row .size { color: var(--text-2); font-size: calc(13px * var(--z)); }
.drive-row .r { text-align: right; }
.drive-row.pick { grid-template-columns: calc(30px * var(--z)) minmax(0, 1fr) auto; }
.drive-pick { max-height: min(50vh, calc(420px * var(--z))); overflow-y: auto; margin-top: calc(8px * var(--z)); }
.drive-empty { display: grid; place-items: center; text-align: center; gap: calc(6px * var(--z)); padding: calc(60px * var(--z)) calc(20px * var(--z)); color: var(--text-2); }
.drive-empty svg { width: calc(34px * var(--z)); height: calc(34px * var(--z)); color: var(--muted); }
.drive-empty p { margin: 0; }
.drive-ups { position: sticky; bottom: 0; margin-top: calc(14px * var(--z)); display: grid; gap: calc(6px * var(--z)); padding: calc(10px * var(--z)); background: var(--card); border: 1px solid var(--line); border-radius: calc(8px * var(--z)); }
.drive-up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: calc(2px * var(--z)) calc(10px * var(--z)); font-size: calc(13px * var(--z)); }
.drive-up .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-up .p { color: var(--muted); font-family: var(--mono); font-size: calc(12px * var(--z)); }
.drive-up.bad .p { color: var(--red); }
.drive-up .bar, .drive-usage .bar { grid-column: 1 / -1; height: calc(4px * var(--z)); background: var(--line); border-radius: 2px; overflow: hidden; }
.drive-up .bar i, .drive-usage .bar i { display: block; height: 100%; background: var(--cyan); }
.drive-usage { margin: calc(14px * var(--z)) calc(12px * var(--z)) 0; display: grid; gap: calc(6px * var(--z)); font-size: calc(12px * var(--z)); color: var(--muted); }
.drive-usage .bar i.warn { background: var(--red); }
.drive-vers { display: grid; gap: calc(6px * var(--z)); }
.drive-ver { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: calc(8px * var(--z)); align-items: center; padding: calc(8px * var(--z)); border: 1px solid var(--line); border-radius: calc(8px * var(--z)); }
.drive-ver.cur { border-color: var(--cyan); }
.drive-ver .t { display: grid; }
.drive-ver .t span { color: var(--muted); font-size: calc(12.5px * var(--z)); }
.drive-checks { display: grid; gap: calc(6px * var(--z)); margin: calc(10px * var(--z)) 0; }
.drive-check { display: grid; grid-template-columns: calc(20px * var(--z)) minmax(0, 1fr); gap: calc(8px * var(--z)); align-items: start; font-size: calc(13.5px * var(--z)); }
.drive-check.ok svg { color: var(--green); }
.drive-check.bad svg { color: var(--red); }
.drive-check small { display: block; color: var(--muted); }
.drive .pv-pane { flex: 1; }
@media (max-width: 920px) {
  .app.drive-mode { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .drive { grid-area: main; }
  .drive-row { grid-template-columns: calc(30px * var(--z)) minmax(0, 1fr) calc(36px * var(--z)); }
  .drive-q { width: 100%; order: 9; }
}
[data-theme="grey"] .drive { background: transparent; }
/* grey: Drive like the mail list and the calendar (dark bar, light page under it) */
[data-theme="grey"] .drive-body { background: #d0d2d5; border-radius: calc(14px * var(--z)) calc(14px * var(--z)) 0 0; margin-right: calc(10px * var(--z)); }
@media (max-width: 920px) { [data-theme="grey"] .drive-body { border-radius: 0; margin-right: 0; } }
.drive-space { display: grid; gap: calc(10px * var(--z)); margin: calc(12px * var(--z)) 0; }
.drive-meter { display: grid; grid-template-columns: calc(90px * var(--z)) minmax(0, 1fr) auto; gap: calc(10px * var(--z)); align-items: center; font-size: calc(13.5px * var(--z)); }
.drive-meter span { color: var(--muted); }
.drive-meter b { font-weight: 500; white-space: nowrap; }
.drive-meter .bar { height: calc(6px * var(--z)); background: var(--line); border-radius: 3px; overflow: hidden; }
.drive-meter .bar i { display: block; height: 100%; background: var(--cyan); }
.drive-meter .bar i.warn { background: var(--red); }
@media (max-width: 600px) { .drive-meter { grid-template-columns: 1fr; gap: calc(4px * var(--z)); } }

/* the theme's name fits a narrow sidebar: there the button drops its icon and tightens up ("Classic", not "C…") */
@container sidetop (max-width: 300px) {
  .side-top .theme-btn { padding: 0 calc(8px * var(--z)); gap: 0; letter-spacing: .05em; justify-content: center; }
  .side-top .theme-btn svg { display: none; }
  .side-top .theme-btn .theme-name { text-align: center; }
}

/* ---------- Drive's editor (1.25.33): text, Word and spreadsheets, words only ---------- */
.drive .ed { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ed-bar .ed-name { font-weight: 600; font-size: calc(15px * var(--z)); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-state { display: inline-flex; align-items: center; gap: calc(5px * var(--z)); font: 600 calc(11px * var(--z)) var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--cyan); white-space: nowrap; }
.ed-state svg, .drive-lock svg { width: calc(13px * var(--z)); height: calc(13px * var(--z)); }
.drive-row .nm small.drive-lock { display: inline-flex; align-items: center; gap: calc(4px * var(--z)); color: var(--amber); }
.ed-note { display: flex; align-items: center; flex-wrap: wrap; gap: calc(8px * var(--z)); margin: 0 auto calc(10px * var(--z)); max-width: calc(900px * var(--z)); }
.ed-note > svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); color: var(--amber); flex: none; }
.ed-note .grow { flex: 1; }
.ed-paper { max-width: calc(900px * var(--z)); margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: calc(10px * var(--z));
  padding: calc(18px * var(--z)) clamp(calc(12px * var(--z)), 4vw, calc(40px * var(--z))) calc(26px * var(--z)); display: flex; flex-direction: column; gap: calc(12px * var(--z)); }
.ed-paper.ed-sheet { max-width: none; padding: calc(10px * var(--z)); }
.ed-text { width: 100%; min-height: calc(28px * var(--z)); resize: none; overflow: hidden; border: 0; outline: 0; background: transparent; color: var(--text);
  font: calc(15.5px * var(--z))/1.65 var(--sans); padding: 0; field-sizing: content; tab-size: 4; }
.ed-text.mono { font: calc(14px * var(--z))/1.6 var(--mono); min-height: 50vh; }
.ed-text[readonly] { cursor: text; }
.ed-grid-wrap { overflow: auto; max-width: 100%; }
.ed-grid { border-collapse: collapse; font-size: calc(14px * var(--z)); }
.ed-grid th { background: var(--thead, var(--card-2)); color: var(--muted); font: 500 calc(11.5px * var(--z)) var(--mono); padding: calc(3px * var(--z)) calc(6px * var(--z)); border: 1px solid var(--line); min-width: calc(28px * var(--z)); position: sticky; top: 0; }
.ed-grid tr > th:first-child { position: sticky; left: 0; text-align: right; z-index: 1; }
.ed-grid td { border: 1px solid var(--line); padding: 0; }
.ed-cell { width: calc(130px * var(--z)); border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; padding: calc(5px * var(--z)) calc(7px * var(--z)); }
.ed-doc .ed-cell { width: calc(170px * var(--z)); }
.ed-cell:focus { box-shadow: inset 0 0 0 2px var(--cyan); }
.ed-cell.fixed { color: var(--muted); font-style: italic; }
.ed-fixed { color: var(--muted); white-space: pre-wrap; border-left: calc(3px * var(--z)) solid var(--line); padding-left: calc(10px * var(--z)); }
.ed-tabs { display: flex; flex-wrap: wrap; gap: calc(6px * var(--z)); }
.ed-tabs .btn.on { border-color: var(--cyan); color: var(--cyan); }
.ed-more { align-self: flex-start; margin-top: calc(8px * var(--z)); }
.ed-hint { margin: 0; font-size: calc(12.5px * var(--z)); }
.ed.editing .ed-paper { border-color: color-mix(in srgb, var(--cyan) 45%, var(--line)); }
.ed-grid.plain tr:first-child, .ed-grid.plain th { display: none; }
/* the formatted Word editor */
.ed-tools { display: flex; flex-wrap: wrap; align-items: center; gap: calc(6px * var(--z)); position: sticky; top: calc(-18px * var(--z)); z-index: 3; background: var(--card); padding: calc(6px * var(--z)) 0; border-bottom: 1px solid var(--line); }
.ed-tools .ed-fmt { min-width: calc(32px * var(--z)); justify-content: center; }
.ed-tools .ed-style { width: auto; height: calc(30px * var(--z)); }
.ed-fmt-tools { gap: calc(4px * var(--z)); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.ed-fmt-tools > * { flex: none; }
.ed-fmt-tools .ed-style { max-width: calc(118px * var(--z)); }
.ed-fmt-tools .btn.on, .ed-tools .btn.on { background: var(--accent-soft, var(--card-2)); border-color: var(--accent); }
.ed-colorwrap { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm, 6px); padding: 0 2px 0 6px; }
.ed-color-label { font-weight: 700; font-size: calc(12px * var(--z)); }
.ed-color { width: calc(26px * var(--z)); height: calc(24px * var(--z)); border: 0; padding: 0; background: transparent; cursor: pointer; }
.ed-sheet-wrap { max-height: calc(100vh - 240px); }
.ed-sheet td { background-clip: padding-box; }
.ed-sheet td.sel { box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--cyan, #2aa) 16%, transparent); }
.ed-sheet td.ed-frozen { background-color: var(--card); }
.ed-sheet td.ed-frozen-edge, .ed-sheet th.ed-frozen-edge { border-bottom: 2px solid var(--muted); }
.ed-sheet .ed-cell { display: block; box-sizing: border-box; }
.ed-sheet textarea.ed-cell.wrap { resize: none; overflow: hidden; white-space: pre-wrap; word-break: break-word; line-height: 1.3; min-height: calc(28px * var(--z)); }
.ed-sheet .ed-corner { z-index: 5 !important; }
.ed-rich { outline: 0; font: calc(15.5px * var(--z))/1.6 var(--sans); color: var(--text); min-height: calc(28px * var(--z)); white-space: pre-wrap; overflow-wrap: anywhere; }
.ed-rich[contenteditable="false"] { cursor: text; }
.ed-p { margin: 0 0 calc(8px * var(--z)); position: relative; }
.ed-p.k-title { font-size: 2em; line-height: 1.2; font-weight: 400; margin-bottom: calc(10px * var(--z)); }
.ed-p.k-h1 { font-size: 1.55em; font-weight: 700; line-height: 1.3; margin-top: calc(14px * var(--z)); }
.ed-p.k-h2 { font-size: 1.3em; font-weight: 700; line-height: 1.3; margin-top: calc(12px * var(--z)); }
.ed-p.k-h3 { font-size: 1.12em; font-weight: 700; margin-top: calc(10px * var(--z)); }
.ed-p[data-list] { padding-left: calc((26px + 24px * var(--lv, 0)) * var(--z)); margin-bottom: calc(3px * var(--z)); }
.ed-p[data-list]::before { content: attr(data-n); position: absolute; left: calc(24px * var(--lv, 0) * var(--z)); width: calc(22px * var(--z)); text-align: right; color: var(--text-2); }
.ed-p[data-level="1"] { --lv: 1; } .ed-p[data-level="2"] { --lv: 2; } .ed-p[data-level="3"] { --lv: 3; } .ed-p[data-level="4"] { --lv: 4; }
.ed-p[data-level="5"] { --lv: 5; } .ed-p[data-level="6"] { --lv: 6; } .ed-p[data-level="7"] { --lv: 7; } .ed-p[data-level="8"] { --lv: 8; }
.ed-row-tools { display: flex; gap: calc(6px * var(--z)); margin-top: calc(6px * var(--z)); }

/* ---------- calendar (1.25.34): alternating shades, select then create ---------- */
.cal-body { --cal-shade: color-mix(in srgb, var(--text) 5.5%, transparent); --cal-band: color-mix(in srgb, var(--text) 3%, transparent); --cal-line: color-mix(in srgb, var(--line) 70%, var(--text) 12%); }
.cal-body .mcell { border-color: var(--cal-line); }
.cal-body .mcell.alt { background: var(--cal-shade); }
.cal-body .mcell.out.alt { background: color-mix(in srgb, var(--text) 7%, transparent); }
.cal-body .tv-col, .cal-body .tv-allcell { border-left-color: var(--cal-line); }
.cal-body .tv-col.alt { background: var(--cal-shade); }
.cal-body .tv-col.alt.today { background: color-mix(in srgb, var(--cyan) 6%, var(--cal-shade)); }
.cal-body .tv-grid { background-image: linear-gradient(to bottom, var(--cal-line) 1px, transparent 1px),
  repeating-linear-gradient(to bottom, transparent 0 var(--hh, 48px), var(--cal-band) var(--hh, 48px) calc(2 * var(--hh, 48px)));
  background-size: 100% var(--hh, calc(48px * var(--z))), 100% 100%; }
.cal-body .mcell.sel, .cal-body .tv-allcell.sel { background: color-mix(in srgb, var(--cyan) 15%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--cyan) 70%, transparent); }
.cal-sel { position: absolute; left: 1px; right: 1px; background: color-mix(in srgb, var(--cyan) 15%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--cyan) 70%, transparent);
  border-radius: calc(4px * var(--z)); font: 600 calc(11px * var(--z)) var(--sans); color: var(--text-2); padding: calc(2px * var(--z)) calc(6px * var(--z)); z-index: 1; cursor: crosshair; user-select: none; }
.cal-body .tv-col { user-select: none; }

/* ---------- Drive pictures and selection (1.25.36) ---------- */
.drive-row .ic { position: relative; }
.drive-thumb { width: calc(30px * var(--z)); height: calc(30px * var(--z)); object-fit: cover; border-radius: calc(5px * var(--z)); display: block; background: var(--card-2, var(--line)); }
.drive-check { all: unset; box-sizing: border-box; cursor: pointer; display: none; place-items: center; width: calc(20px * var(--z)); height: calc(20px * var(--z));
  border: 1.5px solid var(--text-2); border-radius: calc(5px * var(--z)); background: var(--card); color: #fff; z-index: 2; }
.drive-check svg { width: calc(14px * var(--z)); height: calc(14px * var(--z)); stroke-width: 3; }
.drive-check.on { background: var(--cyan); border-color: var(--cyan); }
.drive-row .drive-check { position: absolute; left: calc(-28px * var(--z)); top: 50%; transform: translateY(-50%); }
.drive-row:hover .drive-check, .drive-row.sel .drive-check, .drive-list:has(.sel) .drive-check, .drive-tile:hover .drive-check, .drive-tile.sel .drive-check, .drive-grid:has(.sel) .drive-check { display: grid; }
.drive-list { padding-left: calc(30px * var(--z)); }
.drive-row.sel, .drive-tile.sel { background: color-mix(in srgb, var(--cyan) 14%, transparent); }
.drive-row.drop, .drive-tile.drop, .drive-crumbs .crumb.drop { outline: 2px solid var(--cyan); outline-offset: -2px; background: color-mix(in srgb, var(--cyan) 18%, transparent); }
.drive-seln { font-weight: 600; color: var(--text); margin-right: calc(4px * var(--z)); white-space: nowrap; }
.drive-seg button svg { width: calc(16px * var(--z)); height: calc(16px * var(--z)); }
.drive-ghost { position: fixed; top: -100px; left: -100px; padding: calc(6px * var(--z)) calc(12px * var(--z)); border-radius: 999px; background: var(--cyan); color: #fff; font: 600 calc(13px * var(--z)) var(--sans); }
.drive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(170px * var(--z)), 1fr)); gap: calc(12px * var(--z)); padding: calc(4px * var(--z)); }
.drive-tile { position: relative; display: flex; flex-direction: column; gap: calc(6px * var(--z)); padding: calc(8px * var(--z)); border-radius: calc(10px * var(--z)); cursor: pointer; border: 1px solid transparent; }
.drive-tile:hover { border-color: var(--line); }
.drive-tile .tile-pic { aspect-ratio: 4 / 3; width: 100%; align-self: stretch; flex: none; display: grid; place-items: center; border-radius: calc(8px * var(--z)); background: color-mix(in srgb, var(--text) 5%, transparent); overflow: hidden; }
.drive-tile .tile-pic > svg { width: calc(44px * var(--z)); height: calc(44px * var(--z)); color: var(--text-2); }
.drive-tile.dir .tile-pic > svg { color: var(--amber); }
.drive-tile .tile-pic .drive-thumb { width: 100%; height: 100%; object-fit: contain; border-radius: 0; background: none; }
.drive-tile .drive-check { position: absolute; left: calc(14px * var(--z)); top: calc(14px * var(--z)); }
.drive-tile .nm { display: flex; flex-direction: column; min-width: 0; padding-right: calc(24px * var(--z)); }
.drive-tile .nm b { font-weight: 500; font-size: calc(13.5px * var(--z)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.drive-tile .nm small { color: var(--text-2); font-size: calc(11.5px * var(--z)); }
.drive-tile .drive-menu-btn { position: absolute; right: calc(4px * var(--z)); bottom: calc(4px * var(--z)); }
.pv-pic.zoomed { place-items: start; }
.pv-pic.zoomed img { max-width: none; max-height: none; height: auto; }

/* Drive: the side list's areas, and a phone's photos (step 3) */
.drive-area { margin: calc(14px * var(--z)) calc(12px * var(--z)) calc(4px * var(--z)); font: 600 calc(10.5px * var(--z))/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.side-scroll .folder.dim { opacity: .55; }
.ph-info { margin-left: calc(10px * var(--z)); font-weight: 400; }
.ph-grid { padding: 0 calc(20px * var(--z)) calc(24px * var(--z)); }
.ph-month { margin: calc(18px * var(--z)) 0 calc(10px * var(--z)); font-size: calc(15px * var(--z)); font-weight: 700; }
.ph-tiles { display: grid; gap: calc(6px * var(--z)); grid-template-columns: repeat(auto-fill, minmax(calc(150px * var(--z)), 1fr)); }
.ph-t0 .ph-tiles { gap: calc(4px * var(--z)); grid-template-columns: repeat(auto-fill, minmax(calc(96px * var(--z)), 1fr)); }
.ph-t2 .ph-tiles { grid-template-columns: repeat(auto-fill, minmax(calc(236px * var(--z)), 1fr)); }
.ph-tile { position: relative; aspect-ratio: 1; background: color-mix(in srgb, var(--muted) 12%, transparent); overflow: hidden; cursor: pointer; }
.ph-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-tile:hover::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: rgba(255, 255, 255, .08); }
.ph-tile.sel { outline: 3px solid var(--accent); outline-offset: -3px; }
.ph-tile.sel::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: color-mix(in srgb, var(--accent) 18%, transparent); }
.ph-check { position: absolute; z-index: 2; left: 5px; top: 5px; width: 20px; height: 20px; border-radius: 5px; background: rgba(0, 0, 0, .45); border: 1.5px solid rgba(255, 255, 255, .85); display: none; place-items: center; color: #fff; cursor: pointer; }
.ph-check svg { width: 13px; height: 13px; opacity: 0; }
.ph-tile:hover .ph-check, .ph-tile.sel .ph-check, .ph-grid:has(.ph-tile.sel) .ph-check { display: grid; }
.ph-check.on { background: var(--accent); border-color: var(--accent); }
.ph-check.on svg { opacity: 1; }
.phl { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .92); display: grid; place-items: center; }
.phl > img { width: 94vw; height: 86vh; object-fit: contain; }
.phl-bar .grow { flex: 1; }
.phl-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #fff; }
.phl-bar .icon-btn, .phl .phl-nav { color: #fff; }
.phl-name { font-weight: 600; font-size: 14px; }
.phl .phl-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 24px; background: rgba(0, 0, 0, .45); }
.phl .phl-prev { left: 14px; }
.phl .phl-next { right: 14px; }
.phl-wait { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(0, 0, 0, .55); padding: 6px 14px; border-radius: 16px; font-size: 13px; }
.phl-wait:empty { display: none; }
.ph-copied { position: absolute; left: 5px; bottom: 5px; display: flex; gap: 4px; }
.ph-badge { width: 18px; height: 18px; border-radius: 9px; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.ph-badge.pc { background: #22a052; }
.ph-badge svg { width: 12px; height: 12px; }
.ph-reqs { padding: 6px 24px; border-bottom: 1px solid var(--line); background: var(--card); display: grid; gap: 2px; }
.ph-req { display: flex; align-items: center; gap: 10px; min-height: 30px; font-size: 13px; font-weight: 600; }
.ph-req svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.ph-req.ok { color: var(--green, #22a052); font-weight: 400; }
.ph-req.bad { color: var(--danger, #c5221f); }
.ph-tag { position: absolute; right: 5px; bottom: 5px; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; font-weight: 700; }
.ph-more { height: 1px; }

/* the list toolbar's Unread switch (styled like the Pane button) */
.toolbar .unread-btn { margin-left: calc(4px * var(--z)); }
