/* ══════════════════════════════════════════
   Maria Canovas — Salon de Belleza
   Luxury Minimalist Design System
   Font: Playfair Display + Inter
   Palette: Black + Gold + Warm White
   ══════════════════════════════════════════ */

:root {
  /* ── Core palette ── */
  --gold: #C8A96E;
  --gold-dark: #A88B4A;
  --gold-light: #E8D5B0;
  --gold-glow: rgba(200, 169, 110, 0.15);
  --black: #1A1A1A;
  --black-soft: #2D2D2D;
  --charcoal: #4A4A4A;
  --gray: #8A8A8A;
  --gray-light: #C5C5C5;
  --border: #E8E4DF;
  --bg: #FDFBF8;
  --bg-warm: #F8F5F0;
  --white: #FFFFFF;

  /* ── Semantic ── */
  --danger: #C0392B;
  --danger-light: #FADBD8;
  --success: #1E8449;
  --success-light: #D5F5E3;
  --warning: #B7950B;
  --warning-light: #FEF9E7;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --shadow-gold: 0 4px 20px rgba(200, 169, 110, 0.2);

  /* ── Layout ── */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --sidebar-w: 260px;
  --topnav-h: 64px;
  --bottomnav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  /* ── Z-index scale ── */
  --z-base: 1;
  --z-card: 10;
  --z-sticky: 50;
  --z-nav: 100;
  --z-modal-backdrop: 200;
  --z-modal: 210;
  --z-toast: 300;

  /* ── Transitions ── */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 250ms;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--black);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════
   Typography
   ══════════════════════════════════════════ */

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--black);
}
h1 { font-size: 1.75rem; line-height: 1.3; }
h2 { font-size: 1.375rem; line-height: 1.35; }
h3 { font-size: 1.125rem; line-height: 1.4; }

/* ══════════════════════════════════════════
   Buttons
   ══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--black);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--black-soft);
  box-shadow: var(--shadow);
}

.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-gold:hover {
  background: var(--gold-dark);
  box-shadow: var(--shadow-gold);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #A93226; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--charcoal);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--gray);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--black); }

.btn-sm {
  padding: 7px 14px;
  font-size: 0.75rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-warm);
  color: var(--charcoal);
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
}
.btn-icon:hover {
  background: var(--gold-glow);
  border-color: var(--gold);
  color: var(--gold-dark);
}

.btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* ══════════════════════════════════════════
   Forms
   ══════════════════════════════════════════ */

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--charcoal);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--black);
  background: var(--white);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--gray-light);
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}
.checkbox-group label {
  font-size: 0.875rem;
  color: var(--charcoal);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* ══════════════════════════════════════════
   Login Page
   ══════════════════════════════════════════ */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-body::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 80%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(200, 169, 110, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.login-card h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 2px;
  letter-spacing: 0.04em;
}
.login-card .subtitle {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 36px;
}
.login-card .divider {
  width: 40px;
  height: 1px;
  background: var(--gold);
  margin: 16px auto 32px;
}
.login-card .form-group { text-align: left; }
.login-card .btn {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
}
.login-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 12px;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

/* ══════════════════════════════════════════
   App Layout
   ══════════════════════════════════════════ */

.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Nav ── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topnav-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: var(--z-nav);
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
  padding-top: var(--safe-top);
}
.top-nav .brand {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--black);
  letter-spacing: 0.02em;
}
.top-nav .brand span {
  color: var(--gold);
  font-weight: 400;
}
.top-nav .user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--gray);
}
.top-nav .user-info .role-badge {
  background: var(--bg-warm);
  color: var(--gold-dark);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--gold-light);
}
#logoutBtn {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  transition: all var(--duration) var(--ease);
  font-family: 'Inter', sans-serif;
}
#logoutBtn:hover {
  background: var(--bg-warm);
  color: var(--danger);
}

/* ── Sidebar (desktop) ── */
.sidebar {
  display: none;
  position: fixed;
  top: var(--topnav-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  z-index: var(--z-sticky);
  overflow-y: auto;
}
.sidebar .nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray-light);
  padding: 8px 28px 8px;
  font-weight: 600;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 28px;
  color: var(--gray);
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  border-left: 3px solid transparent;
  position: relative;
}
.sidebar .nav-item:hover {
  color: var(--black);
  background: var(--bg-warm);
}
.sidebar .nav-item.active {
  color: var(--black);
  background: var(--bg-warm);
  border-left-color: var(--gold);
  font-weight: 500;
}
.sidebar .nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
  flex-shrink: 0;
}

