/* ==========================================================================
   Task Automation Platform — single stylesheet
   No build step, no framework. Design tokens first, then layout, then parts.
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f0f2f5;
  --border: #dfe3e8;
  --border-strong: #c4cbd4;

  --text: #1a1f26;
  --text-2: #545c66;
  --text-3: #858e99;

  --accent: #2b5fd9;
  --accent-hover: #1f4bb8;
  --accent-soft: #eaf0ff;
  --accent-border: #b9cbf7;

  --ok: #17794c;
  --ok-soft: #e3f5ea;
  --ok-border: #a8ddc0;

  --warn: #9a6200;
  --warn-soft: #fdf3e0;
  --warn-border: #f0d49a;

  --danger: #b3261e;
  --danger-soft: #fdecea;
  --danger-border: #f3bfba;

  --info: #0b6b83;
  --info-soft: #e4f4f8;
  --info-border: #a5d9e5;

  --purple: #6b3fa0;
  --purple-soft: #f2ecfa;
  --purple-border: #d2c0ea;

  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 4px 12px rgba(16, 24, 40, .1), 0 12px 28px rgba(16, 24, 40, .08);

  --sidebar-w: 236px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #22262e;
    --surface-3: #282d36;
    --border: #333a44;
    --border-strong: #454e5b;

    --text: #e8eaed;
    --text-2: #a8b0ba;
    --text-3: #7c848f;

    --accent: #7ba1f5;
    --accent-hover: #97b5f8;
    --accent-soft: #1e2942;
    --accent-border: #35507f;

    --ok: #6ede9f;
    --ok-soft: #16291f;
    --ok-border: #2c5340;

    --warn: #f0c070;
    --warn-soft: #2b2113;
    --warn-border: #574328;

    --danger: #f79188;
    --danger-soft: #2d1817;
    --danger-border: #5c2f2b;

    --info: #78ccdf;
    --info-soft: #14262b;
    --info-border: #2b4c56;

    --purple: #c0a3e8;
    --purple-soft: #241d33;
    --purple-border: #453763;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .25);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, .4), 0 12px 28px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h4 { font-size: 13px; }

p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

code, kbd, .mono { font-family: var(--mono); font-size: .92em; }

mark {
  background: var(--warn-soft);
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
  box-shadow: inset 0 -1px 0 var(--warn-border);
}

hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

::placeholder { color: var(--text-3); }

/* ==========================================================================
   Layout
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-name { font-weight: 650; font-size: 14px; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.nav { padding: 10px 8px; flex: 1; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  padding: 0 8px 6px;
  font-weight: 600;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 1px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.nav a .ico { width: 15px; text-align: center; opacity: .85; flex: 0 0 15px; }
.nav a .label { flex: 1; }

.nav-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.nav-badge.warn { background: var(--warn); }
@media (prefers-color-scheme: dark) {
  .nav-badge { color: #0f1319; }
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 12px;
}
.who { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.avatar {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.who-name { font-weight: 550; font-size: 12px; }
.who-role { color: var(--text-3); font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { flex: 1; min-width: 0; }
.topbar .sub { color: var(--text-3); font-size: 12px; font-weight: 400; margin-left: 8px; }

.content { padding: 20px 22px 48px; max-width: 1500px; width: 100%; }

.dry-banner {
  background: var(--warn-soft);
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn);
  padding: 7px 22px;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

/* ==========================================================================
   Grid helpers
   ========================================================================== */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

