@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --cream: #F7F4EF;
  --cream-dark: #EDE8DF;
  --ink: #1C1917;
  --ink-light: #44403C;
  --ink-muted: #78716C;
  --accent: #C2410C;
  --accent-light: #FED7AA;
  --accent-pale: #FFF7ED;
  --green: #15803D;
  --green-pale: #DCFCE7;
  --amber: #B45309;
  --amber-pale: #FEF3C7;
  --red: #B91C1C;
  --red-pale: #FEE2E2;
  --blue: #1D4ED8;
  --blue-pale: #DBEAFE;
  --border: #D6CFC4;
  --border-light: #E8E2D9;
  --shadow-sm: 0 1px 3px rgba(28,25,23,0.08);
  --shadow-md: 0 4px 16px rgba(28,25,23,0.10);
  --shadow-lg: 0 8px 32px rgba(28,25,23,0.13);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --sidebar-width: 260px;
  --topbar-height: 60px;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Typography ── */
h1,h2,h3,h4 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #9a3412; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--ink-muted); background: var(--cream); }
.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--cream-dark); color: var(--ink); }
.btn-danger { background: var(--red-pale); color: var(--red); border: 1.5px solid #FECACA; }
.btn-danger:hover { background: #FEE2E2; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-light); text-transform: uppercase; letter-spacing: 0.05em; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.9rem; color: var(--ink);
  background: #fff; transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194,65,12,0.10);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.78rem; color: var(--ink-muted); }

/* ── Cards ── */
.card {
  background: #fff; border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-sm { padding: 16px; border-radius: var(--radius-md); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-green { background: var(--green-pale); color: var(--green); }
.badge-amber { background: var(--amber-pale); color: var(--amber); }
.badge-red { background: var(--red-pale); color: var(--red); }
.badge-blue { background: var(--blue-pale); color: var(--blue); }
.badge-gray { background: var(--cream-dark); color: var(--ink-muted); }

/* ── Alerts ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 0.875rem; display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-warn { background: var(--amber-pale); color: var(--amber); border-color: #FDE68A; }
.alert-error { background: var(--red-pale); color: var(--red); border-color: #FECACA; }
.alert-success { background: var(--green-pale); color: var(--green); border-color: #BBF7D0; }
.alert-info { background: var(--blue-pale); color: var(--blue); border-color: #BFDBFE; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border-light); margin: 20px 0; }

/* ── Loading spinner ── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tooltip ── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); white-space: nowrap;
  background: var(--ink); color: #fff;
  font-size: 0.75rem; padding: 5px 10px; border-radius: 5px;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  z-index: 100;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Tag input pills ── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--cream-dark); color: var(--ink-light);
  padding: 4px 10px; border-radius: 99px; font-size: 0.8rem;
}
.pill-remove {
  background: none; border: none; cursor: pointer;
  color: var(--ink-muted); font-size: 1rem; line-height: 1;
  padding: 0; transition: color 0.1s;
}
.pill-remove:hover { color: var(--red); }

/* ── Transitions ── */
.fade-in { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Utility ── */
.text-muted { color: var(--ink-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.required::after { content: ' *'; color: var(--accent); }