/* ── Bottom Nav (mobile) ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: var(--z-nav);
  padding: 0 8px;
  padding-bottom: var(--safe-bottom);
  height: calc(var(--bottomnav-h) + var(--safe-bottom));
}
.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px;
  color: var(--gray);
  font-size: 0.6rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--duration) var(--ease);
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  letter-spacing: 0.02em;
}
.bottom-nav .nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
}
.bottom-nav .nav-item.active {
  color: var(--gold-dark);
}

/* ── Main Content ── */
.main-content {
  margin-top: var(--topnav-h);
  padding: 20px 16px;
  padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 20px);
  min-height: calc(100vh - var(--topnav-h));
}

/* ── Sections ── */
.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Search Bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  flex: 1;
  max-width: 340px;
  transition: border-color var(--duration) var(--ease);
}
.search-bar:focus-within {
  border-color: var(--gold);
}
.search-bar input {
  border: none;
  outline: none;
  padding: 12px 0;
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  background: transparent;
  color: var(--black);
}
.search-bar input::placeholder { color: var(--gray-light); }
.search-bar svg {
  width: 18px;
  height: 18px;
  color: var(--gray-light);
  stroke-width: 1.75;
}

/* ══════════════════════════════════════════
   Data Cards
   ══════════════════════════════════════════ */

.data-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  border: 1px solid var(--border);
  position: relative;
}
.data-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--gold-light);
}
.data-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.data-card .card-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--black);
}
.data-card .card-subtitle {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 2px;
}
.data-card .card-body {
  font-size: 0.85rem;
  color: var(--gray);
}
.data-card .card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-primary {
  background: var(--bg-warm);
  color: var(--gold-dark);
  border: 1px solid var(--gold-light);
}
.badge-accent {
  background: var(--bg-warm);
  color: var(--charcoal);
}
.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}
.badge-success {
  background: var(--success-light);
  color: var(--success);
}
.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

/* ══════════════════════════════════════════
   Modals
   ══════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.4);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: 'Playfair Display', serif;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray);
  line-height: 1;
  padding: 4px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
}
.modal-close:hover {
  background: var(--bg-warm);
  color: var(--danger);
}
.modal-body { padding: 24px 28px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border);
}

.modal-lg { max-width: 800px; }

/* ══════════════════════════════════════════
   Timeline
   ══════════════════════════════════════════ */

.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding: 16px 20px;
  margin-bottom: 14px;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color var(--duration) var(--ease);
}
.timeline-item:hover {
  border-color: var(--gold-light);
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 22px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--gold-light);
}
.timeline-item.late::before {
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--warning-light);
}
.timeline-item.cancelled::before {
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-light);
}
.timeline-date {
  font-size: 0.7rem;
  color: var(--gray);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.timeline-service {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  color: var(--black);
  margin: 4px 0;
  font-size: 0.95rem;
}
.timeline-details {
  font-size: 0.8rem;
  color: var(--gray);
}
.timeline-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ══════════════════════════════════════════
   Metrics Dashboard
   ══════════════════════════════════════════ */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all var(--duration) var(--ease);
}
.metric-card:hover {
  box-shadow: var(--shadow);
}
.metric-card .metric-value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--black);
  line-height: 1.2;
}
.metric-card .metric-label {
  font-size: 0.7rem;
  color: var(--gray);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.metric-card.gold .metric-value { color: var(--gold-dark); }
.metric-card.danger .metric-value { color: var(--danger); }
.metric-card.warning .metric-value { color: var(--warning); }
.metric-card.success .metric-value { color: var(--success); }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.chart-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  border: 1px solid var(--border);
}
.chart-container h3 {
  margin-bottom: 16px;
  font-size: 1rem;
}
.chart-container canvas { max-height: 300px; }

