.mobile-menu { display: none; }
.sidebar-scrim { display: none; }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 180ms ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgb(2 6 23 / .32); }
  .sidebar-scrim.open { position: fixed; inset: 0; z-index: 19; display: block; border: 0; background: rgb(2 6 23 / .62); backdrop-filter: blur(2px); }
  .main { margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding-inline: 18px; }
  .content { padding: 24px 18px 36px; }
}

@media (max-width: 680px) {
  .login-card { padding: 24px 20px; }
  .metrics-grid { grid-template-columns: 1fr; gap: 12px; }
  .metric-card { min-height: 92px; }
  .page-header { align-items: stretch; flex-direction: column; }
  .page-header .actions { justify-content: flex-start; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar .input, .toolbar .select { max-width: none; }
  .info-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-header { align-items: flex-start; flex-wrap: wrap; padding-inline: 16px; }
  .card-body { padding: 16px; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
  .modal-header, .modal-body, .modal-footer { padding-inline: 16px; }
  th, td { padding-inline: 12px; }
  .topbar-title { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .policy-accounts { padding: 14px; }
  .policy-accounts-header { flex-direction: column; }
  .policy-account-actions { width: 100%; }
  .policy-account-actions .btn { flex: 1; }
  .policy-account-columns { display: none; }
  .policy-account-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding-block: 12px; }
  .policy-account-info { grid-column: 1 / -1; margin-bottom: 4px; }
  .drawer { width: 100vw; border-left: 0; }
  .drawer-header { min-height: 82px; padding: 16px; }
  .drawer-header h2 { font-size: 19px; }
  .drawer-body { padding: 16px 14px 24px; }
  .drawer-toolbar { align-items: stretch; flex-direction: column; }
  .drawer-search { min-width: 0; }
  .drawer-toolbar-meta { justify-content: space-between; }
  .drawer-table { min-width: 720px; }
}

@media (max-width: 420px) {
  .info-strip { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 23px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --primary: #2dd4bf;
    --primary-hover: #0d9488;
    --primary-bright: #14b8a6;
    --primary-soft: rgb(19 78 74 / .38);
    --success: #4ade80;
    --success-soft: rgb(20 83 45 / .42);
    --warning: #fbbf24;
    --warning-soft: rgb(120 53 15 / .42);
    --danger: #fca5a5;
    --danger-soft: rgb(127 29 29 / .38);
    --info: #60a5fa;
    --info-soft: rgb(30 58 138 / .38);
    --bg: #020617;
    --surface: #1e293b;
    --surface-elevated: #263449;
    --surface-muted: #1f2937;
    --topbar: rgb(30 41 59 / .8);
    --border: #334155;
    --border-strong: #475569;
    --text: #f3f4f6;
    --text-body: #d1d5db;
    --text-muted: #9ca3af;
    --sidebar: #0f172a;
    --sidebar-text: #d1d5db;
    --focus: #2dd4bf;
    --shadow-card: 0 1px 3px rgb(0 0 0 / .18), 0 1px 2px rgb(0 0 0 / .2);
    --shadow-popover: 0 24px 64px rgb(0 0 0 / .46);
  }
  .metric-card { background: rgb(30 41 59 / .72); border-color: rgb(51 65 85 / .72); }
  .metric-card:nth-child(3) .metric-icon { background: rgb(76 29 149 / .32); color: #c4b5fd; }
  .badge-neutral { background: #374151; color: #d1d5db; }
  .skeleton { background: #334155; }
  .alert-warning { color: #fde68a; }
  .alert-danger { color: #fecaca; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
