/* ── Reset & tokens ────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* PowerPanne / ModuloTech brand palette */
  --brand:        #F97316;   /* PowerPanne orange */
  --brand-dark:   #EA6C0A;
  --brand-light:  #FED7AA;
  --brand-glow:   rgba(249,115,22,.18);

  --bg:           #0C0E13;
  --bg-card:      #141720;
  --bg-input:     #0C0E13;
  --border:       #252A36;
  --border-focus: #F97316;

  --text:         #F0F2F7;
  --text-muted:   #8A91A8;
  --text-dim:     #3E4459;

  --accent:       #F97316;
  --accent-hover: #EA6C0A;
  --accent-txt:   #ffffff;

  /* semantic colours */
  --green:   #34D399;
  --teal:    #22D3EE;
  --yellow:  #FBBF24;
  --red:     #F87171;
  --blue:    #60A5FA;
  --gold:    #F59E0B;
  --purple:  #A78BFA;
  --orange:  #F97316;

  --row-selected:  rgba(249,115,22,.10);
  --score-bar-bg:  #1C2030;
  --score-bar-fg:  #F97316;

  --radius:    8px;
  --radius-sm: 4px;
  --shadow:    0 4px 28px rgba(0,0,0,.5);

  --font:      "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.header {
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  /* orange left accent stripe */
  border-left: 3px solid var(--brand);
}

.header-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
}

.header-logo span { color: var(--brand); }

.header-sub {
  color: var(--text-muted);
  font-size: .82rem;
}

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.header-nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  transition: color .15s, border-color .15s, background .15s;
}

.header-nav-link:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: rgba(249,115,22,.06);
}

/* powered-by badge */
.header-poweredby {
  font-size: .72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: .35rem;
}

.header-poweredby strong { color: var(--brand); font-weight: 600; }


