:root {
  --bg: #f8fafc;
  --bg-strong: #0e1726;
  --panel: #111b2f;
  --panel-soft: #1a2740;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --surface-soft: #eef3fb;
  --surface-muted: #f8fafd;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-secondary: #0d9488;
  --accent-2: #1d4ed8;
  --warning: #b45309;
  --danger: #b91c1c;
  --border: #d9e2ef;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.10);

  /* Theme specifics */
  --bg-grad-radial: rgba(29, 78, 216, 0.08);
  --bg-grad-top: #eef3fb;
  --bg-grad-bot: #f8fafc;
  --sidebar-grad: rgba(41, 98, 255, 0.28);
  --action-tile-bg: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  --input-bg: #ffffff;
  --table-head-bg: rgba(255, 255, 255, 0.98);
  --row-hover-bg: rgba(219, 234, 254, 0.22);
  --btn-sec-bg: #e2e8f0;
  --btn-sec-text: #0f172a;
  --modal-shell-bg: #ffffff;
  --empty-icon-bg: #dbeafe;
  --empty-icon-text: var(--accent-2);
  --eyebrow-bg: #dceef3;
  --eyebrow-text: #0f766e;
  --icon-edit-bg: #e0ecff;
  --icon-edit-text: #1d4ed8;
  --icon-quota-bg: #dcfce7;
  --icon-quota-text: #166534;
  --icon-temp-bg: #ede9fe;
  --icon-temp-text: #6d28d9;
  --icon-danger-bg: #fee2e2;
  --icon-danger-text: var(--danger);
}

