/* Integrity Human Services — shared tokens */
:root {
  /* Brand colors */
  --gold-900: #7a5f1f;
  --gold-700: #a88438;
  --gold-600: #c9a961;
  --gold-500: #d6bb7e;
  --gold-300: #e8d5a3;
  --gold-100: #f5ecd4;
  --gold-50:  #faf4e4;

  --ink-900: #14110b;
  --ink-700: #2d2720;
  --ink-500: #5a5247;
  --ink-400: #857c6f;
  --ink-300: #b5ac9e;
  --ink-200: #d9d2c4;
  --ink-100: #ece7da;

  --cream-50: #fbf7ee;
  --cream-100: #f6f0e0;
  --paper:    #ffffff;

  --sage-600: #6d8668;
  --sage-100: #e0e8dc;
  --rust-600: #b05d3b;
  --rust-100: #f4ddd0;
  --blue-600: #3f6b8b;
  --blue-100: #dbe6ef;

  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(20, 17, 11, 0.06), 0 1px 3px rgba(20, 17, 11, 0.04);
  --shadow-md: 0 2px 6px rgba(20, 17, 11, 0.06), 0 8px 20px rgba(20, 17, 11, 0.05);
  --shadow-lg: 0 8px 28px rgba(20, 17, 11, 0.10), 0 2px 6px rgba(20, 17, 11, 0.04);

  color-scheme: light;
}

/* ========= DARK MODE =========
   Warm dark palette that keeps the gold brand readable.
   Applied via [data-theme="dark"] so the toggle wins over system.
*/
[data-theme="dark"] {
  --gold-900: #f0dca0;
  --gold-700: #e7c879;
  --gold-600: #c9a961;
  --gold-500: #a88438;
  --gold-300: #6d5524;
  --gold-100: #3a2e14;
  --gold-50:  #2a220f;

  --ink-900: #f6f1e3;
  --ink-700: #ddd4bf;
  --ink-500: #9a9181;
  --ink-400: #7a7262;
  --ink-300: #5a5448;
  --ink-200: #3f3a32;
  --ink-100: #2a2621;

  --cream-50: #1a1714;
  --cream-100: #22201c;
  --paper:    #26231e;

  --sage-600: #8fa98a;
  --sage-100: #2f3a2c;
  --rust-600: #d88565;
  --rust-100: #3e251a;
  --blue-600: #7fa4c2;
  --blue-100: #233642;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.4), 0 8px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);

  color-scheme: dark;
}

/* Auto dark DISABLED — site is locked to light mode.
   Original selector was :root:not([data-theme="light"]).
   Changed to a selector that will never match so the whole block is dead. */
@media (prefers-color-scheme: dark) {
  :root[data-theme="__disabled__"] {
    --gold-900: #f0dca0;
    --gold-700: #e7c879;
    --gold-600: #c9a961;
    --gold-500: #a88438;
    --gold-300: #6d5524;
    --gold-100: #3a2e14;
    --gold-50:  #2a220f;

    --ink-900: #f6f1e3;
    --ink-700: #ddd4bf;
    --ink-500: #9a9181;
    --ink-400: #7a7262;
    --ink-300: #5a5448;
    --ink-200: #3f3a32;
    --ink-100: #2a2621;

    --cream-50: #1a1714;
    --cream-100: #22201c;
    --paper:    #26231e;

    --sage-600: #8fa98a;
    --sage-100: #2f3a2c;
    --rust-600: #d88565;
    --rust-100: #3e251a;
    --blue-600: #7fa4c2;
    --blue-100: #233642;

    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--cream-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--ink-900); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink-900); color: var(--cream-50); }
.btn-primary:hover { background: var(--ink-700); }
.btn-gold { background: var(--gold-600); color: var(--ink-900); }
.btn-gold:hover { background: var(--gold-700); color: var(--cream-50); }
.btn-ghost { background: transparent; color: var(--ink-900); border-color: var(--ink-200); }
.btn-ghost:hover { background: var(--cream-100); border-color: var(--ink-300); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-danger { background: var(--rust-600); color: white; }
.btn-danger:hover { background: #944a2c; }
.btn-success { background: var(--sage-600); color: white; }
.btn-success:hover { background: #536d4f; }

.input, .select, .textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: var(--paper);
  font: inherit;
  color: var(--ink-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold-600);
  box-shadow: 0 0 0 3px var(--gold-100);
}
.label { display: block; font-size: 13px; color: var(--ink-500); margin-bottom: 6px; font-weight: 500; }
.hint { font-size: 12px; color: var(--ink-400); margin-top: 6px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
  background: var(--ink-100); color: var(--ink-700);
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-sage { background: var(--sage-100); color: var(--sage-600); }
.chip-gold { background: var(--gold-100); color: var(--gold-900); }
.chip-rust { background: var(--rust-100); color: var(--rust-600); }
.chip-blue { background: var(--blue-100); color: var(--blue-600); }
.chip-ink  { background: var(--ink-100); color: var(--ink-700); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--ink-500); }
.tiny { font-size: 12px; }

.card {
  background: var(--paper);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-lg);
  padding: 24px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }
::-webkit-scrollbar-track { background: transparent; }

/* ===== Theme toggle button (used in Onboarding + Admin) ===== */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--r-full);
  background: var(--cream-100); color: var(--ink-700);
  border: 1px solid var(--ink-100);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
}
.theme-toggle:hover { background: var(--gold-100); color: var(--gold-900); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ===== Mobile-first utilities ===== */
/* Tap targets: all buttons/inputs/selects should hit 44px minimum on touch */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 12px 18px; }
  .btn-sm { min-height: 40px; padding: 10px 14px; }
  .input, .select, .textarea { min-height: 48px; font-size: 16px; /* prevent iOS zoom on focus */ }
}
@media (max-width: 700px) {
  .input, .select, .textarea { font-size: 16px; }
}

/* Bottom nav shell shared across apps */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--paper); border-top: 1px solid var(--ink-100);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}
.mobile-bottom-nav-grid { display: grid; gap: 2px; }
.mbn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 8px 4px; min-height: 56px;
  background: none; border: none; border-radius: var(--r-md);
  font: inherit; font-size: 10.5px; font-weight: 500;
  color: var(--ink-500);
  letter-spacing: 0.02em;
  line-height: 1.15; text-align: center;
  transition: color 0.12s ease, background 0.12s ease;
}
.mbn-item svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.mbn-item.active { color: var(--gold-900); }
.mbn-item.active .mbn-dot { background: var(--gold-600); }
.mbn-dot { width: 4px; height: 4px; border-radius: 50%; background: transparent; margin-top: 1px; }

/* Top app bar for mobile */
.mobile-appbar {
  display: none;
  position: sticky; top: 0; z-index: 40;
  background: var(--paper); border-bottom: 1px solid var(--ink-100);
  padding: 12px 16px calc(12px + env(safe-area-inset-top));
  align-items: center; gap: 12px;
}
.mobile-appbar-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; flex: 1; }
.mobile-appbar-logo { width: 32px; height: 32px; object-fit: contain; }

@media (max-width: 820px) {
  .mobile-bottom-nav { display: block; }
  .mobile-appbar { display: flex; }
}
