/* ==========================================================================
   Snappy Mail — UI prototype
   Design tokens live on :root. Dark mode follows the OS unless the user
   picks Light or Dark explicitly (data-theme on <html>).
   ========================================================================== */

:root {
  color-scheme: light;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --folders-w: 252px;
  --list-w: 420px;
  --list-h: 46%;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eceff4;
  --elevated: #ffffff;
  --seg-on: #ffffff;
  --border: #e2e6ed;
  --border-strong: #cfd6e0;
  --text: #16191e;
  --text-2: #4b5563;
  --text-3: #7c8594;
  --hover: rgba(17, 24, 39, .055);
  --pressed: rgba(17, 24, 39, .1);
  --scroll: rgba(17, 24, 39, .2);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 28px -6px rgba(16, 24, 40, .18), 0 4px 10px -4px rgba(16, 24, 40, .08);
  --shadow-xl: 0 24px 48px -12px rgba(16, 24, 40, .28), 0 8px 16px -8px rgba(16, 24, 40, .1);
  --scrim: rgba(15, 18, 24, .36);
  --inverse: #1d2127;
  --on-inverse: #f3f4f6;
  --danger: #c4314b;
  --flag: #d13438;
  --warn: #b45309;
  --success: #0f7b3f;
  --tag-red: #d13438;
  --tag-orange: #c75d00;
  --tag-green: #107c10;
  --tag-blue: #0f6cbd;
  --tag-purple: #8764b8;
  --accent: var(--accent-l);
  --on-accent: #ffffff;
  --paper-bg: transparent;
  --paper-pad: 0px;

  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-softer: color-mix(in srgb, var(--accent) 6%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent) 86%, var(--text));
  --accent-tint: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

/* Accent palettes: -l is used in light mode, -d in dark mode */
/* Emerald is the Snappyhost brand colour and the default; "green" was the old name for it */
:root, :root[data-accent="emerald"], :root[data-accent="green"] { --accent-l: #0b7a4a; --accent-d: #57e0a8; }
:root[data-accent="blue"]     { --accent-l: #0f6cbd; --accent-d: #5caaf5; }
:root[data-accent="teal"]     { --accent-l: #0b7a75; --accent-d: #3cc8bf; }
:root[data-accent="violet"]   { --accent-l: #6d3fd1; --accent-d: #a98bf5; }
:root[data-accent="rose"]     { --accent-l: #c2185b; --accent-d: #f47ba8; }
:root[data-accent="amber"]    { --accent-l: #b45309; --accent-d: #f5a54a; }
:root[data-accent="graphite"] { --accent-l: #3f4a5a; --accent-d: #a3b1c2; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0e12;
    --surface: #15181d;
    --surface-2: #1b1f25;
    --surface-3: #23282f;
    --elevated: #1c2026;
    --seg-on: #343a44;
    --border: #252a32;
    --border-strong: #353c47;
    --text: #e8ebf0;
    --text-2: #a8b0bc;
    --text-3: #737d8b;
    --hover: rgba(255, 255, 255, .055);
    --pressed: rgba(255, 255, 255, .1);
    --scroll: rgba(255, 255, 255, .16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 28px -6px rgba(0, 0, 0, .55), 0 4px 10px -4px rgba(0, 0, 0, .4);
    --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, .7), 0 8px 16px -8px rgba(0, 0, 0, .4);
    --scrim: rgba(0, 0, 0, .55);
    --inverse: #e8ebf0;
    --on-inverse: #121418;
    --danger: #f1707b;
    --flag: #f1707b;
    --warn: #f0a44b;
    --success: #4cc38a;
    --tag-red: #f1707b;
    --tag-orange: #f5a35c;
    --tag-green: #5fd068;
    --tag-blue: #6cb4f7;
    --tag-purple: #b59ae6;
    --accent: var(--accent-d);
    --on-accent: #0b0d10;
  --paper-bg: #ffffff;
  --paper-pad: 18px;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0e12;
  --surface: #15181d;
  --surface-2: #1b1f25;
  --surface-3: #23282f;
  --elevated: #1c2026;
  --seg-on: #343a44;
  --border: #252a32;
  --border-strong: #353c47;
  --text: #e8ebf0;
  --text-2: #a8b0bc;
  --text-3: #737d8b;
  --hover: rgba(255, 255, 255, .055);
  --pressed: rgba(255, 255, 255, .1);
  --scroll: rgba(255, 255, 255, .16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 28px -6px rgba(0, 0, 0, .55), 0 4px 10px -4px rgba(0, 0, 0, .4);
  --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, .7), 0 8px 16px -8px rgba(0, 0, 0, .4);
  --scrim: rgba(0, 0, 0, .55);
  --inverse: #e8ebf0;
  --on-inverse: #121418;
  --danger: #f1707b;
  --flag: #f1707b;
  --warn: #f0a44b;
  --success: #4cc38a;
  --tag-red: #f1707b;
  --tag-orange: #f5a35c;
  --tag-green: #5fd068;
  --tag-blue: #6cb4f7;
  --tag-purple: #b59ae6;
  --accent: var(--accent-d);
  --on-accent: #0b0d10;
  --paper-bg: #ffffff;
  --paper-pad: 18px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
mark { background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }

.ic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-sm { width: 15px; height: 15px; }
.ic-xs { width: 13px; height: 13px; }
.ic.filled { fill: currentColor; }
.spin { animation: spin 1s linear infinite; }
.grow { flex: 1; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 8px;
  color: var(--text-2);
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { background: var(--pressed); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 7px; }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 6px; }
.icon-btn.xs .ic { width: 15px; height: 15px; }
.icon-btn.on { color: var(--accent); }
.icon-btn.flagged { color: var(--flag); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 500; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--border-strong) 70%, var(--text-3)); }
.btn .ic { color: var(--text-2); width: 16px; height: 16px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary .ic { color: inherit; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-block { width: 100%; }
.btn.chosen { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.link-btn { color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.link-btn:hover { background: var(--accent-soft); }

.split { display: inline-flex; flex: none; }
.split > :first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split > .caret {
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  padding: 0 7px; margin-left: 1px;
}

.cbox {
  width: 18px; height: 18px; border-radius: 5px; flex: none;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center;
  transition: background .1s, border-color .1s;
}
.cbox .ic { width: 12px; height: 12px; stroke-width: 3; color: var(--on-accent); opacity: 0; }
.cbox:hover { border-color: var(--accent); }
.cbox.on { background: var(--accent); border-color: var(--accent); }
.cbox.on .ic { opacity: 1; }

.avatar {
  --av: 36px;
  width: var(--av); height: var(--av); flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c); color: #fff;
  font-size: calc(var(--av) * .36); font-weight: 600; letter-spacing: .02em;
  user-select: none;
}
.avatar.me { color: var(--on-accent); }
.acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  /* The --sa-* safe areas keep clear of the notch or camera, the status bar and the home indicator (all 0 on a computer) */
  grid-template-rows: calc(52px + var(--sa-t)) minmax(0, 1fr) calc(28px + var(--sa-b));
  height: 100vh; height: 100dvh;
  padding: 0 var(--sa-r) 0 var(--sa-l);
}

.topbar { display: flex; align-items: center; gap: 12px; padding: var(--sa-t) 10px 0 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; font-weight: 650; font-size: 15.5px; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; box-shadow: 0 1px 3px rgba(4, 17, 11, .25); }
.search {
  flex: 1; max-width: 680px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 6px 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search > .ic { color: var(--text-3); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }
.scope-btn {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: 26px; padding: 0 6px 0 9px; border-radius: 6px;
  font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-3);
}
.scope-btn:hover { color: var(--text); }
.scope-btn .ic { width: 13px; height: 13px; }
kbd {
  font: 600 11px var(--font);
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 6px; background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border); border-bottom-width: 2px;
}
.top-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.me-btn { margin-left: 6px; border-radius: 50%; }
.me-btn .avatar { --av: 32px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent-soft); }

.workspace { display: grid; grid-template-columns: 60px minmax(0, 1fr); min-height: 0; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 0 8px; }
.rail-btn {
  position: relative; width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; color: var(--text-2);
  transition: background .12s, color .12s;
}
.rail-btn .ic { width: 21px; height: 21px; }
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent); }
.rail-btn.active::before {
  content: ""; position: absolute; left: -9px; top: 11px; bottom: 11px;
  width: 3px; border-radius: 3px; background: var(--accent);
}
.rail-btn .badge {
  position: absolute; top: 5px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.rail-spacer { flex: 1; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding-right: 10px; }

/* ---------- Ribbon ---------- */
.ribbon-tabs { display: flex; align-items: flex-end; gap: 2px; height: 34px; padding-left: 2px; flex: none; }
.rtab { position: relative; padding: 6px 12px 9px; font-weight: 500; color: var(--text-2); border-radius: 7px 7px 0 0; }
.rtab:hover { color: var(--text); }
.rtab.active { color: var(--text); font-weight: 600; }
.rtab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px;
  height: 3px; border-radius: 3px; background: var(--accent);
}
.ribbon {
  flex: none; display: flex; align-items: center;
  height: 48px; padding: 0 8px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-sm);
  container-type: inline-size;
  overflow: hidden;
}
.rb-panel { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; width: 100%; }
.rb-panel::-webkit-scrollbar { display: none; }
.rb {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 34px; padding: 0 9px; border-radius: 8px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.rb > .ic:first-child { color: var(--text-2); }
.rb .caret-ic { width: 13px; height: 13px; color: var(--text-3); margin-left: -2px; }
.rb:hover { background: var(--hover); }
.rb:active { background: var(--pressed); }
.rb.on { background: var(--accent-soft); color: var(--accent); }
.rb.on > .ic:first-child { color: var(--accent); }
.rb-primary { background: var(--accent); color: var(--on-accent); font-weight: 600; padding: 0 13px 0 11px; }
.rb-primary > .ic:first-child { color: inherit; }
.rb-primary:hover { background: var(--accent-hover); }
.rb-primary.caret { padding: 0 8px; }
.rb-primary.caret .ic { color: inherit; width: 14px; height: 14px; }
.rb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; flex: none; }
/* Labels collapse to icons in priority order as the ribbon narrows */
@container (max-width: 1480px) { .rb[data-collapse="1"] .rb-label { display: none; } }
@container (max-width: 1260px) { .rb[data-collapse="2"] .rb-label { display: none; } }
@container (max-width: 1030px) { .rb:not(.rb-primary) .rb-label { display: none; } }

/* ---------- Content panes ---------- */
.content { flex: 1; display: flex; gap: 10px; min-height: 0; min-width: 0; }

.folders {
  width: var(--folders-w); flex: none;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  padding: 0 2px 16px 0;
}
.folders > * { flex-shrink: 0; }
.app[data-folders="hidden"] .folders { display: none; }
.fsec-head {
  display: flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; margin-top: 2px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3);
}
.f-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  width: 100%; height: 34px; padding: 0 10px 0 calc(10px + var(--depth, 0) * 18px);
  border-radius: 8px; text-align: left; color: var(--text);
  transition: background .1s;
}
.f-item .ic { color: var(--text-2); }
.f-item:hover { background: var(--hover); }
.f-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.f-item.active .ic { color: var(--accent); }
.f-item.drop-target { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.f-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-count { font-size: 12px; font-weight: 650; color: var(--accent); font-variant-numeric: tabular-nums; }
.f-count.muted { color: var(--text-3); font-weight: 500; }

.acct { margin-top: 10px; }
.acct-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 4px; border-radius: 9px; cursor: pointer; user-select: none;
}
.acct-head:hover { background: var(--hover); }
.acct-head .chev { color: var(--text-3); transition: transform .15s var(--ease); }
.acct.collapsed .chev { transform: rotate(-90deg); }
.acct-badge {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 700; font-size: 13px;
}
.acct-badge .ic { width: 15px; height: 15px; }
.acct-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.acct-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-email { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proto {
  flex: none; font-size: 9.5px; font-weight: 750; letter-spacing: .05em;
  padding: 2px 5px; border-radius: 5px;
  background: var(--surface-3); color: var(--text-2);
}
.proto.pop { background: color-mix(in srgb, var(--tag-orange) 15%, transparent); color: var(--tag-orange); }
.proto.imap { background: color-mix(in srgb, var(--tag-blue) 13%, transparent); color: var(--tag-blue); }
.acct-more { opacity: 0; }
.acct-head:hover .acct-more, .acct-more[aria-expanded="true"] { opacity: 1; }
.acct-folders { padding-left: 4px; }
.acct.collapsed .acct-folders { display: none; }
.add-acct {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 16px 4px 0; height: 38px; border-radius: 9px;
  border: 1.5px dashed var(--border-strong); color: var(--text-2); font-weight: 500; font-size: 13px;
}
.add-acct:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-softer); }

