/**
 * Cordintel — Shared Design System
 * Base24: Catppuccin Mocha (dark) / Catppuccin Latte (light)
 *
 * Linked by: index.html, landing.html
 * Inlined in: admin-ui.js (worker-served, no CDN link available)
 *
 * Catppuccin is a community-driven Base24 pastel color scheme.
 * Mocha is its dark variant — warm, low-contrast backgrounds with
 * distinct pastel accents that remain readable at small sizes.
 * Chosen for: professional SaaS aesthetics, WCAG AA contrast,
 * and a clear step away from "hacker terminal" aesthetics.
 */

/* ── Fonts ─────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ── Catppuccin Mocha (dark) ─────────────────────────────────────────── */
:root {
  /* Base surfaces */
  --bg:          #1e1e2e;   /* base     — main background */
  --surface:     #313244;   /* surface0 — card/panel bg */
  --surface-2:   #45475a;   /* surface1 — elevated bg */
  --surface-3:   #585b70;   /* surface2 — highest surface */
  /* Borders */
  --border:      #45475a;
  --border-soft: #313244;
  /* Text */
  --text-1:      #cdd6f4;   /* text      — primary */
  --text-2:      #bac2de;   /* subtext1  — body */
  --text-3:      #a6adc8;   /* subtext0  — secondary */
  --text-4:      #6c7086;   /* overlay0  — muted */
  /* Accents — Catppuccin Mocha palette */
  --mauve:       #cba6f7;   /* primary accent */
  --mauve-dim:   #b4a7f5;
  --mauve-bg:    rgba(203,166,247,.1);
  --blue:        #89b4fa;
  --sapphire:    #74c7ec;
  --teal:        #94e2d5;
  --green:       #a6e3a1;
  --green-dim:   #87d98c;
  --green-bg:    rgba(166,227,161,.08);
  --yellow:      #f9e2af;
  --yellow-dim:  #f5c97a;
  --red:         #f38ba8;
  --red-dim:     #ee7a9b;
  --red-bg:      rgba(243,139,168,.08);
  --peach:       #fab387;
  --lavender:    #b4befe;
  /* Semantic */
  --accent:      var(--mauve);
  --accent-dim:  var(--mauve-dim);
  --accent-bg:   var(--mauve-bg);
  --warn:        var(--yellow);
  --danger:      var(--red);
  --info:        var(--sapphire);
  --success:     var(--green);
}

/* ── Catppuccin Latte (light) ────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #eff1f5;
  --surface:     #e6e9ef;
  --surface-2:   #dce0e8;
  --surface-3:   #ccd0da;
  --border:      #ccd0da;
  --border-soft: #dce0e8;
  --text-1:      #4c4f69;
  --text-2:      #5c5f77;
  --text-3:      #6c6f85;
  --text-4:      #9ca0b0;
  --mauve:       #8839ef;
  --mauve-dim:   #7b31d4;
  --mauve-bg:    rgba(136,57,239,.08);
  --blue:        #1e66f5;
  --sapphire:    #209fb5;
  --teal:        #179299;
  --green:       #40a02b;
  --green-dim:   #389124;
  --green-bg:    rgba(64,160,43,.08);
  --yellow:      #df8e1d;
  --yellow-dim:  #c47f18;
  --red:         #d20f39;
  --red-dim:     #b90c32;
  --red-bg:      rgba(210,15,57,.08);
  --peach:       #fe640b;
  --lavender:    #7287fd;
  --accent:      var(--mauve);
  --accent-dim:  var(--mauve-dim);
  --accent-bg:   var(--mauve-bg);
  --warn:        var(--yellow);
  --danger:      var(--red);
  --info:        var(--sapphire);
  --success:     var(--green);
}

/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; scroll-behavior: smooth; }
[data-theme="light"] html { color-scheme: light; }
body {
  background: var(--bg);
  color: var(--text-2);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Typography ──────────────────────────────────────────────────────── */
.mono { font-family: 'IBM Plex Mono', monospace; }

/* ── Shared buttons ──────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 22px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity .15s;
  letter-spacing: 0.1px;
}
.btn-primary:hover { opacity: .85; }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-3);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 20px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all .15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text-1); }

/* ── Shared form inputs ──────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.field input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-1);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--text-4); font-family: 'DM Sans', sans-serif; }

/* ── Shared pill badge ───────────────────────────────────────────────── */
.pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-4);
  border: 1px solid var(--border-soft);
  text-transform: uppercase;
}
.pill.pro {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent-dim);
}

/* ── Shared loading spinner ──────────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  gap: 10px;
  color: var(--text-4);
  font-size: 12px;
}
.loader::after {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: ci-spin .7s linear infinite;
}
@keyframes ci-spin { to { transform: rotate(360deg); } }

/* ── Shared nav logo ─────────────────────────────────────────────────── */
.logo-text {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  color: var(--text-1);
  text-decoration: none;
}
.logo-text span { color: var(--accent); }
