/* ============================================================
   NightAgent v2 - Apple/Arc Spacious
   One stylesheet, two themes (Pearl light / Onyx dark).
   Toggle with html[data-theme="pearl"|"onyx"]
   Single accent (Hydra Teal). Status colors used sparingly.
   ============================================================ */

/* ---------- Themes ---------- */

:root, html[data-theme="pearl"] {
  /* surface stack - quiet, paper-like */
  --bg:        #f6f5f1;          /* page */
  --surface-1: rgba(255,255,255,.78);   /* cards / glass */
  --surface-2: rgba(255,255,255,.55);   /* sub-panels */
  --surface-3: rgba(247,245,240,.72);   /* hover lift */
  --solid-1:   #ffffff;          /* solid card when blur unavailable */

  /* ink */
  --ink:       #1d1d1f;
  --ink-2:     #4a4a4d;
  --muted:     #6e6e73;     /* darker for AA contrast on light surfaces */
  --faint:     #a1a1a6;

  /* hairlines - very thin, low contrast */
  --hairline:  rgba(60,60,67,.10);
  --hairline-2:rgba(60,60,67,.20);

  /* single accent - cool teal */
  --accent:    #00787f;
  --accent-2:  #006066;
  --accent-fg: #ffffff;
  --accent-soft: rgba(0,120,127,.10);

  /* status (used minimally) */
  --st-red:    #b8392f;
  --st-orange: #b06a18;
  --st-green:  #3d6c25;
  --st-blue:   #2c5d8a;

  /* shadows - very soft, layered */
  --sh-1: 0 1px 2px rgba(0,0,0,.04), 0 0 0 .5px rgba(0,0,0,.04);
  --sh-2: 0 4px 16px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --sh-3: 0 24px 60px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.04);

  --row-today: rgba(0,120,127,.04);

  /* ---- legacy aliases (kept so existing pages keep rendering) ---- */
  --fg: var(--ink);
  --text: var(--ink);
  --text-dim: var(--muted);
  --border: var(--hairline);
  --card: var(--solid-1);
  --card2: var(--surface-2);
  --surface: var(--solid-1);
  --note-bg: var(--surface-2);
  --shadow-md: var(--sh-2);
  --ink-3: var(--faint);
  --cat-red:    var(--st-red);
  --cat-orange: var(--st-orange);
  --cat-yellow: var(--st-orange);
  --cat-info:   var(--muted);
  --red:    var(--st-red);
  --red-dk: var(--st-red);
  --orange: var(--st-orange);
  --yellow: #b89400;
  --green:  var(--st-green);
  --blue:   var(--st-blue);
  --teal:   var(--accent);
  --purple: #7a4ec7;
  --gray:   var(--muted);
  --warn:   var(--st-orange);
  --st-overdue:  var(--st-red);
  --st-critical: var(--st-red);
  --st-warning:  var(--st-orange);
  --st-offered:  #b89400;
  --st-info:     var(--st-blue);
  --st-ack:      var(--accent);
  --st-done:     var(--st-green);
  --st-fyi:      var(--muted);

  color-scheme: light;
}

html[data-theme="onyx"] {
  --bg:        #131316;
  --surface-1: rgba(28,28,32,.72);
  --surface-2: rgba(34,34,38,.55);
  --surface-3: rgba(40,40,44,.72);
  --solid-1:   #1c1c20;

  --ink:       #f0f0f3;
  --ink-2:     #c8c8cc;
  --muted:     #a3a3a8;     /* lighter for AA contrast on dark surfaces */
  --faint:     #6c6c70;

  --hairline:  rgba(255,255,255,.07);
  --hairline-2:rgba(255,255,255,.14);

  --accent:    #4ec3ce;
  --accent-2:  #2ea4af;
  --accent-fg: #0c1416;
  --accent-soft: rgba(78,195,206,.14);

  --st-red:    #e0625a;
  --st-orange: #e09040;
  --st-green:  #6ec45a;
  --st-blue:   #6ba9e0;

  --sh-1: 0 1px 2px rgba(0,0,0,.40), 0 0 0 .5px rgba(255,255,255,.04);
  --sh-2: 0 6px 20px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.30);
  --sh-3: 0 30px 80px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.30);

  --row-today: rgba(78,195,206,.06);

  /* ---- legacy aliases ---- */
  --fg: var(--ink);
  --text: var(--ink);
  --text-dim: var(--muted);
  --border: var(--hairline);
  --card: var(--solid-1);
  --card2: var(--surface-2);
  --surface: var(--solid-1);
  --note-bg: var(--surface-2);
  --shadow-md: var(--sh-2);
  --ink-3: var(--faint);
  --cat-red:    var(--st-red);
  --cat-orange: var(--st-orange);
  --cat-yellow: #d6b441;
  --cat-info:   var(--muted);
  --red:    var(--st-red);
  --red-dk: var(--st-red);
  --orange: var(--st-orange);
  --yellow: #d6b441;
  --green:  var(--st-green);
  --blue:   var(--st-blue);
  --teal:   var(--accent);
  --purple: #b388ff;
  --gray:   var(--muted);
  --warn:   var(--st-orange);
  --st-overdue:  var(--st-red);
  --st-critical: var(--st-red);
  --st-warning:  var(--st-orange);
  --st-offered:  #d6b441;
  --st-info:     var(--st-blue);
  --st-ack:      var(--accent);
  --st-done:     var(--st-green);
  --st-fyi:      var(--muted);

  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Inter, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11','ss01';
  text-rendering: optimizeLegibility;
}

/* Accent bg pattern - very subtle radial gradient for depth */
body::before {
  content:''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 80% -20%, var(--accent-soft), transparent 70%),
    radial-gradient(900px 500px at -10% 110%, var(--accent-soft), transparent 70%);
  opacity: .55;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-2); }

button, input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* tabular nums for any data */
.tnum, time, .num, td.num, .badge, .meta { font-variant-numeric: tabular-nums; }

/* Scrollbars - thin, neutral */
* { scrollbar-width: thin; scrollbar-color: var(--hairline-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--hairline-2); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- App layout ---------- */
.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px 80px;
}

