/* ────────────────────────────────────────────────
   Wingman Pilot — Stylesheet
   Design: minimal, legible, no frameworks.
   ──────────────────────────────────────────────── */

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

:root {
  --bg:            #edf2f8;
  --surface:       #ffffff;
  --surface-soft:  #f7f9fc;
  --surface-strong:#f3f7fd;
  --surface-deep:  #eef3fb;
  --border:        #d7e0ec;
  --border-med:    #c1cddd;
  --text:          #162033;
  --text-sub:      #566379;
  --text-faint:    #8390a5;
  --accent:        #2554d3;
  --accent-strong: #173ea9;
  --accent-bg:     #ecf2ff;
  --live:          #2554d3;
  --live-bg:       #eef3ff;
  --teal:          #0f766e;
  --teal-bg:       #eaf8f5;
  --amber:         #b7791f;
  --amber-bg:      #fff8e8;
  --slate:         #64748b;
  --slate-bg:      #f1f5f9;
  --grey:          #64748b;
  --grey-bg:       #f1f5f9;
  --red:           #b42318;
  --red-bg:        #fff2f0;
  --green:         #0f766e;
  --green-bg:      #edfdf8;
  --shadow-sm:     0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-md:     0 18px 36px rgba(15, 23, 42, 0.10);
  --radius:        18px;
  --radius-sm:     12px;
  --font:          'Manrope', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 84, 211, 0.07), transparent 28%),
    linear-gradient(180deg, #f5f8fd 0%, var(--bg) 42%, #edf3fa 100%);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(193, 205, 221, 0.78);
  height: 64px;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  height: 100%; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.nav-logo {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(180deg, #3368f0 0%, #1b49c6 100%); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  box-shadow: 0 8px 20px rgba(37, 84, 211, 0.18);
}
.nav-name-group {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.nav-name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.nav-subname {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 12px; border-radius: 999px;
  text-decoration: none; color: var(--text-sub);
  font-size: 13px; font-weight: 700;
  transition: background .15s, color .15s, border-color .15s;
  border: 1px solid transparent;
}
.nav-link:hover { background: var(--surface-soft); color: var(--text); }
.nav-link.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: #d6e1ff;
}

/* ── Main container ── */
.main { max-width: 1200px; margin: 0 auto; padding: 0 14px; }

/* ════════════════════════════════════════════
   CHAT PAGE
   ════════════════════════════════════════════ */

.chat-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 14px 0 24px;
}

/* ── Sidebar ── */
.sidebar {
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: visible;
  order: 2;
}
.sidebar-heading {
  font-size: 20px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em;
}
.sidebar-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sidebar-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.sidebar-body {
  font-size: 14px; color: var(--text-sub); line-height: 1.7;
}
.thread-help-text {
  margin: 0 0 14px;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.45;
}
.sidebar-examples {
  margin-top: 16px; list-style: none; display: flex; flex-direction: column; gap: 8px;
}
.sidebar-examples li {
  font-size: 13px; color: var(--text-sub);
  background: var(--surface-soft); border-radius: var(--radius-sm);
  padding: 8px 12px; font-style: italic;
  border: 1px solid var(--border);
}
.panel-card,
.current-read,
.sidebar-intro,
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.thread-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin: 0 -2px;
  scroll-snap-type: x proximity;
}
.thread-link {
  display: block;
  min-width: min(85vw, 320px);
  scroll-snap-align: start;
  text-decoration: none;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
.thread-link.active {
  border-color: rgba(37,84,211,0.6);
  background: linear-gradient(180deg, #f9fbff 0%, #eef4ff 100%);
  box-shadow: 0 10px 24px rgba(37, 84, 211, 0.10);
}
.thread-link-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.35;
}
.thread-link-pills,
.chat-thread-banner-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.thread-list-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.thread-list-pill-mode {
  background: var(--live-bg);
  border-color: #ccdafd;
  color: var(--live);
}
.thread-pill-live-bidding {
  background: var(--live-bg);
  border-color: #ccdafd;
  color: var(--live);
}
.thread-pill-renegotiation {
  background: var(--amber-bg);
  border-color: #f0d5a5;
  color: var(--amber);
}
.thread-pill-stage-sale-agreed,
.thread-pill-stage-resolved {
  background: var(--green-bg);
  border-color: #bbead9;
  color: var(--green);
}
.thread-pill-stage-paused,
.thread-pill-stage-watching,
.thread-pill-stage-moved-on,
.thread-pill-stage-archived {
  background: var(--slate-bg);
  border-color: #dbe3ed;
  color: var(--slate);
}
.thread-pill-stage-active-bidding,
.thread-pill-stage-considering-bid,
.thread-pill-stage-counter-under-review,
.thread-pill-stage-ask-made,
.thread-pill-stage-evidence-gathering,
.thread-pill-stage-issue-identified {
  background: var(--surface);
  border-color: var(--border-med);
  color: var(--text-sub);
}
.thread-active-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.thread-link-meta {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.55;
}
.thread-link-advice {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.thread-link-status {
  margin-top: 8px;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}
.thread-current-note {
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.current-read-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.current-read-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.current-read-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.current-read-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ── Result card ── */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.result-card.hidden { display: none; }

.result-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px;
  margin-bottom: 14px;
}
.result-action-label {
  font-size: 17px; font-weight: 600; line-height: 1.3;
  flex: 1;
}
.result-badge {
  padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.result-badge.high   { background: var(--green-bg); color: var(--green); }
.result-badge.medium { background: var(--amber-bg); color: var(--amber); }
.result-badge.low    { background: var(--grey-bg);  color: var(--grey);  }

.result-section { margin-bottom: 14px; }
.result-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint); margin-bottom: 4px;
}
.result-rationale {
  font-size: 13.5px; color: var(--text-sub); line-height: 1.65;
}
.result-increment {
  font-size: 22px; font-weight: 600; color: var(--accent);
  margin-bottom: 4px;
}
.result-increment-note {
  font-size: 12px; color: var(--text-faint); line-height: 1.55;
}

.result-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.result-meta-item { font-size: 12px; color: var(--text-faint); }
.result-meta-sep  { color: var(--border-med); }

.result-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.result-pid {
  font-family: monospace; font-size: 11px; color: var(--text-faint);
}
.btn-reset {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px; font-size: 13px; cursor: pointer;
  color: var(--text-sub);
  transition: border-color .15s, color .15s;
}
.btn-reset:hover { border-color: var(--text-sub); color: var(--text); }
.btn-new-thread {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  color: var(--text);
  min-height: 42px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.btn-new-thread:hover {
  border-color: var(--text-sub);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-new-thread-banner {
  background: linear-gradient(180deg, #2e62ec 0%, #1f4fd6 100%);
  border-color: var(--accent);
  color: #fff;
}
.btn-new-thread-banner:hover {
  border-color: var(--accent-strong);
  background: linear-gradient(180deg, #2554d3 0%, #173ea9 100%);
}

/* ── Chat panel ── */
.chat-panel {
  display: flex; flex-direction: column;
  background: rgba(255,255,255,0.84);
  backdrop-filter: blur(10px);
  overflow: hidden;
  min-height: calc(100vh - 176px);
  order: 1;
}

.messages {
  flex: 1; overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
}

.chat-thread-banner {
  padding: 18px 18px 16px;
  background: linear-gradient(135deg, #0f1d3d 0%, #193d95 45%, #1f4fd6 100%);
  border-color: rgba(31, 79, 214, 0.22);
  color: #fff;
  box-shadow: 0 18px 34px rgba(18, 42, 96, 0.22);
}
.chat-thread-banner-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.chat-thread-banner-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
  margin-bottom: 6px;
}
.chat-thread-banner-title {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.chat-thread-banner-subtitle {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}
.chat-thread-banner .thread-list-pill {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  color: #fff;
}
.chat-thread-banner .thread-pill-renegotiation {
  background: rgba(255, 232, 201, 0.16);
  color: #ffe1a6;
  border-color: rgba(255, 225, 166, 0.24);
}
.chat-thread-banner .thread-pill-live-bidding {
  background: rgba(255,255,255,0.16);
  color: #dce8ff;
  border-color: rgba(255,255,255,0.18);
}

.message { display: flex; max-width: 85%; }
.message.user     { align-self: flex-end; }
.message.wingman  { align-self: flex-start; }

.message-bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 14.5px; line-height: 1.6;
}
.message.user .message-bubble {
  background: linear-gradient(180deg, #2e62ec 0%, #1e4fd6 100%); color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 10px 20px rgba(37, 84, 211, 0.14);
}
.message.wingman .message-bubble {
  background: var(--surface-soft); color: var(--text);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border);
}
.message-context,
.message-fresh-start,
.message.clarify {
  max-width: 100%;
}
.message-context .message-bubble,
.message-fresh-start .message-bubble {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  width: 100%;
  border-radius: var(--radius);
}
.message.clarify .message-bubble {
  background: linear-gradient(180deg, #fffdf6 0%, #fff8e8 100%);
  border-color: #f0d6ab;
  box-shadow: inset 3px 0 0 var(--amber);
}
.context-kicker,
.clarify-lead {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
}
.clarify-lead {
  color: var(--amber);
}
.context-body {
  color: var(--text-sub);
}

/* Typing indicator */
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  animation: dot-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(.7); opacity: .5; }
  40%            { transform: scale(1.0); opacity: 1; }
}

/* Bold inside bubbles */
.message-bubble strong { font-weight: 600; }

/* ── Chat input ── */
.chat-input-form {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.94);
}
.chat-input {
  flex: 1;
  border: 1px solid var(--border-med);
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 15px; font-family: var(--font);
  resize: none; outline: none;
  line-height: 1.5;
  max-height: 120px; overflow-y: auto;
  color: var(--text);
  background: var(--surface-soft);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.chat-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(37, 84, 211, 0.10);
}
.chat-input::placeholder { color: var(--text-faint); }

.btn-send {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(180deg, #2e62ec 0%, #1f4fd6 100%); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 22px rgba(37, 84, 211, 0.16);
  transition: background .15s, opacity .15s, transform .15s;
}
.btn-send:hover   { background: linear-gradient(180deg, #2554d3 0%, #173ea9 100%); transform: translateY(-1px); }
.btn-send:disabled { opacity: .4; cursor: default; }

/* ════════════════════════════════════════════
   ADMIN PAGE
   ════════════════════════════════════════════ */

.admin-layout {
  padding: 26px 0 60px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.admin-header-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 720px;
}
.admin-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.admin-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.admin-subtitle {
  margin: 0;
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.55;
}
.btn-refresh {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-sub);
  transition: border-color .15s, color .15s, background .15s;
}
.btn-refresh:hover { border-color: rgba(37, 84, 211, 0.26); color: var(--text); background: #fff; }

.admin-status-band {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 16px;
}
.admin-status-card {
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.96) 0%, rgba(255, 255, 255, 0.98) 100%);
  border: 1px solid rgba(37, 84, 211, 0.12);
  border-radius: 24px;
  padding: 22px 24px;
  box-shadow: 0 18px 34px rgba(16, 24, 40, 0.06);
}
.admin-status-card-primary {
  background: linear-gradient(180deg, rgba(240, 246, 255, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
}
.admin-status-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.admin-status-copy,
.admin-status-note {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-sub);
}
.admin-status-strip,
.admin-status-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.admin-status-item,
.admin-status-mini,
.status-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-status-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.admin-status-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.admin-pill-live,
.admin-pill-ok {
  background: rgba(5, 150, 105, 0.12);
  color: #0f766e;
}
.admin-pill-warn {
  background: rgba(217, 119, 6, 0.13);
  color: #b45309;
}
.admin-pill-neutral {
  background: var(--surface-strong);
  color: var(--text-sub);
}

/* Stat grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.stat-card {
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.96) 0%, rgba(255, 255, 255, 1) 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  padding: 18px 18px 16px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
}
.stat-value {
  font-size: 29px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Section */
.admin-section {
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.98) 0%, rgba(255, 255, 255, 1) 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 24px;
  padding: 22px 24px;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.05);
}
.admin-panel {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  padding: 18px 18px 16px;
}
.admin-panel-muted {
  background: rgba(248, 250, 252, 0.82);
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.section-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.section-note {
  margin: 0;
  max-width: 360px;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.55;
}

/* Notes */
.notes-list {
  list-style: none; display: flex; flex-direction: column; gap: 6px;
}
.notes-list li {
  font-size: 13.5px; color: var(--text-sub); padding-left: 16px;
  position: relative;
}
.notes-list li::before {
  content: "·"; position: absolute; left: 4px; color: var(--text-faint);
}

/* Distribution bars */
.dist-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.dist-section {}
.dist-bars { display: flex; flex-direction: column; gap: 8px; }
.dist-empty { font-size: 13px; color: var(--text-faint); }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label {
  width: 140px; font-size: 12px; font-weight: 600; color: var(--text-sub);
  text-transform: capitalize; flex-shrink: 0;
}
.bar-track {
  flex: 1; height: 10px; background: var(--grey-bg);
  border-radius: 999px; overflow: hidden;
}
.bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent) 0%, #4f7bff 100%);
  border-radius: 999px; transition: width .4s ease;
}
.bar-count { font-size: 12px; color: var(--text-faint); width: 28px; text-align: right; }

/* Decisions table */
.table-wrap { overflow-x: auto; }
.decisions-table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px;
}
.decisions-table th {
  text-align: left; padding: 9px 12px;
  font-size: 11.5px; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.decisions-table td {
  padding: 11px 12px; border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  color: var(--text-sub); vertical-align: middle;
}
.decisions-table tr:last-child td { border-bottom: none; }
.decisions-table tr:hover td { background: rgba(247, 249, 252, 0.95); }
.table-empty { text-align: center; color: var(--text-faint); padding: 24px; }
.pid-cell { font-family: monospace; font-size: 12px; color: var(--text-faint); }
.action-cell { font-weight: 500; color: var(--text); text-transform: capitalize; }

.conf-badge {
  display: inline-block; padding: 4px 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.conf-high   { background: var(--green-bg); color: var(--green); }
.conf-med    { background: var(--amber-bg); color: var(--amber); }
.conf-low    { background: var(--grey-bg);  color: var(--grey);  }

.admin-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(37, 84, 211, 0.08);
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: capitalize;
}
.admin-tag-neutral {
  background: var(--grey-bg);
  color: var(--text-sub);
}
.admin-tag-action {
  background: rgba(5, 150, 105, 0.1);
  color: #0f766e;
}

/* Forms */
.forms-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.admin-runtime-grid {
  align-items: start;
}
.form-hint {
  font-size: 13px;
  color: var(--text-sub);
  margin: 0 0 16px;
  line-height: 1.55;
}
.admin-form { display: flex; flex-direction: column; gap: 12px; }
.form-label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.form-input,
.form-select {
  padding: 10px 12px;
  border: 1px solid var(--border-med);
  border-radius: 14px;
  font-size: 14px; font-family: var(--font);
  color: var(--text); background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus {
  border-color: rgba(37, 84, 211, 0.35);
  box-shadow: 0 0 0 4px rgba(37, 84, 211, 0.08);
}
.btn-submit {
  background: var(--accent); color: #fff; border: none;
  border-radius: 999px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  align-self: flex-start; transition: background .15s, transform .15s;
}
.btn-submit:hover { background: #1648c0; transform: translateY(-1px); }
.form-feedback {
  font-size: 13px; min-height: 18px;
  color: var(--text-faint);
}
.form-feedback.ok  { color: var(--green); }
.form-feedback.err { color: var(--red); }
.model-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 18px;
  margin-bottom: 16px;
}
.model-paths {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.model-paths strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-sub);
}
.mono-small {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-faint);
  word-break: break-all;
}

/* ════════════════════════════════════════════
   DECISION REPORT  (inline in chat stream)
   ════════════════════════════════════════════ */

/* Full-width wrapper — overrides .message max-width */
.report-wrapper {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}
.report-wrapper-live .decision-report {
  border-top-color: var(--accent);
}
.report-wrapper-renegotiation .decision-report {
  border-top-color: var(--amber);
  box-shadow: 0 18px 34px rgba(183, 121, 31, 0.10);
}
.report-wrapper-renegotiation .report-header {
  background: linear-gradient(180deg, #fffaf0 0%, #fff4df 100%);
}
.report-wrapper-renegotiation .report-eyebrow,
.report-wrapper-renegotiation .report-section-title {
  color: var(--amber);
  border-left-color: var(--amber);
}
.report-wrapper-move .decision-report {
  border-top-color: var(--teal);
  box-shadow: 0 18px 34px rgba(15, 118, 110, 0.10);
}
.report-wrapper-move .report-header {
  background: linear-gradient(180deg, #f0faf8 0%, #e8f7f4 100%);
}
.report-wrapper-move .report-eyebrow,
.report-wrapper-move .report-section-title {
  color: var(--teal);
  border-left-color: var(--teal);
}
.returning-report {
  margin-top: 4px;
}

.decision-report {
  background: var(--surface);
  /* Neutral border on sides/bottom; strong accent stripe on top */
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* Header band */
.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 18px 18px;
  background: linear-gradient(180deg, #f6f9ff 0%, #edf3ff 100%);
  border-bottom: 1px solid var(--border);
}
.report-header-left { flex: 1; min-width: 0; }
.report-eyebrow {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  margin-bottom: 6px;
}
.report-headline {
  font-size: 23px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Badge reuses existing .conf-badge colours */
.report-badge { flex-shrink: 0; margin-top: 4px; }

/* Body */
.report-body { padding: 0 18px 8px; }

/* Situation line */
.report-situation {
  padding: 14px 0;
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.65;
  border-bottom: 1px solid var(--border);
}

/* Metrics row — 4 equal cells separated by 1px border lines */
.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 -24px;          /* bleed to card edges */
  background: var(--border);
  gap: 1px;
  border-bottom: 1px solid var(--border);
}
.report-metric {
  background: var(--surface);
  padding: 16px 10px;
  text-align: center;
}
.metric-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.metric-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
/* Confidence cell: show tier as coloured text, not raw lowercase */
.metric-value.conf-display {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.metric-high { color: var(--green); }
.metric-med  { color: var(--amber); }
.metric-low  { color: var(--red);   }

/* Content sections */
.report-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.report-section:last-of-type { border-bottom: none; }

.report-section-title {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
  margin-bottom: 10px;
}
.report-section-body {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.7;
}
.report-bottom-line {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

/* Numbers section — rendered as a bullet list (no pre-line wall of text) */
.report-bullets {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.report-bullets li {
  position: relative;
  padding-left: 16px;
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.65;
}
.report-bullets li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--text-faint);
  font-weight: 400;
}

/* Increment guidance band */
.report-increment {
  background: linear-gradient(180deg, #f8fbff 0%, var(--accent-bg) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 10px;
}
.report-increment-range {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
  line-height: 1.3;
}
.report-increment-note {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.55;
}

/* Confidence note */
.report-confidence-note {
  padding: 12px 18px;
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-faint);
  line-height: 1.6;
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
}

/* Footer */
.report-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}
.report-freshness {
  font-size: 12px;
  color: var(--text-faint);
  flex: 1;
}
.report-pid {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-faint);
}

@media (min-width: 768px) {
  .main {
    padding: 0 20px;
  }

  .current-read-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .thread-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }

  .thread-link {
    min-width: 0;
  }
}

@media (min-width: 981px) {
  .chat-layout {
    grid-template-columns: 340px 1fr;
    gap: 24px;
    height: calc(100vh - 64px);
    padding: 24px 0;
  }

  .sidebar {
    overflow-y: auto;
    order: 0;
  }

  .chat-panel {
    order: 0;
    min-height: calc(100vh - 120px);
  }

  .chat-thread-banner-top {
    flex-direction: row;
    align-items: flex-start;
  }

  .btn-new-thread-banner {
    align-self: flex-start;
  }

  .report-metrics {
    grid-template-columns: repeat(4, 1fr);
  }

  .thread-list {
    display: flex;
    flex-direction: column;
    overflow-x: visible;
  }

  .thread-link {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 0 12px;
  }

  .chat-layout {
    gap: 16px;
    padding: 16px 0;
  }

  .nav {
    height: 58px;
  }

  .nav-inner {
    padding: 0 12px;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-link {
    padding: 7px 10px;
    font-size: 12px;
  }

  .nav-subname {
    display: none;
  }

  .messages {
    padding: 14px;
  }

  .chat-thread-banner {
    padding: 14px;
  }

  .chat-thread-banner-title {
    font-size: 18px;
  }

  .current-read-grid {
    grid-template-columns: 1fr 1fr;
  }

  .report-headline {
    font-size: 20px;
  }

  .thread-link {
    padding: 12px;
    min-width: 84vw;
  }

  .sidebar-intro {
    padding: 14px;
  }

  .sidebar-examples {
    display: none;
  }

  .chat-input-form {
    position: sticky;
    bottom: 0;
    z-index: 6;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .message {
    max-width: 93%;
  }

  .report-freshness,
  .report-pid {
    font-size: 11px;
  }
}

/* ════════════════════════════════════════════
   ACCESS GATE / LOGIN / PENDING PAGES
   Centred single-purpose layouts.
   ════════════════════════════════════════════ */

.gate-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: calc(100vh - 52px);
  padding: 60px 20px 80px;
}

.gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px 40px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.gate-logo {
  margin-bottom: 20px;
}

.gate-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.gate-body {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.65;
  margin-bottom: 24px;
}

.gate-hint {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 12px;
  margin-bottom: 16px;
}

.gate-alert {
  width: 100%;
  background: #fff5f5;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--red);
  text-align: left;
  margin-bottom: 18px;
}

.gate-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.gate-submit {
  width: 100%;
  padding: 10px 18px;
  font-size: 14.5px;
  font-weight: 600;
  margin-top: 4px;
}

/* Status icon on pending/blocked pages */
.gate-status-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.gate-status-pending {
  background: var(--accent-bg);
  color: var(--accent);
}

.gate-status-blocked {
  background: #fff5f5;
  color: var(--red);
}

/* Spinning "waiting" indicator */
.gate-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* "Check status" button on pending page */
.btn-gate-refresh {
  display: inline-block;
  padding: 9px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s;
}
.btn-gate-refresh:hover { background: #1648c0; }

/* ════════════════════════════════════════════
   ADMIN — HEADER + LOGOUT + USERS TABLE
   ════════════════════════════════════════════ */

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-logout {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  text-decoration: none;
  background: #fff;
  transition: border-color .15s, color .15s;
}
.btn-logout:hover { border-color: var(--text-sub); color: var(--text); }

/* User status badges */
.status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-pending  { background: var(--amber-bg);  color: var(--amber); }
.status-approved { background: var(--green-bg);  color: var(--green); }
.status-blocked  { background: #fff5f5;           color: var(--red);   }

/* User action buttons (Approve / Block) */
.user-actions-cell { display: flex; gap: 6px; align-items: center; }

.btn-user-action {
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border-med);
  cursor: pointer;
  background: #fff;
  transition: background .12s, border-color .12s, color .12s;
}
.btn-approve { color: var(--green); border-color: #a7f3d0; }
.btn-approve:hover { background: var(--green-bg); border-color: var(--green); }
.btn-block   { color: var(--red);   border-color: #fca5a5; }
.btn-block:hover   { background: #fff5f5; border-color: var(--red); }

/* ── Responsive ── */
@media (max-width: 800px) {
  .chat-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-header,
  .section-head { flex-direction: column; align-items: stretch; }
  .admin-status-band,
  .dist-row,
  .forms-row { grid-template-columns: 1fr; }
  .model-status-grid { grid-template-columns: 1fr 1fr; }
  .report-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .admin-layout { padding-top: 18px; gap: 16px; }
  .admin-title { font-size: 24px; }
  .admin-section,
  .admin-status-card { padding: 18px 18px; border-radius: 20px; }
  .admin-status-strip,
  .admin-status-mini-grid,
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .model-status-grid { grid-template-columns: 1fr; }
  .decisions-table th, .decisions-table td { padding: 7px 8px; font-size: 12px; }
  .hide-mobile { display: none; }
}