.panes {
  flex: 1; min-width: 0; min-height: 0;
  display: grid;
  grid-template-columns: min(var(--list-w), 62%) 10px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "list rz reader";
}
.app[data-pane="bottom"] .panes {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: min(var(--list-h), 72%) 10px minmax(0, 1fr);
  grid-template-areas: "list" "rz" "reader";
}
.app[data-pane="off"] .panes {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "list";
}
.app[data-pane="off"] .resizer, .app[data-pane="off"] .reader { display: none; }
.app[data-pane="off"].reading .list { display: none; }
.app[data-pane="off"].reading .reader { display: flex; grid-area: list; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.list { grid-area: list; container-type: inline-size; }
.reader { grid-area: reader; }
.resizer { grid-area: rz; position: relative; cursor: col-resize; touch-action: none; }
.app[data-pane="bottom"] .resizer { cursor: row-resize; }
.resizer::after {
  content: ""; position: absolute; border-radius: 3px;
  left: 4px; right: 4px; top: calc(50% - 24px); height: 48px;
  background: transparent; transition: background .15s;
}
.app[data-pane="bottom"] .resizer::after { top: 4px; bottom: 4px; left: calc(50% - 24px); right: auto; width: 48px; height: auto; }
.resizer:hover::after, .resizer.dragging::after { background: var(--accent); }
body.resizing { user-select: none; cursor: col-resize; }
body.resizing.rows { cursor: row-resize; }

/* ---------- Message list ---------- */
.list-head { flex: none; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.lh-row { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.lh-row.bulk { gap: 10px; }
.lh-row.bulk .cbox { margin-left: 2px; }
.lh-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.lh-title h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.pills { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  border: 1px solid var(--border);
  transition: background .12s, color .12s, border-color .12s;
}
.pill:hover { background: var(--hover); color: var(--text); }
.pill.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pill .n { font-size: 11px; font-weight: 700; opacity: .85; }

.list-scroll > .empty { min-height: 100%; }
.list-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 0 14px; outline: 0; }

.group-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 12px 18px 6px; text-align: left;
  background: var(--surface);
  font-size: 12px; font-weight: 650; color: var(--text-2);
}
.group-head .chev { width: 14px; height: 14px; color: var(--text-3); transition: transform .15s var(--ease); }
.group-head.collapsed .chev { transform: rotate(-90deg); }
.group-head .gcount { color: var(--text-3); font-weight: 500; }

/* Card style */
.msg {
  --pad-y: 12px; --av: 38px;
  position: relative; display: flex; gap: 12px;
  margin: 1px 6px; padding: var(--pad-y) 12px var(--pad-y) 14px;
  border-radius: 10px; cursor: default; user-select: none;
  transition: background .1s;
}
.msg:hover { background: var(--hover); }
.msg.flagged { background: color-mix(in srgb, var(--flag) 6%, transparent); }
.msg.flagged:hover { background: color-mix(in srgb, var(--flag) 9%, transparent); }
.msg.selected, .msg.checked { background: var(--accent-soft); }
.msg.selected:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.msg.unread::before {
  content: ""; position: absolute; left: 4px; top: 13px; bottom: 13px;
  width: 3px; border-radius: 3px; background: var(--accent);
}
.msg.fresh { animation: fresh .8s var(--ease); }

.m-lead { position: relative; width: var(--av); height: var(--av); flex: none; }
.m-lead .avatar { --av: inherit; width: 100%; height: 100%; font-size: calc(var(--av) * .36); transition: opacity .1s; }
.m-check {
  position: absolute; inset: 0; display: grid; place-items: center;
  opacity: 0; transition: opacity .1s;
}
.msg:hover .m-check, .msg.checked .m-check, .list.selecting .m-check { opacity: 1; }
.msg:hover .avatar, .msg.checked .avatar, .list.selecting .avatar { opacity: 0; }

.m-main {
  flex: 1; min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "from meta" "subject subject" "preview preview" "children children";
  column-gap: 8px; row-gap: 1px;
}
.m-from { grid-area: from; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; }
.m-from .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.draft-tag { color: var(--danger); font-weight: 600; font-size: 12px; flex: none; }
.m-meta { grid-area: meta; display: flex; align-items: center; gap: 6px; height: 21px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.m-icons { display: inline-flex; align-items: center; gap: 4px; }
.m-icons .ic { width: 14px; height: 14px; }
.flag-on { color: var(--flag); fill: var(--flag); }
.pin-on { color: var(--accent); }
.m-meta time { font-variant-numeric: tabular-nums; }
.m-quick { display: none; align-items: center; gap: 1px; margin-right: -4px; }
.m-quick button {
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-2);
}
.m-quick button:hover { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.m-quick .ic { width: 16px; height: 16px; }
.m-quick button.on { color: var(--accent); }
.m-quick button.on.flag { color: var(--flag); }
.m-quick button.on .ic { fill: currentColor; }
.msg:hover .m-quick { display: flex; }
.msg:hover .m-icons, .msg:hover .m-meta time { display: none; }
.thread-toggle {
  display: inline-flex; align-items: center; gap: 1px;
  height: 20px; padding: 0 6px 0 3px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 11.5px; font-weight: 650;
}
.thread-toggle:hover { color: var(--text); background: var(--pressed); }
.thread-toggle .ic { width: 14px; height: 14px; transition: transform .15s var(--ease); }
.msg.expanded .thread-toggle .ic { transform: rotate(180deg); }

.m-subject { grid-area: subject; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; }
.m-subject .subj { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-subject .snip { display: none; }
.m-preview {
  grid-area: preview; font-size: 13px; line-height: 1.42; color: var(--text-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.msg.unread .m-from .name { font-weight: 650; }
.msg.unread .subj { font-weight: 600; color: var(--accent); }
.msg.unread .m-meta time { color: var(--accent); font-weight: 600; }

.m-children {
  grid-area: children; display: flex; flex-direction: column;
  margin: 8px 0 -4px; border-left: 2px solid var(--border-strong);
}
.m-child {
  display: grid; grid-template-columns: minmax(70px, auto) minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 6px 8px 6px 12px; border-radius: 0 8px 8px 0; font-size: 12.5px;
}
.m-child:hover { background: var(--hover); }
.m-child.selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); margin-left: -2px; padding-left: 14px; }
.m-child .c-from { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.m-child.unread .c-from { color: var(--accent); }
.m-child .c-snip { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-child time { color: var(--text-3); font-size: 11.5px; }
.m-child .loc { font-size: 11px; color: var(--text-3); background: var(--surface-3); padding: 0 6px; border-radius: 4px; margin-left: 4px; font-weight: 500; }

/* Density */
.app[data-density="cozy"] .msg { --pad-y: 8px; --av: 30px; gap: 10px; }
.app[data-density="cozy"] .m-preview { -webkit-line-clamp: 1; }
.app[data-density="cozy"] .msg.unread::before { top: 9px; bottom: 9px; }
.app[data-density="compact"] .msg { --pad-y: 5px; --av: 24px; gap: 10px; align-items: center; margin: 0 6px; }
.app[data-density="compact"] .m-main {
  grid-template-columns: minmax(110px, 26%) minmax(0, 1fr) auto;
  grid-template-areas: "from subject meta" "children children children";
  align-items: center; column-gap: 12px;
}
.app[data-density="compact"] .m-from { font-size: 13.5px; }
.app[data-density="compact"] .m-preview { display: none; }
.app[data-density="compact"] .m-subject .snip {
  display: block; flex: 1 1 0; min-width: 0; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app[data-density="compact"] .m-subject .snip::before { content: "—"; margin-right: 6px; }
.app[data-density="compact"] .msg.unread::before { top: 7px; bottom: 7px; }
.app[data-density="compact"] .m-lead .avatar { font-size: 9.5px; }
.app[data-avatars="off"] .m-lead { width: 18px; }
.app[data-avatars="off"] .m-lead .avatar { display: none; }
.app[data-preview="off"] .m-preview,
.app[data-preview="off"] .m-subject .snip { display: none !important; }

/* Table style */
.tbl {
  --tcols: 40px 22px 28px 26px minmax(0, 1fr) minmax(130px, 24%) 136px 72px;
  --row-h: 38px;
  min-width: 0;
}
.app[data-density="cozy"] .tbl { --row-h: 33px; }
.app[data-density="compact"] .tbl { --row-h: 28px; }
.tbl-head, .trow { display: grid; grid-template-columns: var(--tcols); align-items: center; }
.tbl-head {
  position: sticky; top: 0; z-index: 2; height: 34px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.th { display: flex; align-items: center; gap: 4px; height: 100%; padding: 0 8px; text-align: left; white-space: nowrap; min-width: 0; }
button.th:hover { background: var(--hover); color: var(--text); }
.th .ic-xs { color: var(--text-3); }
.th.c-sel, .trow .c-sel { justify-content: center; padding: 0 0 0 6px; }
.th.c-date, .th.c-size { justify-content: flex-end; }
.trow {
  position: relative; height: var(--row-h); font-size: 13px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  user-select: none; cursor: default;
}
.trow > span { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 8px; height: 100%; overflow: hidden; white-space: nowrap; }
.trow:hover { background: var(--hover); }
.trow.flagged { background: color-mix(in srgb, var(--flag) 6%, transparent); }
.trow.selected, .trow.checked { background: var(--accent-soft); }
.trow.selected { box-shadow: inset 3px 0 0 var(--accent); }
.trow.unread { font-weight: 600; }
.trow.unread .t-subj { color: var(--accent); }
.trow .c-thr, .trow .c-flag, .trow .c-att { justify-content: center; padding: 0; }
.trow .c-att .ic { width: 14px; height: 14px; color: var(--text-3); }
.trow .c-date, .trow .c-size { justify-content: flex-end; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.trow .c-from .ell { overflow: hidden; text-overflow: ellipsis; }
.t-subj { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; min-width: 5em; }
.trow .tag { height: 18px; font-size: 10.5px; }
.d-short { display: none; }
.sub-from { display: none; color: var(--text-2); flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.udot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.cnt { flex: none; font-size: 11px; font-weight: 650; color: var(--text-2); background: var(--surface-3); border-radius: 999px; padding: 0 6px; height: 18px; display: inline-grid; place-items: center; }
.twisty { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; color: var(--text-3); }
.twisty:hover { background: var(--pressed); color: var(--text); }
.twisty .ic { width: 14px; height: 14px; transition: transform .15s var(--ease); }
.twisty.open .ic { transform: rotate(90deg); }
.flag-btn { width: 24px; height: 24px; border-radius: 5px; display: grid; place-items: center; color: var(--text-3); opacity: 0; }
.flag-btn .ic { width: 15px; height: 15px; }
.trow:hover .flag-btn, .flag-btn.on { opacity: 1; }
.flag-btn.on { color: var(--flag); }
.flag-btn.on .ic { fill: currentColor; }
.flag-btn:hover { background: var(--pressed); }
.trow .cbox { opacity: .55; }
.trow:hover .cbox, .trow .cbox.on, .list.selecting .trow .cbox { opacity: 1; }
.trow.child { font-weight: 400; color: var(--text-2); }
.trow.child .c-subj { padding-left: 26px; }
.trow.child .c-subj::before { content: ""; width: 10px; height: 10px; border-left: 1.5px solid var(--border-strong); border-bottom: 1.5px solid var(--border-strong); border-bottom-left-radius: 4px; margin: -8px 2px 0 -14px; flex: none; }
.trow.child.unread { font-weight: 600; color: var(--text); }
@container (max-width: 720px) {
  .tbl { --tcols: 40px 22px 28px 26px minmax(0, 1fr) minmax(110px, 28%) 128px; }
  .tbl .c-size { display: none !important; }
}
@container (max-width: 540px) {
  .tbl { --tcols: 36px 22px 28px 24px minmax(0, 1fr) 92px; }
  .tbl .c-from { display: none !important; }
  .tbl .sub-from { display: inline; }
  .tbl .c-subj .tag { display: none; }
  .tbl .d-long { display: none; }
  .tbl .d-short { display: inline; }
}

/* Empty states */
.empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 32px 24px; color: var(--text-2); }
.empty-inner { max-width: 300px; }
.empty h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 650; color: var(--text); }
.empty p { margin: 0; font-size: 13px; line-height: 1.5; }
.empty .btn { margin-top: 14px; }
.empty-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.empty-icon .ic { width: 26px; height: 26px; }
.empty-art { width: 168px; height: 128px; margin: 0 auto 12px; display: block; }
.ea-back { fill: var(--accent-tint); }
.ea-paper { fill: var(--surface); stroke: var(--border-strong); }
.ea-line { fill: var(--border-strong); }
.ea-line.accent { fill: var(--accent); }
.ea-front { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.ea-flap { fill: none; stroke: color-mix(in srgb, var(--accent) 45%, var(--surface)); stroke-width: 2; stroke-linejoin: round; }
.ea-spark { fill: var(--accent); opacity: .5; }
.tip { margin-top: 18px !important; font-size: 12px !important; color: var(--text-3); }

/* ---------- Reading pane ---------- */
.reader-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.r-head { display: flex; align-items: flex-start; gap: 10px; padding: 20px 20px 14px 24px; }
.r-back { display: none !important; margin: -3px 0 0 -8px; }
.app[data-pane="off"] .r-back { display: inline-grid !important; }
.r-titles { flex: 1; min-width: 0; }
.r-subject { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; overflow-wrap: anywhere; }
.r-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.loc-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 12px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
}
.r-tools { display: flex; gap: 2px; flex: none; margin-top: -2px; }
.thread { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 8px; }
.rm { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.thread.single .rm { border-color: transparent; }
.rm.expanded { padding: 16px 20px 20px; }
.thread.single .rm.expanded { padding-top: 6px; }
.rm.collapsed {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer;
  transition: background .1s;
}
.rm.collapsed:hover { background: var(--surface-2); }
.rm.collapsed .avatar { --av: 30px; }
.rm-c-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.rm-c-from { font-weight: 600; font-size: 13.5px; white-space: nowrap; flex: none; display: flex; gap: 6px; }
.rm-c-snip { color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rm-c-side { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.rm-c-side .ic { width: 14px; height: 14px; }
.rm.unread-msg .rm-c-from { color: var(--accent); }
.rm-head { display: flex; align-items: flex-start; gap: 12px; }
.rm-head[data-ract] { cursor: pointer; }
.rm-head .avatar { --av: 42px; }
.rm-who { flex: 1; min-width: 0; padding-top: 1px; }
.rm-from { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 7px; font-size: 14.5px; }
.rm-from strong { font-weight: 650; }
.rm-addr { color: var(--text-3); font-size: 12.5px; overflow-wrap: anywhere; }
.rm-to { margin-top: 2px; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-to b { font-weight: 500; color: var(--text-3); }
.rm-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.rm-actions { display: flex; gap: 0; margin-top: -4px; margin-right: -6px; }
.rm-date { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding: 9px 10px 9px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.4;
  --b: var(--warn);
  background: color-mix(in srgb, var(--b) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--b) 24%, transparent);
}
.banner > .ic { color: var(--b); }
.banner .grow { min-width: 180px; }
.banner.danger { --b: var(--danger); }
.banner.info { --b: var(--accent); }
.banner.neutral { --b: var(--text-3); }
.banner .link-btn { color: var(--b); }
.banner.neutral .link-btn, .banner.info .link-btn { color: var(--accent); }

.invite {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.inv-cal { width: 54px; flex: none; text-align: center; border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.inv-cal .mon { display: block; padding: 3px 0; background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 750; letter-spacing: .08em; }
.inv-cal .day { display: block; padding: 3px 0 5px; font-size: 21px; font-weight: 700; }
.inv-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2); }
.inv-info strong { color: var(--text); font-size: 14.5px; font-weight: 650; }
.inv-info span { display: flex; align-items: center; gap: 6px; }
.inv-info .ic { width: 14px; height: 14px; color: var(--text-3); }
.inv-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inv-actions .btn { height: 32px; font-size: 13px; padding: 0 12px; }

.mail-body { margin-top: 18px; max-width: 760px; font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.mail-body p { margin: 0 0 12px; }
.mail-body ul, .mail-body ol { margin: 0 0 12px; padding-left: 22px; }
.mail-body li { margin-bottom: 4px; }
.mail-body li::marker { color: var(--text-3); }
.mail-body h3 { font-size: 15px; margin: 20px 0 6px; }
.mail-body blockquote { margin: 12px 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.mail-body .sig { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 13px; line-height: 1.5; }
.mail-body .muted { color: var(--text-3); font-size: 12.5px; }
.mail-body .cta {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; font-size: 13.5px;
}
.gh-card { margin: 12px 0 16px; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.gh-card p { margin: 0 0 10px; color: var(--text-2); font-size: 13.5px; }
.gh-title { font-weight: 650; font-size: 15px; margin-bottom: 4px; }
.gh-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.gh-stats .add { color: var(--success); font-weight: 650; }
.gh-stats .del { color: var(--danger); font-weight: 650; }
.trip { margin: 14px 0 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.trip-leg { display: flex; align-items: center; gap: 18px; padding: 18px 20px; background: linear-gradient(135deg, var(--accent-soft), transparent 70%); }
.trip .code { font-size: 28px; font-weight: 750; letter-spacing: .01em; line-height: 1.1; }
.trip .city { font-size: 12.5px; color: var(--text-2); }
.trip-leg .r { text-align: right; }
.trip-line { flex: 1; position: relative; height: 2px; background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 11px); }
.trip-line .ic { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(45deg); padding: 4px; width: 28px; height: 28px; border-radius: 50%; color: var(--accent); background: var(--surface); }
.trip-meta { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); }
.trip-meta span { padding: 10px 14px; font-weight: 650; font-size: 14px; }
.trip-meta span + span { border-left: 1px solid var(--border); }
.trip-meta small { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.nl-h { font-size: 21px; line-height: 1.3; letter-spacing: -.015em; margin: 0 0 8px; }
.remote-blocked .remote {
  position: relative;
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 10px, var(--surface-3) 10px 20px) !important;
  border: 1px dashed var(--border-strong);
}
.remote-blocked .remote > * { visibility: hidden; }
.remote-blocked .remote::after {
  content: "Remote image blocked"; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--text-3);
}

.atts { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.atts-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12.5px; color: var(--text-2); }
.atts-head .ic { width: 15px; height: 15px; color: var(--text-3); }
.atts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.att {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 6px 8px 8px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.att:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.att-ic {
  position: relative; width: 34px; height: 40px; flex: none; border-radius: 5px;
  display: grid; place-items: end center; padding-bottom: 5px;
  background: var(--c); color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .04em;
  clip-path: polygon(0 0, 70% 0, 100% 22%, 100% 100%, 0 100%);
}
.att-ic::after { content: ""; position: absolute; top: 0; right: 0; width: 30%; height: 22%; background: rgba(255, 255, 255, .35); clip-path: polygon(0 0, 0 100%, 100% 100%); }
.att-thumb { width: 40px; height: 40px; flex: none; border-radius: 7px; background: var(--g); }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { font-size: 11.5px; color: var(--text-3); }
.att .icon-btn { opacity: 0; }
.att:hover .icon-btn { opacity: 1; }

.reply-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 36px 30px; }
.reply-bar .btn { border-radius: 999px; height: 34px; }

.multi { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; }
.multi-stack { position: relative; width: 92px; height: 84px; margin: 0 auto 18px; }
.multi-stack i { position: absolute; inset: 0; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow); }
.multi-stack i:nth-child(1) { transform: rotate(-8deg) translate(-6px, 4px); }
.multi-stack i:nth-child(2) { transform: rotate(5deg) translate(6px, 2px); }
.multi-stack i:nth-child(3) { display: grid; place-items: center; font-size: 26px; font-weight: 750; color: var(--accent); background: var(--accent-tint); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.multi h3 { margin: 0 0 4px; font-size: 16px; }
.multi p { margin: 0 0 16px; color: var(--text-2); font-size: 13px; }
.multi-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---------- Status bar ---------- */
.statusbar { display: flex; align-items: center; gap: 18px; padding: 0 16px var(--sa-b) 18px; font-size: 12px; color: var(--text-3); min-width: 0; white-space: nowrap; }
.sb-item { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sb-item .ic { width: 13px; height: 13px; }
.sb-item b { color: var(--text-2); font-weight: 600; }
.sb-grow { flex: 1; }
.sb-ok .ic { color: var(--success); }
.sb-btn { display: flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; }
.sb-btn:hover { background: var(--hover); color: var(--text); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.dot.off { background: var(--text-3); box-shadow: none; }

/* ---------- Menus / popovers ---------- */
/* Above dialogs (.scrim), which open menus of their own */
.menu {
  position: fixed; z-index: 270; min-width: 220px; max-width: 340px; max-height: min(70vh, 520px); overflow-y: auto;
  padding: 5px; border-radius: 11px;
  background: var(--elevated); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: pop .12s var(--ease);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 33px; padding: 0 10px; border-radius: 7px; text-align: left; font-size: 13.5px;
}
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--hover); outline: 0; }
.menu-item > .ic { color: var(--text-2); width: 16px; height: 16px; }
.mi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-hint { font-size: 11.5px; color: var(--text-3); }
.menu-item .mi-check { color: var(--accent); width: 15px; height: 15px; stroke-width: 2.5; }
.menu-item.danger, .menu-item.danger > .ic { color: var(--danger); }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--border); }
.menu-head { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.menu .swatch { width: 16px; height: 16px; display: grid; place-items: center; flex: none; }
.menu .swatch::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

.toast {
  position: fixed; left: 50%; bottom: calc(44px + var(--sa-b)); z-index: 300;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 9px 9px 9px 16px; border-radius: 11px;
  background: var(--inverse); color: var(--on-inverse); font-size: 13.5px; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .22s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { padding: 5px 10px; border-radius: 7px; font-weight: 650; color: color-mix(in srgb, var(--accent) 55%, var(--on-inverse)); }
.toast button:hover { background: color-mix(in srgb, var(--on-inverse) 12%, transparent); }
.toast:not(:has(button)) { padding-right: 16px; }

.drag-ghost {
  position: fixed; top: -200px; left: -200px; max-width: 260px;
  padding: 7px 12px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Settings drawer ---------- */
.drawer {
  position: fixed; z-index: 150; top: calc(56px + var(--sa-t)); right: calc(10px + var(--sa-r)); bottom: calc(36px + var(--sa-b));
  width: 372px; max-width: calc(100vw - 20px);
  display: flex; flex-direction: column;
  background: var(--elevated); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-xl);
  transform: translateX(calc(100% + 24px)); visibility: hidden;
  transition: transform .26s var(--ease), visibility 0s .26s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .26s var(--ease), visibility 0s; }
.dr-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 6px 20px; }
.dr-head h2 { flex: 1; margin: 0; font-size: 16.5px; font-weight: 650; }
.dr-body { flex: 1; overflow-y: auto; padding: 0 20px 18px; }
.set-group { padding: 14px 0 16px; border-bottom: 1px solid var(--border); }
.set-group:last-of-type { border-bottom: 0; }
.set-title { margin: 0 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.set-title.mt { margin-top: 16px; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.seg button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: background .12s, color .12s;
}
.seg button .ic { width: 15px; height: 15px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--seg-on); color: var(--text); box-shadow: var(--shadow); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch-btn {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.swatch-btn .ic { width: 15px; height: 15px; stroke-width: 3; opacity: 0; }
.swatch-btn.active { outline: 2px solid var(--c); outline-offset: 3px; }
.swatch-btn.active .ic { opacity: 1; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiles.two { grid-template-columns: repeat(2, 1fr); }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 7px 7px 8px; border-radius: 11px; border: 1.5px solid var(--border);
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: border-color .12s, background .12s;
}
.tile:hover { border-color: var(--border-strong); color: var(--text); }
.tile.active { border-color: var(--accent); background: var(--accent-softer); color: var(--text); }
.mini { width: 100%; aspect-ratio: 16 / 10; display: grid; gap: 3px; padding: 4px; border-radius: 7px; background: var(--bg); }
.mini i { display: block; border-radius: 3px; background: var(--surface); border: 1px solid var(--border); min-height: 0; }
.mini i.f { background: var(--surface-3); border: 0; }
.mini i.l { background-image: repeating-linear-gradient(to bottom, transparent 0 5px, var(--border) 5px 6px); }
.mini i.r { background-image: linear-gradient(var(--accent), var(--accent)), linear-gradient(var(--border-strong), var(--border-strong)), linear-gradient(var(--border-strong), var(--border-strong)); background-size: 50% 3px, 70% 2px, 60% 2px; background-position: 4px 4px, 4px 11px, 4px 16px; background-repeat: no-repeat; }
.tile.active .mini i.l, .tile.active .mini i.r { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.mini-right { grid-template-columns: 1fr 2fr 3fr; }
.mini-bottom { grid-template-columns: 1fr 5fr; grid-template-rows: 1fr 1fr; }
.mini-bottom .f { grid-row: span 2; }
.mini-off { grid-template-columns: 1fr 5fr; }
.mini-rows { grid-auto-rows: 1fr; padding: 5px; gap: 3px; }
.mini-rows i { position: relative; background-image: linear-gradient(var(--border-strong), var(--border-strong)); background-size: 55% 2px; background-position: 14px 50%; background-repeat: no-repeat; }
.mini-rows i::before { content: ""; position: absolute; left: 3px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.mini-rows.dense i::before { width: 5px; height: 5px; margin-top: -2.5px; }
.mini-table { padding: 0; gap: 0; overflow: hidden; border: 1px solid var(--border); background: var(--surface); grid-auto-rows: 1fr; }
.mini-table i { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); background-image: linear-gradient(90deg, transparent 22%, var(--border) 22% calc(22% + 1px), transparent calc(22% + 1px) 68%, var(--border) 68% calc(68% + 1px), transparent calc(68% + 1px)); }
.mini-table i:first-child { background-color: var(--surface-3); }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.toggle-row .tl { flex: 1; font-size: 13.5px; font-weight: 500; }
.toggle-row small { display: block; color: var(--text-3); font-size: 12px; font-weight: 400; }
.switch { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .18s var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.dr-acct { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.dr-acct .acct-meta { line-height: 1.3; }
.dr-foot { padding-top: 12px; text-align: center; }

/* ---------- Compose ---------- */
.compose {
  position: fixed; z-index: 120; right: calc(24px + var(--sa-r)); bottom: calc(38px + var(--sa-b));
  width: min(640px, calc(100vw - 32px)); height: min(660px, calc(100dvh - 110px - var(--sa-t) - var(--sa-b)));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--elevated); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-xl);
  transform-origin: bottom right; animation: pop .2s var(--ease);
}
.compose.min { height: 50px; width: 340px; }
.compose.min > :not(.c-titlebar) { display: none !important; }
.compose.max { inset: calc(4vh + var(--sa-t)) calc(max(16px, 8vw) + var(--sa-r)) calc(4vh + var(--sa-b)) calc(max(16px, 8vw) + var(--sa-l)); width: auto; height: auto; transform-origin: center; }
.c-titlebar { display: flex; align-items: center; gap: 4px; height: 50px; padding: 0 8px 0 18px; flex: none; border-bottom: 1px solid var(--border); }
.compose.min .c-titlebar { border-bottom: 0; cursor: pointer; }
.c-title { flex: 1; min-width: 0; font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-fields { flex: none; }
.c-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 12px 4px 18px; border-bottom: 1px solid var(--border); }
.c-label { width: 54px; flex: none; font-size: 13px; color: var(--text-3); }
.c-row > input, .c-row > select { flex: 1; min-width: 0; height: 34px; border: 0; outline: 0; background: transparent; }
.c-row > select { cursor: pointer; font-weight: 500; }
.c-row > select option { background: var(--elevated); color: var(--text); }
.c-subject-input { font-size: 15px; font-weight: 600; }
.c-smtp { display: flex; align-items: center; gap: 5px; flex: none; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.c-smtp .ic { width: 12px; height: 12px; color: var(--success); }
.chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 4px 0; cursor: text; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 3px 0 3px; border-radius: 999px;
  background: var(--surface-3); font-size: 13px; max-width: 100%;
}
.chip .avatar { --av: 22px; font-size: 9px; }
.chip > span:not(.avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); }
.chip button:hover { background: var(--pressed); color: var(--text); }
.chip button .ic { width: 12px; height: 12px; stroke-width: 2.25; }
.chip.invalid { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 40%, transparent); }
.chips input { flex: 1; min-width: 140px; height: 28px; border: 0; outline: 0; background: transparent; }
.suggest {
  position: absolute; z-index: 5; left: 72px; top: calc(100% - 2px); width: min(380px, calc(100% - 90px));
  padding: 5px; border-radius: 11px; background: var(--elevated); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.sug { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 8px; text-align: left; }
.sug .avatar { --av: 30px; }
.sug.active, .sug:hover { background: var(--hover); }
.sug b { display: block; font-weight: 600; font-size: 13px; }
.sug small { display: block; font-size: 12px; color: var(--text-3); }
.c-toolbar { display: flex; align-items: center; gap: 1px; flex: none; padding: 6px 10px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.c-toolbar .icon-btn { width: 30px; height: 30px; }
.c-toolbar .icon-btn .ic { width: 17px; height: 17px; }
.c-toolbar .sep { width: 1px; height: 18px; margin: 0 5px; background: var(--border); flex: none; }
.c-editor { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; outline: 0; font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.c-editor p { margin: 0 0 10px; }
.c-editor blockquote { margin: 8px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.c-editor .quote-head { margin-top: 18px; font-size: 13px; color: var(--text-3); }
.c-editor .c-sig { color: var(--text-2); font-size: 13.5px; }
.c-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; flex: none; }
.cm-att { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 4px 0 10px; border-radius: 9px; border: 1px solid var(--border); font-size: 12.5px; }
.cm-att .ic { width: 14px; height: 14px; color: var(--text-3); }
.cm-att small { color: var(--text-3); }
.c-footer { display: flex; align-items: center; gap: 6px; flex: none; padding: 10px 12px 12px 14px; border-top: 1px solid var(--border); }
.c-footer .split .btn-primary:first-child { padding: 0 16px 0 14px; }
.c-footer .split .caret { padding: 0 8px; }
.c-status { flex: 1; min-width: 0; font-size: 12px; color: var(--text-3); padding-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose.shake { animation: shake .35s; }

/* ---------- Dialogs ---------- */
.scrim { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: calc(16px + var(--sa-t)) calc(16px + var(--sa-r)) calc(16px + var(--sa-b)) calc(16px + var(--sa-l)); background: var(--scrim); animation: fade .15s; }
.dialog {
  width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  background: var(--elevated); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-xl);
  animation: pop .2s var(--ease);
}
.dialog.wide { width: min(780px, 100%); }
.dialog.narrow { width: min(420px, 100%); }
.d-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 18px 6px 22px; }
.d-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.d-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.d-head > div { flex: 1; min-width: 0; }
.d-icon { flex: none !important; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.d-icon .ic { width: 21px; height: 21px; }
.d-body { padding: 16px 22px 8px; }
.d-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px 22px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field small { font-size: 12px; color: var(--text-3); }
.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); outline: 0;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { padding-right: 8px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 42px; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 4px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; padding: 3px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.check input[type="number"] { width: 64px; height: 28px; padding: 0 8px; accent-color: auto; }
.detect-list { display: flex; flex-direction: column; gap: 4px; padding: 6px 0 12px; }
.detect-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 13.5px; color: var(--text-3); }
.detect-row.done { color: var(--text); }
.detect-row.active { color: var(--text); font-weight: 500; }
.detect-row .ic { width: 18px; height: 18px; color: var(--success); stroke-width: 2.5; }
.detect-row .pending { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); }
.spinner { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.found {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--success) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
  font-size: 13px;
}
.found .ic { color: var(--success); }
.proto-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.proto-card {
  display: flex; flex-direction: column; gap: 4px; padding: 13px 14px; text-align: left;
  border-radius: 12px; border: 1.5px solid var(--border); font-size: 12.5px; color: var(--text-2); line-height: 1.45;
}
.proto-card:hover { border-color: var(--border-strong); }
.proto-card.active { border-color: var(--accent); background: var(--accent-softer); }
.proto-card .pc-top { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 650; }
.proto-card .pc-top .ic { color: var(--accent); }
.rec { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.srv { padding: 14px 14px 4px; margin-bottom: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.srv-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 650; font-size: 13.5px; }
.srv-title .ic { color: var(--text-2); width: 16px; height: 16px; }
.srv-grid { display: grid; grid-template-columns: 1fr 96px; gap: 0 10px; }
.srv-grid.even { grid-template-columns: 1fr 1fr; }
.srv-grid .field { margin-bottom: 12px; }
.srv-opts { display: flex; flex-direction: column; gap: 4px; padding: 0 0 12px; }
.test-result { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); min-height: 22px; }
.test-result.ok { color: var(--success); }
.test-result .ic { width: 17px; height: 17px; }
pre.source {
  margin: 0; padding: 14px 16px; max-height: 62vh; overflow: auto;
  font: 12px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
pre.source .h { color: var(--accent); }
.kbd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.kbd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.kbd-row span:last-child { display: flex; gap: 4px; }

.folders-scrim { display: none; }

/* ---------- Live mail additions ---------- */
.mail-paper { margin-top: 18px; padding: var(--paper-pad); border-radius: 10px; background: var(--paper-bg); }
.mail-frame { display: block; width: 100%; min-height: 40px; border: 0; background: transparent; color-scheme: light; }
.mail-text { white-space: pre-wrap; }
.mail-text blockquote { white-space: pre-wrap; }
.mail-text .muted { color: var(--text-3); }
.body-loading { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; max-width: 640px; }
.body-loading i, .sk-lines i, .sk-av {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
}
.body-loading i { height: 12px; }
.body-loading i:nth-child(1) { width: 72%; }
.body-loading i:nth-child(2) { width: 94%; }
.body-loading i:nth-child(3) { width: 86%; }
.body-loading i:nth-child(4) { width: 42%; }
.body-error {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding: 12px 14px;
  border-radius: 10px; font-size: 13px; color: var(--text-2);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
}
.body-error .ic { color: var(--danger); }
.msg.skeleton { pointer-events: none; }
.msg.skeleton:hover { background: none; }
.sk-av { width: var(--av); height: var(--av); border-radius: 50%; flex: none; }
.app[data-avatars="off"] .sk-av { display: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }
.sk-lines i { height: 10px; }
.sk-lines i:nth-child(1) { width: 38%; }
.sk-lines i:nth-child(2) { width: 72%; }
.sk-lines i:nth-child(3) { width: 90%; }
.app[data-density="compact"] .sk-lines i:nth-child(n + 2) { display: none; }
.list-more { display: flex; justify-content: center; padding: 14px 0 6px; }
.folders-empty { margin: 4px 12px 10px 14px; font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.acct-badge { position: relative; }
.acct-status {
  position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--bg); background: var(--text-3);
}
.acct-status.connected { background: var(--success); }
.acct-status.connecting, .acct-status.reconnecting { background: var(--warn); }
.acct-status.error { background: var(--danger); }
.dr-acct .acct-status { display: none; }
.acct-badge.lg { width: 42px; height: 42px; border-radius: 12px; font-size: 17px; flex: none; }
.empty-icon.brandish { display: block; background: none; box-shadow: 0 10px 24px -10px rgba(4, 17, 11, .55); }
.empty-icon.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.welcome .empty-inner { max-width: 340px; }
.found.warn { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.found.warn .ic { color: var(--warn); }
.wiz-note {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 10px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.5; background: var(--accent-softer); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.wiz-note .ic { color: var(--accent); margin-top: 1px; }
.test-results { display: flex; flex-direction: column; gap: 6px; }
.test-result { align-items: flex-start; }
.test-result .ic, .test-result .spinner { margin-top: 1px; }
.test-result.err { color: var(--danger); }
.test-result.err span { color: var(--text-2); }
.test-result strong { color: var(--text); font-weight: 600; }
.rec.muted { background: var(--surface-3); color: var(--text-3); }
.proto-card:disabled { opacity: .55; cursor: not-allowed; }
.swatches.sm { gap: 8px; padding-top: 6px; }
.swatches.sm .swatch-btn { width: 24px; height: 24px; }
.swatches.sm .swatch-btn .ic { width: 12px; height: 12px; }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent); }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; font: inherit; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 86%, #000); border-color: transparent; }
.danger-text, .danger-text .ic { color: var(--danger) !important; }
.d-icon.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.spinner.on-accent { width: 15px; height: 15px; border-color: color-mix(in srgb, var(--on-accent) 35%, transparent); border-top-color: var(--on-accent); }
.toast .ic { width: 17px; height: 17px; flex: none; }
.toast span { max-width: 62ch; }
.toast.error { background: #a4262c; color: #fff; }
.toast.error button { color: #fff; }
.compose.dropping { box-shadow: 0 0 0 3px var(--accent), var(--shadow-xl); }
.link-btn.unsub { margin-left: 2px; padding: 0 6px; font-size: 12px; font-weight: 500; color: var(--text-3); text-decoration: underline; }
.link-btn.unsub:hover { color: var(--accent); }
.sb-item.warn .ic { color: var(--warn); }
.sb-item .ell { display: block; max-width: 560px; }
.statusbar .sb-btn { font-weight: 600; color: var(--accent); }

@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fresh { from { opacity: 0; transform: translateY(-8px); background: var(--accent-soft); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  :root { --list-w: 380px; --folders-w: 232px; }
}
@media (max-width: 1100px) {
  .hide-lg { display: none !important; }
}
@media (max-width: 900px), (pointer: coarse) and (max-width: 1000px) and (max-height: 500px) {
  .folders {
    position: fixed; z-index: 140; top: 0; bottom: 0; left: 0;
    width: min(300px, 86vw); padding: calc(14px + var(--sa-t)) 10px calc(20px + var(--sa-b)) calc(10px + var(--sa-l));
    background: var(--bg); border-right: 1px solid var(--border); box-shadow: var(--shadow-xl);
    transform: translateX(-105%); transition: transform .24s var(--ease);
  }
  .app[data-folders="hidden"] .folders { display: flex; }
  .app.folders-open .folders { transform: none; }
  .app.folders-open .folders-scrim { display: block; position: fixed; inset: 0; z-index: 130; background: var(--scrim); animation: fade .15s; }
  .hide-md { display: none !important; }
  .search kbd { display: none; }
}
/* ---------- Touch screens ---------- */
/* Safe areas: iOS reports them with env(); Capacitor on Android injects --safe-area-inset-* (0 in a normal browser) */
:root {
  --sa-t: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sa-r: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --sa-b: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sa-l: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
}
.phone-only, .fab, .phone-bar { display: none; }
.list-scroll { position: relative; }

/* Swipe a message: the coloured action shows behind the row as it slides */
.msg.swiping { z-index: 1; background: var(--surface); box-shadow: var(--shadow); }
.swipe-bg {
  position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  color: #fff; font-weight: 650; font-size: 14px; background: var(--text-3);
}
.swipe-bg span { display: flex; align-items: center; gap: 8px; opacity: .6; transition: opacity .15s, transform .15s var(--ease); }
.swipe-bg .ic { width: 22px; height: 22px; }
.swipe-bg[data-action="archive"] { background: var(--success); }
.swipe-bg[data-action="read"] { background: #0f6cbd; }
.swipe-bg[data-action="archive"] .sb-read, .swipe-bg[data-action="read"] .sb-archive { visibility: hidden; }
.swipe-bg.armed span { opacity: 1; transform: scale(1.08); }

/* Pull to refresh */
.ptr {
  position: relative; z-index: 4; flex: none; width: 38px; height: 38px; margin: -38px auto 0;
  display: grid; place-items: center; border-radius: 50%; opacity: 0; pointer-events: none;
  background: var(--elevated); color: var(--text-3); box-shadow: var(--shadow-lg);
}
.ptr .ic { width: 19px; height: 19px; }
.ptr.armed { color: var(--accent); }
.ptr.spinning { opacity: 1; color: var(--accent); }
.ptr.spinning .ic { animation: spin .8s linear infinite; }

/* No sticky hover effects after a tap */
@media (hover: none) {
  .m-quick { display: none !important; }
  .msg:hover:not(.selected):not(.checked):not(.flagged) { background: transparent; }
}

/* ---------- Phones (and phones turned sideways: see PHONE_MQ in js/util.js) ---------- */
@media (max-width: 640px), (pointer: coarse) and (max-width: 1000px) and (max-height: 500px) {
  .app { grid-template-rows: calc(56px + var(--sa-t)) minmax(0, 1fr) 0; padding: 0 var(--sa-r) 0 var(--sa-l); background: var(--surface); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .rail, .ribbon-tabs, .ribbon, .statusbar, .brand, .scope-btn, .hide-sm, .top-actions [data-cmd="theme-toggle"] { display: none !important; }
  .phone-only { display: inline-grid; }
  input, select, textarea { font-size: 16px; }

  /* Top bar: folders button, search, settings and accounts */
  .topbar { padding: var(--sa-t) 8px 0 6px; gap: 4px; border-bottom: 1px solid var(--border); background: var(--surface); }
  .topbar .icon-btn { width: 42px; height: 42px; }
  .search { min-width: 0; height: 42px; margin: 0 4px; border-radius: 999px; border-color: transparent; background: var(--surface-2); }
  .search input { width: 0; }
  .me-btn { margin-left: 2px; }

  /* Lists and messages run edge to edge */
  .main { padding: 0; }
  .content { gap: 0; padding: 0; }
  .card { border: 0; border-radius: 0; box-shadow: none; }
  .list-head { padding: 14px 6px 10px 16px; }
  .lh-title h2 { font-size: 22px; font-weight: 700; }
  .lh-row.bulk .lh-title h2 { font-size: 17px; }
  .lh-row.bulk .lh-actions { gap: 0; }
  .lh-actions .icon-btn.sm { width: 40px; height: 40px; }
  .pill { height: 32px; padding: 0 14px; font-size: 14px; }
  .list-scroll { padding: 0 0 calc(100px + var(--sa-b)); overscroll-behavior-y: contain; }
  .group-head { padding-left: 18px; }
  .msg { --pad-y: 14px; margin: 0; padding: var(--pad-y) 16px var(--pad-y) 18px; border-radius: 0; box-shadow: inset 0 -1px 0 var(--border); touch-action: pan-y; }
  .msg.unread::before { left: 5px; }
  .m-from { font-size: 15.5px; }
  .m-subject { font-size: 14.5px; }
  .m-preview { font-size: 14px; }
  .msg .m-check { width: 100%; height: 100%; }

  /* Reading a message: a sticky header with the back button, and the actions in a bar at the bottom */
  .reader-scroll { padding-bottom: calc(80px + var(--sa-b)); }
  .r-head {
    position: sticky; top: 0; z-index: 3; align-items: center; gap: 4px; padding: 8px 6px 10px 4px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
  }
  .r-back { margin: 0 !important; width: 42px; height: 42px; }
  .r-subject { font-size: 18px; }
  .r-chips { margin-top: 5px; }
  .r-tools .icon-btn { width: 40px; height: 40px; }
  .thread { padding: 0; gap: 0; }
  .rm { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); }
  .rm.expanded { padding: 16px; }
  .rm-side { display: none; }
  .reply-bar { padding: 16px; }
  .reply-bar .btn { flex: 1; height: 42px; justify-content: center; }
  .trip-meta { grid-template-columns: 1fr 1fr; }
  .trip-meta span:nth-child(3) { border-left: 0; }
  .trip-meta span:nth-child(n + 3) { border-top: 1px solid var(--border); }

  .fab {
    display: inline-flex; align-items: center; gap: 10px; position: fixed; z-index: 60;
    right: calc(16px + var(--sa-r)); bottom: calc(18px + var(--sa-b));
    height: 56px; padding: 0 22px 0 18px; border-radius: 18px;
    background: var(--accent); color: var(--on-accent); font-weight: 650; font-size: 15.5px;
    box-shadow: 0 12px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent), var(--shadow-lg);
  }
  .fab .ic { width: 22px; height: 22px; }
  .fab:active { transform: scale(.97); }
  .app.reading .fab, .app:has(.list.selecting) .fab, .app.folders-open .fab { display: none; }

  .app.reading .phone-bar { display: flex; }
  .phone-bar {
    position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
    padding: 4px calc(6px + var(--sa-r)) var(--sa-b) calc(6px + var(--sa-l));
    background: color-mix(in srgb, var(--surface) 94%, transparent); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--border);
  }
  .phone-bar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
    padding: 8px 0 7px; border-radius: 10px; font-size: 11px; font-weight: 600; color: var(--text-2);
  }
  .phone-bar .ic { width: 22px; height: 22px; color: var(--text); }
  .phone-bar button:active { background: var(--pressed); }

  /* Folders, settings, compose and dialogs fill the screen, clear of the notch and home indicator */
  .folders { width: min(320px, 86vw); }
  .drawer { top: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; border-radius: 0; padding: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l); }
  .compose, .compose.max { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; padding: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l); }
  .c-titlebar { height: 54px; }
  .c-editor { font-size: 16px; padding: 16px; }
  .c-smtp { display: none; }
  .scrim { padding: calc(12px + var(--sa-t)) calc(12px + var(--sa-r)) calc(12px + var(--sa-b)) calc(12px + var(--sa-l)); }
  .dialog { max-height: 100%; border-radius: 16px; }
  .kbd-grid { grid-template-columns: 1fr; }
  .proto-cards { grid-template-columns: 1fr; }
  .toast { bottom: calc(92px + var(--sa-b)); }
  /* Phones always read full screen in a card list, so these layout choices don't apply */
  .drawer .set-group:has([data-set="pane"]), .drawer .set-group:has([data-set="listStyle"]) { display: none; }

  /* Menus open as bottom sheets */
  .menu {
    left: calc(8px + var(--sa-l)) !important; right: calc(8px + var(--sa-r)) !important; top: auto !important; bottom: calc(8px + var(--sa-b)) !important;
    min-width: 0; max-width: none; max-height: 72vh; max-height: 72dvh; padding: 8px; border-radius: 18px;
    box-shadow: var(--shadow-xl); animation: sheet .24s var(--ease);
  }
  .menu-item { height: 48px; padding: 0 14px; gap: 14px; border-radius: 10px; font-size: 16px; }
  .menu-item > .ic { width: 20px; height: 20px; }
  .menu-head { padding: 10px 14px 6px; }
}
.menu-scrim { position: fixed; inset: 0; z-index: 260; background: var(--scrim); animation: fade .2s; }
.menu-scrim.closing { opacity: 0; transition: opacity .2s; }
@keyframes sheet { from { opacity: 0; transform: translateY(28px); } }

/* ---------- Print: just the open message ---------- */
@media print {
  body { overflow: visible; background: #fff; }
  .topbar, .rail, .ribbon-tabs, .ribbon, .folders, .list, .resizer, .statusbar,
  .r-tools, .rm-actions, .reply-bar, .r-back, .toast, .drawer, .compose { display: none !important; }
  .app, .workspace, .main, .content, .panes { display: block; height: auto; }
  .card { border: 0; box-shadow: none; }
  .reader-scroll { overflow: visible; }
}

/* ---------- Desktop app: the top bar doubles as the window's title bar ---------- */
:root:is([data-desktop="darwin"], [data-desktop="win32"]) .topbar { -webkit-app-region: drag; }
:root[data-desktop] .topbar :is(button, input, .search),
:root[data-desktop] :is(.menu, .scrim, .toast, .compose, .drawer, .folders-scrim) { -webkit-app-region: no-drag; }
/* Room for the Mac traffic lights (hidden in full screen) and the Windows minimise / maximise / close buttons */
:root[data-desktop="darwin"]:not([data-fullscreen]) .topbar { padding-left: 88px; }
:root[data-desktop="win32"] .topbar { padding-right: 148px; }

/* ---------- Signature editor (account settings) ---------- */
/* Shown on white, as recipients usually see it, so signatures with their own dark text stay readable in dark mode */
.sig-editor { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.sig-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sig-tools { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.sig-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--border); }
.sig-color { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; cursor: pointer; }
.sig-color:hover { background: var(--surface-3); }
.sig-color input { width: 16px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; }
.sig-color input::-webkit-color-swatch-wrapper { padding: 0; }
.sig-color input::-webkit-color-swatch { border: 1px solid var(--border-strong); border-radius: 4px; }
.sig-tools .link-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.sig-tools .link-btn .ic { width: 14px; height: 14px; }
.sig-area { min-height: 96px; max-height: 280px; overflow: auto; padding: 12px 14px; outline: 0; background: #fff; color: #16191e; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.sig-area:empty::before { content: attr(data-placeholder); color: #8a94a3; }
.sig-area img { max-width: 100%; height: auto; }
.sig-area a { color: #0f6cbd; }
.sig-area p { margin: 0 0 6px; }
.sig-code { display: block; width: 100%; min-height: 150px; max-height: 320px; resize: vertical; padding: 10px 12px; border: 0; outline: 0; background: transparent; color: var(--text); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.c-editor .c-sig img { max-width: 100%; height: auto; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .c-editor .c-sig:not(:empty) { margin-top: 6px; padding: 10px 12px; border-radius: 8px; background: #fff; color: #4b5563; }
}
:root[data-theme="dark"] .c-editor .c-sig:not(:empty) { margin-top: 6px; padding: 10px 12px; border-radius: 8px; background: #fff; color: #4b5563; }

/* Link address popover (compose and signature toolbars) */
.link-pop { z-index: 300; display: flex; gap: 6px; padding: 6px; width: min(380px, calc(100vw - 16px)); max-width: none; }
.link-pop .input { flex: 1; min-width: 0; height: 32px; }
.link-pop .btn { height: 32px; flex: none; }

/* Settings › Signatures */
.sig-list { display: flex; flex-direction: column; gap: 4px; }
.sig-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; color: var(--text); }
.sig-row:hover { background: var(--surface-3); }
.sig-row > .ic { margin-left: auto; color: var(--text-3); width: 16px; height: 16px; }
.sig-row-text { display: flex; flex-direction: column; min-width: 0; }
.sig-row-text b { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-row-text small { color: var(--text-3); font-size: 12px; }
.sig-none { margin: 0; color: var(--text-3); font-size: 13px; }

/* Rules dialog */
.rule-acct { max-width: 420px; }
.rule-loading { display: flex; align-items: center; gap: 10px; padding: 24px 0; color: var(--text-2); font-size: 13.5px; }
.rule-empty { text-align: center; padding: 20px 12px 28px; color: var(--text-2); }
.rule-empty h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 650; color: var(--text); }
.rule-empty p { margin: 0 auto; max-width: 380px; font-size: 13px; line-height: 1.5; }
.rule-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rule-row { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; background: var(--surface); }
.rule-row + .rule-row { border-top: 1px solid var(--border); }
.rule-row.off .rule-main { opacity: .6; }
.rule-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; margin: -2px 0; border-radius: 8px; text-align: left; color: var(--text); }
.rule-main:hover { background: var(--hover); }
.rule-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rule-name b { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-sum { font-size: 12.5px; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.rule-arrow { color: var(--text-3); }
.rule-badge { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.rule-badge.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.rule-badge .ic { width: 12px; height: 12px; }
.rule-tools { display: flex; flex: none; }
.rule-tools .icon-btn:disabled { opacity: .35; pointer-events: none; }
.rule-note { display: flex; align-items: flex-start; gap: 8px; margin: 12px 2px 4px; font-size: 12.5px; line-height: 1.5; color: var(--text-3); }
.rule-note .ic { flex: none; width: 15px; height: 15px; margin-top: 2px; }
.rule-match { margin-bottom: 12px; }
.rule-match button { flex: 1; }
.rule-lines { display: flex; flex-direction: column; gap: 8px; }
.rule-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rule-line .input { height: 34px; }
.rule-line > select.input { flex: 1 1 130px; width: auto; min-width: 0; }
.rule-line > .rule-val { flex: 2 1 170px; width: auto; min-width: 0; }
.rule-line > [data-cf="header"] { flex: 1 1 110px; }
.rule-line > .icon-btn { margin-left: auto; }
.rule-unit, .rule-newfolder { display: flex; align-items: center; gap: 6px; }
.rule-unit .input { flex: 1; min-width: 0; }
.rule-unit > span { font-size: 13px; color: var(--text-2); }
.rule-newfolder .input { flex: 1; min-width: 0; }
.rule-add { display: inline-flex; align-items: center; gap: 5px; margin: 8px 0 12px -6px; }
.rule-add .ic { width: 14px; height: 14px; }
.rule-hint { margin: 0 0 12px; font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.srv-opts .rule-hint { margin: 2px 0 0; }
.rule-log { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.log-row { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; background: var(--surface); font-size: 12.5px; }
.log-row + .log-row { border-top: 1px solid var(--border); }
.log-top { display: flex; align-items: baseline; gap: 10px; }
.log-top b { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-top time { flex: none; color: var(--text-3); font-size: 12px; }
.log-sub { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-did { color: var(--text-2); }
.log-err { display: flex; align-items: flex-start; gap: 6px; color: var(--danger); }
.log-err .ic { flex: none; width: 14px; height: 14px; margin-top: 1px; }
@media (max-width: 640px), (pointer: coarse) and (max-width: 1000px) and (max-height: 500px) {
  .rule-row { flex-wrap: wrap; gap: 4px 10px; padding: 8px 6px 6px 12px; }
  .rule-main { flex-basis: calc(100% - 60px); }
  .rule-tools { width: 100%; justify-content: flex-end; margin-top: -4px; }
  .rule-line { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .rule-line:last-child { padding-bottom: 0; border-bottom: 0; }
  /* What to check, with its remove button beside it, then one control per line */
  .rule-line > * { order: 2; }
  .rule-line > :first-child { order: 0; flex-basis: calc(100% - 46px); }
  .rule-line > .icon-btn { order: 1; }
  .rule-line > select.input:not(:first-child), .rule-line > .rule-val { flex-basis: 100%; }
  .rule-line .input { height: 40px; font-size: 16px; }
}
