/* =====================================================================
   Jarvis Command Center — Redesign
   Dark-navy command-console aesthetic. Glassmorphic panels, cyan accents,
   instrument-grade typography.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Base surfaces */
  --bg-void:        #060A12;
  --bg-base:        #0B0F17;
  --bg-raised:      #11172280;
  --bg-raised-2:    #161D2B90;
  --bg-overlay:     rgba(6, 10, 18, 0.72);

  /* Lines */
  --edge-hair:      rgba(140, 175, 220, 0.08);
  --edge-soft:      rgba(140, 175, 220, 0.14);
  --edge-strong:    rgba(140, 175, 220, 0.22);
  --edge-inner:     rgba(255, 255, 255, 0.06);
  --edge-glow:      rgba(77, 208, 255, 0.35);

  /* Text */
  --fg-primary:     #E6ECF5;
  --fg-secondary:   #9AA6B8;
  --fg-tertiary:    #6B7689;
  --fg-mute:        #4B5468;

  /* Accent */
  --accent:         #4DD0FF;
  --accent-dim:     #2B8FB8;
  --accent-soft:    rgba(77, 208, 255, 0.14);
  --accent-glow:    rgba(77, 208, 255, 0.45);

  /* Status */
  --status-online:  #4FD48A;
  --status-working: #4DD0FF;
  --status-waiting: #8B97A8;
  --status-error:   #FF7A63;
  --status-done:    #6B7689;

  /* Priority */
  --prio-1: #FF7A63;
  --prio-2: #F4B740;
  --prio-3: #4DD0FF;

  /* Model tints */
  --model-haiku:   #A78BFA;
  --model-sonnet:  #4DD0FF;
  --model-opus:    #F4B740;

  /* Typography */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  /* Motion */
  --ease:  cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur:   180ms;

  /* Shape */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Layout */
  --header-h: 52px;
  --rail-w:   40px;
  --left-w:   240px;
  --right-w:  300px;

  /* ---- Legacy token aliases (app.js + existing component classes) ---- */
  --surface-0:      rgba(8, 12, 20, 0.7);
  --surface-1:      #0B0F17;
  --surface-2:      rgba(77, 208, 255, 0.08);
  --surface-3:      rgba(77, 208, 255, 0.14);
  --border:         rgba(140, 175, 220, 0.08);
  --border-subtle:  rgba(140, 175, 220, 0.08);
  --border-default: rgba(140, 175, 220, 0.14);
  --text-primary:   #E6ECF5;
  --text-secondary: #9AA6B8;
  --text-tertiary:  #6B7689;
  --font-display:   'Inter', ui-sans-serif, system-ui, sans-serif;
  --tg-blue:        #4DD0FF;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 13px;
  --text-lg:   16px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.55);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.65);
}

/* ---------- 2. Reset + base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-void);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
  overflow: hidden;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
body::before {
  background:
    radial-gradient(ellipse 80% 60% at 15% 10%,
      rgba(77, 208, 255, 0.06), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 90%,
      rgba(120, 140, 255, 0.05), transparent 60%),
    linear-gradient(180deg, #0A0E16 0%, #0B0F17 50%, #080B12 100%);
}
body::after {
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.018) 0px,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px,
      transparent 3px
    ),
    repeating-linear-gradient(
      to right,
      rgba(77, 208, 255, 0.012) 0px,
      rgba(77, 208, 255, 0.012) 1px,
      transparent 1px,
      transparent 120px
    );
  mix-blend-mode: screen;
  opacity: 0.9;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140, 175, 220, 0.18);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

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

button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

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

/* ---------- 3. Layout grid ---------- */
#header {
  position: relative;
  z-index: 10;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(180deg, #0E1421 0%, #0A0F1A 100%);
  border-bottom: 1px solid var(--edge-soft);
  box-shadow:
    inset 0 1px 0 var(--edge-inner),
    0 1px 20px rgba(0, 0, 0, 0.4);
}

#main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--left-w) 1fr var(--right-w);
  gap: 12px;
  padding: 12px;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

aside#sidebar-left,
aside#sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* ---------- 4. Header ---------- */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-orb {
  width: 24px; height: 24px;
  display: block;
}
.header-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--fg-primary);
  text-shadow: 0 0 12px rgba(77, 208, 255, 0.15);
}
.header-timeblock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(77, 208, 255, 0.28);
  border-radius: 999px;
  box-shadow: inset 0 0 8px rgba(77, 208, 255, 0.08);
}
.header-timeblock::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulse-dot 2.4s var(--ease) infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-secondary);
}
.header-meta strong {
  color: var(--accent);
  font-weight: 500;
  text-shadow: 0 0 8px var(--accent-glow);
}
.header-latency {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.02);
}
.header-latency-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--fg-tertiary);
  text-transform: uppercase;
}
.header-latency-value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
}
.header-clock {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--fg-primary);
  text-shadow:
    0 0 4px rgba(77, 208, 255, 0.3),
    0 0 14px rgba(77, 208, 255, 0.2);
  font-variant-numeric: tabular-nums;
}
.header-active-clocks {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid rgba(77, 208, 255, 0.35);
  border-radius: 999px;
  background: rgba(77, 208, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-shadow: 0 0 6px var(--accent-glow);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 8px rgba(77, 208, 255, 0.12);
}
.clock-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  animation: pulse-dot 1.6s ease-in-out infinite;
}
.clock-pill__label {
  font-weight: 600;
}
.clock-pill__time {
  opacity: 0.92;
}
.clock-pill__sep {
  color: var(--fg-tertiary);
  opacity: 0.55;
  margin: 0 1px;
}
.clock-pill__totals {
  color: var(--fg-secondary);
  font-weight: 500;
}

/* ---------- 5. Glass panel system ---------- */
.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-raised);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 1px 0 var(--edge-inner),
    inset 0 0 0 1px rgba(77, 208, 255, 0.03),
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
.panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent);
  pointer-events: none;
  z-index: 2;
}

.panel-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge-hair);
  background: linear-gradient(180deg,
    rgba(255,255,255,0.025), transparent);
}
.panel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-secondary);
}
.panel-label::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 8px;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: -1px;
  box-shadow: 0 0 6px var(--accent-glow);
}
.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

#sidebar-left > .panel { flex: 1 1 0; }
#panel-agents { flex: 3 1 0; }
#panel-tasks  { flex: 2 1 0; }

/* Agents panel body is a flex column so the list scrolls internally
   and the add-agent button stays pinned at the bottom. */
#panel-agents .panel-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar-right > .panel { flex: 1 1 0; }
#panel-telegram { flex: 1 1 auto; min-height: 0; overflow: hidden; }
#panel-usage    { flex: 0 0 auto; max-height: 175px; overflow: hidden; }
#panel-usage .panel-body {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
#panel-usage .usage-cluster {
  grid-template-columns: repeat(2, 110px);
  padding: 4px 0;
  gap: 8px;
}

/* ---------- 6. Agent cards (holographic) ---------- */
.agent-card {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: auto auto auto;
  gap: 4px 10px;
  padding: 10px 10px 8px;
  margin-bottom: 8px;
  background: linear-gradient(180deg,
    rgba(77, 208, 255, 0.04),
    rgba(77, 208, 255, 0.015) 40%,
    transparent);
  border: 1px solid var(--edge-hair);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 var(--edge-inner);
  transition: transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.agent-card:hover {
  transform: scale(1.015);
  border-color: var(--edge-glow);
  box-shadow:
    inset 0 0 0 1px var(--edge-glow),
    0 4px 18px rgba(77, 208, 255, 0.14);
}
.agent-card__ico {
  grid-row: 1 / span 2;
  align-self: start;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
}
.agent-card__ico canvas { display: block; }
.agent-card__name {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-primary);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-card__meta {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
}
.agent-card__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--edge-hair);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 3px;
  border: 1px solid currentColor;
  background: rgba(255,255,255,0.02);
}
.chip--haiku  { color: var(--model-haiku);  box-shadow: inset 0 0 10px rgba(167, 139, 250, 0.10); }
.chip--sonnet { color: var(--model-sonnet); box-shadow: inset 0 0 10px rgba(77, 208, 255, 0.10); }
.chip--opus   { color: var(--model-opus);   box-shadow: inset 0 0 10px rgba(244, 183, 64, 0.10); }

.icon-btn {
  flex: 1 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 6px;
  color: var(--fg-tertiary);
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--edge-hair);
  border-radius: var(--r-sm);
  transition: color var(--dur) var(--ease),
              background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.icon-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--edge-glow);
}
.icon-btn--danger:hover {
  color: var(--status-error);
  background: rgba(255, 122, 99, 0.10);
  border-color: rgba(255, 122, 99, 0.35);
}
.icon-btn svg { width: 12px; height: 12px; }

.agent-card__tail {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 10px;
  min-width: 260px;
  max-width: 340px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--fg-secondary);
  background: rgba(10, 14, 22, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 1px 0 var(--edge-inner),
    0 10px 30px rgba(0,0,0,.5);
  opacity: 0;
  transform: translateX(-4px);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  z-index: 20;
  white-space: pre;
}
.agent-card:hover .agent-card__tail {
  opacity: 1;
  transform: translateX(0);
}
.agent-card__tail-label {
  display: block;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ---------- 7. Task cards ---------- */
.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 10px;
  padding: 9px 10px 9px 0;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--edge-hair);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 var(--edge-inner);
  transition: transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  cursor: pointer;
}
.task-card:hover {
  transform: scale(1.015);
  border-color: var(--edge-glow);
}
.task-card__bar {
  grid-row: 1 / -1;
  align-self: stretch;
  border-radius: var(--r-md) 0 0 var(--r-md);
}
.task-card__bar--p1 { background: var(--prio-1); box-shadow: 0 0 10px rgba(255,122,99,.4); }
.task-card__bar--p2 { background: var(--prio-2); box-shadow: 0 0 10px rgba(244,183,64,.35); }
.task-card__bar--p3 { background: var(--prio-3); box-shadow: 0 0 10px rgba(77,208,255,.35); }
.task-card__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-card__sub {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  margin-top: 2px;
}
.task-card__status {
  grid-column: 3;
  align-self: end;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 3px;
}
.status--in-progress { color: var(--accent);         background: var(--accent-soft); }
.status--pending     { color: var(--fg-tertiary);    background: rgba(255,255,255,0.04); }
.status--done        { color: var(--status-done);    background: rgba(107,118,137,0.12); text-decoration: line-through; text-decoration-thickness: 1px; }
.status--blocked     { color: var(--status-error);   background: rgba(255,122,99,0.10); }

/* ---------- 8. Center panel + vertical rail ---------- */
#panel-terminals {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.view-rail {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--rail-w);
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.02), transparent 60%);
  border-right: 1px solid var(--edge-hair);
  z-index: 3;
}
.view-rail__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 36px;
  color: var(--fg-tertiary);
  transition: color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.view-rail__btn::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: transparent;
  border-radius: 0 2px 2px 0;
  transition: background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.view-rail__btn:hover {
  color: var(--fg-primary);
  background: rgba(77, 208, 255, 0.04);
}
.view-rail__btn.active {
  color: var(--accent);
  background: rgba(77, 208, 255, 0.06);
}
.view-rail__btn.active::before {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.view-rail__btn svg { width: 16px; height: 16px; }

.view-rail__btn .view-rail__tip {
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-primary);
  background: rgba(10, 14, 22, 0.95);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  z-index: 5;
}
.view-rail__btn:hover .view-rail__tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ---------- Header view-rail (horizontal) ---------- */
header .view-rail {
  position: static;
  width: auto;
  height: 100%;
  flex-direction: row;
  align-items: center;
  gap: 0;
  padding: 0;
  background: none;
  border-right: none;
  flex: 1;
  justify-content: center;
}
header .view-rail__btn {
  width: 44px;
  height: 100%;
}
header .view-rail__btn::before {
  left: 8px;
  right: 8px;
  top: auto;
  bottom: 0;
  width: auto;
  height: 2px;
  border-radius: 2px 2px 0 0;
}
header .view-rail__btn .view-rail__tip {
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%) translateY(-4px);
}
header .view-rail__btn:hover .view-rail__tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.view-surface {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.view-surface > .panel-header {
  background: transparent;
  border-bottom: 1px solid var(--edge-hair);
}
.view-surface > .view-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Grid picker */
.grid-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.grid-picker:hover { border-color: var(--edge-glow); color: var(--accent); }
.grid-thumb {
  display: grid;
  width: 22px; height: 14px;
  gap: 1px;
  padding: 1px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
}
.grid-thumb div {
  background: var(--fg-tertiary);
  border-radius: 1px;
}
.grid-thumb--1x1 { grid-template: 1fr / 1fr; }
.grid-thumb--2x1 { grid-template: 1fr / 1fr 1fr; }
.grid-thumb--2x2 { grid-template: 1fr 1fr / 1fr 1fr; }
.grid-thumb--3x2 { grid-template: 1fr 1fr / 1fr 1fr 1fr; }
.grid-thumb--4x2 { grid-template: 1fr 1fr / repeat(4, 1fr); }

.grid-picker-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 10px;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  background: rgba(14, 20, 32, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  z-index: 30;
  min-width: 140px;
}
.grid-picker-menu.open { display: flex; }
.grid-picker-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  color: var(--fg-secondary);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.grid-picker-menu button:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- 9. Terminal grid ---------- */
.terminal-grid {
  position: absolute;
  inset: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
}
.terminal-grid[data-layout="1x1"] { grid-template-columns: 1fr; }
.terminal-grid[data-layout="2x1"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.terminal-grid[data-layout="2x2"] { grid-template-columns: 1fr 1fr; }
.terminal-grid[data-layout="3x2"] { grid-template-columns: repeat(3, 1fr); }
.terminal-grid[data-layout="4x2"] { grid-template-columns: repeat(4, 1fr); }

.term-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgba(8, 12, 20, 0.7);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 1px 0 var(--edge-inner),
    0 4px 14px rgba(0,0,0,.35);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
.term-cell:hover { border-color: var(--edge-glow); }
.term-cell__chrome {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border-bottom: 1px solid var(--edge-hair);
}
.term-cell__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--status-online);
  box-shadow: 0 0 8px var(--status-online);
}
.term-cell__dot--offline { background: var(--status-waiting); box-shadow: none; }
.term-cell__name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.term-cell__actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
}
.term-cell__body {
  flex: 1 1 auto;
  min-height: 0;
  background: #060A12;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: #B8D6E8;
  padding: 8px 10px;
  overflow: auto;
  white-space: pre;
}

/* ---------- 11. Files ---------- */
.files-panel {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
}
.files-col {
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  border-right: 1px solid var(--edge-hair);
  scroll-snap-align: start;
}
.files-col:last-child { border-right: 0; }
.files-col__label {
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--fg-tertiary);
  text-transform: uppercase;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.file-row:hover { background: rgba(77, 208, 255, 0.06); color: var(--fg-primary); }
.file-row.active { background: var(--accent-soft); color: var(--accent); }
.file-row svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--fg-tertiary); }
.file-row.active svg { color: var(--accent); }
.file-row__name {
  flex: 1 1 auto;
  font-family: var(--font-mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-reader {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 32px;
  margin: 10px;
  background:
    linear-gradient(180deg,
      rgba(255,255,255,0.035),
      rgba(255,255,255,0.015));
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 1px 0 var(--edge-inner),
    0 6px 24px rgba(0,0,0,.35);
  color: var(--fg-primary);
  font-size: 13px;
  line-height: 1.65;
}
.file-reader h1, .file-reader h2, .file-reader h3 {
  font-family: var(--font-sans);
  color: var(--fg-primary);
  letter-spacing: -0.01em;
  margin: 1.4em 0 0.5em;
}
.file-reader h1 { font-size: 22px; }
.file-reader h2 { font-size: 17px; color: var(--accent); }
.file-reader h3 { font-size: 14px; }
.file-reader p  { color: var(--fg-secondary); }
.file-reader code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  background: rgba(77, 208, 255, 0.08);
  color: var(--accent);
  border-radius: 3px;
}
.file-reader blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  margin: 1em 0;
  color: var(--fg-secondary);
  font-style: italic;
}

.listen-cluster {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-top: 16px;
  padding: 2px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--edge-soft);
  border-radius: 999px;
  overflow: hidden;
}
.listen-cluster__main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  border-radius: 999px;
  transition: background var(--dur) var(--ease);
}
.listen-cluster__main:hover { background: var(--accent-soft); }
.listen-cluster__main svg { width: 12px; height: 12px; }
.listen-cluster__options {
  display: flex;
  gap: 2px;
  max-width: 0;
  overflow: hidden;
  transition: max-width 260ms var(--ease);
}
.listen-cluster:hover .listen-cluster__options,
.listen-cluster.open .listen-cluster__options {
  max-width: 260px;
}
.listen-cluster__opt {
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  border-radius: 999px;
}
.listen-cluster__opt:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- 12. Email ---------- */
.email-panel {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
}

/* ---------- 13. Plans / cytoscape frame ---------- */
.plans-panel {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
}
.plans-list {
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  border-right: 1px solid var(--edge-hair);
}
.plans-canvas-wrap {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(77,208,255,0.04), transparent 60%),
    #080C14;
}
.plans-cy {
  position: absolute; inset: 0;
}
.plans-controls {
  position: absolute;
  top: 12px; right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  background: rgba(11, 15, 23, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  z-index: 5;
}
.plans-controls .icon-btn { width: 28px; height: 28px; padding: 0; }
.plans-legend {
  position: absolute;
  bottom: 12px; left: 12px;
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(11, 15, 23, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  z-index: 5;
}
.plans-legend span { display: inline-flex; align-items: center; gap: 6px; }
.plans-legend i {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
}

/* ---------- 14. Calendar (FullCalendar overrides) ---------- */
.calendar-panel {
  position: absolute;
  inset: 0;
  padding: 12px;
  overflow: auto;
}
.calendar-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--edge-hair);
  border-radius: 999px;
}
.calendar-source-badge::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.fc {
  --fc-border-color: var(--edge-hair);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: rgba(255,255,255,0.015);
  --fc-today-bg-color: rgba(77, 208, 255, 0.05);
  --fc-list-event-hover-bg-color: var(--accent-soft);
  color: var(--fg-secondary);
  font-family: var(--font-sans);
}
.fc .fc-toolbar-title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--fg-primary);
  letter-spacing: -0.01em;
}
.fc .fc-button {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--edge-soft);
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  box-shadow: none;
}
.fc .fc-button:hover,
.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--edge-glow);
}
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number {
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
}
.fc-theme-standard td, .fc-theme-standard th {
  border-color: var(--edge-hair);
}
.fc .fc-daygrid-day.fc-day-today {
  box-shadow: inset 0 0 0 1px var(--edge-glow);
}
.fc-event, .fc .fc-daygrid-event {
  background: rgba(77, 208, 255, 0.10);
  border: 0;
  border-left: 2px solid var(--accent);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-primary);
}

/* ---------- 15. Right sidebar — Telegram chrome + Usage radial cluster ---------- */
#panel-telegram .panel-header {
  justify-content: space-between;
}
.tg-conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--status-online);
  text-transform: uppercase;
}
.tg-conn::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--status-online);
  box-shadow: 0 0 6px currentColor;
}

#react-chat-root {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: rgba(8, 12, 20, 0.6);
}

.usage-cluster {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 10px 8px 12px;
}
.usage-arc {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1.1 / 1;
}
.usage-arc svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.usage-arc__track {
  fill: none;
  stroke: rgba(140, 175, 220, 0.10);
  stroke-width: 4;
  stroke-linecap: round;
}
.usage-arc__fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px var(--accent-glow));
  transition: stroke-dashoffset 600ms var(--ease);
}
.usage-arc[data-kind="week-all"]    .usage-arc__fill { stroke: #7AE2FF; }
.usage-arc[data-kind="week-sonnet"] .usage-arc__fill { stroke: var(--model-sonnet); }
.usage-arc[data-kind="extra"]       .usage-arc__fill { stroke: var(--model-opus); }
.usage-arc__label-block {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}
.usage-arc__value {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--fg-primary);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px rgba(77, 208, 255, 0.18);
}
.usage-arc__label {
  display: block;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--fg-tertiary);
  text-transform: uppercase;
}
.usage-arc__reset {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--fg-mute);
}

/* ---------- 15b. Task Board (Kanban) ---------- */
.tasks-board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}
.kanban-col {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-raised);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--edge-inner);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.kanban-col::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--kb-tint, var(--fg-tertiary));
  opacity: 0.8;
  box-shadow: 0 0 10px var(--kb-tint, transparent);
}
.kanban-col[data-p="unsorted"] { --kb-tint: #6B7689; }
.kanban-col[data-p="1"]        { --kb-tint: var(--prio-1); }
.kanban-col[data-p="2"]        { --kb-tint: var(--prio-2); }
.kanban-col[data-p="3"]        { --kb-tint: var(--prio-3); }

.kanban-col.drag-over {
  border-color: var(--edge-glow);
  box-shadow:
    inset 0 0 0 1px var(--edge-glow),
    inset 0 1px 0 var(--edge-inner),
    0 0 24px rgba(77, 208, 255, 0.18);
}
.kanban-col__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge-hair);
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--kb-tint) 8%, transparent),
    transparent);
}
.kanban-col__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--kb-tint, var(--fg-secondary));
  display: inline-flex; align-items: center; gap: 8px;
}
.kanban-col__label::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--kb-tint);
  box-shadow: 0 0 6px var(--kb-tint);
}
.kanban-col__count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  padding: 1px 7px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--edge-hair);
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}
.kanban-col__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kanban-col__empty {
  display: grid;
  place-items: center;
  margin: 4px;
  min-height: 72px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
  border: 1px dashed var(--edge-hair);
  border-radius: var(--r-md);
  text-align: center;
}
.kanban-col.drag-over .kanban-col__empty {
  border-color: var(--edge-glow);
  color: var(--accent);
}

