/* =================================================================
   WINTER SALON · Editorial Barbershop Interface
   Aesthetic: deep ink + barber gold + frost cyan, with
   serif display (Fraunces), technical sans (IBM Plex Sans),
   grain texture, hairline rules, and editorial layouts.
   ================================================================= */

:root {
  /* --- Palette: warm ink, brass, frost ------------------------- */
  --ink-900: #0b0a0d;
  --ink-800: #111015;
  --ink-700: #15141a;
  --ink-600: #1b1a21;
  --ink-500: #24222c;
  --ink-400: #2e2b37;

  --brass-600: #a87e28;
  --brass-500: #c89b3c;
  --brass-400: #dcb765;
  --brass-300: #ecd49a;

  --frost-500: #7ebac9;
  --frost-400: #9ec9d8;
  --frost-300: #bbdbe6;

  --burgundy-700: #5f1022;
  --burgundy-500: #8a1c32;
  --burgundy-400: #b2384f;
  --burgundy-soft: rgba(138, 28, 50, 0.14);

  --sage-500: #6b8e6c;
  --sage-400: #8dae8e;
  --sage-soft: rgba(107, 142, 108, 0.14);

  --paper: #f4ead5;
  --paper-dim: rgba(244, 234, 213, 0.06);

  --text-primary: #f2ecdc;
  --text-secondary: #c9c2ae;
  --text-muted: #8d8774;
  --text-faint: #524e45;

  --border: rgba(244, 234, 213, 0.08);
  --border-strong: rgba(244, 234, 213, 0.18);
  --hairline: rgba(200, 155, 60, 0.35);

  /* Legacy aliases so previously written code keeps working */
  --bg-primary: var(--ink-900);
  --bg-secondary: var(--ink-800);
  --bg-tertiary: var(--ink-700);
  --bg-card: var(--ink-800);
  --accent-primary: var(--brass-500);
  --accent-secondary: var(--brass-400);
  --accent-gradient: linear-gradient(135deg, var(--brass-500) 0%, var(--brass-300) 100%);
  --success: var(--sage-500);
  --warning: var(--brass-400);
  --error: var(--burgundy-500);

  /* --- Spacing scale ------------------------------------------- */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;

  --spacing-xs: var(--s-2);
  --spacing-sm: var(--s-3);
  --spacing-md: var(--s-4);
  --spacing-lg: var(--s-5);
  --spacing-xl: var(--s-6);
  --spacing-2xl: var(--s-7);

  /* --- Radii --------------------------------------------------- */
  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 16px;
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --radius-xl: var(--r-xl);

  /* --- Typography --------------------------------------------- */
  --font-display: 'Fraunces', 'Hoefler Text', Georgia, serif;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* --- Shadows ------------------------------------------------- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 24px 56px -20px rgba(0, 0, 0, 0.75);
  --shadow-xl: 0 40px 90px -24px rgba(0, 0, 0, 0.85);
  --glow-brass: 0 0 0 1px rgba(200, 155, 60, 0.45), 0 0 28px -4px rgba(200, 155, 60, 0.35);

  /* --- Motion -------------------------------------------------- */
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 160ms var(--ease);
  --transition-base: 220ms var(--ease);
  --transition-slow: 360ms var(--ease);
}

/* ===============================================================
   RESET & BASE
   =============================================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html, body {
  min-height: 100vh;
  background: var(--ink-900);
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* Atmospheric background: twin brass + frost glows */
  background-color: var(--ink-900);
  background-image:
    radial-gradient(ellipse 80% 45% at 85% -10%, rgba(200, 155, 60, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 35% at 8% 105%, rgba(126, 186, 201, 0.07), transparent 60%),
    linear-gradient(180deg, var(--ink-900) 0%, #0a0810 100%);
  background-attachment: fixed;
}

/* Fine film grain overlay using inline SVG — stays crisp at any DPR */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * {
  position: relative;
  z-index: 2;
}

/* ===============================================================
   TYPOGRAPHY
   =============================================================== */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.012em;
  line-height: 1.1;
  font-variation-settings: "SOFT" 30, "opsz" 144;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 300;
  letter-spacing: -0.025em;
}
h2 { font-size: 1.875rem; font-weight: 400; }
h3 { font-size: 1.375rem; font-weight: 500; }
h4 { font-size: 1.125rem; font-weight: 500; }

h1 em, h2 em, h3 em {
  font-style: italic;
  color: var(--brass-400);
  font-weight: 400;
  font-variation-settings: "SOFT" 80, "opsz" 144;
}

p {
  color: var(--text-secondary);
}

a {
  color: var(--brass-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--brass-300); }

::selection {
  background: var(--brass-500);
  color: var(--ink-900);
}

