/* Desk 2 — Gmail look (Material 3 tokens). Roboto (Apache-2.0), self-hosted, Latin + Cyrillic. */
@font-face { font-family: "Roboto"; src: url("/static/fonts/roboto-cyrillic-ext.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Roboto"; src: url("/static/fonts/roboto-cyrillic.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Roboto"; src: url("/static/fonts/roboto-latin-ext.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Roboto"; src: url("/static/fonts/roboto-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F6F8FC; --surface: #FFFFFF; --surface-2: #F2F6FC;
  --ink: #1F1F1F; --ink-2: #444746; --ink-3: #747775; --line: #E1E3E1;
  --hover: rgba(68, 71, 70, .08); --selected: #D3E3FD; --selected-ink: #041E49;
  --compose: #C2E7FF; --compose-ink: #001D35; --primary: #0B57D0; --primary-hover: #0842A0; --star: #F4B400;
  --good: #146C2E; --good-bg: #C4EED0; --bad: #B3261E; --bad-bg: #F9DEDC; --warn: #7A4F01; --warn-bg: #FFE08A; --chip: #E9EEF6;
  --b-avera: #5B57A6; --b-kika: #C5221F; --b-zaro: #00796B; --b-spovex: #A0522D; --b-hotfresh: #E8710A; --b-other: #5F6368;
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --top-h: 64px; --drawer-w: 256px; --radius: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/20px var(--font); }
a { color: var(--primary); }
button { font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ic { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 4px; padding: 8px 16px 8px 8px; background: var(--bg); }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; text-decoration: none; flex: none; }
.iconbtn:hover { background: var(--hover); }
.iconbtn .ic { width: 24px; height: 24px; }
.logo { display: flex; align-items: center; gap: 10px; width: 200px; padding-left: 8px; color: var(--ink-2); font-size: 22px; text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.search { flex: 1; max-width: 720px; height: 48px; display: flex; align-items: center; gap: 4px; padding: 0 8px; background: #E9EEF6; border-radius: 24px; }
.search:focus-within { background: var(--surface); box-shadow: 0 1px 1px rgba(65,69,73,.3), 0 1px 3px 1px rgba(65,69,73,.15); }
.search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); outline: 0; min-width: 0; min-height: 0; padding: 0; }
.search input:focus { outline: 0; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 500; font-size: 14px; background: hsl(var(--h, 210) 45% 45%); flex: none; text-transform: uppercase; }
.avatar.lg { width: 40px; height: 40px; font-size: 18px; }

/* layout */
.shell { display: flex; align-items: flex-start; }
.drawer { width: var(--drawer-w); flex: none; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 8px 0 24px; }
.panel { flex: 1; min-width: 0; background: var(--surface); border-radius: var(--radius); margin: 0 16px 16px 0; min-height: calc(100vh - var(--top-h) - 16px); }
.panel-pad { padding: 16px 24px 32px; }
.compose-btn { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 24px 0 16px; margin: 0 0 16px 8px; border-radius: 16px; background: var(--compose); color: var(--compose-ink); font-weight: 500; text-decoration: none; transition: box-shadow .15s; }
.compose-btn:hover { box-shadow: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15); }
.compose-btn .ic { width: 24px; height: 24px; }
.nav-row { display: flex; align-items: center; gap: 18px; height: 32px; padding: 0 12px 0 26px; margin-right: 12px; border-radius: 0 16px 16px 0; color: var(--ink); text-decoration: none; }
.nav-row:hover { background: var(--hover); }
.nav-row.on { background: var(--selected); color: var(--selected-ink); font-weight: 700; }
.nav-row .count { margin-left: auto; font-size: 12px; font-weight: 700; }
.nav-row .dot { width: 10px; height: 10px; border-radius: 3px; margin: 0 5px; flex: none; }
.nav-section { padding: 16px 0 6px 26px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.dot.biz-avera, .chip-biz.biz-avera { background: var(--b-avera); }
.dot.biz-kika, .chip-biz.biz-kika { background: var(--b-kika); }
.dot.biz-zaro, .chip-biz.biz-zaro { background: var(--b-zaro); }
.dot.biz-spovex, .chip-biz.biz-spovex { background: var(--b-spovex); }
.dot.biz-hotfresh, .chip-biz.biz-hotfresh { background: var(--b-hotfresh); }
.dot.biz-personal, .dot.biz-other, .chip-biz.biz-personal, .chip-biz.biz-other { background: var(--b-other); }
.bottomnav, .fab, .drawer-scrim { display: none; }

/* toolbar + tabs */
.toolbar { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar .pager-txt { color: var(--ink-2); font-size: 12px; }
.toolbar h1 { font-size: 16px; font-weight: 500; margin: 0 8px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 14px; min-width: 190px; height: 56px; padding: 0 16px; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; font-weight: 500; white-space: nowrap; }
.tab:hover { background: var(--hover); }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.tab .n { font-size: 12px; background: var(--chip); color: var(--ink-2); border-radius: 10px; padding: 0 8px; }
.acct-chips { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

/* chips + badges */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid #747775; border-radius: 8px; color: var(--ink-2); background: var(--surface); text-decoration: none; font-weight: 500; font-size: 13px; white-space: nowrap; }
.chip:hover { background: var(--hover); }
.chip.on, .chip.is-on { background: var(--selected); border-color: var(--selected); color: var(--selected-ink); }
.chip span { color: inherit; opacity: .75; }
.chip-biz { display: inline-block; color: #fff; font-size: 11px; font-weight: 500; line-height: 16px; padding: 0 6px; border-radius: 4px; }
.badge { display: inline-block; font-size: 12px; line-height: 18px; padding: 0 8px; border-radius: 9px; background: var(--chip); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.chalk, .badge.blue { background: var(--selected); color: var(--selected-ink); }
.badge.cat { background: transparent; border: 1px solid var(--line); }

/* mail list */
.mlist { list-style: none; margin: 0; padding: 0; }
.mrow { position: relative; display: flex; align-items: center; height: 40px; padding: 0 16px 0 12px; border-bottom: 1px solid #EEF0F2; background: var(--surface-2); cursor: pointer; overflow: hidden; }
.mrow.unread { background: var(--surface); }
.mrow:hover { box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); z-index: 1; }
.mrow.focus { box-shadow: inset 4px 0 0 var(--primary); }
.star { width: 32px; height: 32px; border: 0; background: transparent; color: #A9A9A9; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.star:hover { background: var(--hover); color: var(--ink-2); }
.star.on { color: var(--star); }
.mlink { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 100%; color: inherit; text-decoration: none; }
.mlink .avatar { display: none; }
.mfrom { width: 190px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.mrow.unread .mfrom, .mrow.unread .msubj, .mrow.unread .mdate { font-weight: 700; color: #000; }
.mmid { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.msubj { color: var(--ink); flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.msnip { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.mdate { width: 64px; text-align: right; font-size: 12px; color: var(--ink-2); flex: none; }
.mtags { display: inline-flex; gap: 4px; flex: none; }
.macts { position: absolute; right: 8px; top: 0; height: 40px; display: none; align-items: center; background: inherit; padding-left: 8px; }
.mrow:hover .macts { display: flex; }
.mrow:hover .mdate { visibility: hidden; }
.mrow .macts .iconbtn { width: 36px; height: 36px; }
.mrow.leaving { transition: transform .2s, opacity .2s; opacity: 0; }
.empty { padding: 48px 24px; text-align: center; color: var(--ink-2); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 16px; }

/* message view */
.msg-subject { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 8px; padding: 0 24px 0 72px; font-size: 22px; line-height: 28px; font-weight: 400; }
.desk-card { margin: 8px 24px 16px 72px; padding: 12px 16px; border-radius: 12px; background: #F0F4F9; }
.desk-card .summary { margin: 6px 0; }
.desk-card .why { margin: 0 0 8px; font-size: 12px; color: var(--ink-3); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.msg-head { display: flex; gap: 16px; padding: 12px 24px 0 16px; }
.msg-head .who { flex: 1; min-width: 0; }
.msg-head .who b { font-weight: 700; }
.msg-head .addr, .msg-head .to, .msg-head .when { color: var(--ink-2); font-size: 12px; }
.msg-head .when { white-space: nowrap; }
.msg-body { padding: 12px 24px 8px 72px; overflow-x: auto; }
.img-banner { margin: 0 24px 0 72px; padding: 8px 12px; background: #F0F4F9; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.atts { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 24px 8px 72px; }
.att { display: flex; align-items: center; gap: 8px; width: 220px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.att:hover { background: var(--hover); }
.att .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.reply-bar { display: flex; flex-wrap: wrap; gap: 12px; padding: 24px 24px 32px 72px; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 20px 0 16px; border: 1px solid #747775; border-radius: 20px; color: var(--ink-2); text-decoration: none; font-weight: 500; background: var(--surface); cursor: pointer; }
.pill:hover { background: var(--hover); }
.thread { margin: 0 24px 0 72px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.thread a { display: flex; gap: 12px; padding: 10px 14px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.thread a:last-child { border-bottom: 0; }
.thread a:hover { background: var(--hover); }
.thread .t-from { width: 160px; flex: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .t-snip { flex: 1; min-width: 0; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .t-date { color: var(--ink-2); font-size: 12px; }
.side-box { margin: 0 24px 16px 72px; }
.side-box h2 { font-size: 14px; font-weight: 500; color: var(--ink-2); margin: 16px 0 8px; }

/* compose */
.compose { max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - var(--top-h) - 16px); }
.compose-head { display: flex; align-items: center; height: 44px; padding: 0 8px 0 16px; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; font-weight: 500; }
.compose-head .spacer { flex: 1; }
.cfield { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cfield label { color: var(--ink-2); width: 56px; flex: none; }
.cfield input, .cfield select { flex: 1; border: 0; outline: 0; font: inherit; font-size: 15px; background: transparent; min-width: 0; height: 40px; padding: 0; color: var(--ink); }
.cfield input:focus, .cfield select:focus { outline: 0; }
.cfield .toggle { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; padding: 4px 6px; }
.editor { flex: 1; min-height: 260px; padding: 16px; outline: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.editor .desk-signature { margin-top: 16px; }
.editor blockquote { margin: 0 0 0 .8ex; border-left: 1px solid #ccc; padding-left: 1ex; }
.quote-toggle { margin: 0 16px 12px; border: 0; background: var(--chip); border-radius: 8px; padding: 0 10px; height: 20px; line-height: 20px; cursor: pointer; color: var(--ink-2); align-self: flex-start; }
.cfiles { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 8px; }
.cfiles .file { background: var(--chip); border-radius: 8px; padding: 4px 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.file-x { border: 0; background: none; color: inherit; width: 24px; height: 24px; margin-right: -6px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; }
.file-x:hover { background: rgba(0, 0, 0, .08); }
.file-x .ic { width: 16px; height: 16px; }
.cbar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 4px; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; z-index: 5; }
.cbar .spacer { flex: 1; }
.btn-send { height: 40px; padding: 0 24px; border: 0; border-radius: 20px; background: var(--primary); color: #fff; font-weight: 500; cursor: pointer; font-size: 14px; }
.btn-send:hover { background: var(--primary-hover); box-shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); }
.btn-send:disabled { opacity: .6; cursor: default; }
.fmt { display: flex; }
.fmt .iconbtn { width: 34px; height: 34px; border-radius: 6px; }
.fmt .iconbtn .ic { width: 20px; height: 20px; }
.sig-pick { height: 34px; min-height: 34px; width: auto; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 13px; background: var(--surface); color: var(--ink-2); max-width: 190px; }
.brand-warn { margin: 8px 16px; padding: 10px 14px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); }
.brand-warn label { display: flex; gap: 8px; align-items: center; margin-top: 6px; color: var(--ink); }
.draft-state { color: var(--ink-3); font-size: 12px; margin-left: 8px; }

/* toast */
#toast { position: fixed; left: 24px; bottom: 24px; z-index: 60; display: none; align-items: center; gap: 16px; min-width: 288px; max-width: calc(100vw - 48px);
  padding: 14px 16px; border-radius: 4px; background: #303030; color: #F2F2F2; font-size: 14px; box-shadow: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14); }
#toast.show { display: flex; }
#toast button { margin-left: auto; border: 0; background: transparent; color: #A8C7FA; font-weight: 500; cursor: pointer; }

/* other pages */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 400; flex: 1 1 auto; }
.page-head .meta { flex: 1 1 100%; }
.crumb { margin: 0 0 8px; font-size: 13px; }
.lede { font-size: 15px; max-width: 70ch; margin: 0 0 16px; color: var(--ink-2); }
.day { margin: 0 0 16px; }
.day-name { margin: 0; color: var(--ink-2); }
.day-date { margin: 0; font-size: 32px; line-height: 40px; font-weight: 400; }
.day-line { margin: 4px 0 0; color: var(--ink-2); }
.cutline { display: flex; align-items: center; gap: 8px; margin: 24px 0 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.cutline .count { color: var(--ink-3); font-weight: 400; }
.group-overdue .cutline { color: var(--bad); }
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.list > li + li { border-top: 1px solid var(--line); }
.row-link, .task-body, .mail-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; color: inherit; text-decoration: none; min-width: 0; }
.row-link:hover, .task-body:hover, .mail-body:hover { background: var(--hover); }
.task-title { font-weight: 500; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--ink-2); font-size: 12px; margin: 0; }
.due { color: var(--ink); font-weight: 500; }
.group-overdue .due { color: var(--bad); }
.from-mail { font-style: italic; }
.task { display: flex; align-items: stretch; }
.task .task-body { flex: 1; padding-left: 4px; }
.task-check { display: flex; align-items: center; padding-left: 12px; }
.check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #747775; background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; }
.check svg { width: 14px; height: 14px; fill: none; stroke: transparent; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.check:hover svg { stroke: #747775; }
.task.is-high .check { border-color: var(--bad); }
.task.is-done .check { background: var(--primary); border-color: var(--primary); }
.task.is-done .check svg { stroke: #fff; }
.task.is-done .task-title { text-decoration: line-through; color: var(--ink-3); }
.suggest { display: flex; flex-wrap: wrap; align-items: center; }
.suggest .task-body { flex: 1 1 260px; }
.suggest-actions { display: flex; gap: 6px; padding: 0 12px 10px; }
@media (min-width: 600px) { .suggest-actions { padding: 0 12px; } }
.suggest-actions form { margin: 0; }
.more { margin: 8px 4px 0; }
.mail { display: block; }
.mail-top { display: flex; justify-content: space-between; gap: 12px; }
.mail-from { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.mail-subj { overflow-wrap: anywhere; }
.mail-sum { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.lead-top { display: flex; justify-content: space-between; gap: 12px; }
.project-sum { color: var(--ink-2); font-size: 13px; }
.biz { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--b-other); }
.biz::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.biz-avera { color: var(--b-avera); } .biz-kika { color: var(--b-kika); } .biz-zaro { color: var(--b-zaro); } .biz-spovex { color: var(--b-spovex); } .biz-hotfresh { color: var(--b-hotfresh); }
.state { font-weight: 500; color: var(--ink); }
.state-not_yet { color: var(--ink-3); font-weight: 400; }
.state-bounced, .state-stopped { color: var(--bad); }
.state-replied, .state-inbound { color: var(--good); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip-needs:not(.is-on) { border-color: var(--primary); color: var(--primary); }
.tabs-line { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs-line a { padding: 10px 14px; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs-line a.is-on { color: var(--primary); border-bottom-color: var(--primary); }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid #747775; border-radius: 4px; padding: 8px 12px; min-height: 40px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
textarea { min-height: 88px; line-height: 1.45; resize: vertical; }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--primary); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.check-field { flex-direction: row; align-items: center; gap: 8px; }
.add-form, .edit, .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 0 0 16px; }
.field.wide, .add-form .btn, .edit .wide, .filters .wide { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .add-form { grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; align-items: end; }
  .add-form .field.wide { grid-column: auto; }
  .add-form .btn { grid-column: auto; }
  .filters { grid-template-columns: 2fr 1fr 1fr; align-items: end; }
  .filters .wide { grid-column: auto; }
}
.form-actions { grid-column: 1 / -1; }
.edit details { grid-column: 1 / -1; }
.edit-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 10px; }
.quick-add { display: flex; gap: 8px; margin: 0 0 8px; }
.quick-add input[name="title"] { flex: 1; }
.quick-add input[type="date"] { width: auto; flex: 0 0 160px; }
@media (max-width: 480px) { .quick-add { flex-wrap: wrap; } .quick-add input[type="date"] { flex: 1 1 auto; } }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.btn, .btn-quiet, .btn-small { font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 24px; border-radius: 20px; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn { background: var(--primary); color: #fff; }
.btn:hover { background: var(--primary-hover); }
.btn-quiet { background: transparent; color: var(--primary); padding: 0 12px; }
.btn-quiet:hover { background: rgba(11,87,208,.08); }
.btn-small { min-height: 32px; padding: 0 14px; font-size: 13px; background: var(--selected); color: var(--selected-ink); border-radius: 16px; }
.btn-quiet.btn-small { background: transparent; color: var(--primary); }
.danger { color: var(--bad); }
.danger-zone { margin-top: 32px; }
details > summary { cursor: pointer; color: var(--primary); font-weight: 500; min-height: 28px; }
.add-details { margin-top: 24px; }
.add-details[open] summary { margin-bottom: 12px; }
.done-list { margin: 16px 0; }
.flash { background: var(--selected); color: var(--selected-ink); padding: 10px 16px; border-radius: 8px; margin: 0 0 16px; }
.alert { border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; background: #FFF4D6; }
.alert h2 { font-size: 14px; font-weight: 700; margin: 0 0 4px; }
.alert p, .alert ul { margin: 4px 0; }
.alert-brand { background: var(--bad-bg); }
.hint { color: var(--ink-2); font-size: 13px; }
.linked { margin: 6px 0; }
.facts { display: grid; grid-template-columns: 1fr; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 8px; overflow: hidden; }
.facts > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 9px 16px; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--ink-2); font-size: 13px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 0; max-width: 80ch; }
.history li { padding: 10px 16px; }
.history summary { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; color: var(--ink); font-weight: 400; }
.table { width: 100%; border-collapse: collapse; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; display: block; overflow-x: auto; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--ink-2); font-weight: 500; }
.plain { padding-left: 18px; }
.sig-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 0 0 12px; }
.sig-preview { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; overflow-x: auto; }
.sig-editor { min-height: 120px; border: 1px solid #747775; border-radius: 4px; padding: 12px; outline: 0; overflow-x: auto; background: var(--surface); }
.boxes { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.boxes label { display: inline-flex; gap: 6px; align-items: center; }

/* login */
.login-body { display: grid; min-height: 100vh; place-items: center; background: var(--bg); }
.login { width: min(400px, 100% - 32px); background: var(--surface); border-radius: 28px; padding: 36px 32px; }
.login-mark { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 400; margin: 0 0 24px; }
.login-form { display: grid; gap: 16px; }
.login-msg { color: var(--bad); margin: 0; }

/* phone */
@media (max-width: 899px) {
  .topbar { padding: 8px 12px; gap: 0; }
  .topbar .logo, .topbar .hide-sm, .topbar > .menu-out { display: none; }
  .search { max-width: none; padding: 0 4px; }
  .drawer { position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; height: 100vh; width: 288px; background: var(--surface); transform: translateX(-100%); transition: transform .2s; padding-top: 16px; border-radius: 0 16px 16px 0; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
  body.drawer-open .drawer { transform: none; }
  body.drawer-open .drawer-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 40; }
  .drawer .compose-btn { display: none; }
  .panel { margin: 0; border-radius: 0; min-height: calc(100vh - var(--top-h)); }
  .panel-pad { padding: 12px 16px 120px; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #F3F6FC; border-top: 1px solid var(--line); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-2); text-decoration: none; font-size: 12px; font-weight: 500; }
  .bottomnav .pillicon { width: 56px; height: 30px; border-radius: 15px; display: grid; place-items: center; }
  .bottomnav a.on { color: var(--selected-ink); }
  .bottomnav a.on .pillicon { background: var(--selected); }
  .fab { display: inline-flex; align-items: center; gap: 12px; position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 36; height: 56px; padding: 0 20px 0 16px; border-radius: 16px; background: var(--compose); color: var(--compose-ink); font-weight: 500; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.3), 0 4px 8px 3px rgba(0,0,0,.15); }
  .fab .ic { width: 24px; height: 24px; }
  .toolbar { padding: 0 8px; }
  .tab { min-width: 0; padding: 0 14px; height: 48px; gap: 8px; }
  .mlist { padding-bottom: 140px; }
  .mrow { height: auto; align-items: flex-start; padding: 10px 8px 10px 16px; background: var(--surface); border-bottom: 0; }
  .mrow:hover { box-shadow: none; }
  .mlink { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "av from date" "av subj subj" "av snip snip" "av tags tags"; column-gap: 14px; align-items: start; }
  .mlink .avatar { display: inline-grid; grid-area: av; width: 40px; height: 40px; font-size: 18px; margin-top: 2px; }
  .mfrom { grid-area: from; width: auto; font-size: 16px; line-height: 22px; }
  .mdate { grid-area: date; width: auto; line-height: 22px; }
  .mmid { display: contents; }
  .msubj { grid-area: subj; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .msnip { grid-area: snip; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mtags { grid-area: tags; margin-top: 4px; }
  .mtags:empty { display: none; }
  .mrow .star { margin-top: 30px; }
  .macts { display: none !important; }
  .mrow .mdate { visibility: visible !important; }
  .msg-subject { padding: 0 16px; font-size: 20px; }
  .desk-card, .thread, .side-box, .img-banner { margin-left: 16px; margin-right: 16px; }
  .msg-head { padding: 12px 16px 0; }
  .msg-body, .atts { padding-left: 16px; padding-right: 16px; }
  .reply-bar { padding: 16px 16px 140px; }
  .reply-bar .pill { flex: 1; justify-content: center; padding: 0 12px; }
  .thread .t-from { width: 110px; }
  .compose { margin: 0; min-height: calc(100vh - var(--top-h)); }
  .compose-head { border-radius: 0; }
  .cbar { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  body.compose-page .bottomnav, body.compose-page .fab { display: none; }
  #toast { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); min-width: 0; }
  .facts > div { grid-template-columns: 110px 1fr; }
}
@media (min-width: 900px) { .search .menu-in { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* avatar colours (classes, so the page CSP needs no inline styles) */
.hue-0 { background: #1A73E8; } .hue-1 { background: #D93025; } .hue-2 { background: #188038; } .hue-3 { background: #E37400; }
.hue-4 { background: #9334E6; } .hue-5 { background: #12A4AF; } .hue-6 { background: #C5221F; } .hue-7 { background: #5F6368; }
.hue-8 { background: #B06000; } .hue-9 { background: #3949AB; } .hue-10 { background: #00897B; } .hue-11 { background: #AD1457; }
.mt { margin-top: 10px; }
.chip-biz.chip-biz { color: #fff; }  /* beats the .biz-* text colours */
[hidden] { display: none !important; }
@media (max-width: 899px) {
  .tab .ic { display: none; }
  .tab { gap: 6px; padding: 0 12px; }
  .mrow .star { order: 2; margin-left: 4px; }
  .msnip .dash { display: none; }
}