@media (max-width: 720px){ .app { padding: 0 18px 80px; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 0;
  margin: 0 -32px 24px;
  padding-left: 32px; padding-right: 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}
.topbar.glass {
  background: linear-gradient(to bottom, rgba(246,245,241,.85), rgba(246,245,241,.65));
  backdrop-filter: saturate(140%) blur(20px);
  -webkit-backdrop-filter: saturate(140%) blur(20px);
}
html[data-theme="onyx"] .topbar.glass {
  background: linear-gradient(to bottom, rgba(19,19,22,.85), rgba(19,19,22,.65));
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; letter-spacing: -.012em;
  color: var(--ink);
}
.brand .dot {
  width: 18px; height: 18px; border-radius: 6px;
  background: var(--ink); position: relative;
  box-shadow: inset 0 0 0 1px var(--hairline-2);
}
.brand .dot::after {
  content:''; position:absolute; top:4px; left:4px; right:4px; bottom:4px;
  border-radius: 50%;
  background: var(--bg);
}

.nav {
  display: flex; gap: 2px; align-items: center;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  backdrop-filter: blur(20px);
}
.nav a {
  padding: 6px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  border-radius: 7px;
  transition: background .14s, color .14s;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a[aria-current="page"] {
  background: var(--solid-1);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--sh-1);
  position: relative;
}
/* Global icon size defaults - prevents oversized SVGs anywhere */
.ic    { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.ic-xs { width: 12px; height: 12px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.ic-sm { width: 14px; height: 14px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.ic-lg { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
svg.ic, svg.ic-xs, svg.ic-sm, svg.ic-lg { max-width: 100%; }
.nav a[aria-current="page"] .ic { opacity: 1; color: var(--accent); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px; border-radius: 2px;
  background: var(--accent);
}
.nav a .ic { width: 14px; height: 14px; opacity: .75; }
.nav a:hover .ic { opacity: 1; }

.spacer { flex: 1; }

.toolbar { display: flex; align-items: center; gap: 8px; }

/* Theme switch - segmented control */
.theme-switch {
  display: inline-flex; align-items: center;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
.theme-switch button {
  border: 0; background: transparent; color: var(--muted);
  width: 28px; height: 24px; padding: 0;
  border-radius: 6px;
  cursor: pointer; transition: all .14s;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button.active {
  background: var(--solid-1);
  color: var(--ink);
  box-shadow: var(--sh-1);
}
.theme-switch svg { width: 14px; height: 14px; }

/* Run badge */
.run-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.run-pill .live { width: 6px; height: 6px; border-radius: 50%; background: var(--st-green); box-shadow: 0 0 0 3px rgba(110,196,90,.20); }

/* ---------- Page header ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin: 16px 0 32px;
  gap: 24px;
}
.page-head h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.022em;
  line-height: 1.1;
  color: var(--ink);
}
.page-head .sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--sh-1);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}
.card-h {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between;
}
.card-h h2, .card-h h3 {
  margin: 0; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.card-b { padding: 18px 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: transform .12s, background .14s, box-shadow .14s;
  white-space: nowrap;
}
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

.btn.ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--hairline-2);
}
.btn.ghost:hover { background: var(--surface-3); border-color: var(--hairline-2); }

.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn.lg { padding: 10px 18px; font-size: 14px; }
.btn.icon { padding: 6px; width: 30px; height: 30px; justify-content: center; }

/* ---------- Inputs ---------- */
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="date"], input[type="number"],
textarea, select {
  width: 100%;
  background: var(--solid-1);
  border: 1px solid var(--hairline-2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
::placeholder { color: var(--faint); }

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  font-size: 11px; font-weight: 500;
  letter-spacing: .03em;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.pill-RED    { color: var(--st-red);    background: rgba(184,57,47,.10); border-color: rgba(184,57,47,.20); }
.pill-ORANGE { color: var(--st-orange); background: rgba(176,106,24,.10); border-color: rgba(176,106,24,.20); }
.pill-YELLOW { color: var(--st-orange); background: transparent; border-color: var(--hairline-2); }
.pill-INFO   { color: var(--muted);     background: transparent; border-color: var(--hairline); }
.pill-DONE   { color: var(--st-green);  background: rgba(61,108,37,.10); border-color: rgba(61,108,37,.20); }
.pill-OPEN   { color: var(--st-blue);   background: rgba(44,93,138,.10); border-color: rgba(44,93,138,.20); }

html[data-theme="onyx"] .pill-RED    { background: rgba(224,98,90,.14); }
html[data-theme="onyx"] .pill-ORANGE { background: rgba(224,144,64,.14); }
html[data-theme="onyx"] .pill-DONE   { background: rgba(110,196,90,.14); }
html[data-theme="onyx"] .pill-OPEN   { background: rgba(107,169,224,.14); }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl thead th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  position: sticky; top: 0; z-index: 1;
}
.tbl tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  font-size: 13.5px; line-height: 1.45;
}
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-3); }
.tbl tbody tr.today { background: var(--row-today); }

.tbl .meta { color: var(--muted); font-size: 12px; }

/* ---------- Subtle horizontal rule between sections ---------- */
.rule { height: 1px; background: var(--hairline); border: 0; margin: 24px 0; }

/* ---------- Empty state ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center; color: var(--muted);
  font-size: 14px;
}
.empty .glyph {
  font-size: 24px; margin-bottom: 12px; opacity: .35;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--solid-1);
  border: 1px solid var(--hairline-2);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: var(--sh-3);
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.err  { border-color: var(--st-red); color: var(--st-red); }
.toast.ok   { border-color: var(--st-green); color: var(--st-green); }

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block; width: 12px; height: 12px;
  border: 1.5px solid var(--hairline-2);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}

/* ---------- Tab strip ---------- */
.tabs {
  display: flex; gap: 4px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  width: fit-content;
}
.tabs button, .tabs a {
  padding: 6px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--muted);
  background: transparent; border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.tabs button:hover, .tabs a:hover { color: var(--ink); }
.tabs button.active, .tabs a.active {
  background: var(--solid-1);
  color: var(--ink);
  box-shadow: var(--sh-1);
}

/* ---------- KBD chip ---------- */
kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-3);
  border: 1px solid var(--hairline-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--ink-2);
}

/* ---------- Mobile overrides ---------- */
@media (max-width: 720px) {
  .page-head h1 { font-size: 24px; }
  .topbar { padding: 8px 12px; gap: 6px; flex-wrap: nowrap; align-items: center; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar > * { flex-shrink: 0; }
  .topbar .nav { gap: 2px; }
  .topbar .brand { gap: 6px; }
  .topbar .brand span { font-size: 13px; }
  .nav a { padding: 6px 8px; font-size: 12.5px; }
  .nav a span { display: none; } /* show only icons */
  .nav a svg.ic { width: 18px; height: 18px; }
  .topbar .theme-switch { gap: 2px; padding: 2px; }
  .topbar .theme-switch button { width: 26px; height: 26px; padding: 4px; }
  .topbar .btn.icon, .topbar a.btn { padding: 6px 8px; }
  .card-h { padding: 14px 16px; }
  .card-b { padding: 16px; }
  .btn { padding: 8px 14px; }
  /* Force tables to fit narrow viewports on tasks page */
  .app { overflow-x: hidden; }
  table[data-cat] { table-layout: auto; min-width: 0; }
  table[data-cat] colgroup col { width: auto !important; }
  table[data-cat] thead { display: none; }
  table[data-cat] tbody, table[data-cat] tr, table[data-cat] td { display: block; width: 100%; box-sizing: border-box; }
  table[data-cat] tr { padding: 12px 4px; border-bottom: 1px solid var(--hairline); position: relative; }
  table[data-cat] tbody td { padding: 4px 0; border-bottom: 0; }
  table[data-cat] td.grip { display: none; }
  table[data-cat] td.num { display: inline-block; width: auto; padding: 0 8px 0 0; color: var(--muted); font-size: 11px; }
  /* Hide noisy long sender lines on overdue summary blocks */
  .es-from { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
  /* Search/filter form inputs full-width */
  .toolbar input, .toolbar select, .toolbar textarea { width: 100%; box-sizing: border-box; }
}

/* ---------- Legacy compat shims ---------- */
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.b-RED, .badge.b-RED       { background: rgba(184,57,47,.14); color: var(--st-red);    border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.b-ORANGE, .badge.b-ORANGE { background: rgba(176,106,24,.14); color: var(--st-orange); border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.b-YELLOW, .badge.b-YELLOW { background: rgba(176,106,24,.08); color: var(--st-orange); border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 500; letter-spacing: .04em; }
.b-INFO, .badge.b-INFO     { background: var(--surface-3);     color: var(--muted);     border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 500; letter-spacing: .04em; }
.b-DRAFT, .badge.b-DRAFT   { background: rgba(61,108,37,.14);  color: var(--st-green);  border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; }

/* Subtle helper text (used in settings) */
.help { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* Section header in cards */
.section-h3 { margin: 0 0 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }

/* =============================================================
   PAGE STYLES — modernized versions of legacy classes used
   across index / kanban / mail / settings / mobile.
   Apple/Arc spacious feel. All themed via tokens above.
   ============================================================= */

/* ---------- Meta / row layout (index) ---------- */
.meta-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meta-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.meta-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }
.meta-v { font-size: 13px; color: var(--ink-2); }

.editable { cursor: text; transition: background .14s; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; }
.editable:hover { background: var(--surface-3); }
.editable:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--solid-1); }
.editable-hint { font-size: 11px; color: var(--faint); font-style: italic; }
.save-flag { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--st-green); margin-left: 6px; opacity: 0; transition: opacity .2s; }
.save-flag.show { opacity: 1; }

/* ---------- Status pills (.status-pill .s-*) ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .03em;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-pill::before { content:''; width:6px; height:6px; border-radius:50%; background: currentColor; }

.s-OPEN, .s-OFFERED, .s-PROPOSAL { color: var(--st-blue); background: rgba(44,93,138,.10); border-color: rgba(44,93,138,.18); }
.s-CRITICAL, .s-OVERDUE          { color: var(--st-red); background: rgba(184,57,47,.12); border-color: rgba(184,57,47,.20); }
.s-WARNING                        { color: var(--st-orange); background: rgba(176,106,24,.12); border-color: rgba(176,106,24,.20); }
.s-ACK, .s-IN_PROGRESS            { color: var(--accent); background: var(--accent-soft); border-color: rgba(0,120,127,.18); }
.s-DONE, .s-CLOSED                { color: var(--st-green); background: rgba(61,108,37,.10); border-color: rgba(61,108,37,.18); }
.s-INFO, .s-FYI, .s-LOST, .s-OPEN_INFO, .s-INFO_FYI, .s-INFO_RECEIVED, .s-INFO_IGNORE
  { color: var(--ink-2); background: var(--surface-3); border-color: var(--hairline-2); }
.s-NEW                             { color: var(--accent); background: var(--accent-soft); border-color: rgba(0,120,127,.18); }
.s-OPEN_ACTION, .s-AWAITING_REPLY, .s-AWAITING_PAX8
  { color: var(--st-blue); background: rgba(44,93,138,.10); border-color: rgba(44,93,138,.20); }
.s-SCHEDULED, .s-ALLOCATED_TODAY, .s-ATTENDED
  { color: var(--st-orange); background: rgba(176,106,24,.10); border-color: rgba(176,106,24,.20); }
.s-WAITING_SE, .s-WAITING_SE_REPLY, .s-CKW_OOO_WAIT_SE, .s-WAITING_REMOTE_ACCESS,
.s-SENT, .s-SENT_WAITING, .s-SENT_WAITING_SE, .s-SENT_ACKNOWLEDGED, .s-RESEND_CASE_NUMBER_TODO,
.s-ACKNOWLEDGED, .s-ACKNOWLEDGED_AWAITING_PRODUCT_MGMT
  { color: var(--accent-2); background: var(--accent-soft); border-color: rgba(0,120,127,.20); }
.s-REPLY_RECEIVED, .s-OFFER_RECEIVED, .s-RMA_NUMBER_ASSIGNED, .s-CONFIRMED, .s-DONE_LICENSES_DEPLOYED, .s-SUPERSEDED
  { color: var(--st-green); background: rgba(61,108,37,.10); border-color: rgba(61,108,37,.20); }
.s-CRITICAL_ESCALATED, .s-ESCALATED, .s-ESCALATED_TO_SE, .s-PHISHING_BLOCKED
  { color: var(--st-red); background: rgba(184,57,47,.12); border-color: rgba(184,57,47,.22); }
html[data-theme="onyx"] .s-INFO, html[data-theme="onyx"] .s-FYI, html[data-theme="onyx"] .s-LOST,
html[data-theme="onyx"] .s-OPEN_INFO, html[data-theme="onyx"] .s-INFO_FYI,
html[data-theme="onyx"] .s-INFO_RECEIVED, html[data-theme="onyx"] .s-INFO_IGNORE
  { color: var(--ink-2); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
html[data-theme="onyx"] .s-WAITING_SE, html[data-theme="onyx"] .s-WAITING_SE_REPLY,
html[data-theme="onyx"] .s-CKW_OOO_WAIT_SE, html[data-theme="onyx"] .s-WAITING_REMOTE_ACCESS,
html[data-theme="onyx"] .s-SENT, html[data-theme="onyx"] .s-SENT_WAITING,
html[data-theme="onyx"] .s-SENT_WAITING_SE, html[data-theme="onyx"] .s-SENT_ACKNOWLEDGED,
html[data-theme="onyx"] .s-RESEND_CASE_NUMBER_TODO, html[data-theme="onyx"] .s-ACKNOWLEDGED,
html[data-theme="onyx"] .s-ACKNOWLEDGED_AWAITING_PRODUCT_MGMT
  { background: rgba(78,195,206,.16); border-color: rgba(78,195,206,.28); }
html[data-theme="onyx"] .s-OPEN_ACTION, html[data-theme="onyx"] .s-AWAITING_REPLY,
html[data-theme="onyx"] .s-AWAITING_PAX8
  { background: rgba(107,169,224,.18); border-color: rgba(107,169,224,.28); }
html[data-theme="onyx"] .s-SCHEDULED, html[data-theme="onyx"] .s-ALLOCATED_TODAY,
html[data-theme="onyx"] .s-ATTENDED
  { background: rgba(224,144,64,.18); border-color: rgba(224,144,64,.28); }
html[data-theme="onyx"] .s-REPLY_RECEIVED, html[data-theme="onyx"] .s-OFFER_RECEIVED,
html[data-theme="onyx"] .s-RMA_NUMBER_ASSIGNED, html[data-theme="onyx"] .s-CONFIRMED,
html[data-theme="onyx"] .s-DONE_LICENSES_DEPLOYED, html[data-theme="onyx"] .s-SUPERSEDED
  { background: rgba(110,196,90,.16); border-color: rgba(110,196,90,.28); }
html[data-theme="onyx"] .s-CRITICAL_ESCALATED, html[data-theme="onyx"] .s-ESCALATED,
html[data-theme="onyx"] .s-ESCALATED_TO_SE, html[data-theme="onyx"] .s-PHISHING_BLOCKED
  { background: rgba(224,98,90,.18); border-color: rgba(224,98,90,.30); }

html[data-theme="onyx"] .s-OPEN, html[data-theme="onyx"] .s-OFFERED, html[data-theme="onyx"] .s-PROPOSAL { background: rgba(107,169,224,.16); border-color: rgba(107,169,224,.22); }
html[data-theme="onyx"] .s-CRITICAL, html[data-theme="onyx"] .s-OVERDUE { background: rgba(224,98,90,.18); border-color: rgba(224,98,90,.28); }
html[data-theme="onyx"] .s-WARNING  { background: rgba(224,144,64,.18); border-color: rgba(224,144,64,.28); }
html[data-theme="onyx"] .s-DONE, html[data-theme="onyx"] .s-CLOSED { background: rgba(110,196,90,.16); border-color: rgba(110,196,90,.24); }

/* ---------- Category dots ---------- */
.cat-dot, .cat-swatch {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
  background: var(--muted);
}
.cat-RED,    .cat-swatch.cat-RED,    .cat-dot.cat-RED    { background: var(--st-red); }
.cat-ORANGE, .cat-swatch.cat-ORANGE, .cat-dot.cat-ORANGE { background: var(--st-orange); }
.cat-YELLOW, .cat-swatch.cat-YELLOW, .cat-dot.cat-YELLOW { background: #b89400; }
.cat-INFO,   .cat-swatch.cat-INFO,   .cat-dot.cat-INFO   { background: var(--muted); }
html[data-theme="onyx"] .cat-YELLOW, html[data-theme="onyx"] .cat-swatch.cat-YELLOW { background: #d6b441; }

/* ---------- Docs block (file attachments) ---------- */
.docs-block { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.docs-list { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 12px; color: var(--ink-2);
  transition: background .14s, border-color .14s;
}
.doc-chip:hover { background: var(--surface-3); border-color: var(--hairline-2); }
.doc-ico { width: 12px; height: 12px; opacity: .7; }
.doc-name { color: var(--ink-2); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-size { color: var(--faint); font-size: 11px; }
.doc-dl { color: var(--accent); }
.doc-x  { color: var(--muted); cursor: pointer; padding: 0 2px; line-height: 1; border: 0; background: transparent; }
.doc-x:hover { color: var(--st-red); }
.doc-add  { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; background: transparent; border: 1px dashed var(--hairline-2); border-radius: 999px; font-size: 11px; color: var(--muted); cursor: pointer; }
.doc-add:hover { color: var(--accent); border-color: var(--accent); }
.doc-input { display: none; }

/* ---------- Subtasks ---------- */
.subtasks { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hairline); }
.subs-toggle { font-size: 11px; color: var(--muted); cursor: pointer; user-select: none; padding: 2px 0; }
.subs-toggle:hover { color: var(--accent); }
.subs { display: flex; flex-direction: column; gap: 3px; }
.sub-add { display: flex; gap: 6px; align-items: center; }
.sub-add-input, .sub-input { flex: 1; padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.sub-saved-add { background: transparent; color: var(--accent); border: 0; cursor: pointer; padding: 4px; font-size: 12px; }
.sub-saved-add:hover { color: var(--accent-2); }
.sub-saved { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; padding: 3px 4px; }
.sub-saved.done { color: var(--muted); text-decoration: line-through; }
.sub-check { accent-color: var(--accent); cursor: pointer; }
.sub-status { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.sub-st-OPEN  { color: var(--st-blue); background: rgba(44,93,138,.10); }
.sub-st-DONE  { color: var(--st-green); background: rgba(61,108,37,.10); }
.sub-st-WIP, .sub-st-IN_PROGRESS { color: var(--accent); background: var(--accent-soft); }

/* ---------- Add bar (new task input) ---------- */
.add-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 16px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: var(--sh-1);
  margin-bottom: 18px;
}
.add-bar input[type="text"] { flex: 1; border: 0; background: transparent; padding: 6px 0; font-size: 14px; }
.add-bar input[type="text"]:focus { box-shadow: none; }
.add-bar select { width: auto; padding: 6px 10px; }

/* ---------- NL bar (natural language quick add) ---------- */
.nl-bar, .nl-bar-m {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: var(--sh-1);
  margin-bottom: 18px;
}
.nl-bar h, .nl-bar .h { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 0; }
.nl-bar textarea, .nl-bar-m textarea { min-height: 56px; font-size: 13.5px; }
.nl-preview, .nl-preview-m {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}

/* ---------- Legend ---------- */
.legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend > span::before { content:''; width:8px; height:8px; border-radius:50%; background: var(--muted); }
.lg-overdue::before, .lg-critical::before { background: var(--st-red); }
.lg-warning::before { background: var(--st-orange); }
.lg-offered::before { background: #b89400; }
.lg-info::before    { background: var(--st-blue); }
.lg-ack::before     { background: var(--accent); }
.lg-done::before    { background: var(--st-green); }
.lg-open::before    { background: var(--st-blue); }
.lg-fyi::before, .lg-lost::before { background: var(--muted); }

/* ---------- Email strip (last contact preview) — flex column, structured ---------- */
.email-strip {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-size: 12.5px;
  margin-top: 8px;
  cursor: pointer;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  transition: background .15s ease, border-color .15s ease;
}
.email-strip:hover { background: var(--surface-3, var(--surface-2)); border-color: var(--hairline-2, var(--hairline)); }
.es-line  { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: nowrap; }
.es-meta  { color: var(--faint); font-size: 11px; }
.es-meta > svg { flex: 0 0 auto; opacity: .65; }
.es-from  { color: var(--ink-2); font-weight: 500; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.es-date  { color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; white-space: nowrap; }
.es-open  {
  margin-left: auto; color: var(--accent); font-size: 11px; cursor: pointer;
  background: transparent; border: 1px solid transparent; padding: 2px 6px;
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  border-radius: 6px; line-height: 1;
}
.es-open:hover { background: var(--surface-3, var(--surface)); border-color: var(--hairline); }
.es-open > svg { flex: 0 0 auto; }
.es-subj  { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; min-width: 0; }
.es-summary {
  color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  /* Fallback for non-webkit */
  max-height: 2.9em;
}

/* ---------- Contact chips ---------- */
.contact-chips, .contact-chips-m { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip, .chip-m {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-2);
  transition: background .14s;
}
.chip:hover { background: var(--surface-3); }
.chip-name { font-weight: 500; }
.chip-link { color: var(--accent); }
.chip-x { color: var(--muted); cursor: pointer; padding: 0 2px; line-height: 1; border: 0; background: transparent; }
.chip-x:hover { color: var(--st-red); }
.chip-add {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  background: transparent;
  border: 1px dashed var(--hairline-2);
  border-radius: 999px;
  font-size: 11.5px; color: var(--muted);
  cursor: pointer;
}
.chip-add:hover { color: var(--accent); border-color: var(--accent); }
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }

.contact-card {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
.contact-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.contact-company, .contact-role { font-size: 11.5px; color: var(--muted); }
.contact-remove { color: var(--muted); cursor: pointer; border: 0; background: transparent; padding: 2px 6px; }
.contact-remove:hover { color: var(--st-red); }

/* ---------- Why email block ---------- */
.why-email, .why-box {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(0,120,127,.16);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.45;
}
html[data-theme="onyx"] .why-email, html[data-theme="onyx"] .why-box { border-color: rgba(78,195,206,.20); }

/* ---------- Modal / sheet ---------- */
.modal-bg, .overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.30);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.modal-bg.show, .overlay.show { opacity: 1; pointer-events: auto; }
html[data-theme="onyx"] .modal-bg, html[data-theme="onyx"] .overlay { background: rgba(0,0,0,.55); }

.modal, .sheet {
  background: var(--solid-1);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: var(--sh-3);
  max-width: 560px; width: 100%;
  max-height: 85vh; overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(8px); transition: transform .18s;
}
.modal-bg.show .modal, .overlay.show .sheet { transform: translateY(0); }
.modal-wide { max-width: 920px; }
.modal-h, .sheet > header { padding: 18px 22px; border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; align-items: center; }
.modal-h h2, .modal-h h3, .sheet > header h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.012em; }
.modal-b, .sheet > .body { padding: 18px 22px; overflow: auto; flex: 1; }
.sheet-foot, .modal-f { padding: 14px 22px; border-top: 1px solid var(--hairline); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
.close-x {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer;
}
.close-x:hover { background: var(--surface-3); color: var(--ink); }

/* ---------- Tool buttons / pills ---------- */
.tool-icons { display: inline-flex; gap: 4px; }
.tool-btn, .tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 0; background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.tool-btn:hover, .tool:hover { background: var(--surface-3); color: var(--ink); }
.tool-btn .ic, .tool .ic { width: 14px; height: 14px; }
.tool-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-2);
}

/* ---------- Plan / chat modal styles ---------- */
.plan-banner {
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(0,120,127,.18);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 12px;
}
html[data-theme="onyx"] .plan-banner { border-color: rgba(78,195,206,.22); }

.run-chat, .chat-list { display: flex; flex-direction: column; gap: 10px; }
.chat-q, .chat-a, .tmsg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px; line-height: 1.5;
  max-width: 88%;
}
.chat-q {
  background: var(--accent); color: var(--accent-fg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-a, .tmsg {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-time { font-size: 11px; color: var(--faint); margin-top: 2px; }
.chat-pending { font-style: italic; color: var(--muted); }

/* ---------- Today highlights ---------- */
.today-row, tr.today { background: var(--row-today); }
.today-arrow {
  display: inline-block; width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--accent);
  margin-right: 4px;
}
.today-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(0,120,127,.18);
  border-radius: 999px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .04em;
}

/* ---------- Filter / search ---------- */
.filter-active-hint {
  font-size: 11.5px; color: var(--accent);
  display: inline-flex; align-items: center; gap: 6px;
}
.search-wrap { position: relative; }
.search-wrap input { padding-left: 32px; }
.search-wrap .ic-xs { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 14px; height: 14px; }

/* ---------- Banners / hints ---------- */
.install-banner, .banner {
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(0,120,127,.18);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
html[data-theme="onyx"] .install-banner, html[data-theme="onyx"] .banner { border-color: rgba(78,195,206,.22); }

.hint, .hints { font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.hints code, .hint code { display: inline-block; padding: 1px 6px; margin: 1px 1px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--ink); }
.hints .kbd, .hint .kbd { display: inline-block; padding: 1px 6px; background: var(--solid-1); border: 1px solid var(--hairline-2); border-bottom-width: 2px; border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--ink); }
.link-muted { font-size: 11.5px; color: var(--muted); text-decoration: none; padding: 0 6px; align-self: center; white-space: nowrap; }
.link-muted:hover { color: var(--accent); }
.empty-hint { color: var(--muted); font-size: 12.5px; padding: 12px 0; text-align: center; }
.snoozed-note { color: var(--muted); font-size: 11.5px; font-style: italic; }

/* ---------- Snooze controls ---------- */
.snooze-row { display: flex; gap: 6px; align-items: center; }
.snooze-btn {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--hairline-2);
  color: var(--ink-2);
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
}
.snooze-btn:hover { background: var(--surface-3); border-color: var(--accent); color: var(--accent); }

/* ---------- Tags ---------- */
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: .03em;
}
.tag-manual  { color: var(--accent); border-color: rgba(0,120,127,.20); }
.tag-snooze  { color: var(--st-orange); border-color: rgba(176,106,24,.20); }

/* ---------- Field group (forms) ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .help { margin-top: 2px; font-size: 12px; color: var(--ink-2); line-height: 1.45; }
.field .help code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--ink); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--hairline); }
.group { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Card head / meta (mobile) ---------- */
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title { font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.card-meta  { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.card-tools { display: inline-flex; gap: 2px; }

/* ---------- Mobile FAB ---------- */
.fab-wrap { position: fixed; right: 18px; bottom: 24px; z-index: 50; }
.fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent); color: var(--accent-fg);
  border: 0;
  box-shadow: var(--sh-3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .14s, box-shadow .14s;
}
.fab:hover { transform: translateY(-2px); }
.fab svg { width: 22px; height: 22px; }

/* ---------- Theme switch (mobile variant) ---------- */
.theme-switch-m { position: fixed; top: 12px; right: 12px; z-index: 60; }

/* ---------- Kanban ---------- */
.kb-shell { display: flex; flex-direction: column; gap: 14px; }
.kb-tabs  { display: flex; gap: 4px; padding: 3px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 10px; width: fit-content; }
.kb-tab   { padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--muted); background: transparent; border: 0; border-radius: 7px; cursor: pointer; transition: background .14s, color .14s; }
.kb-tab:hover { color: var(--ink); }
.kb-tab.active { background: var(--solid-1); color: var(--ink); box-shadow: var(--sh-1); }
.kb-pane  { display: none; }
.kb-pane.active { display: block; }
.kb-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 14px;
  /* allow horizontal scroll if viewport too narrow for 4 cols at min-width */
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 6px;
}
.kb-board > .kb-col { scroll-snap-align: start; min-width: 240px; }
@media (max-width: 1100px){
  .kb-board { grid-template-columns: repeat(4, minmax(260px, 280px)); }
}
@media (max-width: 720px){
  .kb-board { grid-template-columns: repeat(4, minmax(240px, 260px)); }
}

.kb-col {
  display: flex; flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  min-height: 240px;
  max-height: 78vh;
  overflow: hidden;
  box-shadow: var(--sh-1);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}
.kb-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
}
.lane-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; padding: 0 7px; height: 18px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--hairline); font-size: 11px; color: var(--ink-2); }
.kb-col-body {
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  overflow: auto;
  flex: 1;
}

