/* ══════════════════════════════════════════════════════════════
   Al Khoury Diamonds — Mobile-First Design System
   ══════════════════════════════════════════════════════════════ */

/* ── Remove number spinners ──────────────────────────────────── */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  --gold:          #c9a84c;
  --gold-hover:    #b5912f;
  --gold-light:    #faf3e0;
  --gold-subtle:   #f5edd4;
  --sidebar-bg:    #111827;
  --sidebar-hover: rgba(255,255,255,0.07);
  --sidebar-text:  #9ca3af;
  --sidebar-w:     250px;
  --topbar-h:      58px;
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06);
  --border:        #e5e7eb;
  --text-primary:  #111827;
  --text-secondary:#6b7280;
  --text-muted:    #9ca3af;
  --bg-page:       #f3f4f6;
  --bg-card:       #ffffff;
}

/* ── Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg-page);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ── Gold theme utilities ────────────────────────────────────── */
.text-gold       { color: var(--gold) !important; }
.bg-gold         { background-color: var(--gold) !important; }
.bg-gold-light   { background-color: var(--gold-light) !important; }
.bg-gold-subtle  { background-color: var(--gold-subtle) !important; }
.border-gold     { border-color: var(--gold) !important; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 1000;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.sidebar-brand i { font-size: 1.15rem; }

.sidebar .nav-link {
  color: var(--sidebar-text);
  padding: 9px 14px 9px 16px;
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #f9fafb; }
.sidebar .nav-link.active {
  background: rgba(201,168,76,0.15);
  color: var(--gold);
}
.sidebar .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.25);
  padding: 16px 18px 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  color: var(--sidebar-text);
  flex-shrink: 0;
  margin-top: auto;
}

/* ── Mobile overlay ──────────────────────────────────────────── */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#sidebarOverlay.active { display: block; }

/* ── Main content ────────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-height: 100dvh;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }
.sidebar.collapsed ~ #main-content { margin-left: 0; }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

#sidebarToggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
#sidebarToggle:hover { background: #f3f4f6; color: var(--text-primary); }

/* ── Content area ────────────────────────────────────────────── */
.content-area {
  padding: 20px;
  max-width: 1400px;
}

/* ── Flash messages ──────────────────────────────────────────── */
.alert {
  border: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1e40af; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
  padding: 14px 18px;
  font-size: 13.5px;
  font-weight: 600;
}
.card-body { padding: 18px; }
.card-footer {
  background: #fafafa;
  border-top: 1px solid var(--border);
  padding: 12px 18px;
}