/* Editorial eyebrow label — reused on page headers and form labels */
.eyebrow,
.form-label {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

/* ===============================================================
   LAYOUT
   =============================================================== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-5) var(--s-8);
}

/* ===============================================================
   NAVBAR
   =============================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 10, 13, 0.72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  padding: var(--s-4) var(--s-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
}

.navbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline), transparent);
  pointer-events: none;
}

.navbar-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  background: none;
  -webkit-text-fill-color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  white-space: nowrap;
}

.navbar-menu {
  display: flex;
  gap: var(--s-1);
  align-items: center;
  flex-wrap: wrap;
}

.navbar-link {
  position: relative;
  color: var(--text-secondary);
  padding: var(--s-2) var(--s-4);
  border-radius: 0;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: color var(--transition-fast);
}

.navbar-link::after {
  content: '';
  position: absolute;
  left: var(--s-4);
  right: var(--s-4);
  bottom: 4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition-base);
}

.navbar-link:hover {
  color: var(--text-primary);
  background: transparent;
}
.navbar-link:hover::after { transform: scaleX(1); }

.navbar-link.active {
  color: var(--brass-400);
  background: transparent;
}
.navbar-link.active::after {
  transform: scaleX(1);
  background: var(--brass-500);
  height: 2px;
}

/* ===============================================================
   CARDS
   =============================================================== */
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(244, 234, 213, 0.015) 0%, transparent 100%),
    linear-gradient(180deg, var(--ink-800), var(--ink-700));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  transition: border-color var(--transition-base);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-header {
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}

/* ===============================================================
   FORMS
   =============================================================== */
.form-group {
  margin-bottom: var(--s-5);
}
.form-group.mb-0 { margin-bottom: 0; }

.form-label {
  display: block;
  margin-bottom: var(--s-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.7rem var(--s-4);
  background: var(--ink-900);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brass-500);
  background: var(--ink-800);
  box-shadow: 0 0 0 3px rgba(200, 155, 60, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-faint);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c9c2ae' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-4) center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-input[type="date"],
.form-input[type="time"] {
  color-scheme: dark;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.form-input[type="date"]::-webkit-calendar-picker-indicator,
.form-input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.75) sepia(0.4) saturate(2) hue-rotate(15deg);
  cursor: pointer;
}

.form-input[type="number"] {
  font-family: var(--font-mono);
}

/* ===============================================================
   BUTTONS
   =============================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0.7rem var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brass-500);
  color: var(--ink-900);
  border-color: var(--brass-500);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brass-400);
  border-color: var(--brass-400);
  box-shadow: var(--glow-brass);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--ink-700);
  border-color: var(--brass-500);
  color: var(--brass-400);
}

.btn-danger {
  background: transparent;
  color: #e48a98;
  border-color: rgba(138, 28, 50, 0.55);
}
.btn-danger:hover:not(:disabled) {
  background: var(--burgundy-500);
  color: var(--paper);
  border-color: var(--burgundy-400);
}

.btn-success {
  background: var(--sage-500);
  color: var(--ink-900);
  border-color: var(--sage-500);
}
.btn-success:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 0 0 1px var(--sage-400);
}

.btn-sm {
  padding: var(--s-2) var(--s-3);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
}

.btn-block { width: 100%; }

/* ===============================================================
   GRID
   =============================================================== */
.grid {
  display: grid;
  gap: var(--s-5);
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===============================================================
   TABLE
   =============================================================== */
.table-container {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--ink-900);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

thead {
  background: linear-gradient(180deg, var(--ink-700), var(--ink-800));
  border-bottom: 1px solid var(--hairline);
}

th {
  padding: var(--s-4);
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--brass-400);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.875rem;
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: rgba(200, 155, 60, 0.045);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Utility for monetary / numerical columns */
.mono,
.money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ===============================================================
   STATS
   =============================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-5);
  margin-bottom: var(--s-6);
}

.stat-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(244, 234, 213, 0.015) 0%, transparent 100%),
    linear-gradient(180deg, var(--ink-800), var(--ink-700));
  border: 1px solid var(--border);
  border-left: 1px solid var(--brass-500);
  border-radius: var(--r-md);
  padding: var(--s-5);
  transition: all var(--transition-base);
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle at top right, rgba(200, 155, 60, 0.08), transparent 70%);
  pointer-events: none;
}

.stat-card:hover {
  border-color: var(--border-strong);
  border-left-color: var(--brass-400);
  transform: translateY(-2px);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  background: none;
  -webkit-text-fill-color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--s-3);
  font-variation-settings: "SOFT" 30, "opsz" 144;
}

.stat-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* ===============================================================
   BADGES
   =============================================================== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid currentColor;
  background: transparent;
  line-height: 1.5;
}

