:root {
  --bg: #f2f6f8;
  --panel: #ffffff;
  --panel-2: #f8fbfc;
  --border: #e2e9ee;
  --border-strong: #cdd8df;
  --text: #0f2230;
  --text-2: #31495a;
  --muted: #6a7f8e;
  --brand: #1bb0ce;
  --brand-deep: #0b7f99;
  --accent: #0e97b4;
  --accent-ink: #ffffff;
  --accent-weak: #e3f6fa;
  --hover: #eff5f8;
  --selected: #dff3f8;
  --side-bg: linear-gradient(180deg, #0b2233 0%, #0a1b29 60%, #081521 100%);
  --side-text: #c9dbe6;
  --side-muted: #7e98a9;
  --side-hover: rgba(27, 176, 206, .10);
  --side-active: rgba(27, 176, 206, .20);
  --danger: #d92d20;
  --danger-weak: #fef0ef;
  --ok: #067647;
  --warn-bg: #fff8e6;
  --warn-ink: #7a4f01;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .10);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .22);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1218;
    --panel: #111a21;
    --panel-2: #0f171d;
    --border: #1e2b35;
    --border-strong: #2c3d49;
    --text: #e4eef3;
    --text-2: #bfd0da;
    --muted: #7f97a6;
    --accent: #3cc7e3;
    --accent-ink: #04212a;
    --accent-weak: #0f2e38;
    --hover: #16232c;
    --selected: #123341;
    --side-bg: linear-gradient(180deg, #081a26 0%, #07131c 100%);
    --danger: #ff6b5f;
    --danger-weak: #3a1a17;
    --ok: #4ade80;
    --warn-bg: #2f2410;
    --warn-ink: #f5c86b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
    --shadow-lg: 0 20px 48px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font-size: 12.5px; background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--panel); cursor: pointer; font-weight: 550; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.wide { width: 100%; height: 42px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 0; background: transparent; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-weak); }
.icon-btn.on { color: #e3a008; }
.icon-btn.on svg { fill: #f5b82e; stroke: #e3a008; }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 6px; }
.link-btn:hover { color: var(--accent); }
.only-mobile { display: none; }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px;
}
.auth-card h1 { margin: 6px 0 0; font-size: 20px; }
.auth-card p { margin: 0; }
.brand-lg { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 450; }
input:not([type=checkbox]):not([type=color]), select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--panel); outline: none; font-weight: 400;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
input[type=color] { width: 100%; height: 38px; padding: 3px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--panel); }
.form-error { background: var(--danger-weak); color: var(--danger); padding: 9px 11px; border-radius: 8px; font-size: 13px; }

/* ---------- layout ---------- */
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.logo svg { width: 17px; height: 17px; }
.app { display: grid; grid-template-columns: 248px minmax(320px, 400px) 1fr; height: 100vh; height: 100dvh; }

.sidebar { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; border-right: 1px solid var(--border); background: var(--panel-2); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 2px 8px 12px; }
.compose-btn { margin: 0 4px 12px; height: 42px; border-radius: 10px; }
.boxes a, .accounts a, .side-link {
  display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 8px;
  cursor: pointer; color: var(--text-2); text-decoration: none; user-select: none; border: 0; background: none; width: 100%; text-align: left;
}
.boxes a:hover, .accounts a:hover, .side-link:hover { background: var(--hover); color: var(--text); }
.boxes a.active, .accounts a.active { background: var(--selected); color: var(--accent); font-weight: 600; }
.boxes a span, .accounts a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 12px; font-weight: 650; color: var(--text); }
.count.soft { color: var(--muted); font-weight: 500; }
.count:empty { display: none; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 10px 4px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.accounts .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin: 0 4px; }
.accounts .acc-mail { font-size: 13px; }
.accounts .err { color: var(--danger); font-size: 12px; }
.accounts .empty-acc { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 2px; }

