/* Zoltis Mail – Gmail-style UI. Light/dark via [data-theme]. */
:root {
  --primary: #0b57d0;
  --primary-hover: #0842a0;
  --on-primary: #fff;
  --bg: #f6f8fc;
  --surface: #fff;
  --surface-2: #f2f6fc;
  --surface-3: #eaf1fb;
  --nav-active: #d3e3fd;
  --nav-hover: #e1e5ea;
  --compose: #c2e7ff;
  --compose-hover: #b3d7ef;
  --text: #1f1f1f;
  --text-2: #444746;
  --text-3: #5e5e5e;
  --border: #e0e3e7;
  --row-read: #f2f6fc;
  --row-unread: #fff;
  --row-hover-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);
  --row-selected: #c2dbff;
  --star: #f4b400;
  --danger: #b3261e;
  --ok: #146c2e;
  --warn: #8a5a00;
  --shadow-2: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
  --shadow-compose: 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12), 0 5px 5px -3px rgba(0,0,0,.2);
  --radius: 16px;
  --row-h: 40px;
  --font: "Google Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --primary: #a8c7fa;
  --primary-hover: #c2d7fb;
  --on-primary: #062e6f;
  --bg: #1b1b1b;
  --surface: #111;
  --surface-2: #1e1f20;
  --surface-3: #282a2c;
  --nav-active: #004a77;
  --nav-hover: #2d2f31;
  --compose: #004a77;
  --compose-hover: #0b5a8c;
  --text: #e3e3e3;
  --text-2: #c4c7c5;
  --text-3: #9aa0a6;
  --border: #3c4043;
  --row-read: #1e1f20;
  --row-unread: #111;
  --row-hover-shadow: inset 1px 0 0 #5f6368, inset -1px 0 0 #5f6368, 0 1px 3px rgba(0,0,0,.6);
  --row-selected: #0e3a5e;
  --danger: #f2b8b5;
  --ok: #6dd58c;
  --warn: #ffb95c;
  color-scheme: dark;
}
[data-density="compact"] { --row-h: 32px; }
[data-density="comfortable"] { --row-h: 48px; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.43 var(--font-body); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: var(--primary); }
a.btn, a.tab { text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.spacer { flex: 1; }
.ic { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* ---------- buttons ---------- */
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); flex: none; position: relative; }
.icon-btn:hover { background: rgba(68,71,70,.08); }
[data-theme="dark"] .icon-btn:hover { background: rgba(227,227,227,.08); }
.icon-btn:active { background: rgba(68,71,70,.16); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .38; cursor: default; background: none; }
.btn { border: 0; border-radius: 20px; height: 36px; padding: 0 24px; font: 500 14px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; letter-spacing: .01em; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.btn.primary:disabled { opacity: .6; cursor: progress; }
.btn.text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn.text:hover { background: rgba(11,87,208,.08); }
.btn.outline { background: transparent; border: 1px solid #747775; color: var(--text-2); }
.btn.outline:hover { background: rgba(68,71,70,.08); }
.btn.danger { background: var(--danger); color: #fff; }
.sep { width: 1px; height: 20px; background: var(--border); margin: 0 8px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 448px; background: var(--surface); border-radius: 28px; padding: 40px 40px 28px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.login-logo { width: 48px; height: 48px; }
.login-card h1 { font: 400 32px/1.25 var(--font); margin: 16px 0 6px; }
.login-sub { margin: 0 0 32px; color: var(--text-2); font-size: 16px; }
.field { position: relative; display: block; margin-bottom: 20px; }
.field input { width: 100%; height: 56px; border: 1px solid #747775; border-radius: 4px; padding: 16px 15px 0; background: transparent; font-size: 16px; outline: none; }
.field input:focus { border: 2px solid var(--primary); padding-left: 14px; }
.field span { position: absolute; left: 12px; top: 18px; padding: 0 4px; color: var(--text-2); background: var(--surface); transition: all .15s; pointer-events: none; font-size: 16px; }
.field input:focus + span, .field input:not(:placeholder-shown) + span { top: -9px; font-size: 12px; color: var(--primary); }
.field input:not(:focus):not(:placeholder-shown) + span { color: var(--text-2); }
.field textarea { width: 100%; min-height: 80px; border: 1px solid #747775; border-radius: 4px; padding: 22px 15px 8px; background: transparent; font: 13px/1.4 ui-monospace, monospace; outline: none; resize: vertical; word-break: break-all; }
.field textarea:focus { border: 2px solid var(--primary); padding-left: 14px; }
.field textarea:focus + span, .field textarea:not(:placeholder-shown) + span { top: -9px; font-size: 12px; color: var(--primary); }
.lic-key { width: 100%; max-width: 760px; border: 1px solid #747775; border-radius: 4px; padding: 10px 12px; background: transparent; font: 13px/1.4 ui-monospace, monospace; word-break: break-all; outline: none; }
.lic-key:focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.login-error { color: var(--danger); min-height: 20px; font-size: 13px; margin: -8px 0 8px; display: flex; gap: 6px; align-items: center; }
.login-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.show-pw { display: flex; gap: 8px; align-items: center; color: var(--text-2); cursor: pointer; }
.login-foot { margin: 32px 0 0; color: var(--text-3); font-size: 12px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); grid-template-rows: 64px 1fr; height: 100vh; overflow: hidden; }
.app.collapsed { grid-template-columns: 72px minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; padding: 8px 12px 8px 12px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-2); font: 400 22px var(--font); width: 200px; padding-left: 4px; flex: none; }
.brand img { width: 36px; height: 36px; }
.search { flex: 1; max-width: 720px; height: 48px; background: var(--surface-3); border-radius: 24px; display: flex; align-items: center; padding: 0 4px; position: relative; }
.search:focus-within { background: var(--surface); box-shadow: 0 1px 1px 0 rgba(65,69,73,.3), 0 1px 3px 1px rgba(65,69,73,.15); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; height: 100%; min-width: 0; }
.search input::-webkit-search-cancel-button { display: none; }
.search-panel { position: absolute; top: 52px; left: 0; right: 0; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-2); padding: 16px 24px; z-index: 50; display: grid; grid-template-columns: 1fr; gap: 10px; }
.search-panel label { display: grid; grid-template-columns: 140px 1fr; align-items: center; color: var(--text-2); }
.search-panel label input, .search-panel label select { border: 0; border-bottom: 1px solid var(--border); background: transparent; height: 32px; outline: none; }
.search-panel label input:focus { border-bottom: 2px solid var(--primary); }
.search-panel label.chk { display: flex; gap: 8px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; position: relative; }
.avatar-btn { border: 0; background: none; padding: 4px; border-radius: 50%; cursor: pointer; }
.avatar-btn:hover { background: rgba(68,71,70,.08); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font: 500 15px var(--font); background: #7b1fa2; flex: none; user-select: none; }
.avatar.big { width: 56px; height: 56px; font-size: 24px; }
.avatar.md { width: 40px; height: 40px; font-size: 17px; }

/* ---------- sidebar ---------- */
.sidebar { overflow-y: auto; padding: 8px 16px 16px 8px; }
.compose-btn { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px 0 16px; min-width: 56px; border: 0; border-radius: 16px; background: var(--compose); color: var(--text); font: 500 14px var(--font); cursor: pointer; margin: 0 0 16px 0; transition: box-shadow .1s; }
.compose-btn:hover { box-shadow: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15); }
.compose-btn .ic { width: 24px; height: 24px; }
.folders { list-style: none; margin: 0; padding: 0; }
.folder { display: flex; align-items: center; gap: 18px; height: 32px; padding: 0 12px 0 26px; border-radius: 0 16px 16px 0; cursor: pointer; color: var(--text); text-decoration: none; user-select: none; white-space: nowrap; }
.folder:hover { background: var(--nav-hover); }
.folder.active { background: var(--nav-active); font-weight: 700; }
.folder .name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.folder .count { font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.folder.has-unread .name { font-weight: 700; }
.folder.drop-target { background: var(--row-selected); }
.labels-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 4px 4px 26px; font: 500 16px var(--font); color: var(--text); }
.enterprise-nav { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 8px; }
.enterprise-nav:empty { display: none; }
.app.collapsed .sidebar .folder .name, .app.collapsed .sidebar .folder .count, .app.collapsed .compose-btn span, .app.collapsed .labels-head, .app.collapsed #labels { display: none; }
.app.collapsed .folder { padding: 0; justify-content: center; border-radius: 16px; width: 56px; }
.app.collapsed .compose-btn { padding: 0 16px; }

/* ---------- main ---------- */
.main { overflow: hidden; padding: 0 16px 16px 0; display: flex; }
.pane { flex: 1; background: var(--surface); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 8px 4px 8px; min-height: 48px; border-bottom: 1px solid transparent; flex: none; }
.bulk { display: flex; align-items: center; gap: 2px; }
.chk-wrap { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; }
.chk-wrap:hover { background: rgba(68,71,70,.08); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.pager-text { font-size: 12px; color: var(--text-2); padding: 0 8px; white-space: nowrap; }
.search-banner { padding: 8px 24px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.list { flex: 1; overflow-y: auto; }

/* ---------- rows ---------- */
.row { display: flex; align-items: center; height: var(--row-h); padding: 0 16px 0 8px; border-bottom: 1px solid var(--border); cursor: pointer; background: var(--row-read); position: relative; font-size: 14px; }
.row.unread { background: var(--row-unread); font-weight: 700; }
.row.unread .snippet { font-weight: 400; }
.row:hover { box-shadow: var(--row-hover-shadow); z-index: 1; }
.row.selected { background: var(--row-selected); }
.row.focused::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.row .chk-wrap { width: 32px; height: 32px; flex: none; }
.row .star { width: 32px; height: 32px; flex: none; color: var(--text-3); }
.row .star.on { color: var(--star); }
.row .from { width: 168px; flex: none; padding: 0 16px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .from .cnt { color: var(--text-3); font-weight: 400; font-size: 12px; }
.row .content { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.row .subject { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.row .snippet { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }

.row .att { color: var(--text-3); flex: none; display: flex; }
.row .att .ic { width: 16px; height: 16px; }
.row .date { width: 76px; text-align: right; flex: none; font-size: 12px; color: var(--text-2); }
.row.unread .date { color: var(--text); }
.row .hover-acts { display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: inherit; }
.row:hover .hover-acts { display: flex; }
.row:hover .date { visibility: hidden; }
.row .hover-acts .icon-btn { width: 36px; height: 36px; }
.row .chip { font-size: 11px; font-weight: 500; padding: 0 6px; border-radius: 4px; background: #ddd; color: #444; margin-right: 4px; flex: none; }
.row .chip.draft { color: #c5221f; background: none; padding: 0; font-size: 14px; }
.empty { text-align: center; padding: 64px 24px; color: var(--text-3); }
.empty .ic { width: 64px; height: 64px; opacity: .35; }
.loading-bar { height: 3px; background: linear-gradient(90deg, transparent, var(--primary), transparent); background-size: 50% 100%; animation: load 1s linear infinite; background-repeat: no-repeat; }
@keyframes load { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---------- message view ---------- */
.msg-scroll { flex: 1; overflow-y: auto; padding: 8px 0 32px; }
.msg-subject { display: flex; align-items: flex-start; gap: 8px; padding: 12px 24px 12px 72px; }
.msg-subject h2 { font: 400 22px/1.3 var(--font); margin: 0; flex: 1; word-break: break-word; }
.msg-subject .chip { font-size: 12px; background: var(--surface-3); border-radius: 4px; padding: 2px 6px; color: var(--text-2); white-space: nowrap; margin-left: 8px; vertical-align: middle; }
.msg { padding: 0 24px 0 16px; }
.msg-head { display: flex; align-items: flex-start; gap: 16px; padding: 16px 0 8px; }
.msg-head .who { flex: 1; min-width: 0; }
.msg-head .who b { font-weight: 700; }
.msg-head .who .addr { color: var(--text-3); font-size: 12px; }
.msg-head .to { color: var(--text-3); font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; }
.msg-head .to .ic { width: 16px; height: 16px; }
.msg-head .when { color: var(--text-2); font-size: 12px; white-space: nowrap; padding-top: 4px; }
.msg-details { margin: 4px 0 0; font-size: 12px; color: var(--text-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; max-width: 560px; }
.msg-details dt { color: var(--text-3); text-align: right; }
.msg-details dd { margin: 0; word-break: break-all; }
.msg-body { padding-left: 56px; }
.msg-body iframe { width: 100%; border: 0; display: block; min-height: 60px; background: #fff; color-scheme: light; border-radius: 4px; }
.img-banner { margin: 4px 0 12px 56px; padding: 8px 12px; background: var(--surface-3); border-radius: 8px; font-size: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.attachments { margin: 16px 0 0 56px; padding-top: 16px; border-top: 1px solid var(--border); }
.attachments h4 { margin: 0 0 12px; font: 500 14px var(--font); }
.att-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.att-card { width: 180px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; text-decoration: none; color: var(--text); display: flex; flex-direction: column; position: relative; background: var(--surface); }
.att-card:hover { box-shadow: var(--shadow-2); }
.att-thumb { height: 96px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb .ic { width: 40px; height: 40px; color: var(--text-3); }
.att-meta { padding: 8px 10px; display: flex; gap: 8px; align-items: center; font-size: 12px; }
.att-meta .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.att-meta .sz { color: var(--text-3); }
.av-badge { position: absolute; top: 6px; left: 6px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; display: inline-flex; align-items: center; gap: 4px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.av-badge .ic { width: 12px; height: 12px; }
.av-badge.clean { color: var(--ok); }
.av-badge.infected { color: #fff; background: #b3261e; }
.av-badge.error { color: var(--warn); }
.att-card.infected { border-color: #b3261e; pointer-events: none; opacity: .85; }
.att-sig { font-size: 11px; color: #b3261e; padding: 0 10px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sig.warn { color: var(--warn); }
.av-badge.right { left: auto; right: 6px; }
.att-card.caution { border-color: #e8a33d; }
.c-att.warn { background: #fef7e0; color: #7a4f01; }
[data-theme="dark"] .c-att.warn { background: #3d2e00; color: #ffd27a; }
.att-card.infected .att-thumb { background: repeating-linear-gradient(45deg, #fce8e6, #fce8e6 8px, #fff 8px, #fff 16px); }
.reply-bar { display: flex; gap: 12px; margin: 24px 0 0 56px; flex-wrap: wrap; }
.reply-bar .btn { height: 40px; }
.msg-actions { display: flex; align-items: center; }

/* ---------- compose ---------- */
.composers { position: fixed; right: 16px; bottom: 0; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 16px; z-index: 40; pointer-events: none; }
.composer { width: 560px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 80px); background: var(--surface); border-radius: 8px 8px 0 0; box-shadow: var(--shadow-compose); display: flex; flex-direction: column; pointer-events: auto; overflow: hidden; }
.composer.min { height: 40px; width: 280px; }
.composer.max { position: fixed; inset: 5vh 8vw; width: auto; height: auto; max-height: none; border-radius: 8px; z-index: 60; }
.composer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; pointer-events: auto; }
.c-head { height: 40px; flex: none; display: flex; align-items: center; padding: 0 4px 0 16px; background: var(--surface-2); cursor: pointer; font: 500 14px var(--font); }
.c-head .ttl { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.c-head .icon-btn { width: 28px; height: 28px; }
.c-head .icon-btn .ic { width: 16px; height: 16px; }
.composer.min .c-body, .composer.min .c-foot { display: none; }
.c-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 0 16px; }
.c-row { display: flex; align-items: center; min-height: 40px; border-bottom: 1px solid var(--border); gap: 8px; position: relative; flex-wrap: wrap; padding: 4px 0; }
.c-row label { color: var(--text-3); }
.c-row input.plain { flex: 1; border: 0; outline: none; background: transparent; min-width: 120px; height: 30px; }
.c-row .toggles { margin-left: auto; color: var(--text-2); display: flex; gap: 8px; }
.c-row .toggles span { cursor: pointer; }
.c-row .toggles span:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; align-items: center; }
.rchip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px 0 10px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); font-size: 13px; max-width: 260px; }
.rchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rchip.bad { background: #fce8e6; border-color: #f28b82; color: #a50e0e; }
.rchip button { border: 0; background: none; cursor: pointer; padding: 0; display: flex; color: var(--text-3); }
.rchip button .ic { width: 14px; height: 14px; }
.suggest { position: absolute; top: 100%; left: 24px; z-index: 5; background: var(--surface); box-shadow: var(--shadow-2); border-radius: 8px; min-width: 320px; padding: 6px 0; }
.suggest div { padding: 6px 16px; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.suggest div.on, .suggest div:hover { background: var(--surface-3); }
.suggest small { color: var(--text-3); }
.c-editor { flex: 1; overflow-y: auto; outline: none; padding: 12px 0; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5; word-break: break-word; }
.c-editor:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.c-editor blockquote { margin: 0 0 0 .8ex; border-left: 1px solid #ccc; padding-left: 1ex; color: var(--text-2); }
.c-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 8px; }
.c-att { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3); border-radius: 4px; padding: 4px 4px 4px 10px; font-size: 13px; font-weight: 500; max-width: 100%; }
.c-att .sz { color: var(--text-3); font-weight: 400; }
.c-att.bad { background: #fce8e6; color: #a50e0e; }
.c-foot { display: flex; align-items: center; gap: 2px; padding: 12px 16px 12px; flex: none; position: relative; }
.c-foot .btn.primary { padding: 0 20px; height: 36px; margin-right: 12px; }
.fmt-bar { display: flex; gap: 2px; padding: 4px; border-radius: 8px; background: var(--surface-2); margin: 0 16px 0; flex: none; }
.fmt-bar .icon-btn { width: 32px; height: 32px; border-radius: 4px; }
.fmt-bar .icon-btn .ic { width: 18px; height: 18px; }
.drop-zone { position: absolute; inset: 40px 0 0; background: rgba(194,231,255,.9); border: 2px dashed var(--primary); display: flex; align-items: center; justify-content: center; font: 500 18px var(--font); color: var(--primary); z-index: 3; }

/* ---------- menus, snackbar, modal ---------- */
.menu { position: absolute; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-2); padding: 8px 0; z-index: 70; min-width: 220px; }
#account-menu { top: 48px; right: 0; width: 320px; padding: 16px 0 8px; border-radius: 24px; }
.acct-head { display: flex; gap: 16px; align-items: center; padding: 0 24px 16px; }
.acct-edition { margin: 0 24px 12px; padding: 8px 12px; border-radius: 8px; background: var(--surface-3); font-size: 12px; color: var(--text-2); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 8px 24px; text-align: left; cursor: pointer; min-height: 36px; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.on { font-weight: 700; }
#popover { position: fixed; max-height: 60vh; overflow-y: auto; }
.snackbar { position: fixed; left: 24px; bottom: 24px; min-width: 288px; max-width: 560px; background: #323232; color: #f2f2f2; border-radius: 4px; padding: 6px 8px 6px 16px; display: flex; align-items: center; gap: 8px; z-index: 90; box-shadow: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px rgba(0,0,0,.14); font-size: 14px; }
.snackbar span { flex: 1; padding: 8px 0; }
.snackbar .btn.text { color: #a8c7fa; height: 32px; }
.snackbar .icon-btn { color: #f2f2f2; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 28px; width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-compose); }
.modal.wide { max-width: 860px; }
.modal h3 { font: 400 24px var(--font); margin: 0; padding: 24px 24px 16px; }
.modal .m-body { padding: 0 24px; overflow-y: auto; flex: 1; }
.modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 20px 24px; }
.modal input.txt, .modal select, .modal textarea { width: 100%; border: 1px solid #747775; border-radius: 4px; padding: 10px 12px; background: transparent; outline: none; }
.modal input.txt:focus, .modal textarea:focus, .modal select:focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 24px; overflow-x: auto; }
.tab { text-decoration: none; display: inline-block; border: 0; background: none; padding: 12px 16px; cursor: pointer; color: var(--text-2); border-bottom: 3px solid transparent; font: 500 14px var(--font); white-space: nowrap; }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.set-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: start; }
.set-row > b { font-weight: 500; padding-top: 8px; }
.radio-col { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.radio-col label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.sig-editor { min-height: 100px; border: 1px solid #747775; border-radius: 4px; padding: 10px 12px; outline: none; }
.kbd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 32px; }
.kbd-grid div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
kbd { font: 500 12px ui-monospace, monospace; background: var(--surface-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; }
.report-row { display: grid; grid-template-columns: 28px 140px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
.report-row .ic { width: 20px; height: 20px; }
.report-row .fix { font: 12px ui-monospace, monospace; background: var(--surface-3); padding: 6px 8px; border-radius: 4px; margin-top: 6px; word-break: break-all; user-select: all; }
.st-pass { color: var(--ok); } .st-warn { color: var(--warn); } .st-fail { color: var(--danger); }
.score { font: 400 44px var(--font); }
.ent-card { border: 1px dashed var(--border); border-radius: 16px; padding: 24px; margin: 24px; text-align: center; color: var(--text-2); }
.ent-card .ic { width: 48px; height: 48px; color: var(--primary); }

/* ---------- storage meter ---------- */
.storage { margin: 16px 8px 8px 26px; font-size: 12px; color: var(--text-2); }
.storage-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin-bottom: 6px; }
.storage-bar span { display: block; height: 100%; background: var(--primary); border-radius: 2px; transition: width .3s; }
.storage.warn .storage-bar span { background: #e37400; }
.storage.full .storage-bar span { background: #d93025; }
.storage.full .storage-text { color: #d93025; font-weight: 500; }
.app.collapsed .storage { display: none; }

/* ---------- admin console ---------- */
#module-view { overflow: hidden; }
.adm { display: flex; flex-direction: column; height: 100%; }
.adm-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px 0; flex-wrap: wrap; }
.adm-head h2 { font: 400 22px var(--font); margin: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.adm-head h2 .ic { width: 26px; height: 26px; color: var(--primary); }
.adm .tabs { margin: 8px 24px 0; }
.adm-body { flex: 1; overflow: auto; padding: 20px 24px 40px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card { border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; background: var(--surface); }
.card h4 { margin: 0 0 6px; font: 500 13px var(--font); color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.card h4 .ic { width: 18px; height: 18px; }
.card .big { font: 400 30px var(--font); }
.card .big small { font-size: 15px; color: var(--text-3); }
.card .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.meter { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 10px; }
.meter span { display: block; height: 100%; background: var(--primary); }
.meter.warn span { background: #e37400; } .meter.full span { background: #d93025; }
.adm-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.adm-tools .txt { max-width: 280px; }
.adm-tools .count { color: var(--text-2); font-size: 13px; margin-left: auto; }
.adm input.txt, .adm select.txt { border: 1px solid #747775; border-radius: 4px; padding: 8px 12px; background: transparent; outline: none; height: 38px; }
.adm input.txt:focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .who { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.tbl .who div { min-width: 0; }
.tbl .who > div > b { font-weight: 500; display: block; }
.tbl .who > div > span { color: var(--text-3); font-size: 12px; }
.tbl .use { min-width: 150px; }
.tbl .use .meter { margin-top: 4px; height: 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.admin { background: #e8def8; color: #4a2c8f; }
.badge.ok { background: #e6f4ea; color: #137333; } .badge.off { background: #fce8e6; color: #a50e0e; } .badge.warn { background: #fef7e0; color: #7a4f01; }
[data-theme="dark"] .badge.admin { background: #3b2a63; color: #d7c6ff; }
[data-theme="dark"] .badge.ok { background: #0f3d1f; color: #8fdca5; } [data-theme="dark"] .badge.off { background: #4d1712; color: #f6aea9; } [data-theme="dark"] .badge.warn { background: #3d2e00; color: #ffd27a; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #1e8e3e; display: inline-block; }
.dns-tbl td:nth-child(3) { font: 12px ui-monospace, monospace; word-break: break-all; }
.copy { cursor: pointer; }
.domain-card { border: 1px solid var(--border); border-radius: 16px; margin-bottom: 18px; overflow: hidden; }
.domain-card header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--surface-2); flex-wrap: wrap; }
.domain-card header b { font: 500 16px var(--font); flex: 1; }
.domain-card .inner { padding: 6px 18px 16px; overflow-x: auto; }
.limit-note { padding: 12px 16px; border-radius: 12px; background: var(--surface-3); font-size: 13px; display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.limit-note .ic { color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 160px 1fr; gap: 12px 16px; align-items: center; }
.form-grid > label { color: var(--text-2); }
.pw-row { display: flex; gap: 6px; }
.pw-row input { flex: 1; }
.job { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }

/* ---------- responsive ---------- */
.scrim { display: none; }
#compose-fab { display: none; position: fixed; right: 16px; bottom: 20px; z-index: 30; box-shadow: var(--shadow-2); margin: 0; }
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 280px; background: var(--bg); z-index: 45; transform: translateX(-100%); transition: transform .2s; padding-top: 16px; }
  .app.drawer .sidebar { transform: none; box-shadow: var(--shadow-2); }
  .app.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 44; }
  .app.collapsed .sidebar .folder .name, .app.collapsed .sidebar .folder .count, .app.collapsed .compose-btn span, .app.collapsed .labels-head, .app.collapsed #labels { display: revert; }
  .app.collapsed .folder { width: auto; padding: 0 12px 0 26px; justify-content: flex-start; border-radius: 0 16px 16px 0; }
  .main { padding: 0; }
  .pane { border-radius: 0; }
  .brand { width: auto; }
  .brand span { display: none; }
  .row { height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "from date" "content star"; padding: 10px 8px 10px 16px; gap: 0 8px; align-items: center; }
  .row .chk-wrap, .row .att { display: none; }
  .row .from { grid-area: from; width: auto; padding: 0; font-size: 15px; }
  .row .date { grid-area: date; width: auto; padding-right: 8px; }
  .row .content { grid-area: content; flex-direction: column; align-items: stretch; gap: 0; }
  .row .subject, .row .snippet { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; }
  .row .star { grid-area: star; align-self: start; }
  .row .hover-acts { display: none !important; }
  .row:hover .date { visibility: visible; }
  .row:hover { box-shadow: none; }
  .search { min-width: 0; height: 44px; }
  #search-opts, #search-clear { display: none; }
  .search-panel { position: fixed; left: 8px; right: 8px; top: 60px; }
  #settings-btn { display: none; }
  .topbar { gap: 2px; padding: 8px 8px; }
  .brand img { width: 30px; height: 30px; }
  .toolbar .pager-text { display: none; }
  .row .snippet .dash { display: none; }
  .app:not(.hidden) ~ #compose-fab { display: inline-flex; }
  .msg-subject { padding-left: 16px; }
  .msg-subject h2 { font-size: 20px; }
  .msg-head { flex-wrap: wrap; gap: 4px 12px; position: relative; }
  .msg-head .who { flex: 1 1 0; }
  .msg-head .who .addr { display: block; }
  .msg-head .when { order: 5; flex-basis: 100%; padding: 0 0 0 52px; }
  .app[data-view="msg"] ~ #compose-fab, .app[data-view="module"] ~ #compose-fab { display: none !important; }
  .msg-body, .attachments, .reply-bar, .img-banner { margin-left: 0; padding-left: 0; }
  .msg { padding: 0 12px; }
  .composers { right: 0; left: 0; }
  .composer, .composer.max { position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; max-width: none; border-radius: 0; }
  .set-row { grid-template-columns: 1fr; }
  .kbd-grid { grid-template-columns: 1fr; }
  .search-panel label { grid-template-columns: 1fr; }
  #help-btn { display: none; }
  .adm-head, .adm-body { padding-left: 12px; padding-right: 12px; }
  .adm .tabs { margin: 8px 12px 0; }
  .tbl .hide-sm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .sidebar, .toolbar, .reply-bar, .composers, .snackbar { display: none !important; }
  .app { display: block; height: auto; }
  .main, .pane, .msg-scroll { overflow: visible; display: block; }
}

/* Admin setup guide */
.guide-step { display: flex; gap: 16px; margin: 0 0 28px; max-width: 1100px; }
.guide-step .num { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; }
.guide-step .txt { flex: 1; min-width: 0; }
.guide-step h3 { font: 500 16px var(--font); margin: 4px 0 8px; }
.guide-step ol { margin: 0; padding-left: 20px; line-height: 1.7; }
.guide-step p { margin: 0 0 10px; line-height: 1.6; }
.cf-tbl code { word-break: break-all; }
.cf-tbl .cf-content { max-width: 460px; }
@media (max-width: 600px) { .guide-step { gap: 10px; } .guide-step .num { width: 26px; height: 26px; font-size: 13px; } }
pre.code { background: var(--surface-3); border-radius: 8px; padding: 10px 12px; font: 12px/1.5 ui-monospace, monospace; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0 0 10px; }
