/* Britannia Mail: red and white.
   White panes, a red side rail, Apple's system font, the shield crest.
   Settings → Appearance can switch to dark or to the device's setting
   (html data-theme = "light" | "dark" | "system"). */
:root {
  /* Apple's own font (San Francisco) on Apple devices; the closest system font elsewhere */
  --font: -apple-system, BlinkMacSystemFont, system-ui, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, system-ui, "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --red: #C8102E; --red-deep: #A00C24;
  --bg: #ffffff; --panel: #ffffff; --side: #faf6f6; --line: #ece4e5; --text: #1b1f2c; --muted: #6a6470;
  --accent: #C8102E; --accent-hover: #A00C24; --accent-ink: #ffffff; --accent-soft: #fdecee;
  --warn: #9a5b00; --warn-soft: #fff4d6; --ok: #17733a; --ok-soft: #e3f5e9; --danger: #b30d28;
  --sel: #fbf3f4; --shadow: 0 12px 34px rgba(60, 8, 18, .16);
  --rail: linear-gradient(180deg, #C8102E 0%, #B40E29 60%, #9E0B23 100%);
  --rail-ink: #ffffff; --rail-soft: rgba(255,255,255,.78); --rail-line: rgba(255,255,255,.22);
  --rail-hover: rgba(255,255,255,.12); --rail-pill: rgba(255,255,255,.2);
  --gate: #C8102E; --gate-deep: #8E0A20;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121216; --panel: #18181d; --side: #1f1d23; --line: #2d2a31; --text: #f3eef0; --muted: #a9a0a7;
  --accent: #ec3a55; --accent-hover: #f25c73; --accent-ink: #ffffff; --accent-soft: #3a1119;
  --warn: #f6c04c; --warn-soft: #3a2c0b; --ok: #5bd38a; --ok-soft: #12321f; --danger: #ff6b80;
  --sel: #221b20; --shadow: 0 12px 34px rgba(0,0,0,.55);
  --rail: linear-gradient(180deg, #8E0A20 0%, #74081A 100%);
  --gate: #74081A; --gate-deep: #3d0410;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #121216; --panel: #18181d; --side: #1f1d23; --line: #2d2a31; --text: #f3eef0; --muted: #a9a0a7;
    --accent: #ec3a55; --accent-hover: #f25c73; --accent-ink: #ffffff; --accent-soft: #3a1119;
    --warn: #f6c04c; --warn-soft: #3a2c0b; --ok: #5bd38a; --ok-soft: #12321f; --danger: #ff6b80;
    --sel: #221b20; --shadow: 0 12px 34px rgba(0,0,0,.55);
    --rail: linear-gradient(180deg, #8E0A20 0%, #74081A 100%);
    --gate: #74081A; --gate-deep: #3d0410;
    color-scheme: dark;
  }
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; width: fit-content; }
.seg button { border: 0; border-radius: 0; padding: 7px 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover { background: var(--sel); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.primary:disabled { opacity: .6; cursor: wait; }
button.link { border: 0; color: var(--accent); padding: 4px 0; }
button.link:hover { background: none; text-decoration: underline; }
button.danger { color: var(--danger); }
button.icon { border: 0; font-size: 18px; padding: 4px 10px; }
input, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.015em; }

/* sign-in / unlock: white card on a red field with a faint union-flag weave */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background-color: var(--gate);
  background-image:
    radial-gradient(ellipse at 50% 40%, transparent 0 45%, rgba(0,0,0,.28) 100%),
    linear-gradient(90deg, transparent calc(50% - 46px), rgba(255,255,255,.07) calc(50% - 46px) calc(50% + 46px), transparent calc(50% + 46px)),
    linear-gradient(0deg, transparent calc(50% - 46px), rgba(255,255,255,.07) calc(50% - 46px) calc(50% + 46px), transparent calc(50% + 46px)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.045) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.045) 0 2px, transparent 2px 26px);
}
.card { width: min(410px, 100%); background: var(--panel); border-radius: 18px; padding: 30px 30px 26px; display: grid; gap: 14px; box-shadow: 0 24px 60px rgba(40, 0, 8, .38); border-top: 6px solid var(--red); }
.card p { margin: 0; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand span { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; }
.brand img { width: 34px; height: 34px; }
.card .brand { flex-direction: column; gap: 8px; font-size: 27px; text-align: center; }
.card .brand img { width: 64px; height: 64px; filter: drop-shadow(0 4px 8px rgba(120, 10, 30, .22)); }
.card .tagline { text-align: center; }
.card .err:empty { display: none; }
.card .motto { text-align: center; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-top: 4px; border-top: 1px solid var(--line); }
.card .motto b { color: var(--accent); font-weight: 700; }
.brand.small { font-size: 19px; padding: 2px 4px 14px; color: var(--rail-ink); }
.brand.small img { width: 32px; height: 32px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }

/* layout */
#app { display: grid; grid-template-columns: 252px minmax(300px, 380px) 1fr; height: 100%; }

/* the red side rail */
#side { background: var(--rail); color: var(--rail-ink); padding: 16px 12px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
#side .muted { color: var(--rail-soft); }
#side button.compose { width: 100%; padding: 10px; background: #fff; color: var(--red); border-color: #fff; font-weight: 700; box-shadow: 0 3px 10px rgba(60, 0, 10, .25); }
#side button.compose:hover { background: #fff; color: var(--red-deep); box-shadow: 0 5px 14px rgba(60, 0, 10, .32); }
/* folders sit in soft white boxes; the open one is solid white (owner picked option C, 25 Nov 2026) */
#boxes { display: grid; gap: 7px; }
#boxes a, .sidelink { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--rail-ink); text-decoration: none; cursor: pointer;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.55); }
#boxes a:hover, .sidelink:hover { background: rgba(255,255,255,.26); border-color: rgba(255,255,255,.8); }
#boxes a.on { background: #fff; border-color: #fff; color: var(--red); font-weight: 700; box-shadow: 0 2px 8px rgba(60, 0, 10, .2); }
#boxes .count { font-size: 12px; background: var(--rail-pill); color: #fff; border-radius: 10px; padding: 0 7px; font-weight: 700; }
#boxes a.on .count { background: var(--red); color: #fff; }
.me { margin-top: auto; display: grid; gap: 6px; font-size: 13px; border-top: 1px solid var(--rail-line); padding-top: 12px; word-break: break-all; }
#side button.link { color: var(--rail-ink); opacity: .92; justify-self: start; }
#side button.link:hover { opacity: 1; }
.keystate { font-size: 12px; padding: 6px 8px; border-radius: 8px; }
.keystate.ok { background: var(--ok-soft); color: var(--ok); }
.keystate.no { background: var(--warn-soft); color: var(--warn); cursor: pointer; }
#side .keystate.ok { background: rgba(255,255,255,.16); color: #fff; }
#side .keystate.no { background: #fff4d6; color: #7a4600; }

.bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 58px; }
.bar h1 { font-size: 22px; margin: 0; white-space: nowrap; }
#listPane > .bar { border-bottom: 2px solid var(--accent); }
.search { margin-left: auto; width: min(260px, 50%); }
.search input { padding: 6px 10px; border-radius: 20px; background: var(--sel); border-color: transparent; }

