/* ============================================================
   lisa — shared design tokens & primitives
   Include in any new page with:
     <link rel="stylesheet" href="lisa.css" />
   Tailwind utilities and these tokens compose freely.
   ============================================================ */

/* ---- Fonts ----
   Pages should also include the Google Fonts <link> for
   Inter (400/500/600/700) and JetBrains Mono (400/500). */

:root {
  /* Palette — slate-first, blue accent, emerald status */
  --c-bg:           #f8fafc;   /* page background */
  --c-surface:      #ffffff;   /* cards */
  --c-surface-2:    #f1f5f9;   /* subtle inset */
  --c-border:       #e2e8f0;
  --c-border-strong:#cbd5e1;
  --c-text:         #0f172a;   /* primary */
  --c-text-2:       #334155;   /* body */
  --c-text-muted:   #64748b;
  --c-text-faint:   #94a3b8;

  --c-accent:       #1e40af;   /* primary blue */
  --c-accent-bg:    #dbeafe;
  --c-accent-soft:  #eff6ff;

  --c-ink:          #0f172a;   /* near-black for primary buttons */
  --c-ink-hover:    #1e293b;

  --c-success:      #10b981;
  --c-success-2:    #34d399;
  --c-warn:         #f59e0b;
  --c-danger:       #e11d48;
  --c-danger-soft:  #fff1f2;

  /* Sidebar (dark) */
  --c-side-bg:      #0f172a;
  --c-side-text:    #94a3b8;
  --c-side-text-2:  #cbd5e1;
  --c-side-hover:   rgba(30,41,59,0.45);
  --c-side-active:  rgba(30,41,59,0.85);
  --c-side-border:  rgba(15,23,42,0.8);

  /* Typography */
  --ff-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-xs:   11px;
  --fs-sm:   12px;
  --fs-base: 13.5px;
  --fs-body: 14px;
  --fs-md:   15px;
  --fs-lg:   16px;
  --fs-xl:   18px;
  --fs-2xl:  22px;
  --fs-3xl:  28px;

  /* Spacing scale matches Tailwind's defaults; tokens here are for inline use */
  --pad-card:  24px;
  --pad-row:   14px;

  /* Edges */
  --r-0: 0;
  --r-1: 2px;
  --r-full: 9999px;

  --bs-card: 0 1px 0 rgba(15,23,42,0.04);
}

/* ---------- Reset-ish base ---------- */
html, body {
  font-family: var(--ff-sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--c-text-2);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

/* ---------- Type helpers ---------- */
.mono {
  font-family: var(--ff-mono);
  font-size: var(--fs-sm);
}
.mono-xs {
  font-family: var(--ff-mono);
  font-size: 11px;
}

/* Section kicker — UPPERCASE caption */
.label {
  font-size: var(--fs-xs);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--c-text-muted);
}
.label-muted {
  font-size: var(--fs-xs);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--c-text-faint);
}

/* Page / card titles */
.h-page  { font-size: var(--fs-3xl); font-weight: 500; letter-spacing: -0.01em; color: var(--c-text); line-height: 1.2; }
.h-card  { font-size: var(--fs-lg);  font-weight: 500; letter-spacing: -0.005em; color: var(--c-text); }
.h-meta  { font-size: 13px; color: var(--c-text-muted); }

/* ---------- Layout primitives ---------- */
.app {
  min-height: 100vh;
  display: flex;
  background: var(--c-bg);
}
.app > main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.page {
  flex: 1;
  padding: 32px;
}
.page-narrow { max-width: 760px; margin: 0 auto; }
.page-wide   { max-width: 1280px; margin: 0 auto; }

/* ---------- Surface (card) ---------- */
.surface {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
}
.surface + .surface { margin-top: 24px; }

.surface-pad   { padding: 24px 28px; }
.surface-pad-tight { padding: 16px 20px; }

.divider { height: 1px; background: var(--c-border); }

/* Vertical rhythm between sections */
.stack-6 > * + * { margin-top: 24px; }
.stack-8 > * + * { margin-top: 32px; }

