/* ============ RESET + ROOT ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: #0a0a0a;
  color: #ededed;
  font-family: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}
:root {
  /* Kampfire palette — sober dark SaaS, single restrained accent */
  --bg: #0a0a0a;
  --bg-elev: #121212;
  --ink: #ededed;
  --ink-soft: #a3a3a3;
  --ink-dim: #6b6b6b;
  --line: rgba(255,255,255,0.06);
  --line-strong: rgba(255,255,255,0.10);
  --card: #121212;
  --card-hover: #161616;
  --accent: #ff6a17;       /* single ember accent — used SPARINGLY */
  --accent-soft: rgba(255,106,23,0.12);
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 12px;
}
button, input, select { font-family: inherit; color: inherit; }
input, select { outline: none; }
a { color: inherit; }

/* ============ ANIMATED BG ============ */
.bg-grid { display: none; }
.bg-orbs { display: none; }
.orb { display: none; }
.scanline { display: none; }

/* ============ ROOT LAYOUT ============ */
.root { position: relative; z-index: 2; min-height: 100vh; }

/* ============ BOOT ============ */
.boot { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.boot-pulse {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 24px var(--accent), 0 0 4px #fff;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.5; }
  50%      { transform: scale(1.25); opacity: 1; }
}

/* ============ AUTH ============ */
.auth {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px 24px;
  position: relative;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 24px 60px -20px rgba(0,0,0,0.5);
  animation: rise 0.4s cubic-bezier(.16,1,.3,1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; }
.auth-mark, .mark {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 9px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff;
}
.auth-mark svg, .mark svg { width: 60%; height: 60%; display: block; }
.auth-eyebrow, .eyebrow {
  font-size: 11px; letter-spacing: 0.08em;
  color: var(--ink-dim); margin-bottom: 4px; text-transform: uppercase; font-weight: 500;
}
.auth-title {
  font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.02em;
  color: var(--ink);
}
.auth-sub { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-size: 12px; color: var(--ink-soft); font-weight: 500;
}
.field-label em { color: var(--ink-dim); font-style: normal; font-weight: 400; }
.field input, .field select {
  background: #0a0a0a;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder { color: var(--ink-dim); }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two-up input { padding: 9px 11px; font-size: 13px; }
.auth-error, .modal-error {
  min-height: 18px; font-size: 12.5px; color: var(--danger);
}
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent);
  color: #fff; font-weight: 500; font-size: 14px;
  border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn-primary:hover { background: #ff7a2d; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-arrow { transition: transform 0.15s; }
.btn-primary:hover .btn-arrow { transform: translateX(2px); }

.auth-foot {
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-dim);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-dim); flex-shrink: 0; }
.dot.live { background: var(--ok); }
@keyframes blink { 50% { opacity: 0.5; } }

/* ============ DASHBOARD ============ */
.dash { padding: 32px clamp(20px, 4vw, 48px) 48px; max-width: 1200px; margin: 0 auto; }
.dash-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 40px; padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.dash-brand { display: flex; align-items: center; gap: 12px; }
.mark { width: 32px; height: 32px; border-radius: 8px; }
.brand-name { font-weight: 600; letter-spacing: 0; font-size: 15px; line-height: 1.1; color: var(--ink); }
.brand-module {
  font-size: 11px; letter-spacing: 0; text-transform: none;
  color: var(--ink-soft); margin-top: 2px; font-weight: 400;
}
.brand-sub { display: none; }
.dash-actions { display: flex; gap: 8px; align-items: center; }
.ghost-btn {
  background: transparent; border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 7px 12px; color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.ghost-btn:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.16); }
.ghost-btn:active { transform: translateY(1px); }

.dash-hero { margin-bottom: 32px; }
.dash-hero .eyebrow { display: none; }
.hero-title {
  font-size: 24px;
  font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px;
  color: var(--ink);
}
.hero-sub { color: var(--ink-soft); font-size: 14px; margin: 0; max-width: 560px; line-height: 1.5; }

/* ============ GRID ============ */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.tile {
  --tile-accent: #ff6a17;
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: background 0.15s, border-color 0.15s;
  display: flex; flex-direction: column;
}
.tile:hover { background: var(--card-hover); border-color: var(--line-strong); }

.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.tile-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px; letter-spacing: 0;
  color: #fff;
  background: var(--tile-accent);
}
.tile-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500;
  color: var(--ink-soft); padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: transparent;
}
.tile-status.armed { color: var(--ok); border-color: rgba(34,197,94,0.25); background: rgba(34,197,94,0.06); }
.tile-status.armed .dot { background: var(--ok); }
.tile-status.unarmed { color: var(--ink-soft); }
.tile-status.unarmed .dot { background: var(--ink-dim); }

.tile-body { flex: 1; margin-bottom: 16px; }
.tile-body .eyebrow { margin-bottom: 8px; font-size: 10.5px; }
.tile-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; color: var(--ink); }
.tile-domain { font-size: 12.5px; color: var(--ink-soft); }

.tile-actions { display: flex; gap: 8px; }
.tile-launch {
  flex: 1;
  background: var(--ink);
  color: #0a0a0a; font-weight: 500; font-size: 13.5px;
  border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.15s, transform 0.05s;
}
.tile-launch:hover { background: #fff; }
.tile-launch:active { transform: translateY(1px); }
.tile-launch .btn-arrow { transition: transform 0.15s; }
.tile-launch:hover .btn-arrow { transform: translateX(2px); }
.tile-edit {
  background: transparent; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 0 12px; cursor: pointer; color: var(--ink-soft);
  font-size: 14px; transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tile-edit:hover { color: var(--ink); border-color: rgba(255,255,255,0.16); background: rgba(255,255,255,0.04); }

.dash-foot {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-dim);
  letter-spacing: 0.06em;
}

/* ============ MODAL ============ */
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(3,3,12,0.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(540px, 100%);
  background: #141414;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.6);
  animation: rise 0.25s cubic-bezier(.16,1,.3,1);
  max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.modal h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; font-weight: 600; color: var(--ink); }
.x { background: transparent; border: 0; color: var(--ink-soft); font-size: 20px; cursor: pointer; padding: 2px 8px; line-height: 1; border-radius: 6px; }
.x:hover { color: var(--ink); background: rgba(255,255,255,0.04); }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Install modal */
.install-btn .dot.ok-dot { background: var(--accent); }
.install-modal .muted { color: var(--ink-soft); font-size: 13px; margin: 0 0 18px; line-height: 1.5; }
.install-modal .muted.small { font-size: 12px; margin-top: 6px; margin-bottom: 0; color: var(--ink-dim); }
.install-modal .muted.small.mt { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.install-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.install-steps li { position: relative; padding-left: 32px; font-size: 13.5px; line-height: 1.5; counter-increment: step; color: var(--ink-soft); }
.install-steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.06);
  color: var(--ink); font-weight: 600; font-size: 11.5px;
}
.install-steps strong { display: block; margin-bottom: 4px; color: var(--ink); font-weight: 500; font-size: 14px; }
.install-steps code { background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 12px; color: var(--ink); }
.install-links { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ghost-btn.small { padding: 5px 10px; font-size: 12px; }
.btn-primary.install-cta { padding: 8px 14px; font-size: 13px; text-decoration: none; }

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  .dash { padding: 22px 18px 32px; }
  .auth-card { padding: 28px 22px 22px; }
}
