/* ============================================================
   SIG ADVISORY — Mission Control
   Monochrome instrument-grade UI. Black / graphite / white.
   Pure presentation layer. No markup or logic dependencies.
   ============================================================ */

:root {
  /* Surfaces */
  --bg:          #08080a;
  --bg-2:        #0b0b0e;
  --panel:       #131316;
  --panel-2:     #17171b;
  --panel-soft:  #101013;
  --raise:       #1c1c21;

  /* Hairlines */
  --line:        rgba(255, 255, 255, 0.07);
  --line-2:      rgba(255, 255, 255, 0.13);
  --line-3:      rgba(255, 255, 255, 0.22);

  /* Type */
  --ink:         #fafafa;
  --ink-dim:     #d6d6da;
  --muted:       #9a9aa3;
  --muted-2:     #6c6c74;
  --faint:       #4a4a52;

  /* Signal — the single point of brightness */
  --white:       #ffffff;

  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, "Roboto Mono", "Courier New", monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --shadow:    0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.45);
  --radius: 3px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    /* blueprint grid — hairline lattice */
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    /* coarse grid */
    linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    radial-gradient(120% 80% at 50% -8%, rgba(255, 255, 255, 0.05), transparent 60%),
    linear-gradient(180deg, #0a0a0d 0%, #08080a 50%, #060608 100%);
  background-size: 40px 40px, 40px 40px, 200px 200px, 200px 200px, auto, auto;
}

/* faint vignette so the grid never dominates */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(130% 120% at 50% 0%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

button, input, select, textarea { font: inherit; }

/* ---------- Buttons ---------- */
button {
  position: relative;
  border: 1px solid var(--line-3);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-height: 42px;
  color: #050505;
  background: var(--white);
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
              transform 0.12s ease, box-shadow 0.15s ease;
}

button:hover {
  background: #e4e4e7;
  border-color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
button:active { transform: translateY(0); }
button:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

button.ghost {
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line-2);
  box-shadow: none;
}
button.ghost:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-3);
  box-shadow: none;
}

button.danger {
  color: var(--white);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.32);
}
button.danger:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--white);
}

/* ============================================================
   Shell
   ============================================================ */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 18px;
  background: linear-gradient(180deg, rgba(20, 20, 24, 0.6), rgba(8, 8, 10, 0.72));
  border-right: 1px solid var(--line-2);
  backdrop-filter: blur(12px);
}

/* hairline rail accent down the divider */
.sidebar::after {
  content: "";
  position: absolute;
  top: 0; right: -1px;
  width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, var(--line-3) 18%, var(--line-3) 82%, transparent);
}

.brand-block {
  display: grid;
  gap: 9px;
  padding: 6px 8px 20px;
  border-bottom: 1px solid var(--line);
}

.brand-block h1 {
  margin: 0;
  color: var(--white);
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* registration tick before the wordmark */
.brand-block h1::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  margin-right: 11px;
  vertical-align: 3px;
  background: var(--white);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.5);
}

.side-nav { display: grid; gap: 4px; }

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
  box-shadow: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  transform: none;
  box-shadow: none;
}

.nav-item.active {
  color: #050505;
  background: var(--white);
  border-color: var(--white);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.12);
  transform: none;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.sidebar-footer button { width: 100%; }

.status-text {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.status-text::before {
  content: "● ";
  color: var(--white);
  font-size: 9px;
  vertical-align: 1px;
}

.content-shell { min-width: 0; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  padding: 30px clamp(20px, 4vw, 54px) 170px;
  min-width: 0;
}

/* ============================================================
   Alerts
   ============================================================ */
.hub-alerts { display: grid; gap: 10px; min-width: 0; }
.hub-alerts.empty { display: none; }

.hub-alert {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--white);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}
.hub-alert strong {
  color: var(--white);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hub-alert span { color: var(--muted); }

.hub-alert.danger {
  border-left-color: var(--white);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 8px, transparent 8px 16px),
    rgba(255, 255, 255, 0.02);
}
.hub-alert.danger strong { color: var(--white); }

/* ============================================================
   Views & titles
   ============================================================ */
.view { display: none; gap: 26px; min-width: 0; max-width: 100%; }
.view.active { display: grid; grid-template-columns: minmax(0, 1fr); }

.page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  min-width: 0;
  min-height: 78px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.page-title h2, h2, h3, p { margin: 0; }

.page-title h2 {
  max-width: 820px;
  color: var(--ink);
  font-size: clamp(30px, 4.4vw, 52px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.eyebrow {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.page-title .eyebrow { margin-bottom: 12px; }
.page-title .eyebrow::before {
  content: "// ";
  color: var(--faint);
}

.inline-actions,
.topbar-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.date-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(142px, 1fr));
  gap: 10px;
  min-width: min(340px, 100%);
}

/* ============================================================
   Metrics
   ============================================================ */
.summary-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 14px;
}

.metric,
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 154px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  transition: border-color 0.16s ease, transform 0.16s ease;
}
.metric:hover { border-color: var(--line-3); transform: translateY(-2px); }

/* instrument top rule */
.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, var(--white), transparent 70%);
  opacity: 0.5;
}