.kanban-card {
  position: relative;
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 10px;
  padding: 9px 10px 9px 0;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--edge-hair);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 var(--edge-inner);
  cursor: grab;
  user-select: none;
  transition: transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  animation: kb-card-in 260ms var(--ease);
}
.kanban-card:hover {
  transform: scale(1.015);
  border-color: var(--edge-glow);
  box-shadow:
    inset 0 0 0 1px var(--edge-glow),
    0 4px 14px rgba(77, 208, 255, 0.12);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging {
  opacity: 0.55;
  border-color: var(--edge-glow);
  box-shadow:
    inset 0 0 0 1px var(--edge-glow),
    0 14px 36px rgba(0, 0, 0, 0.55);
  transform: scale(1.02);
}

.kanban-card__bar {
  grid-row: 1 / -1;
  align-self: stretch;
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: var(--fg-mute);
}
.kanban-card[data-p="1"] .kanban-card__bar { background: var(--prio-1); box-shadow: 0 0 10px rgba(255,122,99,.35); }
.kanban-card[data-p="2"] .kanban-card__bar { background: var(--prio-2); box-shadow: 0 0 10px rgba(244,183,64,.30); }
.kanban-card[data-p="3"] .kanban-card__bar { background: var(--prio-3); box-shadow: 0 0 10px rgba(77,208,255,.30); }

.kanban-card__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-primary);
  line-height: 1.35;
}
.kanban-card__meta {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  flex-wrap: wrap;
}
.kanban-card__worker { color: var(--accent); }
.kanban-card__status {
  grid-column: 3;
  align-self: start;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 3px;
}

.assigned-chip {
  display: inline-flex; align-items: center;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 3px;
  border: 1px solid currentColor;
}
.assigned-chip[data-a="user"]               { color: #9AA6B8; }
.assigned-chip[data-a="agent-support"]      { color: var(--model-sonnet); }
.assigned-chip[data-a="agent-autonomous"]   { color: var(--model-opus); }

@keyframes kb-card-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-rail__badge {
  position: absolute;
  top: 2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  background: #EF4444;
  border-radius: 999px;
  box-shadow:
    0 0 0 2px rgba(11, 15, 23, 0.9),
    0 2px 6px rgba(239, 68, 68, 0.4);
  pointer-events: none;
  line-height: 1;
}
.view-rail__badge[hidden] { display: none; }

/* ---------- 16. Modals ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  animation: fade-in var(--dur) var(--ease);
}
.modal-root.open { display: flex; }
.modal {
  position: relative;
  width: min(720px, 100%);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(22,29,43,.92), rgba(11,15,23,.92));
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 1px 0 var(--edge-inner),
    0 20px 60px rgba(0,0,0,.6),
    0 0 0 1px rgba(77, 208, 255, 0.05);
  animation: modal-slide 260ms var(--ease);
  overflow: hidden;
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--edge-hair);
}
.modal__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-primary);
}
.modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}
.modal__close {
  color: var(--fg-tertiary);
  padding: 4px;
  border-radius: var(--r-sm);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.modal__close:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-slide {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 17. Motion ---------- */
@keyframes panel-mount {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel {
  opacity: 1;
  animation: panel-mount 380ms var(--ease);
}
.panel[style*="--i"] { animation-delay: calc(var(--i, 0) * 60ms); }

/* Utility */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap;
}


/* =====================================================================
   LEGACY COMPATIBILITY SHIMS
   Styles for classes rendered by app.js or present in existing HTML
   that differ from the design CSS selectors above.
   ===================================================================== */

/* ---- Agent items (app.js renders .agent-item in #agents-list) ---- */
.agent-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  border: 1px solid transparent;
  margin-bottom: 4px;
}
.agent-item:hover {
  background: rgba(77, 208, 255, 0.05);
  border-color: var(--edge-hair);
}

.agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.agent-dot.online  { background: var(--status-online); box-shadow: 0 0 6px rgba(79,212,138,.5); animation: agent-pulse-online 3s ease-in-out infinite; }
.agent-dot.working { background: var(--status-working); animation: agent-pulse-working 2s ease-in-out infinite; }
.agent-dot.waiting { background: var(--status-waiting); }
.agent-dot.error   { background: var(--status-error); }

@keyframes agent-pulse-online {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(79,212,138,0.5); }
  50%      { opacity: 0.8; box-shadow: 0 0 0 4px rgba(79,212,138,0); }
}
@keyframes agent-pulse-working {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(77,208,255,0.5); }
  50%      { opacity: 0.7; box-shadow: 0 0 0 4px rgba(77,208,255,0); }
}

.agent-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.agent-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.agent-type-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(77, 208, 255, 0.06);
  border: 1px solid var(--edge-hair);
  color: var(--fg-tertiary);
  text-transform: uppercase;
}
.agent-lock-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--accent-soft);
  border: 1px solid rgba(77, 208, 255, 0.35);
  color: var(--accent);
  text-transform: uppercase;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 3px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.02);
  color: var(--fg-tertiary);
}
.model-chip[data-model="haiku"]  { color: var(--model-haiku);  box-shadow: inset 0 0 8px rgba(167, 139, 250, 0.10); }
.model-chip[data-model="sonnet"] { color: var(--model-sonnet); box-shadow: inset 0 0 8px rgba(77, 208, 255, 0.10); }
.model-chip[data-model="opus"]   { color: var(--model-opus);   box-shadow: inset 0 0 8px rgba(244, 183, 64, 0.10); }

/* ---- Task items (app.js renders .task-item in #tasks-list) ---- */
.task-group {
  margin-bottom: 8px;
}
.task-group-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  padding: 4px 0;
  border-bottom: 1px solid var(--edge-hair);
  margin-bottom: 4px;
}
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 3px 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-secondary);
  line-height: 1.4;
  border-radius: var(--r-sm);
}
.task-checkbox {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin-top: 2px;
  border: 1px solid var(--edge-soft);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: var(--status-online);
}
.task-item.clickable .task-checkbox { cursor: pointer; }
.task-item.clickable .task-checkbox:hover {
  border-color: var(--status-online);
  background: rgba(79, 212, 138, 0.12);
}
.task-checkbox.checking { border-color: var(--accent); opacity: 0.6; }
.task-checkbox.checked { background: rgba(79, 212, 138, 0.18); border-color: var(--status-online); }

.task-title {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  padding: 4px 0;
  border-bottom: 1px solid var(--edge-hair);
  margin-bottom: 4px;
  margin-top: 8px;
}
.task-section-label:first-child { margin-top: 0; }
.task-section-label.completed { color: var(--status-online); border-bottom-color: rgba(79, 212, 138, 0.30); }
.task-item.clickable { cursor: pointer; transition: background var(--dur) var(--ease); }
.task-item.clickable:hover { background: rgba(77, 208, 255, 0.05); }
.task-item.completed { opacity: 0.55; }
.task-item.completed .task-title { text-decoration: line-through; color: var(--fg-tertiary); }

.task-item__bar {
  flex-shrink: 0;
  width: 2px;
  align-self: stretch;
  border-radius: 2px;
  background: transparent;
  margin-top: 1px;
}
.task-item__bar--p1 { background: var(--prio-1); }
.task-item__bar--p2 { background: var(--prio-2); }
.task-item__bar--p3 { background: var(--prio-3); }

/* ---- Terminal tiles (app.js renders .terminal-tile in .terminal-grid) ---- */
.terminal-tile {
  display: flex;
  flex-direction: column;
  background: rgba(8, 12, 20, 0.85);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  min-height: 0;
  height: 100%;
  cursor: pointer;
  position: relative;
  transition: border-color var(--dur) var(--ease);
  box-shadow: inset 0 1px 0 var(--edge-inner), 0 4px 14px rgba(0,0,0,.35);
}
.terminal-tile:hover { border-color: var(--edge-glow); }
.terminal-tile.focused {
  box-shadow: inset 0 0 0 2px var(--status-online);
  border-color: var(--status-online);
  z-index: 1;
}
.terminal-tile.focused .terminal-tile-header {
  background: rgba(79, 212, 138, 0.08);
  border-bottom-color: rgba(79, 212, 138, 0.35);
}
.terminal-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 26px;
  padding: 0 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border-bottom: 1px solid var(--edge-hair);
  flex-shrink: 0;
  gap: 8px;
}
.terminal-tile-name {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--fg-secondary);
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.terminal-tile-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.terminal-tile-body {
  flex: 1;
  position: relative;
  min-height: 0;
}
.terminal-pre {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 6px 8px;
  background: #060A12;
  color: #B8D6E8;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}
.terminal-pre::-webkit-scrollbar { width: 4px; }
.terminal-pre::-webkit-scrollbar-track { background: transparent; }
.terminal-pre::-webkit-scrollbar-thumb { background: rgba(140,175,220,0.18); border-radius: 4px; }
.terminal-pre.fullscreen-pre { font-size: 13px; padding: 10px 14px; }
.terminal-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #060A12;
}
.terminal-placeholder-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-mute);
  opacity: 0.6;
}

/* ---- Grid controls ---- */
#grid-controls {
  display: flex;
  gap: 2px;
  position: relative;
}
#grid-picker-wrapper {
  position: relative;
}
#grid-picker-trigger, .grid-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--edge-soft);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}
#grid-picker-trigger:hover, .grid-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--edge-glow);
}
/* Raised — was 100; now 1200 so it sits above view-rail and panel headers */
.grid-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  margin-top: 0;
  background: rgba(14, 20, 32, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  padding: 8px;
  z-index: 1200;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  min-width: 110px;
}
.grid-picker-dropdown.hidden { display: none; }
.grid-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 3px;
}
.grid-picker-cell {
  width: 18px;
  height: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--edge-hair);
  border-radius: 2px;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.grid-picker-cell.highlighted {
  background: rgba(77, 208, 255, 0.28);
  border-color: var(--accent);
}
.grid-picker-size {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-secondary);
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.08em;
}
.auto-grid-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--edge-soft);
  color: var(--fg-tertiary);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  border-radius: var(--r-sm);
}
.auto-grid-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--edge-glow); }
.auto-grid-btn.active { background: var(--accent-soft); border-color: rgba(77, 208, 255, 0.35); color: var(--accent); }

/* ---- Fullscreen terminal ---- */
.terminal-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #060A12;
  display: flex;
  flex-direction: column;
}
.terminal-fullscreen.hidden { display: none; }
.fullscreen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 16px;
  background: linear-gradient(180deg, #0E1421, #0A0F1A);
  border-bottom: 1px solid var(--edge-soft);
  flex-shrink: 0;
}
#fullscreen-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--fg-primary);
  text-transform: uppercase;
}
#fullscreen-close {
  background: none;
  border: 1px solid var(--edge-soft);
  color: var(--fg-secondary);
  font-size: 16px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  line-height: 1;
  transition: all var(--dur) var(--ease);
}
#fullscreen-close:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--edge-glow); }
#fullscreen-terminal-container {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

/* ---- Task modal ---- */
.task-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(6, 10, 18, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-modal-overlay.hidden { display: none !important; }
.task-modal-content {
  width: 560px;
  max-width: 90vw;
  max-height: 82vh;
  background: linear-gradient(180deg, rgba(22,29,43,.95), rgba(11,15,23,.95));
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: inset 0 1px 0 var(--edge-inner), 0 20px 60px rgba(0,0,0,.65);
}
.task-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--edge-hair);
  flex-shrink: 0;
}
.task-modal-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-primary);
  letter-spacing: 0.06em;
}
#task-modal-close {
  background: none;
  border: 1px solid var(--edge-soft);
  color: var(--fg-secondary);
  font-size: 16px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  line-height: 1;
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}
#task-modal-close:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--edge-glow); }
.task-modal-meta {
  padding: 10px 18px;
  border-bottom: 1px solid var(--edge-hair);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.task-modal-meta:empty { display: none; }
.task-modal-field { display: flex; align-items: center; gap: 6px; }
.task-modal-key {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}
.task-modal-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  padding: 1px 6px;
  background: var(--accent-soft);
  border: 1px solid rgba(77, 208, 255, 0.28);
  border-radius: 3px;
}
.task-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--fg-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Email create modal ---- */
.email-create-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 18, 0.75);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.email-create-modal-overlay.hidden { display: none !important; }
.email-create-modal {
  background: linear-gradient(180deg, rgba(22,29,43,.96), rgba(11,15,23,.96));
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  padding: 24px;
  width: 460px;
  max-width: 92vw;
  box-shadow: inset 0 1px 0 var(--edge-inner), 0 20px 60px rgba(0,0,0,.65);
}
.email-create-modal h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
  color: var(--fg-primary);
}
.email-create-modal label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  margin-bottom: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.email-create-modal input,
.email-create-modal textarea {
  width: 100%;
  background: rgba(8, 12, 20, 0.6);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  color: var(--fg-primary);
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  margin-bottom: 12px;
  resize: vertical;
  outline: none;
  transition: border-color var(--dur) var(--ease);
}
.email-create-modal input:focus,
.email-create-modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(77,208,255,0.12); }
.email-create-modal-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.email-create-modal-btns button {
  padding: 7px 16px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--edge-soft);
  background: rgba(255,255,255,0.03);
  color: var(--fg-secondary);
  transition: all var(--dur) var(--ease);
}
.email-create-modal-btns button.primary {
  background: var(--accent-soft);
  border-color: rgba(77, 208, 255, 0.35);
  color: var(--accent);
}
.email-create-modal-btns button:hover { background: rgba(255,255,255,0.06); color: var(--fg-primary); }
.email-create-modal-btns button.primary:hover { background: rgba(77, 208, 255, 0.22); border-color: var(--edge-glow); }

/* ---- Usage panel (legacy) ---- */
.usage-session-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.usage-model {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  text-transform: capitalize;
  letter-spacing: 0.04em;
}
.usage-uptime {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
}
.usage-context-bar { margin-bottom: 10px; }
.usage-context-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.usage-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(77, 208, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  background: var(--accent);
}
.usage-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.usage-stat { display: flex; flex-direction: column; gap: 1px; }
.usage-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-primary);
  line-height: 1;
}
.usage-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-tertiary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---- Files browser (legacy HTML structure) ---- */
.files-browser {
  display: flex;
  flex-direction: column;
  width: 440px;
  min-width: 320px;
  max-width: 55%;
  border-right: 1px solid var(--edge-hair);
  overflow: hidden;
  flex-shrink: 0;
}
.files-crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--edge-hair);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  background: rgba(11, 15, 23, 0.8);
  min-height: 28px;
  overflow-x: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.files-crumbs .fc-crumb {
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--fg-secondary);
  flex-shrink: 0;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.files-crumbs .fc-crumb:hover { background: rgba(77, 208, 255, 0.06); color: var(--fg-primary); }
.files-crumbs .fc-crumb.current { color: var(--accent); background: var(--accent-soft); }
.files-crumbs .fc-crumb-sep { opacity: 0.35; flex-shrink: 0; user-select: none; }
.files-columns {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}
.files-col {
  display: flex;
  flex-direction: column;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  overflow: hidden;
  border-right: 1px solid var(--edge-hair);
  background: rgba(8, 12, 20, 0.5);
  transition: min-width 120ms ease, max-width 120ms ease, width 120ms ease;
  scroll-snap-align: start;
  padding: 0;
}
.files-col.collapsed {
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  cursor: pointer;
}
.files-col.auto-hidden { display: none !important; }
.files-col.collapsed .files-col-body,
.files-col.collapsed .fc-search-wrap { display: none; }
.files-col.collapsed .files-col-header {
  flex-direction: column;
  padding: 0.5rem 0;
  gap: 4px;
  justify-content: flex-start;
  cursor: pointer;
  height: 100%;
}
.files-col.collapsed .files-col-title-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-orientation: mixed;
  margin-top: 0.4rem;
  max-height: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg-secondary);
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
}
.files-col.collapsed .files-col-close { display: none; }
.files-col-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--edge-hair);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-height: 28px;
  flex-shrink: 0;
  background: rgba(11, 15, 23, 0.6);
}
.files-col-title-text {
  flex: 1;
  color: var(--fg-secondary);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.files-col-btn {
  background: transparent;
  border: none;
  color: var(--fg-tertiary);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}
.files-col-btn:hover { background: rgba(77, 208, 255, 0.08); color: var(--fg-primary); }
.fc-search-wrap {
  padding: 4px 6px;
  border-bottom: 1px solid var(--edge-hair);
  flex-shrink: 0;
}
.fc-search {
  width: 100%;
  background: rgba(6, 10, 18, 0.7);
  border: 1px solid var(--edge-soft);
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--dur) var(--ease);
}
.fc-search:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(77,208,255,0.12); }
.files-col-body {
  flex: 1;
  overflow: auto;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
}
.files-col-body-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-mute);
  font-size: 10px;
  padding: 1rem;
  text-align: center;
}
.fc-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  cursor: pointer;
  color: var(--fg-secondary);
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.fc-item:hover { background: rgba(77, 208, 255, 0.05); color: var(--fg-primary); }
.fc-item.selected { background: rgba(79,212,138,0.10); color: var(--fg-primary); border-left-color: var(--status-online); }
.fc-item.selected-file { background: rgba(77,208,255,0.10); color: var(--fg-primary); border-left-color: var(--accent); }
.fc-item.kbd-focus { outline: 2px solid rgba(79,212,138,0.4); outline-offset: -2px; background: rgba(79,212,138,0.14); }
.fc-item.hidden { display: none; }
.fc-empty-filter { color: var(--fg-mute); opacity: 0.6; font-size: 10px; padding: 6px 10px; font-style: italic; }
.fc-icon { width: 14px; text-align: center; color: var(--fg-tertiary); flex-shrink: 0; font-size: 12px; }
.fc-item.selected .fc-icon, .fc-item.selected-file .fc-icon { color: var(--fg-primary); }
.fc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.fc-meta { font-size: 9px; color: var(--fg-mute); flex-shrink: 0; margin-left: auto; padding-left: 6px; }
.fc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--status-error); flex-shrink: 0; box-shadow: 0 0 4px rgba(255,122,99,0.5); }
.fc-dot.fc-dot-amber { background: var(--prio-2); box-shadow: 0 0 4px rgba(244,183,64,0.4); }
.fc-dot.fc-dot-dim { background: var(--fg-mute); box-shadow: none; opacity: 0.6; }
.fc-chevron { color: var(--fg-tertiary); font-size: 10px; opacity: 0.6; flex-shrink: 0; }
.fc-item.selected .fc-chevron { color: var(--fg-primary); opacity: 0.9; }

.files-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  backdrop-filter: blur(8px) saturate(120%);
  background: rgba(6, 10, 18, 0.55);
}
.files-viewer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--edge-hair);
  padding: 6px 12px;
  flex-shrink: 0;
  background: rgba(11, 15, 23, 0.6);
}
.files-breadcrumbs {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.files-listen { display: flex; align-items: center; gap: 6px; }
.files-listen.hidden { display: none; }
.files-listen-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(77, 208, 255, 0.28);
  padding: 3px 10px;
  border-radius: var(--r-sm);
  font-size: 10px;
  cursor: pointer;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all var(--dur) var(--ease);
}
.files-listen-btn:hover { background: rgba(77, 208, 255, 0.22); border-color: var(--edge-glow); }
.files-listen-btn:disabled { opacity: 0.4; cursor: wait; }
.files-podcast-buttons { display: flex; gap: 4px; }
.files-listen-status {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
}
.files-fullscreen-btn {
  background: transparent;
  color: var(--fg-tertiary);
  border: 1px solid var(--edge-hair);
  padding: 3px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
}
.files-fullscreen-btn:hover { color: var(--accent); border-color: var(--edge-glow); background: rgba(77, 208, 255, 0.08); }
.files-panel.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg-0, #060A12);
  display: flex !important;
}
.files-panel.fullscreen .files-browser { display: none; }
.files-panel.fullscreen .files-viewer { flex: 1; min-width: 0; }
.files-panel.fullscreen .files-content .md-body,
.files-panel.fullscreen .files-content .docx-body { max-width: 960px; margin: 0 auto; }
.files-content {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
  font-size: 13px;
  color: var(--fg-primary);
}
.files-content-empty {
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.files-content pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre;
  overflow: auto;
  color: var(--fg-secondary);
}
.files-content pre.wrap { white-space: pre-wrap; word-break: break-word; }
.files-content .md-body { max-width: 820px; line-height: 1.65; }
.files-content .md-body h1,
.files-content .md-body h2,
.files-content .md-body h3 { margin-top: 1.2em; color: var(--fg-primary); }
.files-content .md-body h2 { color: var(--accent); }
.files-content .md-body p { color: var(--fg-secondary); }
.files-content .md-body code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(77, 208, 255, 0.08);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
}
.files-content .md-body pre code { background: transparent; padding: 0; }
.files-content .md-body pre { background: rgba(6,10,18,0.6); padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--edge-hair); }
.files-content img { max-width: 100%; height: auto; }
.files-content iframe { width: 100%; height: 100%; border: 0; }
.files-content .binary-cta { color: var(--fg-tertiary); font-family: var(--font-mono); font-size: 11px; padding: 8px 0; }

/* docx-preview renders the doc's own fonts, styles, tables, page layout.
   Give it a light page background (matches Word) inside our dark viewer so
   the native colours/type look right. */
.files-content .docx-preview-wrap { padding: 8px 0; }
.files-content .docx-wrapper {
  background: transparent;
  padding: 0;
  display: flex;
  flex-flow: column;
  align-items: center;
}
.files-content .docx-wrapper > section.docx {
  background: #ffffff;
  color: #1a1a1a;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
  margin: 0 0 18px 0;
  border-radius: 2px;
}
.files-content .docx-wrapper table { border-collapse: collapse; }
.files-content .docx-wrapper img { max-width: 100%; height: auto; }

