/* =============================================================
   FITNESS TRIP24/7™ — IPS™
   ADMIN / PROFESSIONAL / DASHBOARD STYLESHEET
   Fully responsive, premium dark theme.
   ============================================================= */

/* -------------------------------------------------------------
   1. DESIGN TOKENS
   ------------------------------------------------------------- */
:root {
  /* Palette */
  --bg:             #05070A;
  --bg-2:           #080B10;
  --surface:        #0D1218;
  --surface-2:      #121821;
  --surface-3:      #1A2230;
  --border:         rgba(25,191,255,0.14);
  --border-strong:  rgba(25,191,255,0.32);
  --border-faint:   rgba(255,255,255,0.06);

  --text:           #FFFFFF;
  --muted:          #98A2B3;
  --muted-2:        #6B7686;

  --accent:         #00AEEF;
  --accent-2:       #19BFFF;
  --accent-3:       #168BFF;

  --success:        #29D3A5;
  --danger:         #FF6B6B;
  --warning:        #FFB547;

  /* Metrics */
  --radius:         14px;
  --radius-sm:      10px;
  --radius-lg:      20px;

  --shadow:         0 8px 30px rgba(0,0,0,0.5);
  --shadow-lg:      0 20px 60px rgba(0,0,0,0.6);
  --glow:           0 0 40px rgba(25,191,255,0.20);

  /* Spacing scale */
  --gap-xs: 6px;
  --gap-sm: 10px;
  --gap:    16px;
  --gap-lg: 24px;
  --gap-xl: 32px;
  --gap-2xl:48px;

  /* Typography */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs-xs: 0.72rem;
  --fs-sm: 0.82rem;
  --fs:    0.92rem;
  --fs-md: 1rem;
  --fs-lg: 1.15rem;
  --fs-xl: 1.5rem;
  --fs-2xl:2rem;
  --fs-3xl:2.6rem;

  /* Sidebar width (used across admin + dash) */
  --sidebar-w: 260px;
  --sidebar-w-md: 240px;
}

/* -------------------------------------------------------------
   2. BASE (admin-specific overrides on top of style.css)
   ------------------------------------------------------------- */
body.admin {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(25,191,255,0.08), transparent 60%),
    radial-gradient(1000px 500px at 90% 10%, rgba(22,139,255,0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.admin-shell,
.dash-grid,
.container {
  -webkit-tap-highlight-color: transparent;
}

.admin-shell img,
.dash-grid img {
  max-width: 100%;
  height: auto;
}

/* -------------------------------------------------------------
   3. ADMIN SHELL LAYOUT
   ------------------------------------------------------------- */
.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 70px);
  width: 100%;
}

.admin-side {
  position: sticky;
  top: 70px;                     /* below sticky header */
  align-self: start;
  height: calc(100vh - 70px);
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--bg-2), #0A0F16);
  border-right: 1px solid var(--border);
  padding: 22px 14px 40px;
  scrollbar-width: thin;
  scrollbar-color: rgba(25,191,255,0.25) transparent;
  z-index: 20;
}
.admin-side::-webkit-scrollbar { width: 8px; }
.admin-side::-webkit-scrollbar-track { background: transparent; }
.admin-side::-webkit-scrollbar-thumb {
  background: rgba(25,191,255,0.22);
  border-radius: 8px;
}
.admin-side::-webkit-scrollbar-thumb:hover {
  background: rgba(25,191,255,0.45);
}

.admin-side h3 {
  font-size: var(--fs-xs);
  letter-spacing: 0.30em;
  color: var(--accent-2);
  margin: 0 0 16px;
  padding: 0 8px;
  text-transform: uppercase;
  font-weight: 700;
}

.admin-side nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-side nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: #C7D2DE;
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background .15s ease, color .15s ease, transform .12s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-side nav a:hover,
.admin-side nav a:focus-visible {
  background: rgba(25,191,255,0.10);
  color: var(--accent-2);
  outline: none;
}

.admin-side nav a.active {
  background: linear-gradient(90deg, rgba(25,191,255,0.18), rgba(25,191,255,0.05));
  color: var(--accent-2);
  border-left: 3px solid var(--accent-2);
  padding-left: 9px;
  font-weight: 600;
}

.admin-main {
  padding: var(--gap-xl);
  min-width: 0;                  /* critical: allow flex/grid children to shrink */
  max-width: 100%;
  overflow-x: hidden;
}

.admin-main h1 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  margin: 0 0 6px;
  line-height: 1.2;
  word-break: break-word;
}

.admin-main > .muted {
  margin-bottom: var(--gap-lg);
}