@media (max-width: 1200px) {
  .grid.cols-5, .grid.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.split, .grid.split-even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5, .grid.cols-6 { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; transform: translateX(-100%); z-index: 60; transition: transform .18s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 10px 14px; }
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head h2, .card-head h3 { flex: 1; min-width: 0; }
.card-body { padding: 14px; }
.card-body.flush { padding: 0; }
.card-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: block;
  color: inherit;
}
.stat:hover { border-color: var(--border-strong); text-decoration: none; }
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  font-weight: 600;
}
.stat-value { font-size: 26px; font-weight: 660; line-height: 1.1; margin-top: 4px; letter-spacing: -.02em; }
.stat-note { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.stat.attention .stat-value { color: var(--danger); }
.stat.warn .stat-value { color: var(--warn); }
.stat.good .stat-value { color: var(--ok); }
.stat.accent .stat-value { color: var(--accent); }

/* ==========================================================================
   Pills / badges
   ========================================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.6;
}
.pill.requested { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.pill.ready     { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.pill.progress  { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.pill.review    { background: var(--purple-soft); color: var(--purple); border-color: var(--purple-border); }
.pill.qa        { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.pill.blocked   { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.pill.done      { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.pill.cancelled { background: var(--surface-3); color: var(--text-3); border-color: var(--border); text-decoration: line-through; }

.pill.critical { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.pill.high     { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.pill.medium   { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.pill.low      { background: var(--surface-3); color: var(--text-3); border-color: var(--border); }

.pill.jira { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.pill.gtasks { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.pill.ghost { background: transparent; color: var(--text-3); border-color: var(--border); }
.pill.dry { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-2);
  font-family: var(--mono);
}

.confidence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.confidence .bar {
  width: 34px; height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  border: 1px solid var(--border);
}
.confidence .bar span { display: block; height: 100%; }
.confidence.high { color: var(--ok); }
.confidence.high .bar span { background: var(--ok); }
.confidence.medium { color: var(--warn); }
.confidence.medium .bar span { background: var(--warn); }
.confidence.low { color: var(--danger); }
.confidence.low .bar span { background: var(--danger); }

.due.overdue { color: var(--danger); font-weight: 650; }
.due.urgent { color: var(--warn); font-weight: 650; }
.due.soon { color: var(--text); }
.due.unset { color: var(--text-3); font-style: italic; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .task-id { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
table.data .primary { font-weight: 550; }
table.data .muted { color: var(--text-3); font-size: 12px; }
table.data td.shrink { width: 1%; }

.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty .big { font-size: 26px; margin-bottom: 6px; opacity: .5; }
.empty p { max-width: 44ch; margin: 0 auto 4px; }

/* ==========================================================================
   Forms
   ========================================================================== */
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
label .opt { font-weight: 400; color: var(--text-3); text-transform: none; }

input[type="text"], input[type="password"], input[type="email"], input[type="date"],
input[type="time"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
}
textarea { resize: vertical; min-height: 72px; }
textarea.tall { min-height: 220px; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  cursor: not-allowed;
}

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; min-width: 0; }
@media (max-width: 700px) { .field-row { flex-direction: column; } }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.check input { width: auto; margin: 2px 0 0; flex: 0 0 auto; }
.check label { margin: 0; font-weight: 500; color: var(--text); font-size: 13px; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; }
legend { font-size: 12px; font-weight: 650; color: var(--text-2); padding: 0 6px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.success:hover { filter: brightness(1.08); }
.btn.danger { background: var(--surface); border-color: var(--danger-border); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.lg { padding: 10px 18px; font-size: 14px; }
.btn.block { width: 100%; }

@media (prefers-color-scheme: dark) {
  .btn.primary, .btn.success, .btn.danger-solid { color: #0f1319; }
}

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); z-index: 1; }

/* ==========================================================================
   Alerts / flash
   ========================================================================== */
.flashes { position: sticky; top: 0; z-index: 30; }

.alert {
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.alert .ico { flex: 0 0 auto; font-size: 14px; line-height: 1.4; }
.alert .msg { flex: 1; min-width: 0; }
.alert .close {
  background: none; border: 0; cursor: pointer; color: inherit;
  opacity: .55; font-size: 15px; padding: 0 2px; line-height: 1;
}
.alert .close:hover { opacity: 1; }

.alert.success { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.alert.error   { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.alert.warning { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.alert.info    { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }

.inline-error {
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.callout {
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
}
.callout.warn { background: var(--warn-soft); border-color: var(--warn-border); }
.callout.danger { background: var(--danger-soft); border-color: var(--danger-border); }
.callout.info { background: var(--info-soft); border-color: var(--info-border); }
.callout.accent { background: var(--accent-soft); border-color: var(--accent-border); }
.callout h4 { margin-bottom: 4px; }

/* ==========================================================================
   Review screen (table + detail pane)
   ========================================================================== */
.review-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 1100px) { .review-layout { grid-template-columns: minmax(0, 1fr); } }

.queue-list { max-height: calc(100vh - 230px); overflow-y: auto; }

.queue-item {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  cursor: pointer;
}
.queue-item:hover { background: var(--surface-2); text-decoration: none; }
.queue-item.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.queue-item .qi-top { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.queue-item .qi-title { font-weight: 550; font-size: 13px; flex: 1; min-width: 0; }
.queue-item .qi-meta { font-size: 11.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; }
.queue-item .qi-flags { margin-top: 5px; display: flex; gap: 4px; flex-wrap: wrap; }

.detail-section { padding: 14px; border-bottom: 1px solid var(--border); }
.detail-section:last-child { border-bottom: 0; }
.detail-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 8px;
}

.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); font-size: 12px; }
.kv dd { margin: 0; }
@media (max-width: 640px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } .kv dd { margin-bottom: 8px; } }

.snippet {
  background: var(--surface-3);
  border-left: 3px solid var(--border-strong);
  padding: 9px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
}
.snippet.quote { font-style: italic; }

.transcript-view {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 520px;
  overflow-y: auto;
}

.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  position: sticky;
  bottom: 0;
}

/* ==========================================================================
   Duplicate comparison
   ========================================================================== */
.compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
@media (max-width: 900px) { .compare { grid-template-columns: minmax(0, 1fr); } }

.compare-side { padding: 14px; }
.compare-side + .compare-side { border-left: 1px solid var(--border); }
@media (max-width: 900px) {
  .compare-side + .compare-side { border-left: 0; border-top: 1px solid var(--border); }
}
.compare-side h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.compare-side.proposed { background: var(--accent-soft); }
.compare-side.existing { background: var(--surface-2); }

.score-ring {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 3px solid var(--warn);
  color: var(--warn);
  font-weight: 700;
  flex: 0 0 62px;
}
.score-ring.strong { border-color: var(--danger); color: var(--danger); }
.score-ring.weak { border-color: var(--border-strong); color: var(--text-2); }
.score-ring .num { font-size: 17px; line-height: 1; }
.score-ring .lbl { font-size: 8.5px; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }

.reasons { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); }
.reasons li { margin-bottom: 3px; }