/* ---------- list ---------- */
.list-pane { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--border); background: var(--panel); }
.list-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px 12px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--hover); color: var(--muted); }
.search input { border: 0 !important; background: transparent !important; box-shadow: none !important; height: 36px; padding: 0 !important; color: var(--text); }
.list-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 8px 14px 10px; border-bottom: 1px solid var(--border); }
.list-title h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.chips { display: flex; gap: 4px; }
.chip { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.chip.active { background: var(--text); color: var(--panel); border-color: var(--text); }
.bulk { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--accent-weak); }
.bulk-actions { margin-left: auto; display: flex; gap: 2px; }
.acc-errors { padding: 8px 14px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12.5px; border-bottom: 1px solid var(--border); }
.list { flex: 1; overflow-y: auto; outline: none; }
.item {
  position: relative; display: grid; grid-template-columns: 36px 1fr auto; gap: 2px 10px;
  padding: 11px 14px 11px 12px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--acc, transparent); opacity: .9; }
.item:hover { background: var(--hover); }
.item.active { background: var(--selected); }
.item.checked { background: var(--accent-weak); }
.avatar {
  grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 650; font-size: 13.5px; color: #fff; position: relative;
}
.avatar .check { position: absolute; inset: 0; display: none; }
.item:hover .avatar .check, .item.checked .avatar .check, .list.selecting .avatar .check { display: grid; }
.item .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.item .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.item .subj { grid-column: 2 / 4; display: flex; align-items: center; gap: 6px; min-width: 0; }
.item .subj span.t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.item.unread .who { color: var(--text); font-weight: 650; }
.item.unread .subj span.t { color: var(--text); font-weight: 600; }
.item.unread .when { color: var(--accent); font-weight: 600; }
.item .meta { grid-column: 2 / 4; display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.acc-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); font-weight: 600; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .ic { width: 14px; height: 14px; color: var(--muted); }
.item .star-ic { fill: #f5b82e; stroke: #e3a008; }
.item .flag-draft { color: var(--danger); font-size: 12px; font-weight: 600; }
.list-state { padding: 40px 20px; text-align: center; color: var(--muted); }
.more-btn { display: block; margin: 14px auto 22px; }
.skeleton { height: 64px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, transparent, var(--hover), transparent); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.check { display: inline-grid; place-items: center; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--panel); display: grid; place-items: center; }
.check input:checked + span { background: var(--accent); border-color: var(--accent); }
.check input:checked + span::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.avatar .check { background: var(--panel); border-radius: 50%; }

/* ---------- reader ---------- */
.reader { min-width: 0; overflow-y: auto; background: var(--bg); }
.empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--muted); text-align: center; }
.empty svg { width: 44px; height: 44px; stroke-width: 1.4; margin-bottom: 6px; opacity: .6; }
.empty p { margin: 0; }
.msg { max-width: 980px; margin: 0 auto; padding: 18px 22px 40px; }
.msg-bar { display: flex; align-items: center; gap: 2px; position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 4px 0 10px; }
.msg-bar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.msg h1 { font-size: 21px; line-height: 1.3; margin: 6px 0 14px; letter-spacing: -.01em; word-break: break-word; }
.msg-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.msg-head { display: flex; gap: 12px; padding: 16px 18px; align-items: flex-start; border-bottom: 1px solid var(--border); }
.msg-head .avatar { width: 40px; height: 40px; font-size: 15px; grid-row: auto; flex: none; }
.msg-head .from { font-weight: 650; }
.msg-head .from .addr { font-weight: 400; color: var(--muted); font-size: 13px; }
.msg-head .rcpt { font-size: 13px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.msg-head .date { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; text-align: right; }
.msg-head .date .acc-tag { display: inline-block; margin-top: 6px; }
.img-bar { display: flex; align-items: center; gap: 10px; padding: 8px 18px; font-size: 13px; background: var(--warn-bg); color: var(--warn-ink); }
.img-bar button { border: 0; background: none; color: inherit; font-weight: 650; text-decoration: underline; cursor: pointer; padding: 0; }
.msg-frame { display: block; width: 100%; border: 0; background: #fff; min-height: 120px; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }
.att {
  display: flex; align-items: center; gap: 9px; max-width: 280px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2); text-decoration: none; color: var(--text);
}
.att:hover { border-color: var(--accent); }
.att .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 550; }
.att .sz { font-size: 11.5px; color: var(--muted); }
.att .x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; display: grid; }
.att .x svg { width: 14px; height: 14px; }
.reply-row { display: flex; gap: 8px; margin-top: 14px; }

