/* ============================================================
   Dental Supply — UI v2
   Optimised: will-change, contain, GPU-composited animations,
   font-display:swap, reduced repaints, hardware-accelerated
   sidebar/modal transitions.
   ============================================================ */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
  --teal:        #0FA974;
  --teal-dk:     #0A7D56;
  --teal-lt:     #E6F7F1;
  --teal-mid:    #B8E8D6;
  --sidebar-bg:      #0D1B2A;
  --sidebar-surface: #132231;
  --sidebar-border:  #1E3347;
  --sidebar-text:    #8FAEC4;
  --sidebar-hover:   #1A2D40;
  --bg:          #F0F4F8;
  --surface:     #FFFFFF;
  --surface-alt: #F7FAFC;
  --border:      #E2EAF0;
  --border-md:   #C9D9E6;
  --text:        #0D1B2A;
  --text-muted:  #5A7A94;
  --text-faint:  #9BB5C8;
  --danger:      #E53E3E;
  --danger-lt:   #FFF5F5;
  --danger-mid:  #FED7D7;
  --warning:     #D97706;
  --warning-lt:  #FFFBEB;
  --warning-mid: #FDE68A;
  --success:     #0FA974;
  --success-lt:  #E6F7F1;
  --success-mid: #B8E8D6;
  --info:        #2B6CB0;
  --info-lt:     #EBF4FF;
  --info-mid:    #BEE3F8;
  --sidebar-w:  240px;
  --topbar-h:   56px;
  --r-xs:  3px;  --r-sm: 6px;  --r-md: 10px;
  --r-lg: 14px;  --r-xl: 20px; --r-full: 9999px;
  --shadow-xs: 0 1px 3px rgba(13,27,42,.07);
  --shadow-sm: 0 2px 8px rgba(13,27,42,.09);
  --shadow-md: 0 4px 16px rgba(13,27,42,.11);
  --shadow-lg: 0 8px 32px rgba(13,27,42,.13);
  --font-head: 'Outfit', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --dur: 150ms;
  --ease: cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: var(--font-size-base, 15px);
  /* Prevent subpixel layout shifts */
  -webkit-text-size-adjust: 100%;
}
a { color: var(--teal-dk); text-decoration: none; }
a:hover { color: var(--teal); text-decoration: underline; }
code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  color: var(--teal-dk);
}

