/* LRA Agent Monitor
   Neutral surfaces, one red accent (selection, focus, primary action,
   Max badge), and status as the only other color on screen. */

:root {
  --ink: #1f2129;
  --ink-2: #4a4e5a;
  --muted: #7a7f8c;
  --faint: #a4a8b3;
  --line: #e8e9ee;
  --line-2: #f0f1f4;
  --canvas: #ffffff;
  --surface: #f7f8fa;
  --hover: #f1f2f5;

  --accent: #df282f;
  --accent-ink: #b71c22;
  --accent-tint: #fdeeee;
  --accent-ring: rgba(223, 40, 47, 0.28);
  --accent-soft: #f5c0c2;

  --blue: #2f7cf6;   --blue-ink: #1b5fd4;   --blue-tint: #eaf2ff;
  --green: #1f9d62;  --green-ink: #167a4b;  --green-tint: #e6f6ee;
  --red: #e5484d;    --red-ink: #c4262e;    --red-tint: #fdecec;
  --amber: #e39a0b;  --amber-ink: #945800;  --amber-tint: #fff4df;
  --gray: #8b8f9a;   --gray-ink: #4b4f5c;   --gray-tint: #f1f2f5;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

button { font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- App shell ---------- */

.app {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---------- Top bar: usage strip (rendered by app.js) + New task ---------- */

.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}

#usage-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 20px;
  white-space: nowrap;
  overflow-x: auto;
  font-size: 13px;
}
#queue-bar { padding: 8px 20px 10px; border-bottom: 1px solid var(--line); background: var(--canvas); font-size: 13px; }
#queue-bar .q-head { display: flex; flex-wrap: wrap; gap: 4px 14px; font-weight: 600; margin-bottom: 6px; }
#queue-bar .q-hint { font-weight: 400; color: var(--muted); }
#queue-bar .q-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 2fr) auto; gap: 12px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line); }
#queue-bar .q-title, #queue-bar .q-why, #queue-bar .q-client { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#queue-bar .q-why, #queue-bar .q-client, #queue-bar .q-pending { color: var(--muted); }
#queue-bar .q-actions { display: flex; gap: 6px; }
#queue-bar .q-btn { padding: 2px 10px; font-size: 12px; }
#queue-bar .q-remove { color: var(--muted); }
#queue-bar .q-rush { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #fdf0d5; color: #8a5a00; }
@media (max-width: 760px) {
  #queue-bar .q-row { grid-template-columns: 1fr auto; }
  #queue-bar .q-client, #queue-bar .q-why { display: none; }
}
#usage-bar .u-item { display: flex; flex-direction: column; gap: 1px; position: relative; flex: 0 0 auto; }
#usage-bar .u-label { font-size: 12px; color: var(--muted); }
#usage-bar .u-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
#usage-bar .u-value.warn { color: var(--amber-ink); }
#usage-bar .u-value.bad { color: var(--red-ink); }
#usage-bar .u-value.muted { color: var(--faint); }
#usage-bar .u-sub { font-size: 11px; color: var(--faint); }
#usage-bar .u-note a { color: inherit; text-decoration: underline; }
#usage-bar .u-item.has-tip .u-label { cursor: help; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
#usage-bar .u-tip {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 50;
  width: 300px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; white-space: normal;
  color: var(--ink); background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(31, 33, 41, 0.12);
}
#usage-bar .u-item.has-tip:hover .u-tip { display: block; }
#usage-bar .u-spark { display: flex; align-items: flex-end; gap: 3px; height: 24px; flex: 0 0 auto; }
#usage-bar .u-spark span { width: 6px; background: var(--accent-soft); border-radius: 2px; }
#usage-bar .u-spark span.today { background: var(--accent); }
#usage-bar .u-note { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--faint); flex: 0 0 auto; }
#usage-bar.error { color: var(--red-ink); }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 320px;
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 4px;
}
.sidebar-header h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

.sidebar-header-right { display: flex; align-items: center; gap: 10px; }

