/* amail / adrive / asheets — Google-Workspace-like look */
:root {
  --bg: #f6f8fc; --surface: #fff; --surface2: #f2f6fc; --hover: #eaf1fb; --sel: #c2e7ff; --nav-active: #d3e3fd;
  --text: #1f1f1f; --text2: #444746; --text3: #5e5e5e; --line: #e1e3e6; --accent: #0b57d0; --accent-bg: #0b57d0; --accent-fg: #fff;
  --search: #e9eef6; --mark: #fde293; --pill: #c2e7ff; --pill-fg: #001d35; --gold: #f4b400; --danger: #d93025;
  --shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); --shadow2: 0 2px 6px 2px rgba(60,64,67,.15), 0 1px 2px rgba(60,64,67,.3);
  --font: "Google Sans", Roboto, "Segoe UI", system-ui, -apple-system, sans-serif; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0e0e0e; --surface: #1e1f20; --surface2: #28292a; --hover: #2d2e30; --sel: #004a77; --nav-active: #004a77; --text: #e3e3e3; --text2: #c4c7c5; --text3: #9aa0a6; --line: #3c4043; --accent: #a8c7fa; --accent-bg: #a8c7fa; --accent-fg: #062e6f; --search: #282a2c; --mark: #6b5d1a; --pill: #004a77; --pill-fg: #c2e7ff; } }
