/* ==========================================================================
   SR Institute Admin Panel — Design System & Responsive Styles
   Brand: Royal Blue (#1a469b), Navy (#0b1f44), Gold (#c89b3c)
   ========================================================================== */

:root {
  --color-royal: #1a469b;
  --color-royal-dark: #133578;
  --color-royal-soft: #eef3fb;
  --color-navy: #0b1f44;
  --color-navy-deep: #071530;
  --color-gold: #c89b3c;
  --color-gold-dark: #a67c22;
  --color-gold-soft: #fbf6e8;

  --color-bg: #f4f7fb;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-muted: #526177;

  --color-success: #15803d;
  --color-success-bg: #dcfce7;
  --color-warning: #b45309;
  --color-warning-bg: #fef3c7;
  --color-danger: #b91c1c;
  --color-danger-bg: #fee2e2;
  --color-info: #1d4ed8;
  --color-info-bg: #dbeafe;
  --color-purple: #6d28d9;
  --color-purple-bg: #ede9fe;
  --color-teal: #0f766e;
  --color-teal-bg: #ccfbf1;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 3px rgba(11, 31, 68, 0.06);
  --shadow-md: 0 8px 24px rgba(11, 31, 68, 0.08);
  --shadow-lg: 0 20px 44px rgba(11, 31, 68, 0.14);

  --sidebar-width: 260px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-bg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.625rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.1s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
}

.btn-xs {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--color-royal);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-royal-dark);
}

.btn-gold {
  background: var(--color-gold);
  color: #fff;
}
.btn-gold:hover:not(:disabled) {
  background: var(--color-gold-dark);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #991b1b;
}

.btn-outline {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--color-bg);
  border-color: #cbd5e1;
}

.btn-outline-light {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}
.btn-outline-light:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
}

.btn-ghost {
  background: transparent;
  color: var(--color-royal);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-royal-soft);
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-royal);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-link:hover {
  text-decoration: underline;
}

.input-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.56rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-royal);
  box-shadow: 0 0 0 3px rgba(26, 70, 155, 0.14);
}

.input-sm {
  max-width: 240px;
  padding: 0.42rem 0.7rem;
  font-size: 0.8125rem;
}

/* ==========================================================================
   Alerts, Badges & Spinners
   ========================================================================== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.alert-error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid #fecaca;
}
.alert-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid #bbf7d0;
}
.alert-info {
  background: var(--color-info-bg);
  color: var(--color-navy);
  border: 1px solid #bfdbfe;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge-paid, .badge-active, .badge-enrolled { background: var(--color-success-bg); color: var(--color-success); }
.badge-pending, .badge-demo_scheduled, .badge-paused { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-overdue { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-new, .badge-online { background: var(--color-info-bg); color: var(--color-info); }
.badge-offline { background: var(--color-purple-bg); color: var(--color-purple); }
.badge-contacted { background: var(--color-teal-bg); color: var(--color-teal); }
.badge-closed, .badge-completed { background: #e2e8f0; color: #475569; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-dark {
  border-color: rgba(26, 70, 155, 0.2);
  border-top-color: var(--color-royal);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.text-danger { color: var(--color-danger); }
.text-muted { color: var(--color-text-muted); }

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-region {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}

.toast {
  background: var(--color-navy);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  border-left: 4px solid var(--color-gold);
  animation: toastIn 0.2s ease;
}
.toast-error { border-left-color: #ef4444; }
.toast-success { border-left-color: #22c55e; }

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

/* ==========================================================================
   Login View
   ========================================================================== */
.login-view {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--color-navy-deep) 0%, var(--color-royal) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.75rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-royal) 0%, var(--color-navy) 100%);
  border: 2px solid var(--color-gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-mark-lg {
  width: 64px;
  height: 64px;
  padding: 6px;
  border-radius: 14px;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  filter: brightness(0) invert(1);
}

/* Sidebar brand-mark (smaller, no invert needed if logo already white) */
.sidebar .brand-mark .brand-logo-img,
.Drawer .brand-mark .brand-logo-img {
  filter: brightness(0) invert(1);
}

.login-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--color-navy);
}

.login-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-navy);
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}
.password-field input {
  padding-right: 4rem;
}
.btn-icon-inline {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--color-royal);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.45rem;
}

.login-footer {
  margin-top: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.login-security-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Admin Shell Layout
   ========================================================================== */
.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100svh;
}

.sidebar {
  background: var(--color-navy);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100svh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  line-height: 1.2;
}
.brand-tag {
  font-size: 0.72rem;
  color: var(--color-gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-group-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 0 0.75rem 0.35rem;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.62rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.is-active {
  background: var(--color-royal);
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--color-gold);
  color: var(--color-navy-deep);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
}

.sidebar-footer {
  padding: 1rem 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-gold);
  color: var(--color-navy-deep);
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.admin-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-role {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
}
.admin-email {
  font-size: 0.72rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Mobile Navigation Drawer (<dialog> + Scroll Snap + Scroll-Driven Backdrop)
   ========================================================================== */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-navy);
  cursor: pointer;
}

.Drawer {
  --drawer-width: min(20em, 80dvw, 100dvw - 24px);
  --drawer-backdrop: 0;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}

.Drawer::backdrop {
  background: #000;
  opacity: calc(var(--drawer-backdrop) / 2);
}

.Drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: var(--drawer-width) 100%;
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

@media (prefers-reduced-motion: no-preference) {
  .Drawer-scroller {
    scroll-behavior: smooth;
  }
}

.Drawer-scroller::after {
  content: '';
  scroll-snap-align: end;
  scroll-initial-target: nearest;
}

.Drawer-sheet {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100svh;
  background: var(--color-navy);
  color: #e2e8f0;
  overflow-y: auto;
  scroll-snap-align: start;
  scrollbar-width: none;
}

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.drawer-top .sidebar-header {
  border-bottom: none;
}
.drawer-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
}

@supports (animation-timeline: scroll()) {
  .Drawer {
    timeline-scope: --drawer-fade;
    animation: fade-drawer-backdrop linear both;
    animation-timeline: --drawer-fade;
  }
  .Drawer-scroller {
    scroll-timeline: --drawer-fade x;
  }
  @property --drawer-backdrop {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
  }
  @keyframes fade-drawer-backdrop {
    0% { --drawer-backdrop: 1; }
    100% { --drawer-backdrop: 0; }
  }
}

/* ==========================================================================
   Workspace, Topbar & Main Content
   ========================================================================== */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1.2;
}

.page-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.main-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.loader-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--color-royal-soft);
  color: var(--color-navy);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ==========================================================================
   KPI Cards, Panels & Charts
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 1rem;
}

.kpi-grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.kpi-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}
.kpi-badge-blue { background: var(--color-royal-soft); color: var(--color-royal); }
.kpi-badge-navy { background: #e2e8f0; color: var(--color-navy); }
.kpi-badge-purple { background: var(--color-purple-bg); color: var(--color-purple); }
.kpi-badge-teal { background: var(--color-teal-bg); color: var(--color-teal); }
.kpi-badge-green { background: var(--color-success-bg); color: var(--color-success); }
.kpi-badge-amber { background: var(--color-warning-bg); color: var(--color-warning); }

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.table-panel {
  padding: 0;
  overflow: hidden;
}
.table-panel .panel-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-navy);
}

.panel-sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.charts-grid,
.dashboard-split,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.chart-container {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.mini-item-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mini-item-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-navy);
}
.mini-item-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Toolbars & Filters
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  background: var(--color-surface);
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex: 1;
}

.toolbar-filters .input-control {
  width: auto;
  min-width: 155px;
  flex: 1 1 160px;
  max-width: 260px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.inline-field label {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.sync-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Responsive Data Tables (@container queries + sticky headers)
   ========================================================================== */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(640px, 75vh);
  container-type: inline-size;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  text-align: left;
}

.data-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

.data-table thead th {
  background: #f8fafc;
  color: var(--color-navy);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table tbody th,
.data-table tbody td {
  padding: 0.78rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.data-table tbody th {
  font-weight: 600;
  color: var(--color-navy);
  background: var(--color-surface);
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
}

.data-table tbody tr:hover td,
.data-table tbody tr:hover th {
  background: #f8fafc;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.cell-primary {
  font-weight: 600;
  color: var(--color-navy);
}
.cell-secondary {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.status-select {
  width: auto;
  min-width: 130px;
  padding: 0.32rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

@container (width < 680px) {
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    margin: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    overflow: hidden;
  }

  .data-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--color-royal-soft);
    border-bottom: 1px solid var(--color-border);
  }

  .data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    text-align: right;
  }

  .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: left;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   Reports & Settings
   ========================================================================== */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.report-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}
.report-card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--color-navy);
}
.report-card p {
  margin: 0;
  font-size: 0.83rem;
  color: var(--color-text-muted);
}

.report-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}
.report-stat {
  background: var(--color-bg);
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.report-stat-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.report-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-navy);
}

.info-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin: 0;
}
.info-list > div {
  background: var(--color-bg);
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
}
.info-list dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  font-weight: 700;
}
.info-list dd {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-navy);
  word-break: break-word;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Native Modal Dialogs (<dialog>)
   ========================================================================== */
.modal-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(560px, calc(100vw - 2rem));
  max-height: min(88svh, 820px);
  box-shadow: var(--shadow-lg);
  background: var(--color-surface);
  color: var(--color-text);
  overflow: hidden;
}

.modal-dialog.modal-lg {
  width: min(760px, calc(100vw - 2rem));
}
.modal-dialog.modal-sm {
  width: min(420px, calc(100vw - 2rem));
}

dialog[open].modal-dialog {
  display: flex;
  flex-direction: column;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(7, 21, 48, 0.55);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.05rem 1.35rem;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-navy);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
}
.modal-close:hover {
  background: var(--color-bg);
  color: var(--color-navy);
}

.modal-body {
  padding: 1.25rem 1.35rem;
  overflow-y: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0 1rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1023px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0.75rem 1rem;
  }
  .topbar-actions .btn {
    padding: 0.42rem 0.65rem;
    font-size: 0.76rem;
  }
  .main-content {
    padding: 1rem;
  }
  .page-subtitle {
    display: none;
  }
}

/* ==========================================================================
   Print Styles (Executive Summary Report)
   ========================================================================== */
@media print {
  .sidebar,
  .topbar,
  .reports-grid,
  .toast-region,
  #print-report-btn {
    display: none !important;
  }
  .admin-shell {
    display: block;
  }
  .main-content {
    padding: 0;
  }
  .panel {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