/* ---------- Sidebar ---------- */
.side {
  width: 220px;
  flex-shrink: 0;
  background: var(--c-side-bg);
  color: var(--c-side-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.side-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 28px;
}
.side-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.side-brand-badge {
  width: 20px; height: 20px;
  border: 1px solid #475569;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.side-brand-badge > span {
  font-family: var(--ff-mono);
  font-size: 9px;
  color: #cbd5e1;
  letter-spacing: -0.02em;
  line-height: 1;
}
.side-brand-name {
  font-family: var(--ff-mono);
  font-size: var(--fs-md);
  color: #fff;
  letter-spacing: -0.01em;
}
.side-brand-dot {
  width: 6px; height: 6px; border-radius: 9999px; background: var(--c-success-2);
}
.side-nav { padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  padding: 8px 12px;
  font-size: 13px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.side-nav a:hover { color: #f1f5f9; background: var(--c-side-hover); }
.side-nav a.active { color: #fff; background: var(--c-side-active); }
.side-nav a .glyph { width: 14px; color: #475569; font-size: 12px; }
.side-nav a .count { font-family: var(--ff-mono); font-size: 11px; color: #64748b; }
.side-foot {
  margin-top: auto;
  padding: 16px 20px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  border-top: 1px solid var(--c-side-border);
}
.side-foot .name { color: #e2e8f0; }
.side-foot .sub  { color: #64748b; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.topbar-inner {
  height: 56px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.crumb { font-size: 13px; color: var(--c-text-muted); }
.crumb .sep { color: var(--c-text-faint); margin: 0 6px; }
.crumb .now { color: var(--c-text); }

/* ---------- Status dots ---------- */
.step-dot { width: 8px; height: 8px; border-radius: 9999px; flex-shrink: 0; display: inline-block; }
.step-dot.dot-ok    { background: var(--c-success); }
.step-dot.dot-warn  { background: var(--c-warn); }
.step-dot.dot-err   { background: var(--c-danger); }
.step-dot.dot-mute  { background: var(--c-text-faint); }
.step-dot.pulse-dot { animation: lisa-pulse 1.4s ease-in-out infinite; }
@keyframes lisa-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: .55; transform: scale(.85); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--c-surface-2); }
.btn-primary {
  background: var(--c-ink); color: #fff; border-color: var(--c-ink);
}
.btn-primary:hover { background: var(--c-ink-hover); border-color: var(--c-ink-hover); }
.btn-accent {
  background: var(--c-accent); color: #fff; border-color: var(--c-accent);
}
.btn-accent:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger {
  border-color: #fecdd3; color: #be123c; background: var(--c-surface);
}
.btn-danger:hover { background: var(--c-danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--c-text-muted); }
.btn-ghost:hover { color: var(--c-text); background: var(--c-surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Underlined inline action link */
.link { color: var(--c-accent); cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- Form fields ---------- */
.field {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  transition: border-color .15s, box-shadow .15s;
}
.field:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-bg);
}
.field::placeholder { color: var(--c-text-faint); }
.field-sm { height: 32px; padding: 0 10px; font-size: 13px; }

.textarea {
  width: 100%;
  padding: 12px;
  font-family: var(--ff-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  resize: vertical;
}
.textarea:focus {
  outline: none; border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-bg);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-muted);
  margin-bottom: 6px;
}

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  padding: 2px 8px;
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  background: var(--c-surface);
}
.pill-ok   { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.pill-warn { color: #b45309; border-color: #fed7aa; background: #fff7ed; }
.pill-err  { color: #be123c; border-color: #fecdd3; background: #fff1f2; }
.pill-info { color: #1e40af; border-color: #bfdbfe; background: var(--c-accent-soft); }

/* Tiny mono kbd / code chip */
.kbd {
  font-family: var(--ff-mono);
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  background: var(--c-surface);
}

/* ---------- Tables ---------- */
.lisa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.lisa-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
}
.lisa-table tbody td {
  padding: 12px;
  border-top: 1px solid var(--c-border);
  vertical-align: top;
}
.lisa-table tbody tr:hover { background: var(--c-bg); }

/* ---------- Definition rows (key/value/action) ---------- */
.def-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid #f1f5f9;
}
.def-row:first-child { border-top: 0; }
.def-row > .k { font-size: 12.5px; color: var(--c-text-muted); }
.def-row > .v { font-size: 13.5px; color: var(--c-text); }
.def-row > .a { font-size: 12px; color: var(--c-accent); cursor: pointer; }
.def-row > .a:hover { text-decoration: underline; }

/* ---------- Toggle switch ---------- */
.switch {
  width: 36px; height: 20px; padding: 2px;
  background: #e2e8f0;
  border-radius: 9999px;
  display: inline-block;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.switch.on { background: var(--c-ink); }
.switch > .knob {
  display: block;
  width: 16px; height: 16px;
  background: #fff; border-radius: 9999px;
  transform: translateX(0); transition: transform .15s;
}
.switch.on > .knob { transform: translateX(16px); }

/* ---------- Empty state ---------- */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--c-text-muted);
  border: 1.5px dashed var(--c-border-strong);
  background: var(--c-surface);
}

/* ---------- Pixel art helper (used in welcome/login art) ---------- */
.pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  shape-rendering: crispEdges;
}

/* ---------- Scrollbar polish ---------- */
.scroll-thin::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-thin::-webkit-scrollbar-thumb { background: #cbd5e1; }
.scroll-thin::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }
