:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --panel: #f1f3f6;
  --text: #1d2330;
  --muted: #667085;
  --line: #e3e6eb;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --sel: #dbe6fd;
  --ok-bg: #e8f6ee;
  --ok-text: #14632f;
  --err-bg: #fdecec;
  --err-text: #9b1c1c;
  --warn: #b45309;
  --hover: #e8edf5;
  --mark: #fde68a;
  --fmeta: #3a404c;
  --acct-name: #ea580c;
  --shadow: 0 10px 30px rgba(15, 23, 42, .16);
  --radius: 10px;
  --top-h: 52px;
  /* iPhone notch / home bar when installed as an app (viewport-fit=cover); 0 elsewhere */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
/* Dark: the browser / OS asks for it and the user has not forced light, or the user forced dark
   (avatar menu switch -> <html data-theme>). Keep the two blocks identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151b;
    --surface: #1b2029;
    --panel: #161a22;
    --text: #e6e9ef;
    --muted: #9aa3b2;
    --line: #2c3340;
    --accent: #6b9bff;
    --accent-text: #0d1117;
    --sel: #233457;
    --ok-bg: #133222;
    --ok-text: #8fe0ad;
    --err-bg: #3a1717;
    --err-text: #ffb4b4;
    --warn: #f0b35a;
    --hover: #232a37;
    --mark: #6b4f12;
    --fmeta: #2b313d;
    --acct-name: #fb923c;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151b;
  --surface: #1b2029;
  --panel: #161a22;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --line: #2c3340;
  --accent: #6b9bff;
  --accent-text: #0d1117;
  --sel: #233457;
  --ok-bg: #133222;
  --ok-text: #8fe0ad;
  --err-bg: #3a1717;
  --err-text: #ffb4b4;
  --warn: #f0b35a;
  --hover: #232a37;
  --mark: #6b4f12;
  --fmeta: #2b313d;
  --acct-name: #fb923c;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, "Segoe UI", "Noto Sans Thai", "Sarabun", "Leelawadee UI", Tahoma, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.3rem; margin: 0 0 .75rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
h1 small, h2 small { color: var(--muted); font-weight: normal; font-size: .85rem; margin-left: .35rem; }
/* An icon in a heading / disclosure line sits beside the text (icons are display:block by default). */
h1:has(> .ic), h2:has(> .ic) { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
h1:has(> .ic) small, h2:has(> .ic) small { margin-left: 0; }
details:not(.acct) > summary:not(.iconbtn) > .ic { display: inline-block; vertical-align: -.2em; margin-right: .3rem; }
main a { overflow-wrap: anywhere; }
code { background: var(--hover); padding: 0 .3em; border-radius: 4px; }

/* ---------- icons (thin line + one accent, same style as pos/_back) ---------- */
.ic { width: 18px; height: 18px; flex: none; display: block; }
.ic .na { stroke: var(--ic, currentColor); }
.ic .nat { stroke: var(--ic, currentColor); fill: var(--ic, none); fill-opacity: .28; }
.ic .naf { fill: var(--ic, currentColor); stroke: none; }
.ic-write { --ic: #f59e0b; } .ic-inbox { --ic: #38bdf8; } .ic-all { --ic: #60a5fa; } .ic-drive { --ic: #34d399; }
.ic-calendar { --ic: #f87171; } .ic-contacts { --ic: #a78bfa; } .ic-star { --ic: #fbbf24; } .ic-important { --ic: #fb923c; }
.ic-junk { --ic: #f43f5e; } .ic-trash { --ic: #94a3b8; } .ic-add { --ic: #22c55e; } .ic-search { --ic: #60a5fa; }
.ic-at { --ic: #22d3ee; } .ic-gmail { --ic: #ef4444; } .ic-mailbox { --ic: #818cf8; } .ic-gear { --ic: #60a5fa; }
.ic-user { --ic: #60a5fa; } .ic-users { --ic: #a78bfa; } .ic-upload { --ic: #38bdf8; } .ic-ban { --ic: #f43f5e; }
.ic-link { --ic: #38bdf8; } .ic-logout { --ic: #f59e0b; } .ic-download { --ic: #34d399; } .ic-copies { --ic: #c084fc; }
.ic-clip { --ic: #94a3b8; } .ic-key { --ic: #fbbf24; } .ic-html { --ic: #fb923c; } .ic-text { --ic: #60a5fa; }
.ic-restore { --ic: #22c55e; } .ic-info { --ic: #60a5fa; } .ic-lock { --ic: #fbbf24; } .ic-camera { --ic: #a78bfa; }
.ic-share { --ic: #22d3ee; } .ic-sync { --ic: #38bdf8; } .ic-ai { --ic: #a78bfa; }
.ic-unread { --ic: #38bdf8; } .ic-readall { --ic: #22c55e; }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--text); cursor: pointer;
}
.iconbtn:hover { background: var(--hover); text-decoration: none; }
.iconbtn.on { background: var(--sel); }
.iconbtn .ic { width: 19px; height: 19px; }
.iconbtn:disabled, .iconbtn.off { opacity: .35; cursor: default; }
.grow { flex: 1; }

/* ---------- top bar + avatar menu ---------- */
.top {
  display: flex; align-items: center; gap: .5rem; height: calc(var(--top-h) + var(--safe-t)); flex: none;
  padding: var(--safe-t) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); font-size: 1.1rem; padding: 0 .3rem; }
.brand:hover { text-decoration: none; }
.burger { display: none; }
/* Shown only when opened from the home screen, where the browser's reload button is gone. */
.app-only { display: none; }
@media (display-mode: standalone) { .app-only { display: inline-flex; } }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .95rem; line-height: 1; user-select: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: 1.2rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2.4rem; }
.av0 { background: #2563eb; } .av1 { background: #0d9488; } .av2 { background: #7c3aed; } .av3 { background: #db2777; }
.av4 { background: #ea580c; } .av5 { background: #16a34a; } .av6 { background: #0891b2; } .av7 { background: #4f46e5; }

.avatar-menu { position: relative; }
.avatar-menu > summary { list-style: none; cursor: pointer; display: flex; border-radius: 50%; }
.avatar-menu > summary::-webkit-details-marker { display: none; }
.avatar-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-menu .menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 280px; z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.menu-who { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem .7rem; }
.menu-who b { display: block; }
.menu-who small { display: block; color: var(--muted); font-size: .82rem; }
.menu a, .menu .menu-item {
  display: flex; align-items: center; gap: .65rem; width: 100%; padding: .48rem .65rem; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu a:hover, .menu .menu-item:hover { background: var(--hover); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
/* a folding group inside the avatar menu (guides) */
.avatar-menu .menu { max-height: calc(100dvh - var(--top-h) - var(--safe-t) - 20px); overflow-y: auto; }
.msub > summary { list-style: none; }
.msub > summary::-webkit-details-marker { display: none; }
.msub > summary .chev { width: 12px; height: 12px; margin-left: auto; color: var(--muted); transition: transform .15s; }
.msub[open] > summary .chev { transform: rotate(90deg); }
.msub > a { padding-left: 2.6rem; font-size: .92rem; }
.lhead .qinfo { margin: 0 0 0 .4rem; align-self: center; }
/* the "ไม่มี password" switch, last in the header row of /files (owner 2026-11-12): a link drawn like label.switch */
.lhead .qinfo:has(> a.switch) { flex: 1; }
.qinfo a.switch { margin-left: auto; display: inline-flex; align-items: center; gap: .45rem; color: var(--text); white-space: nowrap; }
.qinfo a.switch:hover { text-decoration: none; }
.qinfo a.switch .ic { color: var(--muted); }
.qinfo a.switch .sw { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line); transition: background .15s; }
.qinfo a.switch .sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s;
}
.qinfo a.switch.on .sw { background: var(--accent); }
.qinfo a.switch.on .sw::after { transform: translateX(16px); }
.qinfo a.switch:focus-visible .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu form { margin: 0; }

/* ---------- shell: panel | content ---------- */
body.shell { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.layout { flex: 1; min-height: 0; display: flex; position: relative; }
.panel {
  width: var(--pw, 280px); flex: none; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 1px; padding: 10px 8px 28px;
  background: var(--panel); border-right: 1px solid var(--line);
}
main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
main { padding-bottom: calc(3rem + var(--safe-b)); }
main.content { flex: 1; min-width: 0; max-width: none; margin: 0; overflow-y: auto;
  padding: 1rem calc(24px + var(--safe-r)) calc(3rem + var(--safe-b)) 26px; }
.panel { padding-bottom: calc(28px + var(--safe-b)); }
main.narrow { max-width: 420px; padding-top: 12vh; }
.offline-card { text-align: center; }
.offline-card h1 { margin: .6rem 0 .3rem; }
.offline-card p { margin: 0 0 1rem; }
.content > .page { max-width: 1000px; }
.resizer { position: absolute; top: 0; bottom: 0; left: calc(var(--pw, 280px) - 3px); width: 6px; cursor: col-resize; z-index: 5; }
.resizer:hover, html.resizing .resizer { background: var(--accent); opacity: .35; }
html.resizing, html.resizing * { cursor: col-resize !important; user-select: none !important; }
.handle {
  position: absolute; top: 50%; left: var(--pw, 280px); z-index: 6; transform: translateY(-50%);
  width: 15px; height: 50px; padding: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0;
  display: flex; align-items: center; justify-content: center;
}
.handle::before {
  content: ""; width: 6px; height: 6px; margin-left: 3px;
  border-left: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg);
}
.handle:hover { background: var(--hover); }
.scrim { display: none; }
@media (min-width: 761px) {
  html.pc .panel, html.pc .resizer { display: none; }
  html.pc .handle { left: 0; }
  html.pc .handle::before { transform: rotate(-135deg); margin-left: -2px; }
}

/* panel: search */
.psearch {
  display: flex; align-items: center; gap: .4rem; margin: 0 2px 8px; padding: 0 .3rem 0 .7rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
/* where the box searches (owner 2026-11-10): black label across the bottom border, ending under the clear button */
.psearch { position: relative; margin-bottom: 15px; }
.pscope {
  position: absolute; right: 18px; bottom: 0; transform: translateY(55%); max-width: calc(100% - 52px);
  padding: 0 .5rem; border-radius: 999px; background: #000; color: #fff; border: 1px solid #000;
  font-size: .68rem; line-height: 1.55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1;
}
.pscope .lp { color: #fb923c; }
a.pscope:hover { text-decoration: none; border-color: #fb923c; }
.fsearch .pscope { right: 44px; }
/* Mails box has a ☰ too (owner 2026-11-10): the label still ends under the clear button */
.msearch .pscope { right: 48px; }
.msearch .qmenu .menu { width: 270px; max-width: calc(var(--pw, 280px) - 24px); }
.msearch .fkinds .sfirst { font-weight: 600; }
/* search result of the Mails tab: tree of boxes, the chosen one lists its mails with a pager */
.stree { display: flex; flex-direction: column; gap: 1px; }
.shead {
  list-style: none; display: flex; align-items: center; gap: .45rem; padding: .4rem .45rem; border-radius: 8px;
  color: var(--text); font-weight: 600; font-size: .9rem; cursor: pointer;
}
.shead::-webkit-details-marker { display: none; }
.shead:hover { background: var(--hover); }
.snode.on > .shead { background: var(--sel); }
.shead .chev { width: 12px; height: 12px; color: var(--muted); flex: none; transition: transform .15s; }
details.snode[open] > .shead .chev { transform: rotate(90deg); }
.shead .em { flex: 0 1 auto; }
.shead .em .lp { color: var(--acct-name); }
.sitems { margin-bottom: 4px; }
.sitems.busy { opacity: .55; transition: opacity .1s; }
.sitems .pres { padding-left: 1.9rem; }
.sitems .psub { padding-left: 1.9rem; }
.spager { display: flex; align-items: center; gap: .15rem; padding: .15rem .3rem .15rem 1.6rem; font-size: .8rem; color: var(--muted); }
.spager .iconbtn { width: 26px; height: 26px; flex: none; }
.spager .iconbtn.off { opacity: .3; }
.spager .pinfo { flex: 1; min-width: 0; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.spager select { width: auto; flex: none; padding: .1rem .2rem; font-size: .78rem; border-radius: 6px; }
.ic-fstmt { --ic: #14b8a6; }
.psearch:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.psearch input[type=search] { border: 0; background: transparent; padding: .45rem 0; min-width: 0; flex: 1; }
.psearch input:focus { outline: none; }
.psearch .iconbtn { width: 28px; height: 28px; }
.psub { color: var(--muted); font-size: .82rem; padding: .2rem .6rem .4rem; }
.pres { display: block; padding: .45rem .6rem; border-radius: 8px; color: var(--text); }
.pres:hover { background: var(--hover); text-decoration: none; }
.pres.on { background: var(--sel); }
.pres .r1 { display: flex; gap: .5rem; justify-content: space-between; font-size: .88rem; }
.pres .r1 b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.pres .r2 { display: flex; gap: .3rem; align-items: center; font-size: .85rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres .r2 .ic { width: 14px; height: 14px; }
.pres .r3 { display: flex; gap: .3rem; align-items: center; margin-top: 1px; font-size: .78rem; color: var(--muted); min-width: 0; }
.pres .r3 .ic { width: 13px; height: 13px; }
.pres .r3 .lp { color: var(--acct-name); }   /* same colours as the account names in the tree */

/* panel: Mails | Files tabs (owner 2026-11-09) */
.ptabs { display: flex; gap: 2px; margin: 0 2px 8px; padding: 3px; background: var(--hover); border-radius: 10px; flex: none; }
.ptabs a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .3rem .5rem;
  border-radius: 8px; color: var(--muted); font-size: .9rem; font-weight: 600;
}
.ptabs a:hover { color: var(--text); text-decoration: none; }
.ptabs a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.ptabs .ic { width: 16px; height: 16px; }
/* Files tab: search box with the file-kind menu inside, results that wrap */
.fsearch { position: relative; padding-right: .15rem; }
.fsearch > .ic { flex: none; color: var(--muted); }
.fsearch .qmenu .menu { left: 0; right: auto; width: 250px; max-width: calc(var(--pw, 280px) - 24px); }
.fkinds label {
  display: flex; align-items: center; gap: .5rem; padding: .38rem .5rem; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.fkinds label:hover { background: var(--hover); }
.fkinds input { width: auto; margin: 0; accent-color: var(--accent); }
.fkinds .ic { width: 16px; height: 16px; }
.fres {
  display: flex; align-items: flex-start; gap: .45rem; padding: .4rem .6rem; border-radius: 8px;
  color: var(--text); font-size: .88rem; line-height: 1.35;
}
.fres:hover { background: var(--hover); text-decoration: none; }
.fres.on { background: var(--sel); }
.fres .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.fres .fn { min-width: 0; overflow-wrap: anywhere; }
.fres .fem { color: var(--acct-name); font-size: .8rem; }
.ic-files { --ic: #60a5fa; } .ic-file { --ic: #94a3b8; } .ic-fpdf { --ic: #ef4444; } .ic-fdoc { --ic: #3b82f6; }
.ic-fsheet { --ic: #22c55e; } .ic-fslide { --ic: #f97316; } .ic-fimage { --ic: #a78bfa; } .ic-fmedia { --ic: #ec4899; }
.ic-fdesign { --ic: #ec4899; } .ic-faudio { --ic: #ec4899; } .ic-fvideo { --ic: #ec4899; } .ic-farchive { --ic: #f59e0b; }
.ic-newtab { --ic: #38bdf8; }

/* search row of the Files tab: [search box ☰] [list / explorer switch] */
.frow { display: flex; align-items: center; gap: 6px; margin: 0 2px 15px; }
.frow .psearch { flex: 1; min-width: 0; margin: 0; }
.vswitch {
  flex: none; position: relative; width: 46px; height: 26px; border-radius: 999px;
  background: var(--line); border: 1px solid var(--line); transition: background .15s;
}
.vswitch:hover { text-decoration: none; filter: brightness(.97); }
.vswitch .knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  display: flex; align-items: center; justify-content: center; color: var(--muted); transition: left .15s;
}
.vswitch .knob .ic { width: 13px; height: 13px; }
.vswitch.on { background: var(--accent); border-color: var(--accent); }
.vswitch.on .knob { left: 22px; color: var(--accent); }
/* Files tree (list view): "ทั้งหมด" + one folding node per box, same look as the Mails tab */
.ftree { display: flex; flex-direction: column; gap: 1px; }
details.fnode > summary {
  list-style: none; display: flex; align-items: center; gap: .45rem; padding: .4rem .45rem;
  border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .9rem;
}
details.fnode > summary::-webkit-details-marker { display: none; }
details.fnode > summary:hover { background: var(--hover); }
details.fnode.on > summary { background: var(--sel); font-weight: 600; }   /* its files are the rows on the page */
details.fnode .chev { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; flex: none; }
details.fnode[open] > summary .chev { transform: rotate(90deg); }
details.fnode[open] { margin-bottom: 4px; }
details.fnode > summary .em .lp { color: var(--acct-name); }
/* "(5)" right after the name (owner 2026-11-10), the name shortens with "…" before the count does */
details.fnode > summary .em, .fboxes .em { flex: 0 1 auto; }
.fcnt { flex: none; margin-left: .25rem; color: var(--muted); font-size: .8rem; font-style: normal; font-weight: 400;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
details.fnode .fres { padding-left: 1.9rem; }
/* sender groups under a box (Statements): one level deeper than the box, their files one deeper again */
.fsnd { display: flex; align-items: center; gap: .4rem; padding: .32rem .45rem .32rem 1.5rem; border-radius: 8px;
  color: var(--text); font-size: .86rem; }
.fsnd:hover { background: var(--hover); text-decoration: none; }
.fsnd.on { background: var(--sel); font-weight: 600; }
.fsnd .chev { width: 11px; height: 11px; color: var(--muted); flex: none; transition: transform .15s; }
.fsnd.on .chev { transform: rotate(90deg); }
.fsnd > .ic:not(.chev) { width: 15px; height: 15px; flex: none; }
.fsnd .em { flex: 0 1 auto; }
/* one sender = its link + ⚙ (owner 2026-11-11: full address, local part orange like the boxes) */
.fsrow { display: flex; align-items: center; }
.fsrow .fsnd { flex: 1; min-width: 0; }
.fsnd .em .lp { color: var(--acct-name); }
.fsnd .em .dom { color: var(--muted); }
.fskind { flex: none; display: inline-flex; margin-left: .3rem; }
.fskind .ic { width: 15px; height: 15px; }
.fsrow .fsset { flex: none; width: 28px; height: 28px; opacity: .45; }
.fsrow:hover .fsset, .fsrow .fsset.set, .fsrow .fsset:focus-visible { opacity: 1; }
.fsrow .fsset.set { color: var(--accent); }
/* the sender settings dialog */
dialog.sndset { width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
dialog.sndset::backdrop { background: rgba(0, 0, 0, .35); }
.sndset form { display: flex; flex-direction: column; gap: .7rem; padding: 1.1rem 1.2rem; }
.sndset h3 { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: 1.05rem; }
.sndset .sndaddr { margin: -.3rem 0 0; font-weight: 600; word-break: break-all; }
.sndset .sndaddr .lp { color: var(--acct-name); }
.sndset .sfield { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--muted); }
.sndset .sfield input { color: var(--text); }
.sndset .pwrow { display: flex; gap: .4rem; }
.sndset .pwrow input { flex: 1; min-width: 0; }
.sndset .sndvia { margin-top: -.45rem; color: var(--muted); }
.sndset .err { margin: 0; color: #dc2626; font-size: .88rem; }
.sndset .sndbtns { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.sndset .sndbtns .grow { flex: 1; }
.sndset .sndbtns a { font-size: .86rem; }
details.fnode .fsndfiles .fres { padding-left: 2.9rem; }
.fsndfiles .fmore { margin-left: 2.9rem; }
.fmore { display: block; margin: .2rem 0 .3rem 1.9rem; padding: .25rem .7rem; font-size: .82rem; }
.fboxes { display: flex; flex-direction: column; gap: 1px; }
.fboxes .em { flex: 1; }
.fboxes .lp { color: var(--acct-name); }
.pmore { color: var(--muted); font-size: .8rem; padding: .5rem .6rem; margin: 0; }
.psub .fchip { margin-left: .3rem; }
.ic-grid { --ic: #60a5fa; } .ic-list { --ic: #94a3b8; }

/* list view of /files: one row per file, every detail in columns; the whole row is the link */
.flist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .9rem; }
.flrow {
  display: grid; align-items: center; gap: 0 .9rem; padding: .5rem .8rem; color: var(--text); border-bottom: 1px solid var(--line);
  grid-template-columns: minmax(200px, 2.4fr) 3.4rem 4.6rem minmax(110px, 1.3fr) minmax(100px, 1.1fr) minmax(120px, 1.7fr) 7.6rem;
}
.flrow:last-child { border-bottom: 0; }
a.flrow:hover { background: var(--hover); text-decoration: none; }
a.flrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.flhead { color: var(--muted); font-weight: 600; font-size: .82rem; background: var(--panel); }
.flrow > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flrow .num { text-align: right; }
.flrow .c-name { display: flex; align-items: flex-start; gap: .45rem; white-space: normal; font-weight: 500; }
.flrow .c-name .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.flrow .c-name .fn { min-width: 0; overflow-wrap: anywhere; }
.flrow .c-ext, .flrow .c-size, .flrow .c-from, .flrow .c-date { color: var(--muted); }
.flrow .c-ext { font-size: .78rem; }
.flrow .c-box .lp { color: var(--acct-name); }
.flrow .c-date { font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) {
  /* narrow: the name on its own line, the details in one small line under it */
  .flrow.flhead { display: none; }
  .flrow { display: flex; flex-wrap: wrap; gap: .1rem .7rem; font-size: .8rem; }
  .flrow .c-name { flex: 1 0 100%; font-size: .92rem; }
  .flrow .c-subj { flex: 1 1 100%; color: var(--muted); }
  .flrow .c-ext:empty { display: none; }
}
/* explorer: cards like the drive project — frame = the thumbnail, words under it, no card box */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.fcard { display: block; min-width: 0; color: var(--text); border-radius: 16px 16px 10px 10px; }
.fcard:hover { text-decoration: none; }
.fcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fthumb {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 16px 16px 0 0; transition: border-color .12s;
}
.fcard:hover .fthumb { border-color: var(--muted); }
/* scanned pages are portrait: keep the top (title, letterhead), not the white middle */
.fthumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.fthumb > .ic { width: 46px; height: 46px; }
/* hover = 4x magnifier inside the same frame, following the mouse (--zx/--zy set by app.js) */
@media (hover: hover) {
  .fthumb img { transition: transform .18s ease; transform-origin: var(--zx, 50%) var(--zy, 50%); }
  .fcard:hover .fthumb img { transform: scale(4); }
}
/* caption = a dark grey band joined to the thumbnail, in both themes (owner 2026-11-10) -> light text here */
.fmeta { display: block; padding: 7px 8px 7px; background: var(--fmeta); color: #eef0f4; border: 1px solid var(--fmeta); border-top: 0;
  border-radius: 0 0 10px 10px; }
.fmeta .fsub { color: #aab2c0; }
.fmeta .fsub .fem { color: #fb923c; }      /* the part before @ = orange, like the account names */
.fmeta .fsub .fdom { color: #eef0f4; }
/* app.js fits the whole name into two lines (smaller letters, down to half size), else start....ext;
   the clamp above stays as the fallback without script */
.fname > span.fit { display: block; max-height: 2.6em; }
/* always the height of two lines, so the bottom edges of a row of cards line up (owner 2026-11-10) */
.fmeta .fname { min-height: 2.6em; }
.fname { display: flex; align-items: flex-start; gap: .3rem; font-size: .88rem; font-weight: 500; line-height: 1.3; }
.fname .ic { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.fname > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.fsub { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsub .fem { color: var(--acct-name); }
.fpager { display: flex; align-items: center; justify-content: center; gap: .8rem; margin: 1.2rem 0 .5rem; color: var(--muted); }
@media (max-width: 760px) { .fgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; } }

/* the opened file, a resizable panel on the right of its mail */
.fresizer { flex: none; width: 6px; margin: 0 -3px; position: relative; z-index: 5; cursor: col-resize; }
.fresizer:hover, html.fresizing .fresizer { background: var(--accent); opacity: .35; }
html.fresizing, html.fresizing * { cursor: col-resize !important; user-select: none !important; }
html.fresizing iframe, html.resizing iframe { pointer-events: none; }   /* the PDF viewer would swallow the drag */
.fpanel {
  flex: none; width: var(--fw, 46%); min-width: 260px; max-width: calc(100% - 320px);
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line);
}
.fhead { flex: none; display: flex; align-items: center; gap: .35rem; padding: .4rem .5rem .4rem .8rem; border-bottom: 1px solid var(--line); }
.fhead > .ic { width: 18px; height: 18px; flex: none; }
.fhead .fname { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.3; overflow-wrap: anywhere; }
.fhead small { color: var(--muted); white-space: nowrap; font-size: .8rem; }
.fhead .iconbtn { width: 30px; height: 30px; flex: none; }
.fbody { flex: 1; min-height: 0; display: flex; background: var(--panel); }
.fbody iframe { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
.fimg { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 12px; }
.fimg img { max-width: 100%; height: auto; }
.fnone { margin: auto; padding: 2rem 1rem; text-align: center; color: var(--muted); }
.fnone > .ic { width: 56px; height: 56px; }
.fnone b { color: var(--text); overflow-wrap: anywhere; }
.atts li.on { border-color: var(--accent); background: var(--sel); }
/* files that look risky (filecheck, owner 2026-11-10): amber = suspicious, red = may be dangerous */
.ic-alert { --ic: #f59e0b; }
.atts li.risk.r1 { border-color: #f59e0b; }
.atts li.risk.r2 { border-color: #dc2626; background: var(--err-bg); }
.atts li.r2 .ic-alert, .ic.risk.r2, .frisk.r2 > .ic, .fbadge.r2 .ic { --ic: #dc2626; }
.risknote { display: flex; align-items: center; gap: .5rem; }
.rnote { display: inline-block; margin-left: .2rem; padding: 0 .4rem; border-radius: 999px; font-size: .72rem;
  background: #fef3c7; color: #92400e; cursor: help; }
.fres:has(.r2) .rnote { background: #fee2e2; color: #991b1b; }
.frisk { flex: none; display: flex; gap: .5rem; padding: .55rem .8rem; border-bottom: 1px solid var(--line);
  background: #fef3c7; color: #78350f; font-size: .88rem; }
.frisk.r2 { background: #fee2e2; color: #7f1d1d; }
.frisk > .ic { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.frisk ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.fthumb { position: relative; }
.fbadge { position: absolute; top: 6px; left: 6px; z-index: 1; display: inline-flex; align-items: center; gap: .25rem;
  padding: .1rem .45rem; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: .74rem; font-style: normal; }
.fbadge.r2 { background: #fee2e2; color: #991b1b; }
.fbadge .ic { width: 13px; height: 13px; }
.attwarn { max-width: 640px; margin: 1.5rem auto; border-left: 4px solid #f59e0b; }
.attwarn.danger { border-left-color: #dc2626; }
.attwarn h1 { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; margin: 0 0 .6rem; }
.attwarn h1 .ic { width: 26px; height: 26px; }
.attwarn.danger h1 .ic { --ic: #dc2626; }
.attwarn .fn { overflow-wrap: anywhere; }
.attwarn .acts { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.fshow, .fhide { display: none; }
@media (max-width: 760px) {
  /* phones: the file covers the page; a button swaps between the file and its mail */
  .fresizer { display: none; }
  .fpanel {
    position: fixed; inset: calc(var(--top-h) + var(--safe-t)) 0 0 0; z-index: 25; width: auto; min-width: 0; max-width: none;
    border-left: 0; padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  }
  .fhide { display: inline-flex; }
  html.fh .fpanel { display: none; }
  html.fh .fshow { display: inline-flex; }
  html:not(.fh) body:has(.fpanel) .aibtn { display: none; }
}

/* panel: account tree */
.node {
  display: flex; align-items: center; gap: .6rem; padding: .36rem .6rem; border-radius: 8px;
  color: var(--text); font-size: .93rem; white-space: nowrap;
}
.node > span { overflow: hidden; text-overflow: ellipsis; }
.node:hover { background: var(--hover); text-decoration: none; }
.node.on { background: var(--sel); font-weight: 600; }
.node.off { color: var(--muted); opacity: .5; cursor: default; }
.node.off:hover { background: none; }
.node.dim { opacity: .6; }
.node.all { margin-bottom: 4px; }
/* unread/total of an Inbox (owner 2026-11-07): plain digits, the explanation lives in title */
.cnt { margin-left: auto; padding-left: .3rem; color: var(--muted); font-size: .78rem; font-style: normal;
  font-variant-numeric: tabular-nums; font-weight: 400; cursor: help; }
.cnt.new { color: var(--accent); font-weight: 700; }
/* live digits (owner 2026-11-13): a box that got mail since the page was drawn gets a dot,
   and a pill on top of the page reloads it */
.cnt.grew::before { content: "●"; color: var(--accent); margin-right: .25rem; font-size: .6rem; vertical-align: 2px; }
.newmail { display: block; width: fit-content; margin: 0 auto .75rem; padding: .35rem .9rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: .85rem; font-weight: 600; text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.newmail:hover { filter: brightness(1.08); }
.newmail[hidden] { display: none; }
details.acct > summary {
  list-style: none; display: flex; align-items: center; gap: .45rem; padding: .4rem .45rem;
  border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .9rem;
}
details.acct > summary::-webkit-details-marker { display: none; }
details.acct > summary:hover { background: var(--hover); }
details.acct .chev { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; }
details.acct[open] .chev { transform: rotate(90deg); }
details.acct[open] { margin-bottom: 4px; }
/* the folded account shows its Inbox count; open, the Inbox line itself has it */
details.acct[open] > summary .cnt { display: none; }
details.acct > summary .cnt { font-size: .75rem; }
details.acct .node { padding-left: 2.15rem; }
.em { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* owner 2026-11-06: the user part of an account address in orange, "@domain" in the normal text colour */
details.acct > summary .em .lp { color: var(--acct-name); }
.gear { display: flex; opacity: 0; color: var(--muted); border-radius: 6px; padding: 2px; }
.gear .ic { width: 16px; height: 16px; }
summary:hover .gear, details[open] > summary .gear, .gear:focus-visible { opacity: .85; }
.gear:hover { background: var(--surface); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.err { background: #ef4444; } .dot.warn { background: #f59e0b; } .dot.off { background: var(--muted); }
.dot.run { background: #3b82f6; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.addacct { margin-top: 8px; padding-top: .55rem; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }

@media (max-width: 760px) {
  .burger { display: inline-flex; }
  .panel {
    position: fixed; top: calc(var(--top-h) + var(--safe-t)); bottom: 0; left: 0; z-index: 30; width: min(320px, 86vw);
    padding-left: calc(8px + var(--safe-l));
    transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow);
  }
  html.po .panel { transform: none; }
  .resizer, .handle { display: none; }
  .scrim { position: fixed; inset: calc(var(--top-h) + var(--safe-t)) 0 0 0; z-index: 29; background: rgba(0, 0, 0, .35); }
  html.po .scrim { display: block; }
  main.content { padding: .9rem calc(16px + var(--safe-r)) calc(3rem + var(--safe-b)) calc(16px + var(--safe-l)); }
}

/* ---------- forms ---------- */
input, select, button, textarea { font: inherit; color: inherit; }
input[type=text], input:not([type]), input[type=password], input[type=search], input[type=email], select, textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }
button {
  padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer;
}
button:hover { background: var(--hover); }
button.primary, a.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.primary:hover, a.btn.primary:hover { filter: brightness(1.08); }
a.btn { display: inline-block; padding: .5rem 1.1rem; border: 1px solid var(--line); border-radius: 8px; }
a.btn:has(> .ic) { display: inline-flex; align-items: center; gap: .45rem; }
button.danger { color: #dc2626; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; }
.linkbtn:hover { background: none; text-decoration: underline; }
.linkbtn.small { font-size: .8rem; margin-left: .3rem; }
label { display: block; font-size: .9rem; color: var(--muted); }
label > input, label > select, label > textarea, label > .addr-input { margin-top: .25rem; color: var(--text); }
label.check { display: inline-flex; align-items: center; gap: .35rem; color: var(--text); white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.form-grid { display: grid; gap: .75rem; margin-bottom: 1.25rem; max-width: 560px; }
.form-grid h2 { margin: 0; }
.addr-input { display: flex; align-items: center; gap: .35rem; }
.addr-input input { flex: 1.2; min-width: 0; }
.addr-input select { flex: 1; width: auto; min-width: 0; }
.login h1 { text-align: center; }
.login form { display: grid; gap: .8rem; }

.hint { color: var(--muted); font-size: .88rem; margin: .25rem 0 1rem; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 2.5rem 0; text-align: center; }
.flash { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.err { background: var(--err-bg); color: var(--err-text); }
.warn { color: var(--warn); }
.flash.warn-box { background: var(--hover); color: var(--text); border-left: 4px solid var(--warn); }
.remind { background: var(--hover); border-left: 4px solid var(--warn); border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; }
.remind-head { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.remind-head small { color: var(--muted); }
.remind-body { white-space: pre-line; margin: .4rem 0; }
.remind-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.remind-acts form { margin: 0; }
table.reminders td { vertical-align: top; white-space: normal; }
/* /sync/ms/renew: status of the Microsoft app secret */
.ms-status .state { margin: 0 0 .6rem; }
.ms-status .state.ok { color: var(--ok-text); }
.ms-status .state.warn { color: var(--warn); }
.ms-status .state.bad { color: var(--err-text); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: 0 0 .9rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { dl.kv { grid-template-columns: 1fr; } dl.kv dd { margin-bottom: .35rem; } }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.tag { display: inline-block; font-size: .75rem; padding: 0 .45rem; border-radius: 999px; background: var(--hover); color: var(--muted); }
.tag.on { background: var(--accent); color: var(--accent-text); }

/* ---------- mail list ---------- */
.lhead { display: flex; align-items: center; gap: .35rem; margin-bottom: .7rem; flex-wrap: wrap; }
.lhead h1 { display: flex; flex-wrap: nowrap; align-items: center; gap: .55rem; margin: 0; font-size: 1.2rem; min-width: 0; }
.lhead h1 .ic { width: 22px; height: 22px; }
.lhead h1 small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* search box of a list: [search icon | words | clear | menu] — the menu picks sender or text */
.lsearch {
  position: relative; display: flex; align-items: center; gap: .3rem; flex: 1 1 260px; max-width: 560px;
  margin: 0 auto 0 .8rem; padding: 0 .2rem 0 .7rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.lsearch:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.lsearch > .ic { flex: none; color: var(--muted); }
.lsearch input[type=search] { flex: 1; min-width: 0; border: 0; background: transparent; padding: .42rem 0; }
.lsearch input[type=search]:focus { outline: none; }
.lsearch .iconbtn { width: 30px; height: 30px; flex: none; }
.qmenu > summary { list-style: none; }
.qmenu > summary::-webkit-details-marker { display: none; }
.qmenu[open] > summary { background: var(--sel); }
.qmenu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: 230px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.qmenu > summary.has { position: relative; }
.qmenu > summary.has::after {   /* a filter or group is on */
  content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: #f59e0b;
}
.gchips [data-tk] small:empty::before { content: "…"; }
.qpanel { width: 330px; max-width: calc(100vw - 32px); max-height: min(72vh, 620px); overflow-y: auto; padding: 6px 10px 10px; }
.qsec { margin: .55rem 0 .3rem; font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.qsec:first-child { margin-top: .2rem; }
.qrow { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; margin-bottom: .3rem; }
.qrow label { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; white-space: nowrap; }
.qrow input[type=radio], .qrow input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); }
.qrow select { width: auto; padding: .3rem .5rem; }
.qrow.gsave { flex-wrap: nowrap; gap: .4rem; margin-top: .4rem; }
.qrow.gsave input { flex: 1; min-width: 0; padding: .3rem .55rem; }
button.small { padding: .3rem .7rem; font-size: .88rem; }
.small { font-size: .85rem; }
.gchips { display: flex; flex-wrap: wrap; gap: .3rem; }
.gchip {
  display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; padding: .2rem .6rem; border: 1px solid var(--line);
  border-radius: 999px; color: var(--text); font-size: .86rem; background: var(--surface); white-space: nowrap;
}
a.gchip:hover, .gchip a:hover { text-decoration: none; background: var(--hover); }
/* inside the menu, chips must not take the full-width menu row style */
.qpanel a.gchip, .qpanel .gchip a { display: inline-flex; width: auto; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .86rem; line-height: 1.35; }
.qpanel a.gchip { border: 1px solid var(--line); background: var(--surface); }
.qpanel a.gchip:hover { background: var(--hover); }
.qpanel a.gchip.on, .qpanel .gchip.mine.on { background: var(--sel); border-color: var(--accent); }
.qpanel .gchip.mine a { padding: 0; border-radius: 0; }
.qpanel .gchip.mine a:hover { background: none; text-decoration: underline; }
.gchip small { color: var(--muted); font-size: .76rem; }
.gchip.on { background: var(--sel); border-color: var(--accent); }
.gchip.mine { padding-right: .15rem; }
.gchip.mine a { color: inherit; overflow: hidden; text-overflow: ellipsis; }
.gchip .gx { border: 0; background: none; padding: 0 .3rem; color: var(--muted); font-size: 1rem; line-height: 1; border-radius: 50%; }
.gchip .gx:hover { color: #dc2626; background: none; }
.fchip {
  display: inline-flex; align-items: center; gap: .2rem; padding: .1rem .3rem .1rem .6rem; border-radius: 999px;
  background: var(--sel); color: var(--text); font-size: .84rem;
}
.fchip .ic { width: 13px; height: 13px; }
.fchip:hover { text-decoration: none; filter: brightness(.97); }
.qinfo { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; color: var(--muted); font-size: .88rem; margin: -.2rem 0 .6rem; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
@media (max-width: 760px) {
  .lsearch { order: 5; flex-basis: 100%; max-width: none; margin: .35rem 0 0; }
  /* Portrait phones: title, pager and buttons share one row; the box name shortens with "…". */
  .lhead { gap: .15rem; }
  .lhead h1 { flex: 1 1 0; min-width: 6.5em; margin-right: 0; }
  .lhead > .iconbtn { width: 30px; }
  .pagerinfo { font-size: .8rem; padding: 0 .1rem; }
}
.pagerinfo { color: var(--muted); font-size: .85rem; padding: 0 .25rem; white-space: nowrap; }
.lhead form.markall { display: contents; }
.mlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mlist li { display: flex; align-items: center; }
.mlist li + li { border-top: 1px solid var(--line); }
.mlist li:hover { background: var(--hover); }
.mlist li.dup { opacity: .7; }
.mlist .marks { display: flex; padding-left: .25rem; }
.mlist .marks form { margin: 0; }
.mlist .marks .iconbtn { width: 30px; height: 30px; }
.mlist a.row {
  flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(110px, 24%) 1fr auto; gap: .9rem;
  align-items: center; padding: .55rem .9rem .55rem .35rem; color: var(--text);
}
.mlist a.row:hover { text-decoration: none; }
.mlist .from { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist li.new .from, .mlist li.new .subj { font-weight: 700; }
.mlist .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist .snip { color: var(--muted); }
.mlist .when { display: flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.mlist .when .ic { width: 15px; height: 15px; }
/* /search: the mails of one node of the panel search, more lines per mail (owner 2026-11-10) */
.lgap { flex: 1; }
.lhead h1 small .lp, .sbox .lp { color: var(--acct-name); }
.slist li { display: block; }
.slist a.row { grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .8rem; padding: .6rem .9rem .5rem; }
.slist .from small { color: var(--muted); font-weight: 400; margin-left: .25rem; }
.slist .subj { grid-column: 1 / -1; }
.slist .snip {
  grid-column: 1 / -1; font-size: .86rem; line-height: 1.45; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
}
.sfoot { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; padding: 0 .9rem .6rem; font-size: .8rem; color: var(--muted); }
.sbox { display: inline-flex; align-items: center; gap: .25rem; margin-right: .3rem; }
.sbox .ic, .sfile .ic { width: 14px; height: 14px; flex: none; }
.sfile {
  display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; padding: .12rem .55rem; border: 1px solid var(--line);
  border-radius: 999px; color: var(--text); background: var(--surface);
}
.sfile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sfile:hover { background: var(--hover); text-decoration: none; }
.lfoot { display: flex; justify-content: flex-end; align-items: center; gap: .35rem; margin-top: .6rem; }
.markbtn:not(.on) .ic .nat { fill: none; stroke: currentColor; }
.markbtn:not(.on) { color: var(--muted); opacity: .55; }
.markbtn:not(.on):hover { opacity: 1; }
.markbtn.on .ic .nat { fill-opacity: .95; }
@media (max-width: 760px) {
  .mlist a.row { grid-template-columns: 1fr auto; gap: .1rem .6rem; }
  .mlist .subj { grid-column: 1 / -1; }
  .mlist .from { grid-row: 1; }
  .mlist .when { grid-row: 1; grid-column: 2; }
}

/* ---------- message ---------- */
.mtools { display: flex; align-items: center; gap: .1rem; flex-wrap: wrap; margin: -.2rem 0 .5rem; }
.mtools form { display: contents; }
.mtools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 .35rem; }
.subject { word-break: break-word; margin-bottom: .5rem; }
.mfrom { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.mfrom .who { font-weight: 600; word-break: break-word; }
.mfrom time { color: var(--muted); font-size: .88rem; margin-left: auto; white-space: nowrap; }
details.minfo > summary { list-style: none; display: inline-flex; cursor: pointer; border-radius: 6px; }
details.minfo > summary::-webkit-details-marker { display: none; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: .4rem 0 1rem; font-size: .9rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; word-break: break-word; }
.atts { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.atts li { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem .4rem .7rem; max-width: 100%; }
.atts .fn { font-weight: 600; word-break: break-all; font-size: .9rem; }
.atts small { color: var(--muted); white-space: nowrap; }
.atts .iconbtn { width: 28px; height: 28px; }
.mailhtml { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
pre.body { white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; font: inherit; margin: 0; }
.notice { display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; border-radius: 8px; margin-bottom: .6rem;
  background: var(--hover); font-size: .9rem; }
.notice.place { border-left: 4px solid var(--warn); }

/* ---------- Add ---------- */
.addbox { max-width: 460px; margin: 5vh auto 0; }
.addbox h1 { display: flex; align-items: center; gap: .5rem; justify-content: center; }
.addbox h1 .ic { width: 24px; height: 24px; }
.add-form { display: grid; gap: .75rem; }
.add-form .addr-input input { flex: 1; }
.add-form .addr-input select { flex: 1.1; }
.add-form[data-kind=google] .pw-imap, .add-form[data-kind=signup] .pw-row, .add-form[data-kind=signup] .adv,
.add-form[data-kind=google] .adv, .add-form[data-kind=microsoft] .pw-imap, .add-form[data-kind=microsoft] .adv { display: none; }
.add-form:not([data-kind=google]) .pw-gg, .add-form:not([data-kind=microsoft]) .pw-ms { display: none; }
.add-form .lbl-google, .add-form .lbl-ms, .add-form .lbl-signup, .add-form .lbl-imap { display: none; }
.add-form[data-kind=google] .lbl-google, .add-form[data-kind=microsoft] .lbl-ms, .add-form[data-kind=signup] .lbl-signup,
.add-form[data-kind=imap] .lbl-imap, .add-form:not([data-kind]) .lbl-imap { display: inline; }
details.adv > summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
details.adv[open] > summary { margin-bottom: .6rem; }
details.adv .form-grid { margin: 0; }
.add-form button.primary { padding: .6rem; font-size: 1rem; }

/* ---------- profile ---------- */
.profile { max-width: 620px; }
.pdfpage .pdfpw { margin-top: .5rem; }            /* PDF Settings: the table takes the whole width (owner 2026-11-11) */
.phead { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.2rem; }
.phead h1 { margin: 0; }
.phead small { display: block; color: var(--muted); }
.photo-form { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
/* two-step sign-in (Profile) */
.twostep .tsitem + .tsitem { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.twostep .tshead { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.twostep .hint { margin: .25rem 0 .6rem; }
/* Profile: PDF passwords per sender (owner 2026-11-10). Text boxes drawn as dots, not type=password, so
   the browser does not offer to keep them as the login password of this site */
.pdfpw { margin-top: 1.25rem; }
.pphead { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; }
.pphead h2 { margin: 0; flex: 1; }
.ppshow { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; color: var(--muted); cursor: pointer; }
.ppshow input { width: auto; margin: 0; accent-color: var(--accent); }
.pptbl { margin-bottom: .8rem; }
.pptbl td, .pptbl th { padding: .35rem .4rem; }
.pptbl td input { width: 100%; min-width: 0; }
.grid.pptbl td input:not([type=checkbox]) { min-width: 0; }
.pptbl th.num, .pptbl td.num { width: 3.5rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.pptbl td:last-child { width: 36px; }
.ppwrap { overflow-x: auto; margin-bottom: .8rem; }
.ppwrap .pptbl { margin-bottom: 0; width: auto; }
/* owner 2026-11-11: sender 3x (106 -> 318 px), comment 5x (125 -> 625 px) the width they had */
.pptbl td.ppsnd input { width: 318px; }
.pptbl td.pprcp input { width: 240px; }
.pptbl td.pppw input { width: 124px; }
.pptbl td.ppnote input { width: 625px; }
.pptbl th.ppkind, .pptbl td.ppkind { white-space: nowrap; }
.pptbl th.ppex, .pptbl td.ppex { width: 44px; text-align: center; }
/* the table is wider than most screens (owner's widths): Example stays pinned at the right edge */
.ppwrap .pptbl th.ppex, .ppwrap .pptbl td.ppex { position: sticky; right: 0; z-index: 1; background: var(--surface);
  box-shadow: -6px 0 6px -6px rgba(0, 0, 0, .25); }
.pptbl td.ppex .iconbtn.on { background: var(--sel); color: var(--accent); }
/* Bank Statement column + the Statements senders not chosen yet (owner 2026-11-11) */
.pptbl tr.ppsec th { padding-top: .9rem; text-align: left; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: help; }
.pptbl tr.ppsug td input { color: var(--muted); }
.pptbl tr.ppsug.ppset td input { color: inherit; }
/* document kind: 4 tabs touching each other, a blue thumb slides under the chosen one (owner 2026-11-11) */
.kseg { position: relative; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: var(--surface); vertical-align: middle; }
.kseg button { position: relative; z-index: 1; width: 36px; height: 30px; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: color .2s; }
.kseg button + button { border-left: 1px solid var(--line); }
.kseg button:hover { color: var(--text); background: var(--hover); }
.kseg button .ic { width: 18px; height: 18px; }
.kseg button[aria-checked="true"] { color: #fff; background: transparent; }
.kseg button[aria-checked="true"] .ic { --ic: #fff; }
.kseg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.kthumb { position: absolute; z-index: 0; top: 0; bottom: 0; left: 0; width: 25%; background: #2563eb; opacity: 0;
  transition: transform .22s ease, opacity .15s; }
.kseg.ksel .kthumb { opacity: 1; }
.kseg.k1 .kthumb { transform: translateX(100%); }
.kseg.k2 .kthumb { transform: translateX(200%); }
.kseg.k3 .kthumb { transform: translateX(300%); }
.ic-kstmt { --ic: #2563eb; } .ic-kcard { --ic: #7c3aed; } .ic-kexp { --ic: #ea580c; } .ic-kother { --ic: #64748b; }
/* the Example panel of Profile is the file panel, hidden until a row's Example is clicked */
.fpanel[hidden], .fresizer[hidden] { display: none; }
.pwmask { -webkit-text-security: disc; }
.ppolist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin: .3rem 0 .6rem; }
.ppolist input { width: 100%; }
.ppother .ppbar { display: flex; justify-content: flex-end; }
.tsform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; margin-bottom: .5rem; }
.tsform input { flex: 1 1 150px; width: auto; }
.tsform label { display: grid; gap: .3rem; flex: 1 1 200px; }
.totp-setup { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.totp-setup img { background: #fff; border-radius: 8px; padding: 4px; }
.totp-setup > div { flex: 1 1 240px; }
.totp-setup p { margin: 0 0 .7rem; }
code.secret { font-size: .95rem; letter-spacing: .04em; user-select: all; word-break: break-all; }
.ts-on { display: inline-flex; margin-left: .3rem; }
.ts-on .ic { width: 15px; height: 15px; }
/* login: "or" line + Sign in with Google */
.orline { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .85rem; margin: 1rem 0 .8rem; }
.orline::before, .orline::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login .gbtn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: .55rem; }
.ic-google { --ic: #4285f4; }
.photo-form input[type=file] { max-width: 260px; font-size: .88rem; }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.stats span { display: inline-flex; align-items: center; gap: .3rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
.grid th, .grid td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.grid th { color: var(--muted); font-weight: 600; font-size: .82rem; white-space: nowrap; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.off td { color: var(--muted); }
.grid td input:not([type=checkbox]), .grid td select { min-width: 140px; }
.grid td .usercell { display: flex; align-items: center; gap: .5rem; }
.row-form { display: grid; gap: .3rem; margin: 0; }
.share-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.share-chips:not(:has(.chip)) { display: none; }
.share-chips .chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .25rem .15rem .6rem;
  border: 1px solid var(--line, #ccc); border-radius: 999px; background: var(--card, transparent); }
.share-chips .chipx { background: none; border: 0; padding: 0 .3rem; cursor: pointer; color: var(--muted); font-size: 1.05rem; line-height: 1; }
.share-chips .chipx:hover { color: var(--danger, #c00); }
.share-pick { position: relative; max-width: 26rem; }
.share-pick > input { width: 100%; box-sizing: border-box; }
.share-dd { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: .15rem 0 0; padding: .2rem 0; list-style: none;
  max-height: 16rem; overflow-y: auto; background: var(--bg, #fff); border: 1px solid var(--line, #ccc); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.share-dd li { padding: .35rem .7rem; cursor: pointer; }
.share-dd li.on, .share-dd li:hover { background: var(--hover, rgba(37, 99, 235, .12)); }
.share-dd li.none { color: var(--muted); cursor: default; }

/* ---------- account settings (sync) ---------- */
.sync-card { margin-bottom: 1.25rem; max-width: 760px; }
.sync-card.off { opacity: .75; }
.sync-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.sync-head h2 { margin: 0; word-break: break-all; }
.sync-status { margin: .6rem 0 .9rem; font-size: .92rem; }
.sync-status .flash { margin: .5rem 0 0; }
.sync-status progress { display: block; width: 100%; margin-top: .4rem; }
.sync-form { margin-bottom: 0; max-width: none; }
.btns { display: flex; flex-wrap: wrap; gap: .5rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.help { max-width: 760px; margin-top: 1.25rem; font-size: .92rem; }
.help summary { cursor: pointer; font-weight: 600; }
.help li { margin: .2rem 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
details.sub { margin-top: .5rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
details.sub > summary, details.folders > summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
details.folders { margin: 0 0 .8rem; font-size: .9rem; }
details.folders code { display: inline-block; margin: .1rem 0; }
.copy-list { list-style: none; padding: 0; margin: 0 0 .8rem; }
.copy-list li { margin: .2rem 0; word-break: break-all; }
.pagehead { display: flex; align-items: center; gap: .55rem; margin-bottom: .9rem; }
.pagehead h1 { margin: 0; display: flex; align-items: center; gap: .5rem; word-break: break-all; }
.pagehead h1 .ic { width: 22px; height: 22px; }

/* ---------- guides ---------- */
.guide { max-width: 800px; }
.guide h2 { margin-top: 1.6rem; padding-top: .4rem; border-top: 1px solid var(--line); }
.guide ol > li, .guide ul > li { margin: .45rem 0; }
.guide .step-link { font-weight: 600; }
.guide .note { background: var(--hover); border-left: 4px solid var(--accent); padding: .55rem .8rem; border-radius: 6px; margin: .8rem 0; }
.guide .warnbox { background: var(--hover); border-left: 4px solid var(--warn); padding: .55rem .8rem; border-radius: 6px; margin: .8rem 0; }
.guide .checked { color: var(--muted); font-size: .88rem; }
.guide .sources { font-size: .88rem; color: var(--muted); }
.guide .sources a { word-break: break-all; }
.guide table.grid td, .guide table.grid th { white-space: normal; }
.guide figure.shot { margin: .6rem 0 1rem; }
.guide figure.shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.guide figure.shot figcaption { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.guide details.manual { margin: 1rem 0; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .8rem; }
.guide details.manual summary { cursor: pointer; font-weight: 600; }
.kbd { display: inline-block; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 .4em; background: var(--surface); font-size: .9em; white-space: nowrap; }
.back { margin: 0 0 .5rem; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.bar h1 { margin: 0; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.filters select { width: auto; max-width: 280px; }
.filters input { width: 240px; }

@media (max-width: 640px) {
  .filters, .filters select, .filters input { width: 100%; max-width: none; }
  .meta { grid-template-columns: 1fr; }
  .meta dd { margin-bottom: .35rem; }
  .row2 { grid-template-columns: 1fr; }
}

/* ---------- Google Drive mirror ---------- */
.sub-h { font-size: .95rem; margin: .4rem 0 .4rem; }
.roots { list-style: none; padding: 0; margin: 0 0 .8rem; display: grid; gap: .3rem; }
.roots li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .8rem; }
.roots li > span { font-weight: 600; word-break: break-word; }
form.inline { display: inline; margin: 0; }
.sheet-wrap { max-height: 75vh; overflow: auto; }
table.sheet td, table.sheet th { white-space: nowrap; font-size: .85rem; padding: .3rem .5rem; }
table.sheet .rownum { color: var(--muted); text-align: right; position: sticky; left: 0; background: var(--surface); }
table.sheet thead th { position: sticky; top: 0; background: var(--surface); }
.addfoot { display: flex; justify-content: center; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .9rem; }
.addfoot span { display: inline-flex; align-items: center; gap: .3rem; }
.addfoot .ic, .pw-google .ic { width: 15px; height: 15px; }
.pw-google > .hint { margin: 0; }
.pw-google > .hint .ic, .addfoot .ic { display: inline-block; vertical-align: -2px; margin-right: .2rem; }
.pw-google .gsetup { margin: .6rem 0 0; align-items: flex-start; }
.pw-google .gsetup .ic { margin-top: .2rem; }

/* ---------- public pages: about / privacy / terms (needed by Google's branding page) ---------- */
main.pubmain { max-width: 780px; }
.pubnav { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1rem; padding-bottom: .7rem; margin-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.pubnav .name { display: inline-flex; align-items: center; gap: .5rem; margin-right: auto; font-weight: 700; font-size: 1.15rem; color: inherit; }
.pubnav a.on { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.pubhero { display: flex; align-items: center; gap: 1.1rem; margin-bottom: .6rem; }
.pubhero p { margin: 0; }
.pub h2 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; }
.pub li { margin: .3rem 0; }
.pub .updated { color: var(--muted); font-size: .88rem; }
.pub .en { margin-top: 2.2rem; padding-top: .4rem; border-top: 1px dashed var(--line); }
.publinks { text-align: center; font-size: .85rem; margin-top: 1rem; }
@media (max-width: 520px) { .pubhero { flex-direction: column; align-items: flex-start; } .pubhero img { width: 64px; height: 64px; } }

/* ---------- Drive browse (look first, then tick what to copy) ---------- */
.dsearch input { width: min(260px, 40vw); }
.dviews { display: inline-flex; gap: 2px; }
.dviews .iconbtn.on { background: var(--hover); color: var(--accent); }
.dflist .flrow { grid-template-columns: minmax(220px, 3fr) 4.6rem 5rem 8.6rem minmax(90px, 1fr); }
.fcard.dfolder .fthumb .ic { width: 46%; height: 46%; color: #e8b84a; }
.fcard.off, .flrow.off { opacity: .55; }
.dtabs { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; margin: -.2rem 0 .8rem; font-size: .92rem; }
.dtabs > a { padding: .25rem .1rem; color: var(--muted); border-bottom: 2px solid transparent; }
.dtabs > a.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.dtabs > a:hover { text-decoration: none; color: var(--text); }
.dtabs .crumbs { color: var(--muted); min-width: 0; }
.dlist td.ck, .dlist th.ck { width: 1%; text-align: center; }
.dlist td.ck input { width: auto; margin: 0; accent-color: var(--accent); }
.dlist td a { display: inline-flex; align-items: center; gap: .35rem; }
.dlist td .ic { width: 17px; height: 17px; }
.dlist tr.off td { color: var(--muted); }
.dall { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-weight: 600; cursor: pointer; }
.dbar {
  position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-top: .6rem;
  padding: .6rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.dbar { margin-bottom: var(--safe-b); }
.dconnect { max-width: 620px; }
.dconnect > p:first-child { margin-top: 0; }
.dquota { display: inline-flex; align-items: center; gap: .45rem; margin-left: .8rem; font-weight: normal; vertical-align: middle; }
.dquota progress { width: 140px; height: 8px; accent-color: var(--accent); }
.dquota small { color: var(--muted); white-space: nowrap; }
/* Portrait phones: the kind and date columns fold into a small line under the name. */
.dlist .dsub { display: none; }
@media (max-width: 640px) {
  .dlist th.dk, .dlist td.dk, .dlist th.dm, .dlist td.dm { display: none; }
  .dlist .dsub { display: block; color: var(--muted); font-size: .8rem; font-weight: normal; }
  .dquota { display: flex; margin: .3rem 0 0; }
  .dquota progress { flex: 1; width: auto; min-width: 60px; }
}

/* ---------- AI assistant (owner 2026-11-06): same cartoon as pos; Claude mark = the "buckle" ---------- */
.aibtn {
  position: fixed; left: calc(14px + var(--safe-l)); bottom: calc(14px + var(--safe-b)); z-index: 40;
  background: none; border: 0; padding: 0; cursor: pointer; line-height: 0;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .35)); transition: transform .12s;
}
.aibtn:hover { background: none; transform: translateY(-3px) scale(1.04); }
.aibtn img { width: 96px; height: 96px; display: block; pointer-events: none; -webkit-user-drag: none; }
.aibtn .cap {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); white-space: nowrap;
  background: #1a3a6b; color: #fff; font-size: 12px; line-height: 1.7; padding: 1px 10px; border-radius: 12px;
}
.aibtn .cmark {
  position: absolute; top: -7px; right: -7px; width: 17px; height: 17px; display: block; padding: 1px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.aibtn .cmark[hidden] { display: none; }
.aibtn .cmark svg { width: 100%; height: 100%; display: block; }
html.aio .aibtn, html.po .aibtn { display: none; }
/* room under the last rows so the cartoon (bottom left since 11/11/2026) never hides them */
body:has(.aibtn) main.content { padding-bottom: calc(118px + var(--safe-b)); }
body:has(.aibtn) .panel { padding-bottom: calc(118px + var(--safe-b)); }
.aibox label.switch { color: var(--text); }
@media (max-width: 760px) {
  .aibtn img { width: 70px; height: 70px; }
  .aibtn .cap { font-size: 11px; padding: 0 8px; }
}
.aipanel {
  position: fixed; z-index: 45; left: 0; top: calc(var(--top-h) + var(--safe-t)); bottom: 0; width: min(var(--aiw, 440px), 100vw);
  display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: var(--shadow); padding-bottom: var(--safe-b);
}
.aipanel[hidden] { display: none; }
/* the AI panel sits on the LEFT and its right edge drags its width (owner 2026-11-11 — the right side is for files) */
.airesizer { position: absolute; z-index: 3; right: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; }
.airesizer:hover, html.airesizing .airesizer { background: var(--accent); opacity: .35; }
html.airesizing, html.airesizing * { cursor: col-resize !important; user-select: none !important; }
html.airesizing iframe { pointer-events: none; }
@media (max-width: 760px) { .airesizer { display: none; } .aipanel { width: 100vw; } }
.aihead { display: flex; align-items: center; gap: .45rem; padding: .45rem .5rem .45rem .8rem; border-bottom: 1px solid var(--line); }
.aihead select { width: auto; max-width: 170px; padding: .2rem .4rem; font-size: .85rem; }
.ailog { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .8rem; display: flex; flex-direction: column; gap: .8rem; }
.aiturn { display: flex; flex-direction: column; gap: .4rem; }
.aiq { align-self: flex-end; max-width: 88%; padding: .45rem .7rem; border-radius: 12px 12px 3px 12px; background: var(--sel); white-space: pre-wrap; overflow-wrap: anywhere; }
.aia { align-self: stretch; overflow-wrap: anywhere; }
.aia p { margin: 0 0 .5rem; }
.aia ul { margin: 0 0 .5rem; padding-left: 1.2rem; }
.aia li { margin: .15rem 0; }
.aisteps { list-style: none; margin: 0 0 .35rem; padding: 0; color: var(--muted); font-size: .8rem; }
.aisteps li::before { content: "› "; }
.aiwait { color: var(--muted); font-size: .88rem; animation: pulse 1.4s ease-in-out infinite; }
.aierr { color: var(--err-text); background: var(--err-bg); padding: .45rem .65rem; border-radius: 8px; font-size: .9rem; }
.aimeta { color: var(--muted); font-size: .72rem; }
.ainote { color: var(--muted); font-size: .85rem; padding: .5rem .65rem; border: 1px dashed var(--line); border-radius: 8px; }
.aia .ainote { margin-top: .4rem; }
.aiwarn { flex: none; max-height: 30%; overflow-y: auto; padding: 0 .8rem .5rem; }
.aiwarn[hidden] { display: none; }
.ainote a, .aierr a { color: inherit; text-decoration: underline; font-weight: 600; }
.aiempty { margin: auto 0; text-align: center; color: var(--muted); font-size: .9rem; }
.aiask { display: flex; flex-direction: column; gap: .4rem; padding: .55rem; border-top: 1px solid var(--line); }
.airow { display: flex; align-items: flex-end; gap: .4rem; }
.airow textarea { flex: 1; resize: none; min-height: 2.7rem; max-height: 9rem; }
.aiattach { flex: none; align-self: flex-end; margin-bottom: .2rem; }
.aiattach:disabled { opacity: .35; cursor: default; }
/* topics (owner 2026-11-10): title line, list + search, fold line of the AI's compacted memory */
.aititle { display: flex; align-items: center; min-height: 2rem; padding: .15rem .8rem; border-bottom: 1px solid var(--line); }
.aitname { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: .2rem 0; color: var(--text);
  font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; }
.aitname:hover { background: none; text-decoration: underline dotted; }
.aitname.new { color: var(--muted); font-weight: 400; cursor: default; text-decoration: none; }
.aitinput { flex: 1; min-width: 0; padding: .2rem .4rem; font-size: .88rem; }
.aitopics { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.aitopics[hidden] { display: none; }
.aipanel.topics .ailog, .aipanel.topics .aiwarn, .aipanel.topics .aiask, .aipanel.topics .aititle { display: none; }
[data-ai-topics][aria-expanded="true"] { background: var(--sel); }
.aitq { display: flex; align-items: center; gap: .4rem; margin: .6rem .8rem .3rem; padding: 0 .55rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.aitq .ic { width: 16px; height: 16px; flex: none; color: var(--muted); }
.aitq input { flex: 1; min-width: 0; border: 0; padding: .45rem 0; background: none; outline: none; }
.aitlist { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .2rem .5rem .8rem; }
.aitem { display: grid; gap: .1rem; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px;
  padding: .5rem .55rem; color: var(--text); cursor: pointer; }
.aitem:hover { background: var(--hover); }
.aitem.cur { background: var(--sel); }
.aitem b { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aitem small { color: var(--muted); font-size: .75rem; }
.aitem .snip { color: var(--muted); font-size: .8rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aitem mark, .aitem .snip mark { background: var(--mark); color: inherit; border-radius: 2px; }
.aimore { align-self: center; margin: .2rem auto; display: block; font-size: .82rem; padding: .25rem .8rem; }
.aiturn.hit .aiq { outline: 2px solid var(--accent); outline-offset: 2px; }
.aifold { border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); padding: .3rem 0; font-size: .82rem; color: var(--muted); }
.aifold summary { cursor: pointer; text-align: center; list-style: none; }
.aifold summary::-webkit-details-marker { display: none; }
.aifold summary::before { content: "⋯ "; }
.aifold[open] summary { margin-bottom: .4rem; }
.aifold .aibody { color: var(--text); font-size: .85rem; background: var(--panel); border-radius: 8px; padding: .5rem .7rem; }
/* files of a question: chips while picking, thumbnails above the question bubble */
.aifiles { display: flex; flex-wrap: wrap; gap: .35rem; }
.aifiles[hidden] { display: none; }
.aichip { display: flex; align-items: center; gap: .35rem; max-width: 100%; padding: .2rem .25rem .2rem .3rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: .8rem; }
.aichip img { width: 34px; height: 34px; object-fit: cover; border-radius: 5px; flex: none; }
.aichip .nm { max-width: 11rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aichip.up .nm { animation: pulse 1.4s ease-in-out infinite; }
.aichip.err { border-color: var(--err-text); color: var(--err-text); background: var(--err-bg); }
.aichip .why { font-size: .75rem; }
.aix { flex: none; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: 50%; background: none;
  color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; }
.aix:hover { background: var(--hover); color: var(--text); }
.aiqf { align-self: flex-end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; max-width: 88%; }
.aif { display: block; line-height: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.aif img { width: 84px; height: 84px; object-fit: cover; display: block; }
.aif.file { line-height: 1.3; padding: .35rem .55rem; font-size: .8rem; background: var(--panel); color: var(--text);
  max-width: 14rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aipanel.drag { outline: 3px dashed var(--accent); outline-offset: -6px; }
/* toggle switch (AI permissions of a box) */
label.switch { position: relative; display: flex; align-items: center; gap: .6rem; cursor: pointer; }
label.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.switch .sw { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line); transition: background .15s; }
label.switch .sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s;
}
label.switch input:checked + .sw { background: var(--accent); }
label.switch input:checked + .sw::after { transform: translateX(16px); }
label.switch input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.aibox-inline { display: grid; gap: .5rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); }

.sndset .kseg { align-self: flex-start; margin-top: .15rem; }
.sndset .sfield small { color: var(--text); font-weight: 600; }
/* file-name shapes of a sender (owner 2026-11-11): one sub-row each, lighter, the shape in monospace */
.pptbl td.ppshape { min-width: 220px; max-width: 340px; }
.pptbl td.ppshape code { font-size: .8rem; overflow-wrap: anywhere; }
.pptbl tr.pppat td { padding-top: .15rem; padding-bottom: .15rem; border-top: 0; }
.pptbl tr.pppat td.ppshape { padding-left: 1.2rem; position: relative; }
.pptbl tr.pppat td.ppshape::before { content: "└"; position: absolute; left: .3rem; color: var(--muted); }
.pptbl tr.pppat td.ppnote { font-size: .8rem; }
/* the system's own guess (doctype.py): the same thumb, light blue, until a person picks a tab */
.kseg.kauto .kthumb { opacity: 1; background: #bfdbfe; }
.kseg button.ka { color: #1e3a8a; }
.kseg button.ka .ic { --ic: #1e3a8a; }
:root[data-theme="dark"] .kseg.kauto .kthumb { background: #1e3a8a; }
:root[data-theme="dark"] .kseg button.ka, :root[data-theme="dark"] .kseg button.ka .ic { color: #dbeafe; --ic: #dbeafe; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kseg.kauto .kthumb { background: #1e3a8a; }
  :root:not([data-theme="light"]) .kseg button.ka, :root:not([data-theme="light"]) .kseg button.ka .ic { color: #dbeafe; --ic: #dbeafe; }
}
/* Files ☰: the document kinds under Statement, one step in, with their counts (owner 2026-11-11) */
.fkinds label.ksub { padding-left: 1.6rem; }
.fkinds label .fcnt { margin-left: auto; }
.fkinds label small { color: var(--muted); font-weight: 400; }
/* a file the Statement sync took (stmt_exports, owner 2026-11-11): bank icon before its name, colour = state */
.fbank { display: inline-flex; vertical-align: -2px; margin-right: .25rem; font-style: normal; cursor: help; }
.fbank .ic { width: 14px; height: 14px; }
.fbank.s-done .ic, .fbank.s-dup .ic { --ic: #16a34a; color: #16a34a; }
.fbank.s-queued .ic { --ic: #2563eb; color: #2563eb; }
.fbank.s-need_password .ic, .fbank.s-error .ic { --ic: #d97706; color: #d97706; }
.fbank.s-skipped .ic { --ic: #94a3b8; color: #94a3b8; }
.fbank.s-waiting .ic { --ic: #7c3aed; color: #7c3aed; }

/* Files ☰ > Statement: "only the PDFs no saved password opens yet" switch (owner 2026-11-12) */
.fkinds label.switch.flock { margin-top: .3rem; padding-top: .5rem; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.fkinds label.switch.flock .ic { color: var(--muted); }

/* Google Drive in the Files tab (2026-11-12): Drive nodes, their two tabs one level in, "also elsewhere" mark */
details.fnode.fsubn > summary { padding-left: 1.5rem; }
.fboxes .node.fsubn { padding-left: 1.7rem; }
.dtag { margin-right: .3rem; padding: 0 .3rem; border-radius: 4px; font-size: .68rem; font-weight: 600; line-height: 1.35;
        background: var(--hover); color: var(--muted); vertical-align: 1px; }
.falso { display: inline-flex; vertical-align: -2px; color: var(--muted); }
.falso .ic { width: 12px; height: 12px; }
.c-box .ic { width: 13px; height: 13px; vertical-align: -2px; margin-right: .2rem; color: var(--muted); }
.fcard .fsub .dtag { background: rgba(255,255,255,.14); color: #e5e7eb; }

/* password field with an eye button to show / hide what was typed (owner 2026-11-12) */
.pwbox { position: relative; display: block; min-width: 0; }
.pwbox > input { width: 100%; padding-right: 2.2rem; box-sizing: border-box; }
.pwbox > .pweye { position: absolute; right: .2rem; top: 50%; transform: translateY(-50%); background: none; border: 0;
  padding: .25rem; color: var(--muted); cursor: pointer; line-height: 0; }
.pwbox > .pweye:hover, .pwbox > .pweye.on { color: var(--accent, currentColor); }
.pwbox > .pweye .ic { width: 1.1rem; height: 1.1rem; }