/* corner register tick */
.metric::after {
  content: "";
  position: absolute;
  top: 14px; right: 14px;
  width: 7px; height: 7px;
  border-top: 1px solid var(--line-3);
  border-right: 1px solid var(--line-3);
}

.metric span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric strong {
  position: relative;
  z-index: 1;
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric small {
  color: var(--muted-2);
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  line-height: 1.35;
}

#expenseBreakdown {
  display: block;
  max-width: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* hero readout — inverted instrument panel */
.metric.primary {
  color: #050505;
  background: linear-gradient(180deg, #ffffff, #ededf0);
  border-color: var(--white);
  box-shadow: var(--shadow), 0 0 50px rgba(255, 255, 255, 0.08);
}
.metric.primary::before { background: linear-gradient(90deg, #000, transparent 70%); opacity: 0.35; }
.metric.primary::after { border-color: rgba(0, 0, 0, 0.28); }
.metric.primary span { color: #3a3a3e; }
.metric.primary strong { color: #050505; }
.metric.primary small { color: #4a4a4e; }

/* ============================================================
   Panels
   ============================================================ */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.42fr);
  gap: 22px;
  align-items: start;
  width: 100%;
  min-width: 0;
}
.workspace-grid .wide { grid-column: span 1; }

.panel {
  padding: 24px;
  min-width: 0;
  max-width: 100%;
}

/* corner brackets — framed-instrument detail */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  pointer-events: none;
  opacity: 0.6;
}
.panel::before {
  top: -1px; left: -1px;
  border-top: 1px solid var(--line-3);
  border-left: 1px solid var(--line-3);
}
.panel::after {
  bottom: -1px; right: -1px;
  border-bottom: 1px solid var(--line-3);
  border-right: 1px solid var(--line-3);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.section-title h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.section-title h3 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.section-title .eyebrow { margin-bottom: 7px; display: block; }
.section-title.compact { margin-top: 18px; margin-bottom: 12px; }

/* ============================================================
   Forms
   ============================================================ */
.form-grid,
.ops-grid,
.routing-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 13px;
  min-width: 0;
}
.ops-grid { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.single-column { grid-template-columns: 1fr; }
.span-2 { grid-column: span 2; }

label {
  display: grid;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 0;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.35);
  outline: none;
  min-height: 42px;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="date"], input[type="time"] { color-scheme: dark; font-family: var(--mono); }
input[type="number"] { font-family: var(--mono); }

textarea {
  min-height: 150px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}

input:focus, select:focus, textarea:focus {
  background: rgba(0, 0, 0, 0.5);
  border-color: var(--line-3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}
::placeholder { color: var(--faint); }

.rate-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.rate-row span, .pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* ============================================================
   Cards / lists
   ============================================================ */
.connection-list,
.automation-list,
.lead-list-stack,
.rep-list { display: grid; gap: 10px; }

.connection-card,
.automation-list div,
.list-row,
.rep-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.connection-card:hover,
.list-row:hover,
.rep-card:hover {
  border-color: var(--line-3);
  background: rgba(255, 255, 255, 0.025);
}

.automation-list div {
  grid-template-columns: 130px 1fr;
  align-items: start;
}
.automation-list strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.automation-list span { color: var(--muted); }

.readout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 12px;
}
.readout-grid div {
  display: grid;
  gap: 8px;
  min-height: 110px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-3);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
}
.readout-grid strong { color: var(--ink); line-height: 1.3; font-weight: 600; }
.readout-grid span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.list-row span, .rep-readout span { color: var(--muted); font-size: 13px; }

.list-row { grid-template-columns: 1fr auto; align-items: center; }
.list-row div, .rep-readout { display: grid; gap: 4px; min-width: 0; }

.connection-card header,
.rep-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.connection-card strong, .rep-card strong { color: var(--ink); font-weight: 700; }

/* ---------- Status chips (monochrome, differentiated by weight) ---------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 11px 5px 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}
.status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status.connected {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}
.status.connected::before { box-shadow: 0 0 10px rgba(255, 255, 255, 0.8); }

.status.ready_for_oauth {
  color: var(--ink-dim);
  border-color: rgba(255, 255, 255, 0.28);
}

.status.manual,
.status.skipped,
.status.warning,
.status.paused {
  color: var(--muted);
  border-style: dashed;
  border-color: var(--line-2);
}

.status.needs_setup,
.status.out_of_credits {
  color: var(--ink);
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}
.status.needs_setup::before,
.status.out_of_credits::before {
  background: transparent;
  border: 1.5px solid var(--white);
  width: 7px; height: 7px;
}

/* ---------- Rep editing ---------- */
.rep-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 9px;
  align-items: end;
  min-width: 0;
}

.ghl-rep-fields {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(92px, 100%), 1fr));
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 12px;
}
.check-label input {
  width: auto;
  min-height: auto;
  accent-color: var(--white);
}

.routing-controls {
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  align-items: end;
}

.route-result {
  min-height: 40px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.25);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.01em;
}
.compact-result { min-height: 0; }
.save-list input { margin-bottom: 10px; }
.panel-actions { margin-top: 16px; }