/* -------------------------------------------------------------
   4. DASHBOARD SHELL (client / professional)
   ------------------------------------------------------------- */
.dash {
  padding: var(--gap-xl) 0;
}

.dash-grid {
  display: grid;
  grid-template-columns: var(--sidebar-w-md) minmax(0, 1fr);
  gap: var(--gap-lg);
  align-items: start;
}

.dash-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  height: fit-content;
  position: sticky;
  top: 90px;
}

.dash-side h3 {
  font-size: var(--fs-xs);
  letter-spacing: 0.25em;
  color: var(--accent-2);
  margin: 0 0 12px;
  text-transform: uppercase;
}

.dash-side nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-side nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: #C7D2DE;
  font-size: var(--fs-sm);
  transition: background .15s ease, color .15s ease;
}

.dash-side nav a:hover,
.dash-side nav a.active {
  background: rgba(25,191,255,0.10);
  color: var(--accent-2);
}

.dash-main { min-width: 0; }

/* -------------------------------------------------------------
   5. GRIDS & CARDS
   ------------------------------------------------------------- */
.cards {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.cards.kpi {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  min-width: 0;
  word-break: break-word;
  transition: border-color .18s ease, transform .18s ease;
}

.card:hover {
  border-color: var(--border-strong);
}

.card h2,
.card h3 {
  margin-top: 0;
  word-break: break-word;
}

.kpi-label {
  display: block;
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.kpi-value {
  display: block;
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  font-weight: 700;
  color: var(--accent-2);
  line-height: 1.2;
  word-break: break-word;
}

/* Quick access tiles */
.quick-access {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--gap-sm);
}

.qa {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.03em;
  transition: all .15s ease;
}

.qa:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
  transform: translateY(-2px);
}

/* Module tiles */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap-sm);
}

.mod {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  min-width: 0;
}

.mod > span { overflow: hidden; text-overflow: ellipsis; }

/* -------------------------------------------------------------
   6. TABLES — responsive with horizontal scroll fallback
   ------------------------------------------------------------- */
.card > .table,
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;              /* triggers horizontal scroll on phones */
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: var(--fs-sm);
  vertical-align: middle;
  word-break: break-word;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table tbody tr:hover {
  background: rgba(25,191,255,0.03);
}

.table .row-actions {
  white-space: nowrap;
}

/* -------------------------------------------------------------
   7. FORMS — responsive grid columns
   ------------------------------------------------------------- */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.row-2,
.row-3 {
  display: grid;
  gap: var(--gap);
}
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-sm);
  color: #C7D2DE;
  min-width: 0;
}

input,
select,
textarea {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: #0A0E14;
  color: var(--text);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: var(--fs);
  width: 100%;
  max-width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(25,191,255,0.15);
}

textarea { resize: vertical; min-height: 80px; }

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.checkbox input { width: auto; }

.err {
  color: var(--danger);
  font-size: var(--fs-xs);
}

/* -------------------------------------------------------------
   8. ADMIN ACTION BAR + INLINE FORMS
   ------------------------------------------------------------- */
.admin-actions {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  margin-bottom: var(--gap-lg);
  flex-wrap: wrap;
}

.inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.inline-form input,
.inline-form select {
  padding: 8px 10px;
  width: auto;
  min-width: 140px;
}

/* -------------------------------------------------------------
   9. BUTTONS (admin sizing refinements)
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.03em;
  transition: all .15s ease;
  white-space: nowrap;
  text-decoration: none;
  min-height: 40px;              /* touch target */
}