html.dark {
  --bg: #0f172a;
  --bg-strong: #020617;
  --panel: #020617;
  --panel-soft: #0f172a;
  --surface: rgba(30, 41, 59, 0.85); /* Slate 800 transparent */
  --surface-solid: #1e293b;
  --surface-soft: #1e293b;
  --surface-muted: #0f172a;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #14b8a6;
  --accent-secondary: #0d9488;
  --accent-2: #60a5fa;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #334155;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);

  --bg-grad-radial: rgba(14, 165, 233, 0.08);
  --bg-grad-top: #0f172a;
  --bg-grad-bot: #020617;
  --sidebar-grad: rgba(14, 165, 233, 0.15);
  --action-tile-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --input-bg: #0f172a;
  --table-head-bg: rgba(30, 41, 59, 0.98);
  --row-hover-bg: rgba(59, 130, 246, 0.15);
  --btn-sec-bg: #334155;
  --btn-sec-text: #f8fafc;
  --modal-shell-bg: #1e293b;
  --empty-icon-bg: #1e3a8a;
  --empty-icon-text: #93c5fd;
  --eyebrow-bg: #115e59;
  --eyebrow-text: #ccfbf1;
  --icon-edit-bg: #1e3a8a;
  --icon-edit-text: #93c5fd;
  --icon-quota-bg: #14532d;
  --icon-quota-text: #86efac;
  --icon-temp-bg: #4c1d95;
  --icon-temp-text: #c4b5fd;
  --icon-danger-bg: #7f1d1d;
  --icon-danger-text: #fca5a5;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top right, var(--bg-grad-radial), transparent 32%),
    linear-gradient(180deg, var(--bg-grad-top) 0%, var(--bg-grad-bot) 100%);
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon { width: 18px; height: 18px; flex: 0 0 18px; display: inline-block; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { max-width: 460px; width: 100%; }
.auth-brand h1 { margin: 8px 0 6px; font-size: 30px; }
.auth-brand p { margin: 0 0 18px; color: var(--muted); }

.app-shell {
  display: grid;
  grid-template-columns: 292px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 20px;
  color: #f8fafc;
  background: 
    radial-gradient(circle at top left, #1e293b, transparent 28%),
    linear-gradient(180deg, #0f172a 0%, #020617 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 1px 0 10px rgba(0,0,0,0.1);
  z-index: 20;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 15;
}
.sidebar-overlay.open { display: block; }
@media (min-width: 768px) {
  .sidebar-overlay { display: none !important; }
}

.sidebar-head { margin-bottom: 24px; }
.sidebar-head .sidebar-pill { 
  margin-bottom: 12px; 
  background: rgba(20, 184, 166, 0.15); 
  color: #5eead4; 
  border: 1px solid rgba(20, 184, 166, 0.25); 
}
.sidebar-brand-title { font-size: 1.15rem; font-weight: 700; color: #fff; letter-spacing: -0.01em; }

.sidebar-nav { display: grid; gap: 10px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  border: 1px solid transparent;
}
.sidebar-nav a svg { width: 18px; height: 18px; opacity: 0.8; }
.sidebar-nav a:hover {
  transform: translateX(4px);
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.12);
}
.sidebar-nav a:hover svg { opacity: 1; }
.sidebar-nav a.active {
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(20, 184, 166, 0.3);
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.1);
  color: #5eead4;
}
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  background: transparent;
}

.sidebar-switcher-label { color: rgba(255,255,255,.6); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 2px; }
.sidebar-select { 
  width: 100%; 
  background-color: rgba(255,255,255,.05); 
  color: #ffffff; 
  border: 1px solid rgba(255,255,255,.12); 
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
.sidebar-select:focus { border-color: rgba(255,255,255,0.3); outline: none; }
.sidebar-select option { background: #0f172a; color: #fff; }

.sidebar-footer { margin-top: auto; display: flex; gap: 8px; }
.sidebar-footer-form { flex: 1; display: flex; }
.sidebar-footer-btn { 
  flex: 1; 
  display: flex; 
  align-items: center;
  justify-content: center; 
  background: rgba(255,255,255,.05);
  color: #fff;
  border: 1px solid rgba(255,255,255,.1); 
  border-radius: 8px;
  padding: 10px 0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sidebar-footer-btn:hover { 
  background: rgba(20, 184, 166, 0.15); 
  border-color: rgba(20, 184, 166, 0.2);
  color: #5eead4;
}
.icon-only-btn { flex: 0 0 44px; min-width: 44px; }
.logout-btn { gap: 8px; }
.sidebar-btn-text { font-weight: 500; font-size: 0.95rem; }
.hidden-icon { display: none; }

.content-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 28px 18px;
}

.topbar-left { display: flex; align-items: flex-start; gap: 14px; }
.topbar h2 { margin: 0; font-size: 30px; }
.topbar p { margin: 6px 0 0; color: var(--muted); }

.topbar-right {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.program-switcher {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.content-main {
  display: grid;
  gap: 20px;
  padding: 0 28px 24px;
}

.card {
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, z-index 0.2s ease;
}
.card:hover, .card:focus-within {
  z-index: 10;
}

.hero-card {
  padding: 32px 34px;
}

.hero-copy h3 { margin: 8px 0 10px; font-size: 28px; }
.hero-copy p { margin: 0; color: var(--muted); line-height: 1.6; max-width: 760px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--eyebrow-bg);
  color: var(--eyebrow-text);
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.hero-actions {
  display: grid;
  gap: 14px;
  align-content: stretch;
}

.action-tile {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--action-tile-bg);
  color: var(--text);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .2s ease;
}

.action-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.action-tile strong { font-size: 16px; }
.action-tile small { color: var(--muted); }

.action-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--eyebrow-bg);
  color: var(--eyebrow-text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-mini {
  display: grid;
  gap: 16px;
  align-content: start;
}

.compact-head {
  margin-bottom: 0;
}

.stat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.info-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  transition: color 0.2s;
}
.info-btn:hover, .info-btn:focus {
  color: var(--text);
  outline: none;
}
.info-icon {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

/* Premium CSS Tooltip */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 99;
}
[data-tooltip]::before {
  content: '';
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 4px solid transparent;
  border-top-color: #0f172a;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #f8fafc;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  text-align: center;
  box-shadow: var(--shadow);
}
[data-tooltip]:hover::before,
[data-tooltip]:hover::after,
[data-tooltip]:focus::before,
[data-tooltip]:focus::after,
[data-tooltip]:active::before,
[data-tooltip]:active::after {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title-wrap h3 { margin: 0; }
.section-title-wrap .info-icon { margin-left: 0; }

.mini-metric {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}
.stat-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.table-card { overflow: hidden; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h3 { margin: 0; font-size: 20px; }
.section-head p { margin: 6px 0 0; }
.section-head-spread { align-items: flex-start; }
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(180px, .8fr) minmax(180px, .8fr) auto;
  gap: 12px;
  margin-bottom: 16px;
}
.filter-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--input-bg);
}
.filter-icon { color: var(--muted); display: inline-flex; align-items: center; }
.no-border { border: 0 !important; padding-left: 0; padding-right: 0; background: transparent !important; }
.no-border:focus { outline: none; box-shadow: none; }
.btn-small { min-height: 40px; padding: 10px 14px; }

.stack-sm { display: grid; gap: 12px; }
.stack-md { display: grid; gap: 20px; }
.stack-lg { display: grid; gap: 28px; }

.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon .field-input { padding-left: 42px; }
.input-icon { position: absolute; left: 14px; color: var(--muted); display: flex; pointer-events: none; }

.field-label { font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }
.field-input,
select,
input[type="date"],
input[type="number"],
input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 11px 13px;
  background: var(--input-bg);
  color: var(--text);
}

.field-input.compact { min-height: 42px; }

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
}
.btn:hover, .icon-btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-secondary)); color: #fff; }
.btn-secondary { background: var(--btn-sec-bg); color: var(--btn-sec-text); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex: 0 0 16px; }
.btn span { white-space: nowrap; }

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: var(--btn-sec-bg);
  color: var(--btn-sec-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--border);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.edit { background: var(--icon-edit-bg); color: var(--icon-edit-text); }