.kb-card {
  background: var(--solid-1);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--sh-1);
  cursor: grab;
  transition: box-shadow .14s, transform .14s, border-color .14s;
  display: flex; flex-direction: column; gap: 6px;
}
.kb-card:hover { box-shadow: var(--sh-2); border-color: var(--hairline-2); transform: translateY(-1px); }
.kb-card.sortable-ghost { opacity: .35; }
.kb-card.sortable-chosen { box-shadow: var(--sh-3); }
.kc-title { font-size: 13px; line-height: 1.4; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kc-meta  { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); }
.kc-actions { display: inline-flex; gap: 4px; align-items: center; }
.kc-actions-r { margin-left: auto; }
.kc-id    {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 10.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kc-run   { color: var(--faint); font-size: 10.5px; }
.kc-open, .kc-del { width: 22px; height: 22px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.kc-open:hover { color: var(--accent); background: var(--surface-3); }
.kc-del:hover  { color: var(--st-red); background: rgba(184,57,47,.10); }
.kb-empty { padding: 24px; text-align: center; color: var(--faint); font-size: 12px; }
.kb-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 8px 14px; background: var(--solid-1); border: 1px solid var(--hairline-2); border-radius: 10px; font-size: 12.5px; color: var(--ink); box-shadow: var(--sh-2); }

/* ---------- Mail page ---------- */
.mail .layout { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
@media (max-width: 880px){ .mail .layout { grid-template-columns: 1fr; } }
.mail .list {
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 14px;
  overflow: hidden; box-shadow: var(--sh-1);
  max-height: 78vh; display: flex; flex-direction: column;
}
.mail .controls { padding: 10px 12px; border-bottom: 1px solid var(--hairline); display: flex; gap: 6px; align-items: center; }
.mail .picker-list { flex: 1; overflow: auto; padding: 4px; }
.mail .menu-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  transition: background .14s;
  border: 1px solid transparent;
}
.mail .menu-item:hover { background: var(--surface-3); }
.mail .menu-item.active { background: var(--accent-soft); border-color: rgba(0,120,127,.18); }
html[data-theme="onyx"] .mail .menu-item.active { border-color: rgba(78,195,206,.22); }
.mail .menu-item .from { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.mail .menu-item .subject { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail .menu-item .meta  { font-size: 11px; color: var(--muted); }

.mail .detail {
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 14px;
  box-shadow: var(--sh-1); padding: 18px 22px;
}
.mail .subj { font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -.014em; line-height: 1.3; }
.mail .from { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.mail .summary-text { padding: 12px 14px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--hairline); margin: 14px 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.mail .body, .mail .body-full { font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.mail .body-full { white-space: pre-wrap; word-break: break-word; max-height: 50vh; overflow: auto; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 10px; }
.mail .body-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-top: 16px; margin-bottom: 6px; }
.mail .draft-area { margin-top: 16px; }
.mail .draft-area textarea { min-height: 160px; }
.mail .draft-ready { font-size: 11.5px; color: var(--st-green); margin-top: 6px; }
.mail .model-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; background: var(--surface-3); border: 1px solid var(--hairline);
  border-radius: 999px; font-size: 11px; color: var(--ink-2);
}
.mail .thread { margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 10px; }
.mail .thread .tmsg.out { background: var(--accent-soft); border-color: rgba(0,120,127,.16); }

/* ---------- Settings page ---------- */
.settings-shell { max-width: 760px; margin: 0 auto; }
.settings-shell .card-b { padding: 24px 28px; }
.settings-shell h2 { font-size: 22px; font-weight: 600; letter-spacing: -.014em; color: var(--ink); margin: 0 0 20px; }
.settings-shell h3, .settings-shell .section h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.settings-shell .section { padding-top: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--hairline); }
.settings-shell .section:last-child { border-bottom: 0; }
.settings-shell .test-result { margin-top: 8px; font-size: 12px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--hairline); color: var(--ink-2); }
.settings-shell .test-result.ok  { color: var(--st-green); border-color: rgba(61,108,37,.20); }
.settings-shell .test-result.err { color: var(--st-red);   border-color: rgba(184,57,47,.20); }
.settings-shell input.secret, .settings-shell textarea.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: .02em; }