.main {
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.title-count {
  background: var(--border);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 500;
  padding: .1rem .45rem;
  border-radius: 99px;
}

/* ── Input panel ────────────────────────────────────────────────────────────── */

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.input-title {
  font-size: 1rem;
  font-weight: 600;
}

.input-hint {
  font-size: .78rem;
  color: var(--text-muted);
}

.snapshot-textarea {
  width: 100%;
  height: 220px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.5;
  padding: .75rem 1rem;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.snapshot-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.snapshot-textarea.drag-over {
  border-color: var(--brand);
  background: rgba(249,115,22,.04);
}

.snapshot-textarea::placeholder { color: var(--text-dim); }

/* ── Mission ID panel ───────────────────────────────────────────────────────── */

.mission-id-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.mission-id-input {
  flex: 1;
  min-width: 160px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .9rem;
  padding: .55rem .85rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
}
.mission-id-input::-webkit-inner-spin-button,
.mission-id-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.mission-id-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.mission-id-input::placeholder { color: var(--text-dim); }

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .75rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.char-count {
  font-size: .75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ── Toggle ─────────────────────────────────────────────────────────────────── */

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  user-select: none;
  font-size: .85rem;
  color: var(--text-muted);
}

.toggle-wrap input[type="checkbox"] {
  width: 36px;
  height: 20px;
  appearance: none;
  background: var(--border);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
}

.toggle-wrap input[type="checkbox"]::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform .2s;
}

.toggle-wrap input[type="checkbox"]:checked { background: var(--brand); }
.toggle-wrap input[type="checkbox"]:checked::after { transform: translateX(16px); }

.toggle-label { line-height: 1; }
.toggle-note  { font-size: .72rem; color: var(--text-dim); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn--primary:hover:not(:disabled) {
  background: var(--brand-dark);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.btn--primary:disabled       { opacity: .5; cursor: not-allowed; }
.btn--primary.btn--loading   { opacity: .75; }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn--ghost:hover { background: rgba(255,255,255,.04); color: var(--text); }

/* ── Status bar ─────────────────────────────────────────────────────────────── */

.status-bar {
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  border: 1px solid transparent;
}

.status-bar--info    { background: rgba(249,115,22,.08);  border-color: rgba(249,115,22,.25); color: var(--brand); }
.status-bar--success { background: rgba(52,211,153,.08);  border-color: rgba(52,211,153,.25); color: var(--green); }
.status-bar--error   { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.25); color: var(--red); }

/* ── Decision card ──────────────────────────────────────────────────────────── */

.decision-card {
  border-color: var(--brand);
  border-left-width: 3px;
  background: linear-gradient(135deg, #141720 0%, #16180F 100%);
}

.decision-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.decision-driver-id {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.driver-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
}

.driver-id {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--brand);
  font-family: var(--font-mono);
  line-height: 1;
  text-shadow: 0 0 24px rgba(249,115,22,.35);
}

.decision-meta {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  align-items: flex-end;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.meta-label { font-size: .78rem; color: var(--text-muted); }

.meta-value {
  font-size: .83rem;
  font-family: var(--font-mono);
  color: var(--text);
}

.decision-headline {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.primary-reason .section-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  display: block;
  margin-bottom: .35rem;
}

.primary-reason p { color: var(--text); font-size: .9rem; }

/* ── Data table ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.data-table th {
  text-align: left;
  padding: .5rem .75rem;
  color: var(--text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid rgba(37,42,54,.7);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover   { background: rgba(255,255,255,.025); }

.row--selected { background: var(--row-selected) !important; }
.row--human    { background: rgba(99,102,241,.08) !important; }

.rank-cell       { color: var(--text-muted); font-family: var(--font-mono); width: 2.5rem; text-align: center; }
.driver-cell     { font-family: var(--font-mono); }
.num-cell        { font-family: var(--font-mono); text-align: right; }
.explanation-cell { color: var(--text-muted); font-size: .82rem; }

.driver-name     { font-weight: 500; margin-right: .4rem; }
.driver-id-dim   { color: var(--text-dim); font-size: .78rem; }
.driver-id-inline { color: var(--text-dim); font-size: .8em; margin-left: .25em; }
.human-pick-badge { margin-left: .3rem; font-size: .85rem; cursor: help; }

.meta-value--warn { color: #f59e0b; }

/* ── Disagreement card ──────────────────────────────────────────────────────── */

.disagreement-card {
  border-left: 3px solid #f59e0b;
  background: rgba(245,158,11,.05);
}

.disagreement-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
  color: #f59e0b;
}

.disagreement-vs {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: rgba(0,0,0,.2);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.disagree-side {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.disagree-role {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

.disagree-name {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.disagree-arrow {
  font-size: 1.4rem;
  color: #f59e0b;
  flex-shrink: 0;
}

.disagreement-body {
  color: var(--text);
  font-size: .9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ── Score bar ──────────────────────────────────────────────────────────────── */

.score-bar-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 120px;
}

.score-bar {
  height: 6px;
  background: var(--score-bar-fg);
  border-radius: 99px;
  min-width: 2px;
}

.score-label {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Badges & pills ─────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .70rem;
  font-weight: 700;
  letter-spacing: .05em;
  white-space: nowrap;
  text-transform: uppercase;
}

.badge--orange { background: rgba(249,115,22,.15); color: var(--orange); }
.badge--green  { background: rgba(52,211,153,.12); color: var(--green); }
.badge--teal   { background: rgba(34,211,238,.12); color: var(--teal); }
.badge--yellow { background: rgba(251,191,36,.12); color: var(--yellow); }
.badge--red    { background: rgba(248,113,113,.12); color: var(--red); }
.badge--blue   { background: rgba(96,165,250,.12); color: var(--blue); }

.pill {
  display: inline-flex;
  padding: .1rem .45rem;
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
}

.pill--gold { background: rgba(245,158,11,.12); color: var(--gold); }
.pill--blue { background: rgba(96,165,250,.12); color: var(--blue); }
.pill--dim  { background: rgba(255,255,255,.04); color: var(--text-dim); }

/* ── Trade-off list ─────────────────────────────────────────────────────────── */

.tradeoff-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding-left: 1.2rem;
}

.tradeoff-list li {
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.5;
}

/* ── Recommendation card ────────────────────────────────────────────────────── */

.recommendation-card { border-left: 3px solid var(--brand); }

.recommendation-card p {
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.65;
}

/* ── Error card ─────────────────────────────────────────────────────────────── */

.error-card { border-color: var(--red); }
.error-message { color: var(--red); font-size: .9rem; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  text-align: center;
  font-size: .78rem;
  color: var(--text-dim);
}

.footer strong { color: var(--brand); font-weight: 600; }

/* ── Skeleton loader ────────────────────────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 25%, var(--border) 50%, var(--bg-card) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
  height: 1rem;
}

/* ── Voice panel ─────────────────────────────────────────────────────────────── */

.voice-panel {
  border-color: rgba(249,115,22,.3);
  background: linear-gradient(160deg, #141720 0%, #0f1218 100%);
  transition: border-color .3s, box-shadow .3s;
}

.voice-panel[data-session-active="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(249,115,22,.4), 0 0 24px rgba(249,115,22,.12);
}

.voice-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.voice-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(249,115,22,.12);
  border: 1px solid rgba(249,115,22,.25);
  padding: .15rem .6rem;
  border-radius: 99px;
}

/* Waveform */
.voice-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

.waveform-wrap {
  width: 100%;
  max-width: 480px;
  height: 56px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.waveform-canvas {
  width: 100%;
  height: 100%;
}

/* Mic button */
.mic-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}

.mic-btn {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(249,115,22,.4);
  background: #1c2030;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s, transform .1s;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}

.mic-btn:hover { border-color: var(--brand); background: #21283a; }
.mic-btn:active { transform: scale(.95); }
.mic-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* state: recording — session active, VAD listening */
.mic-btn[data-state="recording"] {
  background: rgba(249,115,22,.18);
  border-color: var(--brand);
}
.mic-btn[data-state="recording"] .mic-icon { stroke: var(--brand); }
.mic-btn[data-state="recording"] .mic-ring { animation: mic-pulse 1.6s ease-out infinite; }

/* state: processing */
.mic-btn[data-state="processing"] {
  background: rgba(249,115,22,.08);
  border-color: rgba(249,115,22,.5);
}
.mic-btn[data-state="processing"] .mic-spinner { display: block; animation: mic-spin .9s linear infinite; }
.mic-btn[data-state="processing"] .mic-icon    { opacity: .3; }

/* state: speaking */
.mic-btn[data-state="speaking"] {
  background: rgba(34,211,238,.1);
  border-color: var(--teal);
}
.mic-btn[data-state="speaking"] .mic-icon { stroke: var(--teal); }
.mic-btn[data-state="speaking"] .mic-ring { animation: mic-pulse 2s ease-out infinite; }

/* state: error */
.mic-btn[data-state="error"] { border-color: var(--red); background: rgba(248,113,113,.1); }
.mic-btn[data-state="error"] .mic-icon { stroke: var(--red); }

/* Subparts */
.mic-icon {
  stroke: var(--brand);
  transition: stroke .2s, opacity .2s;
  position: relative;
  z-index: 2;
}

.mic-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--red);
  opacity: 0;
  pointer-events: none;
}

.mic-spinner {
  display: none;
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  pointer-events: none;
}

.mic-label {
  font-size: .75rem;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-align: center;
  min-width: 120px;
  transition: color .2s;
}

/* ── Animations ──────────────────────────────────────────────────────────────── */

@keyframes mic-pulse {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(1.6); opacity: 0; }
}

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

@keyframes ve-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Voice conversation log ──────────────────────────────────────────────────── */

.voice-log {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: 1rem;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.voice-log:empty { display: none; }

.voice-entry {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  animation: ve-in .25s ease;
}

.ve-time {
  font-size: .68rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-align: center;
}

.ve-row {
  display: flex;
}

.ve-row--user  { justify-content: flex-end; }
.ve-row--agent { justify-content: flex-start; }

.ve-bubble {
  max-width: 80%;
  padding: .5rem .85rem;
  border-radius: var(--radius);
  font-size: .85rem;
  line-height: 1.5;
}

.ve-bubble--user {
  background: rgba(249,115,22,.12);
  border: 1px solid rgba(249,115,22,.2);
  color: var(--text);
  border-bottom-right-radius: 2px;
}

.ve-bubble--agent {
  background: #1c2030;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-bottom-left-radius: 2px;
}

.ve-bubble--error {
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.2);
  color: var(--red);
  font-size: .83rem;
}

/* ── Rules changed diff ──────────────────────────────────────────────────────── */

.vc-changes {
  margin-top: .35rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.vc-changes-label {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-bottom: .1rem;
}

.rule-change {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .4rem .65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: .8rem;
  animation: ve-in .2s ease;
}

.rule-change--added    { background: rgba(52,211,153,.06); border-color: rgba(52,211,153,.2); }
.rule-change--removed  { background: rgba(248,113,113,.06); border-color: rgba(248,113,113,.2); }
.rule-change--disabled { background: rgba(251,191,36,.06); border-color: rgba(251,191,36,.2); }
.rule-change--enabled  { background: rgba(34,211,238,.06); border-color: rgba(34,211,238,.2); }
.rule-change--modified { background: rgba(96,165,250,.06); border-color: rgba(96,165,250,.2); }

.rc-icon {
  font-size: .9rem;
  min-width: 16px;
  text-align: center;
  margin-top: 1px;
}

.rule-change--added    .rc-icon { color: var(--green); }
.rule-change--removed  .rc-icon { color: var(--red); }
.rule-change--disabled .rc-icon { color: var(--yellow); }
.rule-change--enabled  .rc-icon { color: var(--teal); }
.rule-change--modified .rc-icon { color: var(--blue); }

.rc-body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem .6rem;
  line-height: 1.4;
}

.rc-action {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .1rem .4rem;
  border-radius: 99px;
}

.rule-change--added    .rc-action { background: rgba(52,211,153,.15);  color: var(--green); }
.rule-change--removed  .rc-action { background: rgba(248,113,113,.15); color: var(--red); }
.rule-change--disabled .rc-action { background: rgba(251,191,36,.15);  color: var(--yellow); }
.rule-change--enabled  .rc-action { background: rgba(34,211,238,.15);  color: var(--teal); }
.rule-change--modified .rc-action { background: rgba(96,165,250,.15);  color: var(--blue); }

.rc-detail { color: var(--text-muted); font-size: .8rem; }
.rc-detail strong { color: var(--text); }
.rc-id   { font-family: var(--font-mono); font-size: .68rem; color: var(--text-dim); }
.vc-time { font-family: var(--font-mono); font-size: .72rem; color: var(--text-dim); }

/* ── Text Command panel ──────────────────────────────────────────────────────── */

.text-cmd-row {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  margin-top: .75rem;
}

.text-cmd-input {
  flex: 1;
  resize: vertical;
  min-height: 3rem;
  max-height: 8rem;
  padding: .55rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 1.5;
  outline: none;
  transition: border-color .15s;
}

.text-cmd-input:focus {
  border-color: var(--brand);
}

.text-cmd-send {
  align-self: flex-end;
  white-space: nowrap;
}

/* ── Active Dispatch Rules panel ─────────────────────────────────────────────── */

.rules-panel {
  border-color: rgba(249,115,22,.2);
}

.rules-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.rules-count-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(249,115,22,.1);
  border: 1px solid rgba(249,115,22,.22);
  padding: .15rem .65rem;
  border-radius: 99px;
  transition: color .25s, background .25s;
}

.rules-empty {
  color: var(--text-dim);
  font-size: .85rem;
  padding: .5rem 0;
}

.rules-list {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.rule-card {
  flex: 1 1 220px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(249,115,22,.25);
  border-radius: var(--radius-sm);
  padding: .75rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  animation: ve-in .2s ease;
  transition: border-color .2s, box-shadow .2s;
}

.rule-card:hover {
  border-color: rgba(249,115,22,.5);
  box-shadow: 0 0 12px rgba(249,115,22,.08);
}

.rule-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.rule-driver {
  font-size: .9rem;
  color: var(--text);
}

.rule-driver strong {
  color: var(--brand);
}

.rule-card-id {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-dim);
  letter-spacing: .04em;
}

.rule-reason {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.rule-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .1rem;
}

.rule-tag {
  font-size: .7rem;
  color: var(--text-dim);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: .1rem .5rem;
  white-space: nowrap;
}

.btn--sm {
  padding: .25rem .7rem;
  font-size: .78rem;
}

/* ── Archimede Agreement panel ─────────────────────────────────────────────── */

.agreement-panel-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.agreement-date-label {
  color: var(--text-muted);
  font-size: .8rem;
  margin-right: auto;
}

.agreement-summary {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.agreement-empty {
  color: var(--text-muted);
  font-size: .85rem;
}

.agreement-company {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .85rem;
}

.agreement-company-name {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
}

.agreement-pct {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .95rem;
}

.agreement-pct--high   { color: var(--green); }
.agreement-pct--medium { color: var(--yellow); }
.agreement-pct--low    { color: var(--red); }
.agreement-pct--none   { color: var(--text-dim); }

.agreement-count {
  color: var(--text-muted);
  font-size: .75rem;
}

.agreement-details {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  overflow-x: auto;
}

.agreement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.agreement-table th,
.agreement-table td {
  text-align: left;
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.agreement-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.agreement-table-count {
  color: var(--text-muted);
  font-size: .74rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .header        { padding: 0 1rem; }
  .main          { padding: 1rem .75rem 3rem; }
  .card          { padding: 1rem; }
  .decision-hero { flex-direction: column; }
  .decision-meta { align-items: flex-start; }
  .driver-id     { font-size: 2.5rem; }
  .input-footer  { flex-direction: column; align-items: stretch; }
  .input-actions { justify-content: flex-end; }
  .header-poweredby { display: none; }
}
