/* ═══════════════════════════════════════════════════
   MILEMARKER COMMAND CENTER — Design System
   Arc Raiders aesthetic: dark, warm cream, industrial
   ═══════════════════════════════════════════════════ */

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

:root {
  --bg: #0c0b0a;
  --bg-panel: #141312;
  --bg-card: #1a1918;
  --bg-card-hover: #211f1e;
  --bg-input: #161514;
  --border: #2a2725;
  --border-accent: #3d3833;
  --border-focus: #FF6720;
  --cream: #ece2d0;
  --cream-dim: #b8a990;
  --text-dim: #8a7f72;
  --text-muted: #524a42;
  --accent: #FF6720;
  --accent-dim: #CC3A30;
  --accent-bg: rgba(255,103,32,0.08);
  --green: #4ade80;
  --green-dim: #166534;
  --green-bg: rgba(74,222,128,0.08);
  --red: #f87171;
  --red-dim: #991b1b;
  --red-bg: rgba(248,113,113,0.08);
  --blue: #60a5fa;
  --blue-dim: #1e3a5f;
  --blue-bg: rgba(96,165,250,0.08);
  --yellow: #fbbf24;
  --yellow-dim: #78350f;
  --yellow-bg: rgba(251,191,36,0.08);
  --violet: #a78bfa;
  --violet-bg: rgba(167,139,250,0.08);
  --mono: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 4px;
  --transition: 0.15s ease;
}

html { scroll-behavior: smooth; scroll-padding-top: 7rem; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--cream);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  line-height: 1.5;
}

/* ── Scanline overlay ──────────────────────────── */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
}

/* ── Header ────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(12,11,10,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-top {
  max-width: 1280px; margin: 0 auto; padding: 0 1rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 3.25rem;
}
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.logo-mark {
  width: 1.75rem; height: 1.75rem;
  background: linear-gradient(135deg, #FF6720, #CC3A30);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  padding: 3px;
}
.logo-text { font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--cream); }
.logo-sub { font-family: var(--mono); font-size: 9px; color: var(--text-muted); letter-spacing: 1px; }

/* ── Nav (secondary bar) ───────────────────────── */
.nav-bar {
  max-width: 1280px; margin: 0 auto; padding: 0 1rem;
  display: flex; align-items: center; gap: 2px;
  height: 2.5rem; overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.nav-bar::-webkit-scrollbar { display: none; }
.nav-bar { -ms-overflow-style: none; scrollbar-width: none; }
.nav-link {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0.35rem 0.65rem; border-radius: var(--radius);
  color: var(--text-dim); text-decoration: none;
  white-space: nowrap; transition: all var(--transition);
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--cream); background: var(--bg-card); }
.nav-link.active {
  color: var(--accent); background: var(--accent-bg);
  border-color: rgba(255,103,32,0.2);
}

.header-badges { display: flex; gap: 0.5rem; align-items: center; }

/* ── Main ──────────────────────────────────────── */
.main { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

/* ── Page title ────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-sys { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--text-muted); }
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: var(--cream); margin-top: 2px; }
.page-desc { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── Section ───────────────────────────────────── */
.section { margin-bottom: 2rem; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.section-label { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); }
.section-title { font-size: 14px; font-weight: 700; color: var(--cream); margin-top: 2px; }

/* ── Grids ─────────────────────────────────────── */
.grid { display: grid; gap: 0.75rem; }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ── Stat card ─────────────────────────────────── */
.stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  position: relative; overflow: hidden;
  transition: border-color 0.2s;
}
.stat:hover { border-color: var(--border-accent); }
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.stat:hover::before { opacity: 0.5; }
.stat-label { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -1px; color: var(--cream); margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
.stat-sub { font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.stat-up { color: var(--green); }
.stat-down { color: var(--red); }

/* ── Card ──────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: border-color 0.2s, transform var(--transition);
}
.card:hover { border-color: var(--border-accent); }
.card-clickable:hover { transform: translateY(-1px); cursor: pointer; }
.card-title { font-size: 13px; font-weight: 700; color: var(--cream); }
.card-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; line-height: 1.5; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 0.75rem; }

/* ── Action card (briefing) ────────────────────── */
.action-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  transition: border-color 0.2s, background 0.2s;
}
.action-card:hover { border-color: var(--border-accent); }
.action-card[data-priority="high"] { border-left-color: var(--red); }
.action-card[data-priority="medium"] { border-left-color: var(--yellow); }
.action-card[data-priority="low"] { border-left-color: var(--green); }
.action-type { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.action-title { font-size: 13px; font-weight: 600; color: var(--cream); margin-top: 4px; }
.action-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; line-height: 1.5; }
.action-meta { font-family: var(--mono); font-size: 9px; color: var(--text-muted); margin-top: 8px; display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Action workstation (expanded panel) ───────── */
.action-workspace {
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: none;
}
.action-card.expanded .action-workspace { display: block; }
.action-card.expanded { background: var(--bg-card-hover); border-color: var(--border-accent); }
.ws-label { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.ws-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.75rem; }
.ws-output {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem;
  font-size: 12px; color: var(--cream-dim); line-height: 1.6;
  min-height: 60px; max-height: 300px; overflow-y: auto;
  white-space: pre-wrap;
}
.ws-output:empty::before { content: 'Output will appear here...'; color: var(--text-muted); font-style: italic; }
.ws-output.loading::before { content: 'Working...'; color: var(--accent); font-family: var(--mono); animation: pulse 1.5s ease-in-out infinite; }
.ws-composer {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.ws-composer-input {
  width: 100%; background: transparent; border: none;
  padding: 0.75rem; color: var(--cream); font-family: var(--sans);
  font-size: 13px; resize: vertical; min-height: 100px;
}
.ws-composer-input:focus { outline: none; }
.ws-composer-input::placeholder { color: var(--text-muted); }
.ws-composer-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.75rem; border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}
.ws-composer-count { font-family: var(--mono); font-size: 9px; color: var(--text-muted); }
.ws-steps { display: flex; flex-direction: column; gap: 4px; }
.ws-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--cream-dim); padding: 4px 0;
}
.ws-step-num {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text-dim); flex-shrink: 0;
}
.ws-step.done .ws-step-num { background: var(--green-bg); border-color: var(--green-dim); color: var(--green); }
.ws-step.active .ws-step-num { background: var(--accent-bg); border-color: var(--accent-dim); color: var(--accent); }