#listPane { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
#list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
#list li { display: grid; grid-template-columns: 36px 1fr auto; gap: 4px 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
#list li:hover { background: var(--sel); }
#list li.on { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
#list li.unread::after { content: ""; position: absolute; left: 5px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); }
#list li .lead { grid-row: span 3; width: 36px; height: 36px; position: relative; cursor: pointer; }
#list li .lead .pick { position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; accent-color: var(--accent); display: none; cursor: pointer; }
#list li:hover .lead .avatar, #list.selecting .lead .avatar, #list li.picked .lead .avatar { display: none; }
#list li:hover .lead .pick, #list.selecting .lead .pick, #list li.picked .lead .pick { display: block; }
#list li.picked { background: var(--accent-soft); }
@media (hover: none) { #list li:hover .lead .avatar { display: grid; } #list li:hover .lead .pick { display: none; } #list.selecting li .lead .avatar { display: none; } #list.selecting li .lead .pick { display: block; } }
#list .who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#list li.unread .who, #list li.unread .subj { font-weight: 700; }
#list .when { font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; justify-self: end; }
#list .when .clip { width: 14px; height: 14px; }
#list .subj { grid-column: 2 / 3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
#list .prev { grid-column: 2 / 4; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
#list li.unread .when { color: var(--accent); font-weight: 700; }
.lockmark { display: inline-flex; align-items: center; gap: 3px; color: var(--ok); font-size: 12px; font-weight: 600; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; flex: none; }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; }
.empty.big { margin: auto; display: grid; justify-items: center; gap: 14px; font-size: 16px; }
.empty.big::before { content: ""; width: 92px; height: 92px; background: url(icon.svg) center / contain no-repeat; opacity: .16; }