/* ---- Email panel (legacy HTML structure) ---- */
.email-list-col {
  width: 30%;
  min-width: 200px;
  max-width: 320px;
  border-right: 1px solid var(--edge-hair);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
.email-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--edge-hair);
  background: rgba(11, 15, 23, 0.7);
  flex-shrink: 0;
}
.email-list-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-tertiary);
  text-transform: uppercase;
}
.email-refresh-btn {
  background: none;
  border: none;
  color: var(--fg-tertiary);
  cursor: pointer;
  font-size: 15px;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.email-refresh-btn:hover { color: var(--fg-primary); background: rgba(77, 208, 255, 0.06); }
.email-refresh-btn.spinning { display: inline-block; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.email-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.email-list-loading,
.email-list-empty {
  color: var(--fg-tertiary);
  font-size: 11px;
  padding: 16px;
  text-align: center;
  font-family: var(--font-mono);
}
.email-item {
  padding: 9px 12px;
  border-bottom: 1px solid var(--edge-hair);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background var(--dur) var(--ease);
}
.email-item:hover { background: rgba(77, 208, 255, 0.04); }
.email-item.selected { background: rgba(77, 208, 255, 0.06); border-left-color: var(--accent); }
.email-item-row1 { display: flex; align-items: center; gap: 6px; }
.email-importance-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.email-importance-dot.high   { background: var(--prio-2); }
.email-importance-dot.medium { background: var(--accent); }
.email-importance-dot.low    { background: var(--fg-tertiary); }
.email-item-from {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.email-item-subject {
  font-size: 11px;
  color: var(--fg-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.email-item-date { font-size: 10px; color: var(--fg-tertiary); margin-top: 2px; font-family: var(--font-mono); }
.email-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--edge-hair);
}
.email-detail-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-tertiary);
  font-size: 12px;
  font-family: var(--font-mono);
}
.email-detail-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--edge-hair);
  background: rgba(11, 15, 23, 0.6);
  flex-shrink: 0;
}
.email-detail-subject {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-primary);
  line-height: 1.35;
  margin-bottom: 5px;
}
.email-detail-meta { font-size: 11px; color: var(--fg-secondary); line-height: 1.5; }
.email-detail-body-wrap { flex: 1; overflow-y: auto; padding: 14px 16px; }
.email-detail-body {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg-secondary);
  font-family: var(--font-sans);
}
.email-detail-loading { color: var(--fg-tertiary); font-size: 11px; padding: 20px 16px; font-family: var(--font-mono); }
.email-tasks-col {
  width: 240px;
  min-width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.email-tasks-header {
  padding: 8px 12px;
  background: rgba(11, 15, 23, 0.7);
  border-bottom: 1px solid var(--edge-hair);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-secondary);
  text-transform: uppercase;
  flex-shrink: 0;
}
.email-tasks-list { flex: 1; overflow-y: auto; padding: 8px; }
.email-tasks-empty { color: var(--fg-tertiary); font-size: 11px; text-align: center; padding: 20px 0; font-family: var(--font-mono); }
.email-task-item {
  padding: 8px 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--edge-hair);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 11px;
  color: var(--fg-primary);
  line-height: 1.4;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.email-task-item:hover { border-color: var(--edge-glow); background: rgba(77, 208, 255, 0.04); }
.email-task-hint { font-size: 10px; color: var(--fg-tertiary); margin-top: 3px; font-family: var(--font-mono); }

/* ---- Plans panel (legacy HTML structure) ---- */
.plans-panel {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.plans-sidebar {
  width: 200px;
  min-width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--edge-hair);
  background: rgba(11, 15, 23, 0.6);
  overflow: hidden;
}
.plans-sidebar-header {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg-tertiary);
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--edge-hair);
  text-transform: uppercase;
  flex-shrink: 0;
}
.plans-sidebar-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.plans-loading { padding: 12px; font-size: 11px; color: var(--fg-tertiary); font-family: var(--font-mono); }
.plans-sidebar-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.plans-sidebar-item:hover { background: rgba(77, 208, 255, 0.04); }
.plans-sidebar-item.active { background: rgba(77, 208, 255, 0.06); border-left-color: var(--accent); }
.plans-sidebar-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plans-sidebar-item.active .plans-sidebar-item-title { color: var(--accent); }
.plans-sidebar-item-meta { font-size: 10px; color: var(--fg-tertiary); font-family: var(--font-mono); }
.plans-sidebar-item-status {
  display: inline-block;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  background: rgba(255,255,255,0.04);
  color: var(--fg-secondary);
}
.plans-sidebar-item-status.status-in_progress { background: rgba(77, 208, 255, 0.14); color: var(--accent); }
.plans-sidebar-item-status.status-done { background: rgba(79, 212, 138, 0.14); color: var(--status-online); }
.plans-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.plans-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--edge-hair);
  background: rgba(11, 15, 23, 0.6);
  flex-shrink: 0;
  gap: 10px;
}
.plans-plan-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}
.plans-zoom-controls { display: flex; gap: 3px; flex-shrink: 0; }
.plans-zoom-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  color: var(--fg-secondary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all var(--dur) var(--ease);
}
.plans-zoom-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--edge-glow); }
.plans-canvas-wrap { flex: 1; position: relative; min-height: 0; }
.plans-canvas { width: 100%; height: 100%; display: block; }
.plans-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
.plans-empty.hidden { display: none !important; }
.plans-empty-icon { font-size: 32px; color: var(--fg-tertiary); opacity: 0.5; }
.plans-empty-text { font-size: 12px; color: var(--fg-tertiary); font-family: var(--font-mono); }
.plans-node-tooltip {
  position: fixed;
  z-index: 1000;
  padding: 6px 10px;
  background: rgba(14, 20, 32, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  font-size: 11px;
  color: var(--fg-primary);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  max-width: 220px;
  word-break: break-word;
}
.plans-node-tooltip-link { display: block; margin-top: 3px; font-size: 10px; color: var(--accent); }

/* ---- view-toggle compatibility (kept for app.js active-class tracking) ---- */
#view-toggle { display: none !important; }
.view-toggle-btn {
  /* no visual style needed — app.js just toggles .active on these by ID */
}

/* =========================================================================
   Tasks tab redesign — folder groups, side-pane detail, new-task modal
   ========================================================================= */

#panel-tasks .panel-header { display: flex; align-items: center; justify-content: space-between; }
.tasks-new-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--edge-glow);
  border-radius: 3px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.tasks-new-btn:hover { background: rgba(77, 208, 255, 0.18); }

.tasks-empty {
  padding: 8px;
  color: var(--text-tertiary, var(--fg-tertiary));
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.task-folder { margin-bottom: 6px; }
.task-folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 3px;
  user-select: none;
  transition: background var(--dur) var(--ease);
}
.task-folder-header:hover { background: rgba(77, 208, 255, 0.06); }
.task-folder-chevron {
  font-size: 0.7rem;
  color: var(--fg-secondary, var(--text-secondary));
  width: 10px;
  display: inline-block;
}
.task-folder-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-secondary, var(--text-secondary));
  flex: 1;
}
.task-folder-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--fg-tertiary);
  background: var(--panel-bg-2, rgba(255,255,255,0.04));
  padding: 1px 6px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
}
.task-folder-body { padding-left: 6px; }
.task-folder.collapsed .task-folder-body { display: none; }

/* =========================================================================
   Task detail side-pane - REDESIGNED 2026-04-30 (Linear/Things 3 inspired)
   Inline-editable property strip, hero title, polished neon accents.
   ========================================================================= */
.task-detail-pane {
  position: fixed;
  top: 60px;
  right: 14px;
  width: 520px;
  max-width: 94vw;
  height: calc(100vh - 80px);
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(77, 208, 255, 0.06), transparent 55%),
    linear-gradient(180deg, rgba(20, 27, 41, 0.98), rgba(9, 13, 21, 0.98));
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 1px 0 var(--edge-inner),
    inset 0 0 0 1px rgba(77, 208, 255, 0.04),
    -2px 0 0 rgba(77, 208, 255, 0.18),
    0 24px 64px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
  transform: translateX(0);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.task-detail-pane.hidden { transform: translateX(108%); pointer-events: none; opacity: 0; }

/* ---- Topbar (project chip + copy id + nav + close) ---- */
.task-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  flex-shrink: 0;
  gap: 10px;
}
.task-detail-topbar__left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.task-detail-topbar__right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.task-detail-project {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  padding: 3px 9px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}
.task-detail-project[data-project] {
  border-left: 2px solid var(--task-project-tint, var(--accent));
  color: var(--task-project-tint, var(--accent));
}

.task-detail-iconbtn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-tertiary);
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0 6px;
  gap: 6px;
  min-width: 26px;
}
.task-detail-iconbtn:hover { color: var(--accent); background: var(--accent-soft); border-color: rgba(77, 208, 255, 0.22); }
.task-detail-iconbtn--close { font-size: 18px; line-height: 1; }
.task-detail-copy-id__label {
  font-size: 0.62rem;
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-detail-iconbtn:hover .task-detail-copy-id__label { color: var(--accent); }
.task-detail-iconbtn.is-copied { color: #4fd48a; border-color: rgba(79, 212, 138, 0.3); background: rgba(79, 212, 138, 0.1); }
.task-detail-iconbtn.is-copied .task-detail-copy-id__label { color: #4fd48a; }

/* ---- Hero (title + age subline) ---- */
.task-detail-hero {
  padding: 4px 18px 14px;
  flex-shrink: 0;
}
.task-detail-title {
  margin: 0 0 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.15rem;
  line-height: 1.35;
  font-weight: 600;
  color: var(--fg-primary, var(--text-primary));
  letter-spacing: -0.005em;
  /* Allow up to 3 lines, then ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-detail-subline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--fg-tertiary);
}
.task-detail-subline__age { color: var(--fg-secondary); }
.task-detail-subline__age.is-stale { color: #f4b740; }
.task-detail-subline__sep { opacity: 0.4; }
.task-detail-subline__path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.7;
}

/* ---- Property strip (status / priority / due / assigned / worker) ---- */
.task-detail-props {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  padding: 0 12px 14px;
  border-bottom: 1px solid var(--edge-hair);
  margin: 0 0 0;
  flex-shrink: 0;
}
.task-detail-prop {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  min-width: 0;
}
.task-detail-prop:hover { background: rgba(255, 255, 255, 0.03); }
.task-detail-prop--readonly { cursor: default; }
.task-detail-prop--readonly:hover { background: transparent; }
.task-detail-prop__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  width: 60px;
  flex-shrink: 0;
}
.task-detail-prop__value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-detail-prop__value--empty { color: var(--fg-tertiary); font-style: italic; opacity: 0.7; }
.task-detail-prop__chevron {
  margin-left: auto;
  color: var(--fg-tertiary);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.task-detail-prop:hover .task-detail-prop__chevron { opacity: 0.7; }

/* Status pill */
.task-detail-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  border: 1px solid transparent;
}
.task-detail-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}
.task-detail-status--pending     { color: #8ea8c3; background: rgba(142, 168, 195, 0.12); border-color: rgba(142, 168, 195, 0.25); }
.task-detail-status--in_progress { color: #4dd0ff; background: rgba(77, 208, 255, 0.12); border-color: rgba(77, 208, 255, 0.3); }
.task-detail-status--blocked     { color: #ff7a63; background: rgba(255, 122, 99, 0.12); border-color: rgba(255, 122, 99, 0.3); }
.task-detail-status--done        { color: #4fd48a; background: rgba(79, 212, 138, 0.12); border-color: rgba(79, 212, 138, 0.3); }

/* Priority dot */
.task-detail-priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.task-detail-priority__dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}
.task-detail-priority__dot--p1 { background: #ff7a63; box-shadow: 0 0 6px rgba(255, 122, 99, 0.6); }
.task-detail-priority__dot--p2 { background: #f4b740; box-shadow: 0 0 6px rgba(244, 183, 64, 0.5); }
.task-detail-priority__dot--p3 { background: #4dd0ff; box-shadow: 0 0 5px rgba(77, 208, 255, 0.4); }
.task-detail-priority__dot--none { background: rgba(255, 255, 255, 0.1); border: 1px dashed rgba(255, 255, 255, 0.18); }
.task-detail-priority__label { color: var(--fg-secondary); font-size: 0.7rem; }

/* Due date */
.task-detail-due {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.task-detail-due__icon { color: var(--fg-tertiary); flex-shrink: 0; }
.task-detail-due--overdue { color: #ff7a63; }
.task-detail-due--overdue .task-detail-due__icon { color: #ff7a63; }
.task-detail-due--today   { color: #f4b740; }
.task-detail-due--today   .task-detail-due__icon { color: #f4b740; }
.task-detail-due--soon    { color: #4dd0ff; }
.task-detail-due--soon    .task-detail-due__icon { color: #4dd0ff; }
.task-detail-due--future  { color: var(--fg-secondary); }

/* ---- Body (description + sections) ---- */
.task-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 18px;
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--fg-primary, var(--text-primary));
}
.task-detail-body::-webkit-scrollbar { width: 7px; }
.task-detail-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.06); border-radius: 4px; }
.task-detail-body::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.12); }

.task-detail-body h1 { font-size: 1.05rem; margin: 14px 0 6px; }
.task-detail-body h2 { font-size: 0.95rem; margin: 12px 0 6px; color: var(--accent); }
.task-detail-body h3 { font-size: 0.85rem; margin: 10px 0 4px; }
.task-detail-body h4, .task-detail-body h5, .task-detail-body h6 { font-size: 0.8rem; margin: 8px 0 4px; }
.task-detail-body p { margin: 0 0 10px; }
.task-detail-body ul, .task-detail-body ol { margin: 0 0 12px 22px; padding: 0; }
.task-detail-body li { margin-bottom: 4px; }
.task-detail-body code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(77, 208, 255, 0.08);
  color: #a8e3ff;
  padding: 1px 5px;
  border-radius: 3px;
}
.task-detail-body pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--edge-subtle, rgba(255, 255, 255, 0.06));
  padding: 10px 12px;
  border-radius: 5px;
  overflow-x: auto;
  margin: 0 0 12px;
}
.task-detail-body pre code { background: transparent; color: var(--fg-primary); padding: 0; font-size: 0.75rem; }
.task-detail-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.task-detail-empty { color: var(--fg-tertiary); font-style: italic; opacity: 0.8; }

.task-detail-section { margin-bottom: 22px; }
.task-detail-section:last-child { margin-bottom: 8px; }
.task-detail-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}
.task-detail-h::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent);
}
.task-detail-h__count {
  font-size: 0.6rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(77, 208, 255, 0.22);
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.task-detail-markdown > *:first-child { margin-top: 0; }
.task-detail-markdown > *:last-child { margin-bottom: 0; }

/* Work-log rows - clean grid, hover highlight */
.task-detail-worklog__row {
  display: grid;
  grid-template-columns: 78px 140px 1fr;
  gap: 10px;
  font-size: 0.74rem;
  padding: 5px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
  transition: background var(--dur) var(--ease);
}
.task-detail-worklog__row:hover { background: rgba(255, 255, 255, 0.025); }
.task-detail-worklog__row + .task-detail-worklog__row { border-top: 1px dotted rgba(255, 255, 255, 0.04); }
.task-detail-worklog__date { color: var(--accent); }
.task-detail-worklog__src  { color: var(--fg-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-detail-worklog__line { color: var(--fg-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.task-detail-future__list { margin: 0; padding-left: 18px; }
.task-detail-future__list li { margin-bottom: 6px; font-size: 0.82rem; color: var(--fg-secondary); }

/* Memory / file shortcut row */
.task-detail-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.task-detail-shortcut-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--fg-secondary);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
}
.task-detail-shortcut-link:hover {
  color: var(--accent);
  border-color: rgba(77, 208, 255, 0.32);
  background: var(--accent-soft);
}

/* ---- Footer actions ---- */
.task-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--edge-hair);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.task-detail-actions__spacer { flex: 1; }
.task-detail-shortcut-hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--fg-tertiary);
  opacity: 0.7;
  letter-spacing: 0.04em;
  margin-right: 6px;
}
.task-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--edge-subtle, rgba(255, 255, 255, 0.12));
  color: var(--fg-secondary, var(--text-secondary));
  border-radius: 5px;
  padding: 6px 11px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.task-detail-btn:hover:not(:disabled) { filter: brightness(1.18); transform: translateY(-1px); }
.task-detail-btn--complete { color: #4fd48a; border-color: rgba(79, 212, 138, 0.32); }
.task-detail-btn--complete:hover:not(:disabled) { background: rgba(79, 212, 138, 0.12); border-color: rgba(79, 212, 138, 0.5); }
.task-detail-btn--ghost { color: var(--fg-tertiary); }
.task-detail-btn--ghost:hover:not(:disabled) { color: #ff7a63; border-color: rgba(255, 122, 99, 0.32); background: rgba(255, 122, 99, 0.08); }
.task-detail-btn:disabled { opacity: 0.45; cursor: default; }

.task-detail-start {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(180deg, #4dd0ff, #2eaad6);
  color: #061018;
  border: none;
  border-radius: 5px;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(77, 208, 255, 0.4), 0 6px 16px rgba(77, 208, 255, 0.25);
  transition: all var(--dur) var(--ease);
}
.task-detail-start:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 0 0 1px rgba(77, 208, 255, 0.55), 0 8px 22px rgba(77, 208, 255, 0.4);
  transform: translateY(-1px);
}
.task-detail-start:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

/* ---- Toast ---- */
.task-detail-toast {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 15, 23, 0.96);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  z-index: 10;
  pointer-events: none;
}
.task-detail-toast.is-error { color: #ff7a63; border-color: #ff7a63; }
.task-detail-toast.hidden { opacity: 0; transform: translate(-50%, 6px); transition: opacity 0.18s, transform 0.18s; }

/* ---- Edit popover (floats above the property strip) ---- */
.task-detail-popover {
  position: fixed;
  z-index: 1000;
  background: linear-gradient(180deg, rgba(20, 27, 41, 0.99), rgba(11, 15, 23, 0.99));
  border: 1px solid var(--edge-glow);
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.7);
  min-width: 220px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-primary);
}
.task-detail-popover.hidden { display: none; }
.task-detail-popover__title {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  margin: 0 0 8px;
  padding: 0 4px;
}
.task-detail-popover__list { display: flex; flex-direction: column; gap: 1px; }
.task-detail-popover__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  background: transparent;
  border: none;
  color: var(--fg-primary);
  font-family: inherit;
  font-size: inherit;
  text-align: left;
}
.task-detail-popover__row:hover { background: var(--accent-soft); color: var(--accent); }
.task-detail-popover__row.is-active { color: var(--accent); }
.task-detail-popover__row.is-active::after { content: "✓"; margin-left: auto; }
.task-detail-popover__hint {
  display: block;
  margin-left: auto;
  color: var(--fg-tertiary);
  font-size: 0.62rem;
  opacity: 0.7;
}
.task-detail-popover__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 6px 0;
}
.task-detail-popover input[type="date"] {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--edge-soft);
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--fg-primary);
  font-family: inherit;
  font-size: 0.78rem;
  width: 100%;
  color-scheme: dark;
  margin-top: 6px;
}
.task-detail-popover input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(77, 208, 255, 0.2);
}
.task-detail-popover__actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.task-detail-popover__btn {
  background: transparent;
  border: 1px solid var(--edge-subtle, rgba(255, 255, 255, 0.12));
  color: var(--fg-secondary);
  border-radius: 4px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.task-detail-popover__btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--fg-primary); }