.btn.small {
  padding: 6px 12px;
  font-size: var(--fs-xs);
  min-height: 32px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  color: #fff;
  box-shadow: var(--glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 55px rgba(25,191,255,0.4); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover { border-color: var(--accent-2); color: var(--accent-2); }

.btn-ghost {
  background: rgba(25,191,255,0.08);
  color: var(--accent-2);
}
.btn-ghost:hover { background: rgba(25,191,255,0.16); }

/* -------------------------------------------------------------
   10. BADGES
   ------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active,
.badge-paid,
.badge-completed,
.badge-reviewed,
.badge-confirmed {
  background: rgba(41,211,165,0.15);
  color: #8EF0D4;
}

.badge-pending,
.badge-assigned,
.badge-in_progress,
.badge-rescheduled,
.badge-info {
  background: rgba(25,191,255,0.15);
  color: var(--accent-2);
}

.badge-inactive,
.badge-suspended,
.badge-cancelled,
.badge-failed,
.badge-refunded,
.badge-lost {
  background: rgba(255,107,107,0.12);
  color: #FFC1C1;
}

/* -------------------------------------------------------------
   11. ALERTS
   ------------------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 0 0 var(--gap);
  font-size: var(--fs);
  word-break: break-word;
}
.alert-success {
  background: rgba(41,211,165,0.12);
  border: 1px solid rgba(41,211,165,0.35);
  color: #A8F0DA;
}
.alert-error {
  background: rgba(255,107,107,0.10);
  border: 1px solid rgba(255,107,107,0.35);
  color: #FFC1C1;
}

/* -------------------------------------------------------------
   12. LISTS, PAGINATION, GALLERY
   ------------------------------------------------------------- */
.list-plain { list-style: none; padding: 0; margin: 0 0 12px; }
.list-plain li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pagination a {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--fs-sm);
  min-width: 34px;
  text-align: center;
}
.pagination a.active {
  background: var(--accent-2);
  color: #000;
  border-color: var(--accent-2);
}

.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--gap-sm);
}
.gallery-admin-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.gallery-admin-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* -------------------------------------------------------------
   13. FILTER CHIPS
   ------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 28px;
}
.filters .chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(25,191,255,0.08);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--fs-sm);
  transition: all .15s ease;
}
.filters .chip:hover { border-color: var(--accent-2); }
.filters .chip.active {
  background: var(--accent-2);
  color: #000;
  border-color: var(--accent-2);
}

/* -------------------------------------------------------------
   14. PERMISSIONS PAGE
   ------------------------------------------------------------- */
.perm-toolbar {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.perm-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  background: rgba(25,191,255,0.03);
}

.perm-group legend {
  padding: 0 10px;
  font-weight: 700;
  color: var(--accent-2);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.perm-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap-sm);
  margin-top: 10px;
}

.perm-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(5,7,10,0.5);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: border-color .15s ease;
}
.perm-item:hover { border-color: var(--border-strong); }
.perm-item input[type="checkbox"] {
  margin-top: 3px;
  width: auto;
  accent-color: var(--accent-2);
  flex-shrink: 0;
}

/* -------------------------------------------------------------
   15. CODE / MISC
   ------------------------------------------------------------- */
code {
  background: rgba(25,191,255,0.10);
  color: var(--accent-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: var(--fs-sm);
  word-break: break-word;
}

.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }

/* =============================================================
   16. RESPONSIVE — every device tier
   ============================================================= */

