:root {
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --brand-press: #0c3b5e;
  --on-brand: #ffffff;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --hover: #f0f0f0;
  --selected: #ebf3fc;
  --selected-strong: #cfe4fa;
  --border: #e0e0e0;
  --text: #242424;
  --text-2: #616161;
  --text-3: #8a8a8a;
  --danger: #c50f1f;
  --flag: #c50f1f;
  --ok: #107c10;
  --shadow: 0 8px 24px rgba(0, 0, 0, .14), 0 1px 3px rgba(0, 0, 0, .1);
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2886de;
    --brand-hover: #3a96e8;
    --brand-press: #1b5c99;
    --bg: #1b1b1b;
    --surface: #242424;
    --surface-2: #1f1f1f;
    --hover: #2e2e2e;
    --selected: #1d3550;
    --selected-strong: #234a73;
    --border: #3a3a3a;
    --text: #f0f0f0;
    --text-2: #c2c2c2;
    --text-3: #8f8f8f;
    --danger: #f1707b;
    --flag: #f1707b;
    --ok: #54b054;
    --shadow: 0 8px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #2886de;
  --brand-hover: #3a96e8;
  --brand-press: #1b5c99;
  --bg: #1b1b1b;
  --surface: #242424;
  --surface-2: #1f1f1f;
  --hover: #2e2e2e;
  --selected: #1d3550;
  --selected-strong: #234a73;
  --border: #3a3a3a;
  --text: #f0f0f0;
  --text-2: #c2c2c2;
  --text-3: #8f8f8f;
  --danger: #f1707b;
  --flag: #f1707b;
  --ok: #54b054;
  --shadow: 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.4 "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.muted { color: var(--text-2); }
.error { color: var(--danger); white-space: pre-line; margin: 8px 0 0; font-size: 13px; }
.icon-btn.mobile-only, .scrim { display: none; }

.ic { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius); padding: 6px 14px; cursor: pointer; font-weight: 600;
  min-height: 32px; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.primary:active { background: var(--brand-press); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 0; background: transparent; border-radius: var(--radius); cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on-brand { color: var(--on-brand); }
.icon-btn.on-brand:hover { background: rgba(255, 255, 255, .15); color: var(--on-brand); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  border: 1px solid var(--border); border-bottom-color: var(--text-3); background: var(--surface);
  border-radius: 4px; padding: 6px 10px; min-height: 32px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-bottom: 2px solid var(--brand); padding-bottom: 5px; }
input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; cursor: pointer; }

/* ---------- lock screen ---------- */
.lock { min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(135deg, var(--brand) 0%, #2b88d8 50%, #6264a7 100%); }
.lock-card { width: min(380px, 100%); background: var(--surface); border-radius: 10px; padding: 32px 28px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.lock-card h1 { margin: 0; font-size: 22px; font-weight: 600; }
.lock-card p { margin: 0; }
.lock-logo { width: 48px; height: 48px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.lock-logo .ic { width: 26px; height: 26px; }

/* ---------- app shell ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 48px; flex: none; background: var(--brand); color: var(--on-brand);
  display: flex; align-items: center; gap: 12px; padding: 0 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; width: 228px; }
.search {
  flex: 1; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .92); color: #424242; border-radius: 4px; padding: 0 10px; height: 32px;
}
.search input { border: 0 !important; background: transparent; padding: 0 !important; min-height: 0; color: #242424; }
.search input::placeholder { color: #707070; }
.top-actions { display: flex; gap: 4px; margin-left: auto; }

.commandbar {
  flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
}
.commandbar > .btn.primary { width: 216px; justify-content: center; }
.cmds { display: flex; align-items: center; gap: 2px; }
.cmd {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: 4px;
  padding: 6px 8px; cursor: pointer; color: var(--text); white-space: nowrap;
}
.cmd .ic { color: var(--brand); }
.cmd:hover:not(:disabled) { background: var(--hover); }
.cmd:disabled { opacity: .4; cursor: default; }
.sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }

.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(320px, 400px) 1fr; }

/* ---------- folder pane ---------- */
.folder-pane { background: var(--surface-2); border-right: 1px solid var(--border); overflow-y: auto; padding: 8px 6px 24px; }
.fp-section { margin-bottom: 6px; }
.fp-head {
  display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; cursor: pointer;
  padding: 8px 8px; font-weight: 600; border-radius: 4px; text-align: left;
}
.fp-head:hover { background: var(--hover); }
.fp-head .chev { width: 14px; height: 14px; color: var(--text-2); transition: transform .15s; }
.fp-section.collapsed .chev { transform: rotate(-90deg); }
.fp-section.collapsed .fp-list { display: none; }
.fp-head .acct-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.fp-list { list-style: none; margin: 0; padding: 0; }
.folder {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent;
  padding: 7px 10px 7px 26px; border-radius: 4px; cursor: pointer; text-align: left; color: var(--text);
}
.folder .ic { color: var(--text-2); }
.folder:hover { background: var(--hover); }
.folder.active { background: var(--selected-strong); font-weight: 600; }
.folder.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--brand); }
.folder.drop { outline: 2px dashed var(--brand); outline-offset: -2px; }
.folder .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { color: var(--brand); font-weight: 600; font-size: 13px; }
.folder.unread .fname { font-weight: 600; }
.fp-error { color: var(--danger); font-size: 12px; padding: 2px 10px 6px 26px; }
.fp-add { margin: 8px 6px; }
.fp-add .btn { width: 100%; justify-content: center; font-weight: 400; }

/* ---------- message list ---------- */
.list-pane { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.list-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px 8px; border-bottom: 1px solid var(--border); }
.list-head h2 { font-size: 18px; margin: 0; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.group-head { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface); position: sticky; top: 0; z-index: 1; }
.row {
  position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start;
  padding: 9px 12px 9px 14px; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none;
}
.row:hover { background: var(--hover); }
.row.selected { background: var(--selected); }
.row.active { background: var(--selected-strong); }
.row.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.row .acct-bar { position: absolute; right: 0; top: 0; bottom: 0; width: 3px; }
.row input[type=checkbox] { margin-top: 3px; opacity: 0; }
.row:hover input[type=checkbox], .row.selected input[type=checkbox], .msg-list.selecting input[type=checkbox] { opacity: 1; }
.row-main { min-width: 0; }
.row-top, .row-mid { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.row.unread .from { font-weight: 600; }
.row .subject { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.row.unread .subject { color: var(--brand); font-weight: 600; }
.row .date { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.row.unread .date { color: var(--brand); font-weight: 600; }
.row .meta { display: inline-flex; gap: 4px; color: var(--text-2); }
.row .meta .ic { width: 14px; height: 14px; }
.row .meta .flagged { color: var(--flag); }
.row-bottom { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--hover); color: var(--text-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill .dot { width: 7px; height: 7px; }
.row-actions { position: absolute; right: 8px; bottom: 6px; display: none; gap: 2px; background: var(--hover); border-radius: 4px; }
.row:hover .row-actions { display: flex; }
.row-actions .icon-btn { width: 26px; height: 26px; }
.row-actions .icon-btn .ic { width: 15px; height: 15px; }
.empty { display: grid; place-items: center; text-align: center; color: var(--text-2); padding: 48px 24px; gap: 8px; }
.empty .ic { width: 56px; height: 56px; color: var(--text-3); }
.empty .ic svg { stroke-width: 1; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 4px 8px; border-top: 1px solid var(--border); font-size: 12px; }
.pager #page-info { margin-right: auto; padding-left: 6px; }
.banner { margin: 8px 12px 0; padding: 8px 10px; font-size: 12px; border-radius: 4px; background: #fdf3f4; color: #a4262c; white-space: pre-line; }
:root[data-theme="dark"] .banner { background: #3b2326; color: #f1a7ad; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner { background: #3b2326; color: #f1a7ad; } }

.skeleton { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.skeleton div { height: 10px; border-radius: 4px; background: var(--hover); margin: 6px 0; animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- reading pane ---------- */
.read-pane { background: var(--surface); min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.read { padding: 16px 24px 32px; max-width: 1100px; width: 100%; }
.read-back { display: none; margin: 8px 0 0 8px; }
.read h1 { font-size: 20px; font-weight: 600; margin: 0 0 14px; word-break: break-word; }
.sender { display: flex; gap: 12px; align-items: flex-start; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; flex: none; font-size: 15px; }
.sender-info { flex: 1; min-width: 0; }
.sender-name { font-weight: 600; font-size: 15px; }
.sender-name .addr { font-weight: 400; color: var(--text-2); font-size: 13px; word-break: break-all; }
.recips { color: var(--text-2); font-size: 13px; margin-top: 2px; word-break: break-word; }
.read-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.read-date { font-size: 12px; color: var(--text-2); text-align: right; margin-top: 4px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.att {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); max-width: 260px; background: var(--surface);
}
.att:hover { background: var(--hover); }
.att .ic { color: var(--brand); }
.att .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.att .size { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.att button { border: 0; background: none; cursor: pointer; color: var(--text-2); padding: 0 0 0 4px; }
.img-banner { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 8px 12px; background: var(--hover); border-radius: 4px; font-size: 13px; }
.img-banner button { border: 0; background: none; color: var(--brand); cursor: pointer; font-weight: 600; padding: 0; }
.body { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.body iframe { width: 100%; border: 0; display: block; min-height: 120px; background: #fff; border-radius: 4px; }
.text-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.55; }
.text-body .q { color: var(--text-2); border-left: 3px solid var(--border); padding-left: 10px; display: block; }
.quick-reply { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.loading { padding: 40px; color: var(--text-2); text-align: center; }

/* ---------- compose ---------- */
.compose { display: flex; flex-direction: column; min-height: 100%; padding: 12px 20px 20px; gap: 0; }
.compose-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; flex-wrap: wrap; }
.compose-actions .status { margin-left: auto; color: var(--text-2); font-size: 13px; }
.c-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); min-height: 42px; position: relative; }
.c-row label { width: 64px; flex: none; color: var(--text-2); }
.c-row input, .c-row select { border: 0 !important; padding: 8px 0 !important; background: transparent; min-height: 40px; border-radius: 0; }
.c-row select { width: auto; max-width: 100%; cursor: pointer; }
.c-row .link { border: 0; background: none; color: var(--brand); cursor: pointer; white-space: nowrap; }
.c-row.subject input { font-size: 16px; }
.fmt { display: flex; gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fmt button { min-width: 30px; height: 28px; border: 0; background: transparent; border-radius: 4px; cursor: pointer; color: var(--text); }
.fmt button:hover { background: var(--hover); }
.editor { flex: 1; min-height: 260px; padding: 14px 2px; outline: none; line-height: 1.5; word-break: break-word; }
.editor blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--border); color: var(--text-2); }
.editor .sig img, .sig-preview-box img { max-width: 100%; height: auto; }
.sig-preview { display: grid; gap: 4px; font-size: 13px; }
.sig-preview small { color: var(--text-2); font-weight: 600; }
.sig-preview-box { border: 1px dashed var(--border); border-radius: 4px; padding: 10px; background: #fff; color: #242424; overflow-x: auto; }
.modal textarea[name=signature] { font: 12px/1.4 ui-monospace, Menlo, monospace; }
.editor hr { border: 0; border-top: 1px solid var(--border); }
.c-atts { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
.ac-menu { position: absolute; left: 72px; top: 100%; z-index: 20; min-width: 280px; max-width: calc(100% - 72px); background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius); padding: 4px; }
.ac-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 10px; border-radius: 4px; cursor: pointer; }
.ac-item.on, .ac-item:hover { background: var(--hover); }
.ac-item small { color: var(--text-2); display: block; }

/* ---------- menus, modals, toast ---------- */
.menu {
  position: fixed; z-index: 50; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius);
  padding: 4px; min-width: 220px; max-height: 60vh; overflow-y: auto;
}
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 4px; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu .menu-label { font-size: 12px; color: var(--text-2); padding: 6px 10px 2px; font-weight: 600; }
.modal-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .4); display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); padding: 22px 24px; }
.modal h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.modal h3 { margin: 22px 0 8px; font-size: 14px; font-weight: 600; }
.modal .form { display: grid; gap: 12px; margin-top: 14px; }
.modal .f { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.modal .f small { font-weight: 400; color: var(--text-2); }
.modal .grid2 { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal details summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 13px; }
.modal details[open] summary { margin-bottom: 10px; }
.hint { font-size: 12px; color: var(--text-2); background: var(--hover); padding: 8px 10px; border-radius: 4px; margin: 0; }
.acct-list { display: grid; gap: 6px; }
.acct-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.acct-item .info { flex: 1; min-width: 0; }
.acct-item .info div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-item .info small { color: var(--text-2); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: #242424; color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px);
}
.toast.err { background: #a4262c; }
.toast button { border: 0; background: none; color: #8ac6ff; font-weight: 600; cursor: pointer; }
.kbd-help td { padding: 3px 10px 3px 0; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font: 12px ui-monospace, monospace; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .panes { grid-template-columns: 210px minmax(300px, 360px) 1fr; }
  .brand { width: auto; }
  .commandbar > .btn.primary { width: auto; }
  .cmd > span:last-child { display: none; }
  .cmd[data-cmd="reply"] > span:last-child, .cmd[data-cmd="delete"] > span:last-child { display: inline; }
}
@media (max-width: 860px) {
  .icon-btn.mobile-only { display: inline-grid; }
  .brand span:last-child { display: none; }
  .panes { grid-template-columns: 1fr; position: relative; }
  .folder-pane { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); padding-top: 14px; }
  .app.drawer .folder-pane { transform: none; }
  .scrim { display: none; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .35); }
  .app.drawer .scrim { display: block; }
  .read-pane { position: absolute; inset: 0; z-index: 10; display: none; }
  .app.reading .read-pane { display: flex; }
  .read-back { display: inline-grid; }
  .read { padding: 8px 16px 24px; }
  .cmd > span:last-child, .cmd[data-cmd="reply"] > span:last-child, .cmd[data-cmd="delete"] > span:last-child { display: none; }
  .commandbar { gap: 6px; }
  .commandbar > .btn.primary > span:last-child { display: none; }
  .commandbar > .btn.primary { padding: 6px 10px; }
  .row input[type=checkbox] { opacity: 1; }
  .row-actions { display: none !important; }
  .compose { padding: 8px 16px 16px; }
  .modal .grid2 { grid-template-columns: 1fr 90px; }
  .sender { flex-wrap: wrap; }
  .sender > div:last-child { width: 100%; display: flex; justify-content: space-between; align-items: center; flex-direction: row-reverse; }
  .sender-name .addr { display: block; }
}

/* signature editor */
.sig-wrap { border: 1px solid var(--border); border-radius: 4px; overflow: hidden; font-weight: 400; }
.sig-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.sig-toolbar button { min-width: 30px; height: 28px; border: 0; background: transparent; border-radius: 4px; cursor: pointer; padding: 0 6px; }
.sig-toolbar button:hover, .sig-toolbar button.on { background: var(--selected-strong); }
.sig-toolbar select { width: auto; min-height: 28px; padding: 2px 6px; font-size: 12px; }
.sig-toolbar input[type=color] { width: 30px; height: 28px; padding: 2px; border: 0; background: transparent; cursor: pointer; }
.sig-editor { min-height: 110px; max-height: 260px; overflow: auto; padding: 10px 12px; outline: none; background: #fff; color: #242424; font: 14px/1.45 "Segoe UI", Arial, sans-serif; }
.sig-editor img { max-width: 100%; height: auto; }
.sig-source { border: 0 !important; border-radius: 0; min-height: 150px; font: 12px/1.4 ui-monospace, Menlo, monospace; }
.quote-toggle { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13px; cursor: pointer; width: fit-content; }
.quote-view { color: var(--text-2); font-size: 13px; padding-bottom: 8px; }
.quote-view blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--border); white-space: pre-wrap; }
.quote-view hr { border: 0; border-top: 1px solid var(--border); }

/* ---------- sidebar for many accounts ---------- */
.fp-list.smart { margin-bottom: 4px; }
.fp-list.smart .folder { padding-left: 12px; }
.fp-title { display: flex; justify-content: space-between; align-items: center; padding: 12px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; border-top: 1px solid var(--border); margin-top: 4px; }
.acct-filter-wrap { padding: 4px 4px 6px; }
.acct-filter { min-height: 30px !important; font-size: 13px; }
.fp-empty { color: var(--text-2); font-size: 12px; padding: 6px 12px; list-style: none; }
.acct-group { margin: 1px 0; }
.acct-row { display: flex; align-items: center; border-radius: 4px; position: relative; }
.acct-row:hover { background: var(--hover); }
.acct-row.active { background: var(--selected-strong); }
.acct-row.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--brand); }
.chev-btn { width: 22px; height: 40px; flex: none; border: 0; background: transparent; cursor: pointer; color: var(--text-2); display: grid; place-items: center; padding: 0; }
.chev-btn .ic { width: 14px; height: 14px; transition: transform .15s; }
.acct-group.open .chev-btn .ic { transform: rotate(90deg); }
.acct-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; cursor: pointer; padding: 6px 8px 6px 0; text-align: left; color: var(--text); }
.acct-avatar { width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.acct-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.acct-title, .acct-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-row.unread .acct-title { font-weight: 600; }
.acct-sub { font-size: 11px; color: var(--text-2); }
.acct-main .count { color: var(--brand); font-weight: 600; font-size: 12px; background: var(--selected); border-radius: 10px; padding: 0 7px; line-height: 18px; }
.acct-warn { width: 18px; height: 18px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.fp-list.sub { margin: 0 0 6px; }
.fp-list.sub .folder { padding-left: 34px; padding-top: 6px; padding-bottom: 6px; }
.acct-group .fp-error { padding-left: 34px; }
.color-field input[type=color] { width: 60px; height: 32px; padding: 2px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); cursor: pointer; }

/* ---------- conversations ---------- */
.thread-count { font-size: 11px; font-weight: 600; color: var(--text-2); border: 1px solid var(--border); border-radius: 9px; padding: 0 6px; line-height: 16px; }
.draft-tag { color: var(--danger); font-weight: 600; }
.icon-btn.toggle.on { color: var(--brand); background: var(--selected); }
.read.thread h1 { margin-bottom: 4px; }
.thread-meta { font-size: 13px; margin-bottom: 14px; display: flex; gap: 6px; align-items: center; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.card.open { box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.card .sender.clickable { cursor: pointer; }
.card:not(.open) .sender { align-items: center; }
.card:not(.open) .avatar { width: 32px; height: 32px; font-size: 13px; }
.recips.snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .body { margin-top: 12px; }
.card .quick-reply { margin-top: 12px; }

/* ---------- attachments & preview ---------- */
.att { padding: 0; gap: 0; overflow: hidden; }
.att-open { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 8px 6px 10px; cursor: pointer; color: var(--text); min-width: 0; }
.att-open .name { max-width: 170px; }
.att-dl { display: grid; place-items: center; padding: 0 8px; align-self: stretch; color: var(--text-2); border-left: 1px solid var(--border); }
.att-dl:hover, .att-open:hover { background: var(--hover); }
.c-atts .att { padding: 6px 10px; gap: 8px; }
.modal.wide { width: min(980px, 100%); }
.preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.preview-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-body { display: grid; place-items: center; background: var(--hover); border-radius: 6px; min-height: 300px; }
.preview-img { max-width: 100%; max-height: 75vh; display: block; }
.preview-frame { width: 100%; height: 75vh; border: 0; background: #fff; border-radius: 6px; }

/* ---------- compose extras ---------- */
.compose-actions .btn { padding: 6px 10px; }

/* ---------- settings ---------- */
.settings-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.settings-top h2 { margin: 0; }
.settings { display: grid; grid-template-columns: 170px 1fr; gap: 20px; min-height: 60vh; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); padding-right: 12px; }
.settings-nav button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 4px; cursor: pointer; color: var(--text); }
.settings-nav button:hover { background: var(--hover); }
.settings-nav button.on { background: var(--selected-strong); font-weight: 600; }
.settings-panel { min-width: 0; }
.settings-panel h3:first-child { margin-top: 0; }
.settings-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.settings-row h3 { margin: 0 !important; }
.small { font-size: 12px; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.modal .grid2.eq { grid-template-columns: 1fr 1fr; }
.acct-list.contacts { max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.acct-item > .ic { color: var(--brand); }
.acct-item .info small.error { display: block; margin: 2px 0 0; }

@media (max-width: 860px) {
  .hide-sm { display: none; }
  .settings { grid-template-columns: 1fr; min-height: 0; }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 8px; }
  .settings-nav button { white-space: nowrap; }
  .modal { padding: 16px; }
  .modal-bg { padding: 8px; }
  .preview-frame { height: 65vh; }
  .att-open .name { max-width: 120px; }
}

/* phone notch / home-bar safe areas when installed as an app */
.topbar { padding-top: env(safe-area-inset-top); height: calc(48px + env(safe-area-inset-top)); }
.pager { padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
a.btn { text-decoration: none; color: inherit; }