/* ============================================================
   Agency Assistant
   ============================================================ */
.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.assistant-layout .wide { grid-column: 1 / -1; }

.assistant-console textarea {
  min-height: 260px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    rgba(0, 0, 0, 0.42);
}

.assistant-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.assistant-answer {
  display: grid;
  gap: 12px;
  min-height: 180px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.26);
}

.assistant-answer strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.assistant-answer span,
.assistant-answer small {
  color: var(--muted);
  line-height: 1.55;
}

.assistant-actions,
.assistant-history {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.assistant-action,
.assistant-history-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.assistant-action strong,
.assistant-history-item strong {
  color: var(--ink);
}

.assistant-action span,
.assistant-action small,
.assistant-history-item p,
.assistant-history-item small,
.memory-path {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.assistant-history-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.memory-path {
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

/* ============================================================
   Persistent Assistant Dock
   ============================================================ */
.assistant-dock {
  position: fixed;
  right: clamp(18px, 3vw, 44px);
  bottom: 18px;
  left: calc(268px + clamp(18px, 3vw, 44px));
  z-index: 40;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.dock-grip,
.dock-panel,
.dock-bar {
  pointer-events: auto;
}

.dock-grip {
  justify-self: center;
  min-height: 28px;
  padding: 5px 14px;
  border-radius: 999px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line-2);
  box-shadow: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dock-grip::before {
  content: "";
  display: inline-block;
  width: 34px;
  height: 2px;
  margin-right: 10px;
  vertical-align: 3px;
  border-radius: 999px;
  background: var(--line-3);
}

.dock-panel,
.dock-bar {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.022)),
    rgba(10, 10, 14, 0.82);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: saturate(140%) blur(22px);
}

.dock-panel::before,
.dock-bar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  opacity: 0.8;
}

.dock-panel {
  display: none;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 16px;
  max-height: min(45vh, 440px);
  padding: 18px;
}

.assistant-dock.dock-expanded .dock-panel { display: grid; }

.dock-readout,
.dock-memory {
  min-width: 0;
  overflow: auto;
}

.assistant-answer.compact {
  min-height: 104px;
  max-height: 180px;
  overflow: auto;
}

.assistant-history.compact {
  max-height: 230px;
  overflow: auto;
}

.dock-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 12px;
}

.dock-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #050505;
  background: var(--white);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 0 32px rgba(255, 255, 255, 0.18);
}

#dockAssistantPrompt {
  min-height: 44px;
  max-height: 110px;
  resize: none;
  padding-top: 12px;
  border-radius: 999px;
  font-family: var(--sans);
  background: rgba(0, 0, 0, 0.38);
}

.dock-memory-toggle {
  display: flex;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.dock-quick-prompts {
  position: absolute;
  right: 12px;
  bottom: calc(100% + 8px);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.assistant-dock:hover .dock-quick-prompts,
.assistant-dock:focus-within .dock-quick-prompts {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dock-quick-prompts button {
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 11px;
}

/* ============================================================
   Tables
   ============================================================ */
.history-panel { overflow: hidden; }
.history-table-wrap {
  overflow-x: auto;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.2);
}

th, td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: #101013;
  border-bottom: 1px solid var(--line-2);
}

td {
  font-size: 14px;
  color: var(--ink-dim);
}
td .status { font-size: 10px; }
tbody tr { transition: background 0.12s ease; }
tr:hover td { background: rgba(255, 255, 255, 0.03); }

a { color: var(--white); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line-3); }
a:hover { border-bottom-color: var(--white); }

::selection { color: #050505; background: var(--white); }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: #0a0a0c; }
::-webkit-scrollbar-thumb {
  background: #2a2a30;
  border: 2px solid #0a0a0c;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: #3c3c44; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1180px) {
  .summary-band { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
  .workspace-grid { grid-template-columns: 1fr; }
  .assistant-layout { grid-template-columns: 1fr; }
  .dock-panel { grid-template-columns: 1fr; max-height: min(55vh, 520px); }
  .ops-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    gap: 16px;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line-2);
  }
  .sidebar::after { display: none; }
  .brand-block { padding: 0 0 14px; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-item { text-align: center; }
  .sidebar-footer { grid-template-columns: 1fr 1fr; }
  .sidebar-footer .status-text { grid-column: 1 / -1; }
  main { padding: 22px 16px 150px; }
  .topbar-actions, .inline-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
  }
  .topbar-actions button, .inline-actions button { width: 100%; min-width: 0; }
  .summary-band, .form-grid, .ops-grid, .readout-grid, .routing-controls,
  .rep-fields, .mini-metrics, .automation-list div { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .section-title, .page-title {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
  }
  .page-title h2 { font-size: 34px; }
  .date-filter { grid-template-columns: 1fr; width: 100%; }
  .assistant-dock {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .dock-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .dock-memory-toggle,
  .dock-quick-prompts {
    display: none;
  }
  .dock-panel {
    padding: 12px;
    max-height: 54vh;
  }
  #dockAssistantPrompt {
    border-radius: 14px;
  }
}