/* ---------- Banner / install ---------- */
.banner.danger, .install-banner.danger { background: rgba(184,57,47,.08); border-color: rgba(184,57,47,.22); color: var(--st-red); }
html[data-theme="onyx"] .banner.danger { background: rgba(224,98,90,.10); }

/* ---------- Misc shims ---------- */
.muted { color: var(--muted); }
.ok { color: var(--st-green); }
.err { color: var(--st-red); }
.danger { color: var(--st-red); }
.sep  { width: 1px; height: 16px; background: var(--hairline); margin: 0 4px; }
.small { font-size: 11.5px; }
.snip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.txt { white-space: pre-wrap; word-break: break-word; }

/* ---------- Acted / priority subtle row treatments ---------- */
tr.acted, .kb-card.acted { opacity: .92; }
tr.priority td:first-child { box-shadow: inset 3px 0 0 var(--st-red); }
tr.priority.has-text td:first-child { box-shadow: inset 3px 0 0 var(--st-red); }

/* ---------- Print ---------- */
@media print {
  .topbar, .toolbar, .add-bar, .nl-bar, .fab-wrap, .modal-bg, .overlay { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* =============================================================
   v=7  (May 4 2026)  — Tasks-table column widths,
                        action button stack fix,
                        mobile bottom tabbar app shell.
   ============================================================= */

/* ---------- Category swatches (cs-* alias) ---------- */
.cs-RED    { background: var(--st-red); }
.cs-ORANGE { background: var(--st-orange); }
.cs-YELLOW { background: #b89400; }
.cs-INFO   { background: var(--muted); }
html[data-theme="onyx"] .cs-YELLOW { background: #d6b441; }

/* ---------- Tasks table column widths (desktop) ---------- */
table[data-cat] {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
table[data-cat] colgroup col.c-grip { width: 22px; }
table[data-cat] colgroup col.c-num  { width: 36px; }
table[data-cat] colgroup col.c-done { width: 56px; }
table[data-cat] colgroup col.c-task { width: auto; }
table[data-cat] colgroup col.c-meta { width: 120px; }
table[data-cat] colgroup col.c-stat { width: 150px; }
table[data-cat] colgroup col.c-act  { width: 200px; }
table[data-cat] colgroup col.c-note { width: 280px; }

table[data-cat] thead th {
  text-align: left;
  padding: 10px 10px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
  background: transparent;
}
table[data-cat] tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  font-size: 13px; line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
table[data-cat] tbody tr:hover { background: var(--surface-3); }
table[data-cat] td.grip { cursor: grab; color: var(--faint); user-select: none; padding-top: 14px; }
table[data-cat] td.num  { color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 14px; }

/* Status pill always visible, even when status string is unknown */
.status-pill { background: var(--surface-3); color: var(--ink-2); border-color: var(--hairline-2); }
.status-pill.s-RED { color: var(--st-red); background: rgba(184,57,47,.12); border-color: rgba(184,57,47,.22); }
html[data-theme="onyx"] .status-pill.s-RED { background: rgba(224,98,90,.18); }

/* ---------- Action column tool buttons ---------- */
.tool-icons {
  display: flex; flex-wrap: wrap; gap: 4px;
  align-items: center;
  margin: 4px 0 6px;
}
.tool-btn, .tool {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  width: auto; height: 24px;
  font-size: 11.5px; line-height: 1; white-space: nowrap;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
}
.tool-btn:hover, .tool:hover { background: var(--surface-3); color: var(--ink); border-color: var(--hairline-2); }
.tool-btn.draft-ready { color: var(--st-green); border-color: rgba(61,108,37,.30); background: rgba(61,108,37,.06); }
.tool-btn .ic, .tool .ic { width: 13px; height: 13px; flex-shrink: 0; }

/* row-tools = snooze/delete in action col */
.row-tools {
  display: flex; flex-wrap: wrap; gap: 4px;
  align-items: center;
  margin-top: 4px;
}
.row-tools a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px;
  font-size: 11px; line-height: 1; white-space: nowrap;
  color: var(--muted); cursor: pointer;
  border-radius: 5px;
  text-decoration: none;
}
.row-tools a:hover { background: var(--surface-3); color: var(--ink); }
.row-tools a.danger:hover { color: var(--st-red); background: rgba(184,57,47,.08); }
.row-tools a .ic { width: 12px; height: 12px; flex-shrink: 0; }

/* ---------- Notes column row-actions ---------- */
.row-actions {
  display: flex; flex-wrap: wrap; gap: 4px;
  align-items: center;
  margin-top: 6px;
}
.row-actions .save-flag {
  flex: 1 1 100%;
  width: auto; height: auto;
  background: transparent;
  margin: 0; opacity: 1;
  font-size: 11px; color: var(--muted);
  border-radius: 0; display: block;
}
.row-actions button {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px;
  height: 26px; line-height: 1;
  font-size: 11.5px; white-space: nowrap;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
}
.row-actions button:hover { background: var(--surface-3); color: var(--ink); border-color: var(--hairline-2); }
.row-actions button.process-now { color: var(--accent); border-color: rgba(0,120,127,.28); background: var(--accent-soft); }
.row-actions button.process-now:hover { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.row-actions button.row-del { color: var(--muted); }
.row-actions button.row-del:hover { color: var(--st-red); border-color: rgba(184,57,47,.30); background: rgba(184,57,47,.06); }
.row-actions button .ic { width: 12px; height: 12px; flex-shrink: 0; }

/* Notes textarea fits column */
td textarea.note {
  width: 100%; box-sizing: border-box;
  min-height: 64px;
  padding: 8px 10px;
  font-size: 12.5px; line-height: 1.45;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  resize: vertical;
}
td textarea.note:focus { outline: 0; border-color: var(--accent); background: var(--solid-1); }
td textarea.note.priority { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
td textarea.note.acted   { background: rgba(61,108,37,.06); border-color: rgba(61,108,37,.20); }

/* ---------- Smaller breakpoint: compress columns, hide labels ---------- */
@media (max-width: 1280px) {
  table[data-cat] colgroup col.c-meta { width: 96px; }
  table[data-cat] colgroup col.c-stat { width: 110px; }
  table[data-cat] colgroup col.c-act  { width: 168px; }
  table[data-cat] colgroup col.c-note { width: 260px; }
}
@media (max-width: 1100px) {
  table[data-cat] colgroup col.c-act  { width: 132px; }
  .tool-btn, .tool { padding: 3px 6px; font-size: 11px; }
}

/* =============================================================
   MOBILE APP SHELL — bottom tab bar + scroll-reveal top header
   ============================================================= */
/* When body has .is-mobile, suppress the desktop topbar at any viewport width
   (browser dev-tools mobile preview may render at >760px) */
body.is-mobile .topbar { display: none !important; }
body.is-mobile .app    { padding: 0 14px 96px; }
body.is-mobile         { padding-top: 0; }

/* Bottom tab bar (always visible on mobile shell) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: none;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(to bottom, rgba(246,245,241,.92), rgba(246,245,241,.98));
  backdrop-filter: saturate(150%) blur(20px);
  -webkit-backdrop-filter: saturate(150%) blur(20px);
  border-top: 1px solid var(--hairline);
}
html[data-theme="onyx"] .tabbar {
  background: linear-gradient(to bottom, rgba(19,19,22,.92), rgba(19,19,22,.98));
}
.tabbar nav {
  display: grid; grid-template-columns: repeat(5, 1fr);
  width: 100%; height: 64px; max-width: 560px; margin: 0 auto;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-size: 10.5px; font-weight: 500;
  color: var(--muted); text-decoration: none;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a svg { width: 22px; height: 22px; flex-shrink: 0; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; top: 6px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
}
body.is-mobile .tabbar { display: block; }
body.is-mobile { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* Floating mobile top sheet — auto-hides on scroll-down, reveals on scroll-up/tap */
.m-tophead {
  display: none;
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(to bottom, rgba(246,245,241,.92), rgba(246,245,241,.75));
  backdrop-filter: saturate(150%) blur(20px);
  -webkit-backdrop-filter: saturate(150%) blur(20px);
  margin: 0 -14px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  transition: transform .25s ease;
  will-change: transform;
}
html[data-theme="onyx"] .m-tophead {
  background: linear-gradient(to bottom, rgba(19,19,22,.92), rgba(19,19,22,.75));
}
body.is-mobile .m-tophead { display: block; }
.m-tophead.hidden { transform: translateY(-110%); }
.m-tophead .m-row {
  display: flex; align-items: center; gap: 10px;
  min-height: 32px;
}
.m-tophead .m-brand { font-weight: 600; font-size: 14px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.m-tophead .m-brand-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--ink); position: relative; }
.m-tophead .m-brand-dot::after { content: ""; position: absolute; top: 3px; left: 3px; right: 3px; bottom: 3px; border-radius: 50%; background: var(--bg); }
.m-tophead .m-spacer { flex: 1; }
.m-tophead .m-runchip {
  font-size: 11px; padding: 3px 8px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(0,120,127,.18);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.m-tophead .m-iconbtn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--muted);
  border-radius: 8px; cursor: pointer;
}
.m-tophead .m-iconbtn:active { background: var(--surface-3); }
.m-tophead .m-iconbtn svg { width: 18px; height: 18px; }

/* Mobile page heading sits below the m-tophead */
body.is-mobile .page-head { padding: 10px 0 8px; }
body.is-mobile .page-head h1 { font-size: 22px; }
body.is-mobile .page-head .sub { font-size: 12px; }

/* Compact tables on mobile pages that still use them (history) */
body.is-mobile .history-tbl thead { display: none; }
body.is-mobile .history-tbl, body.is-mobile .history-tbl tbody, body.is-mobile .history-tbl tr, body.is-mobile .history-tbl td { display: block; width: 100%; }
body.is-mobile .history-tbl tr {
  border: 1px solid var(--hairline);
  border-radius: 10px; padding: 10px 12px;
  margin-bottom: 8px; background: var(--surface-2);
}
body.is-mobile .history-tbl td { padding: 4px 0; border: 0; }

/* Mobile filters as scroll-x chips */
body.is-mobile .controls {
  display: flex; flex-wrap: nowrap; overflow-x: auto;
  gap: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 -14px 12px; padding: 4px 14px 8px;
}
body.is-mobile .controls::-webkit-scrollbar { display: none; }
body.is-mobile .controls > * { flex: 0 0 auto; }

/* =====================================================================
   v8 - Mail polish + mobile kanban move sheet + workflow chrome
   2026-05-04 - reduced/elegant, Apple/Arc inspired
   ===================================================================== */

/* ---------- Mail list row separation, priority accent, hover actions ---------- */
.mail .picker-list { padding: 0; }
.mail .menu-item {
  position: relative;
  padding: 12px 14px 12px 18px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  margin: 0;
  gap: 4px;
}
.mail .menu-item:last-child { border-bottom: 0; }
.mail .menu-item:hover { background: var(--surface-2); }
.mail .menu-item.active {
  background: var(--accent-soft);
  border-color: var(--hairline);
}
/* Left accent bar by priority - 3px ribbon */
.mail .menu-item::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 2px 2px 0;
  background: transparent;
}
.mail .menu-item.p-RED::before    { background: var(--st-red); }
.mail .menu-item.p-ORANGE::before { background: var(--st-orange); }
.mail .menu-item.p-YELLOW::before { background: #b89400; }
.mail .menu-item.p-INFO::before   { background: var(--muted); opacity: .4; }
.mail .menu-item.has-draft::after {
  content: ""; position: absolute; right: 12px; top: 14px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--st-green);
}
.mail .menu-item.is-handled { opacity: .55; }
.mail .menu-item.is-handled .from { text-decoration: line-through; text-decoration-color: var(--hairline-2); }

/* Hover quick-actions on mail row (desktop) */
.mail .row-quick {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: none; gap: 4px; align-items: center;
  background: var(--solid-1); padding: 4px; border-radius: 8px;
  border: 1px solid var(--hairline-2); box-shadow: var(--sh-2);
}
.mail .menu-item:hover .row-quick { display: inline-flex; }
.mail .row-quick button {
  width: 28px; height: 28px; padding: 0; border: 0;
  background: transparent; color: var(--ink-2); border-radius: 6px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.mail .row-quick button:hover { background: var(--surface-3); color: var(--accent); }
.mail .row-quick button.danger:hover { background: rgba(184,57,47,.10); color: var(--st-red); }
.mail .row-quick svg { width: 14px; height: 14px; }

/* Filter chip strip above mail list */
.mail-filterbar {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid var(--hairline);
  background: var(--surface-2);
}
.mail-filterbar .chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: transparent; border: 1px solid var(--hairline);
  font-size: 11.5px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; transition: all .14s;
  white-space: nowrap;
}
.mail-filterbar .chip:hover { border-color: var(--hairline-2); color: var(--ink); }
.mail-filterbar .chip.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: rgba(0,120,127,.22);
}
html[data-theme="onyx"] .mail-filterbar .chip.active { border-color: rgba(78,195,206,.30); }
.mail-filterbar .chip-count { font-size: 10px; color: var(--muted); margin-left: 2px; }
.mail-filterbar .chip.active .chip-count { color: var(--accent); }
.mail-filterbar .chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }
.mail-filterbar .chip.f-RED .chip-dot { color: var(--st-red); opacity: 1; }
.mail-filterbar .chip.f-ORANGE .chip-dot { color: var(--st-orange); opacity: 1; }
.mail-filterbar .chip.f-DRAFT .chip-dot { color: var(--st-green); opacity: 1; }

/* Inbox-Zero progress pill */
.iz-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--hairline);
  font-size: 11.5px; color: var(--ink-2);
}
.iz-pill .iz-bar {
  position: relative; width: 84px; height: 6px;
  background: var(--surface-3); border-radius: 999px; overflow: hidden;
}
.iz-pill .iz-fill { position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent), var(--st-green)); border-radius: 999px;
  transition: width .4s ease;
}
.iz-pill b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Bulk-actions toolbar when chips applied or items selected */
.mail-bulkbar {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--hairline);
  background: var(--surface-1);
  font-size: 11.5px; color: var(--muted);
}
.mail-bulkbar .spacer { flex: 1; }
.mail-bulkbar .btn.sm { padding: 3px 10px; font-size: 11.5px; }