.task-detail-popover__btn--primary {
  background: var(--accent);
  color: #061018;
  border-color: var(--accent);
  font-weight: 600;
}
.task-detail-popover__btn--primary:hover { filter: brightness(1.1); }
.task-detail-popover__btn--danger { color: #ff7a63; border-color: rgba(255, 122, 99, 0.3); }
.task-detail-popover__btn--danger:hover { background: rgba(255, 122, 99, 0.1); }

/* Project tints used by the project chip - match kanban-col tints */
.task-detail-project[data-project="KashKick"]            { --task-project-tint: #ff7a63; }
.task-detail-project[data-project="Keylink"]             { --task-project-tint: #4dd0ff; }
.task-detail-project[data-project="Dashboard / Jarvis"]  { --task-project-tint: #a479ff; }
.task-detail-project[data-project="AI audit overnight"]  { --task-project-tint: #f4b740; }
.task-detail-project[data-project="Portfolio"]           { --task-project-tint: #4fd48a; }
.task-detail-project[data-project="Personal"]            { --task-project-tint: #ff9ac1; }
.task-detail-project[data-project="Work-misc"]           { --task-project-tint: #8ea8c3; }
.task-detail-project[data-project="Emails"]              { --task-project-tint: #6B7689; }
.task-detail-project[data-project="Other"]               { --task-project-tint: #6B7689; }

/* + New task modal */
.task-create-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
}
.task-create-modal-overlay.hidden { display: none !important; }
.task-create-modal {
  background: var(--panel-bg, #0d1117);
  border: 1px solid var(--edge-glow);
  border-radius: 6px;
  padding: 18px 22px;
  width: 460px;
  max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.task-create-modal h3 {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-primary, var(--text-primary));
}
.task-create-modal label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  margin: 10px 0 4px;
}
.task-create-modal input,
.task-create-modal textarea,
.task-create-modal select {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--edge-subtle, rgba(255,255,255,0.1));
  border-radius: 3px;
  padding: 6px 8px;
  color: var(--fg-primary, var(--text-primary));
  font-family: var(--font-mono);
  font-size: 0.8rem;
  box-sizing: border-box;
}
.task-create-modal textarea { resize: vertical; min-height: 80px; }
.task-create-modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.task-create-modal-btns button {
  background: transparent;
  border: 1px solid var(--edge-subtle, rgba(255,255,255,0.12));
  color: var(--fg-secondary, var(--text-secondary));
  border-radius: 3px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
}
.task-create-modal-btns button.primary {
  background: var(--accent);
  color: #0b0f15;
  border-color: var(--accent);
  font-weight: 600;
}
.task-create-modal-btns button:hover { filter: brightness(1.1); }
.task-create-modal-btns button:disabled { opacity: 0.5; cursor: default; }

/* ---- Kanban project columns (redesign axis=project) ---- */
.kanban-col--project { --kb-tint: var(--accent); }
.kanban-col--project[data-folder="KashKick"]         { --kb-tint: #ff7a63; }
.kanban-col--project[data-folder="Keylink"]          { --kb-tint: #4dd0ff; }
.kanban-col--project[data-folder="Dashboard / Jarvis"] { --kb-tint: #a479ff; }
.kanban-col--project[data-folder="AI audit overnight"] { --kb-tint: #f4b740; }
.kanban-col--project[data-folder="Portfolio"]        { --kb-tint: #4fd48a; }
.kanban-col--project[data-folder="Personal"]         { --kb-tint: #ff9ac1; }
.kanban-col--project[data-folder="Work-misc"]        { --kb-tint: #8ea8c3; }
.kanban-col--project[data-folder="Emails"]           { --kb-tint: #6B7689; }
.kanban-col--project[data-folder="Other"]            { --kb-tint: #6B7689; }

/* Softer column backgrounds — tint only on top border + light fill */
.kanban-col--project {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 2px solid var(--kb-tint);
}
.kanban-col--project::before { display: none; }

.kanban-col__chevron {
  font-size: 0.7rem;
  color: var(--fg-secondary, var(--text-secondary));
  width: 10px;
  display: inline-block;
  margin-right: 4px;
  cursor: pointer;
}
.kanban-col__header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kanban-col__header .kanban-col__label { flex: 1; }
.kanban-col.collapsed .kanban-col__body { display: none; }
.kanban-col.collapsed { max-height: 48px; flex: 0 0 auto; }

.tasks-board {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

/* Tighter, cleaner kanban cards (item 3 cleanup) */
.kanban-col--project .kanban-card {
  padding: 8px 10px;
  gap: 4px;
}
.kanban-col--project .kanban-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  font-size: 0.65rem;
  margin-top: 2px;
}
.kanban-col--project .kanban-card__meta > span:last-child {
  color: #555;
  margin-left: auto;
  font-size: 0.6rem;
  opacity: 0.75;
}
.kanban-col--project .kanban-card__status {
  font-size: 0.6rem;
  padding: 1px 6px;
}

/* (Detail-pane secondary block removed - superseded by redesign block above.) */

/* =========================================================================
   Tasks list view (default) — dense grouped list with "Fires" band at top.
   Replaces the priority-axis kanban as the primary Tasks-board surface.
   ========================================================================= */

.tasks-board-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--edge-subtle, rgba(255, 255, 255, 0.06));
  flex: 0 0 auto;
}
.tasks-board-header__spacer { flex: 1; }

.tasks-view-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}
.tasks-view-toggle__btn {
  background: transparent;
  border: none;
  color: var(--fg-secondary, var(--text-secondary));
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.tasks-view-toggle__btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.tasks-view-toggle__btn:hover:not(.active) { background: rgba(255, 255, 255, 0.04); }

.tasks-folder-back {
  padding: 2px 10px;
  min-width: 32px;
  font-size: 0.85rem;
  line-height: 1;
}
.tasks-folder-back.hidden { display: none; }
.tasks-folder-drilldown {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 16px;
  overflow-y: auto;
  overflow-x: hidden;
}
.tasks-folder-drilldown.hidden { display: none; }
.tasks-folder-drilldown .tdv-section { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.tfd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  padding: 4px 0;
  align-content: start;
}
.tfd-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(20, 28, 40, 0.55);
  border: 1px solid var(--edge-hair, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--fg-primary, var(--text-primary));
  font-family: inherit;
  transition: background var(--dur, 160ms) var(--ease, ease), border-color var(--dur, 160ms) var(--ease, ease), transform var(--dur, 160ms) var(--ease, ease);
  min-height: 86px;
}
.tfd-card:hover { background: rgba(28, 40, 58, 0.75); border-color: rgba(122, 226, 255, 0.32); }
.tfd-card:focus-visible { outline: 2px solid var(--accent, #7AE2FF); outline-offset: 1px; }
.tfd-card[data-priority="1"] { border-left: 3px solid #ff6b6b; }
.tfd-card[data-priority="2"] { border-left: 3px solid #ffd166; }
.tfd-card[data-priority="3"] { border-left: 3px solid rgba(122, 226, 255, 0.5); }
.tfd-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.66rem;
  font-family: var(--font-mono);
  color: var(--fg-tertiary, rgba(255, 255, 255, 0.5));
  letter-spacing: 0.04em;
}
.tfd-card__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}
.tfd-card__status svg { width: 14px; height: 14px; }
.tfd-card__prio {
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg-secondary, rgba(255, 255, 255, 0.7));
}
.tfd-card__prio--p1 { background: rgba(255, 107, 107, 0.18); color: #ffb4b4; }
.tfd-card__prio--p2 { background: rgba(255, 209, 102, 0.18); color: #ffd98a; }
.tfd-card__prio--p3 { background: rgba(122, 226, 255, 0.16); color: #9fe7ff; }
.tfd-card__age { margin-left: auto; }
.tfd-card__title {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--fg-primary, var(--text-primary));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.tfd-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}
.tfd-card__due {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--fg-tertiary, rgba(255, 255, 255, 0.55));
  letter-spacing: 0.04em;
}
.tfd-card__due--today { color: #ffd98a; }
.tfd-card__due--overdue { color: #ff8a8a; }

.tasks-list-view {
  display: flex;
  flex-direction: column;
  padding: 10px 14px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.tasks-list-view.hidden,
.tasks-board-view.hidden { display: none; }

.tlv-band {
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.tlv-band--fires {
  border: 1px solid rgba(255, 122, 99, 0.35);
  background: rgba(255, 122, 99, 0.04);
  margin-bottom: 14px;
}
.tlv-band--completed {
  border: 1px solid rgba(79, 212, 138, 0.28);
  background: rgba(79, 212, 138, 0.035);
  margin-bottom: 14px;
}
.tlv-band--completed .tlv-band__label { color: #4fd48a; }
.tlv-band--completed .tlv-row { opacity: 0.75; }
.tlv-band--completed .tlv-row .tlv-title { text-decoration: line-through; color: var(--fg-secondary); }
.tlv-band__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
}
.tlv-band:not(.collapsed) .tlv-band__header {
  border-bottom-color: rgba(255, 255, 255, 0.04);
}
.tlv-band__chevron {
  font-size: 0.7rem;
  color: var(--fg-tertiary);
  width: 10px;
}
.tlv-band__emoji { font-size: 0.9rem; }
.tlv-band__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-primary, var(--text-primary));
}
.tlv-band--fires .tlv-band__label { color: #ff7a63; }
.tlv-band__sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--fg-tertiary);
  opacity: 0.7;
  flex: 1;
}
.tlv-band__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--fg-tertiary);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 8px;
  border-radius: 9px;
  min-width: 22px;
  text-align: center;
}
.tlv-band.collapsed .tlv-band__body { display: none; }
.tlv-band.collapsed .tlv-band__header { border-bottom: none; }

.tlv-band__body {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.tlv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  outline: none;
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  transition: background var(--dur) var(--ease);
  min-height: 30px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.tlv-row:first-child { border-top: none; }
.tlv-row:hover { background: rgba(77, 208, 255, 0.05); }
.tlv-row:focus { background: rgba(77, 208, 255, 0.08); outline: 1px solid var(--edge-glow); }

.tlv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.tlv-dot--pending  { background: #6b7689; }
.tlv-dot--live     { background: #4dd0ff; box-shadow: 0 0 6px rgba(77, 208, 255, 0.55); }
.tlv-dot--done     { background: #4fd48a; }
.tlv-dot--blocked  { background: #ff7a63; }

.tlv-title {
  color: var(--fg-primary, var(--text-primary));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}
.tlv-status {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
  max-width: 110px;
}
.tlv-status.status--in-progress,
.tlv-status.status--in_progress {
  color: #4dd0ff;
  background: rgba(77, 208, 255, 0.1);
}
.tlv-status.status--draft-ready,
.tlv-status.status--research-ready,
.tlv-status.status--ready_for_review,
.tlv-status.status--ready-for-review {
  color: #f4b740;
  background: rgba(244, 183, 64, 0.1);
}
.tlv-status.status--user-action-required {
  color: #ff7a63;
  background: rgba(255, 122, 99, 0.1);
}
.tlv-prio {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg-tertiary);
  text-align: center;
  flex: 0 0 40px;
  width: 40px;
}
.tlv-prio--1 { color: #ff7a63; }
.tlv-prio--2 { color: #f4b740; }
.tlv-prio--3 { color: #8ea8c3; }
.tlv-age {
  font-size: 0.65rem;
  color: #777;
  text-align: right;
  opacity: 0.85;
  white-space: nowrap;
  flex: 0 0 56px;
  width: 56px;
}

.tlv-empty {
  padding: 6px 12px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-style: italic;
}
.tlv-more {
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  cursor: pointer;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}
.tlv-more:hover { background: rgba(77, 208, 255, 0.06); }

/* =============================================================
   Folders view (Asana-style, default Tasks tab layout).
   Top: "Tasks Due Soon" flat list. Bottom: vibrant folder grid.
   ============================================================= */
.tasks-folders-view {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 14px 18px 28px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.tasks-folders-view.hidden { display: none; }

.tdv-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tdv-section__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 4px;
}
.tdv-section__chevron {
  font-size: 0.7rem;
  color: var(--fg-tertiary);
}
.tdv-section__title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--fg-primary);
}
.tdv-section__spacer { flex: 1; }
.tdv-section__hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--fg-tertiary);
  opacity: 0.7;
}

/* ---- Tasks Due Soon list ---- */
.tdv-list {
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  overflow: hidden;
}
.tdv-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  outline: none;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--dur) var(--ease);
  min-height: 40px;
}
.tdv-row:first-child { border-top: none; }
.tdv-row:hover { background: rgba(255, 255, 255, 0.03); }
.tdv-row:focus { background: rgba(77, 208, 255, 0.08); }

.tdv-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--fg-tertiary);
}
.tdv-icon svg { width: 18px; height: 18px; }
.tdv-icon--in-progress { color: #4dd0ff; }
.tdv-icon--in_progress { color: #4dd0ff; }
.tdv-icon--blocked { color: #ff7a63; }
.tdv-icon--done { color: #4fd48a; }

.tdv-title {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.tdv-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.tdv-pill {
  display: inline-block;
  max-width: 110px;
  padding: 3px 10px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
  text-transform: capitalize;
  line-height: 1.4;
}

.tdv-due {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg-secondary);
  flex: 0 0 auto;
  text-align: right;
  min-width: 64px;
  white-space: nowrap;
}
.tdv-due--today { color: var(--accent); font-weight: 600; }
.tdv-due--overdue { color: #ff7a63; font-weight: 600; }

.tdv-empty {
  padding: 16px 18px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg-tertiary);
  text-align: center;
  font-style: italic;
}
.tdv-more {
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary);
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
  text-align: center;
}

/* ---- Folders grid ---- */
.tdv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
.tdv-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 16px;
  min-height: 156px;
  border: none;
  border-radius: 18px;
  color: #ffffff;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              filter var(--dur) var(--ease);
}
.tdv-tile:hover {
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.06);
}
.tdv-tile:active { transform: translateY(0) scale(0.99); }
.tdv-tile:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}
.tdv-tile__icon {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  margin-bottom: 8px;
}
.tdv-tile__icon svg { width: 36px; height: 36px; }
.tdv-tile__title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  letter-spacing: -0.005em;
  word-break: break-word;
}
.tdv-tile__sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
  letter-spacing: 0;
}

.tdv-othernote {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary);
  padding: 4px 2px 0;
  opacity: 0.7;
}

@media (max-width: 1100px) {
  .tdv-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .tdv-tile { min-height: 140px; padding: 14px; }
  .tdv-tile__icon { width: 36px; height: 36px; }
  .tdv-tile__icon svg { width: 30px; height: 30px; }
}

/* Board view container (holds the existing kanban columns) */
.tasks-board-view {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  align-items: flex-start;
}

/* Make #panel-tasks-board itself a flex column so the header pins to top */
#panel-tasks-board { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; height: 100%; padding: 8px 12px 12px; gap: 8px; }
#panel-tasks-board.hidden { display: none; }

/* Dropdown panels — single-open invariant + z-index fix (item 4) */
.dashboard-dropdown-panel {
  position: absolute;
  z-index: 1000;
  background: var(--panel-bg, #0d1117);
  border: 1px solid var(--edge-glow);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  min-width: 160px;
  padding: 6px 0;
}
.dashboard-dropdown-panel.hidden { display: none; }

/* =====================================================================
   MONITOR TAB — status cards, thread panel, collapsible sections
   ===================================================================== */

/* --- Monitor panel container --- */
.monitor-panel {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.monitor-panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Kanban mode: outer container doesn't scroll; columns scroll independently */
.monitor-panel-scroll.mon-kanban-mode {
  overflow: hidden;
}

/* --- Kanban layout --- */
.mon-kanban {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 10px;
  overflow: hidden;
}

.mon-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.mon-col-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: var(--r-md);
  background: var(--bg-base);
  border: 1px solid rgba(255,255,255,0.07);
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.mon-col-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 5px currentColor;
}

.mon-col-count {
  margin-left: auto;
  background: rgba(255,255,255,0.08);
  color: var(--fg-tertiary);
  border-radius: 99px;
  font-size: 9px;
  font-weight: 500;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.mon-col-empty {
  padding: 20px 12px;
  color: var(--fg-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  opacity: 0.5;
}

/* Attention column — subtle amber tint */
.mon-col--alert {
  background: rgba(255, 178, 0, 0.025);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 178, 0, 0.07);
  padding: 6px;
  gap: 8px;
}

/* active-b col: hide its empty header visually (no label, no dot) */
.mon-col--active-b .mon-col-header {
  visibility: hidden;
  pointer-events: none;
}

/* --- Card meta row (replaces stat grid) --- */
.mon-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-secondary);
  margin: 5px 0 4px;
  flex-wrap: wrap;
}

.mon-meta-sep {
  color: var(--fg-mute);
  flex-shrink: 0;
}

/* --- Inline activity preview (always visible, no hover) --- */
.mon-act-preview {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-secondary);
  background: rgba(255,255,255,0.03);
  border-left: 2px solid rgba(255,255,255,0.08);
  padding: 4px 8px;
  border-radius: 0 4px 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.mon-act-preview--idle {
  color: var(--fg-mute);
  font-style: italic;
}

/* --- Compact tags (idle warn, crash count) --- */
.mon-tag {
  font-family: var(--font-mono);
  font-size: 8px;
  border-radius: 3px;
  padding: 1px 5px;
}

.mon-tag--warn  { background: rgba(255,191,0,0.12); color: var(--prio-2); }
.mon-tag--error { background: rgba(255,80,80,0.12);  color: var(--status-error); }

/* --- Card grid (kept for reference; kanban uses .mon-kanban) --- */
.mon-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

/* --- Metrics strip --- */
.mon-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 11px;
  flex-shrink: 0;
}

.mon-metric {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mon-metric__value {
  color: var(--fg-primary);
  font-weight: 500;
}

.mon-metric__label {
  color: var(--fg-tertiary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 9px;
}

.mon-realtime-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--status-online);
  box-shadow: 0 0 6px var(--status-online);
  animation: breathe 2.4s var(--ease) infinite;
}

/* --- Card grid --- */
.mon-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

/* --- Individual agent card --- */
.monitor-card {
  position: relative;
  background: var(--bg-raised);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  padding: 12px;
  cursor: pointer;
  transition:
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.monitor-card:hover {
  border-color: var(--edge-strong);
  box-shadow: 0 0 18px rgba(77, 208, 255, 0.18);
  transform: translateY(-1px);
}

.monitor-card.status-stuck   { border-color: rgba(244, 183, 64, 0.3); }
.monitor-card.status-errored { border-color: rgba(255, 122, 99, 0.35); }
.monitor-card.status-dead    { border-color: rgba(255, 122, 99, 0.35); opacity: 0.7; }

.monitor-card.needs-input {
  border-color: var(--prio-2);
  box-shadow: 0 0 0 2px rgba(244, 183, 64, 0.2);
  animation: card-shake 0.5s var(--ease);
}

.monitor-card.shake-again { animation: card-shake 0.5s var(--ease); }

.monitor-card.is-open {
  border-color: rgba(77, 208, 255, 0.4);
  box-shadow: 0 0 14px rgba(77, 208, 255, 0.15);
}

/* --- Card header row --- */
.mon-card-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

/* --- Icon tile --- */
.mon-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}

.mon-icon.persistent {
  background: rgba(79, 212, 138, 0.12);
  border: 1px solid rgba(79, 212, 138, 0.25);
}

.mon-icon.worker {
  background: rgba(77, 208, 255, 0.10);
  border: 1px solid rgba(77, 208, 255, 0.2);
}

/* --- Name block --- */
.mon-name-block { flex: 1; min-width: 0; }

.mon-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mon-type {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--fg-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* --- Status pill --- */
.mon-status-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.mon-status-pill[data-s="dead"]    { background: rgba(255,122,99,0.12); border-color: rgba(255,122,99,0.3); color: var(--status-error); }
.mon-status-pill[data-s="errored"] { background: rgba(255,122,99,0.12); border-color: rgba(255,122,99,0.3); color: var(--status-error); }
.mon-status-pill[data-s="stuck"]   { background: rgba(244,183,64,0.12); border-color: rgba(244,183,64,0.3); color: var(--prio-2); }
.mon-status-pill[data-s="working"] { background: rgba(77,208,255,0.10); border-color: rgba(77,208,255,0.25); color: var(--status-working); }
.mon-status-pill[data-s="waiting"] { background: rgba(139,151,168,0.10); border-color: rgba(139,151,168,0.2); color: var(--status-waiting); }
.mon-status-pill[data-s="online"]  { background: rgba(79,212,138,0.10); border-color: rgba(79,212,138,0.2); color: var(--status-online); }

/* --- Status dot --- */
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot[data-s="dead"]    { background: var(--status-error); }
.status-dot[data-s="errored"] { background: var(--status-error); animation: blink 0.8s ease-in-out infinite; }
.status-dot[data-s="stuck"]   { background: var(--prio-2); }
.status-dot[data-s="working"] { background: var(--status-working); animation: breathe 2s ease-in-out infinite; }
.status-dot[data-s="waiting"] { background: var(--status-waiting); animation: breathe 3s ease-in-out infinite; }
.status-dot[data-s="online"]  { background: var(--status-online); }

/* --- Keyframes --- */
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.55; transform: scale(1.35); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

@keyframes card-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* --- Card stats grid --- */
.mon-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
  font-size: 10px;
}

.mon-stat { display: flex; flex-direction: column; gap: 1px; }

.mon-stat-label {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--fg-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mon-stat-value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-secondary);
}

/* --- Awaiting input badge on card --- */
.mon-input-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--prio-2);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* --- Fast-checker badge --- */
.mon-fc-badge {
  font-family: var(--font-mono);
  font-size: 9px;
}
.mon-fc-disabled {
  color: var(--clr-text-dim);
  opacity: 0.6;
}

/* --- Activity summary panel (expands under card) --- */
.mon-activity {
  margin-top: 10px;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.3s var(--ease),
    opacity 0.2s var(--ease),
    padding 0.2s var(--ease);
}

.mon-activity.expanded {
  padding: 7px 9px;
  max-height: 140px;
  opacity: 1;
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--edge-hair);
  border-radius: var(--r-sm);
}

.mon-activity-line {
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.65;
  color: var(--fg-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mon-activity-line:first-child { color: var(--fg-secondary); }

/* --- Collapsible section --- */
.mon-section {
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}

.mon-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  user-select: none;
}

.mon-section-header:hover { background: rgba(255,255,255,0.04); color: var(--fg-secondary); }

.mon-section-caret {
  transition: transform var(--dur) var(--ease);
  font-size: 10px;
  color: var(--fg-mute);
}

.mon-section.collapsed .mon-section-caret { transform: rotate(-90deg); }

.mon-section-body {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s var(--ease);
}

.mon-section.collapsed .mon-section-body { max-height: 0; }

/* --- Tables in sections --- */
.mon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  font-family: var(--font-mono);
}

.mon-table th, .mon-table td {
  padding: 5px 12px;
  text-align: left;
  border-bottom: 1px solid var(--edge-hair);
}

.mon-table th {
  color: var(--fg-mute);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
}

.mon-table td { color: var(--fg-secondary); }
.mon-table tr:last-child td { border-bottom: none; }
.mon-table .stale { color: var(--status-error); }
.mon-table .held  { color: var(--prio-2); }
.mon-table .free  { color: var(--status-online); opacity: 0.6; }

/* --- Timeline entries --- */
.mon-timeline-entry {
  padding: 5px 12px;
  border-bottom: 1px solid var(--edge-hair);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-tertiary);
  animation: slide-in-left 200ms var(--ease) both;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mon-timeline-entry:last-child { border-bottom: none; }

/* --- Thread panel (slides in over right side of monitor) --- */
.mon-thread-panel {
  position: absolute;
  top: 0; right: 0;
  width: clamp(280px, 40%, 420px);
  height: 100%;
  background: var(--bg-raised-2);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-left: 1px solid var(--edge-soft);
  display: flex;
  flex-direction: column;
  z-index: 10;
  animation: slide-in-right 200ms var(--ease) both;
}

.mon-thread-panel.hidden { display: none; }

.mon-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge-hair);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-primary);
  flex-shrink: 0;
}

.mon-thread-close {
  font-size: 16px;
  line-height: 1;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: var(--fg-tertiary);
  transition: color var(--dur), background var(--dur);
}

.mon-thread-close:hover { color: var(--fg-primary); background: rgba(255,255,255,0.06); }

.mon-thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Thread bubbles --- */
.mon-thread-bubble {
  max-width: 88%;
  padding: 6px 10px;
  border-radius: var(--r-md);
  font-size: 10px;
  line-height: 1.55;
  word-break: break-word;
  animation: slide-in-left 150ms var(--ease) both;
}

.mon-thread-bubble.from-worker {
  background: var(--surface-2);
  border: 1px solid var(--edge-hair);
  align-self: flex-end;
  color: var(--fg-secondary);
}

.mon-thread-bubble.from-rishi {
  background: var(--bg-raised);
  border: 1px solid var(--edge-soft);
  align-self: flex-start;
  color: var(--fg-primary);
}

.mon-thread-bubble.type-question   { border-left: 3px solid var(--prio-2); }
.mon-thread-bubble.type-task_complete { border-left: 3px solid var(--status-online); }

.mon-bubble-meta {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 2px;
}

.mon-bubble-who {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mon-bubble-time {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--fg-mute);
}

.mon-bubble-text { font-family: var(--font-mono); white-space: pre-wrap; }

/* --- Thread input row --- */
.mon-thread-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--edge-hair);
  flex-shrink: 0;
}

.mon-thread-input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-primary);
  resize: none;
  line-height: 1.4;
  min-height: 32px;
  max-height: 100px;
  overflow-y: auto;
}

.mon-thread-input:focus {
  border-color: var(--accent);
  outline: none;
}