/* ══════════════════════════════════════════
   Empty State
   ══════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  stroke-width: 1;
  color: var(--gray-light);
  margin-bottom: 16px;
}
.empty-state p {
  font-size: 0.9rem;
}

/* ══════════════════════════════════════════
   Data Tables
   ══════════════════════════════════════════ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--charcoal);
}
.data-table tr {
  transition: background var(--duration) var(--ease);
}
.data-table tr:hover td {
  background: var(--bg-warm);
}
.data-table .actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
}

/* ══════════════════════════════════════════
   Tabs
   ══════════════════════════════════════════ */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}
.tab {
  padding: 12px 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--duration) var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tab:hover { color: var(--black); }
.tab.active {
  color: var(--black);
  border-bottom-color: var(--gold);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════════
   Counters bar (client detail)
   ══════════════════════════════════════════ */

.counters-bar {
  display: flex;
  gap: 12px;
  padding: 14px 28px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
}

/* ══════════════════════════════════════════
   Utilities
   ══════════════════════════════════════════ */

.hidden { display: none !important; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--gray); }
.text-gold { color: var(--gold-dark); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ══════════════════════════════════════════
   Scrollbar styling
   ══════════════════════════════════════════ */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--gray-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gray); }

/* ══════════════════════════════════════════
   Responsive — Desktop (>= 1024px)
   ══════════════════════════════════════════ */

@media (min-width: 1024px) {
  .sidebar { display: block; }
  .bottom-nav { display: none; }
  .main-content {
    margin-left: var(--sidebar-w);
    padding: 28px 40px;
    padding-bottom: 40px;
    max-width: calc(100vw - var(--sidebar-w));
  }
  .modal-lg { max-width: 900px; }
  .charts-grid { grid-template-columns: 1fr 1fr; }
  .metrics-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ══════════════════════════════════════════
   Responsive — Tablet (>= 640px)
   ══════════════════════════════════════════ */

@media (min-width: 640px) and (max-width: 1023px) {
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ══════════════════════════════════════════
   Responsive — Mobile adjustments (< 640px)
   Touch-first: 44px+ targets, safe areas,
   no horizontal scroll, GPU transitions
   ══════════════════════════════════════════ */

@media (max-width: 639px) {
  /* ── Forms: prevent iOS zoom on focus (16px min) ── */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
    padding: 14px 16px;
  }

  .form-row { flex-direction: column; gap: 0; }

  /* ── Section header stacks vertically ── */
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  .section-header h2 { margin-bottom: 4px; }
  .search-bar { max-width: 100%; }

  /* ── Tables: horizontal scroll wrapper ── */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }
  .data-table { font-size: 0.8rem; min-width: 500px; }
  .data-table th,
  .data-table td { padding: 12px 10px; }
  .data-table .actions {
    flex-direction: column;
    gap: 6px;
  }
  .data-table .actions .btn-sm {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── Modals: near full-screen on mobile ── */
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal {
    max-height: 95vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .modal-lg { max-width: 100%; }
  .modal-body { padding: 20px; }
  .modal-header { padding: 20px; }
  .modal-footer { padding: 14px 20px 20px; }

  /* ── Login ── */
  .login-card {
    padding: 36px 24px;
    max-width: 100%;
  }
  .login-card h1 { font-size: 1.6rem; }

  /* ── Metrics: smaller values on mobile ── */
  .metric-card { padding: 16px 12px; }
  .metric-card .metric-value { font-size: 1.4rem; }
  .metric-card .metric-label { font-size: 0.65rem; }

  /* ── Tabs: horizontal scroll, no wrap ── */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 12px 16px;
    font-size: 0.75rem;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* ── Cards: touch-friendly ── */
  .data-card { padding: 16px; }

  /* ── Timeline: compact on mobile ── */
  .timeline { padding-left: 24px; }
  .timeline-item { padding: 14px 16px; }
  .timeline-actions .btn-sm {
    min-height: 44px;
    padding: 10px 14px;
  }

  /* ── Buttons: ensure 44px min touch target ── */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 44px; }
  .btn-icon { width: 44px; height: 44px; }

  /* ── Counters bar wraps ── */
  .counters-bar { flex-wrap: wrap; padding: 12px 20px; }

  /* ── Charts: stack and fit ── */
  .chart-container { padding: 16px; }
  .chart-container canvas { max-height: 250px; }
}

/* ══════════════════════════════════════════
   Accessibility: focus states
   ══════════════════════════════════════════ */

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Hover only on pointer devices ── */
@media (hover: hover) {
  .data-card:hover { transform: translateY(-1px); }
}