/* ---------- Mail list mobile - bigger tap targets, swipe affordance ---------- */
body.is-mobile .mail .layout { display: block; }
body.is-mobile .mail .list { max-height: none; border-radius: 12px; }
body.is-mobile .mail .menu-item {
  padding: 14px 14px 14px 18px;
  min-height: 64px;
}
body.is-mobile .mail .menu-item .from { font-size: 14px; font-weight: 600; }
body.is-mobile .mail .menu-item .subject { font-size: 13px; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
body.is-mobile .mail .menu-item .meta { font-size: 11px; }
body.is-mobile .mail .menu-item .snip { display: none; }
body.is-mobile .mail .row-quick { display: none !important; }

/* On mobile when a mail is opened, hide list, show detail full-bleed */
body.is-mobile .mail .layout.detail-open .list { display: none; }
body.is-mobile .mail .detail .back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px; margin-bottom: 10px;
  background: transparent; border: 1px solid var(--hairline);
  border-radius: 8px; color: var(--ink-2); cursor: pointer; font-size: 12px;
}
body.is-mobile .mail .detail .back-btn:hover { background: var(--surface-3); }
.mail .detail .back-btn { display: none; }

/* ---------- Kanban: move button on every card (mobile + desktop fallback) ---------- */
.kc-move {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer;
  margin-right: 2px;
}
.kc-move:hover { color: var(--accent); background: var(--surface-3); }
.kc-move svg { width: 13px; height: 13px; }
/* Also expose move via long-press anywhere on mobile cards */
body.is-mobile .kb-card { cursor: pointer; }
body.is-mobile .kb-card .kc-actions { gap: 6px; }
body.is-mobile .kc-move { width: 32px; height: 32px; }
body.is-mobile .kc-move svg { width: 18px; height: 18px; }
body.is-mobile .kc-open, body.is-mobile .kc-del, body.is-mobile .kc-run { width: 32px; height: 32px; }
body.is-mobile .kc-open { padding: 6px 10px; width: auto; }

