/* Attaché mission control — contemporary dark aesthetic:
   near-black canvas, high-contrast type, hairline borders,
   a single vivid orange accent and a precise, product-grade grid. */

:root {
  /* Cool near-black canvas + elevated surfaces */
  --bg: #08080a;             /* page canvas */
  --bg-panel: #101013;       /* card / panel surface */
  --bg-elevated: #17171b;    /* inset (outputs, chips) */
  --bg-hover: #1c1c21;

  /* Hairline borders (light on dark) */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* Text ladder */
  --text: #f4f4f6;           /* near-white ink */
  --text-dim: #9a9aa4;       /* muted secondary */
  --text-faint: #61616b;     /* faint */

  /* International orange — the single saturated accent */
  --accent: #ff5b2e;
  --accent-2: #ff8a3d;
  --accent-soft: rgba(255, 91, 46, 0.12);

  /* Supporting hues, tuned for dark */
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, 0.14);
  --red: #ff5f6e;
  --red-soft: rgba(255, 95, 110, 0.14);
  --blue: #5b9dff;
  --blue-soft: rgba(91, 157, 255, 0.14);
  --purple: #b494ff;
  --purple-soft: rgba(180, 148, 255, 0.14);
  --amber: #f5c451;
  --amber-soft: rgba(245, 196, 81, 0.16);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;

  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 40px rgba(0, 0, 0, 0.5);
  --radius: 16px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(ellipse 60% 40% at 85% -10%, rgba(255, 91, 46, 0.10), transparent 70%),
    radial-gradient(ellipse 50% 30% at 8% -6%, rgba(91, 157, 255, 0.06), transparent 70%);
  background-attachment: fixed;
}

::selection { background: var(--accent-soft); color: #fff; }

/* thin, modern scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); background-clip: padding-box; }

/* ── Top bar ────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 10, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.03em;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(255, 91, 46, 0.35), 0 0 0 1px rgba(255,255,255,0.08) inset;
}
.brand-mark .accent { color: #fff; }
.brand-text h1 {
  font-family: var(--sans);
  font-size: 20px;
  letter-spacing: -0.02em;
  font-weight: 650;
  color: var(--text);
}
.brand-text .accent { color: var(--accent); }
.brand-text p {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.1px;
  margin-top: 2px;
}
.topbar-right { display: flex; gap: 10px; }
.conn-pill {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  display: flex; align-items: center; gap: 7px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft), 0 0 10px var(--green); }

/* ── Stats strip ────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  padding: 26px 32px 8px;
}
.stat {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.stat::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat label {
  display: block;
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 9px;
  font-weight: 600;
}
.stat output {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: color 0.2s;
}
.stat.spend output { color: var(--accent); }
.stat.saved output { color: var(--green); }
.stat.blocked output { color: var(--red); }
.stat.injected output { color: var(--purple); }
.stat output.tick { animation: tickflash 0.5s ease; }
@keyframes tickflash { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ── Layout ─────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  padding: 14px 32px 32px;
  align-items: start;
}
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  font-size: 15px;
  letter-spacing: -0.01em;
  text-transform: none;
  font-weight: 600;
  color: var(--text);
}
.panel-sub { font-size: 12px; color: var(--text-dim); }
.badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: 1px;
  font-weight: 600;
}
.badge-live { background: var(--green-soft); color: var(--green); border: 1px solid rgba(62, 207, 142, 0.3); }

/* ── Live stream ────────────────────────── */
.stream-panel { min-height: 70vh; }
.stream { padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px; max-height: 78vh; overflow-y: auto; }
.stream-empty {
  text-align: center;
  padding: 90px 0;
  color: var(--text-dim);
}
.stream-empty p {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.stream-empty code {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 9px 15px;
  border-radius: 10px;
  color: var(--accent);
}
.pulse-ring {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 22px;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 91, 46, 0.5); }
  100% { box-shadow: 0 0 0 22px rgba(255, 91, 46, 0); }
}

