/* base.css — shared theme tokens + primitives for every page.
 * v2.0 — CEO design system. All colors via CSS variables only.
 * Ref: DESIGN_SYSTEM.md */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* ── Backgrounds ── */
  --bg:    #080d0b;
  --bg2:   #0c1410;
  --bg3:   #111a15;
  --bg4:   #182218;

  /* ── Primary accent: mat teal ── */
  --acc:   #4a8c7a;
  --accd:  #3a7060;
  --accl:  #5ea88f;

  /* ── Secondary accent: copper (primary CTA only) ── */
  --cop:   #9c7248;
  --copd:  #7a5230;

  /* ── Text ── */
  --txtb:  #d4cfc8;
  --txtd:  #5a7060;
  --txtx:  #8aa090;

  /* ── Borders ── */
  --bdr:   #1e2e25;
  --bdr2:  #2a4035;
  --bdr3:  #3a5545;

  /* ── Status ── */
  --danger: #8c3535;
  --warn:   #9c7248;
  --info:   #3a6e8c;
  --ok:     #4a8c7a;

  /* ── Shadows ── */
  --shadow:    0 8px 32px rgba(0,0,0,0.55);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
  --glow:      0 0 14px rgba(74,140,122,0.15);

  /* ── Typography ── */
  --font-ui:   'Inter', system-ui, -apple-system, sans-serif;
  --font-data: 'JetBrains Mono', 'Fira Code', monospace;
  --font:      var(--font-data); /* legacy alias — data contexts */

  /* ── Type scale (UI) ── */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 14px;
  --text-md:   16px;
  --text-lg:   20px;
  --text-xl:   26px;
  --text-2xl:  34px;
  --text-hero: clamp(32px, 4vw, 52px);

  /* ── Type scale (data / mono) ── */
  --data-xs:   10px;
  --data-sm:   12px;
  --data-base: 13px;
  --data-lg:   18px;
  --data-xl:   28px;

  /* ── Spacing (8px base) ── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  96px;

  /* ── Border radius ── */
  --radius-sm:   2px;
  --radius-md:   4px;
  --radius-lg:   6px;
  --radius-xl:   8px;
  --radius-pill: 20px;

  /* ── Transitions ── */
  --t-fast:   all .12s ease;
  --t-normal: all .20s ease;
  --t-slow:   all .35s ease;
}

[data-theme="light"] {
  --bg:    #f0ede8;
  --bg2:   #e6e2db;
  --bg3:   #dbd6cd;
  --bg4:   #cfc9bf;

  --acc:   #2d6b59;
  --accd:  #1e5244;
  --accl:  #3d8070;

  --cop:   #7a5230;
  --copd:  #5e3e22;

  --txtb:  #1a2820;
  --txtd:  #5a7060;
  --txtx:  #8a9890;

  --bdr:   #c8c2b8;
  --bdr2:  #b0a898;
  --bdr3:  #8a8278;

  --danger: #8c2828;
  --warn:   #7a5230;
  --info:   #2a5a7a;
  --ok:     #2d6b59;

  --shadow:    0 8px 24px rgba(20,35,28,0.12);
  --shadow-sm: 0 2px 6px rgba(20,35,28,0.08);
  --glow:      0 0 12px rgba(45,107,89,0.10);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--txtb);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--acc); color: var(--bg); }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bdr3); }

/* ── Links ── */
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px; height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bdr2);
  position: relative; z-index: 200;
}
.hdr .logo {
  font-family: var(--font-ui);
  font-weight: 700; letter-spacing: 2px; font-size: 14px;
  color: var(--acc); white-space: nowrap; text-decoration: none;
}
.hdr .logo small { color: var(--txtd); font-weight: 400; letter-spacing: 1px; }
.hdr .spacer { flex: 1; }

/* ── Buttons ── */
.btn {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 6px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bdr2);
  background: var(--bg3);
  color: var(--txtb);
  cursor: pointer;
  white-space: nowrap;
  text-transform: none;
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: color-mix(in srgb, var(--acc) 6%, var(--bg3));
}
.btn.primary {
  background: var(--cop);
  border-color: var(--cop);
  color: #fff;
  font-weight: 700;
}
.btn.primary:hover { background: var(--copd); border-color: var(--copd); }
.btn.accent { border-color: var(--acc); color: var(--acc); }
.btn.accent:hover { background: color-mix(in srgb, var(--acc) 10%, var(--bg3)); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 8%, var(--bg3)); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

/* ── Form elements ── */
select, input[type="text"], input[type="email"], input[type="password"], textarea {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  background: var(--bg3);
  color: var(--txtb);
  border: 1px solid var(--bdr2);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 15%, transparent);
}

label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--txtd);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}

/* ── Auth card ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-top: 2px solid var(--acc);
  border-radius: var(--radius-xl);
  padding: 36px 34px;
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--txtb);
  margin-bottom: 4px;
}
.auth-card h1 span.acc { color: var(--acc); }
.auth-card .sub { font-family: var(--font-ui); font-size: var(--text-sm); color: var(--txtd); margin-bottom: 28px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .actions { margin-top: 22px; }
.auth-card .links {
  margin-top: 18px; font-size: var(--text-sm); color: var(--txtd);
  display: flex; justify-content: space-between;
}
.banner {
  padding: 10px 12px; border-radius: var(--radius-md);
  font-family: var(--font-ui); font-size: var(--text-sm);
  margin-bottom: 16px; display: none;
}
.banner.err { display: block; border: 1px solid var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.banner.ok  { display: block; border: 1px solid var(--acc);    color: var(--acc);    background: color-mix(in srgb, var(--acc)    8%, transparent); }

.pw-meter { height: 3px; background: var(--bg4); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.pw-meter > div { height: 100%; width: 0; background: var(--danger); transition: width .25s, background .25s; }

/* ── Chips ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--bdr2);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--txtd);
  cursor: pointer;
  user-select: none;
  transition: var(--t-fast);
  background: var(--bg3);
}
.chip.on {
  border-color: var(--acc);
  color: var(--acc);
  background: color-mix(in srgb, var(--acc) 8%, transparent);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  transform: translateY(16px);
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-left: 3px solid var(--acc);
  color: var(--txtb);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  opacity: 0;
  transition: all .25s ease;
  z-index: 9999;
  pointer-events: none;
  box-shadow: var(--shadow);
  min-width: 240px;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err  { border-left-color: var(--danger); }
.toast.ok   { border-left-color: var(--acc); }
.toast.warn { border-left-color: var(--warn); }

/* ── Overlay / Panel ── */
.overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 4vh 4vw;
}
.overlay.open { display: flex; }

.panel {
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 1080px; max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow); overflow: hidden;
}

.panel-hd {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--bdr);
  background: var(--bg3);
  flex: 0 0 auto;
}
.panel-hd h2 {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--txtb);
  flex: 1;
}
.panel-bd { padding: 20px; overflow-y: auto; flex: 1; }

.x {
  background: none;
  border: 1px solid var(--bdr2);
  color: var(--txtd);
  width: 26px; height: 26px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast);
}
.x:hover { color: var(--danger); border-color: var(--danger); }

/* ── Card ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--bdr2); transform: translateY(-2px); }
.card.accented::before {
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 1.5px;
  background: var(--acc);
  opacity: 0.5;
  transition: opacity .2s;
}
.card.accented:hover::before { opacity: 1; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .hdr { flex-wrap: wrap; height: auto; padding: 8px; gap: 6px; }
  .panel { max-height: 96vh; }
}