/* ── KPI Cards ───────────────────────────────────────────────── */
.kpi-card {
  border-radius: var(--radius-md);
  transition: transform 0.18s, box-shadow 0.18s;
  cursor: default;
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md) !important;
}

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bg-danger-light  { background: #fef2f2 !important; }
.bg-warning-light { background: #fffbeb !important; }
.bg-success-light { background: #ecfdf5 !important; }
.bg-info-light    { background: #eff6ff !important; }
.bg-purple-light  { background: #f5f3ff !important; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  font-weight: 600;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-sm {
  font-size: 12.5px;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
}
.btn-lg { font-size: 15px; padding: 0.75rem 1.5rem; }

.btn-gold {
  background-color: var(--gold);
  border-color: var(--gold);
  color: #fff;
}
.btn-gold:hover, .btn-gold:focus {
  background-color: var(--gold-hover);
  border-color: var(--gold-hover);
  color: #fff;
  box-shadow: 0 4px 12px rgba(201,168,76,0.35);
}

.btn-outline-gold {
  color: var(--gold);
  border-color: var(--gold);
  background: transparent;
}
.btn-outline-gold:hover {
  background: var(--gold);
  color: #fff;
}

.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline-secondary:hover {
  background: #f3f4f6;
  color: var(--text-primary);
  border-color: #d1d5db;
}

.badge.bg-gold {
  background-color: var(--gold) !important;
  color: #fff !important;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-responsive {
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}
.table {
  margin-bottom: 0;
  font-size: 13.5px;
}
.table th {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border) !important;
  padding: 10px 14px;
  white-space: nowrap;
  background: #fafafa;
}
.table td {
  vertical-align: middle;
  padding: 11px 14px;
  border-bottom: 1px solid #f3f4f6;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: #fafbfc; }
.table thead { position: sticky; top: 0; z-index: 1; }

/* Scrollable table wrapper */
.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

/* Summary / totals row inside a table body */
.table-summary-row td {
  background: #f1f5f9 !important;
  font-weight: 700;
  border-top: 2px solid #e2e8f0 !important;
  color: var(--text-primary);
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-label {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--bg-card);
  color: var(--text-primary);
}
.form-control:focus, .form-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.input-group-text {
  background: #f9fafb;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 13.5px;
}
.form-check-input:checked {
  background-color: var(--gold);
  border-color: var(--gold);
}
.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(201,168,76,0.2);
}
.form-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  font-weight: 600;
  font-size: 11.5px;
  padding: 0.3em 0.65em;
  border-radius: 6px;
  letter-spacing: 0.2px;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-top: 4px;
}
.page-header h4, .page-header h5 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.page-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Login ───────────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px rgba(0,0,0,0.4);
  width: 100%;
  max-width: 400px;
  padding: 36px;
}

/* ── Loading overlay ─────────────────────────────────────────── */
#loadingOverlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Hover card ──────────────────────────────────────────────── */
.hover-card {
  transition: transform 0.18s, box-shadow 0.18s;
  color: var(--text-primary);
  text-decoration: none;
}
.hover-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md) !important;
  color: var(--text-primary);
}

/* ── Misc ────────────────────────────────────────────────────── */
.diamond-row { background: #f9fafb; }
.diamond-row:last-child { border-bottom: none !important; }
.sortable-ghost { opacity: 0.3; background: var(--gold-subtle); border-radius: 6px; }
#sidebarNav .nav-item { cursor: grab; }
#sidebarNav .nav-item:active { cursor: grabbing; }

/* ── Nav tabs ────────────────────────────────────────────────── */
.nav-tabs {
  border-bottom: 2px solid var(--border);
}
.nav-tabs .nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 16px;
  transition: color 0.15s;
}
.nav-tabs .nav-link:hover { color: var(--text-primary); background: transparent; }
.nav-tabs .nav-link.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: transparent;
}

/* ── Dashboard ────────────────────────────────────────────────── */
.dash-greeting   { font-weight: 800; letter-spacing: -0.3px; margin: 0; }
.dash-date       { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px 2px;
}

/* Quick action tiles */
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  box-shadow: var(--shadow-sm);
  height: 100%;
}
.quick-action i { font-size: 20px; color: var(--gold); transition: transform 0.15s; }
.quick-action span { color: var(--text-secondary); }
.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--gold);
}
.quick-action:hover i { transform: scale(1.1); }
.quick-action:hover span { color: var(--gold); }