.req-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
  animation: slidein 0.3s ease;
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.req-card:hover { border-color: var(--border-strong); }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.req-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 12px;
}
.req-id { color: var(--text-faint); }
.req-model { color: var(--blue); font-weight: 500; }
.req-status {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 600;
}
.req-status.running { background: var(--blue-soft); color: var(--blue); }
.req-status.done { background: var(--green-soft); color: var(--green); }
.req-status.blocked { background: var(--red-soft); color: var(--red); }
.req-preview { padding: 0 16px 10px; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.req-output {
  margin: 0 16px 12px;
  padding: 12px 14px;
  background: #0c0c0f;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #cbcbd2;
  white-space: pre-wrap;
  max-height: 140px;
  overflow-y: auto;
}
.req-output:empty { display: none; }
.req-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 14px; }
.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  animation: slidein 0.25s ease;
  font-weight: 500;
}
.tag-route { background: var(--blue-soft); color: var(--blue); border-color: rgba(91, 157, 255, 0.3); }
.tag-diet { background: var(--green-soft); color: var(--green); border-color: rgba(62, 207, 142, 0.3); }
.tag-inject { background: var(--purple-soft); color: var(--purple); border-color: rgba(180, 148, 255, 0.32); }
.tag-intercept { background: var(--amber-soft); color: var(--amber); border-color: rgba(245, 196, 81, 0.32); }
.tag-blocked { background: var(--red-soft); color: var(--red); border-color: rgba(255, 95, 110, 0.42); font-weight: 600; }
.tag-exec { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(255, 91, 46, 0.4); font-weight: 600; }
.tag-meta { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); }

/* ── Side panels ────────────────────────── */
.side { display: flex; flex-direction: column; gap: 16px; }

.policy-list { list-style: none; padding: 12px 20px; }
.policy-list li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 9px 0;
  font-size: 12.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.policy-list li:last-child { border-bottom: none; }
.policy-list .rule-id { font-family: var(--mono); font-size: 11px; color: var(--accent); white-space: nowrap; font-weight: 500; }
.policy-events { padding: 0 20px 6px; }
.policy-events:not(:empty) { padding-bottom: 16px; }
.policy-hit {
  background: var(--red-soft);
  border: 1px solid rgba(255, 95, 110, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 12px;
  animation: alarmflash 1.2s ease;
}
@keyframes alarmflash {
  0%, 20%, 40% { box-shadow: 0 0 0 3px rgba(255, 95, 110, 0.3); }
  10%, 30%, 100% { box-shadow: 0 0 0 0 rgba(255, 95, 110, 0); }
}
.policy-hit .hit-title { font-family: var(--mono); color: var(--red); font-weight: 600; font-size: 11px; letter-spacing: 0.4px; margin-bottom: 5px; }
.policy-hit .hit-reason { color: var(--text-dim); line-height: 1.5; }

.connector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px 20px 20px;
}
.connector {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-elevated);
  transition: all 0.25s;
  position: relative;
}
.connector .c-icon {
  width: 28px; height: 28px;
  margin: 0 auto 7px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  background: #0c0c0f;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.connector.live { border-color: rgba(180, 148, 255, 0.4); background: var(--purple-soft); }
.connector.live .c-icon { background: rgba(180, 148, 255, 0.18); color: var(--purple); border-color: rgba(180, 148, 255, 0.45); }
.connector.firing {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft), 0 10px 26px rgba(180, 148, 255, 0.3);
  transform: translateY(-2px);
}
.connector.firing .c-icon { background: var(--purple); color: #0c0c0f; }
.connector .c-status { font-size: 9px; letter-spacing: 0.8px; text-transform: uppercase; margin-top: 4px; font-weight: 600; }
.connector.live .c-status { color: var(--purple); }

/* ── Enterprise tiles (display-only) ────── */
.faux-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}
.faux-tile { background: var(--bg-panel); padding: 18px 20px; }
.faux-tile h3 { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px; font-weight: 600; }
.faux-tile p { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }
.faux-big { font-family: var(--mono); font-size: 26px !important; color: var(--text) !important; font-weight: 600; letter-spacing: -0.02em; }
.faux-bar { height: 6px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.faux-bar div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.faux-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.faux-badges span {
  font-family: var(--mono);
  font-size: 9.5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--text-dim);
  background: var(--bg-elevated);
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