/* ── Tag ───────────────────────────────────────── */
.tag {
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  padding: 2px 7px; border-radius: 2px; letter-spacing: 0.3px;
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 3px;
}
.tag-accent { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-bg); }
.tag-green { color: var(--green); border-color: var(--green-dim); background: var(--green-bg); }
.tag-blue { color: var(--blue); border-color: var(--blue-dim); background: var(--blue-bg); }
.tag-violet { color: var(--violet); border-color: rgba(167,139,250,0.3); background: var(--violet-bg); }
.tag-yellow { color: var(--yellow); border-color: var(--yellow-dim); background: var(--yellow-bg); }
.tag-red { color: var(--red); border-color: var(--red-dim); background: var(--red-bg); }

/* ── Bar chart ─────────────────────────────────── */
.bar-row { margin-bottom: 0.5rem; }
.bar-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.bar-label-name { font-size: 11px; color: var(--cream-dim); }
.bar-label-value { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.bar-track { height: 6px; background: var(--bg-panel); border-radius: 2px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill { height: 100%; border-radius: 1px; transition: width 0.6s ease; }
.fill-green { background: var(--green); }
.fill-blue { background: var(--blue); }
.fill-accent { background: var(--accent); }
.fill-yellow { background: var(--yellow); }
.fill-red { background: var(--red); }
.fill-violet { background: var(--violet); }

/* ── Table ─────────────────────────────────────── */
.table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.table-label { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); }
table { width: 100%; border-collapse: collapse; }
th { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); text-align: left; padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); }
td { font-size: 12px; color: var(--cream-dim); padding: 0.6rem 1rem; border-bottom: 1px solid rgba(42,39,37,0.5); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.015); }

/* ── Form elements ─────────────────────────────── */
.input {
  font-family: var(--sans); font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem 0.75rem;
  color: var(--cream); width: 100%;
  transition: border-color var(--transition);
}
.input:focus { outline: none; border-color: var(--border-focus); }
.input::placeholder { color: var(--text-muted); }

.textarea {
  font-family: var(--sans); font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem;
  color: var(--cream); width: 100%; min-height: 120px;
  resize: vertical; transition: border-color var(--transition);
}
.textarea:focus { outline: none; border-color: var(--border-focus); }
.textarea::placeholder { color: var(--text-muted); }

.btn {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0.45rem 0.9rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--cream-dim); cursor: pointer;
  transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--accent-dim); color: var(--accent); background: var(--accent-bg); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-accent { border-color: var(--accent-dim); color: var(--accent); background: var(--accent-bg); }
.btn-accent:hover { background: rgba(255,103,32,0.15); }
.btn-green { border-color: var(--green-dim); color: var(--green); background: var(--green-bg); }
.btn-red { border-color: var(--red-dim); color: var(--red); background: var(--red-bg); }
.btn-sm { font-size: 9px; padding: 0.3rem 0.6rem; }
.btn-lg { font-size: 11px; padding: 0.6rem 1.2rem; }

/* ── Toast notifications ───────────────────────── */
.toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 10000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  font-family: var(--mono); font-size: 11px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  color: var(--cream); max-width: 360px;
  animation: toastIn 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--blue); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Utilities ─────────────────────────────────── */
.mono { font-family: var(--mono); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.75rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.overflow-x { overflow-x: auto; }
.hidden { display: none; }
.w-full { width: 100%; }

/* ── Dot / Pulse ───────────────────────────────── */
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }
.pulse { animation: pulse 2.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Mobile ────────────────────────────────────── */
@media (max-width: 640px) {
  .header-badges { display: none; }
  .page-title { font-size: 17px; }
  .stat-value { font-size: 22px; }
  .card { padding: 1rem; }
  .main { padding: 1rem 0.75rem 2rem; }
  .hide-mobile { display: none; }
}