.icon-btn.quota { background: var(--icon-quota-bg); color: var(--icon-quota-text); }
.icon-btn.temp { background: var(--icon-temp-bg); color: var(--icon-temp-text); }
.icon-btn.danger { background: var(--icon-danger-bg); color: var(--icon-danger-text); }

.message { padding: 12px 14px; border-radius: 14px; }
.message.error { background: #fee2e2; color: var(--danger); }
.muted { color: var(--muted); }

.brand-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
}

.brand-pill {
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--eyebrow-bg);
  color: var(--accent-secondary);
  border: 1px solid var(--border);
}

.badge.ok { background: var(--icon-quota-bg); color: var(--icon-quota-text); }
.badge.off { background: var(--icon-danger-bg); color: var(--icon-danger-text); }
.badge.warn { background: var(--warning); color: #fff; }
.badge.outline { background: transparent; border: 1px solid var(--border); color: var(--text); }

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.table-wrap { overflow: auto; }
.licenses-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
.licenses-table th,
.licenses-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.licenses-table thead th {
  position: sticky;
  top: 0;
  background: var(--table-head-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 1;
}
.licenses-table tbody tr:hover { background: var(--row-hover-bg); }
.devices-table { min-width: 1080px; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.service-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.service-config-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.service-config-btn:hover,
.service-config-btn:focus {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.cell-title { font-weight: 600; }
.cell-subtle { color: var(--muted); font-size: 12px; margin-top: 3px; }
.hash-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 36px 18px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-muted);
  border-radius: 18px;
}
.empty-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--empty-icon-bg);
  color: var(--empty-icon-text);
}
.empty-icon svg { width: 28px; height: 28px; }
#license-filter-empty { display: none; margin-top: 12px; }

.audit-list { display: grid; gap: 10px; }
.audit-list.collapsed .audit-item:nth-child(n+5) { display: none; }
.audit-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.audit-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.audit-action { font-size: 13px; }
.audit-actor { color: var(--muted); font-size: 13px; }
.audit-page-list { display: grid; gap: 14px; }
.audit-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.audit-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.audit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
.audit-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.audit-summary {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}
.chevron-icon { transition: transform .18s ease; }
.chevron-icon.rotated { transform: rotate(180deg); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 28px 24px;
  color: var(--muted);
  font-size: 13px;
}

.mobile-only { display: none; }
.fade-in-up { animation: fadeInUp .35s ease both; }

.app-modal {
  border: 0;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  max-width: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: transparent;
}

.app-modal::backdrop {
  background: rgba(15, 23, 42, 0.56);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-shell {
  background: var(--modal-shell-bg);
  border-radius: 24px;
  padding: 22px;
  display: grid;
  gap: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.modal-head h3 { margin: 0; font-size: 22px; }
.modal-head p { margin: 6px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.info-box {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-soft);
  font-family: "Consolas", "Courier New", monospace;
  word-break: break-word;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 80;
}

.toast {
  min-width: 260px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #fff;
  background: #0f766e;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.error { background: #b91c1c; }
.toast.hidden { opacity: 0; transform: translateY(8px); }

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

@media (max-width: 1200px) {
  .hero-card { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid { grid-template-columns: 1fr; }
  .filter-toolbar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-flex; }
  .topbar { align-items: stretch; flex-direction: column; }
  .topbar-right { justify-items: stretch; }
}

@media (max-width: 760px) {
  .stats-grid { grid-template-columns: 1fr; }
  .compact-grid { grid-template-columns: 1fr; }
  .topbar, .content-main, .footer { padding-left: 16px; padding-right: 16px; }
  .section-head, .section-head-spread { flex-direction: column; align-items: stretch; }
  .filter-toolbar { grid-template-columns: 1fr; }
  .program-switcher { min-width: 100%; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .header-actions .btn, .header-actions form { width: 100%; }
  .header-actions form .btn { width: 100%; }
  .modal-actions .btn { width: 100%; }
  .audit-card-top { flex-direction: column; }
}