.logout-button {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-sm);
}
.logout-button:hover { background: var(--hover); color: var(--ink); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-connected { background: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.dot-unknown { background: var(--faint); }
.dot-error { background: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }

.sidebar-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 8px;
}
.task-search {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--canvas);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}
.task-search::placeholder { color: var(--faint); }
.task-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.list-divider {
  margin: 12px 8px 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}

.archive-toggle-link {
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 6px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.archive-toggle-link:hover { color: var(--ink); background: var(--hover); }

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-card {
  position: relative;
  padding: 10px 12px 10px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.task-card:hover { background: var(--hover); }
.task-card::before {
  content: "";
  position: absolute;
  left: 3px; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 2px;
  background: transparent;
}
.task-card.stuck::before { background: var(--red); }
.task-card.needs-input::before { background: var(--amber); }
.task-card.quiet::before { background: var(--amber); }
.task-card.active { background: var(--canvas); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(31, 33, 41, 0.04); }
.task-card.active::before { background: var(--accent); }

.task-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-card .client { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-group-count {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  color: var(--muted);
  background: var(--line-2);
  border-radius: 9px;
}
.task-card .meta {
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-card-bottom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.task-time { font-size: 12px; color: var(--faint); }

/* ---------- Badges: status pills and mode tags ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--gray-ink);
  background: var(--gray-tint);
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gray);
}
.badge-in_progress { color: var(--blue-ink); background: var(--blue-tint); }
.badge-in_progress::before { background: var(--blue); animation: pulse 1.8s ease-in-out infinite; }
.badge-in_testing { color: var(--accent-ink); background: var(--accent-tint); }
.badge-in_testing::before { background: var(--accent); }
.badge-sent_for_approval { color: var(--green-ink); background: var(--green-tint); }
.badge-sent_for_approval::before { background: var(--green); }
.badge-stuck, .badge-blocked { color: var(--red-ink); background: var(--red-tint); }
.badge-stuck::before, .badge-blocked::before { background: var(--red); }
.badge-need_user_info { color: var(--amber-ink); background: var(--amber-tint); }
.badge-need_user_info::before { background: var(--amber); }
.badge-quiet { color: var(--amber-ink); background: var(--amber-tint); }
.badge-quiet::before { background: var(--amber); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Mode tags are square-ish and dotless so they never read as a status. */
.badge-mode {
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 11.5px;
}
.badge-mode::before { display: none; }
.badge-mode-max { color: var(--accent-ink); background: var(--accent-tint); }
.badge-mode-api { color: var(--amber-ink); background: var(--amber-tint); }
.badge-mode-billed { color: var(--amber-ink); background: var(--amber-tint); }
.badge-mcp { color: var(--green-ink); background: var(--green-tint); }
.badge-mode-unknown { display: none; }

/* ---------- Main column ---------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
}

.empty-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.task-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.task-view-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.th-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.th-main h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.th-subtitle {
  margin: -2px 0 0;
  font-size: 14px;
  color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.th-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.task-duration { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.th-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--canvas); color: var(--ink); box-shadow: 0 1px 2px rgba(31, 33, 41, 0.08); }
.btn-danger { color: var(--red-ink); }
.btn-danger:hover { background: var(--red-tint); color: var(--red-ink); box-shadow: none; }
.btn:disabled { opacity: 0.55; cursor: default; }

.mobile-back-button {
  display: none;
  border: none;
  background: none;
  color: var(--ink-2);
  padding: 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.mobile-back-button:hover { background: var(--hover); }

/* ---------- Activity feed ---------- */

.event-log-container { position: relative; flex: 1; min-height: 0; }

.event-log {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 24px 24px 32px;
  display: flex;
  flex-direction: column;
}
.event-log > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }

.empty-state { color: var(--muted); font-size: 13px; margin: 0; }

/* Agent message: transcript style, no bubble. */
.msg-agent {
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 12px;
  margin-top: 18px;
}
.msg-agent.cont { margin-top: 6px; }
.msg-agent.cont .msg-avatar, .msg-agent.cont .msg-head { visibility: hidden; height: 0; }
.msg-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-name { font-weight: 700; font-size: 13.5px; }
.msg-time { font-size: 12px; color: var(--faint); }
.msg-body { grid-column: 2; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.msg-body p { margin: 0 0 8px; }
.msg-body p:last-child, .msg-body ul:last-child { margin-bottom: 0; }
.msg-body ul { margin: 2px 0 8px; padding-left: 20px; }
.msg-body li { margin: 2px 0; }
.msg-body li.nested { margin-left: 18px; list-style: circle; }
.msg-body code {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--line-2);
}

/* Your notes: right-aligned accent bubble. */
.msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 18px;
}
.msg-user .msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  background: var(--accent-tint);
  color: var(--ink);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.msg-user .msg-time { margin-top: 4px; }

/* System lines: session start/resume, usage, delivery confirmations. */
.msg-system {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.msg-system::before, .msg-system::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg-system span { max-width: 80%; text-align: center; line-height: 1.4; }

/* Collapsed tool runs. */
.tool-group { grid-column: 2; margin-top: 8px; padding-left: 40px; }
.tool-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 6px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.tool-toggle:hover { background: var(--hover); color: var(--ink-2); }
.tool-toggle svg { transition: transform 0.15s ease; }
.tool-group.open .tool-toggle svg { transform: rotate(90deg); }
.tool-toggle .tool-errors { color: var(--red-ink); }
.tool-list {
  display: none;
  margin: 4px 0 2px 12px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.tool-group.open .tool-list { display: block; }
.tool-line {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
}
.tool-line .t-name { flex: 0 0 auto; font-weight: 600; }
.tool-line .t-arg {
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-line .t-time { margin-left: auto; flex: 0 0 auto; font-size: 11.5px; color: var(--faint); }
.tool-line.error .t-name, .tool-line.error .t-arg { color: var(--red-ink); white-space: normal; }
.tool-loading { font-size: 12px; color: var(--faint); padding: 4px 0; }

.load-earlier {
  align-self: center;
  margin: 0 auto 8px;
  width: auto !important;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--canvas);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.load-earlier:hover { color: var(--ink); border-color: #d9dbe2; }
.load-earlier:disabled { opacity: 0.6; cursor: default; }

.scroll-bottom-btn {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--canvas);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(31, 33, 41, 0.1);
  cursor: pointer;
}

/* ---------- Composer ---------- */

.interjection-form { padding: 12px 24px 18px; }
.composer {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--canvas);
  box-shadow: 0 1px 3px rgba(31, 33, 41, 0.05);
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.composer input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
}
.composer input::placeholder { color: var(--faint); }
.composer input:disabled { cursor: not-allowed; }
.composer button {
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.composer button:hover { background: var(--accent-ink); }
.composer button:disabled { background: var(--line); color: var(--faint); cursor: default; }

/* ---------- Right panel ---------- */

.screenshot-panel {
  width: 320px;
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
  min-height: 0;
}
.screenshot-panel-header { padding: 18px 18px 10px; }
.screenshot-panel-header h3 { margin: 0; font-size: 14px; font-weight: 700; }
.screenshot-panel-body { flex: 1; overflow-y: auto; padding: 0 18px 18px; display: flex; flex-direction: column; gap: 20px; }

.shot-frame {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--canvas);
  overflow: hidden;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shot-frame img { display: block; width: 100%; height: auto; }
.shot-frame .empty-state { padding: 20px; }

.group-totals h4, .related-conversations h4 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.group-totals-value { margin: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.related-list { display: flex; flex-direction: column; gap: 6px; }
.related-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--canvas);
  cursor: pointer;
}
.related-item:hover { border-color: #d9dbe2; }
.related-item-top { display: flex; align-items: center; gap: 8px; }
.related-item-label {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- New task button + modal ---------- */

.new-task-button {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.new-task-button:hover { background: var(--accent-ink); }

.new-task-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(31, 33, 41, 0.4);
}
.new-task-overlay.open { display: flex; }
.new-task-box {
  width: 100%;
  max-width: 560px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--canvas);
  box-shadow: 0 12px 40px rgba(31, 33, 41, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.new-task-box h3 { margin: 0; font-size: 16px; font-weight: 700; }
.new-task-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.new-task-box textarea {
  width: 100%;
  min-height: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
}
.new-task-box textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.new-task-error { margin: 0; font-size: 12.5px; color: var(--red-ink); }
.new-task-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.new-task-actions .kbd-hint { margin-right: auto; font-size: 12px; color: var(--faint); }
.new-task-cancel {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.new-task-cancel:hover { background: var(--hover); }
.new-task-submit {
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.new-task-submit:hover { background: var(--accent-ink); }
.new-task-submit:disabled { background: var(--line); color: var(--faint); cursor: default; }

/* ---------- Login ---------- */

.login-screen {
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}
.login-form {
  width: 100%;
  max-width: 340px;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 30px rgba(31, 33, 41, 0.06);
}
.login-form h1 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.login-form input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
}
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.login-form button {
  height: 40px;
  border: none;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
}
.login-form button:hover { background: var(--accent-ink); }
.login-error { color: var(--red-ink); font-size: 12.5px; margin: 4px 0 0; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .screenshot-panel { display: none !important; }
}

@media (max-width: 720px) {
  .sidebar { width: 100%; flex: 1 1 auto; border-right: none; }
  #app-root:not(.mobile-task-open) .main { display: none !important; }
  #app-root.mobile-task-open .sidebar { display: none !important; }
  .mobile-back-button { display: inline-flex; }
  .task-view-header { padding: 12px 14px; gap: 10px; }
  .th-main h2 { font-size: 17px; }
  .btn span { display: none; }
  .event-log { padding: 16px 14px 24px; }
  .tool-group { padding-left: 0; }
  .interjection-form { padding: 10px 12px 14px; }
  #usage-bar { padding: 8px 14px; gap: 20px; }
  .top-bar { padding-right: 12px; }
  .new-task-actions .kbd-hint { display: none; }
}

/* ---------- Hub: Levi's left nav, status bar, pages ---------- */

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

.hub-nav {
  width: 84px;
  flex: 0 0 84px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 14px 8px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.hub-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 2px 0 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.hub-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--line); }
.hub-name { font-weight: 700; font-size: 13px; letter-spacing: 0.01em; }
.hub-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 8px;
  border-radius: var(--r-md);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
}
.hub-link:hover { background: var(--hover); color: var(--ink); }
.hub-link.active { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }

/* Status bar (left side of the top bar) */
.levi-status {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 20px;
  font-size: 13px;
  color: var(--ink);
}
.ls-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.ls-ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.ls-warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-tint); }
.ls-off { background: var(--gray); box-shadow: 0 0 0 3px var(--gray-tint); }
.ls-dim, .ls-note { color: var(--muted); }
.ls-task {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ls-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gray-tint);
  color: var(--gray-ink);
  font-size: 12px;
  font-weight: 500;
}
.ls-chip-warn { background: var(--amber-tint); color: var(--amber-ink); }

/* Pages other than the feed */
.hub-page { flex: 1; overflow: auto; padding: 28px 32px 40px; }
.page-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.page-head p { margin: 0 0 22px; color: var(--muted); }
.page-empty {
  max-width: 560px;
  padding: 22px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.page-empty h3 { margin: 0 0 6px; font-size: 15px; }
.page-empty p { margin: 0; color: var(--ink-2); line-height: 1.5; }

/* Phones: the nav becomes a bar along the bottom */
@media (max-width: 720px) {
  .hub { flex-direction: column; }
  .hub-nav {
    order: 2;
    width: auto;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border-right: none;
    border-top: 1px solid var(--line);
  }
  .hub-brand { display: none; }
  .hub-link { flex: 1; padding: 6px 4px; }
  .levi-status { padding: 10px 12px; }
  .ls-task { max-width: 180px; }
  .hub-page { padding: 20px 16px 28px; }
}

/* ---------- Runs page ---------- */

.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head-row .new-task-button { flex: 0 0 auto; margin-top: 2px; }

.runs-notice {
  max-width: 760px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--green-tint);
  color: var(--green-ink);
  line-height: 1.45;
}
.runs-notice[data-tone="error"] { background: var(--red-tint); color: var(--red-ink); }

.runs-list { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }

.run-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px 12px;
  background: var(--canvas);
}
.run-card.run-off { background: var(--surface); }
.run-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.run-title h3 { margin: 0 0 3px; font-size: 15px; font-weight: 650; }
.run-when { margin: 0; color: var(--ink-2); font-size: 13px; }
.run-instructions { margin: 10px 0 12px; color: var(--ink-2); line-height: 1.5; white-space: pre-line; }
.run-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 13px; }
.run-meta .badge { margin-right: 4px; }
.run-dim { color: var(--muted); }
.run-untested { color: var(--amber-ink); font-weight: 500; }
.run-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.run-actions .run-delete { margin-left: auto; color: var(--red-ink); }
.run-byline { margin: 10px 0 0; font-size: 12px; color: var(--faint); }

.run-history { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.run-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.run-history-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.run-history-list .link-button { margin-left: auto; }

.link-button {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* On/off switch */
.run-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; flex: 0 0 auto; }
.run-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.run-switch-track {
  width: 36px; height: 20px; border-radius: 999px;
  background: var(--line); position: relative; transition: background 0.15s;
}
.run-switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 0.15s;
}
.run-switch input:checked + .run-switch-track { background: var(--green); }
.run-switch input:checked + .run-switch-track::after { transform: translateX(16px); }
.run-switch input:focus-visible + .run-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.run-switch-label { font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 22px; }
.run-switch.disabled { cursor: not-allowed; opacity: 0.55; }

/* Editor */
.run-box { max-width: 560px; }
.run-field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.run-label { font-weight: 600; font-size: 13px; }
.run-help { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.run-field input[type="text"], .run-field textarea, .run-field select, .run-field input[type="time"] {
  font: inherit; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; background: var(--canvas);
}
.run-field textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.run-field input:focus, .run-field textarea:focus, .run-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.run-when-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.run-at { color: var(--muted); }
.run-choice { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.run-choice input { accent-color: var(--accent); }

@media (max-width: 720px) {
  .page-head-row { flex-direction: column; }
  .run-top { flex-direction: column; }
  .run-actions .run-delete { margin-left: 0; }
}

/* ---------- LRA branding ---------- */

:root {
  --display: "p22-mackinac-pro", Georgia, "Times New Roman", serif;
  --charcoal: #262626;
  --charcoal-2: #333130;
}

h1, h2, .page-head h2, .run-title h3, .dash-card-head h3, #task-title, .sidebar-header h1, .new-task-box h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.005em;
}

.lra-mark {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px;
  background: var(--accent);
}

/* Nav: charcoal, like the site's top bar */
.hub-nav { background: var(--charcoal); border-right: none; }
.hub-brand { border-bottom-color: rgba(255, 255, 255, 0.1); }
.hub-name {
  color: #fff; font-size: 11px; font-weight: 700; text-align: center;
  line-height: 1.15; letter-spacing: 0.06em; text-transform: uppercase;
}
.hub-link { color: rgba(255, 255, 255, 0.72); }
.hub-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.hub-link.active { background: var(--accent); color: #fff; }

/* Login */
.login-screen { background: linear-gradient(160deg, var(--charcoal) 0%, #3b342c 100%); }
.login-form { border: none; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); padding: 34px 30px 30px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.lra-word { font-weight: 800; font-size: 22px; letter-spacing: 0.08em; color: var(--charcoal); }
.login-form h1 { font-size: 28px; margin: 0; }
.login-sub { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; line-height: 1.45; }

/* Status badges the worker uses */
.badge-done { color: var(--green-ink); background: var(--green-tint); }
.badge-done::before { background: var(--green); }
.badge-failed { color: var(--red-ink); background: var(--red-tint); }
.badge-failed::before { background: var(--red); }
.badge-queued, .badge-stopped { color: var(--gray-ink); background: var(--gray-tint); }
.badge-queued::before, .badge-stopped::before { background: var(--gray); }

/* ---------- Dashboard ---------- */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  max-width: 1240px;
}
.dash-card {
  display: flex; flex-direction: column;
  min-height: 150px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--canvas);
}
.dash-wide { grid-column: span 2; }
.dash-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dash-card-head h3 { margin: 0; font-size: 18px; }
.dash-link { font-size: 12.5px; white-space: nowrap; }
.dash-card-body { flex: 1; display: flex; flex-direction: column; gap: 10px; }

.dash-headline { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17px; font-weight: 600; }
.dash-line { margin: 0; color: var(--ink-2); }
.dash-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-empty { margin: 0; color: var(--muted); }
.dash-callout { margin: 0; padding: 8px 10px; border-radius: var(--r-md); background: var(--amber-tint); color: var(--amber-ink); font-size: 13px; }

.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 10px; }
.dash-stat { display: flex; flex-direction: column; gap: 2px; }
.dash-stat-n { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1; color: var(--ink); }
.dash-stat-l { font-size: 12px; color: var(--muted); }
.dash-stat-ok .dash-stat-n { color: var(--green-ink); }
.dash-stat-warn .dash-stat-n { color: var(--amber-ink); }
.dash-stat-bad .dash-stat-n { color: var(--red-ink); }

.dash-list, .dash-plain { list-style: none; margin: 0; padding: 0; }
.dash-row {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; margin: 0 -8px;
  border: none; border-radius: var(--r-md); background: none;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.dash-row:hover { background: var(--hover); }
.dash-row-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-side { color: var(--muted); font-size: 12px; white-space: nowrap; }
.dash-plain li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-top: 1px solid var(--line-2); font-size: 13px;
}
.dash-plain li:first-child { border-top: none; padding-top: 0; }
.dash-msg { justify-content: flex-start !important; }
.dash-msg-who { flex: 0 0 44px; font-weight: 600; font-size: 12px; color: var(--ink-2); }
.dash-msg-in .dash-msg-who { color: var(--accent-ink); }
.dash-msg-body { flex: 1; min-width: 0; color: var(--ink-2); }

@media (max-width: 760px) {
  .dash-wide { grid-column: auto; }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ---------- Actions ---------- */

.hub-link { position: relative; }
.hub-count {
  position: absolute; top: 4px; right: 10px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--charcoal);
}
.hub-link.active .hub-count { background: #fff; color: var(--accent-ink); box-shadow: none; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.actions-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip {
  border: 1px solid var(--line); background: var(--canvas); color: var(--ink-2);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.chip:hover { background: var(--hover); }
.chip.active { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.chip-n { opacity: 0.75; font-weight: 600; }

.actions-list { display: flex; flex-direction: column; gap: 12px; max-width: 820px; }
.action-card {
  border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 18px; background: var(--canvas);
}
.action-held, .action-question, .action-input { border-left-color: var(--amber); }
.action-blocked { border-left-color: var(--red); }
.action-draft, .action-knowledge, .action-fitment_gap { border-left-color: var(--blue); }
.action-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.action-head h3 { margin: 0; flex: 1; min-width: 200px; font-family: var(--display); font-size: 16.5px; }
.action-age { color: var(--muted); font-size: 12px; white-space: nowrap; }
.action-kind {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--gray-tint); color: var(--gray-ink);
}
.action-kind-held, .action-kind-question, .action-kind-input { background: var(--amber-tint); color: var(--amber-ink); }
.action-kind-blocked { background: var(--red-tint); color: var(--red-ink); }
.action-kind-draft, .action-kind-knowledge, .action-kind-fitment_gap { background: var(--blue-tint); color: var(--blue-ink); }
.action-detail { margin: 10px 0 6px; white-space: pre-line; line-height: 1.5; color: var(--ink); }
.action-context { margin: 6px 0 10px; font-size: 12.5px; color: var(--muted); }
.action-quick, .action-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.action-quick { margin-bottom: 8px; }
.action-reply { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.action-reply textarea {
  flex: 1; min-height: 40px; resize: vertical;
  font: inherit; font-size: 14px; color: var(--ink); line-height: 1.4;
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px;
}
.action-reply textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.action-row .action-dismiss { margin-left: auto; color: var(--muted); }

@media (max-width: 720px) {
  .action-reply { flex-direction: column; align-items: stretch; }
  .hub-count { top: 2px; right: 6px; box-shadow: none; }
}

/* ---------- People ---------- */

.people-tools { display: flex; flex-direction: column; gap: 10px; max-width: 900px; margin-bottom: 14px; }
.people-tools .task-search { max-width: 420px; }
.people-tools .actions-filters { margin: 0; }
.people-list { display: flex; flex-direction: column; max-width: 900px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.people-list:has(.page-empty), .people-list:has(> .dash-empty) { border: none; }
.person-row {
  display: grid; grid-template-columns: 38px minmax(0, 1.4fr) minmax(0, 1fr) auto auto;
  align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line-2); background: var(--canvas);
}
.person-row:first-child { border-top: none; }
.person-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--charcoal); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: 0.03em;
}
.person-name { font-weight: 600; }
.person-aka { color: var(--muted); font-weight: 400; }
.person-sub { color: var(--ink-2); font-size: 13px; }
.person-notes { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.person-contact { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.person-contact a { color: var(--accent-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-contact a:hover { text-decoration: underline; }
.person-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.person-grid .run-field { margin-bottom: 12px; }
.person-wide { grid-column: 1 / -1; }
.person-grid input[type="email"], .person-grid input[type="tel"] {
  font: inherit; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; background: var(--canvas);
}
.person-archive { margin-right: auto; color: var(--red-ink); }

@media (max-width: 760px) {
  .person-row { grid-template-columns: 38px 1fr auto; }
  .person-contact { grid-column: 2 / -1; }
  .person-rel { display: none; }
  .person-grid { grid-template-columns: 1fr; }
}

/* ---------- People search (own style: the sidebar's collapses in a column) ---------- */
.people-search-wrap {
  position: relative; display: flex; align-items: center;
  width: 100%; max-width: 460px; color: var(--muted);
}
.people-search-wrap svg { position: absolute; left: 12px; pointer-events: none; }
.people-search {
  flex: none; width: 100%; height: 40px; padding: 0 12px 0 36px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--canvas);
  font: inherit; font-size: 14px; color: var(--ink);
}
.people-search::placeholder { color: var(--faint); }
.people-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---------- Team ---------- */
.team-box { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin: 0 0 14px; }
.team-toggle { font-size: 14px; }
#team-fields { margin-top: 12px; }
.team-perms { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 10px; }
.team-perms .run-choice { align-items: flex-start; }
.team-perms .run-choice input { margin-top: 3px; }
.team-badge {
  display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px;
  background: var(--charcoal); color: #fff; font-size: 10.5px; font-weight: 600; vertical-align: 2px;
}
.team-badge-soft { background: var(--gray-tint); color: var(--gray-ink); }

/* Actions: who it's for, reassigning, permission notes */
.action-for { padding: 2px 8px; border-radius: 999px; background: var(--gray-tint); color: var(--gray-ink); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.action-for.mine { background: var(--accent-tint); color: var(--accent-ink); }
.action-assign { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.action-assign select { font: inherit; font-size: 12.5px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 6px; background: var(--canvas); color: var(--ink); }
.action-perm { margin: 0 0 8px; font-size: 12.5px; color: var(--amber-ink); }

/* ---------- Pop-ups fit the screen: header, scrolling body, pinned buttons ---------- */
.new-task-box.run-box {
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.run-box > h3 { flex: 0 0 auto; }
.run-box .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; margin-right: -4px; }
.run-box .new-task-actions, .run-box .new-task-error { flex: 0 0 auto; }
.run-box .new-task-actions { padding-top: 12px; border-top: 1px solid var(--line-2); margin-top: 4px; background: var(--canvas); }

.modal-tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.modal-tab {
  border: none; background: none; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted);
  padding: 8px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer;
}
.modal-tab:hover { color: var(--ink); }
.modal-tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tab-state { font-weight: 500; color: var(--green-ink); }
#team-box { border: none; padding: 0; margin: 0; }
.team-badge-warn { background: var(--amber-tint); color: var(--amber-ink); }
.run-financial { margin: 0 0 16px; align-items: flex-start; }
.run-financial input { margin-top: 3px; }

/* Run recipients */
.run-recipients { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.run-recipients .run-choice.is-blocked { color: var(--muted); cursor: not-allowed; }

/* ---------- Runs: Today strip, grouped sections, compact rows ---------- */
.runs-list { max-width: 980px; gap: 22px; }

.runs-today { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; background: var(--surface); }
.runs-today h3, .runs-group h3 {
  margin: 0 0 10px; font-family: var(--font); font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.today-track { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.today-item {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-width: 150px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--canvas); font: inherit; text-align: left; cursor: pointer;
}
.today-item:hover { border-color: var(--faint); }
.today-item.is-upcoming { border-style: dashed; }
.today-time { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.today-name { font-size: 13.5px; font-weight: 600; color: var(--ink); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-state { font-size: 11.5px; color: var(--blue-ink); font-weight: 600; }
.today-empty { margin: 0; }

.runs-count { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: var(--gray-tint); color: var(--gray-ink); letter-spacing: 0; }
.runs-group.is-attention h3 { color: var(--red-ink); }
.runs-group.is-attention .runs-count { background: var(--red-tint); color: var(--red-ink); }
.runs-rows { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--canvas); }
.runs-group.is-attention .runs-rows { border-color: var(--red-tint); }

.run-row { border-top: 1px solid var(--line-2); }
.run-row:first-child { border-top: none; }
.run-row.is-off .rr-name strong { color: var(--ink-2); }
.run-row.is-open { background: var(--surface); }
.run-row-line { display: flex; align-items: center; gap: 12px; padding: 0 0 0 14px; }
.run-row-head {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) 150px 110px 18px; align-items: center; gap: 14px;
  padding: 12px 14px 12px 0; border: none; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.run-row-head:hover .rr-name strong { color: var(--accent-ink); }
.rr-name { display: flex; flex-direction: column; min-width: 0; }
.rr-name strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-when { font-size: 12.5px; color: var(--muted); }
.rr-who { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-next, .rr-last { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.rr-label { font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; }
.rr-chevron { color: var(--muted); transition: transform 0.15s; }
.run-row.is-open .rr-chevron { transform: rotate(180deg); }

.run-detail { padding: 2px 18px 16px 62px; }
.run-detail .run-instructions { margin: 0 0 8px; }
.run-detail-meta { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.run-detail .run-actions { margin: 0 0 14px; }
.run-detail-h { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.run-detail .run-history { margin: 0; padding: 0; border: none; }

@media (max-width: 860px) {
  .run-row-head { grid-template-columns: minmax(0, 1fr) auto 18px; row-gap: 4px; }
  .rr-who { grid-column: 1 / 2; grid-row: 2; }
  .rr-next { display: none; }
  .rr-last { grid-column: 2; grid-row: 1 / 3; }
  .run-detail { padding-left: 18px; }
}