/* ---------- composer ---------- */
.composer {
  position: fixed; right: 24px; bottom: 0; width: 560px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 60px));
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px 12px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; z-index: 40;
}
.composer.max { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(1000px, calc(100vw - 48px)); height: calc(100vh - 64px); border-radius: 12px; }
.composer.min { height: auto; }
.composer.min .comp-body { display: none; }
.comp-head { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 16px; background: var(--text); color: var(--panel); border-radius: 11px 11px 0 0; cursor: default; }
.composer.max .comp-head { border-radius: 11px 11px 0 0; }
.comp-head #comp-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-head .icon-btn { color: inherit; opacity: .8; }
.comp-head .icon-btn:hover { background: rgba(127,127,127,.25); opacity: 1; color: inherit; }
.comp-status { opacity: .7; margin-right: 6px; }
.comp-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.field { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.field label { width: 42px; font-weight: 450; color: var(--muted); font-size: 13px; }
.field input, .field select { border: 0 !important; box-shadow: none !important; padding: 0 !important; height: 40px; background: transparent; }
.field .subject { font-weight: 550; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 4px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar button { width: 30px; height: 30px; border: 0; background: none; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; line-height: 1; color: var(--text-2); font-size: 13px; font-weight: 700; }
.toolbar button:hover { background: var(--hover); }
.toolbar button svg { width: 15px; height: 15px; }
.toolbar button sub { font-size: 9px; vertical-align: -3px; }
.toolbar .sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.editor { flex: 1; overflow-y: auto; padding: 14px 16px; outline: none; font-size: 14px; line-height: 1.55; min-height: 120px; word-wrap: break-word; }
.editor:empty::before { content: "Write your message…"; color: var(--muted); }
.editor blockquote { margin: 0 0 0 .8ex; border-left: 2px solid var(--border-strong); padding-left: 1ex; color: var(--text-2); }
.editor img { max-width: 100%; height: auto; }
.editor a { color: var(--accent); }
.comp-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.comp-atts:not(:empty) { padding: 8px 14px; border-top: 1px solid var(--border); }
.comp-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.composer.drag::after { content: "Drop files to attach"; position: absolute; inset: 44px 0 0; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border: 2px dashed var(--accent); color: var(--accent); font-weight: 650; border-radius: 0 0 12px 12px; }

/* ---------- modal / settings ---------- */
.modal { border: 0; padding: 0; border-radius: 14px; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--panel); color: var(--text); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(10, 14, 22, .45); }
.modal[open] { display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 22px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.tab { border: 0; background: none; padding: 10px 8px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 550; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.modal-body { padding: 18px 22px 24px; overflow-y: auto; }
.set-list { display: grid; gap: 8px; margin-bottom: 22px; }
.set-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.set-row .dot { width: 10px; height: 10px; border-radius: 50%; }
.set-row .info { flex: 1; min-width: 0; }
.set-row .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row .res { font-size: 12px; }
.set-row .res.ok { color: var(--ok); }
.set-row .res.bad { color: var(--danger); }
.acc-form { display: grid; gap: 12px; }
.acc-form h3 { margin: 0; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.adv summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; }
.bulk-log { margin-top: 12px; display: grid; gap: 4px; font-size: 13px; }
.bulk-log .ok { color: var(--ok); }
.bulk-log .bad { color: var(--danger); }

/* ---------- menu / toasts ---------- */
.menu { position: fixed; z-index: 60; min-width: 200px; max-height: 320px; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu .lbl { padding: 6px 10px 4px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13.5px; display: flex; gap: 14px; align-items: center; animation: up .18s ease-out; }
.toast.bad { background: var(--danger); color: #fff; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 220px minmax(300px, 360px) 1fr; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(300px, 380px) 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 50; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; visibility: visible; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 45; }
  .only-mobile { display: inline-grid; }
}
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; }
  .reader { display: none; }
  .app.reading .list-pane { display: none; }
  .app.reading .reader { display: block; }
  .msg { padding: 10px 12px 30px; }
  .msg-head { flex-wrap: wrap; }
  .msg-head > div:nth-child(2) { flex: 1 1 calc(100% - 60px) !important; }
  .msg-head .date { margin-left: 52px; text-align: left; }
  .composer, .composer.max { inset: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; transform: none; }
  .comp-head { border-radius: 0; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .list-title { flex-wrap: wrap; }
}


/* ================================================================== */
/*  v2 – IDigitalAKKi branding & extras                               */
/* ================================================================== */
body { font-feature-settings: "cv11", "ss01"; }

/* sidebar: deep navy with brand teal */
.sidebar { background: var(--side-bg); color: var(--side-text); border-right: 0; }
.sidebar .boxes a, .sidebar .accounts a, .sidebar .side-link { color: var(--side-text); }
.sidebar .boxes a:hover, .sidebar .accounts a:hover, .sidebar .side-link:hover { background: var(--side-hover); color: #fff; }
.sidebar .boxes a.active, .sidebar .accounts a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.sidebar .count { color: #fff; }
.sidebar .count.soft { color: var(--side-muted); }
.sidebar .side-head { color: var(--side-muted); }
.sidebar .icon-btn { color: var(--side-text); }
.sidebar .icon-btn:hover { background: var(--side-hover); color: #fff; }
.sidebar .side-foot { border-top-color: rgba(255,255,255,.08); }
.sidebar svg { opacity: .9; }

.brand { display: grid; gap: 8px; padding: 2px 4px 14px; }
.brand-card { background: #fff; border-radius: 12px; padding: 10px 12px; display: grid; place-items: center; min-height: 54px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.brand-logo { display: block; max-width: 100%; max-height: 44px; object-fit: contain; }
.brand-fallback { font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: #0b2233; }
.brand-sub-row { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.brand-sub { font-weight: 800; letter-spacing: .22em; text-transform: uppercase; font-size: 12px; background: linear-gradient(90deg, #5fe0f5, var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--side-muted); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #f5b82e; }
.live.on { color: #7ef0c4; background: rgba(16,185,129,.12); }
.live.on i { background: #22d39a; box-shadow: 0 0 0 0 rgba(34,211,154,.6); animation: pulse 2s infinite; }
.live.poll i { background: #f5b82e; }
.live.off i { background: #ef4444; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,211,154,.55); } 70% { box-shadow: 0 0 0 7px rgba(34,211,154,0); } 100% { box-shadow: 0 0 0 0 rgba(34,211,154,0); } }

.compose-btn { background: linear-gradient(135deg, #2fc6e2, var(--brand-deep)); box-shadow: 0 8px 20px rgba(27,176,206,.35); color: #fff; }
.compose-btn:hover { filter: brightness(1.08); }

.dom-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; color: var(--side-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 10px 10px 4px; cursor: pointer; text-align: left; }
.dom-head:hover { color: #fff; }
.dom-head .dom-name { flex: 1; }
.dom-head .chev { display: inline-block; transition: transform .15s; font-size: 10px; }
.dom-head.shut .chev { transform: rotate(-90deg); }
.accounts a { padding: 6px 10px; }
.accounts a.all { margin-bottom: 2px; }
.accounts .acc-mail { display: flex; flex-direction: column; line-height: 1.2; }
.accounts .acc-mail b { font-weight: 550; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.accounts .acc-mail small { font-size: 11px; color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; }
.accounts a.has-unread .acc-mail b { font-weight: 700; color: #fff; }
.accounts .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.08); }
.accounts .err { color: #ff8a80; }
.accounts .empty-acc { color: var(--side-muted); }

.me-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px 2px; }
.me-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: #fff; flex: none; background: var(--brand); }
.me-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-txt b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.me-txt span { color: var(--side-muted); }
body[data-role="member"] .admin-only { display: none !important; }

/* list */
.greet { color: var(--accent); font-weight: 650; margin-bottom: 1px; }
.list-title h2 { font-size: 20px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.item::before { width: 3px; }
.item .snip { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.item.unread .snip { color: var(--text-2); }
.item.fresh { animation: freshIn .6s ease-out; background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%); }
@keyframes freshIn { from { transform: translateY(-6px); opacity: 0; } }
.new-tag { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: #fff; background: var(--brand); padding: 1px 6px; border-radius: 999px; }
.icon-btn.on-accent { color: var(--accent); background: var(--accent-weak); }
.search { background: var(--hover); border: 1px solid transparent; }
.search:focus-within { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-weak); }

/* reader */
.empty .kbd-hints { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 14px; }
kbd { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--panel); color: var(--text-2); }
.msg-card { box-shadow: 0 1px 2px rgba(15,34,48,.04), 0 10px 30px rgba(15,34,48,.06); }

/* composer */
.comp-head { background: linear-gradient(135deg, #0b2233, #0e3a4f); color: #e8f7fb; }
.tpl-btn { width: auto !important; padding: 0 9px !important; gap: 6px; font-weight: 650 !important; color: var(--accent) !important; }
.tpl-btn span { font-size: 12.5px; }
#tpl-menu { min-width: 260px; }
.toast.undo { position: relative; overflow: hidden; background: #0b2233; color: #e8f7fb; }
.toast.undo button { color: #5fe0f5; }
.toast .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--brand); animation: drain 5s linear forwards; }
@keyframes drain { from { width: 100%; } to { width: 0; } }

/* settings extras */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tab { white-space: nowrap; }
.role { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.role.admin { background: var(--accent-weak); color: var(--accent); }
.acc-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.pick { display: flex !important; align-items: center; gap: 8px; font-weight: 450 !important; font-size: 13px !important; }
.pick .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-list { display: grid; gap: 2px; }
.act-row { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.act-time { font-size: 12px; }
.set-row > svg { color: var(--accent); }

/* auth */
.auth { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%), radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #0b2233 25%, transparent), transparent 60%), var(--bg); }
.auth-card { position: relative; z-index: 1; border-top: 4px solid var(--brand); }
.auth-brand { display: grid; justify-items: center; gap: 6px; padding: 4px 0 8px; }
.auth-brand .brand-logo { max-height: 60px; }
.auth-brand .brand-sub { font-size: 13px; background: linear-gradient(90deg, var(--brand), var(--brand-deep)); -webkit-background-clip: text; background-clip: text; }
.auth-card h1 { text-align: center; }
.auth-card > p.muted { text-align: center; }
.btn.primary { background: linear-gradient(135deg, #22bfdc, var(--brand-deep)); }
@media (prefers-color-scheme: dark) {
  .brand-card { background: #f4fbfd; }
  .auth-brand .brand-logo { background: #f4fbfd; padding: 8px 12px; border-radius: 10px; }
}
@media (max-width: 960px) {
  .sidebar { background: var(--side-bg); }
}

.sidebar > * { flex-shrink: 0; }
.greet { padding: 4px 14px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-title { padding-top: 2px; }