.resolve-options { display: grid; gap: 8px; }
.resolve-option {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: var(--surface);
}
.resolve-option:hover { border-color: var(--accent); background: var(--surface-2); }
.resolve-option input { width: auto; margin: 3px 0 0; flex: 0 0 auto; }
.resolve-option .ro-title { font-weight: 600; font-size: 13px; }
.resolve-option .ro-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.resolve-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ==========================================================================
   Timeline
   ========================================================================== */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 14px 20px;
  border-left: 2px solid var(--border);
  margin-left: 5px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px; top: 4px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
}
.timeline li.accent::before { border-color: var(--accent); }
.timeline li.ok::before { border-color: var(--ok); }
.timeline li.danger::before { border-color: var(--danger); }
.timeline .tl-when { font-size: 11px; color: var(--text-3); }
.timeline .tl-what { font-size: 13px; }

/* ==========================================================================
   Workflow strip
   ========================================================================== */
.workflow { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.workflow .step {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-weight: 550;
}
.workflow .step.done { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.workflow .step.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.workflow .arrow { color: var(--text-3); font-size: 11px; }
@media (prefers-color-scheme: dark) { .workflow .step.current { color: #0f1319; } }

/* ==========================================================================
   Agenda output
   ========================================================================== */
.agenda {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 640px;
  overflow-y: auto;
}

.bucket-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.bucket {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: var(--surface-2);
}
.bucket .b-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 600; }
.bucket .b-count { font-size: 20px; font-weight: 650; }
.bucket.hot { background: var(--danger-soft); border-color: var(--danger-border); }
.bucket.hot .b-count { color: var(--danger); }
.bucket.warm { background: var(--warn-soft); border-color: var(--warn-border); }
.bucket.warm .b-count { color: var(--warn); }
.bucket.cool { background: var(--ok-soft); border-color: var(--ok-border); }
.bucket.cool .b-count { color: var(--ok); }

/* ==========================================================================
   Filter bar
   ========================================================================== */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.filters .f { min-width: 130px; }
.filters .f.grow { flex: 1; min-width: 190px; }
.filters label { margin-bottom: 3px; }

/* ==========================================================================
   Login
   ========================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.login-card { width: 100%; max-width: 372px; }
.login-head { text-align: center; margin-bottom: 18px; }
.login-head .mark {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
  margin-bottom: 10px;
}
.login-head h1 { font-size: 18px; }
.login-head p { color: var(--text-3); font-size: 13px; margin-top: 4px; }

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ==========================================================================
   Utilities
   ========================================================================== */
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.strong { font-weight: 650; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.text-right { text-align: right; }
.center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break { word-break: break-word; overflow-wrap: anywhere; }
.pre-wrap { white-space: pre-wrap; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.full { width: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

details.disclose > summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  padding: 5px 0;
}
details.disclose > summary:hover { color: var(--text); }
details.disclose[open] > summary { margin-bottom: 8px; }

.menu-toggle { display: none; }
@media (max-width: 820px) { .menu-toggle { display: inline-flex; } }

.htmx-request .htmx-indicator { display: inline; }
.htmx-indicator { display: none; }
.htmx-request.btn { opacity: .65; pointer-events: none; }

/* --- busy feedback -------------------------------------------------------
   Server round-trips here can take seconds (AI extraction, Jira/Google writes),
   and a button that looks untouched reads as a hung app. Three layers, each
   appearing only when it is still useful: the button itself, a page-top bar,
   and -- once the wait is long enough to worry about -- a blocking overlay. */
.btn.is-busy {
  position: relative;
  pointer-events: none;                 /* not `disabled`: that drops the
                                           button's name/value from the POST */
  color: transparent !important;
}
.btn.is-busy::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 13px; height: 13px;
  margin: -7px 0 0 -7px;
  border: 2px solid currentcolor;
  border-color: rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
/* Light-background buttons need a dark spinner to be visible at all. */
.btn.is-busy:not(.primary):not(.success):not(.danger-solid)::after {
  border-color: var(--border);
  border-top-color: var(--text-2);
}
.btn.is-busy .htmx-indicator { display: none; }
form.is-busy input, form.is-busy select, form.is-busy textarea { opacity: .75; }

@keyframes spin { to { transform: rotate(360deg); } }

.page-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 200;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  opacity: 0;
  transition: width .25s ease, opacity .25s ease;
}
.page-progress.on { opacity: 1; }

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 190;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 12, 17, .38);
  backdrop-filter: blur(1.5px);
  opacity: 0;
  transition: opacity .18s ease;
}
.busy-overlay.on { opacity: 1; }
.busy-overlay .box {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.busy-overlay .box::before {
  content: "";
  width: 15px; height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .btn.is-busy::after, .busy-overlay .box::before { animation-duration: 1.6s; }
  .page-progress { transition: none; }
}

@media print {
  .sidebar, .topbar, .action-bar, .filters, .btn, .flashes { display: none !important; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  .agenda { max-height: none; border: 0; background: none; }
}