/* ── Shell ─────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  border-right: 1px solid var(--sidebar-border);
  /* GPU layer for smooth scroll */
  will-change: transform;
  contain: layout style;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  text-decoration: none;
  display: block;
}
.sidebar-logo-name {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.sidebar-logo-name span { color: var(--teal); }
.sidebar-logo-sub { font-size: 11px; color: var(--sidebar-text); margin-top: 3px; }
.sidebar-nav { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 8px 4px 10px;
  margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,.04);
  color: #4A6580;
  font-family: var(--font-head);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  transition: color var(--dur), background var(--dur);
  border-radius: var(--r-sm);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.nav-section-toggle:first-child { margin-top: 0; border-top: none; }
.nav-section-toggle:hover {
  color: #A8C4D8;
  background: rgba(255,255,255,.04);
}
.nav-section-toggle:active {
  background: rgba(255,255,255,.07);
}
/* Chevron rotates to show open/closed state */
.nav-chevron {
  flex-shrink: 0;
  opacity: .5;
  transition: transform .22s cubic-bezier(.4,0,.2,1), opacity var(--dur);
  margin-left: 4px;
}
.nav-section-toggle:hover .nav-chevron { opacity: .9; }

/* Collapsed section — label shows with a subtle indicator */
.nav-section-toggle[aria-expanded="false"] {
  color: #3D5870;
  padding-bottom: 10px;
}
.nav-section-toggle[aria-expanded="false"]:hover {
  color: #8FAEC4;
}
.nav-section-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  /* Default visible — JS will set max-height after load */
  /* Using max-height:none keeps items visible before JS runs */
  max-height: none;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 7px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 400;
  color: var(--sidebar-text);
  cursor: pointer;
  /* Only transition what changes */
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover { background: var(--sidebar-hover); color: #E0EDF5; }
.nav-item--active { background: rgba(15,169,116,.15); color: #6EEBB6; font-weight: 500; }
.nav-item--active:hover { background: rgba(15,169,116,.20); }
.nav-item--active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--teal);
  border-radius: 0 var(--r-full) var(--r-full) 0;
}
.nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--sidebar-border);
}
.nav-dot--red    { background: #FC8181; box-shadow: 0 0 5px rgba(252,129,129,.5); }
.nav-dot--yellow { background: #F6C90E; box-shadow: 0 0 5px rgba(246,201,14,.4); }
.nav-dot--green  { background: var(--teal); box-shadow: 0 0 5px rgba(15,169,116,.5); }
.sidebar-footer {
  padding: 14px 14px 16px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-footer-user { font-size: 13px; font-weight: 500; color: #D0E4F0; margin-bottom: 1px; }
.sidebar-footer-role { font-size: 11px; color: var(--sidebar-text); margin-bottom: 10px; }

/* ── Main ──────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-xs);
  /* Promote to own layer to avoid repaints on scroll */
  will-change: transform;
  contain: layout style paint;
}
.topbar-title {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.02em;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Page content ──────────────────────────────────────────── */
.page-content {
  padding: 24px;
  flex: 1;
  /* Lightweight fade-up — only opacity+translate, compositor-only */
  animation: fadeUp .2s var(--ease) both;
  contain: layout;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ── Flash ─────────────────────────────────────────────────── */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  margin-bottom: 20px;
  font-size: .9rem;
  border: 1px solid;
  animation: slideIn .18s var(--ease) both;
  /* pre-allocate space to prevent layout shift during dismiss */
  overflow: hidden;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.flash--success { background: var(--success-lt); border-color: var(--success-mid); color: #0A5C3F; }
.flash--error   { background: var(--danger-lt);  border-color: var(--danger-mid);  color: #822727; }
.flash--info    { background: var(--info-lt);    border-color: var(--info-mid);    color: #1A4A7A; }
.flash--warn    { background: var(--warning-lt); border-color: var(--warning-mid); color: #92400E; }
.flash--warning { background: var(--warning-lt); border-color: var(--warning-mid); color: #92400E; }

/* ── Stats ─────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  /* Only animate transform+shadow — GPU composited */
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  contain: layout style;
}
.stat-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.stat-val {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -.03em;
  /* prevent font shift */
  font-display: swap;
}
.stat-val--red   { color: var(--danger);  }
.stat-val--amber { color: var(--warning); }
.stat-val--green { color: var(--success); }
.stat-val--blue  { color: var(--info);    }
.stat-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card--link {
  text-decoration: none !important;
  display: block;
  cursor: pointer;
  border: 1.5px solid var(--border);
  transition: box-shadow var(--dur), transform var(--dur), border-color var(--dur);
}
.stat-card--link:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ── Filter bar ────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.fbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px 12px;
  align-items: end;
  contain: layout;
}
.fbar-dates { display: flex; gap: 8px; align-items: flex-end; grid-column: span 2; }
.fbar-dates .fbar-col { flex: 1; min-width: 0; }
.fbar-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fbar-col label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.fbar-col input[type=text],
.fbar-col input[type=search],
.fbar-col input[type=date],
.fbar-col select { height: 36px; padding: 0 10px; font-size: 13px; width: 100%; }
.fbar-col input[type=date] { padding: 0 8px; }
.fbar-actions { display: flex; gap: 6px; align-items: flex-end; justify-content: flex-end; padding-bottom: 1px; }

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
  contain: layout style;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.card-title {
  font-family: var(--font-head);
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  padding: 10px 14px;
  text-align: left;
  font-family: var(--font-head);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--dur) var(--ease); }
tbody tr:not([style]):hover { background: var(--surface-alt); }
.row--danger  { background: var(--danger-lt)  !important; }
.row--warning { background: var(--warning-lt) !important; }
.row--muted   { opacity: .55; }

/* Sortable headers */
th[data-sort] { cursor: pointer; user-select: none; position: relative; padding-right: 22px !important; }
th[data-sort]:hover { color: var(--teal-dk); background: var(--teal-lt); }
th[data-sort]::after { content: '⇅'; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--text-faint); font-weight: 400; }
th[data-sort].sort-asc::after  { content: '↑'; color: var(--teal); }
th[data-sort].sort-desc::after { content: '↓'; color: var(--teal); }
th[data-sort].sort-asc, th[data-sort].sort-desc { color: var(--teal-dk); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-head);
  letter-spacing: .01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge--red   { background: var(--danger-lt);  color: #C53030; border-color: var(--danger-mid);  }
.badge--amber { background: var(--warning-lt); color: #92400E; border-color: var(--warning-mid); }
.badge--green { background: var(--success-lt); color: #0A5C3F; border-color: var(--success-mid); }
.badge--blue  { background: var(--info-lt);    color: #1A4A7A; border-color: var(--info-mid);    }
.badge--teal  { background: var(--teal-lt);    color: var(--teal-dk); border-color: var(--teal-mid); }
.badge--gray  { background: var(--surface-alt);color: var(--text-muted); border-color: var(--border-md); }
.badge--warning { background: var(--warning-lt); color: #92400E; border-color: var(--warning-mid); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-family: var(--font-body);
  font-size: .87rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-md);
  background: var(--surface);
  color: var(--text);
  /* Only compositor-friendly properties */
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
  text-decoration: none !important;
  white-space: nowrap;
  line-height: 1;
  box-shadow: var(--shadow-xs);
  letter-spacing: -.01em;
  /* Prevent button flash on tap */
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-alt); box-shadow: var(--shadow-sm); transform: translateY(-1px); color: var(--text); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn--primary { background: var(--teal); border-color: var(--teal-dk); color: #fff; box-shadow: 0 2px 8px rgba(15,169,116,.28); }
.btn--primary:hover { background: var(--teal-dk); color: #fff; box-shadow: 0 4px 14px rgba(15,169,116,.32); }
.btn--danger  { background: var(--danger); border-color: #C53030; color: #fff; }
.btn--danger:hover { background: #C53030; color: #fff; box-shadow: 0 4px 12px rgba(229,62,62,.28); }
.btn--warning { background: var(--warning); border-color: #B45309; color: #fff; }
.btn--warning:hover { background: #B45309; color: #fff; }
.btn--sm  { padding: 5px 12px; font-size: 12px; }
.btn--xs  { padding: 3px 9px; font-size: 11px; }
.btn--full { width: 100%; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 24px; max-width: 640px; box-shadow: var(--shadow-sm); }
.form-card--wide { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--full { grid-column: 1/-1; }
label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; }
input[type=text],input[type=email],input[type=number],input[type=password],
input[type=date],input[type=search],input[type=tel],select,textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border-md);
  border-radius: var(--r-md);
  font-size: .93rem;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,169,116,.12);
}
input::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 80px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235A7A94' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.form-hint { font-size: 11px; color: var(--text-faint); line-height: 1.5; }
.form-info { background: var(--info-lt); border: 1px solid var(--info-mid); border-radius: var(--r-md); padding: 10px 13px; font-size: 12px; color: #1A4A7A; margin: 8px 0; line-height: 1.6; }
.form-footer { display: flex; gap: 8px; justify-content: flex-end; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }

/* ── Loc health ────────────────────────────────────────────── */
.loc-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; margin-bottom: 20px; }
.loc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; text-align: center; box-shadow: var(--shadow-xs); transition: box-shadow var(--dur), transform var(--dur); }
.loc-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.loc-card--danger  { background: var(--danger-lt);  border-color: var(--danger-mid);  }
.loc-card--warning { background: var(--warning-lt); border-color: var(--warning-mid); }
.loc-card--ok      { background: var(--success-lt); border-color: var(--success-mid); }
.loc-name { font-family: var(--font-head); font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.loc-nums { display: flex; justify-content: center; gap: 12px; font-family: var(--font-head); font-size: 15px; font-weight: 700; }
.n-red{color:var(--danger)} .n-amber{color:var(--warning)} .n-green{color:var(--success)}
.loc-legend { font-size: 10px; color: var(--text-faint); margin-top: 5px; letter-spacing: .04em; }

/* ── Login ─────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  /* Use CSS gradient instead of radial-gradient composition — faster paint */
  background-image:
    radial-gradient(ellipse 800px 600px at 20% 50%, rgba(15,169,116,.07) 0%, transparent 70%),
    radial-gradient(ellipse 600px 400px at 80% 20%, rgba(43,108,176,.05) 0%, transparent 70%);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  width: 380px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .28s var(--ease) both;
}
.login-title { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.03em; margin-bottom: 4px; }
.login-title span { color: var(--teal); }
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

/* ── Utility ───────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted)  !important; }
.text-faint  { color: var(--text-faint)  !important; }
.text-bold   { font-weight: 500; }
.text-right  { text-align: right; }
.text-red    { color: var(--danger);  }
.text-green  { color: var(--success); }
.font-mono   { font-family: var(--font-mono); }
.mt-8  { margin-top: 8px;   } .mt-16 { margin-top: 16px;  }
.mb-16 { margin-bottom: 16px; }
pre {
  background: var(--sidebar-bg);
  color: #A8D8A8;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.7;
}

/* ── Hamburger ─────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--dur);
  -webkit-tap-highlight-color: transparent;
}
.menu-toggle:hover { background: var(--surface-alt); }
.menu-toggle svg   { display: block; }

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,27,42,.5);
  z-index: 199;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; height: 100%;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
    /* GPU composite for slide animation */
    will-change: transform;
  }
  .sidebar.open { transform: translateX(0); }
  .shell { display: block; }
  .main  { min-height: 100vh; }
  .menu-toggle { display: flex; align-items: center; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-title { font-size: 15px; }
  .page-content { padding: 16px 14px; }
  .stats-row { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .form-card, .form-card--wide { max-width: 100%; }
  .fbar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .fbar-dates { grid-column: span 2; }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .stat-val   { font-size: 22px; }
  .topbar { height: 50px; padding: 0 12px; }
  .topbar-title { font-size: 14px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .btn { padding: 5px 10px; font-size: 11px; }
  .page-content { padding: 12px 10px; }
  .card { border-radius: var(--r-md); }
  .card-header { padding: 10px 12px; }
  table { font-size: 12px; }
  th { padding: 8px 10px; }
  td { padding: 9px 10px; }
  .badge { padding: 2px 7px; font-size: 10px; }
  .btn    { padding: 7px 12px; font-size: 12px; }
  .btn--sm { padding: 4px 9px; font-size: 11px; }
  .form-grid { grid-template-columns: 1fr !important; }
  .form-group--full { grid-column: 1 !important; }
  .fbar { grid-template-columns: 1fr !important; gap: 8px; }
  .fbar-dates { grid-column: 1 !important; flex-direction: row; }
  .fbar-actions { justify-content: flex-start; }
  .stat-card { padding: 12px; }
  .form-card, .form-card--wide { padding: 14px; }
  .form-footer { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stat-val  { font-size: 20px; }
}
@media (max-width: 480px) { .sign-out-label { display: none; } }
