/* Attaché mission control — styled after cursor.com's actual design system:
   white canvas, flat cream cards with hairline borders, near-black
   sentence-case headings at medium weight, dark ink chips, and orange
   reserved as a sparing accent. */

:root {
  /* Light canvas + flat surfaces */
  --bg: #ffffff;             /* page canvas */
  --bg-panel: #faf9f6;       /* card / panel surface */
  --bg-elevated: #f4f2ee;    /* inset (outputs, chips) */
  --bg-hover: #eeece6;

  /* Hairline borders (dark on light) */
  --border: rgba(20, 18, 12, 0.09);
  --border-strong: rgba(20, 18, 12, 0.18);

  /* Text ladder */
  --text: #1f1e1c;           /* near-black ink */
  --text-dim: #6e6c66;       /* muted secondary */
  --text-faint: #9b988f;     /* faint */

  --ink: #191817;            /* dark fill for primary chips */

  /* Zapier brand orange — the single saturated accent */
  --accent: #ff4f00;
  --accent-2: #d64500;
  --accent-soft: rgba(255, 79, 0, 0.09);

  /* Supporting hues, tuned for light */
  --green: #157f50;
  --green-soft: rgba(21, 127, 80, 0.1);
  --red: #d4383e;
  --red-soft: rgba(212, 56, 62, 0.09);
  --blue: #3b6cd4;
  --blue-soft: rgba(59, 108, 212, 0.09);
  --purple: #7a5cc4;
  --purple-soft: rgba(122, 92, 196, 0.1);
  --amber: #8a5a00;
  --amber-soft: rgba(178, 125, 22, 0.12);

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

  --shadow: none;
  --radius: 8px;
}

* { 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;
}

::selection { background: rgba(255, 79, 0, 0.16); }

/* thin, modern scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(20,18,12,0.22) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(20,18,12,0.18); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(20,18,12,0.3); background-clip: padding-box; }

/* ── Top bar ────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(160%) blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap; line-height: 1;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
  border-radius: 8px;
}
.brand-mark .accent { color: #fff; }
.brand-text h1 {
  font-family: var(--sans);
  font-size: 17px;
  letter-spacing: -0.01em;
  font-weight: 600;
  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: 1px;
}
.topbar-right { display: flex; gap: 8px; }
.conn-pill {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 450;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 13px;
  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); }

/* ── Stats strip ────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  padding: 24px 32px 8px;
}
.stat {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 17px;
  position: relative;
  overflow: hidden;
  transition: background 0.15s ease;
}
.stat:hover { background: var(--bg-elevated); }
.stat label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 7px;
  font-weight: 450;
}
.stat output {
  font-family: var(--sans);
  font-size: 21px;
  font-weight: 550;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  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: 14px;
  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: 16px 20px 13px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  font-size: 15px;
  letter-spacing: -0.01em;
  text-transform: none;
  font-weight: 550;
  color: var(--text);
}
.panel-sub { font-size: 12px; color: var(--text-dim); }
.badge {
  font-family: var(--sans);
  font-size: 10.5px;
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: 0.6px;
  font-weight: 550;
}
.badge-live { background: var(--green-soft); color: var(--green); border: 1px solid rgba(21, 127, 80, 0.24); }

/* ── 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: 17px;
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--text);
}
.stream-empty code {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text);
}
.pulse-ring {
  width: 11px; height: 11px;
  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, 79, 0, 0.35); }
  100% { box-shadow: 0 0 0 20px rgba(255, 79, 0, 0); }
}

.req-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  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: 11px 15px;
  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-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 550;
}
.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 15px 10px; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.req-output {
  margin: 0 15px 12px;
  padding: 11px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #494740;
  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 15px 13px; }
.tag {
  font-family: var(--sans);
  font-size: 11px;
  padding: 4px 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(59, 108, 212, 0.22); }
.tag-diet { background: var(--green-soft); color: var(--green); border-color: rgba(21, 127, 80, 0.22); }
.tag-inject { background: var(--purple-soft); color: var(--purple); border-color: rgba(122, 92, 196, 0.24); }
.tag-intercept { background: var(--amber-soft); color: var(--amber); border-color: rgba(178, 125, 22, 0.26); }
.tag-blocked { background: var(--red-soft); color: var(--red); border-color: rgba(212, 56, 62, 0.3); font-weight: 550; }
.tag-exec { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(255, 79, 0, 0.28); font-weight: 550; }
.tag-meta { background: var(--bg-elevated); color: var(--text-dim); }

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

.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-2); 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(212, 56, 62, 0.26);
  border-radius: var(--radius);
  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(212, 56, 62, 0.2); }
  10%, 30%, 100% { box-shadow: 0 0 0 0 rgba(212, 56, 62, 0); }
}
.policy-hit .hit-title { font-family: var(--sans); 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: var(--radius);
  padding: 12px 8px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  background: #ffffff;
  transition: all 0.25s;
  position: relative;
}
.connector .c-icon {
  width: 28px; height: 28px;
  margin: 0 auto 7px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.connector.live { border-color: rgba(122, 92, 196, 0.3); background: var(--purple-soft); }
.connector.live .c-icon { background: rgba(122, 92, 196, 0.14); color: var(--purple); border-color: rgba(122, 92, 196, 0.32); }
.connector.firing {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
  transform: translateY(-2px);
}
.connector.firing .c-icon { background: var(--purple); color: #ffffff; }
.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: 17px 20px; }
.faux-tile h3 { font-size: 12px; color: var(--text-dim); margin-bottom: 11px; font-weight: 500; }
.faux-tile p { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }
.faux-big { font-family: var(--sans); font-size: 24px !important; color: var(--text) !important; font-weight: 550; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.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: var(--ink); border-radius: 999px; }
.faux-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.faux-badges span {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--text-dim);
  background: #ffffff;
}

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