/* On mobile kanban: drop horizontal scroll, stack columns vertically (one tab visible) */
body.is-mobile .kb-board { display: block !important; padding: 0; }
body.is-mobile .kb-board > .kb-col { width: 100%; max-width: none; min-width: 0; flex: none; margin-bottom: 12px; max-height: none; }
body.is-mobile .kb-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding: 4px; }
body.is-mobile .kb-tabs::-webkit-scrollbar { display: none; }
body.is-mobile .kb-tab { flex: 0 0 auto; }

/* ---------- Bottom-sheet modal (mobile-first, also works as a centered dialog on desktop) ---------- */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.32);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 800; backdrop-filter: blur(2px);
}
.sheet-overlay.show { display: flex; }
.sheet-card {
  background: var(--solid-1); border-top: 1px solid var(--hairline);
  border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.14);
  width: 100%; max-width: 560px;
  padding: 8px 0 calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  max-height: 78vh; overflow-y: auto;
}
.sheet-overlay.show .sheet-card { transform: translateY(0); }
.sheet-grip {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--hairline-2); margin: 8px auto 12px;
}
.sheet-title { font-size: 14px; font-weight: 600; color: var(--ink); padding: 0 20px 8px; }
.sheet-sub   { font-size: 12px; color: var(--muted); padding: 0 20px 12px; }
.sheet-list  { display: flex; flex-direction: column; }
.sheet-item  {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border: 0; background: transparent;
  text-align: left; cursor: pointer; color: var(--ink);
  font-size: 14px; width: 100%;
  border-top: 1px solid var(--hairline);
}
.sheet-item:first-child { border-top: 0; }
.sheet-item:hover { background: var(--surface-2); }
.sheet-item.active { background: var(--accent-soft); color: var(--accent); }
.sheet-item .lane-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
}
.sheet-item.lane-OPEN .lane-dot        { background: var(--st-blue); }
.sheet-item.lane-IN_PROGRESS .lane-dot { background: var(--accent); }
.sheet-item.lane-WAITING .lane-dot     { background: var(--st-orange); }
.sheet-item.lane-ESCALATED .lane-dot   { background: var(--st-red); }
.sheet-item.lane-DELEGATED .lane-dot   { background: #7a39bb; }
.sheet-item.lane-DONE .lane-dot        { background: var(--st-green); }
.sheet-item.lane-INFO .lane-dot        { background: var(--muted); }
.sheet-item .lane-label { flex: 1; }
.sheet-item .lane-meta  { font-size: 11.5px; color: var(--muted); }
.sheet-item .lane-check { color: var(--accent); }
.sheet-divider { height: 1px; background: var(--hairline); margin: 8px 0; }
.sheet-cancel  {
  width: calc(100% - 40px); margin: 8px 20px 0;
  padding: 12px; border: 1px solid var(--hairline-2);
  border-radius: 12px; background: var(--surface-2);
  font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.sheet-cancel:hover { background: var(--surface-3); }

/* Centered dialog variant on desktop (≥760px) */
@media (min-width: 760px) {
  .sheet-overlay { align-items: center; }
  .sheet-card { border-radius: 16px; transform: scale(.96); transition: transform .2s, opacity .2s; opacity: 0; max-height: 80vh; }
  .sheet-overlay.show .sheet-card { transform: scale(1); opacity: 1; }
}

/* Long-press indicator */
.kb-card.lp-active {
  outline: 2px solid var(--accent); outline-offset: -2px;
  transform: scale(.99);
}
