:root {
  /* ── Warm Light Palette ── */
  --color-bg: hsl(38, 20%, 97%);
  --color-surface: hsl(0, 0%, 100%);
  --color-surface-hover: hsl(38, 20%, 95%);
  --color-surface-raised: hsl(0, 0%, 100%);
  --color-border: hsl(38, 15%, 86%);
  --color-border-hover: hsl(38, 15%, 75%);

  --color-text: hsl(38, 15%, 12%);
  --color-text-muted: hsl(38, 10%, 50%);

  --color-primary: hsl(38, 80%, 50%);
  --color-primary-hover: hsl(38, 80%, 42%);
  --color-primary-subtle: hsla(38, 80%, 50%, 0.1);

  --color-accent: hsl(160, 60%, 40%);
  --color-danger: hsl(0, 75%, 50%);
  --color-danger-bg: hsla(0, 75%, 50%, 0.08);

  /* ── Spacing (4px 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;

  /* ── Radii ── */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* ── Shadows (layered, never pure black) ── */
  --shadow-sm: 0 1px 2px hsla(0, 0%, 0%, 0.05), 0 1px 4px hsla(0, 0%, 0%, 0.03);
  --shadow-md: 0 1px 2px hsla(0, 0%, 0%, 0.06), 0 4px 16px hsla(0, 0%, 0%, 0.04);
  --shadow-lg: 0 2px 4px hsla(0, 0%, 0%, 0.08), 0 8px 24px hsla(0, 0%, 0%, 0.06);

  /* ── Motion ── */
  --easing: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;

  /* ── Typography ── */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* ── Layout ── */
  --sidebar-width: 260px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--color-primary-subtle); color: var(--color-primary); }

a { color: var(--color-primary); text-decoration: none; transition: color var(--duration-fast) var(--easing); }
a:hover { color: var(--color-primary-hover); text-decoration: none; }

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
h3 { font-size: 1rem; font-weight: 600; line-height: 1.4; }

code, pre { font-family: var(--font-mono); }

/* ── Buttons ── */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-family);
  transition: all var(--duration-fast) var(--easing);
}

button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-primary);
  color: #0a0a0a;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-surface-hover); border-color: var(--color-primary); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }

.btn-danger {
  background: var(--color-danger);
  color: white;
}
.btn-danger:hover { filter: brightness(1.15); }

.btn-icon {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--easing);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { color: var(--color-danger); background: var(--color-danger-bg); }

/* ── Forms ── */
label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}

input, textarea, select {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  color: var(--color-text);
  font-size: 0.9rem;
  font-family: var(--font-family);
  outline: none;
  transition: border-color var(--duration-fast) var(--easing), box-shadow var(--duration-fast) var(--easing);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

::placeholder { color: var(--color-text-muted); opacity: 0.5; }

/* ── Shared Utilities ── */
.page { max-width: 1200px; }
.page-header {
  margin-bottom: var(--space-6);
}
.page-header h1 { margin-bottom: var(--space-1); }
.page-subtitle { color: var(--color-text-muted); font-size: 0.9rem; }

.state-msg {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-muted);
}

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}

/* ── Loading ── */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: var(--color-text-muted);
}