.badge-success { color: var(--sage-400); }
.badge-warning { color: var(--brass-400); }
.badge-primary { color: var(--frost-400); }
.badge-danger  { color: #e48a98; }
.badge-neutral { color: var(--text-muted); }

/* ===============================================================
   AUTH / LOGIN
   =============================================================== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s-5);
  position: relative;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(200, 155, 60, 0.16), transparent 60%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(126, 186, 201, 0.08), transparent 60%),
    var(--ink-900);
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 119px, rgba(244, 234, 213, 0.018) 119px 120px);
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, var(--ink-800), var(--ink-700));
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--s-7) var(--s-6) var(--s-6);
  box-shadow: var(--shadow-xl);
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--s-6);
  right: var(--s-6);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brass-500), transparent);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--s-7);
}

.auth-logo h1 {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  background: none;
  -webkit-text-fill-color: var(--text-primary);
  margin-bottom: var(--s-3);
  font-variation-settings: "SOFT" 40, "opsz" 144;
}

.auth-logo h1 em {
  font-style: italic;
  color: var(--brass-400);
  font-weight: 400;
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

.auth-logo .hairline {
  display: block;
  width: 40px;
  height: 1px;
  background: var(--brass-500);
  margin: var(--s-4) auto var(--s-3);
}

/* ===============================================================
   ALERTS
   =============================================================== */
.alert {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  border-left: 2px solid currentColor;
  font-size: 0.875rem;
}

.alert-error   { background: rgba(138, 28, 50, 0.12);  color: #e48a98; }
.alert-success { background: var(--sage-soft);         color: var(--sage-400); }
.alert-warning { background: rgba(220, 183, 101, 0.1); color: var(--brass-400); }
.alert-info    { background: rgba(126, 186, 201, 0.1); color: var(--frost-400); }

/* ===============================================================
   AUTOCOMPLETE
   =============================================================== */
.autocomplete-container {
  position: relative;
}

.autocomplete-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--ink-700);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}

.autocomplete-item {
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.autocomplete-item:hover {
  background: var(--ink-600);
  color: var(--brass-400);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

/* ===============================================================
   SPINNER
   =============================================================== */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(244, 234, 213, 0.18);
  border-top-color: var(--brass-400);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===============================================================
   MODAL
   =============================================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 10, 13, 0.86);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: var(--s-5);
  animation: fadeIn 0.2s var(--ease);
}

.modal.hidden { display: none; }

.modal-content {
  position: relative;
  background: linear-gradient(180deg, var(--ink-800), var(--ink-700));
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.35s var(--ease);
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--s-5);
  right: var(--s-5);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline), transparent);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--burgundy-soft);
  color: #e48a98;
  border-color: var(--burgundy-500);
}

.modal form {
  padding: var(--s-5) var(--s-6) var(--s-6);
}

/* ===============================================================
   PAGE HEADER (editorial block above a page)
   =============================================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-5);
  flex-wrap: wrap;
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.page-header::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 64px;
  height: 2px;
  background: var(--brass-500);
}

.page-header .eyebrow {
  display: block;
  margin-bottom: var(--s-3);
  color: var(--brass-400);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 2.75rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
  margin: 0;
  font-variation-settings: "SOFT" 40, "opsz" 144;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: var(--s-3);
  max-width: 48ch;
}

/* ===============================================================
   FILTER SHELL (history page)
   =============================================================== */
.filter-shell {
  background: linear-gradient(180deg, var(--ink-800), var(--ink-700));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--s-5);
  position: relative;
}

.filter-shell::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--s-5);
  right: var(--s-5);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline), transparent);
}

.filter-head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.filter-head h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin: 0;
}

.filter-head h3 .count {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--brass-400);
  letter-spacing: 0;
  text-transform: uppercase;
  font-weight: 500;
}

.filter-chips {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.filter-chip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.4;
}

.filter-chip:hover {
  border-color: var(--brass-500);
  color: var(--brass-400);
}

.filter-chip.active {
  background: var(--brass-500);
  color: var(--ink-900);
  border-color: var(--brass-500);
}

.filter-body {
  padding: var(--s-5);
}

.filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--s-4);
}

@media (max-width: 900px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .filter-grid { grid-template-columns: 1fr; }
}

.filter-grid .form-group { margin-bottom: 0; }

.filter-advanced {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all var(--transition-slow);
}

.filter-advanced.open {
  max-height: 600px;
  opacity: 1;
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px dashed var(--border);
}

.filter-advanced-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-4);
}

@media (max-width: 960px) {
  .filter-advanced-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .filter-advanced-grid { grid-template-columns: 1fr 1fr; }
}

.filter-advanced-grid .form-group { margin-bottom: 0; }

