@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Nunito:wght@400;600;700;800&display=swap');

/* ── VARIABLES ───────────────────────────────── */
:root {
  --bg:       #0b0b0c;
  --surface:  #131314;
  --surface2: #1b1b1d;
  --border:   rgba(255,255,255,0.07);
  --amber:    #818cf8;
  --amber-dim: #6366f1;
  --green:    #10b981;
  --blue:     #60a5fa;
  --red:      #ef4444;
  --orange:   #fb923c;
  --text:     #e2e8f0;
  --muted:    #71717a;
  --mono:     'JetBrains Mono', monospace;
  --head:     'Nunito', sans-serif;
  --silver-from: rgba(255,255,255,0.065);
  --silver-to:   rgba(148,163,184,0.02);
}

/* ── RESET ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--head);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── TYPOGRAPHY ──────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--head); font-weight: 700; letter-spacing: 0.03em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }

/* ── LAYOUT ──────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: rgba(11,11,12,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}

.sidebar-logo {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f1f5f9 20%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
}
.sidebar-logo .logo-sub {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-section { padding: 0.25rem 0; }
.nav-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.75rem 1.25rem 0.35rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.12s, color 0.12s;
  border-left: 2px solid transparent;
}
.nav-link:hover { background: rgba(255,255,255,0.04); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--amber); border-left-color: var(--amber); background: rgba(129,140,248,0.08); }
.nav-icon { font-size: 0.9rem; width: 1.2rem; text-align: center; }

.main-content { flex: 1; overflow-x: hidden; }

.page-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13,13,14,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { display: flex; align-items: center; gap: 0.75rem; }

.page-body { padding: 1.5rem; max-width: 1100px; }

/* ── CARDS ───────────────────────────────────── */
.card {
  background: linear-gradient(145deg,var(--silver-from),var(--silver-to)),var(--surface);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
}
.card-header {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--head);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.card-body { padding: 1.25rem; }