#readPane { display: flex; flex-direction: column; min-width: 0; background: var(--panel); }
#reader { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: auto; }
#reader > .bar { position: sticky; top: 0; background: var(--panel); z-index: 2; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.msghead { padding: 18px 22px 8px; display: grid; gap: 10px; }
.msghead h2 { margin: 0; font-size: 25px; line-height: 1.25; word-break: break-word; }
.from { display: flex; gap: 12px; align-items: center; }
.from .date { margin-left: auto; font-size: 13px; white-space: nowrap; }
#rTo { font-size: 13px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.plain { background: var(--sel); color: var(--muted); }
.body { flex: none; padding: 12px 22px 18px; }
.body pre { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 0; }
.body iframe { width: 100%; height: 62vh; min-height: 360px; border: 0; background: #fff; border-radius: 8px; }
.locked-box { border: 1px dashed var(--line); border-radius: 12px; padding: 24px; text-align: center; display: grid; gap: 10px; justify-items: center; }

/* dialogs: white sheets with a red top edge */
dialog { padding: 0; border: 1px solid var(--line); border-top: 5px solid var(--red); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(40, 6, 14, .42); }
dialog .bar h2 { font-size: 20px; margin: 0; }
dialog .bar .icon { margin-left: auto; }

/* compose */
dialog#compose { width: min(720px, calc(100% - 24px)); }
#composeForm { display: flex; flex-direction: column; }
label.row { grid-template-columns: 64px 1fr; align-items: center; padding: 6px 16px; border-bottom: 1px solid var(--line); }
label.row input { border: 0; padding: 6px 0; }
label.row input:focus { outline: none; }
#cBody { border: 0; border-radius: 0; min-height: 260px; padding: 14px 16px; resize: vertical; }
#cBody:focus { outline: none; }
.lockline:empty { display: none; }
.lockline { margin: 0 16px; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.lockline.ok { background: var(--ok-soft); color: var(--ok); }
.lockline.warn { background: var(--warn-soft); color: var(--warn); }
#composeForm footer { display: flex; align-items: center; gap: 10px; padding: 10px 16px 14px; flex-wrap: wrap; }
#composeForm footer #draftState { flex: 1; min-width: 90px; }
#composeErr { padding: 0 16px; }
#composeErr:empty { display: none; }
.files { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 10px; max-width: 100%; }
.chip .x { border: 0; padding: 2px 7px; font-size: 12px; color: var(--muted); }
dialog#compose.drop { outline: 3px dashed var(--accent); outline-offset: -6px; }

dialog#settings { width: min(520px, calc(100% - 24px)); }
.pad { padding: 8px 18px 20px; display: grid; gap: 12px; }
.pad h3 { margin: 10px 0 0; font-size: 17px; }
.small { font-size: 13px; margin: 0; }
.secretrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.secretrow code { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 13px; word-break: break-all; }

/* throwaway addresses */
.sidelink { margin-top: 8px; }
.sidelink .count { font-size: 12px; background: #fff; color: var(--red); border-radius: 10px; padding: 0 7px; font-weight: 700; }
label.row select { font: inherit; color: var(--text); background: transparent; border: 0; padding: 6px 0; width: 100%; min-width: 0; text-overflow: ellipsis; }
label.row select:focus { outline: none; }
select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
dialog#aliases { width: min(640px, calc(100% - 24px)); max-height: calc(100% - 24px); }
.aliasnew { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--side); }
.aliasnew h3 { margin: 0; font-size: 17px; }
#aliasErr:empty { display: none; }
.addr { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.addr input { flex: 1 1 180px; width: auto; min-width: 0; }
.addr .at { color: var(--text); font-weight: 500; font-size: 15px; }
.field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
.field .seg { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 420px; }
.field .seg button { font-weight: 500; padding: 7px 6px; }
.aliaslist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alias { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.alias.on { box-shadow: inset 4px 0 0 var(--accent); }
.alias.off, .alias.expired { background: var(--side); }
.alias.off code, .alias.expired code { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.alias.fresh { outline: 2px solid var(--accent); outline-offset: -1px; }
.atop { display: flex; align-items: center; gap: 8px; }
.atop code { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; word-break: break-all; }
.ameta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.aacts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.aacts button, .atop button, .aacts select { font-size: 13px; padding: 5px 10px; }
.via { flex: none; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 6px; }
.badge.via { background: var(--accent-soft); color: var(--accent); }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); z-index: 10; max-width: calc(100% - 32px); border-left: 4px solid var(--red); }

.only-narrow { display: none; }
@media (max-width: 980px) {
  #app { grid-template-columns: minmax(280px, 360px) 1fr; }
  #side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 5; transform: translateX(-100%); transition: transform .2s; }
  #app.menu #side { transform: none; box-shadow: var(--shadow); }
  #scrim { position: fixed; inset: 0; background: rgba(40, 6, 14, .35); z-index: 4; }
  #menuBtn { display: inline-block; color: var(--accent); }
}
@media (max-width: 700px) {
  #app { grid-template-columns: 1fr; }
  #readPane { display: none; }
  #app.reading #listPane { display: none; }
  #app.reading #readPane { display: flex; }
  .only-narrow { display: inline-block; }
  .bar { padding: 10px 12px; }
  .search { width: auto; flex: 1; }
  .msghead, .body { padding-left: 16px; padding-right: 16px; }
  .actions button { padding: 6px 9px; font-size: 14px; }
  .card { padding: 24px 20px 20px; }
}

/* ---------- Apple Mail / Gmail style pieces (25 Nov 2026) ---------- */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* folders: icon, name, count */
#boxes a, .sidelink { gap: 9px; justify-content: flex-start; }
#boxes a .name, .sidelink .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidelink .name { font-size: 14px; letter-spacing: -.01em; }
#boxes a .del { border: 0; padding: 0; background: none; color: inherit; opacity: 0; display: grid; }
#boxes a .del .ico { width: 15px; height: 15px; }
#boxes a:hover .del { opacity: .75; }
#boxes a .del:hover { opacity: 1; background: none; }
.newfolder { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 8px; color: var(--rail-soft); text-decoration: none; font-size: 14px; border: 1px dashed rgba(255,255,255,.45); }
.newfolder:hover { color: #fff; background: rgba(255,255,255,.12); }
.newfolder .ico { width: 16px; height: 16px; }
/* icon toolbars */
button.tool { border: 0; padding: 7px; border-radius: 8px; color: var(--muted); display: inline-grid; place-items: center; background: none; }
button.tool:hover { background: var(--sel); color: var(--text); }
button.tool.danger:hover { color: var(--danger); }
button.tool.on { color: var(--accent); }
button.tool.on .ico { fill: currentColor; }
button.tool .ico { width: 20px; height: 20px; }
.actions { gap: 2px; align-items: center; }
.tsep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
#attachBtn { display: inline-flex; align-items: center; gap: 6px; }
/* flag in the list */
.flagbtn { grid-column: 3; grid-row: 2; justify-self: end; border: 0; padding: 0 0 0 6px; background: none; color: var(--muted); opacity: 0; display: grid; }
.flagbtn .ico { width: 16px; height: 16px; }
#list li:hover .flagbtn { opacity: .7; }
.flagbtn:hover { opacity: 1 !important; background: none; color: var(--accent); }
.flagbtn.on { opacity: 1; color: var(--accent); }
.flagbtn.on .ico { fill: currentColor; }
@media (hover: none) { .flagbtn { opacity: .35; } }
/* several ticked */
.bar.bulk { gap: 4px; }
.bar.bulk input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0 6px 0 2px; }
.bar.bulk .n { font-weight: 600; margin-right: auto; white-space: nowrap; }
/* pop-up menu */
.popmenu { position: fixed; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 200px; max-height: 60vh; overflow: auto; display: grid; }
.popmenu button { border: 0; border-radius: 8px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-align: left; }
.popmenu button .ico { width: 17px; height: 17px; color: var(--muted); }
/* attachments: a tray of cards under the message */
.attach { margin: 0 22px 24px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; flex: none; }
.attach:empty { display: none; }
.atthead { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 600; }
.atthead .ico { width: 15px; height: 15px; }
.atthead .link { margin-left: auto; font-size: 13px; }
.attgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.att { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--panel); display: grid; grid-template-rows: 96px auto; }
.att:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(60, 8, 18, .1); }
.att .thumb { width: 100%; height: 96px; object-fit: cover; display: block; background: var(--sel); }
.att .thumb.file { display: grid; place-items: center; }
.att .ameta2 { padding: 8px 40px 9px 10px; min-width: 0; }
.att .fname { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .fsize { font-size: 12px; color: var(--muted); }
.att .dl { position: absolute; right: 6px; bottom: 6px; }
.fbadge { display: inline-grid; place-items: center; min-width: 46px; height: 56px; padding: 0 6px; border-radius: 6px; color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.k-pdf { background: #D93025; } .k-doc { background: #2B579A; } .k-xls { background: #1E7145; } .k-ppt { background: #C43E1C; }
.k-zip { background: #6B6470; } .k-media { background: #7B3FA0; } .k-img { background: #0B7A8C; } .k-other { background: #5F6B7A; }
.chip .fbadge { min-width: 30px; height: 22px; font-size: 10px; border-radius: 4px; }
.chip { gap: 8px; padding: 4px 4px 4px 6px; }
.chip .cname { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .csize { color: var(--muted); font-size: 12px; }
.chip .x { display: grid; }
.chip .x .ico { width: 14px; height: 14px; }
/* picture viewer */
dialog.viewer { width: min(1000px, calc(100% - 24px)); max-height: calc(100% - 24px); }
dialog.viewer .bar h2 { font-size: 16px; margin: 0 auto 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.viewer .vbody { display: grid; place-items: center; padding: 12px; background: var(--sel); max-height: calc(100vh - 120px); overflow: auto; }
dialog.viewer img { max-width: 100%; max-height: calc(100vh - 150px); border-radius: 6px; }
@media (max-width: 700px) {
  .attach { margin: 0 16px 20px; }
  .attgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tsep { margin: 0 2px; }
  button.tool { padding: 6px; }
}

/* ---------- Apple Mail proportions on computers (owner, 25 Nov 2026: "ours seem bigger") ----------
   macOS Mail uses 13-point text, ~24px sidebar rows, 28px contact pictures and 2-line previews.
   Phones keep the larger iPhone Mail sizes above. */
@media (min-width: 701px) {
  body { font-size: 13px; line-height: 1.38; }
  button { padding: 4px 10px; border-radius: 6px; }
  input, textarea { padding: 6px 9px; border-radius: 6px; }
  label { font-size: 12px; }
  #app { grid-template-columns: 216px minmax(280px, 340px) 1fr; }

  #side { padding: 10px 8px; gap: 6px; }
  .brand.small { font-size: 15px; gap: 8px; padding: 2px 4px 8px; }
  .brand.small img { width: 24px; height: 24px; }
  #side button.compose { padding: 5px 8px; font-size: 13px; border-radius: 6px; box-shadow: 0 1px 4px rgba(60, 0, 10, .22); }
  #boxes { gap: 3px; }
  #boxes a, .sidelink { padding: 4px 8px; border-radius: 6px; gap: 7px; font-size: 13px; }
  #boxes a .ico, .sidelink .ico, .newfolder .ico { width: 15px; height: 15px; }
  #boxes .count, .sidelink .count { font-size: 11px; line-height: 16px; padding: 0 6px; }
  #boxes a .del .ico { width: 13px; height: 13px; }
  .sidelink { margin-top: 4px; }
  .sidelink .name { font-size: 13px; }
  .newfolder { padding: 3px 8px; font-size: 12px; gap: 7px; border-radius: 6px; }
  .me { font-size: 12px; gap: 3px; padding-top: 8px; }
  .keystate { font-size: 11px; padding: 4px 6px; }

  .bar { padding: 6px 12px; min-height: 44px; gap: 8px; }
  .bar h1 { font-size: 17px; }
  .search input { padding: 3px 10px; font-size: 12px; border-radius: 7px; }
  .bar.bulk input[type=checkbox] { width: 15px; height: 15px; }

  #list li { grid-template-columns: 28px 1fr auto; gap: 1px 8px; padding: 7px 12px 8px 14px; }
  #list li .lead { width: 28px; height: 28px; }
  #list li .lead .pick { width: 16px; height: 16px; }
  #list li .avatar { width: 28px; height: 28px; font-size: 12px; }
  #list li.unread::after { left: 4px; top: 15px; margin-top: 0; width: 7px; height: 7px; }
  #list .who { font-size: 13px; }
  #list .subj { font-size: 12px; }
  #list .prev { font-size: 12px; line-height: 1.35; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  #list .prev .via { display: inline-block; margin-right: 4px; }
  #list .when { font-size: 11px; gap: 3px; }
  #list .when .clip { width: 12px; height: 12px; }
  .flagbtn .ico { width: 13px; height: 13px; }

  button.tool { padding: 4px 5px; border-radius: 6px; }
  button.tool .ico { width: 17px; height: 17px; }
  .tsep { height: 18px; margin: 0 4px; }
  .msghead { padding: 12px 20px 6px; gap: 6px; }
  .msghead h2 { font-size: 18px; }
  .from { gap: 10px; }
  .from .avatar { width: 32px; height: 32px; font-size: 13px; }
  #rFrom { font-weight: 600; }
  .from .date, #rTo { font-size: 12px; }
  .badge { font-size: 11px; padding: 2px 8px; }
  .body { padding: 10px 20px 16px; font-size: 14px; line-height: 1.5; }

  .attach { margin: 0 20px 20px; padding-top: 10px; gap: 8px; }
  .atthead { font-size: 12px; }
  .atthead .link { font-size: 12px; }
  .attgrid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
  .att { grid-template-rows: 72px auto; border-radius: 8px; }
  .att .thumb { height: 72px; }
  .att .ameta2 { padding: 6px 32px 7px 8px; }
  .att .fname { font-size: 12px; }
  .att .fsize { font-size: 11px; }
  .att .dl { right: 3px; bottom: 3px; }
  .att .dl .ico { width: 15px; height: 15px; }
  .fbadge { min-width: 34px; height: 42px; font-size: 11px; border-radius: 5px; }
  .chip { font-size: 12px; padding: 3px 3px 3px 5px; }
  .chip .fbadge { min-width: 26px; height: 18px; font-size: 9px; }

  dialog { border-radius: 10px; border-top-width: 4px; }
  dialog#compose { width: min(640px, calc(100% - 24px)); }
  dialog .bar h2 { font-size: 15px; }
  label.row { grid-template-columns: 56px 1fr; padding: 3px 14px; font-size: 12px; }
  label.row input, label.row select { padding: 5px 0; font-size: 13px; }
  #cBody { padding: 12px 14px; font-size: 13px; min-height: 240px; }
  #composeForm footer { padding: 8px 14px 12px; }
  .lockline { font-size: 12px; }
  .pad { padding: 6px 16px 16px; gap: 10px; }
  .pad h3 { font-size: 14px; }
  .seg button { padding: 5px 12px; }
  .popmenu { min-width: 180px; padding: 4px; border-radius: 8px; }
  .popmenu button { padding: 5px 9px; font-size: 13px; gap: 8px; border-radius: 5px; }
  .popmenu button .ico { width: 15px; height: 15px; }
  #toast { font-size: 13px; padding: 8px 14px; }
  .empty.big { font-size: 14px; }
  .empty.big::before { width: 72px; height: 72px; }
}

/* sign-up page and logs */
.switchline { text-align: center; margin: 2px 0 0; }
.switchline .link { padding: 0 2px; font-weight: 600; }
#suCheck:empty { display: none; }
#suCheck.ok { color: var(--ok); font-weight: 600; }
#suCheck.bad { color: var(--danger); font-weight: 600; }
#suStep:empty { display: none; }
.loglist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.loglist li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; display: grid; gap: 2px; }
.loglist li .muted { font-size: 12px; word-break: break-word; }
.loglist li.empty { border-style: dashed; color: var(--muted); }

/* Folder boxes even smaller, like the rows in Apple Mail's sidebar (owner, 25 Nov 2026) */
@media (min-width: 701px) {
  #boxes { gap: 2px; }
  #boxes a, .sidelink { padding: 2px 7px; min-height: 22px; border-radius: 5px; gap: 6px; font-size: 13px; line-height: 16px;
    background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.38); }
  #boxes a:hover, .sidelink:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.7); }
  #boxes a.on { background: #fff; border-color: #fff; box-shadow: none; }
  #boxes a .ico, .sidelink .ico, .newfolder .ico { width: 14px; height: 14px; }
  #boxes .count, .sidelink .count { font-size: 10.5px; line-height: 14px; padding: 0 5px; }
  .sidelink { margin-top: 6px; }
  .newfolder { padding: 1px 7px; min-height: 20px; font-size: 12px; border-radius: 5px; margin-top: 2px; }
  #side button.compose { padding: 3px 8px; border-radius: 5px; box-shadow: none; }
}

/* Sidebar like Apple Mail (owner's screenshot, 25 Nov 2026): no boxes, small section labels,
   a soft rounded highlight on the open folder, and plain grey unread counts. Replaces the boxed rows above. */
#boxes { gap: 1px; }
.sect { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.6); padding: 10px 8px 3px; }
#boxes .sect:first-child { padding-top: 2px; }
#boxes a, .sidelink { background: transparent; border: 0; border-radius: 6px; padding: 7px 10px; min-height: 0; box-shadow: none; }
#boxes a:hover, .sidelink:hover { background: rgba(255,255,255,.12); border: 0; }
#boxes a.on { background: rgba(255,255,255,.24); color: #fff; font-weight: 600; box-shadow: none; border: 0; }
#boxes .count, .sidelink .count, #boxes a.on .count { background: none; color: rgba(255,255,255,.72); font-weight: 500; padding: 0; }
#boxes a.on .count { color: #fff; }
.newfolder { border: 0; color: rgba(255,255,255,.7); padding: 6px 10px; margin-top: 2px; }
.newfolder:hover { background: rgba(255,255,255,.12); }
.sidelink { margin-top: 10px; }
@media (min-width: 701px) {
  #boxes a, .sidelink { padding: 3px 8px; min-height: 22px; border-radius: 5px; }
  .newfolder { padding: 3px 8px; min-height: 22px; margin-top: 0; border-radius: 5px; }
  .sidelink { margin-top: 8px; }
}

/* Toolbar like Apple Mail (owner, 25 Nov 2026): icons sit in rounded pill groups,
   Reply · Reply all · Forward | Archive · Delete · Junk | Move ▾ | Flag · Unread */
.tgroup { display: inline-flex; align-items: center; gap: 0; padding: 2px; border-radius: 999px; background: rgba(127, 127, 127, .13); }
.tgroup button.tool { border-radius: 999px; padding: 4px 9px; color: var(--text); opacity: .82; }
.tgroup button.tool:hover { background: rgba(127, 127, 127, .2); opacity: 1; }
.tgroup button.tool.danger:hover { color: var(--danger); }
.tgroup button.tool.on { color: var(--accent); opacity: 1; }
.tgroup button.tool[hidden] { display: none; }
.tgroup:not(:has(button.tool:not([hidden]))) { display: none; }
button.tool.menu { display: inline-flex; align-items: center; gap: 1px; padding-right: 7px; }
button.tool .chev { width: 11px; height: 11px; stroke-width: 2.2; }
.actions { gap: 8px; flex-wrap: nowrap; }
.tsep { display: none; }
.bar.bulk { gap: 6px; }
.bar.bulk .tgroup button.tool { padding: 4px 5px; }
.bar.bulk { gap: 4px; padding-left: 10px; padding-right: 10px; }
.bar.bulk { overflow-x: auto; scrollbar-width: none; }
.bar.bulk .n { margin-right: auto; }
@media (min-width: 701px) {
  .tgroup button.tool .ico { width: 16px; height: 16px; }
  .tgroup button.tool .chev { width: 10px; height: 10px; }
}
@media (max-width: 700px) {
  .actions { gap: 5px; }
  .tgroup button.tool { padding: 5px 7px; }
  .tgroup button.tool .ico { width: 18px; height: 18px; }
}

/* invite-only sign-up, sign-in switch, invites */
.switchrow { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; color: var(--text); font-size: 13px; grid-template-columns: none; }
.switchrow input { width: auto; margin-top: 2px; }
.invnew { border: 1px dashed var(--red, #C8102E); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.invnew code { font-size: 17px; font-weight: 700; letter-spacing: .04em; word-break: break-all; }
.loglist li .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.loglist li .tag { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 1px 6px; background: var(--sel); color: var(--muted); }
.loglist li .tag.open { background: var(--ok-soft); color: var(--ok); }
#p12Err:empty { display: none; }

/* ---------- Message list like Apple Mail (owner, 25 Nov 2026) ----------
   Computers: no contact pictures (Apple's default), a red unread dot on the left, bold senders, grey dates,
   two-line grey previews, separator lines that start at the text, and the open message as a filled red
   rounded highlight with white text. The tick box still appears where the dot sits (hover, or once ticking).
   Phones keep the round pictures so the tick box stays easy to tap. */
@media (min-width: 701px) {
  #list li { grid-template-columns: 16px 1fr auto; gap: 1px 6px; padding: 8px 12px 9px 8px; border-bottom: 0;
    background: linear-gradient(var(--line), var(--line)) 30px 100% / calc(100% - 30px) 1px no-repeat; }
  #list li .lead { grid-row: 1; width: 16px; height: 18px; align-self: center; }
  #list li .lead .avatar, #list li:hover .lead .avatar { display: none; }
  #list li .lead .pick { width: 14px; height: 14px; }
  #list li.unread::after { left: 13px; top: 14px; width: 8px; height: 8px; }
  #list li:hover.unread::after, #list.selecting li.unread::after, #list li.picked.unread::after { display: none; }
  #list .who { font-size: 13px; font-weight: 600; }
  #list li.unread .who { font-weight: 700; }
  #list .subj { font-size: 12px; font-weight: 400; color: var(--text); }
  #list li.unread .subj { font-weight: 500; }
  #list .prev { color: var(--muted); }
  #list .when, #list li.unread .when { color: var(--muted); font-weight: 400; }
  #list li:hover { background-color: var(--sel); }
  #list li.picked { background-color: var(--accent-soft); }
  /* the open message: filled red, rounded, white text, as Apple does with its accent colour */
  #list li.on { background: var(--accent); color: #fff; border-radius: 7px; margin: 1px 6px; padding-left: 2px; box-shadow: none; }
  #list li.on .who, #list li.on .subj, #list li.on .prev, #list li.on .when { color: #fff; }
  #list li.on .prev { opacity: .85; }
  #list li.on .flagbtn, #list li.on .flagbtn.on { color: #fff; }
  #list li.on .via { background: rgba(255,255,255,.22); color: #fff; }
  #list li.on.unread::after { background: #fff; }
  #list li.on .lead .pick { accent-color: #fff; }
}

/* ---------- Reading pane like Apple Mail (owner, 25 Nov 2026) ----------
   Computers: round picture on the left; bold sender with the date on the right; the subject under it;
   "To:" in grey; a thin line under the header; the message below. CSS only: the header parts are laid out
   with a grid (display: contents flattens the existing wrappers), so app.js and index.html are unchanged. */
@media (min-width: 701px) {
  .msghead { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: "av from date" "av subj subj" "av to to" ". badges badges";
    column-gap: 12px; row-gap: 1px; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); align-items: baseline; }
  .msghead .from, .msghead .from > div:not(#rDate) { display: contents; }
  .msghead #rAvatar { grid-area: av; width: 40px; height: 40px; font-size: 15px; align-self: start; margin-top: 1px; }
  .msghead #rFrom { grid-area: from; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .msghead #rDate { grid-area: date; font-size: 12px; margin-left: 12px; white-space: nowrap; }
  .msghead h2#rSubject { grid-area: subj; font-family: var(--font); font-size: 13px; font-weight: 600; letter-spacing: 0; line-height: 1.35; margin: 1px 0 0; }
  .msghead #rTo { grid-area: to; font-size: 12px; }
  .msghead #rBadges { grid-area: badges; margin-top: 6px; }
  .msghead #rBadges[hidden] { display: none; }
  .body { padding: 16px 20px 18px; font-size: 14px; line-height: 1.5; }
  .attach { margin-top: 0; }
}

/* throwaway address ending picker */
.addr select#aDomain { width: auto; max-width: 100%; font-weight: 500; }