.filter-foot {
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  background: rgba(11, 10, 13, 0.35);
}

.filter-advanced-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  transition: color var(--transition-fast);
}

.filter-advanced-toggle:hover { color: var(--brass-400); }
.filter-advanced-toggle .arrow {
  display: inline-block;
  transition: transform var(--transition-base);
  font-size: 0.6rem;
}
.filter-advanced-toggle.open .arrow { transform: rotate(180deg); }

/* ===============================================================
   HISTORY SUMMARY (counters above table)
   =============================================================== */
.history-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--ink-900);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--s-5);
  position: relative;
}

@media (max-width: 720px) {
  .history-summary { grid-template-columns: 1fr 1fr; }
}

.history-summary-item {
  padding: var(--s-4) var(--s-5);
  border-right: 1px solid var(--border);
  position: relative;
}

.history-summary-item:last-child { border-right: none; }

@media (max-width: 720px) {
  .history-summary-item { border-bottom: 1px solid var(--border); }
  .history-summary-item:nth-child(odd)  { border-right: 1px solid var(--border); }
  .history-summary-item:nth-child(even) { border-right: none; }
  .history-summary-item:nth-last-child(-n+2) { border-bottom: none; }
}

.history-summary-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: var(--s-2);
}

.history-summary-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variation-settings: "SOFT" 30, "opsz" 144;
}

.history-summary-value.accent { color: var(--brass-400); }

.history-summary-sub {
  margin-top: var(--s-2);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ===============================================================
   CASH CLOSE — validation pill
   =============================================================== */
.cc-state {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  border: 1px solid currentColor;
  background: var(--ink-900);
  font-family: var(--font-sans);
}

.cc-state strong {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  color: currentColor;
  font-variation-settings: "SOFT" 30, "opsz" 144;
}

.cc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.cc-ok    { color: var(--sage-400); }
.cc-warn  { color: var(--brass-400); }
.cc-error { color: #e48a98; }

/* ===============================================================
   EMPTY STATE
   =============================================================== */
.empty-state {
  text-align: center;
  padding: var(--s-8) var(--s-5);
  color: var(--text-muted);
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: var(--s-2);
  font-variation-settings: "SOFT" 80, "opsz" 144;
}

.empty-state-description {
  font-size: 0.875rem;
  max-width: 36ch;
  margin: 0 auto;
}

/* ===============================================================
   UTILITIES
   =============================================================== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mb-0  { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--s-3); }
.mb-md { margin-bottom: var(--s-4); }
.mb-lg { margin-bottom: var(--s-5); }
.mb-xl { margin-bottom: var(--s-6); }
.mt-lg { margin-top: var(--s-5); }
.mt-xl { margin-top: var(--s-6); }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; justify-content: center; align-items: center; }
.gap-sm { gap: var(--s-3); }
.gap-md { gap: var(--s-4); }
.gap-lg { gap: var(--s-5); }

/* ===============================================================
   SCROLLBAR
   =============================================================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--ink-900);
}

::-webkit-scrollbar-thumb {
  background: var(--ink-500);
  border: 2px solid var(--ink-900);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--brass-600);
}

/* ===============================================================
   ANIMATIONS
   =============================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(24px); opacity: 0; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stagger children reveal — used on table rows after filter apply */
.stagger > * {
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out) forwards;
}
.stagger > *:nth-child(1)  { animation-delay: 0.02s; }
.stagger > *:nth-child(2)  { animation-delay: 0.04s; }
.stagger > *:nth-child(3)  { animation-delay: 0.06s; }
.stagger > *:nth-child(4)  { animation-delay: 0.08s; }
.stagger > *:nth-child(5)  { animation-delay: 0.10s; }
.stagger > *:nth-child(6)  { animation-delay: 0.12s; }
.stagger > *:nth-child(7)  { animation-delay: 0.14s; }
.stagger > *:nth-child(8)  { animation-delay: 0.16s; }
.stagger > *:nth-child(9)  { animation-delay: 0.18s; }
.stagger > *:nth-child(10) { animation-delay: 0.20s; }
.stagger > *:nth-child(11) { animation-delay: 0.22s; }
.stagger > *:nth-child(12) { animation-delay: 0.24s; }

/* ===============================================================
   RESPONSIVE ADJUSTMENTS
   =============================================================== */
@media (max-width: 720px) {
  .navbar {
    padding: var(--s-3) var(--s-4);
    gap: var(--s-2);
  }
  .navbar-brand { font-size: 1.15rem; }
  .navbar-link { padding: var(--s-2) var(--s-3); font-size: 0.6875rem; }
  .container { padding: var(--s-5) var(--s-4) var(--s-7); }
  .card { padding: var(--s-5); }
}