/* ─── Ultra-wide (≥ 1600px) ─────────────────────────────────── */
@media (min-width: 1600px) {
  :root {
    --sidebar-w: 280px;
    --sidebar-w-md: 260px;
  }
  .admin-main { padding: 40px 48px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .cards.kpi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

/* ─── Large desktop (1200–1599px) ───────────────────────────── */
@media (min-width: 1200px) and (max-width: 1599px) {
  .admin-main { padding: 32px 36px; }
}

/* ─── Small desktop / large laptop (1024–1199px) ─────────────── */
@media (min-width: 1024px) and (max-width: 1199px) {
  :root {
    --sidebar-w: 240px;
    --sidebar-w-md: 220px;
  }
  .admin-main { padding: 28px 28px; }
  .row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── Professional portal refinements ──────────────────────── */
body.professional .admin-side h3 { color: #29D3A5; }
body.professional .admin-side nav a.active {
  background: linear-gradient(90deg, rgba(41,211,165,0.18), rgba(41,211,165,0.05));
  color: #29D3A5;
  border-left-color: #29D3A5;
}
body.professional .admin-main h1 { color: #fff; }

/* ── Record items (health records list) ───────────────────── */
.record-item strong { color: var(--text); }
.record-item p { color: var(--text-soft); font-size: var(--fs-sm); }

/* ── Chart svg container ──────────────────────────────────── */
.progress-chart svg {
  display: block;
  width: 100%;
  height: 140px;
}

/* ── Professional KPI accent ──────────────────────────────── */
body.professional .kpi-value { color: #29D3A5; }

/* ── Messages view ───────────────────────────────────────── */
#msg-\31 , [id^="msg-"] td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 767px) {
  .record-item { padding: 12px 0 !important; }
  .progress-chart svg { height: 100px; }
}



/* ─── Tablet landscape (900–1023px) ─────────────────────────── */
@media (min-width: 900px) and (max-width: 1023px) {
  :root {
    --sidebar-w: 220px;
    --sidebar-w-md: 200px;
  }
  .admin-main { padding: 24px 22px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .cards.kpi { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ─── Tablet portrait / small laptop (768–899px) ────────────── */
@media (max-width: 899px) {

  /* Collapse sidebar into a slide-in panel */
  .admin-shell,
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .admin-side,
  .dash-side {
    position: static;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 12px;
  }

  /* Make admin/dash nav horizontal scroll on tablets */
  .admin-side nav,
  .dash-side nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .admin-side nav::-webkit-scrollbar,
  .dash-side nav::-webkit-scrollbar { height: 6px; }
  .admin-side nav::-webkit-scrollbar-thumb,
  .dash-side nav::-webkit-scrollbar-thumb {
    background: rgba(25,191,255,0.25);
    border-radius: 6px;
  }

  .admin-side nav a,
  .dash-side nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    border-left: none !important;
    padding: 8px 12px;
  }

  .admin-side nav a.active,
  .dash-side nav a.active {
    padding-left: 12px;
    border-bottom: 2px solid var(--accent-2);
    border-radius: 8px;
  }

  .admin-main { padding: 20px 18px; }

  .row-2,
  .row-3 { grid-template-columns: 1fr; }

  .dash-side { position: static; }
}

/* ─── Large phone / small tablet (600–767px) ────────────────── */
@media (max-width: 767px) {
  .admin-main { padding: 18px 14px; }

  .admin-main h1 {
    font-size: 1.25rem;
    line-height: 1.25;
  }

  .card { padding: 16px; }

  .cards { grid-template-columns: 1fr; }
  .cards.kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .quick-access { grid-template-columns: repeat(3, 1fr); }
  .mod-grid { grid-template-columns: 1fr; }

  .admin-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-actions > * { width: 100%; }
  .admin-actions .inline-form {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .admin-actions .inline-form input,
  .admin-actions .inline-form select {
    width: 100%;
    min-width: 0;
  }

  /* Buttons become full-width when stacked */
  .row-2 > .btn,
  .row-3 > .btn,
  .row-2 > a.btn,
  .row-3 > a.btn {
    width: 100%;
  }

  /* Table always scrollable */
  .table { min-width: 520px; }

  .perm-items { grid-template-columns: 1fr; }

  .gallery-admin-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-admin-item img { height: 120px; }
}

/* ─── Small phone (480–599px) ───────────────────────────────── */
@media (max-width: 599px) {
  .admin-main { padding: 16px 12px; }
  .card { padding: 14px; border-radius: 12px; }

  .cards.kpi { grid-template-columns: 1fr 1fr; }
  .quick-access { grid-template-columns: repeat(2, 1fr); }

  .kpi-value { font-size: 1.25rem; }

  .btn {
    padding: 10px 14px;
    font-size: var(--fs-sm);
    width: 100%;
  }
  .btn.small { width: auto; }

  .table { min-width: 460px; }
  .table th,
  .table td { padding: 8px 10px; font-size: var(--fs-xs); }

  .admin-side nav a,
  .dash-side nav a { font-size: var(--fs-xs); padding: 7px 10px; }
}

/* ─── Very small phone (≤ 380px) ────────────────────────────── */
@media (max-width: 380px) {
  :root {
    --gap: 12px;
    --gap-lg: 18px;
    --gap-xl: 22px;
  }

  .admin-main { padding: 14px 10px; }
  .card { padding: 12px; }

  .cards.kpi { grid-template-columns: 1fr; }

  .kpi-value { font-size: 1.15rem; }

  .admin-main h1 { font-size: 1.1rem; }

  .admin-side h3,
  .dash-side h3 {
    font-size: 0.66rem;
    letter-spacing: 0.22em;
    margin-bottom: 10px;
  }

  .badge { font-size: 0.62rem; padding: 2px 7px; }
}

/* ─── Landscape phone (short height) ────────────────────────── */
@media (max-height: 480px) and (orientation: landscape) {
  .admin-side,
  .dash-side {
    max-height: 55vh;
    overflow-y: auto;
  }
  .admin-main { padding-top: 14px; padding-bottom: 14px; }
}

/* ─── Print ─────────────────────────────────────────────────── */
@media print {
  .admin-side,
  .dash-side,
  .site-header,
  .site-footer,
  .admin-actions,
  .pagination,
  .btn { display: none !important; }

  .admin-shell,
  .dash-grid { display: block; }

  .admin-main { padding: 0; color: #000; background: #fff; }
  .card {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: none;
    color: #000;
  }
  .table th,
  .table td { color: #000; border-color: #ccc; }
}

/* ─── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─── High-contrast / forced-colors ─────────────────────────── */
@media (forced-colors: active) {
  .card,
  .btn,
  .admin-side,
  .dash-side {
    border: 1px solid CanvasText;
  }
  .btn-primary { background: Highlight; color: HighlightText; }
}

/* ─── Dark-mode OS preference (already dark; ensure consistency) */
@media (prefers-color-scheme: light) {
  /* App is intentionally always dark; no override needed. */
}