.mon-thread-send {
  padding: 0 11px;
  height: 32px;
  background: var(--accent);
  color: var(--bg-void);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  transition: opacity var(--dur) var(--ease);
}

.mon-thread-send:hover:not(:disabled) { opacity: 0.85; }
.mon-thread-send:disabled { opacity: 0.35; cursor: not-allowed; }

.mon-char-count {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--fg-mute);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 40px;
  text-align: right;
}

.mon-char-count.warn { color: var(--prio-2); }
.mon-char-count.over { color: var(--status-error); }

.mon-thread-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-mute);
  text-align: center;
  padding: 20px;
}

/* --- Tab badge for awaitingInput count --- */
#view-toggle-monitor {
  position: relative;
}

#mon-tab-badge {
  position: absolute;
  top: 4px;
  right: -2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  display: grid;
  place-items: center;
  background: var(--prio-2);
  color: #000;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(11, 15, 23, 0.85);
}

#mon-tab-badge[hidden] { display: none; }

/* ────────────────────────────────────────────────
   AWAITING INPUT status (amber — highest user-attention)
   ──────────────────────────────────────────────── */
.status-dot[data-s="awaiting_input"] {
  background: var(--prio-2);
  box-shadow: 0 0 0 0 rgba(244, 183, 64, 0.5);
  animation: pulse-approval 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.mon-status-pill[data-s="awaiting_input"] {
  background: rgba(244, 183, 64, 0.12);
  border-color: rgba(244, 183, 64, 0.4);
  color: var(--prio-2);
}

/* ────────────────────────────────────────────────
   AWAITING APPROVAL status (purple/teal)
   ──────────────────────────────────────────────── */
.status-dot[data-s="awaiting_approval"] {
  background: #9b72cf;
  box-shadow: 0 0 0 0 rgba(155, 114, 207, 0.5);
  animation: pulse-approval 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.mon-status-pill[data-s="awaiting_approval"] {
  background: rgba(155, 114, 207, 0.15);
  border-color: rgba(155, 114, 207, 0.4);
  color: #b89fe0;
}

.monitor-card.needs-approval {
  border-color: rgba(155, 114, 207, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(155, 114, 207, 0.2), inset 0 0 20px rgba(155, 114, 207, 0.04);
}

.mon-approval-badge {
  position: absolute;
  top: -6px;
  right: 24px;
  background: #9b72cf;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  z-index: 2;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  pointer-events: none;
}

.mon-approval-preview {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-mute);
  font-style: italic;
  padding: 5px 8px;
  margin-top: 6px;
  background: rgba(155, 114, 207, 0.06);
  border-left: 2px solid rgba(155, 114, 207, 0.35);
  border-radius: 0 3px 3px 0;
  max-height: 36px;
  overflow: hidden;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

@keyframes pulse-approval {
  0%, 100% { box-shadow: 0 0 0 0 rgba(155, 114, 207, 0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(155, 114, 207, 0); }
}

/* ────────────────────────────────────────────────
   FULLSCREEN WORKER VIEW — takes over centre column
   ──────────────────────────────────────────────── */
.monitor-panel.fs-active > .monitor-panel-scroll {
  overflow: hidden; /* fullscreen manages its own scroll */
}

.mon-fullscreen {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-in-right 160ms var(--ease) both;
}

.mon-fs-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.015);
}

.mon-fs-back-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--fg-base);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  white-space: nowrap;
}
.mon-fs-back-btn:hover { background: rgba(255, 255, 255, 0.12); }

.mon-fs-title {
  display: flex;
  flex-direction: column;
}

.mon-fs-stats {
  display: flex;
  gap: 14px;
  margin-left: 6px;
  flex-wrap: wrap;
}
.mon-fs-stat {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-mute);
}
.mon-fs-stat strong {
  color: var(--fg-base);
  margin-right: 3px;
}

.mon-fs-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.mon-fs-left {
  padding: 14px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mon-fs-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mon-fs-section-title {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

.mon-fs-summary {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-base);
  line-height: 1.65;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  min-height: 44px;
}
.mon-fs-summary.idle { color: var(--fg-mute); }

.mon-fs-context-box {
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.mon-fs-context-box.question {
  background: rgba(244, 183, 64, 0.06);
  border-color: rgba(244, 183, 64, 0.25);
  color: var(--prio-2);
}
.mon-fs-context-box.approval {
  background: rgba(155, 114, 207, 0.06);
  border-color: rgba(155, 114, 207, 0.25);
  color: #b89fe0;
}
.mon-fs-context-label {
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
  display: block;
}

.mon-fs-approval-summary {
  margin-bottom: 8px;
  line-height: 1.5;
}

.mon-fs-approval-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.mon-fs-approve-btn {
  flex: 1;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(77, 208, 160, 0.5);
  background: rgba(77, 208, 160, 0.12);
  color: #4dd0a0;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.mon-fs-approve-btn:hover:not(:disabled) {
  background: rgba(77, 208, 160, 0.22);
}
.mon-fs-approve-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mon-fs-feedback-btn {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: 9px;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.mon-fs-feedback-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg-primary);
}

.mon-fs-thread-header {
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.mon-fs-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mon-fs-footer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 7px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.mon-fs-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm);
  color: var(--fg-base);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 5px 8px;
  resize: none;
  min-height: 28px;
  max-height: 80px;
}
.mon-fs-input:focus { outline: none; border-color: var(--accent); }

.mon-fs-send {
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  color: #000;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  height: 28px;
  white-space: nowrap;
}
.mon-fs-send:disabled { opacity: 0.4; cursor: not-allowed; }

.mon-fs-terminal {
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  max-height: 220px;
}
.mon-fs-terminal-body {
  overflow-y: auto;
  max-height: 180px;
}
.mon-fs-terminal-pre {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-mute);
  padding: 8px 14px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* ============================================================
   Agents tab (P2 of agent-dashboard-ux-overhaul-2026-04-30)
   - Grid of agent cards (default landing).
   - List view toggle handed off to legacy #panel-monitor kanban.
   ============================================================ */

.agents-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 16px 18px;
}

.agents-panel.hidden { display: none; }

.agents-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.agents-panel-header__left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.agents-panel-title {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg, #d6dee9);
}

.agents-summary {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.agents-summary__chip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  background: rgba(255, 255, 255, 0.02);
}