/* ── ORDER LIST ──────────────────────────────── */
.order-list { display: flex; flex-direction: column; gap: 0.5rem; }
.order-item {
  background: linear-gradient(145deg,var(--silver-from),rgba(0,0,0,0)),var(--surface);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 0.875rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.12s;
  cursor: pointer;
}
.order-item:hover { border-color: rgba(129,140,248,0.4); box-shadow: 0 0 12px rgba(129,140,248,0.06); text-decoration: none; }
.order-title { font-weight: 500; font-size: 0.875rem; }
.order-meta { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }
.order-source {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  background: var(--surface2);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── BADGES ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.badge-intake     { background: #1c2133; color: #6b7280; border: 1px solid #252836; }
.badge-triaged    { background: #1a2040; color: #93c5fd; border: 1px solid #1e3a6e; }
.badge-quoted     { background: #1c1a10; color: #fcd34d; border: 1px solid #3d300a; }
.badge-accepted   { background: #0f2218; color: #4ade80; border: 1px solid #14532d; }
.badge-in_dev     { background: #161b30; color: #818cf8; border: 1px solid #312e81; }
.badge-testing    { background: #1c1330; color: #c084fc; border: 1px solid #4c1d95; }
.badge-delivered  { background: #0f2218; color: #4ade80; border: 1px solid #14532d; }
.badge-revision   { background: #201a10; color: #fb923c; border: 1px solid #7c2d12; }
.badge-closed     { background: #1a1a1a; color: #9ca3af; border: 1px solid #374151; }
.badge-dropped    { background: #200f0f; color: #f87171; border: 1px solid #7f1d1d; }

.badge-junior     { background: #0f2218; color: #4ade80; }
.badge-mid        { background: #0f1e40; color: #60a5fa; }
.badge-senior     { background: #1c1000; color: #f59e0b; }
.badge-expert     { background: #1c1000; color: #fb923c; }
.badge-architect  { background: #200f0f; color: #f87171; }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--amber);
  color: #000;
  border-color: var(--amber);
}
.btn-primary:hover { background: #d97706; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface2); border-color: var(--muted); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: #7f1d1d;
}
.btn-danger:hover { background: #200f0f; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.7rem; }
.btn-copy { cursor: pointer; }

/* ── FORMS ───────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.35rem;
}
.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  transition: border-color 0.12s;
}
.form-control:focus {
  outline: none;
  border-color: var(--amber-dim);
}
.form-control::placeholder { color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { appearance: none; cursor: pointer; }

/* ── TABS ─────────────────────────────────────── */
.tabs { border-bottom: 1px solid var(--border); display: flex; gap: 0; }
.tab-btn {
  padding: 0.625rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--amber); border-bottom-color: var(--amber); }
.tab-panel { display: none; padding-top: 1.25rem; }
.tab-panel.active { display: block; }

/* ── PIPELINE STEPPER ────────────────────────── */
.pipeline-track { display: flex; flex-direction: column; gap: 0; }
.pipeline-step {
  display: flex;
  gap: 1rem;
  position: relative;
}
.pipeline-step::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: -2px;
  width: 1px;
  background: var(--border);
}
.pipeline-step:last-child::before { display: none; }
.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: 2px;
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
}
.step-dot.done { background: var(--green); border-color: var(--green); color: #000; }
.step-dot.running { background: var(--amber); border-color: var(--amber); color: #000; animation: pulse 1.5s infinite; }
.step-dot.failed { background: var(--red); border-color: var(--red); color: #fff; }
.step-dot.current { border-color: var(--amber); color: var(--amber); }
.step-info { padding-bottom: 1.25rem; flex: 1; }
.step-name { font-size: 0.8rem; font-weight: 500; }
.step-meta { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }

/* ── PROMPT BOX ──────────────────────────────── */
.prompt-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1rem;
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 55vh;
  position: relative;
}
.prompt-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── LISA SLIDERS ────────────────────────────── */
.lisa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.lisa-axis { }
.lisa-axis-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  margin-bottom: 0.3rem;
}
.axis-code { color: var(--amber); font-weight: 700; }
.axis-val { color: var(--text); }
input[type=range] {
  width: 100%;
  accent-color: var(--amber);
  cursor: pointer;
  height: 4px;
}
.lisa-result {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.lisa-metric { text-align: center; }
.lisa-metric-val {
  font-family: var(--head);
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
  line-height: 1;
}
.lisa-metric-label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; margin-top: 0.3rem; }

/* ── TABLE ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
thead { background: var(--surface2); }
th {
  padding: 0.6rem 0.875rem;
  text-align: left;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── STATS ROW ───────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1rem 1.25rem;
}
.stat-val {
  font-family: var(--head);
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
  line-height: 1;
}
.stat-label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; margin-top: 0.3rem; }

/* ── FILTERS ─────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 0.3rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
}
.filter-btn:hover, .filter-btn.active {
  background: #1c1000;
  border-color: var(--amber-dim);
  color: var(--amber);
}

/* ── PROGRESS BAR ────────────────────────────── */
.progress-bar {
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.35rem;
}
.progress-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── ALERTS ──────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.8rem;
  border: 1px solid;
  margin-bottom: 1rem;
}
.alert-warning { background: #1c1000; border-color: #3d300a; color: #fcd34d; }
.alert-error   { background: #200f0f; border-color: #7f1d1d; color: #f87171; }
.alert-success { background: #0f2218; border-color: #14532d; color: #4ade80; }
.alert-info    { background: #0f1e40; border-color: #1e3a6e; color: #60a5fa; }

/* ── MODAL ───────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: min(560px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--head);
  font-weight: 700;
}
.modal-body { padding: 1.25rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem;
}
.modal-close:hover { color: var(--text); }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .lisa-grid { grid-template-columns: 1fr; }
  .lisa-result { grid-template-columns: 1fr 1fr; }
  .order-item { grid-template-columns: 1fr auto; }
  .order-item > *:nth-child(3),
  .order-item > *:nth-child(4) { display: none; }
}
@media (max-width: 480px) {
  .sidebar { display: none; }
  .page-body { padding: 1rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* ── ANIMATIONS ──────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.2s ease; }

/* ── MISC ─────────────────────────────────────── */
.mono { font-family: var(--mono); }
.text-muted { color: var(--muted); }
.text-amber { color: var(--amber); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-sm    { font-size: 0.75rem; }
.text-xs    { font-size: 0.65rem; }
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