:root[data-theme="dark"] { --bg: #0e0e0e; --surface: #1e1f20; --surface2: #28292a; --hover: #2d2e30; --sel: #004a77; --nav-active: #004a77; --text: #e3e3e3; --text2: #c4c7c5; --text3: #9aa0a6; --line: #3c4043; --accent: #a8c7fa; --accent-bg: #a8c7fa; --accent-fg: #062e6f; --search: #282a2c; --mark: #6b5d1a; --pill: #004a77; --pill-fg: #c2e7ff; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); overflow: hidden; }
body.noscroll { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface2); padding: 1px 4px; border-radius: 4px; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: var(--surface); }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.hidden { display: none !important; }
.muted { color: var(--text3); }
.b { font-weight: 700; }
.spacer { flex: 1; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap { word-break: break-all; }
.ic { width: 20px; height: 20px; fill: currentColor; flex: none; vertical-align: middle; }
.ic.small { width: 16px; height: 16px; }
.ic.big { width: 48px; height: 48px; }
.ic.huge { width: 96px; height: 96px; }
.ic.gold { color: var(--gold); }
.kic { display: inline-flex; align-items: center; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 500; flex: none; }
.avatar.me { width: 32px; height: 32px; background: #7b1fa2; font-size: 14px; margin-left: 4px; cursor: default; }

/* Boot */
.boot { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.boot-logo .logo-mark { font-size: 48px; width: 72px; height: 72px; }
.boot-bar { width: 240px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.boot-fill { height: 100%; width: 10%; background: var(--accent); transition: width .2s; }
.boot-text { color: var(--text3); }
.loading { display: flex; justify-content: center; padding: 48px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.iconbtn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text2); flex: none; }
.iconbtn:hover { background: rgba(60,64,67,.08); }
.iconbtn.on { color: var(--accent); }
.iconbtn:disabled { opacity: .35; cursor: default; background: none; }
.iconbtn.small { width: 32px; height: 32px; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.iconbtn.tiny { width: 24px; height: 24px; } .iconbtn.tiny .ic { width: 16px; height: 16px; }
.iconbtn.light { color: #fff; } .iconbtn.light:hover { background: rgba(255,255,255,.15); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px 0 12px; border-radius: 18px; border: 1px solid var(--line); color: var(--accent); font-weight: 500; background: var(--surface); white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent-bg); color: var(--accent-fg); border-color: transparent; }
.btn.light { color: #fff; background: transparent; border-color: rgba(255,255,255,.4); } .btn.light:hover, .btn.light.on { background: rgba(255,255,255,.15); }
.linkbtn { color: var(--accent); font-size: 13px; }
.linkbtn:hover { text-decoration: underline; }
.pill { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 24px 0 16px; border-radius: 16px; background: var(--pill); color: var(--pill-fg); font-weight: 500; font-size: 14px; box-shadow: none; margin: 8px 0 16px 8px; }
.pill:hover { box-shadow: var(--shadow); }
.pill .ic { width: 24px; height: 24px; }

/* Top bar */
#app { display: grid; grid-template-rows: 64px minmax(0, 1fr); height: 100vh; }
#app:has(.warnbar) { grid-template-rows: auto 64px minmax(0, 1fr); }
.warnbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: #fde7e9; color: #5c0a12; border-bottom: 1px solid #f2b8bd; font-size: 13px; line-height: 1.35; }
.warnbar svg { flex: none; color: #a50e0e; }
.warnbar-text { flex: 1; min-width: 0; }
.warnbar .btn { flex: none; }
html.theme-satire .warnbar { background: #1b1b1b; color: #f3e9e9; border-bottom: 3px solid #a50e0e; }
html.theme-satire .warnbar svg { color: #ff6b6b; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .warnbar { background: #3a1216; color: #f3d6d9; border-color: #6b2229; } }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; }
.tb-left { display: flex; align-items: center; min-width: 240px; flex: none; white-space: nowrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--text2); font-size: 22px; margin-left: 4px; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: var(--c, #ea4335); color: #fff; font-weight: 700; font-size: 20px; }
.logo-name { font-family: var(--font); letter-spacing: -.2px; }
.searchbox { position: relative; display: flex; align-items: center; flex: 1; max-width: 720px; height: 48px; background: var(--search); border-radius: 24px; padding: 0 4px; }
.searchbox:focus-within { background: var(--surface); box-shadow: var(--shadow); }
.searchbox input { flex: 1; height: 48px; border: 0; background: none; outline: none; font-size: 16px; min-width: 0; }
.searchbox input::-webkit-search-cancel-button { display: none; }
.suggest { position: absolute; top: 52px; left: 0; right: 0; background: var(--surface); border-radius: 0 0 16px 16px; box-shadow: var(--shadow2); padding: 8px 0; z-index: 30; }
.sug { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 16px; text-align: left; }
.sug:hover { background: var(--hover); }
.tb-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.search-status { font-size: 12px; display: inline-flex; align-items: center; }

/* Shell */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 0; height: 100%; }
body.nav-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
body.nav-collapsed .sidenav { display: none; }
body.nav-collapsed .main { padding-left: 16px; }
.sidenav { overflow-y: auto; padding: 0 8px 16px 4px; }
.nav { list-style: none; margin: 0; padding: 0; }
.navitem a { display: flex; align-items: center; gap: 16px; height: 32px; padding: 0 12px 0 24px; border-radius: 0 16px 16px 0; color: var(--text2); font-size: 14px; }
.navitem a:hover { background: var(--hover); }
.navitem.active a { background: var(--nav-active); color: var(--text); font-weight: 700; }
.navitem .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navitem .count { font-size: 12px; color: var(--text2); }
.navitem.active .count { font-weight: 700; }
.navitem.sub a { padding-left: 32px; height: 30px; font-size: 13px; }
.navhead { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px 24px; font-size: 13px; color: var(--text2); font-weight: 500; }
.navhint { padding: 4px 24px; font-size: 12px; color: var(--text3); }
.navsrc { display: flex; align-items: center; gap: 8px; padding: 6px 24px 2px; font-size: 12px; color: var(--text3); overflow: hidden; }
.navsrc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navgroup ul { list-style: none; margin: 0; padding: 0; }
.ic.dot { color: var(--accent); }
.main { min-width: 0; min-height: 0; height: 100%; padding: 0 16px 16px 0; display: flex; box-sizing: border-box; }
.card { flex: 1; background: var(--surface); border-radius: 16px; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 4px 12px 4px 8px; border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.tb-title { font-weight: 500; margin-left: 4px; }
.pager { display: flex; align-items: center; gap: 2px; font-size: 12px; color: var(--text2); margin-left: 8px; }
.pager .muted { margin-right: 4px; }
.quick { height: 32px; border: 1px solid var(--line); border-radius: 16px; padding: 0 12px; background: var(--surface2); outline: none; width: 220px; }
.quick:focus { border-color: var(--accent); background: var(--surface); }
.empty { padding: 48px 16px; text-align: center; color: var(--text3); }

/* Mail list */
.mlist { overflow-y: auto; flex: 1; }
.mrow { position: relative; display: flex; align-items: center; height: 40px; padding: 0 16px 0 4px; cursor: pointer; background: var(--surface2); border-bottom: 1px solid var(--line); gap: 4px; }
.mrow.unread { background: var(--surface); font-weight: 700; }
.mrow.unread .mrow-snip, .mrow .mrow-snip { font-weight: 400; color: var(--text3); }
.mrow:hover { box-shadow: inset 1px 0 0 var(--line), inset -1px 0 0 var(--line), 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); z-index: 1; }
.mrow.sel { background: var(--sel); }
.mrow.cursor { box-shadow: inset 3px 0 0 var(--accent); }
.mrow-ctl { display: flex; align-items: center; flex: none; }
.mrow-ctl .iconbtn { color: var(--text3); } .mrow-ctl .star.on { color: var(--gold); }
.mrow-who { width: 200px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.mrow-who .cnt { font-weight: 400; color: var(--text3); font-size: 12px; }
.mrow-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.mrow-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow-atts { display: flex; gap: 4px; flex: none; }
.attchip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; font-weight: 400; max-width: 160px; background: var(--surface); }
.attchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attchip .ic { width: 14px; height: 14px; }
.attchip:hover { background: var(--hover); }
.mrow-right { display: flex; align-items: center; gap: 6px; flex: none; font-size: 12px; min-width: 64px; justify-content: flex-end; }
.mrow-right .ic { width: 16px; height: 16px; color: var(--text3); } .mrow-right .note { color: var(--gold); }
.mrow-hover { position: absolute; right: 8px; top: 0; height: 40px; display: none; align-items: center; background: inherit; padding-left: 8px; }
.mrow:hover .mrow-hover { display: flex; } .mrow:hover .mrow-right { visibility: hidden; }
.mrow-hover .iconbtn { color: var(--text2); }
.lbl { display: inline-block; font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 4px; margin: 0 4px 0 6px; vertical-align: middle; }
.lbl.big { font-size: 12px; padding: 2px 4px 2px 8px; display: inline-flex; align-items: center; gap: 2px; }
.lbl.big button { display: inline-flex; } .lbl.big .ic { width: 14px; height: 14px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--surface2); font-size: 12px; font-weight: 400; color: var(--text2); }
.chip .ic { width: 14px; height: 14px; } .chip.tiny { height: 18px; padding: 0 4px; margin-right: 6px; } .chip.small { height: 20px; margin-left: 8px; }
.tiny .ic { width: 12px; height: 12px; }

/* Thread */
.thread { overflow-y: auto; flex: 1; padding: 0 16px 24px; }
.thread-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 16px 56px 8px; }
.thread-subj { font-size: 22px; font-weight: 400; margin: 0; }
.thread-src { font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; }
.msgs { display: flex; flex-direction: column; }
.msg { border-bottom: 1px solid var(--line); }
.msg-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 8px; cursor: pointer; }
.msg-headmain { flex: 1; min-width: 0; }
.msg-from { display: flex; align-items: center; gap: 6px; }
.msg-from .addr { color: var(--text3); font-size: 12px; }
.msg-from .ic.att { width: 16px; height: 16px; color: var(--text3); }
.msg-to { font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 2px; margin-top: 2px; }
.msg-to span { color: var(--text2); }
.msg-snip { font-size: 13px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.msg-date { font-size: 12px; color: var(--text3); white-space: nowrap; }
.msg-actions { display: flex; align-items: center; }
.msg-actions .on { color: var(--gold); }
.msg:not(.open) .open-only, .msg.open .closed-only { display: none; }
.msg:not(.open) .msg-body, .msg:not(.open) .msg-atts, .msg:not(.open) .msg-details { display: none; }
.msg:not(.open) .msg-head { opacity: .85; }
.msg-details { margin: 0 8px 12px 60px; font-size: 12px; background: var(--surface2); border-radius: 8px; padding: 8px 12px; }
.msg-details th { text-align: right; color: var(--text3); font-weight: 400; padding-right: 8px; vertical-align: top; white-space: nowrap; }
.msg-body { padding: 0 8px 16px 60px; }
.body-tools { margin-bottom: 8px; }
.mail-frame { width: 100%; border: 0; min-height: 60px; background: #fff; border-radius: 4px; }
.mail-text { white-space: pre-wrap; word-break: break-word; font-family: var(--font); font-size: 14px; line-height: 1.5; margin: 0; }
.mail-text.quoted { color: var(--text3); border-left: 2px solid var(--line); padding-left: 8px; margin-top: 8px; }
.quote-btn { display: inline-block; margin-top: 8px; padding: 0 8px; height: 14px; line-height: 10px; border-radius: 7px; background: #e0e0e0; color: #444; font-size: 12px; letter-spacing: 1px; }
.msg-atts { padding: 0 8px 16px 60px; }
.attcards { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.attcard { width: 180px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; text-align: left; background: var(--surface); }
.attcard:hover { box-shadow: var(--shadow); }
.attcard img { width: 100%; height: 110px; object-fit: cover; display: block; background: var(--surface2); }
.attcard-ic { height: 110px; display: flex; align-items: center; justify-content: center; background: var(--surface2); }
.attcard-foot { display: flex; align-items: center; gap: 6px; padding: 8px; font-size: 12px; }
.attcard-foot .ic { width: 16px; height: 16px; }
.attcard-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-notes { margin: 24px 0 0 60px; max-width: 720px; }
.thread-notes h4 { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0 0 8px; }
.thread-notes h4 .ic { color: var(--gold); }
.note { width: 100%; min-height: 72px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface); resize: vertical; outline: none; }
.note:focus { border-color: var(--accent); }
/* Chat */
.chatview { padding: 8px 0 16px 48px; gap: 6px; max-width: 820px; }
.chat-day { text-align: center; font-size: 12px; color: var(--text3); margin: 16px 0 8px; }
.chat-msg { display: flex; align-items: flex-end; gap: 8px; }
.chat-msg.me { justify-content: flex-end; }
.bubble { max-width: 70%; background: var(--surface2); border-radius: 16px 16px 16px 4px; padding: 8px 12px; }
.chat-msg.me .bubble { background: var(--sel); border-radius: 16px 16px 4px 16px; }
.bubble-who { font-size: 11px; color: var(--text3); margin-bottom: 2px; }
.chat-msg.me .bubble-who { display: none; }
.bubble-text { white-space: pre-wrap; word-break: break-word; }
.bubble-time { font-size: 10px; color: var(--text3); text-align: right; margin-top: 2px; }
/* People */
.plist { overflow-y: auto; flex: 1; }
.prow { display: flex; align-items: center; gap: 16px; padding: 8px 24px; border-bottom: 1px solid var(--line); }
.prow:hover { background: var(--hover); }
.prow-main { flex: 1; min-width: 0; }
.prow-name { font-weight: 500; }
.prow-addr { font-size: 12px; color: var(--text3); }
.prow-stats { display: flex; gap: 16px; font-size: 13px; align-items: center; }
.prow-stats a { display: inline-flex; align-items: center; gap: 4px; }
.prow-stats .ic { width: 16px; height: 16px; }

/* Drive */
.drive-tb .crumbs { display: flex; align-items: center; gap: 2px; font-size: 18px; min-width: 0; overflow: hidden; }
.crumb { color: var(--text2); padding: 4px 8px; border-radius: 16px; white-space: nowrap; }
a.crumb:hover { background: var(--hover); }
.crumb.cur { color: var(--text); }
.chips { display: flex; gap: 8px; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--text2); }
.fchip:hover { background: var(--hover); } .fchip.on { background: var(--nav-active); border-color: transparent; color: var(--text); }
.fchip .ic { width: 18px; height: 18px; }
.drive-body { display: flex; flex: 1; min-height: 0; }
.drive-main { flex: 1; min-width: 0; overflow-y: auto; }
.dlist { padding: 0 8px; }
.drow { display: flex; align-items: center; height: 48px; border-bottom: 1px solid var(--line); padding: 0 8px; cursor: default; border-radius: 0; }
.drow.head { height: 40px; font-size: 13px; color: var(--text2); font-weight: 500; }
.drow:not(.head):hover { background: var(--hover); }
.drow.sel { background: var(--sel); }
.drow.folder { cursor: pointer; }
.dname { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.dname-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.downer { width: 220px; flex: none; font-size: 13px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.ddate { width: 140px; flex: none; font-size: 13px; color: var(--text2); }
.dsize { width: 100px; flex: none; font-size: 13px; color: var(--text2); }
.dmore { width: 72px; flex: none; display: flex; justify-content: flex-end; visibility: hidden; }
.drow:hover .dmore, .drow.sel .dmore { visibility: visible; }
.sortbtn { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; color: inherit; }
.sortbtn.on { color: var(--text); }
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; padding: 16px; }
.dcard { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); cursor: default; }
.dcard:hover { background: var(--hover); } .dcard.sel { background: var(--sel); border-color: transparent; }
.dcard.folder { cursor: pointer; }
.dcard-top { display: flex; align-items: center; gap: 8px; padding: 10px 6px 10px 12px; font-size: 13px; font-weight: 500; }
.dcard-top .ellipsis { flex: 1; }
.dcard-thumb { height: 140px; background: var(--surface2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.dcard-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dpanel { width: 320px; flex: none; border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.dpanel-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text3); }
.dpanel-head { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 500; }
.dpanel-thumb { height: 160px; margin: 16px 0; background: var(--surface2); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.dpanel-thumb img { max-width: 100%; max-height: 100%; }
.dpanel-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.dpanel h4, .pv-info h4, .pv-info h3 { font-size: 14px; font-weight: 500; margin: 16px 0 8px; }
.dpanel dl, .pv-info dl { margin: 0; font-size: 13px; }
.dpanel dt, .pv-info dt { color: var(--text3); margin-top: 8px; }
.dpanel dd, .pv-info dd { margin: 2px 0 0; }

/* Sheets */
.tlist { overflow-y: auto; flex: 1; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; align-content: start; }
.tcard { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; color: inherit; }
.tcard:hover { background: var(--hover); }
.tcard-body { flex: 1; min-width: 0; }
.tcard-name { font-weight: 500; font-size: 15px; display: flex; align-items: center; }
.tcard-meta { font-size: 12px; color: var(--text3); margin: 4px 0 8px; }
.tcard-cols { display: flex; flex-wrap: wrap; gap: 4px; }
.tcard-cols span { font-size: 11px; background: var(--surface2); padding: 1px 6px; border-radius: 4px; color: var(--text2); }
.gridwrap { overflow: auto; flex: 1; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.grid th { position: sticky; top: 0; background: var(--surface2); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; padding: 4px 6px; vertical-align: top; min-width: 120px; max-width: 360px; z-index: 2; }
.grid th.sorted .th-name { color: var(--accent); }
.grid .th { display: flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 500; padding: 2px 0; }
.grid .th-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.colfilter { width: 100%; height: 24px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; background: var(--surface); font-size: 12px; outline: none; font-weight: 400; }
.colfilter:focus { border-color: var(--accent); }
.grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.grid tr:hover td { background: var(--hover); }
.grid tr.sel td { background: var(--sel); }
.grid .rownum { position: sticky; left: 0; background: var(--surface2); color: var(--text3); text-align: right; min-width: 48px; z-index: 1; }
.grid th.rownum { z-index: 3; }
.grid .null { color: var(--text3); font-style: italic; font-size: 11px; }

/* Preview overlay */
.preview { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 100; display: flex; flex-direction: column; }
.pv-top { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 16px; color: #fff; flex: none; }
.pv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.pv-actions { display: flex; align-items: center; gap: 4px; }
.pv-body { flex: 1; min-height: 0; display: flex; justify-content: center; }
.pv-content { flex: 1; display: flex; justify-content: center; align-items: stretch; min-width: 0; padding: 0 64px 24px; }
.pv-frame { width: 100%; max-width: 1100px; border: 0; background: #525659; border-radius: 4px; }
.pv-frame.white { background: #fff; }
.pv-img { max-width: 100%; max-height: 100%; object-fit: contain; margin: auto; }
.pv-media { max-width: 100%; max-height: 100%; margin: auto; }
.pv-doc { background: var(--surface); color: var(--text); width: 100%; max-width: 900px; border-radius: 8px; overflow: auto; padding: 24px 32px; }
.pv-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
.pv-center h3 { margin: 0; font-weight: 500; }
.pv-tables { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pv-text { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 13px; line-height: 1.5; margin: 0; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; }
.pv-nav:hover { background: rgba(255,255,255,.25); } .pv-nav.prev { left: 8px; } .pv-nav.next { right: 8px; }
.pv-nav .ic { width: 32px; height: 32px; }
.pv-info { width: 320px; flex: none; background: var(--surface); color: var(--text); padding: 16px; overflow-y: auto; margin: 0 16px 24px 0; border-radius: 8px; }
.pv-info .labels { display: flex; flex-wrap: wrap; gap: 4px; }

/* Menus & popovers */
.menu { position: fixed; z-index: 200; background: var(--surface); border-radius: 4px; box-shadow: var(--shadow2); padding: 8px 0; min-width: 200px; max-height: 70vh; overflow-y: auto; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 36px; padding: 0 16px; text-align: left; white-space: nowrap; }
.menu-item:hover { background: var(--hover); } .menu-item.disabled { opacity: .4; cursor: default; }
.menu-item .ic { color: var(--text2); width: 18px; height: 18px; } .menu-item .menu-check { margin-left: auto; color: var(--accent); }
.menu-sep { border-top: 1px solid var(--line); margin: 8px 0; }
.popover { position: fixed; z-index: 200; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow2); padding: 16px; max-height: 80vh; overflow-y: auto; }
.popover h4 { margin: 0 0 8px; font-weight: 500; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.pad { padding: 8px; }
.lblpop .lblnew { width: 100%; height: 36px; border: 0; border-bottom: 1px solid var(--line); outline: none; padding: 0 4px; margin-bottom: 8px; background: none; }
.lbllist { max-height: 240px; overflow-y: auto; }
.lblrow { display: flex; align-items: center; gap: 8px; height: 32px; cursor: pointer; }
.lblrow .dot { width: 12px; height: 12px; border-radius: 50%; }
.apps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.app { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px; border-radius: 8px; color: var(--text2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app:hover { background: var(--hover); }
.app-ic .ic { width: 36px; height: 36px; }
.adv label { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.adv label > span { width: 110px; color: var(--text2); flex: none; }
.adv input:not([type=checkbox]), .adv select { flex: 1; height: 32px; border: 0; border-bottom: 1px solid var(--line); background: none; outline: none; min-width: 0; }
.adv input:focus { border-bottom-color: var(--accent); }
.adv-row { display: flex; gap: 16px; } .adv-row label { flex: 1; }
.adv .chk { gap: 6px; } .adv .chk input { width: auto; }
.adv-help { font-size: 12px; line-height: 1.8; }
.help p { font-size: 13px; line-height: 1.6; }
.keys { font-size: 13px; border-collapse: collapse; } .keys td { padding: 3px 12px 3px 0; }
#toast { position: fixed; left: 24px; bottom: 24px; background: #333; color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow2); display: flex; align-items: center; gap: 16px; opacity: 0; transform: translateY(8px); transition: .2s; z-index: 300; pointer-events: none; }
#toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast-act { color: #8ab4f8; font-weight: 500; }

@media (max-width: 900px) {
  .tb-left { width: auto; min-width: 0; } .logo-name { display: none; } .logo-app { display: none; } .searchbox { min-width: 0; } .tb-right { flex: none; }
  .topbar { padding: 8px 4px 8px 4px; gap: 4px; }
  .searchbox { height: 44px; } .searchbox input { font-size: 15px; } #qtune { display: none; }
  .tb-right .avatar.me { display: none; } .search-status { display: none; }
  .home { padding: 16px 12px 24px; gap: 20px; }
  .home-title, html.theme-satire .home-title { font-size: 44px; }
  .home-mark svg { width: 110px; height: auto; }
  .home-hint { display: none; }
  .home-search { height: 46px; } .home-search .btn { display: none; }
  .home-apps { grid-template-columns: 1fr; gap: 10px; } .app-tile { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 14px 16px; text-align: left; }
  .app-tile-ic .ic { width: 32px; height: 32px; } .app-tile-name { font-size: 20px; }
  .home-cols { grid-template-columns: 1fr; }
  .mrow { padding-right: 8px; } .mrow-hover { display: none !important; } .mrow:hover .mrow-right { visibility: visible; }
  .thread-head { padding: 12px 8px 4px; } .thread-subj { font-size: 19px; } .thread-src { display: none; }
  .msg-head { gap: 8px; padding: 10px 4px; } .msg-date { display: none; }
  .toolbar { padding: 4px 6px; } .pager .muted { display: none; }
  .crumbs { font-size: 16px; } html.theme-satire .crumbs { font-size: 16px; }
  .dpanel { width: 100%; left: 0; }
  .pv-top { padding: 0 8px; gap: 6px; } .pv-actions .btn span { display: none; }
  .popover { left: 8px !important; right: 8px; width: auto !important; max-width: none; }
  .menu { max-width: calc(100vw - 16px); }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: fixed; top: 64px; left: 0; bottom: 0; width: 256px; background: var(--bg); z-index: 50; box-shadow: var(--shadow2); }
  body.nav-collapsed .sidenav { display: none; } body:not(.nav-collapsed) .sidenav { display: block; }
  .main { padding: 0 8px 8px; }
  .mrow-who { width: 110px; } .mrow-atts { display: none; }
  .downer, .ddate { display: none; }
  .dpanel { position: fixed; right: 0; top: 64px; bottom: 0; background: var(--surface); z-index: 40; }
  .pv-content { padding: 0 8px 8px; } .pv-nav { display: none; } .pv-info { position: fixed; right: 0; top: 64px; bottom: 0; }
  .msg-body, .msg-atts, .msg-details, .thread-notes { margin-left: 0; padding-left: 8px; }
}
@media print { .topbar, .sidenav, .toolbar, .thread-notes, .msg-actions { display: none !important; } .main, .card, .thread { overflow: visible !important; } body { overflow: visible; } .msg { break-inside: avoid; } .msg .msg-body, .msg .msg-atts { display: block !important; } }

/* ===================== Home page ===================== */
body.home-page .shell { grid-template-columns: minmax(0, 1fr); }
body.home-page .sidenav { display: none; }
body.home-page:not(.nav-collapsed) .sidenav { display: block; position: fixed; top: 64px; left: 0; bottom: 0; width: 272px; background: var(--surface); z-index: 50; box-shadow: var(--shadow2); padding-top: 8px; }
body.home-page .sidenav .pill { display: none; }
body.home-page .main { padding: 0 16px 16px; }
.home { overflow-y: auto; flex: 1; padding: 24px 24px 32px; display: flex; flex-direction: column; gap: 28px; }
.home-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-top: 16px; }
.home-mark { color: var(--text); }
.home-title { font-size: 64px; margin: 0; font-weight: 400; letter-spacing: -1px; line-height: 1; }
.home-sub { margin: 0; color: var(--text2); }
.home-search { display: flex; align-items: center; gap: 8px; width: min(720px, 100%); height: 52px; margin-top: 12px; padding: 0 8px 0 16px; background: var(--search); border-radius: 26px; }
.home-search:focus-within { background: var(--surface); box-shadow: var(--shadow); }
.home-search input { flex: 1; height: 100%; border: 0; background: none; outline: none; font-size: 17px; min-width: 0; }
.home-search input::-webkit-search-cancel-button { display: none; }
.home-hint { font-size: 12px; margin: 2px 0 0; color: var(--text3); }
.home-apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 900px; width: 100%; margin: 0 auto; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--surface); border-top: 4px solid var(--c); }
.app-tile:hover { box-shadow: var(--shadow2); }
.app-tile-ic { color: var(--c); } .app-tile-ic .ic { width: 44px; height: 44px; }
.app-tile-name { font-size: 22px; }
.app-tile-text { font-size: 13px; color: var(--text2); }
.app-tile-sub { font-size: 12px; }
.home-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; max-width: 1200px; width: 100%; margin: 0 auto; }
.home-col { border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; background: var(--surface); }
.home-col h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; margin: 4px 0 8px; }
.home-row { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-top: 1px solid var(--line); color: var(--text); font-size: 13px; }
.home-row:hover { background: var(--hover); }
.home-row-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-notice { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; padding: 12px 16px; border-radius: 10px; background: var(--nav-active); color: var(--text); font-size: 14px; flex-wrap: wrap; }
.home-notice svg { flex: none; color: var(--accent); }
.home-notice-progress { font-size: 12px; margin-left: auto; }
.foot-small { font-size: 11px; color: var(--text2); letter-spacing: .2px; }
.home-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; font-size: 12px; color: var(--text2); border-top: 1px solid var(--line); padding-top: 16px; }
.nav-foot { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; margin-top: auto; padding: 16px 12px 8px 24px; font-size: 11px; color: var(--text3); line-height: 1.4; }

/* ===================== Satire theme: Fraktur display type + eagle + red/black/white over the Google layout ===================== */
@font-face { font-family: 'UnifrakturMaguntia'; src: url('/fonts/UnifrakturMaguntia.woff2') format('woff2'); font-display: swap; }
/* Fraktur only at display sizes, where it reads well; everything else stays in the clean sans */
.fraktur, html.theme-satire .home-title, html.theme-satire .logo-app .logo-name, html.theme-satire .app-tile-name, html.theme-satire .boot-logo .logo-mark {
  font-family: 'UnifrakturMaguntia', 'Old English Text MT', serif; font-weight: 400; letter-spacing: .5px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
html.theme-satire { --accent: #a50e0e; --accent-bg: #a50e0e; --accent-fg: #fff; --nav-active: #f6dedc; --sel: #f9d6d3; --hover: #f6f1ef; --pill: #a50e0e; --pill-fg: #fff; --mark: #ffe08a; --bg: #f4f1ec; --surface2: #f8f6f2; --line: #e4dfd8; }
html.theme-satire body { font-family: var(--font); }
html.theme-satire .topbar { background: #1b1b1b; color: #fff; border-bottom: 3px solid #a50e0e; }
html.theme-satire .topbar .iconbtn { color: #e8e8e8; } html.theme-satire .topbar .iconbtn:hover { background: rgba(255,255,255,.12); }
html.theme-satire .searchbox { background: #2b2b2b; color: #fff; } html.theme-satire .searchbox input { color: #fff; } html.theme-satire .searchbox input::placeholder { color: #9a9a9a; }
html.theme-satire .searchbox:focus-within { background: #fff; color: var(--text); } html.theme-satire .searchbox:focus-within input { color: var(--text); } html.theme-satire .searchbox:focus-within .iconbtn { color: var(--text2); }
html.theme-satire .logo { color: #fff; gap: 8px; } html.theme-satire .logo-eagle { color: #fff; }
html.theme-satire .logo-app .logo-name { font-size: 26px; line-height: 1; padding-top: 2px; white-space: nowrap; }
html.theme-satire .logo-eagle { flex: none; }
html.theme-satire .pill { border-radius: 10px; letter-spacing: .3px; height: 48px; }
html.theme-satire .navitem.active a { border-radius: 0 10px 10px 0; box-shadow: inset 3px 0 0 #a50e0e; }
html.theme-satire .card { border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); border: 1px solid var(--line); }
html.theme-satire .mrow.unread .mrow-who::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #a50e0e; margin-right: 6px; vertical-align: middle; }
html.theme-satire .btn, html.theme-satire .fchip, html.theme-satire .chip { border-radius: 8px; }
html.theme-satire .home-mark { color: #1b1b1b; }
html.theme-satire .home-title { font-size: 72px; }
html.theme-satire .home-search { border: 1px solid var(--line); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
html.theme-satire .home-search:focus-within { border-color: #a50e0e; box-shadow: 0 2px 8px rgba(165,14,14,.15); }
html.theme-satire .app-tile { border-radius: 12px; }
html.theme-satire .home-foot { border-top: 3px double #1b1b1b; }
html.theme-satire .avatar.me { background: #a50e0e; }
@media (prefers-color-scheme: dark) { html.theme-satire:not([data-theme="light"]) { --bg: #0e0d0c; --surface: #1a1918; --surface2: #222120; --hover: #292725; --nav-active: #3b1a18; --sel: #4a1c19; --accent: #ff6b6b; --accent-bg: #a50e0e; --accent-fg: #fff; --mark: #6b5d1a; --line: #3a3835; } html.theme-satire:not([data-theme="light"]) .home-mark, html.theme-satire:not([data-theme="light"]) .topbar { color: #fff; } html.theme-satire:not([data-theme="light"]) .home-search { background: #1a1918; border-color: #444; }  }

/* ===================== General polish ===================== */
.mrow, .drow, .dcard, .tcard, .app-tile, .home-row, .btn, .iconbtn, .navitem a, .attcard, .attchip { transition: background-color .12s ease, box-shadow .12s ease, color .12s ease; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.iconbtn:focus-visible, .btn:focus-visible { outline-offset: 0; }
.toolbar { gap: 6px; }
.tb-title { font-size: 16px; }
.thread-subj { font-size: 22px; line-height: 1.3; }
.mrow { height: 42px; }
.mrow-who { font-size: 14px; }
.mrow-snip { color: var(--text3); }
.msg-head { padding: 14px 8px; }
.navitem a { height: 34px; }
.pill { font-size: 14px; }
.empty { padding: 56px 16px; font-size: 14px; }
.app-tile-ic .ic { width: 40px; height: 40px; }
.home-hero { gap: 12px; }
.home-sub { font-size: 14px; }
.card { box-shadow: 0 1px 2px rgba(60,64,67,.06); }
/* Indexing progress */
.spinner.small { width: 14px; height: 14px; border-width: 2px; }
.boot-log { font-size: 11px; color: var(--text3); max-width: 720px; white-space: pre-wrap; text-align: left; margin: 0; }