.agents-summary__chip--healthy { color: var(--status-online, #4fd48a); border-color: rgba(79, 212, 138, 0.3); }
.agents-summary__chip--stale   { color: var(--prio-2, #f4b740); border-color: rgba(244, 183, 64, 0.3); }
.agents-summary__chip--down    { color: var(--status-error, #ff7a63); border-color: rgba(255, 122, 99, 0.3); }
.agents-summary__chip--total   { color: var(--fg-mute, #8b97a8); border-color: rgba(255, 255, 255, 0.08); }

.agents-panel-header__right {
  display: flex;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.02);
}

.agents-view-btn {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  padding: 4px 10px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--fg-mute, #8b97a8);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.agents-view-btn:hover { color: var(--fg, #d6dee9); }
.agents-view-btn.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg, #d6dee9);
}

.agents-halt-banner {
  background: rgba(255, 122, 99, 0.10);
  border: 1px solid rgba(255, 122, 99, 0.35);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--status-error, #ff7a63);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agents-halt-banner.hidden { display: none; }

.agents-halt-banner__btn {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  padding: 4px 12px;
  background: rgba(255, 122, 99, 0.20);
  border: 1px solid rgba(255, 122, 99, 0.4);
  border-radius: 4px;
  color: var(--status-error, #ff7a63);
  cursor: pointer;
}

.agents-halt-banner__btn:hover {
  background: rgba(255, 122, 99, 0.30);
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  overflow-y: auto;
  align-content: start;
  flex: 1;
}

.agents-loading {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--fg-mute, #8b97a8);
  padding: 32px;
  text-align: center;
  grid-column: 1 / -1;
}

.agents-grid-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
  min-height: 124px;
  position: relative;
  outline: none;
}

.agents-grid-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.agents-grid-card:focus-visible {
  border-color: rgba(77, 208, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(77, 208, 255, 0.15);
}

.agents-grid-card--halted {
  border-color: rgba(255, 122, 99, 0.35);
  background: rgba(255, 122, 99, 0.05);
}

.agents-grid-card__avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.agents-grid-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.agents-grid-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agents-grid-card__row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agents-grid-card__name {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg, #d6dee9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agents-grid-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  flex-wrap: wrap;
}

.agents-grid-card__systemname {
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--fg-mute, #8b97a8);
  font-size: 11px;
}

.agent-archetype-tag {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.agents-grid-card__modelchip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--fg-mute, #8b97a8);
  margin-left: auto;
}

.agents-grid-card__taskline {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 12px;
  color: var(--fg-mute, #8b97a8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agents-grid-card__row3 {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
  font-size: 10px;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--fg-mute, #8b97a8);
}

.agents-grid-card__lastact {
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--fg-mute, #8b97a8);
  font-size: 10px;
}

.agent-crash-badge {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(244, 183, 64, 0.15);
  color: var(--prio-2, #f4b740);
  border: 1px solid rgba(244, 183, 64, 0.3);
}

.agent-crash-badge--halt {
  background: rgba(255, 122, 99, 0.18);
  color: var(--status-error, #ff7a63);
  border-color: rgba(255, 122, 99, 0.4);
}

/* Status pill on agent cards (matches monitor.js .mon-status-pill colour palette) */
.agent-status {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  border: 1px solid;
}

.agent-status--idle             { background: rgba(139,151,168,0.10); border-color: rgba(139,151,168,0.2); color: var(--status-waiting, #8b97a8); }
.agent-status--online           { background: rgba(79,212,138,0.10);  border-color: rgba(79,212,138,0.2);  color: var(--status-online, #4fd48a); }
.agent-status--working          { background: rgba(77,208,255,0.10);  border-color: rgba(77,208,255,0.25); color: var(--status-working, #4dd0ff); }
.agent-status--waiting          { background: rgba(139,151,168,0.10); border-color: rgba(139,151,168,0.2); color: var(--status-waiting, #8b97a8); }
.agent-status--stuck            { background: rgba(244,183,64,0.12);  border-color: rgba(244,183,64,0.3);  color: var(--prio-2, #f4b740); }
.agent-status--awaiting_input   { background: rgba(244,183,64,0.18);  border-color: rgba(244,183,64,0.4);  color: var(--prio-2, #f4b740); }
.agent-status--awaiting_approval{ background: rgba(244,183,64,0.18);  border-color: rgba(244,183,64,0.4);  color: var(--prio-2, #f4b740); }
.agent-status--errored          { background: rgba(255,122,99,0.12);  border-color: rgba(255,122,99,0.3);  color: var(--status-error, #ff7a63); }
.agent-status--dead             { background: rgba(255,122,99,0.12);  border-color: rgba(255,122,99,0.3);  color: var(--status-error, #ff7a63); }
.agent-status--addressing_feedback { background: rgba(77,208,255,0.10); border-color: rgba(77,208,255,0.25); color: var(--status-working, #4dd0ff); }
.agent-status--awaiting_audit   { background: rgba(244,183,64,0.12);  border-color: rgba(244,183,64,0.3);  color: var(--prio-2, #f4b740); }

/* Mobile breakpoints (audit-B B5 fix preview - full responsive lands in P3) */
@media (max-width: 768px) {
  .agents-grid { grid-template-columns: 1fr; }
  .agents-panel { padding: 12px; }
  .agents-panel-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Agent detail page (P3 of agent-dashboard-ux-overhaul-2026-04-30)
   - Hash route #/agents/<name>[/<tab>]
   - Tabs: Profile / Activity / Chat / Logs / Tasks
   - Mobile breakpoints (audit-B B5 fix)
   ============================================================ */

.agent-detail-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 0;
}

.agent-detail-panel.hidden { display: none; }

.agent-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  position: sticky;
  top: 0;
  z-index: 5;
}

.agent-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--fg, #d6dee9);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
}

.agent-detail-back:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.agent-detail-header__avatar {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.agent-detail-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.agent-detail-header__meta {
  flex: 1;
  min-width: 0;
}

.agent-detail-header__row1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.agent-detail-name {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--fg, #d6dee9);
}

.agent-detail-header__row2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.agent-detail-systemname {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--fg-mute, #8b97a8);
}

.agent-detail-modelchip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--fg-mute, #8b97a8);
}

.agent-detail-tagline {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 12px;
  color: var(--fg-mute, #8b97a8);
}

.agent-detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0 22px;
  background: rgba(0, 0, 0, 0.04);
}

.agent-detail-tab {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--fg-mute, #8b97a8);
  padding: 12px 16px;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.agent-detail-tab:hover { color: var(--fg, #d6dee9); }

.agent-detail-tab.active {
  color: var(--fg, #d6dee9);
  border-bottom-color: var(--accent, #4dd0ff);
}

.agent-detail-tab-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}

.agent-detail-loading,
.agent-detail-empty {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--fg-mute, #8b97a8);
  padding: 24px;
  text-align: center;
}

.agent-detail-empty-hint {
  font-size: 11px;
  margin-top: 6px;
}

.agent-detail-empty-notice {
  background: rgba(244, 183, 64, 0.10);
  border: 1px solid rgba(244, 183, 64, 0.30);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--prio-2, #f4b740);
}

/* Profile tab */

.agent-detail-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.agent-detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 14px 16px;
}

.agent-detail-card h3 {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg, #d6dee9);
  margin: 0 0 10px;
}

.agent-detail-roleline {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  color: var(--fg, #d6dee9);
  line-height: 1.45;
  margin: 0 0 10px;
}

.agent-detail-soul-excerpt {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  font-style: italic;
  color: var(--fg-mute, #8b97a8);
  line-height: 1.55;
  margin: 0 0 10px;
}

.agent-detail-link {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--accent, #4dd0ff);
  text-decoration: none;
}

.agent-detail-link:hover { text-decoration: underline; }

.agent-detail-kv {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agent-detail-kv__row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
}

.agent-detail-kv__k {
  color: var(--fg-mute, #8b97a8);
}

.agent-detail-kv__v {
  color: var(--fg, #d6dee9);
  text-align: right;
}

.agent-detail-stale-badge {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(244, 183, 64, 0.15);
  color: var(--prio-2, #f4b740);
  border: 1px solid rgba(244, 183, 64, 0.30);
  margin-left: 8px;
  vertical-align: middle;
}

.agent-detail-stale-badge--never {
  background: rgba(139, 151, 168, 0.10);
  color: var(--fg-mute, #8b97a8);
  border-color: rgba(139, 151, 168, 0.20);
}

.agent-detail-guardrails {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-detail-guardrails li {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(255, 122, 99, 0.05);
  border-left: 2px solid rgba(255, 122, 99, 0.4);
  border-radius: 0 4px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.agent-detail-guardrail-rule {
  color: var(--fg, #d6dee9);
  font-weight: 500;
}

.agent-detail-guardrail-why {
  color: var(--fg-mute, #8b97a8);
  font-size: 11px;
}

/* Activity tab */

.agent-activity-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.agent-activity-select {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--fg, #d6dee9);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.agent-activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.agent-activity-item {
  display: grid;
  grid-template-columns: 75px 110px 1fr;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  align-items: baseline;
  font-size: 12px;
}

.agent-activity-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.agent-activity-time {
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--fg-mute, #8b97a8);
  font-size: 11px;
}

.agent-activity-source {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg-mute, #8b97a8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: uppercase;
  text-align: center;
}

.agent-activity-source--crashes { background: rgba(255, 122, 99, 0.12); color: var(--status-error, #ff7a63); border-color: rgba(255, 122, 99, 0.3); }
.agent-activity-source--restarts { background: rgba(244, 183, 64, 0.12); color: var(--prio-2, #f4b740); border-color: rgba(244, 183, 64, 0.3); }
.agent-activity-source--feedback-sent { background: rgba(14, 165, 233, 0.10); color: var(--accent, #4dd0ff); border-color: rgba(14, 165, 233, 0.25); }
.agent-activity-source--telegram-history { background: rgba(79, 212, 138, 0.10); color: var(--status-online, #4fd48a); border-color: rgba(79, 212, 138, 0.25); }
.agent-activity-source--dashboard-forwards { background: rgba(124, 58, 237, 0.10); color: #c4b5fd; border-color: rgba(124, 58, 237, 0.25); }

.agent-activity-text {
  color: var(--fg, #d6dee9);
  word-break: break-word;
  line-height: 1.4;
}

.agent-activity-loadmore {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--fg, #d6dee9);
  padding: 8px 16px;
  border-radius: 4px;
  margin: 12px auto;
  display: block;
  cursor: pointer;
}

.agent-activity-loadmore:hover { background: rgba(255, 255, 255, 0.08); }

.agent-activity-end {
  text-align: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--fg-mute, #8b97a8);
  padding: 16px 0;
}

/* Logs tab */

.agent-logs-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.agent-logs-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--fg-mute, #8b97a8);
}

.agent-logs-select {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--fg, #d6dee9);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.agent-logs-refresh {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--fg, #d6dee9);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
}

.agent-logs-pre {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--fg, #d6dee9);
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
  max-height: calc(100vh - 360px);
  overflow-y: auto;
}

/* Tasks tab */

.agent-tasks-summary {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--fg-mute, #8b97a8);
  margin-bottom: 14px;
}

.agent-tasks-group { margin-bottom: 16px; }

.agent-tasks-group__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  font-weight: 600;
  color: var(--fg, #d6dee9);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.agent-tasks-status {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg-mute, #8b97a8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.agent-tasks-status--in_progress { background: rgba(77, 208, 255, 0.10); color: var(--status-working, #4dd0ff); border-color: rgba(77, 208, 255, 0.25); }
.agent-tasks-status--done       { background: rgba(79, 212, 138, 0.10); color: var(--status-online, #4fd48a); border-color: rgba(79, 212, 138, 0.25); }
.agent-tasks-status--blocked    { background: rgba(255, 122, 99, 0.12); color: var(--status-error, #ff7a63); border-color: rgba(255, 122, 99, 0.3); }

.agent-tasks-count { color: var(--fg-mute, #8b97a8); font-weight: 400; }

.agent-tasks-list { list-style: none; padding: 0; margin: 0; }

.agent-tasks-item {
  display: grid;
  grid-template-columns: 36px 1fr 110px;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  align-items: baseline;
  font-size: 12px;
}

.agent-tasks-item:hover { background: rgba(255, 255, 255, 0.02); }

.agent-tasks-priority {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  text-align: center;
  padding: 1px 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg-mute, #8b97a8);
}

.agent-tasks-priority--1 { background: rgba(255, 122, 99, 0.15); color: var(--status-error, #ff7a63); }
.agent-tasks-priority--2 { background: rgba(244, 183, 64, 0.15); color: var(--prio-2, #f4b740); }
.agent-tasks-priority--3 { background: rgba(79, 212, 138, 0.10); color: var(--status-online, #4fd48a); }

.agent-tasks-title { color: var(--fg, #d6dee9); }

.agent-tasks-updated {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--fg-mute, #8b97a8);
  text-align: right;
}

/* Mobile breakpoints (audit-B B5 fix) */

@media (max-width: 1023px) {
  .agent-detail-profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .agent-detail-header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }
  .agent-detail-header__avatar { width: 48px; height: 48px; }
  .agent-detail-header__meta { width: 100%; }
  .agent-detail-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 0 12px;
  }
  .agent-detail-tab { white-space: nowrap; padding: 10px 12px; font-size: 12px; }
  .agent-detail-tab-body { padding: 12px; }
  .agent-activity-item { grid-template-columns: 60px 80px 1fr; gap: 6px; }
  .agent-tasks-item { grid-template-columns: 30px 1fr 70px; gap: 6px; }
}

/* ============================================================
   Agent detail Chat tab (P4)
   - Visual differentiation per audit-B B6:
     User msgs       -> right-aligned blue tint
     Agent msgs      -> left-aligned default (bus)
     task_complete   -> left-aligned green-bordered
     audit_verdict   -> left-aligned amber/red/green pill per verdict
     question        -> left-aligned amber-bordered
     system          -> center-aligned grey italic
   ============================================================ */

#agent-detail-tab-body:has(.agent-chat-messages) {
  display: flex;
  flex-direction: column;
  padding: 0;
  height: 100%;
}

.agent-chat-disabled-banner {
  background: rgba(244, 183, 64, 0.10);
  border: 1px solid rgba(244, 183, 64, 0.30);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 12px 18px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--prio-2, #f4b740);
}

.agent-chat-load-older {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--fg, #d6dee9);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  align-self: center;
  margin: 10px auto 0;
  display: block;
}

.agent-chat-load-older:hover { background: rgba(255, 255, 255, 0.08); }
.agent-chat-load-older.hidden { display: none; }

.agent-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-chat-empty {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--fg-mute, #8b97a8);
  padding: 32px;
  text-align: center;
}

.agent-chat-loading {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--fg-mute, #8b97a8);
  padding: 16px;
  text-align: center;
}

/* Bubble base */
.agent-chat-bubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 12px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.agent-chat-bubble--right {
  align-self: flex-end;
  background: rgba(14, 165, 233, 0.18);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: var(--fg, #d6dee9);
}

.agent-chat-bubble--left {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--fg, #d6dee9);
}

.agent-chat-bubble--center {
  align-self: center;
  background: transparent;
  border: 0;
  color: var(--fg-mute, #8b97a8);
  font-style: italic;
  font-size: 11px;
  font-family: var(--font-mono, ui-monospace, monospace);
  max-width: 80%;
  text-align: center;
}

/* Type-specific tweaks (audit-B B6) */
.agent-chat-bubble--task_complete {
  border-color: rgba(79, 212, 138, 0.4);
  background: rgba(79, 212, 138, 0.06);
}

.agent-chat-bubble--audit_verdict {
  border-color: rgba(244, 183, 64, 0.4);
  background: rgba(244, 183, 64, 0.06);
}

.agent-chat-bubble--question {
  border-color: rgba(244, 183, 64, 0.5);
  background: rgba(244, 183, 64, 0.10);
}

.agent-chat-bubble--feedback {
  /* user-sent feedback uses --right styling; nothing extra */
}

.agent-chat-bubble__head {
  margin-bottom: 4px;
}

.agent-chat-bubble__body {
  /* preserve user line breaks */
}

.agent-chat-bubble__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  color: var(--fg-mute, #8b97a8);
}

.agent-chat-time { letter-spacing: 0.04em; }

.agent-chat-via {
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--fg-mute, #8b97a8);
  opacity: 0.7;
}

.agent-chat-typeflag {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid;
}

.agent-chat-typeflag--complete  { color: var(--status-online, #4fd48a); border-color: rgba(79, 212, 138, 0.4); background: rgba(79, 212, 138, 0.10); }
.agent-chat-typeflag--question  { color: var(--prio-2, #f4b740); border-color: rgba(244, 183, 64, 0.4); background: rgba(244, 183, 64, 0.10); }
.agent-chat-typeflag--system    { color: var(--fg-mute, #8b97a8); border-color: rgba(139, 151, 168, 0.3); background: rgba(139, 151, 168, 0.06); }

.agent-chat-verdict-pill {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg-mute, #8b97a8);
}

.agent-chat-verdict-pill--pass {
  color: var(--status-online, #4fd48a);
  border-color: rgba(79, 212, 138, 0.4);
  background: rgba(79, 212, 138, 0.10);
}

.agent-chat-verdict-pill--fail {
  color: var(--status-error, #ff7a63);
  border-color: rgba(255, 122, 99, 0.4);
  background: rgba(255, 122, 99, 0.12);
}

.agent-chat-verdict-pill--pass-with-caveats {
  color: var(--prio-2, #f4b740);
  border-color: rgba(244, 183, 64, 0.4);
  background: rgba(244, 183, 64, 0.10);
}

.agent-chat-input-bar {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.20);
  padding: 12px 18px;
}

.agent-chat-soft-warning {
  background: rgba(244, 183, 64, 0.08);
  border: 1px solid rgba(244, 183, 64, 0.25);
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--prio-2, #f4b740);
}

.agent-chat-input-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.agent-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--fg, #d6dee9);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  resize: vertical;
  min-height: 36px;
  max-height: 200px;
}

.agent-chat-input:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.5);
}

.agent-chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.agent-chat-send {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  background: rgba(14, 165, 233, 0.20);
  border: 1px solid rgba(14, 165, 233, 0.40);
  color: var(--accent, #4dd0ff);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  align-self: flex-end;
}

.agent-chat-send:hover:not(:disabled) {
  background: rgba(14, 165, 233, 0.30);
}

.agent-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.agent-chat-toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  z-index: 100;
  max-width: 360px;
}

.agent-chat-toast--info {
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.30);
  color: var(--accent, #4dd0ff);
}

.agent-chat-toast--warning {
  background: rgba(244, 183, 64, 0.12);
  border: 1px solid rgba(244, 183, 64, 0.30);
  color: var(--prio-2, #f4b740);
}

.agent-chat-toast--error {
  background: rgba(255, 122, 99, 0.12);
  border: 1px solid rgba(255, 122, 99, 0.30);
  color: var(--status-error, #ff7a63);
}

@media (max-width: 767px) {
  .agent-chat-bubble { max-width: 90%; font-size: 13px; }
  .agent-chat-input-bar { padding: 8px 12px; }
}

/* =========================================================================
   v2 Command Center - Agents tab body (3-column shell)
   Lives entirely inside #panel-agents-grid.agents-panel--v2.
   Outer dashboard chrome (top-rail / left sidebar / right sidebar) is
   strictly untouched - every rule below is namespaced under .agents-panel--v2
   or its descendants.
   ========================================================================= */

.agents-panel--v2 {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.agents-panel--v2 .agents-halt-banner {
  margin: 12px 16px 0;
  flex: 0 0 auto;
}

.agents-v2-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px;
  background: linear-gradient(135deg,
    rgba(11, 17, 32, 0.55) 0%,
    rgba(6, 10, 18, 0.85) 100%);
  position: relative;
  overflow: hidden;
}

.agents-v2-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(77, 208, 255, 0.06), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(77, 208, 255, 0.04), transparent 65%);
  z-index: 0;
}

.agents-v2-shell > * {
  position: relative;
  z-index: 1;
  min-height: 0;
}

.agent-sidebar-root {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(11, 17, 32, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  padding: 14px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-md);
}

.agent-stage-root {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Glass-morphism card primitive used by every v2 tile. */
.v2-card {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.v2-card:hover { border-color: var(--edge-strong); }

.v2-card__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.v2-card__label::before {
  content: '';
  width: 4px;
  height: 12px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-dim));
  border-radius: 2px;
  display: inline-block;
}

/* Loading placeholder shown until V2.3/V2.4 widgets mount. */
.agents-v2-shell .agents-loading {
  font-size: 12px;
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
  padding: 24px 12px;
  text-align: center;
  font-family: var(--font-mono);
}

/* ---------- v2 responsive breakpoints ---------- */

@media (max-width: 1280px) {
  .agents-v2-shell {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }
}

@media (max-width: 1024px) {
  .agents-v2-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .agents-v2-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
  }
  .agent-sidebar-root {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
  }
}

/* ---------- v2 sidebar rows (V2.3) ---------- */

.agent-sidebar__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--edge-soft);
  margin-bottom: 8px;
}
.agent-sidebar__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.agent-sidebar__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
}

.agent-sidebar__banner {
  font-size: 11px;
  color: var(--prio-2);
  background: rgba(244, 183, 64, 0.08);
  border: 1px solid rgba(244, 183, 64, 0.22);
  border-radius: var(--r-md);
  padding: 6px 10px;
  margin: 4px 2px 8px;
  letter-spacing: 0.02em;
}

.agent-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.agent-sidebar__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  background: rgba(11, 17, 32, 0.4);
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  outline: none;
  position: relative;
}
.agent-sidebar__row:hover {
  background: rgba(15, 23, 42, 0.7);
  border-color: var(--edge-soft);
  transform: translateX(1px);
}
.agent-sidebar__row:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(77, 208, 255, 0.18);
}
.agent-sidebar__row--selected {
  background: rgba(77, 208, 255, 0.10);
  border-color: rgba(77, 208, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(77, 208, 255, 0.25),
    0 0 22px rgba(77, 208, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.agent-sidebar__row--selected::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-dim));
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(77, 208, 255, 0.6);
}
.agent-sidebar__row--halted {
  border-color: rgba(255, 122, 99, 0.3);
}

.agent-sidebar__avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(0, 0, 0, 0.2) 100%);
  border: 2px solid var(--edge-soft);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.agent-sidebar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.agent-sidebar__avatar[data-fallback]::after {
  content: attr(data-fallback);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--fg-primary);
  background: var(--archetype-color, var(--bg-raised-2));
}
.agent-sidebar__row--selected .agent-sidebar__avatar {
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(77, 208, 255, 0.45);
}

.agent-sidebar__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-sidebar__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-sidebar__row--selected .agent-sidebar__name {
  color: #fff;
}
.agent-sidebar__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--fg-tertiary);
}
.agent-sidebar__uptime {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.agent-sidebar__add {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: transparent;
  border: 1px dashed var(--edge-soft);
  border-radius: var(--r-md);
  color: var(--fg-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.agent-sidebar__add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.agent-sidebar__add-plus {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.agent-sidebar__empty {
  font-size: 11px;
  color: var(--fg-tertiary);
  padding: 16px 8px;
  text-align: center;
}

/* ---------- V3.16 inline approval buttons (sidebar row) ---------- */
.agent-sidebar__qcard {
  margin-top: 6px;
  background: rgba(244, 183, 64, 0.05);
  border: 1px solid rgba(244, 183, 64, 0.18);
  border-radius: var(--r-md);
  padding: 6px 8px;
}
.agent-sidebar__qheader {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--prio-2, #f4b740);
  text-transform: uppercase;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-sidebar__qbody {
  font-size: 11px;
  color: var(--fg-secondary);
  line-height: 1.35;
  margin-bottom: 6px;
  /* Allow up to 2 lines, then ellipsis - sidebar is narrow */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agent-sidebar__approval {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.agent-sidebar__appr-btn {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--edge-soft);
  background: rgba(11, 17, 32, 0.55);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.agent-sidebar__appr-btn:hover {
  background: rgba(15, 23, 42, 0.85);
  color: var(--fg-primary);
}
.agent-sidebar__appr-btn--approve {
  border-color: rgba(79, 212, 138, 0.45);
  color: var(--status-online, #4fd48a);
}
.agent-sidebar__appr-btn--approve:hover {
  background: rgba(79, 212, 138, 0.12);
  border-color: rgba(79, 212, 138, 0.75);
}
.agent-sidebar__appr-btn--feedback {
  border-color: rgba(244, 183, 64, 0.45);
  color: var(--prio-2, #f4b740);
}
.agent-sidebar__appr-btn--feedback:hover {
  background: rgba(244, 183, 64, 0.12);
  border-color: rgba(244, 183, 64, 0.75);
}
.agent-sidebar__appr-btn--wait {
  border-color: rgba(139, 151, 168, 0.4);
  color: var(--fg-tertiary);
}
.agent-sidebar__appr-btn--wait:hover {
  background: rgba(139, 151, 168, 0.12);
}
.agent-sidebar__appr-btn--pending {
  opacity: 0.55;
  cursor: progress;
}
.agent-sidebar__appr-btn:disabled {
  cursor: not-allowed;
}
/* V3.16: optimistic update placeholder shown after click, before the next
   roster poll. Replaces the button row briefly. */
.agent-sidebar__approval--pending {
  display: flex;
  justify-content: center;
  padding: 6px 4px;
}
.agent-sidebar__appr-pending {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-transform: uppercase;
  font-family: var(--font-mono);
  animation: pendingPulse 1.4s ease-in-out infinite;
}
@keyframes pendingPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ---------- V3.16 active workers subsection ---------- */
.agent-sidebar__subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 6px 6px;
  margin-top: 10px;
  border-top: 1px dashed var(--edge-soft);
}
.agent-sidebar__subhead-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}
.agent-sidebar__subhead-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
}
.agent-sidebar__list--workers {
  flex: 0 0 auto;
  max-height: 180px;
  overflow-y: auto;
}
.agent-sidebar__row--worker {
  background: rgba(11, 17, 32, 0.25);
  padding: 6px 8px;
  gap: 8px;
}
.agent-sidebar__row--worker .agent-sidebar__avatar {
  width: 36px;
  height: 36px;
  border-width: 1px;
  background: rgba(77, 208, 255, 0.05);
}
.agent-sidebar__row--worker .agent-sidebar__avatar[data-fallback]::after {
  font-size: 14px;
  color: var(--accent);
  background: transparent;
}
.agent-sidebar__row--worker .agent-sidebar__name {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
}
.agent-sidebar__row--worker:hover .agent-sidebar__name {
  color: var(--fg-primary);
}
.agent-sidebar__worker-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-tertiary);
  letter-spacing: 0.02em;
}

/* ---------- V3.16 worker detail (read-only stage view) ---------- */
.worker-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 32px;
  height: 100%;
  overflow-y: auto;
}
.worker-detail__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.worker-detail__back {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  padding: 6px 12px;
  font-size: 11px;
  color: var(--fg-secondary);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all var(--dur) var(--ease);
}
.worker-detail__back:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.worker-detail__title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg-primary);
  margin: 0;
  font-family: var(--font-mono);
}
.worker-detail__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.worker-detail__meta-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(77, 208, 255, 0.08);
  border: 1px solid rgba(77, 208, 255, 0.25);
  color: var(--accent);
  letter-spacing: 0.04em;
}
.worker-detail__meta-pill--session {
  background: rgba(139, 151, 168, 0.08);
  border-color: rgba(139, 151, 168, 0.2);
  color: var(--fg-tertiary);
}
.worker-detail__readonly {
  font-size: 11px;
  color: var(--fg-tertiary);
  font-style: italic;
}
.worker-detail__pre {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--fg-secondary);
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  max-height: 360px;
}
.worker-detail__pane,
.worker-detail__activity {
  padding: 14px 16px;
}

/* ---------- V3.16 fleet-wide pending-approvals drawer ---------- */
.waiting-drawer {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: block;
  pointer-events: auto;
  transition: opacity 220ms var(--ease, ease);
}
.waiting-drawer--hidden {
  pointer-events: none;
  opacity: 0;
}
.waiting-drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(2, 7, 17, 0.55);
  backdrop-filter: blur(2px);
}
.waiting-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 92vw);
  background: var(--bg-elevated, #0b1120);
  border-left: 1px solid var(--edge-soft);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 240ms var(--ease, ease);
}
.waiting-drawer--hidden .waiting-drawer__panel {
  transform: translateX(100%);
}
.waiting-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--edge-soft);
}
.waiting-drawer__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--prio-2, #f4b740);
  text-transform: uppercase;
}
.waiting-drawer__sub {
  font-size: 13px;
  color: var(--fg-secondary);
  margin-top: 2px;
}
.waiting-drawer__close {
  background: transparent;
  border: none;
  color: var(--fg-secondary);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 140ms var(--ease, ease);
}
.waiting-drawer__close:hover { color: var(--fg-primary); }
.waiting-drawer__list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.waiting-drawer__loading,
.waiting-drawer__empty {
  text-align: center;
  font-size: 13px;
  color: var(--fg-tertiary);
  padding: 40px 12px;
  font-style: italic;
}
.waiting-drawer__item {
  position: relative;
  background: rgba(244, 183, 64, 0.06);
  border: 1px solid rgba(244, 183, 64, 0.22);
  border-radius: var(--r-md);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: opacity 200ms var(--ease, ease);
}
.waiting-drawer__item--pending { opacity: 0.5; }
.waiting-drawer__item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--fg-tertiary);
}
.waiting-drawer__agent-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(77, 208, 255, 0.10);
  border: 1px solid rgba(77, 208, 255, 0.25);
  color: var(--accent, #4dd0ff);
  padding: 2px 7px;
  border-radius: 4px;
}
.waiting-drawer__sent {
  font-family: var(--font-mono);
}
.waiting-drawer__qheader {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--prio-2, #f4b740);
  text-transform: uppercase;
}
.waiting-drawer__qbody {
  font-size: 13px;
  line-height: 1.45;
  color: var(--fg-primary);
}
.waiting-drawer__buttons {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.waiting-drawer__btn {
  flex: 1 1 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--edge-soft);
  background: rgba(11, 17, 32, 0.6);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all 140ms var(--ease, ease);
}
.waiting-drawer__btn:hover {
  color: var(--fg-primary);
  background: rgba(15, 23, 42, 0.85);
}
.waiting-drawer__btn--approve {
  border-color: rgba(79, 212, 138, 0.45);
  color: var(--status-online, #4fd48a);
}
.waiting-drawer__btn--approve:hover {
  background: rgba(79, 212, 138, 0.12);
  border-color: rgba(79, 212, 138, 0.75);
}
.waiting-drawer__btn--feedback {
  border-color: rgba(244, 183, 64, 0.45);
  color: var(--prio-2, #f4b740);
}
.waiting-drawer__btn--feedback:hover {
  background: rgba(244, 183, 64, 0.12);
  border-color: rgba(244, 183, 64, 0.75);
}
.waiting-drawer__btn--wait {
  border-color: rgba(139, 151, 168, 0.4);
  color: var(--fg-tertiary);
}
.waiting-drawer__btn--wait:hover {
  background: rgba(139, 151, 168, 0.12);
}
.waiting-drawer__btn:disabled { cursor: not-allowed; }
.waiting-drawer__item-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 17, 32, 0.7);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent, #4dd0ff);
  text-transform: uppercase;
  animation: pendingPulse 1.4s ease-in-out infinite;
}
.agent-stage__waiting-badge--clickable {
  cursor: pointer;
  transition: filter 140ms var(--ease, ease);
}
.agent-stage__waiting-badge--clickable:hover {
  filter: brightness(1.18);
}

/* ---------- v2 stage splash (offline state) ---------- */

.agent-stage-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex: 1 1 auto;
  min-height: 320px;
  padding: 60px 24px;
  text-align: center;
}
.agent-stage-splash__brand {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(77, 208, 255, 0.45);
}
.agent-stage-splash__message {
  font-size: 14px;
  color: var(--fg-secondary);
  line-height: 1.6;
  max-width: 380px;
}
.agent-stage-splash__retry {
  margin-top: 8px;
  padding: 10px 28px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.agent-stage-splash__retry:hover {
  background: var(--accent);
  color: var(--bg-void);
  box-shadow: 0 0 16px rgba(77, 208, 255, 0.5);
}

/* ---------- v2 center stage (V2.4) ---------- */

.agent-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

.agent-stage__hero {
  display: grid;
  grid-template-columns: minmax(220px, 30%) minmax(0, 40%) minmax(0, 30%);
  gap: 16px;
  align-items: stretch;
}

.agent-stage__hero-projects,
.agent-stage__hero-side {
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.agent-stage__hero-projects-body,
.agent-stage__hero-side-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.agent-stage__hero-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px 10px;
  background: rgba(11, 17, 32, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 280px;
}

.agent-stage__avatar-glow {
  position: absolute;
  width: 480px;
  height: 480px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  background: radial-gradient(circle,
    rgba(77, 208, 255, 0.55) 0%,
    rgba(77, 208, 255, 0.30) 25%,
    rgba(77, 208, 255, 0.10) 50%,
    transparent 70%);
  filter: blur(38px);
  z-index: 0;
  pointer-events: none;
  animation: agent-stage-glow-pulse 5s ease-in-out infinite;
}

@keyframes agent-stage-glow-pulse {
  0%, 100% { opacity: 0.85; transform: translate(-50%, -52%) scale(1); }
  50%      { opacity: 1.0;  transform: translate(-50%, -52%) scale(1.06); }
}

.agent-stage__avatar-img {
  position: relative;
  z-index: 1;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow:
    0 0 0 1px rgba(77, 208, 255, 0.30),
    0 0 32px rgba(77, 208, 255, 0.40),
    0 12px 32px rgba(0, 0, 0, 0.55);
  background: rgba(8, 12, 20, 0.6);
}

@media (min-width: 1280px) {
  .agent-stage__avatar-img {
    width: 280px;
    height: 280px;
  }
}

@media (min-width: 1600px) {
  .agent-stage__avatar-img {
    width: 320px;
    height: 320px;
  }
}

.agent-stage__hero-name {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0 22px rgba(77, 208, 255, 0.35);
}

.agent-stage__hero-statusline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.agent-stage__uptime {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
}

/* Side card chips */
.agent-stage__chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.agent-stage__chip-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agent-stage__chip-section-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}
.agent-stage__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(77, 208, 255, 0.10);
  color: var(--fg-primary);
  border: 1px solid rgba(77, 208, 255, 0.22);
  white-space: nowrap;
}
.agent-stage__chip--muted {
  background: rgba(140, 175, 220, 0.06);
  color: var(--fg-secondary);
  border-color: var(--edge-soft);
}
.agent-stage__chip--warn {
  background: rgba(255, 122, 99, 0.12);
  color: var(--status-error);
  border-color: rgba(255, 122, 99, 0.30);
}

.agent-stage__project-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Tile strip + Health + Inter rows are scaffolding for V2.5; V2.4 only
   shows their loading placeholders. */
.agent-stage__tile-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-height: 200px;
}
.agent-stage__tile-strip:empty::before {
  content: 'Loading tiles…';
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  text-align: center;
  padding: 32px;
  background: rgba(11, 17, 32, 0.4);
  border: 1px dashed var(--edge-soft);
  border-radius: var(--r-lg);
}

.agent-stage__health-row,
.agent-stage__inter-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-stage__health-body,
.agent-stage__inter-body {
  flex: 1 1 auto;
  min-height: 60px;
}

@media (max-width: 1280px) {
  .agent-stage__hero {
    grid-template-columns: 1fr;
  }
  .agent-stage__avatar-img {
    width: 200px;
    height: 200px;
  }
  .agent-stage__hero-projects,
  .agent-stage__hero-side {
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .agent-stage__tile-strip {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 768px) {
  .agent-stage__tile-strip {
    grid-template-columns: 1fr;
  }
}

/* ---------- v2 tile primitives (V2.5) ---------- */

.agent-tile {
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.agent-tile__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agent-tile__empty {
  font-size: 11px;
  color: var(--fg-tertiary);
  letter-spacing: 0.02em;
  text-align: center;
  padding: 18px 8px;
}
.agent-tile__caption {
  font-size: 10px;
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
  text-align: right;
  padding-top: 6px;
  border-top: 1px solid var(--edge-soft);
  margin-top: auto;
}
.agent-tile__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.agent-tile__pill--ok    { background: rgba(79, 212, 138, 0.14); color: var(--status-online); border: 1px solid rgba(79, 212, 138, 0.28); }
.agent-tile__pill--info  { background: rgba(77, 208, 255, 0.14); color: var(--accent); border: 1px solid rgba(77, 208, 255, 0.28); }
.agent-tile__pill--muted { background: rgba(140, 175, 220, 0.06); color: var(--fg-tertiary); border: 1px solid var(--edge-soft); }

/* Projects card rows */
.agent-tile__project {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  background: rgba(8, 12, 20, 0.4);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
}
.agent-tile__project-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.agent-tile__project-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-tile__progress {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 3px;
  overflow: hidden;
}
.agent-tile__progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(77, 208, 255, 0.45);
  transition: width var(--dur) var(--ease);
}
.agent-tile__project-row2 {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
}
.agent-tile__project-pct {
  color: var(--accent);
  font-weight: 600;
}

/* Live Activity feed */
.agent-tile__feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.agent-tile__feed-row {
  display: grid;
  grid-template-columns: 38px 70px minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(140, 175, 220, 0.06);
}
.agent-tile__feed-time { color: var(--fg-tertiary); letter-spacing: 0.02em; }
.agent-tile__feed-kind {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--accent);
}
.agent-tile__feed-text {
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Upcoming Tasks list */
.agent-tile__tasks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-tile__task {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 56px;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  background: rgba(8, 12, 20, 0.4);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  font-size: 11px;
}
.agent-tile__task-prio {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  color: var(--fg-tertiary);
}
.agent-tile__task-prio--1 { color: var(--prio-1); }
.agent-tile__task-prio--2 { color: var(--prio-2); }
.agent-tile__task-prio--3 { color: var(--prio-3); }
.agent-tile__task-title {
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-tile__task-status {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-tertiary);
  text-align: right;
}

/* ---------- System Overview tile ---------- */

.system-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.system-overview--unavailable {
  display: block;
}
.system-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(8, 12, 20, 0.45);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
}
.system-metric__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.system-metric__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--fg-tertiary);
  text-transform: uppercase;
}
.system-metric__value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--fg-primary);
  letter-spacing: 0.02em;
}
.system-metric__unit {
  font-size: 9px;
  color: var(--fg-tertiary);
  margin-left: 2px;
}
.system-spark {
  width: 100%;
  height: 28px;
  display: block;
}
.system-overview__caption {
  margin-top: 8px;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--fg-tertiary);
  text-align: right;
}

/* ---------- Health Monitor pills ---------- */

.health-pills {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1024px) {
  .health-pills {
    grid-template-columns: 1fr 1fr;
  }
}
.health-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(8, 12, 20, 0.5);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  position: relative;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  cursor: default;
}
.health-pill:hover {
  border-color: var(--edge-strong);
}
.health-pill__head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.health-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.health-pill__name {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-primary);
  letter-spacing: 0.04em;
  flex: 1 1 auto;
}
.health-pill__status {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}
.health-pill__detail {
  font-size: 10px;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.health-pill__missing {
  font-size: 9px;
  color: var(--prio-2);
  letter-spacing: 0.06em;
}
.health-pill--healthy .health-pill__dot   { background: var(--status-online); box-shadow: 0 0 8px var(--status-online); }
.health-pill--healthy .health-pill__status { color: var(--status-online); }
.health-pill--healthy { border-color: rgba(79, 212, 138, 0.28); }
.health-pill--degraded .health-pill__dot   { background: var(--prio-2); box-shadow: 0 0 8px var(--prio-2); }
.health-pill--degraded .health-pill__status { color: var(--prio-2); }
.health-pill--degraded { border-color: rgba(244, 183, 64, 0.28); }
.health-pill--down .health-pill__dot   { background: var(--status-error); box-shadow: 0 0 10px var(--status-error); }
.health-pill--down .health-pill__status { color: var(--status-error); }
.health-pill--down { border-color: rgba(255, 122, 99, 0.30); background: rgba(255, 122, 99, 0.06); }
.health-pill--info .health-pill__dot   { background: var(--accent-dim); }
.health-pill--info .health-pill__status { color: var(--accent-dim); }

.health-popover {
  position: fixed;
  z-index: 9999;
  background: rgba(8, 12, 20, 0.95);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  max-width: 280px;
}
.health-popover__title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.health-popover__list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.health-popover__chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(244, 183, 64, 0.10);
  color: var(--prio-2);
  border: 1px solid rgba(244, 183, 64, 0.28);
  font-family: var(--font-mono);
}

/* ---------- V2.6 quick-command chips (per-agent chat takeover) ---------- */

.agent-chat-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px 10px;
  border-top: 1px solid var(--edge-soft);
  background: rgba(8, 12, 20, 0.4);
}
.agent-chat-quick-chip {
  appearance: none;
  background: rgba(77, 208, 255, 0.10);
  color: var(--accent);
  border: 1px solid rgba(77, 208, 255, 0.28);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.agent-chat-quick-chip:hover {
  background: rgba(77, 208, 255, 0.20);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(77, 208, 255, 0.35);
}
.agent-chat-quick-chip--danger {
  color: var(--prio-2);
  background: rgba(244, 183, 64, 0.10);
  border-color: rgba(244, 183, 64, 0.30);
}
.agent-chat-quick-chip--danger:hover {
  background: rgba(244, 183, 64, 0.20);
  border-color: var(--prio-2);
  box-shadow: 0 0 10px rgba(244, 183, 64, 0.35);
}

/* The takeover host inside #react-chat-root needs to take the full pane. */
.agent-chat-takeover {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ---------- V2.6 Inter-Agent Chat strip ---------- */

.agent-stage__inter-count {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--fg-tertiary);
  margin-left: auto;
}

.inter-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.inter-filter {
  display: flex;
  gap: 4px;
}
.inter-filter__btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--edge-soft);
  color: var(--fg-tertiary);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.inter-filter__btn:hover {
  border-color: var(--edge-strong);
  color: var(--fg-secondary);
}
.inter-filter__btn.is-active {
  background: rgba(77, 208, 255, 0.14);
  color: var(--accent);
  border-color: var(--accent);
}

.inter-collapse-toggle {
  appearance: none;
  background: rgba(140, 175, 220, 0.06);
  border: 1px dashed var(--edge-soft);
  color: var(--fg-secondary);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  font-size: 10px;
  cursor: pointer;
}
.inter-collapse-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.inter-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  max-height: 240px;
  overflow-y: auto;
}
.inter-row {
  display: grid;
  grid-template-columns: 50px 30px minmax(160px, 1fr) 60px 16px 2fr;
  gap: 8px;
  align-items: baseline;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.inter-row:hover { background: rgba(77, 208, 255, 0.06); }
.inter-row.is-expanded .inter-row__text {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.inter-row__time { color: var(--fg-tertiary); letter-spacing: 0.02em; }
.inter-row__rel { color: var(--fg-mute); font-size: 9px; }
.inter-row__route {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 11px;
}
.inter-row__from { color: var(--fg-primary); font-weight: 600; }
.inter-row__arrow { color: var(--accent); font-size: 12px; }
.inter-row__to { color: var(--fg-secondary); }
.inter-row__kind {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--accent);
}
.inter-row__reply {
  color: var(--fg-tertiary);
  font-size: 11px;
}
.inter-row__text {
  color: var(--fg-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inter-row--task .inter-row__kind     { color: var(--accent); }
.inter-row--complete .inter-row__kind { color: var(--status-online); }
.inter-row--sibling .inter-row__kind  { color: var(--fg-tertiary); }
.inter-row--feedback .inter-row__kind { color: var(--prio-2); }

.inter-empty {
  font-size: 11px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  text-align: center;
  padding: 18px 8px;
  letter-spacing: 0.02em;
}

@media (max-width: 1024px) {
  .inter-row {
    grid-template-columns: 50px 30px minmax(120px, 1fr) 50px 16px 1.5fr;
    gap: 6px;
  }
}
@media (max-width: 768px) {
  .inter-row {
    grid-template-columns: 50px minmax(100px, 1fr) 50px 1fr;
  }
  .inter-row__rel,
  .inter-row__reply { display: none; }
}

/* =========================================================================
   V2.7 - Polish (animations + glow + glass-morphism finalization)
   ========================================================================= */

/* Tighten glass-morphism: deeper blur, slightly more saturation, softer
   border on top edge to suggest a light source from above. */
.v2-card,
.agent-sidebar-root,
.agent-stage__hero-avatar {
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.62) 0%,
    rgba(11, 17, 32, 0.55) 100%);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Smoother sidebar row selection animation (extends V2.3 transitions). */
.agent-sidebar__row,
.agent-sidebar__avatar,
.agent-sidebar__row::before {
  transition: all 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Stagger tile content fade-in when the stage swaps to a new agent.
   Each top-level row delays slightly so the eye travels top->bottom. */
@keyframes agent-stage-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.agent-stage > * {
  animation: agent-stage-fade-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.agent-stage > .agent-stage__hero        { animation-delay:   0ms; }
.agent-stage > .agent-stage__tile-strip  { animation-delay:  60ms; }
.agent-stage > .agent-stage__health-row  { animation-delay: 120ms; }
.agent-stage > .agent-stage__inter-row   { animation-delay: 180ms; }

/* Hero avatar tightened: stronger inner shine + slow rotation hint on the
   glow ring so the stage feels alive without overpowering the content. */
.agent-stage__hero-avatar {
  border-image: linear-gradient(135deg, rgba(77, 208, 255, 0.30), rgba(77, 208, 255, 0.05) 60%, rgba(77, 208, 255, 0.18)) 1;
}
.agent-stage__avatar-img {
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.agent-stage__hero-avatar:hover .agent-stage__avatar-img {
  transform: scale(1.02);
}

/* Tile cards: subtle hover lift + stronger top-edge highlight. */
.v2-card {
  position: relative;
  transition:
    border-color 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.v2-card::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08) 50%, transparent);
  pointer-events: none;
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
}
.v2-card:hover {
  border-color: var(--edge-strong);
  box-shadow:
    var(--shadow-lg),
    0 0 24px rgba(77, 208, 255, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

/* Health pill glow on healthy/down to draw the eye. */
.health-pill--down,
.health-pill--degraded {
  animation: health-pill-attention 2.2s ease-in-out infinite;
}
@keyframes health-pill-attention {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 14px rgba(255, 122, 99, 0.25), inset 0 0 0 1px rgba(255, 122, 99, 0.20); }
}

/* Sparkline strokes use accent color animation when last value is fresh. */
.system-spark path:last-of-type {
  filter: drop-shadow(0 0 6px rgba(77, 208, 255, 0.30));
}

/* Quick-command chip pulse on hover for the destructive /approve. */
.agent-chat-quick-chip--danger {
  position: relative;
}
.agent-chat-quick-chip--danger::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 1px solid rgba(244, 183, 64, 0);
  pointer-events: none;
  transition: border-color 180ms ease;
}
.agent-chat-quick-chip--danger:hover::before {
  border-color: rgba(244, 183, 64, 0.45);
  animation: chip-pulse 1.4s ease-in-out infinite;
}
@keyframes chip-pulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1.0; }
}

/* Inter-agent rows: gentle highlight when freshly added (within 30s). */
.inter-row {
  transition: background-color 200ms ease;
}
.inter-row:focus-within {
  background: rgba(77, 208, 255, 0.10);
  outline: 1px solid rgba(77, 208, 255, 0.25);
}

/* Sidebar add-agent button glow on hover. */
.agent-sidebar__add {
  position: relative;
  overflow: hidden;
}
.agent-sidebar__add::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(77, 208, 255, 0.15) 0%,
    transparent 70%);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
}
.agent-sidebar__add:hover::after {
  opacity: 1;
}

/* Reduce motion respect (a11y). */
@media (prefers-reduced-motion: reduce) {
  .agent-stage > *,
  .agent-stage__avatar-glow,
  .health-pill--down,
  .health-pill--degraded,
  .agent-chat-quick-chip--danger:hover::before {
    animation: none !important;
  }
  * {
    transition-duration: 80ms !important;
  }
}

/* =========================================================================
   V3 Agents tab redesign (2026-05-01) - matches Jarvis Agent Tab Inspo.png

   Goals (per Rishi feedback):
   1. Hide outer-left sidebar (#sidebar-left) when Agents tab is active so
      the v2 Command Center sidebar gets the full horizontal width.
   2. Avatar dominates the hero - 480px circle with a strong cyan glow
      stage. Projects card floats to the LEFT of the avatar (no longer
      below). The right-side "Stack" column from V2 is gone.
   3. Health Monitor row (full-width) is gone. Its 4 pills now live as a
      compact footer row inside the System Overview tile.
   4. Visual cohesion: softer card borders, deeper backdrop blur, subtle
      gradient borders, tighter gaps. Less "8 widgets in a grid" - more
      "one composed scene".

   All rules below override the V2 layout. They live at the bottom so
   cascade order keeps V3 winning. Other tabs (Plans/Tasks/Schedule/etc.)
   are unaffected because the outer-left hide is keyed on body.view-active-agents.
   ========================================================================= */

/* ---------- 1. Hide outer-left sidebar when Agents tab is active ---------- */

body.view-active-agents #sidebar-left {
  display: none;
}

body.view-active-agents #main {
  /* Agents tab: outer-left collapses; panel-terminals fills the freed
     column, and outer-right Telegram/Usage stays at the same width. */
  grid-template-columns: minmax(0, 1fr) var(--right-w);
  gap: 8px;
  padding: 8px;
}

/* Tighten the panel chrome on the Agents tab so the v2 shell can blend
   into the surrounding chrome rather than fight it. */
body.view-active-agents #panel-terminals {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
body.view-active-agents #panel-terminals > .view-surface {
  background: transparent;
}
body.view-active-agents #panel-terminals .panel-header {
  display: none;
}

/* ---------- 2. V3 hero: 2-column, big avatar dominates ---------- */

.agent-stage__hero {
  /* V3.8 single-screen fit: hero must NOT push the tile strip below
     the fold on a 1920x1080 viewport. Hero ~580px = ~55% of usable
     1080 height (1080 - header 50 - shell padding 24 = 1006; 580
     leaves 426 for tile strip + gap + inter row). Avatar inside
     scales to ~540px tall (height: 100%), keeping the full Meshy
     scene visible without clipping. */
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.45fr);
  gap: 14px;
  align-items: stretch;
  flex: 0 0 auto;
  height: 580px;
  min-height: 480px;
  max-height: 580px;
  overflow: hidden;
}

@media (min-width: 1700px) {
  .agent-stage__hero { height: 600px; min-height: 540px; max-height: 600px; }
}
@media (max-width: 1500px) {
  .agent-stage__hero { height: 520px; min-height: 460px; max-height: 520px; }
}
@media (max-width: 1280px) {
  .agent-stage__hero { height: 460px; min-height: 420px; max-height: 460px; }
}

.agent-stage__hero-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.agent-stage__hero-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 2px;
}

.agent-stage__hero-name {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 0.005em;
  color: #fff;
  margin: 0;
  text-shadow:
    0 0 24px rgba(77, 208, 255, 0.32),
    0 0 60px rgba(77, 208, 255, 0.12);
  line-height: 0.95;
  font-family: var(--font-display, var(--font-sans));
  text-transform: uppercase;
}

@media (max-width: 1500px) {
  .agent-stage__hero-name { font-size: 48px; }
}
@media (max-width: 1280px) {
  .agent-stage__hero-name { font-size: 42px; }
}

.agent-stage__hero-statusline {
  margin-top: 4px;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
}

.agent-stage__hero-statusline .agent-stage__uptime {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(140, 175, 220, 0.62);
}

/* Override the V2 status pill style for the hero - use a simple
   "● Active" / "● Working" inline style to match the reference. The
   coloured dot + lowercase status text reads cleaner than a chunky
   capsule pill at the hero scale. */
.agent-stage__hero-statusline .agent-stage__status {
  background: transparent !important;
  border: none !important;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  color: var(--status-online);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.agent-stage__hero-statusline .agent-stage__status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}
.agent-stage__hero-statusline .agent-status--idle { color: rgba(140, 175, 220, 0.55); }
.agent-stage__hero-statusline .agent-status--working { color: var(--status-online); }
.agent-stage__hero-statusline .agent-status--waiting { color: rgba(140, 175, 220, 0.55); }
.agent-stage__hero-statusline .agent-status--awaiting_input,
.agent-stage__hero-statusline .agent-status--awaiting_approval { color: var(--prio-2); }
.agent-stage__hero-statusline .agent-status--stuck,
.agent-stage__hero-statusline .agent-status--errored,
.agent-stage__hero-statusline .agent-status--dead { color: var(--status-error); }

/* Hero project card sits in the left column under the name; height fills
   so the bottom edge aligns with the avatar stage. */
.agent-stage__hero-projects {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 13px 16px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0) 30%),
    linear-gradient(155deg,
      rgba(15, 24, 42, 0.45) 0%,
      rgba(8, 14, 26, 0.65) 100%);
  border: 1px solid rgba(77, 208, 255, 0.05);
  border-radius: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 44px rgba(0, 0, 0, 0.30);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  position: relative;
}
.agent-stage__hero-projects::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(77, 208, 255, 0.06) 0%,
    transparent 8%);
}

.agent-stage__hero-projects-body {
  gap: 8px;
  font-size: 12px;
  position: relative;
  z-index: 1;
}

/* Empty-state inside hero projects card: subtle, doesn't shout. */
.agent-stage__hero-projects-body .agents-loading {
  font-size: 11px;
  color: rgba(140, 175, 220, 0.45);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  padding: 16px 8px;
  text-align: center;
  border: 1px dashed rgba(77, 208, 255, 0.10);
  border-radius: 10px;
  background: rgba(8, 14, 26, 0.25);
}

/* ---------- 3. V3 avatar stage: bigger glow, bigger orb, soft ring ---------- */

.agent-stage__hero-avatar {
  /* V3.2: the avatar is the FULL Meshy PNG (character + built-in cyan
     platform + floating cubes). To stop the rectangular grey bg from
     reading as a "pasted" rectangle, we wrap the whole thing in a
     circular stage with its own ambient cyan glow, and apply a
     radial mask to the img so the rectangular corners fade out
     before they reach the stage edge. The platform built into the
     PNG IS the platform - we no longer draw CSS rings on top of it. */
  background: transparent;
  border: none;
  backdrop-filter: none;
  box-shadow: none;
  padding: 0;
  min-height: 0;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.agent-stage__avatar-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* V3.4: ALL CSS stage effects (halo, core, rings, particles) removed
   per Rishi's feedback. The Meshy character (rembg-transparent) sits
   on the navy dashboard bg with no CSS environment around it. The
   character's own built-in brown 3D platform IS the base. The .glow
   / .platform-core / .ring / .particle selectors below are kept as
   safety nets so any leftover skeleton elements render to nothing
   if the cache hasn't refreshed - they all map to display: none. */
.agent-stage__hero-avatar .agent-stage__avatar-glow,
.agent-stage__hero-avatar .agent-stage__avatar-stage,
.agent-stage__avatar-platform,
.agent-stage__avatar-platform-core,
.agent-stage__avatar-ring,
.agent-stage__avatar-particle {
  display: none !important;
}

/* V3.7+V3.8: full Meshy JPG (no rembg) sized to FIT the hero on a
   1920x1080 viewport without scrolling. height: 100% locks to the
   hero (580px), max-width caps the column intrusion. The radial bg
   ::before below matches the JPG's #1d1c24 corner color so the
   rectangular img edges melt into the dashboard navy. */
.agent-stage__hero-avatar > .agent-stage__avatar-img {
  position: relative;
  z-index: 2;
  width: auto;
  height: 100%;
  max-height: 100%;
  max-width: 600px;
  border: none;
  border-radius: 0;
  background: transparent;
  filter: none;
  box-shadow: none;
  object-fit: contain;
  margin-bottom: 0;
}

/* V3.9: avatar PNG now has a feathered alpha mask baked in via PIL,
   so the rectangular bg fades to transparent at the corners before
   it hits the dashboard. The CSS radial bg-match is no longer needed
   - keep an empty rule selector so any cached version doesn't break. */
.agent-stage__hero-avatar::before { content: none; }

@media (min-width: 1700px) {
  .agent-stage__hero-avatar > .agent-stage__avatar-img { max-width: 640px; }
  .agent-stage__hero-name { font-size: 56px; }
}
@media (max-width: 1500px) {
  .agent-stage__hero-avatar > .agent-stage__avatar-img { max-width: 520px; }
}
@media (max-width: 1280px) {
  .agent-stage__hero-avatar > .agent-stage__avatar-img { max-width: 420px; }
  .agent-stage__hero-name { font-size: 36px; }
}
@media (max-width: 1180px) {
  .agent-stage__hero { grid-template-columns: 1fr; max-height: none; }
  .agent-stage__hero-avatar { min-height: 360px; }
  .agent-stage__hero-avatar > .agent-stage__avatar-img { max-width: 360px; }
}

/* ---------- 4. Tile strip: tighter cohesion, softer borders ---------- */

.agent-stage-root {
  gap: 12px;
  /* Don't flex-grow the parent stage scroller; let it scroll if content
     exceeds the viewport but keep the hero+tiles laid out predictably. */
}

.agent-stage__tile-strip {
  gap: 12px;
  min-height: 320px;
  flex: 1 1 auto;
  /* V3.8: tile strip fills the remaining vertical space below the
     580px hero. On 1080-tall viewport this gives ~400-440px which
     comfortably renders LIVE ACTIVITY + SYSTEM OVERVIEW + UPCOMING
     TASKS plus the embedded health pills inside System Overview. */
}
.agents-panel--v2 .agent-tile {
  min-height: 280px;
  height: 100%;
}

/* Each tile inside the strip is its own flex column with a scrollable
   body so content overflow doesn't push the layout. */
.agents-panel--v2 .agent-tile {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.agents-panel--v2 .agent-tile__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.agents-panel--v2 .agent-tile__body--split {
  /* The system tile body has two flex children; let the metrics scroll if
     needed and pin health to the bottom. */
  display: flex;
  flex-direction: column;
}
.agents-panel--v2 .agent-tile__system-metrics {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.agents-panel--v2 .agent-tile__health {
  flex: 0 0 auto;
}

.agent-stage__inter-row {
  flex: 0 0 auto;
}
.agent-stage__inter-body {
  max-height: 120px;
  overflow-y: auto;
}

/* V3 cards: glassier, near-borderless. The reference reads as ONE
   composed scene rather than 8 separate cards in a grid - this is the
   biggest cohesion lever. We use a tinted-glass background gradient,
   a hairline 1px border at very low opacity, and a soft inset top
   highlight so cards feel like glass plates floating on the deep
   navy stage rather than enclosed boxes. */
.agents-panel--v2 .v2-card {
  border-color: rgba(77, 208, 255, 0.05);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0) 30%),
    linear-gradient(155deg,
      rgba(15, 24, 42, 0.42) 0%,
      rgba(8, 14, 26, 0.65) 100%);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(77, 208, 255, 0.03),
    0 14px 44px rgba(0, 0, 0, 0.30);
  border-radius: 16px;
  padding: 13px 16px 12px;
  transition: border-color 240ms ease, box-shadow 240ms ease;
  position: relative;
}
.agents-panel--v2 .v2-card::after {
  /* Faint cyan highlight along the top edge - reads as light catching
     the edge of glass, helps the cards feel like a single material. */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(77, 208, 255, 0.06) 0%,
    transparent 8%);
}
.agents-panel--v2 .v2-card:hover {
  border-color: rgba(77, 208, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 16px 48px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(77, 208, 255, 0.05);
}

.agents-panel--v2 .v2-card__label {
  font-size: 9px;
  letter-spacing: 0.22em;
  margin-bottom: 10px;
  color: rgba(140, 175, 220, 0.55);
}
.agents-panel--v2 .v2-card__label::before {
  width: 3px;
  height: 10px;
  background: linear-gradient(to bottom, var(--accent), rgba(77, 208, 255, 0.35));
  border-radius: 2px;
}

/* V3.4: shell background simplified - flat navy gradient only. The
   radial accent (rgba(20,34,58,0.55) at 50%/10%) was creating a
   visible bluer area around the upper-center where the avatar sits.
   Per Rishi's "no CSS effects underneath the avatar" rule. */
.agents-v2-shell {
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 14px 14px;
  background: linear-gradient(135deg,
    rgba(7, 12, 22, 0.72) 0%,
    rgba(4, 8, 16, 0.92) 100%);
}

@media (min-width: 1600px) {
  .agents-v2-shell { grid-template-columns: 280px minmax(0, 1fr); gap: 18px; }
}

.agents-v2-shell::before {
  /* V3.4: shell ambient cyan gradient removed - it was creating a
     visible cyan halo in the upper-right where the avatar sits,
     which read as a CSS effect behind the avatar even though the
     avatar's own halo/rings/particles were removed. */
  background: none;
}

/* V3 sidebar - even softer; merges into the shell rather than fighting
   for visual weight. */
.agent-sidebar-root {
  background: linear-gradient(180deg,
    rgba(11, 17, 32, 0.55) 0%,
    rgba(7, 12, 22, 0.72) 100%);
  border: 1px solid rgba(77, 208, 255, 0.06);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-radius: 14px;
  padding: 10px 9px;
  gap: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 14px 40px rgba(0, 0, 0, 0.40);
}

/* ---------- 5. System tile split: metrics top, health pills footer ---------- */

.agents-panel--v2 .agent-tile__body--split {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
}

.agents-panel--v2 .agent-tile__system-metrics {
  flex: 1 1 auto;
  min-height: 0;
}

/* Compact health pills that match the reference - just 4 small chips with
   a coloured dot, name, and status word. Sit as a footer row in System
   Overview, separated by a subtle hairline. */
.agents-panel--v2 .agent-tile__health {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(77, 208, 255, 0.08);
}
.agents-panel--v2 .agent-tile__health:empty {
  /* Don't show the divider until pills paint. */
  border-top: none;
  padding-top: 0;
}

.agents-panel--v2 .agent-tile__health .health-pills {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.agents-panel--v2 .agent-tile__health .health-pill {
  padding: 6px 8px;
  background: rgba(8, 14, 26, 0.5);
  border-color: rgba(77, 208, 255, 0.10);
  border-radius: 8px;
  gap: 2px;
}
.agents-panel--v2 .agent-tile__health .health-pill__head {
  gap: 6px;
}
.agents-panel--v2 .agent-tile__health .health-pill__name {
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.agents-panel--v2 .agent-tile__health .health-pill__status {
  font-size: 8px;
}
.agents-panel--v2 .agent-tile__health .health-pill__detail,
.agents-panel--v2 .agent-tile__health .health-pill__missing {
  display: none;
}
.agents-panel--v2 .agent-tile__health .health-pill__dot {
  width: 6px;
  height: 6px;
}

@media (max-width: 1180px) {
  .agents-panel--v2 .agent-tile__health .health-pills {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- 6. System metrics inside the tile - 4-column row matching ref ---------- */

.agents-panel--v2 .system-overview {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 1366px) {
  .agents-panel--v2 .system-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.agents-panel--v2 .system-metric {
  background: rgba(6, 11, 22, 0.45);
  border: 1px solid rgba(77, 208, 255, 0.04);
  border-radius: 8px;
  padding: 7px 8px 5px;
  gap: 2px;
}

.agents-panel--v2 .system-metric__label {
  font-size: 9px;
  letter-spacing: 0.10em;
}

.agents-panel--v2 .system-metric__value {
  font-size: 14px;
}

.agents-panel--v2 .system-spark {
  height: 22px;
}

.agents-panel--v2 .system-overview__caption {
  margin-top: 6px;
  font-size: 8px;
}

/* ---------- 7. Inter-Agent chat row: hidden on the Agents tab to
   match the reference photo (avatar + tile strip is the whole scene).
   Keep the module loaded so cross-tab callers can still read it via
   window.InterAgentChat, but don't render it visually. ---------- */

.agent-stage__inter-row {
  display: none;
}

/* ---------- 8. Sidebar rows: tighter, glassier ---------- */

.agent-sidebar__row {
  border-color: rgba(77, 208, 255, 0.06);
  background: rgba(8, 14, 26, 0.42);
  border-radius: 10px;
  padding: 8px 10px;
}
.agent-sidebar__row:hover {
  border-color: rgba(77, 208, 255, 0.22);
  background: rgba(11, 20, 36, 0.58);
}
.agent-sidebar__row--selected {
  border-color: rgba(77, 208, 255, 0.55);
  background: linear-gradient(155deg,
    rgba(77, 208, 255, 0.14) 0%,
    rgba(77, 208, 255, 0.04) 100%);
  box-shadow:
    0 0 0 1px rgba(77, 208, 255, 0.30),
    0 8px 24px rgba(77, 208, 255, 0.15);
}

/* ---------- 9. Project rows inside the hero card ---------- */

.agents-panel--v2 .agent-tile__project {
  background: rgba(8, 14, 26, 0.45);
  border: 1px solid rgba(77, 208, 255, 0.06);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 200ms ease, background 200ms ease;
}
.agents-panel--v2 .agent-tile__project:hover {
  border-color: rgba(77, 208, 255, 0.22);
  background: rgba(11, 20, 36, 0.60);
}

/* ---------- 10. Outer right rail: matching softness for cohesion ---------- */

body.view-active-agents #sidebar-right .panel {
  border-color: rgba(77, 208, 255, 0.08);
  background: linear-gradient(155deg,
    rgba(13, 21, 38, 0.68) 0%,
    rgba(8, 14, 26, 0.82) 100%);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 8px 28px rgba(0, 0, 0, 0.32);
}

/* ---------- 11. Tile strip responsive: stack 1-col on narrow screens ---------- */

@media (max-width: 900px) {
  .agent-stage__tile-strip {
    grid-template-columns: 1fr;
  }
}

/* ---------- V3.9 new tile content ---------- */

/* 3-up stat row inside Today's Work */
.agents-panel--v2 .agent-tile__stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.agents-panel--v2 .agent-tile__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  background: rgba(8, 14, 26, 0.5);
  border: 1px solid rgba(77, 208, 255, 0.06);
  border-radius: 10px;
}
.agents-panel--v2 .agent-tile__stat-num {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent, #4dd0ff);
  letter-spacing: 0.02em;
}
.agents-panel--v2 .agent-tile__stat-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(140, 175, 220, 0.55);
}

.agents-panel--v2 .agent-tile__sub-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(140, 175, 220, 0.55);
  margin: 8px 0 4px;
}

/* Waiting banner: prominent pill with count */
.agents-panel--v2 .agent-tile__waiting-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(77, 208, 255, 0.08);
  border: 1px solid rgba(77, 208, 255, 0.20);
  margin-bottom: 10px;
}
.agents-panel--v2 .agent-tile__waiting-banner--warn {
  background: rgba(244, 183, 64, 0.10);
  border-color: rgba(244, 183, 64, 0.32);
}
.agents-panel--v2 .agent-tile__waiting-count {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 22px;
  font-weight: 700;
  color: var(--prio-2, #f4b740);
  line-height: 1;
}
.agents-panel--v2 .agent-tile__waiting-banner:not(.agent-tile__waiting-banner--warn) .agent-tile__waiting-count {
  color: rgba(140, 175, 220, 0.65);
}
.agents-panel--v2 .agent-tile__waiting-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(214, 222, 233, 0.85);
}

/* V3.15: Conversations tile - inter-agent dialog rows */
.agents-panel--v2 .agent-tile__filter-row {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.agents-panel--v2 .agent-tile__filter-pill {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 14, 26, 0.5);
  border: 1px solid rgba(77, 208, 255, 0.10);
  color: rgba(140, 175, 220, 0.65);
  cursor: pointer;
  transition: all 160ms ease;
}
.agents-panel--v2 .agent-tile__filter-pill:hover {
  border-color: rgba(77, 208, 255, 0.30);
  color: rgba(160, 230, 255, 0.95);
}
.agents-panel--v2 .agent-tile__filter-pill--active {
  background: rgba(77, 208, 255, 0.16);
  border-color: rgba(77, 208, 255, 0.45);
  color: rgba(160, 230, 255, 1);
}
.agents-panel--v2 .agent-tile__convo-row {
  display: grid;
  grid-template-columns: 30px auto 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(77, 208, 255, 0.04);
}
.agents-panel--v2 .agent-tile__convo-row:last-child { border-bottom: none; }
.agents-panel--v2 .agent-tile__convo-time {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  color: rgba(140, 175, 220, 0.55);
  letter-spacing: 0.04em;
}
.agents-panel--v2 .agent-tile__convo-pair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.agents-panel--v2 .agent-tile__convo-peer {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
}
.agents-panel--v2 .agent-tile__convo-peer--in {
  color: var(--accent, #4dd0ff);
  background: rgba(77, 208, 255, 0.10);
  border: 1px solid rgba(77, 208, 255, 0.22);
}
.agents-panel--v2 .agent-tile__convo-peer--out {
  color: var(--prio-2, #f4b740);
  background: rgba(244, 183, 64, 0.10);
  border: 1px solid rgba(244, 183, 64, 0.22);
}
.agents-panel--v2 .agent-tile__convo-arrow {
  color: rgba(140, 175, 220, 0.45);
  font-size: 11px;
}

/* V3.15: hero waiting badge */
.agent-stage__waiting-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(244, 183, 64, 0.14);
  border: 1px solid rgba(244, 183, 64, 0.40);
  font-family: var(--font-mono, ui-monospace, monospace);
  width: fit-content;
}
.agent-stage__waiting-badge-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--prio-2, #f4b740);
  letter-spacing: 0.02em;
}
.agent-stage__waiting-badge-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 183, 64, 0.85);
}

/* V3.15: hide the inter-agent strip entirely - Conversations tile
   replaces it as the primary inter-agent surface. */
.agent-stage__inter-row { display: none !important; }

/* Approval / question feed kinds */
/* V3.12: live pulse on Recent Activity tile label */
.agents-panel--v2 .agent-tile__live-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(79, 212, 138, 0.95);
  box-shadow: 0 0 6px rgba(79, 212, 138, 0.85), 0 0 12px rgba(79, 212, 138, 0.45);
  margin-left: 6px;
  vertical-align: middle;
  animation: agent-tile-live-pulse 1.6s ease-in-out infinite;
}
@keyframes agent-tile-live-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.15); }
}

/* V3.10: current task block inside Recent Activity tile */
.agents-panel--v2 .agent-tile__current-task {
  background: linear-gradient(155deg, rgba(77, 208, 255, 0.10), rgba(77, 208, 255, 0.02));
  border: 1px solid rgba(77, 208, 255, 0.18);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.agents-panel--v2 .agent-tile__current-task--idle {
  background: rgba(8, 14, 26, 0.45);
  border-color: rgba(140, 175, 220, 0.10);
  color: rgba(140, 175, 220, 0.65);
  font-size: 11px;
  font-style: italic;
}
.agents-panel--v2 .agent-tile__current-task-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(214, 222, 233, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agents-panel--v2 .agent-tile__current-task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: rgba(140, 175, 220, 0.65);
}
.agents-panel--v2 .agent-tile__current-task-age {
  letter-spacing: 0.04em;
}

.agents-panel--v2 .agent-tile__feed-kind--inprogress { color: var(--accent, #4dd0ff); border-color: rgba(77, 208, 255, 0.45); background: rgba(77, 208, 255, 0.12); border: 1px solid; padding: 1px 6px; border-radius: 3px; font-size: 9px; }
.agents-panel--v2 .agent-tile__feed-kind--done { color: var(--status-online, #4fd48a); border-color: rgba(79, 212, 138, 0.4); background: rgba(79, 212, 138, 0.10); border: 1px solid; padding: 1px 6px; border-radius: 3px; font-size: 9px; }
.agents-panel--v2 .agent-tile__feed-kind--approval { color: var(--prio-2, #f4b740); border-color: rgba(244, 183, 64, 0.5); background: rgba(244, 183, 64, 0.12); border: 1px solid; padding: 1px 6px; border-radius: 3px; font-size: 9px; }
.agents-panel--v2 .agent-tile__feed-kind--question { color: var(--accent, #4dd0ff); border-color: rgba(77, 208, 255, 0.4); background: rgba(77, 208, 255, 0.10); border: 1px solid; padding: 1px 6px; border-radius: 3px; font-size: 9px; }

/* Fleet pulse strip (only renders when flags exist) */
.agent-stage__fleet-pulse {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(244, 183, 64, 0.10);
  border: 1px solid rgba(244, 183, 64, 0.32);
  border-radius: 12px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.agent-stage__fleet-pulse-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(244, 183, 64, 0.85);
  font-weight: 700;
}
.agent-stage__fleet-pulse-item {
  font-size: 11px;
  color: rgba(214, 222, 233, 0.85);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(8, 14, 26, 0.45);
}
.agent-stage__fleet-pulse-item--error {
  color: var(--status-error, #ff7a63);
  border: 1px solid rgba(255, 122, 99, 0.40);
}
.agent-stage__fleet-pulse-item--warn {
  color: var(--prio-2, #f4b740);
  border: 1px solid rgba(244, 183, 64, 0.40);
}


/* V3.13: per-agent chat takeover REVERTED. The custom .agent-chat-takeover
   bubble UI was removed; react-chat is the single chat experience. We
   keep one tiny rule: hide the legacy .agent-chat-takeover wrapper if it
   somehow still gets mounted (e.g. cached agent-detail-chat.js). */
.agent-chat-takeover { display: none !important; }


/* =============================================================
   YouTube tab (panel-yt). Mirrors the v2-card glass aesthetic.
   ============================================================= */

#panel-yt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
  padding: 12px 16px 16px;
  gap: 14px;
  overflow: hidden;
}
#panel-yt.hidden { display: none; }

.yt-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--edge-soft);
}
.yt-panel-header__left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.yt-panel-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent, #4DD0FF);
}
.yt-panel-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary, #5d6b87);
  letter-spacing: 0.04em;
}
.yt-panel-meta--stale { color: #f4b740; }

.yt-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(77, 208, 255, 0.10);
  border: 1px solid rgba(77, 208, 255, 0.40);
  color: var(--accent, #4DD0FF);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.yt-refresh-btn:hover {
  background: rgba(77, 208, 255, 0.18);
  border-color: rgba(77, 208, 255, 0.65);
}
.yt-refresh-btn:disabled { opacity: 0.55; cursor: progress; }
.yt-refresh-btn__icon {
  display: inline-block;
  font-size: 13px;
  line-height: 1;
}
.yt-refresh-btn--spinning .yt-refresh-btn__icon {
  animation: yt-spin 0.9s linear infinite;
}
@keyframes yt-spin { to { transform: rotate(360deg); } }

.yt-panel-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
}

.yt-loading {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-tertiary, #5d6b87);
  padding: 24px;
  text-align: center;
}

.yt-empty {
  padding: 32px 16px;
  text-align: center;
  font-family: var(--font-mono);
  border: 1px dashed var(--edge-soft);
  border-radius: 8px;
}
.yt-empty__title { font-size: 13px; color: var(--fg-secondary, #b8c2d6); margin-bottom: 6px; }
.yt-empty__hint { font-size: 11px; color: var(--fg-tertiary, #5d6b87); }
.yt-empty__hint code {
  background: rgba(77, 208, 255, 0.08);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}

/* ---- channel cards grid ---- */
.yt-channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.yt-channel-card {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--edge-soft);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
  font-family: inherit;
  color: inherit;
}
.yt-channel-card:hover { border-color: var(--edge-strong, rgba(255,255,255,0.18)); }
.yt-channel-card--selected {
  border-color: rgba(77, 208, 255, 0.65);
  background: rgba(77, 208, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(77, 208, 255, 0.20);
}
.yt-channel-card--empty .yt-card__statline { opacity: 0.55; }

.yt-card__row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.yt-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-primary, #e6ecf4);
  letter-spacing: 0.01em;
}
.yt-card__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #4DD0FF);
  box-shadow: 0 0 8px rgba(77, 208, 255, 0.7);
}
.yt-card__handle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary, #5d6b87);
}
.yt-card__chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: #f4b740;
  background: rgba(244, 183, 64, 0.10);
  border: 1px solid rgba(244, 183, 64, 0.30);
  padding: 2px 6px;
  border-radius: 4px;
  width: max-content;
  text-transform: uppercase;
}
.yt-card__statline {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-top: 2px;
}
.yt-card__stat { display: flex; flex-direction: column; gap: 1px; }
.yt-card__stat-num {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-primary, #e6ecf4);
  letter-spacing: 0.02em;
}
.yt-card__stat-lbl {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.10em;
  color: var(--fg-tertiary, #5d6b87);
  text-transform: uppercase;
}
.yt-card__metaline {
  display: flex;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-tertiary, #5d6b87);
}
.yt-card__sep { opacity: 0.5; }

/* ---- detail section ---- */
.yt-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.yt-detail-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.yt-detail-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg-primary, #e6ecf4);
  margin: 0;
}
.yt-detail-handle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary, #5d6b87);
}
.yt-detail-section { display: flex; flex-direction: column; gap: 8px; }
.yt-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-tertiary, #5d6b87);
  display: flex;
  align-items: center;
  gap: 8px;
}
.yt-section-label::before {
  content: '';
  width: 4px;
  height: 12px;
  background: linear-gradient(to bottom, var(--accent, #4DD0FF), var(--accent-dim, #2DA8D8));
  border-radius: 2px;
  display: inline-block;
}

.yt-detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.yt-stat-card {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--edge-soft);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.yt-stat-card__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-tertiary, #5d6b87);
}
.yt-stat-card__big {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--fg-primary, #e6ecf4);
}
.yt-stat-card__sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary, #5d6b87);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-stat-card__hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-secondary, #b8c2d6);
  line-height: 1.5;
}
.yt-stat-card--empty { grid-column: 1 / -1; }

/* ---- videos table ---- */
.yt-videos-table {
  background: rgba(15, 23, 42, 0.40);
  border: 1px solid var(--edge-soft);
  border-radius: 8px;
  overflow: hidden;
}
.yt-table__head, .yt-table__row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) 110px 110px 130px;
  gap: 12px;
  padding: 10px 14px;
  align-items: center;
}
.yt-table__head {
  background: rgba(15, 23, 42, 0.65);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--fg-tertiary, #5d6b87);
  border-bottom: 1px solid var(--edge-soft);
}
.yt-table__row {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
}
.yt-table__row:last-child { border-bottom: none; }
.yt-table__row:hover { background: rgba(77, 208, 255, 0.04); }
.yt-row-title {
  color: var(--fg-primary, #e6ecf4);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.yt-row-title:hover { color: var(--accent, #4DD0FF); }
.yt-col-num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-align: right;
  color: var(--fg-secondary, #b8c2d6);
}
/* Stacked metric cell: big primary on top, dim secondary line under it. */
.yt-cell-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: var(--font-mono);
  text-align: right;
  line-height: 1.15;
}
.yt-cell-primary {
  font-size: 13px;
  color: var(--fg-primary, #e6ecf4);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.yt-cell-secondary {
  font-size: 10px;
  color: var(--fg-tertiary, #5d6b87);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.yt-calib-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(77, 208, 255, 0.10);
  color: var(--accent, #4DD0FF);
  border: 1px solid rgba(77, 208, 255, 0.30);
  vertical-align: middle;
  cursor: help;
}
.yt-calib-badge--raw {
  background: rgba(255,255,255,0.04);
  color: var(--fg-tertiary, #5d6b87);
  border-color: var(--edge-soft);
}
.yt-table-empty {
  padding: 16px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary, #5d6b87);
}

/* ---- pending uploads ---- */
.yt-pending-list { display: flex; flex-direction: column; gap: 8px; }
.yt-pending-empty {
  padding: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary, #5d6b87);
  border: 1px dashed var(--edge-soft);
  border-radius: 8px;
}
.yt-pending-item {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--edge-soft);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.yt-pending__row1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.yt-pending__slug {
  color: var(--fg-secondary, #b8c2d6);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.yt-pending__status {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.06);
  color: var(--fg-tertiary, #5d6b87);
  border: 1px solid var(--edge-soft);
}
.yt-pending__status--ready {
  color: #6BCB77;
  background: rgba(107, 203, 119, 0.10);
  border-color: rgba(107, 203, 119, 0.30);
}
.yt-pending__status--pending {
  color: #f4b740;
  background: rgba(244, 183, 64, 0.10);
  border-color: rgba(244, 183, 64, 0.30);
}
.yt-pending__age {
  margin-left: auto;
  color: var(--fg-tertiary, #5d6b87);
}
.yt-pending__title {
  font-size: 12.5px;
  color: var(--fg-primary, #e6ecf4);
}
.yt-pending__premise {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-tertiary, #5d6b87);
}
.yt-pending__missing {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #ff6b6b;
  margin-top: 2px;
}

/* ---- toast ---- */
.yt-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--edge-strong, rgba(255,255,255,0.18));
  color: var(--fg-primary, #e6ecf4);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 10000;
  max-width: 360px;
}
.yt-toast.hidden { display: none; }
.yt-toast--ok { border-color: rgba(77, 208, 255, 0.50); }
.yt-toast--err { border-color: rgba(255, 107, 107, 0.55); color: #ff8a8a; }

/* Narrow panes: collapse the videos table - keep title + performance only. */
@media (max-width: 800px) {
  .yt-table__head, .yt-table__row {
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 8px;
    padding: 8px 10px;
  }
  .yt-table__head > :nth-child(n+3),
  .yt-table__row > :nth-child(n+3) { display: none; }
}

/* ---- pending row action affordances ---- */
.yt-pending__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.yt-pending__download {
  color: var(--accent, #4DD0FF);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  padding-bottom: 1px;
}
.yt-pending__download:hover {
  border-bottom-color: var(--accent, #4DD0FF);
}
.yt-pending__posted-btn {
  background: transparent;
  border: 1px solid rgba(77, 208, 255, 0.40);
  color: var(--accent, #4DD0FF);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.yt-pending__posted-btn:hover {
  background: rgba(77, 208, 255, 0.10);
  border-color: var(--accent, #4DD0FF);
}
.yt-pending__posted-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