/* KPI accent borders (left rail) */
.kpi-card.accent-gold  { border-left: 3px solid var(--gold) !important; }
.kpi-card.accent-amber { border-left: 3px solid #d97706 !important; }
.kpi-card.accent-green { border-left: 3px solid #16a34a !important; }
.kpi-card.accent-red   { border-left: 3px solid #dc2626 !important; }
.kpi-card.accent-slate { border-left: 3px solid #64748b !important; }

.kpi-divider { border: none; border-top: 1px solid #f3f4f6; margin: 12px 0 10px; }
.kpi-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 1px 0;
}
.kpi-line .text-muted { font-size: 12px; }

/* Top progress bar (shown during navigations/submits instead of a full flash) */
#topProgress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-hover));
  box-shadow: 0 0 10px rgba(201,168,76,0.7);
  z-index: 10001;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.3s ease;
  pointer-events: none;
}
#topProgress.active { opacity: 1; }

/* DataTables empty / zero-results state */
.dt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 10px;
  color: var(--text-muted);
}
.dt-empty i { font-size: 28px; opacity: 0.45; }
.dt-empty div { font-size: 13px; font-weight: 500; }
table.dataTable td.dataTables_empty { padding: 0 !important; }

/* ════════════════════════════════════════════════════════════════
   DETAIL PAGES — header, stat cards, statement (lists + mobile cards)
   Shared by Distributors (and reusable for other detail/ledger pages)
   ════════════════════════════════════════════════════════════════ */

/* ── Detail header ─────────────────────────────────────────────── */
.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.detail-head .back-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.detail-head .title-wrap { min-width: 0; }
.detail-head h4 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
  word-break: break-word;
}
.detail-head .subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.detail-head .head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Stat cards ────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  height: 100%;
  text-align: center;
}
.stat-card.stat-hero { padding: 20px 16px; }
.stat-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.stat-value {
  font-size: 1.5rem; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.stat-hero .stat-value { font-size: 1.9rem; }
.stat-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ── Statement table (desktop) ─────────────────────────────────── */
.txn-table { border-collapse: separate; border-spacing: 0; margin-bottom: 0; }
.txn-table thead th {
  padding: 11px 16px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
  background: #fafbfc;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.txn-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 13.5px;
}
.txn-table tbody tr:last-child td { border-bottom: none; }
.txn-table tbody tr:hover td { background: #fafbfc; }
.txn-foot td {
  padding: 12px 16px !important;
  background: #f8fafc;
  font-weight: 700;
  border-top: 2px solid var(--border);
}
.txn-date { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.amt-pos { color: #166534; }
.amt-neg { color: #991b1b; }

/* ── Transaction badges / type pills ───────────────────────────── */
.txn-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.txn-income, .txn-payment { background: #dcfce7; color: #166534; }
.txn-expense, .txn-charge { background: #fee2e2; color: #991b1b; }
.txn-gold { background: #fef3c7; color: #92400e; }
.txn-card { background: #dbeafe; color: #1e40af; }

/* ── Delete (icon) button ──────────────────────────────────────── */
.txn-del-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid #fecaca; color: #ef4444; background: #fff;
  font-size: 13px; cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
.txn-del-btn:hover { background: #fee2e2; border-color: #ef4444; }

/* ── Statement as cards (mobile) ───────────────────────────────── */
.txn-list { display: flex; flex-direction: column; gap: 10px; }
.txn-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
}
.txn-item.is-charge  { border-left-color: #ef4444; }
.txn-item.is-payment { border-left-color: #22c55e; }
.txn-item-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.txn-item-amt { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.txn-item-mid { font-size: 13px; color: var(--text-secondary); margin-top: 6px; word-break: break-word; }
.txn-item-bot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #f1f5f9;
}
.txn-item-bot .bal-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.txn-item-bot .bal-value { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Supplier/list cards (mobile) ──────────────────────────────── */
.entity-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text-primary);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.entity-card:active { transform: scale(0.99); }
.entity-card:hover { box-shadow: var(--shadow-md); border-color: var(--gold); color: var(--text-primary); }
.entity-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.entity-card-name { font-weight: 700; font-size: 15px; }
.entity-card-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.entity-card-stats {
  display: flex; gap: 10px; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.entity-card-stat { flex: 1; min-width: 0; }
.entity-card-stat .lbl { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.entity-card-stat .val { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Selectable option cards (e.g. account type radios) ────────── */
.type-option {
  display: block;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  height: 100%;
  margin: 0;
}
.type-option:hover { border-color: var(--gold); }
.type-option.selected {
  border-color: var(--gold);
  background: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.type-option .form-check-input { margin-top: 0; }

/* ── Generic empty state (server-rendered lists) ───────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.empty-state i { font-size: 34px; opacity: 0.4; margin-bottom: 12px; }
.empty-state .title { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.empty-state .hint { font-size: 12.5px; margin-top: 4px; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤992px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
  :root { --sidebar-w: 230px; }

  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }

  .kpi-value { font-size: 1.45rem; }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤768px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Sidebar: off-canvas on mobile */
  .sidebar {
    transform: translateX(-100%);
    z-index: 1000;
    width: min(280px, 82vw);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  #main-content { margin-left: 0 !important; }

  /* Topbar */
  .topbar { padding: 0 12px; }
  #sidebarToggle { width: 44px; height: 44px; font-size: 18px; }

  /* Content */
  .content-area { padding: 12px; }

  /* Flash alerts */
  .px-4.pt-3 { padding-left: 12px !important; padding-right: 12px !important; padding-top: 10px !important; }

  /* Page header: stack on mobile */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  /* Action button row (un-classed) spans full width and wraps on mobile */
  .page-header > div:last-child:not(:only-child) { width: 100%; }
  .page-header > .d-flex:last-child:not(:only-child) { flex-wrap: wrap; }

  /* Cards */
  .card { border-radius: var(--radius-sm); }
  .card-body { padding: 14px; }
  .card-header { padding: 11px 14px; }

  /* Tables */
  .table { font-size: 12.5px; }
  .table th { font-size: 10.5px; padding: 8px 10px; }
  .table td { padding: 9px 10px; }

  /* KPI cards */
  .kpi-card .card-body { padding: 14px !important; }
  .kpi-value { font-size: 1.35rem; }
  .kpi-icon { width: 42px; height: 42px; font-size: 16px; }
  .kpi-label { font-size: 11px; }

  /* Buttons */
  .btn { font-size: 13px; }
  .btn-sm { font-size: 12px; padding: 0.3rem 0.65rem; }

  /* Forms */
  .form-control, .form-select { padding: 9px 12px; font-size: 16px; /* prevent iOS zoom */ }

  /* Nav tabs scrollable */
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .card-header-tabs { margin-left: 0 !important; margin-right: 0 !important; }
  .nav-tabs .nav-link { white-space: nowrap; font-size: 12px; padding: 8px 12px; }

  /* Typography */
  h4 { font-size: 1.05rem !important; }
  h5 { font-size: 0.95rem !important; }

  /* Spacing reset */
  .mb-4 { margin-bottom: 14px !important; }
  .mb-3 { margin-bottom: 10px !important; }
  .pt-3 { padding-top: 8px !important; }
  .px-4 { padding-left: 12px !important; padding-right: 12px !important; }

  /* Family filter pills */
  .d-flex.flex-wrap.gap-1 { gap: 5px !important; }

  /* Badges on mobile */
  .badge { font-size: 10.5px; }

  /* Dashboard quick actions: compact on mobile */
  .quick-action { padding: 14px 6px; font-size: 11.5px; }
  .quick-action i { font-size: 17px; }

  /* Detail header: name on its own line, actions full-width & tappable */
  .detail-head { gap: 10px; }
  .detail-head .title-wrap { flex: 1 1 auto; }
  .detail-head .head-actions { width: 100%; }
  .detail-head .head-actions .btn { flex: 1; justify-content: center; min-height: 42px; }
  .stat-value { font-size: 1.35rem; }
  .stat-hero .stat-value { font-size: 1.6rem; }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — Phone (≤480px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .content-area { padding: 10px; }

  /* Tables even more compact */
  .table { font-size: 12px; }
  .table th { font-size: 10px; padding: 7px 8px; }
  .table td { padding: 8px 8px; }

  /* Login card */
  .login-card { padding: 24px 20px; }

  /* Stack all flex rows */
  .d-flex.justify-content-between { flex-wrap: wrap; gap: 8px; }

  /* Action button groups: full width on very small */
  .btn-group-mobile { width: 100% !important; }

  /* Grid: 1 column */
  .row.g-3 > [class*="col-md-"], .row.g-4 > [class*="col-md-"] { margin-bottom: 10px; }

  /* Badge smaller */
  .badge { font-size: 10px; padding: 0.2em 0.5em; }
}

/* ════════════════════════════════════════════════════════════════
   PRINT
   ════════════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .no-print, #sidebarOverlay,
  form.no-print, .btn, .alert { display: none !important; }
  #main-content { margin-left: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff !important; font-size: 11px; }
  .content-area { padding: 0 !important; }
}
