/* ============================================================
   HostelHub — "Midnight Campus" design system
   Dark-navy sidebar, light cool content area, indigo->cyan accent,
   sharp corners (no pills), left-accent-bar stat cards, dot-grid
   decoration. Fonts: Space Grotesk (headings/numbers) + Manrope (body).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root{
  --bg:#f4f6fb;
  --surface:#ffffff;
  --surface-2:#eef1f8;
  --surface-3:#e7eaf5;
  --text:#10152b;
  --muted:#6b7280;
  --muted-2:#9aa1b5;
  --border:#e2e6f0;
  --border-strong:#cbd2e6;

  --primary:#4f46e5;
  --primary-dark:#4338ca;
  --primary-2:#06b6d4;
  --gradient-brand:linear-gradient(135deg,#4f46e5,#4338ca 55%,#06b6d4);
  --primary-tint:#eef0fe;

  --sidebar-bg:#10152b;
  --sidebar-bg-2:#171d3a;
  --sidebar-border:#232a4d;
  --sidebar-text:#aab0c6;
  --sidebar-text-dim:#6b7290;
  --sidebar-active:linear-gradient(90deg,#4f46e5,#4338ca);

  --success:#059669; --success-tint:#e7f6ef;
  --danger:#dc2626; --danger-tint:#fdeceb;
  --warning:#d97706; --warning-tint:#fdf3e3;
  --info:#0891b2; --info-tint:#e6f6fa;
  --pink:#db2777; --pink-tint:#fdeaf3;
  --slate:#475569; --slate-tint:#eef1f5;
  --violet:#7c3aed; --violet-tint:#f2ecfe;

  --radius-sm:8px;
  --radius:12px;
  --radius-lg:18px;

  --shadow-sm:0 1px 2px rgba(16,21,43,0.06);
  --shadow:0 8px 20px rgba(16,21,43,0.08);
  --shadow-lg:0 20px 40px rgba(16,21,43,0.16);

  --sidebar-w:260px;
  --topbar-h:68px;

  --font-heading:"Space Grotesk", "Manrope", -apple-system, sans-serif;
  --font-body:"Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font-body);
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,
.stat-value,.module-value,.donut-center-value,.progress-ring-value,
.total-amount,.brand-text strong,.auth-logo,.data-table td.num-strong{
  font-family:var(--font-heading);
  letter-spacing:-0.01em;
  font-weight:700;
  margin:0;
}
p{ margin:0; }
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; }
input,select,textarea{ font-family:inherit; font-size:14px; color:var(--text); }
ul{ list-style:none; margin:0; padding:0; }
::-webkit-scrollbar{ width:9px; height:9px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:var(--border-strong); border-radius:20px; }

/* ---------------- Dot-grid decoration ---------------- */
.dot-grid{
  background-image:radial-gradient(rgba(255,255,255,0.35) 1.4px, transparent 1.4px);
  background-size:16px 16px;
}
.dot-grid-dark{
  background-image:radial-gradient(rgba(79,70,229,0.16) 1.4px, transparent 1.4px);
  background-size:16px 16px;
}

/* ============================================================
   App shell
   ============================================================ */
.app-shell{ display:flex; min-height:100vh; }

.sidebar-backdrop{
  display:none; position:fixed; inset:0; background:rgba(9,12,26,0.55);
  z-index:40; opacity:0; pointer-events:none; transition:opacity .2s ease;
}
.sidebar-backdrop.show{ display:block; opacity:1; pointer-events:auto; }

.sidebar{
  position:fixed; top:0; left:0; bottom:0; width:var(--sidebar-w);
  background:var(--sidebar-bg);
  display:flex; flex-direction:column;
  z-index:50; transition:transform .22s ease;
  border-right:1px solid var(--sidebar-border);
}
.sidebar-brand{
  display:flex; align-items:center; gap:11px;
  padding:22px 20px 18px; border-bottom:1px solid var(--sidebar-border);
}
.brand-mark{
  width:38px; height:38px; border-radius:var(--radius-sm);
  background:var(--gradient-brand); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-heading); font-weight:700; font-size:15px;
  flex:none;
}
.brand-text{ line-height:1.25; }
.brand-text strong{ display:block; color:#fff; font-size:16px; }
.brand-text span{ display:block; color:var(--sidebar-text-dim); font-size:11.5px; }

.sidebar-nav{ flex:1; overflow-y:auto; padding:14px 12px; }
.nav-section-label{
  font-size:10.5px; text-transform:uppercase; letter-spacing:.08em;
  color:var(--sidebar-text-dim); font-weight:700; padding:14px 10px 6px;
}
.nav-section-label:first-child{ padding-top:4px; }
.nav-item{
  display:flex; align-items:center; gap:11px; padding:9px 10px;
  border-radius:var(--radius-sm); color:var(--sidebar-text);
  font-size:13.5px; font-weight:600; margin-bottom:2px; cursor:pointer;
  border:none; background:transparent; width:100%; text-align:left;
  transition:background .12s ease, color .12s ease;
}
.nav-item svg{ width:17px; height:17px; flex:none; }
.nav-item:hover{ background:var(--sidebar-bg-2); color:#fff; }
.nav-item.active{ background:var(--sidebar-active); color:#fff; box-shadow:0 6px 14px rgba(79,70,229,.35); }
.nav-item .nav-badge{
  margin-left:auto; background:var(--danger); color:#fff; font-size:10.5px;
  font-weight:700; border-radius:20px; padding:1px 7px;
}
.logout-item{ margin-top:6px; color:#f0a5a5 !important; }
.logout-item:hover{ background:rgba(220,38,38,.14) !important; color:#fca5a5 !important; }

.sidebar-footer{
  padding:14px 16px; border-top:1px solid var(--sidebar-border);
  display:flex; align-items:center; gap:10px;
}
.avatar{
  width:34px; height:34px; border-radius:var(--radius-sm); flex:none;
  background:var(--gradient-brand); color:#fff; display:flex; align-items:center;
  justify-content:center; font-weight:700; font-size:13px; font-family:var(--font-heading);
}
.sidebar-footer .who{ line-height:1.3; overflow:hidden; }
.sidebar-footer .who strong{ display:block; color:#fff; font-size:12.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-footer .who span{ display:block; color:var(--sidebar-text-dim); font-size:11px; }

.main{ flex:1; margin-left:var(--sidebar-w); min-width:0; display:flex; flex-direction:column; }

.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 26px;
  position:sticky; top:0; z-index:30;
}
.topbar-left{ display:flex; align-items:center; gap:14px; min-width:0; }
.menu-toggle{
  display:none; width:36px; height:36px; border-radius:var(--radius-sm); border:1px solid var(--border);
  background:var(--surface); align-items:center; justify-content:center; cursor:pointer; flex:none;
}
.menu-toggle svg{ width:18px; height:18px; }
.page-title-block h1{ font-size:18px; }
.page-title-block p{ font-size:12.5px; color:var(--muted); margin-top:1px; }
.topbar-right{ display:flex; align-items:center; gap:14px; flex:none; }
.topbar-user{ display:flex; align-items:center; gap:9px; }
.topbar-user .who{ text-align:right; line-height:1.25; }
.topbar-user .who strong{ display:block; font-size:12.5px; }
.topbar-user .who span{ display:block; font-size:11px; color:var(--muted); }
.icon-btn{
  width:36px; height:36px; border-radius:var(--radius-sm); border:1px solid var(--border);
  background:var(--surface); display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.icon-btn svg{ width:17px; height:17px; color:var(--muted); }
.icon-btn:hover{ background:var(--surface-2); }

.content{ padding:26px 30px 60px; flex:1; }

/* ============================================================
   Page header row
   ============================================================ */
.page-header-row{
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px;
  margin-bottom:22px; flex-wrap:wrap;
}
.page-header-row h2{ font-size:21px; }
.page-header-row .desc{ color:var(--muted); font-size:13px; margin-top:4px; }
.page-header-actions{ display:flex; gap:10px; flex-wrap:wrap; }

/* ============================================================
   Buttons
   ============================================================ */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  padding:10px 18px; border-radius:var(--radius-sm); font-size:13.5px; font-weight:700;
  border:1px solid transparent; cursor:pointer; white-space:nowrap;
  transition:filter .15s ease, transform .05s ease, background .15s ease, box-shadow .15s ease;
}
.btn svg{ width:15px; height:15px; }
.btn-primary{ background:var(--gradient-brand); color:#fff; box-shadow:0 8px 18px rgba(79,70,229,.28); }
.btn-primary:hover{ filter:brightness(1.07); }
.btn-primary:active{ transform:scale(.98); }
.btn-outline{ background:var(--surface); border-color:var(--border-strong); color:var(--text); }
.btn-outline:hover{ background:var(--surface-2); }
.btn-danger-outline{ background:var(--danger-tint); border-color:transparent; color:var(--danger); }
.btn-danger-outline:hover{ filter:brightness(0.97); }
.btn-success{ background:var(--success); color:#fff; }
.btn-sm{ padding:7px 13px; font-size:12.5px; }
.btn-lg{ padding:12px 24px; font-size:14.5px; }
.btn-block{ width:100%; }
.btn:disabled,.perm-disabled{ opacity:.5; cursor:not-allowed; }
[data-require].hidden-by-role{ display:none !important; }

/* ============================================================
   Hero banner
   ============================================================ */
.hero-banner{
  border-radius:var(--radius-lg); padding:30px 32px; background:var(--gradient-brand);
  color:#fff; position:relative; overflow:hidden; box-shadow:var(--shadow-lg); margin-bottom:22px;
}
.hero-banner::before{
  content:""; position:absolute; top:0; right:0; width:280px; height:100%;
  background-image:radial-gradient(rgba(255,255,255,0.28) 1.6px, transparent 1.6px);
  background-size:18px 18px; -webkit-mask-image:linear-gradient(to left, black, transparent);
  mask-image:linear-gradient(to left, black, transparent);
}
.hero-banner h2{ font-size:23px; position:relative; }
.hero-banner p{ margin-top:6px; opacity:.88; font-size:13.5px; max-width:520px; position:relative; }
.hero-meta{ display:flex; gap:26px; margin-top:18px; position:relative; flex-wrap:wrap; }
.hero-meta div strong{ display:block; font-size:20px; font-family:var(--font-heading); }
.hero-meta div span{ font-size:11.5px; opacity:.8; }

/* ============================================================
   Module strip
   ============================================================ */
.module-strip{ display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:22px; }
.module-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px; display:flex; flex-direction:column; gap:10px; position:relative; overflow:hidden;
  box-shadow:var(--shadow-sm); transition:transform .15s ease, box-shadow .15s ease;
}
.module-card:hover{ transform:translateY(-3px); box-shadow:var(--shadow); }
.module-card::after{
  content:""; position:absolute; top:-18px; right:-18px; width:70px; height:70px; border-radius:var(--radius);
  background-image:radial-gradient(rgba(0,0,0,0.05) 1.4px, transparent 1.4px); background-size:10px 10px;
  transform:rotate(18deg);
}
.module-icon{
  width:38px; height:38px; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:center;
  color:#fff; flex:none;
}
.module-icon svg{ width:19px; height:19px; }
.module-card.c1 .module-icon{ background:linear-gradient(135deg,#4f46e5,#4338ca); }
.module-card.c2 .module-icon{ background:linear-gradient(135deg,#06b6d4,#0891b2); }
.module-card.c3 .module-icon{ background:linear-gradient(135deg,#059669,#047857); }
.module-card.c4 .module-icon{ background:linear-gradient(135deg,#db2777,#be185d); }
.module-card.c5 .module-icon{ background:linear-gradient(135deg,#d97706,#b45309); }
.module-label{ font-size:12px; color:var(--muted); font-weight:600; }
.module-value{ font-size:22px; }
.module-sub{ font-size:11.5px; color:var(--muted-2); }
.module-arrow{ position:absolute; top:16px; right:16px; color:var(--muted-2); transition:transform .15s ease; }
.module-arrow svg{ width:15px; height:15px; }
.module-card:hover .module-arrow{ transform:translateX(3px); color:var(--primary); }

/* ============================================================
   Stat grid
   ============================================================ */
.stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:22px; }
.stat-grid-tight{ margin-bottom:18px; }
.stat-card{
  background:var(--surface); border:1px solid var(--border); border-left:4px solid var(--primary);
  border-radius:var(--radius); padding:16px 17px; display:flex; align-items:center; gap:13px;
  box-shadow:var(--shadow-sm); transition:transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow); }
.stat-icon{
  width:38px; height:38px; border-radius:var(--radius-sm); flex:none;
  display:flex; align-items:center; justify-content:center;
}
.stat-icon svg{ width:19px; height:19px; }
.icon-indigo{ background:var(--primary-tint); color:var(--primary); }
.icon-cyan{ background:var(--info-tint); color:var(--info); }
.icon-green{ background:var(--success-tint); color:var(--success); }
.icon-amber{ background:var(--warning-tint); color:var(--warning); }
.icon-red{ background:var(--danger-tint); color:var(--danger); }
.icon-pink{ background:var(--pink-tint); color:var(--pink); }
.icon-slate{ background:var(--slate-tint); color:var(--slate); }
.icon-violet{ background:var(--violet-tint); color:var(--violet); }
.stat-card.accent-cyan{ border-left-color:var(--info); }
.stat-card.accent-green{ border-left-color:var(--success); }
.stat-card.accent-amber{ border-left-color:var(--warning); }
.stat-card.accent-red{ border-left-color:var(--danger); }
.stat-card.accent-pink{ border-left-color:var(--pink); }
.stat-card.accent-slate{ border-left-color:var(--slate); }
.stat-card.accent-violet{ border-left-color:var(--violet); }
.stat-value{ font-size:21px; line-height:1.1; }
.stat-label{ font-size:11.5px; color:var(--muted); margin-top:2px; font-weight:600; }
.stat-trend{ margin-left:auto; font-size:11px; font-weight:700; padding:3px 8px; border-radius:20px; }
.stat-trend.up{ background:var(--success-tint); color:var(--success); }
.stat-trend.down{ background:var(--danger-tint); color:var(--danger); }
.stat-trend.soon{ background:var(--warning-tint); color:var(--warning); }

/* ============================================================
   Panels
   ============================================================ */
.panel-grid{ display:grid; grid-template-columns:1.5fr 1fr; gap:16px; margin-bottom:16px; }
.panel-grid.even{ grid-template-columns:1fr 1fr; }
.charts-grid{ grid-template-columns:1fr 1fr; }
.panel{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px; box-shadow:var(--shadow-sm);
}
.panel.full-panel{ margin-bottom:16px; }
.panel-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:10px; }
.panel-header h3{ font-size:14.5px; }
.panel-header a{ font-size:12.5px; color:var(--primary); font-weight:700; }
.panel-tag{
  background:var(--surface-3); color:var(--text); font-size:11px; font-weight:700;
  border-radius:20px; padding:2px 9px;
}

.activity-list{ display:flex; flex-direction:column; gap:2px; max-height:380px; overflow-y:auto; }
.activity-item{ display:flex; gap:11px; padding:10px 4px; border-bottom:1px solid var(--border); }
.activity-item:last-child{ border-bottom:none; }
.activity-dot{ width:8px; height:8px; border-radius:2px; background:var(--primary); margin-top:5px; flex:none; }
.activity-item p{ font-size:13px; }
.activity-item span{ font-size:11.5px; color:var(--muted); }

/* ============================================================
   Tables
   ============================================================ */
.table-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow-sm); overflow:hidden;
}
.table-toolbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:14px 18px; border-bottom:1px solid var(--border); flex-wrap:wrap;
}
.search-box{
  display:flex; align-items:center; gap:8px; background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:8px 12px; min-width:220px;
}
.search-box svg{ width:15px; height:15px; color:var(--muted-2); flex:none; }
.search-box input{ border:none; background:transparent; outline:none; flex:1; font-size:13px; }
.toolbar-meta{ font-size:12px; color:var(--muted); font-weight:600; }
.toolbar-filters{ display:flex; gap:8px; flex-wrap:wrap; }
.select-filter{
  padding:8px 10px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface);
  font-size:12.5px; color:var(--text); font-weight:600;
}
.table-scroll{ overflow-x:auto; }
.data-table{ width:100%; border-collapse:collapse; min-width:640px; }
.data-table th{
  text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted);
  padding:11px 16px; border-bottom:1px solid var(--border); background:var(--surface-2); white-space:nowrap;
}
.data-table td{ padding:12px 16px; border-bottom:1px solid var(--border); font-size:13px; vertical-align:middle; }
.data-table tbody tr:hover{ background:var(--surface-2); }
.data-table tbody tr:last-child td{ border-bottom:none; }
.data-table td.num{ text-align:right; }
.data-table td.num-strong{ text-align:right; font-size:13.5px; }

.cell-user{ display:flex; align-items:center; gap:10px; }
.cell-avatar{
  width:30px; height:30px; border-radius:var(--radius-sm); background:var(--gradient-brand); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; flex:none;
  font-family:var(--font-heading);
}
.cell-user strong{ display:block; font-size:13px; }
.cell-user span{ display:block; font-size:11.5px; color:var(--muted); }
.cell-mono{ font-family:"Space Grotesk",monospace; font-size:12.5px; color:var(--muted); }
.desc-cell{ max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.total-amount{ font-size:14px; }

.table-pagination{ display:flex; align-items:center; justify-content:space-between; padding:12px 18px; border-top:1px solid var(--border); }
.pg-btns{ display:flex; gap:6px; }
.pg-btn{
  width:30px; height:30px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface);
  cursor:pointer; font-size:12.5px; font-weight:700;
}
.pg-btn.active{ background:var(--gradient-brand); color:#fff; border-color:transparent; }
.pg-btn:disabled{ opacity:.4; cursor:not-allowed; }

/* ============================================================
   Badges / chips / status pills
   ============================================================ */
.badge{ display:inline-flex; align-items:center; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:700; }
.badge-success{ background:var(--success-tint); color:var(--success); }
.badge-danger{ background:var(--danger-tint); color:var(--danger); }
.badge-warning{ background:var(--warning-tint); color:var(--warning); }
.badge-info{ background:var(--info-tint); color:var(--info); }

.chip{ display:inline-flex; align-items:center; padding:3px 10px; border-radius:6px; font-size:11.5px; font-weight:700; }
.chip-indigo{ background:var(--primary-tint); color:var(--primary); }
.chip-cyan{ background:var(--info-tint); color:var(--info); }
.chip-green{ background:var(--success-tint); color:var(--success); }
.chip-amber{ background:var(--warning-tint); color:var(--warning); }
.chip-pink{ background:var(--pink-tint); color:var(--pink); }
.chip-slate{ background:var(--slate-tint); color:var(--slate); }
.chip-red{ background:var(--danger-tint); color:var(--danger); }
.chip-violet{ background:var(--violet-tint); color:var(--violet); }

.status-pill{ display:inline-flex; align-items:center; gap:6px; padding:4px 10px 4px 8px; border-radius:20px; font-size:11.5px; font-weight:700; }
.status-pill::before{ content:""; width:7px; height:7px; border-radius:2px; }
.status-pill.active,.status-pill.paid,.status-pill.approved,.status-pill.present,.status-pill.occupied,.status-pill.valid,.status-pill.resolved,.status-pill.confirmed{
  background:var(--success-tint); color:var(--success);
}
.status-pill.active::before,.status-pill.paid::before,.status-pill.approved::before,.status-pill.present::before,.status-pill.occupied::before,.status-pill.valid::before,.status-pill.resolved::before,.status-pill.confirmed::before{ background:var(--success); }
.status-pill.inactive,.status-pill.rejected,.status-pill.absent,.status-pill.expired,.status-pill.left{
  background:var(--danger-tint); color:var(--danger);
}
.status-pill.inactive::before,.status-pill.rejected::before,.status-pill.absent::before,.status-pill.expired::before,.status-pill.left::before{ background:var(--danger); }
.status-pill.pending,.status-pill.partial,.status-pill.expiring,.status-pill.open,.status-pill.out{
  background:var(--warning-tint); color:var(--warning);
}
.status-pill.pending::before,.status-pill.partial::before,.status-pill.expiring::before,.status-pill.open::before,.status-pill.out::before{ background:var(--warning); }
.status-pill.vacant,.status-pill.returned,.status-pill.in{ background:var(--info-tint); color:var(--info); }
.status-pill.vacant::before,.status-pill.returned::before,.status-pill.in::before{ background:var(--info); }

/* ============================================================
   Row actions / kebab menu
   ============================================================ */
.row-actions{ position:relative; text-align:right; }
.action-trigger{
  width:30px; height:30px; border-radius:var(--radius-sm); border:1px solid transparent; background:transparent;
  cursor:pointer; display:inline-flex; align-items:center; justify-content:center; color:var(--muted);
}
.action-trigger:hover{ background:var(--surface-2); border-color:var(--border); }
.action-trigger svg{ width:16px; height:16px; }
.action-menu{
  position:fixed; min-width:150px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); box-shadow:var(--shadow-lg); padding:6px; z-index:80; display:none;
}
.action-menu.show{ display:block; }
.action-menu button{
  width:100%; text-align:left; background:none; border:none; padding:8px 10px; border-radius:6px;
  font-size:12.5px; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:8px; color:var(--text);
}
.action-menu button:hover{ background:var(--surface-2); }
.action-menu button svg{ width:14px; height:14px; }
.action-menu button.danger{ color:var(--danger); }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay{
  position:fixed; inset:0; background:rgba(9,12,26,0.55); display:none; align-items:center; justify-content:center;
  z-index:90; padding:20px;
}
.modal-overlay.show{ display:flex; }
.modal-box{
  background:var(--surface); border-radius:var(--radius-lg); width:100%; max-width:520px;
  max-height:88vh; display:flex; flex-direction:column; box-shadow:var(--shadow-lg);
}
.modal-box.wide{ max-width:720px; }
.modal-header{
  display:flex; align-items:center; justify-content:space-between; padding:18px 22px;
  border-bottom:1px solid var(--border);
}
.modal-header h3{ font-size:16px; }
.modal-close{ width:30px; height:30px; border-radius:var(--radius-sm); border:none; background:var(--surface-2); cursor:pointer; font-size:16px; color:var(--muted); }
.modal-body{ padding:20px 22px; overflow-y:auto; }
.modal-footer{ display:flex; justify-content:flex-end; gap:10px; padding:16px 22px; border-top:1px solid var(--border); }

/* ============================================================
   Forms
   ============================================================ */
.field-grid{ display:grid; grid-template-columns:1fr 1fr; gap:14px 16px; }
.field-grid.cols-3{ grid-template-columns:1fr 1fr 1fr; }
.field-grid.cols-1{ grid-template-columns:1fr; }
.field{ display:flex; flex-direction:column; gap:6px; }
.field.span-2{ grid-column:span 2; }
.field label{ font-size:12px; font-weight:700; color:var(--text); }
.field .hint{ font-size:11px; color:var(--muted-2); }
.field input,.field select,.field textarea{
  padding:10px 12px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface-2);
  outline:none; transition:border-color .12s ease, background .12s ease;
}
.field input:focus,.field select:focus,.field textarea:focus{ border-color:var(--primary); background:var(--surface); }
.field textarea{ resize:vertical; min-height:70px; }
.form-group{ margin-bottom:16px; }
.form-group label{ display:block; font-size:12.5px; font-weight:700; margin-bottom:7px; }
.input-wrapper{ position:relative; }
.leading-icon{ position:absolute; left:13px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--muted-2); }
.input-wrapper input,.input-wrapper select{ width:100%; padding:11px 12px 11px 38px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface-2); outline:none; }
.input-wrapper input:focus,.input-wrapper select:focus{ border-color:var(--primary); background:var(--surface); }

.status-toggle-group{ display:flex; border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; }
.status-toggle-group label{ flex:1; text-align:center; padding:9px 0; font-size:12.5px; font-weight:700; cursor:pointer; color:var(--muted); position:relative; }
.status-toggle-group input{ position:absolute; opacity:0; }
.status-toggle-group label:has(input:checked){ background:var(--gradient-brand); color:#fff; }
.status-toggle-group label + label{ border-left:1px solid var(--border); }

/* ============================================================
   Tabs (in-page sub-nav)
   ============================================================ */
.page-tabs{ display:flex; gap:6px; margin-bottom:20px; flex-wrap:wrap; background:var(--surface-2); padding:5px; border-radius:var(--radius-sm); width:fit-content; }
.page-tab{ padding:8px 16px; border-radius:7px; font-size:12.5px; font-weight:700; color:var(--muted); }
.page-tab.active{ background:var(--surface); color:var(--primary); box-shadow:var(--shadow-sm); }

/* ============================================================
   Detail page
   ============================================================ */
.detail-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.detail-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow-sm); }
.detail-card-header{ padding:14px 18px; border-bottom:1px solid var(--border); font-size:13.5px; font-weight:700; }
.detail-rows{ display:flex; flex-direction:column; }
.detail-row{ display:flex; justify-content:space-between; gap:12px; padding:11px 18px; font-size:13px; }
.detail-row:nth-child(odd){ background:var(--surface-2); }
.detail-row span{ color:var(--muted); }
.detail-row strong{ text-align:right; }

.profile-header{ display:flex; align-items:center; gap:16px; margin-bottom:20px; flex-wrap:wrap; }
.profile-avatar{
  width:64px; height:64px; border-radius:var(--radius); background:var(--gradient-brand); color:#fff;
  display:flex; align-items:center; justify-content:center; font-family:var(--font-heading); font-weight:700; font-size:22px; flex:none;
}

/* ============================================================
   Empty states
   ============================================================ */
.empty-state{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:50px 20px; color:var(--muted); text-align:center; }
.empty-state svg{ width:40px; height:40px; color:var(--muted-2); }
.empty-state.compact{ padding:26px 12px; }
.empty-state p{ font-size:13px; }

/* ============================================================
   Toast
   ============================================================ */
.toast-notice{
  position:fixed; bottom:26px; left:50%; transform:translateX(-50%) translateY(20px); z-index:999;
  background:var(--text); color:#fff; padding:12px 20px; border-radius:var(--radius-sm); font-size:13px; font-weight:600;
  display:flex; align-items:center; gap:9px; opacity:0; pointer-events:none; transition:all .2s ease; box-shadow:var(--shadow-lg);
}
.toast-notice svg{ width:16px; height:16px; flex:none; }
.toast-notice.show{ opacity:1; transform:translateX(-50%) translateY(0); }
.toast-notice.error{ background:var(--danger); }
.toast-notice.error svg{ color:#fff; }
.toast-notice:not(.error) svg{ color:#34d399; }

/* ============================================================
   Auth (login) page
   ============================================================ */
.auth-body{ background:var(--sidebar-bg); min-height:100vh; display:flex; align-items:center; justify-content:center; position:relative; overflow:hidden; padding:20px; }
.auth-stripe{
  position:absolute; inset:-20% -10%; opacity:.5;
  background-image:repeating-linear-gradient(115deg, rgba(79,70,229,0.18) 0 2px, transparent 2px 46px);
}
.auth-glow{ position:absolute; width:520px; height:520px; border-radius:50%; filter:blur(120px); opacity:.35; pointer-events:none; }
.auth-glow.g1{ background:#4f46e5; top:-140px; left:-120px; }
.auth-glow.g2{ background:#06b6d4; bottom:-160px; right:-100px; }
.auth-wrap{ position:relative; z-index:2; width:100%; max-width:420px; }
.auth-card{
  background:var(--surface); border-radius:var(--radius-lg); padding:38px 34px; box-shadow:var(--shadow-lg);
  text-align:center;
}
.auth-logo{
  width:54px; height:54px; margin:0 auto 16px; border-radius:var(--radius); background:var(--gradient-brand);
  color:#fff; display:flex; align-items:center; justify-content:center; font-size:20px;
}
.auth-card h1{ font-size:22px; }
.auth-card .subtitle{ color:var(--muted); font-size:13px; margin-top:6px; margin-bottom:22px; }
.auth-card form{ text-align:left; }
.submit-btn{ margin-top:6px; }
.demo-hint{ margin-top:20px; font-size:11.5px; color:var(--muted); text-align:left; line-height:1.6; background:var(--surface-2); padding:12px 14px; border-radius:var(--radius-sm); }
.form-alert{
  display:none; align-items:flex-start; gap:9px; background:var(--warning-tint); color:var(--warning);
  padding:11px 13px; border-radius:var(--radius-sm); font-size:12px; margin-bottom:16px; text-align:left;
}
.form-alert.show{ display:flex; }
.form-alert svg{ width:16px; height:16px; flex:none; margin-top:1px; }

/* ============================================================
   Access-restricted overlay
   ============================================================ */
.perm-restricted-overlay{
  position:fixed; inset:0; background:rgba(9,12,26,0.6); z-index:200; display:flex; align-items:center; justify-content:center; padding:20px;
}
.perm-restricted-card{ background:var(--surface); border-radius:var(--radius-lg); padding:36px 32px; max-width:380px; text-align:center; box-shadow:var(--shadow-lg); }
.perm-restricted-card .icon{
  width:56px; height:56px; border-radius:var(--radius); background:var(--danger-tint); color:var(--danger);
  display:flex; align-items:center; justify-content:center; margin:0 auto 16px;
}
.perm-restricted-card .icon svg{ width:26px; height:26px; }
.perm-restricted-card h3{ font-size:17px; margin-bottom:8px; }
.perm-restricted-card p{ font-size:13px; color:var(--muted); margin-bottom:20px; }
.perm-restricted-card .btn-row{ display:flex; gap:10px; justify-content:center; }

/* ============================================================
   Charts (custom SVG)
   ============================================================ */
.chart-bar-wrap{ display:flex; align-items:flex-end; gap:14px; height:200px; padding:10px 6px 0; }
.bar-col{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:6px; min-width:0; }
.bar-col .bar-value{ font-size:11px; font-weight:700; color:var(--text); white-space:nowrap; }
.bar-col .bar-fill{ width:100%; max-width:34px; border-radius:6px 6px 0 0; background:var(--gradient-brand); transition:height .3s ease; }
.bar-col .bar-label{ font-size:10.5px; color:var(--muted); text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:60px; }

.donut-wrap{ display:flex; align-items:center; gap:20px; flex-wrap:wrap; justify-content:center; }
.donut-center-value{ font-size:20px; }
.donut-center-label{ font-size:10.5px; color:var(--muted); font-weight:600; }
.donut-legend{ display:flex; flex-direction:column; gap:8px; flex:1; min-width:150px; }
.donut-legend-row{ display:flex; align-items:center; gap:8px; font-size:12px; }
.donut-legend-dot{ width:9px; height:9px; border-radius:3px; flex:none; }
.donut-legend-row strong{ margin-left:auto; font-size:12px; }

.progress-ring-value{ font-size:16px; }
.progress-bar-track{ height:8px; border-radius:20px; background:var(--surface-3); overflow:hidden; }
.progress-bar-fill{ height:100%; border-radius:20px; transition:width .3s ease; }
.progress-bar-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; font-size:12px; font-weight:600; }
.progress-bar-meta{ font-size:11px; color:var(--muted); margin-top:5px; }
.progress-mini{ display:flex; align-items:center; gap:8px; }
.progress-mini .progress-bar-track{ flex:1; height:6px; }
.progress-mini span{ font-size:11px; font-weight:700; width:32px; text-align:right; }

/* ============================================================
   Permission matrix (roles page)
   ============================================================ */
.role-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; margin-bottom:12px; box-shadow:var(--shadow-sm); }
.role-card-top{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.role-card-top h4{ font-size:14.5px; }
.role-card p.role-desc{ font-size:12.5px; color:var(--muted); margin-top:4px; }
.role-card-tags{ display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.role-card-actions{ display:flex; gap:8px; }

.perm-table{ display:flex; flex-direction:column; border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; }
.perm-head-row,.perm-row{ display:grid; grid-template-columns:1.6fr repeat(4,0.8fr); align-items:center; }
.perm-head-row{ background:var(--surface-2); padding:9px 14px; font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); font-weight:700; }
.perm-row{ padding:10px 14px; border-top:1px solid var(--border); font-size:12.5px; font-weight:600; }
.perm-head-row span:not(:first-child),.perm-row span:not(:first-child){ text-align:center; }
.perm-switch{ position:relative; width:36px; height:20px; display:inline-block; margin:0 auto; }
.perm-switch input{ opacity:0; width:0; height:0; }
.perm-switch .slider{ position:absolute; inset:0; background:var(--border-strong); border-radius:20px; cursor:pointer; transition:background .15s ease; }
.perm-switch .slider::before{ content:""; position:absolute; width:14px; height:14px; left:3px; top:3px; background:#fff; border-radius:50%; transition:transform .15s ease; }
.perm-switch input:checked + .slider{ background:var(--primary); }
.perm-switch input:checked + .slider::before{ transform:translateX(16px); }

/* ============================================================
   Combobox
   ============================================================ */
.combo-wrap{ position:relative; }
.combo-panel{
  position:absolute; top:calc(100% + 6px); left:0; right:0; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); box-shadow:var(--shadow-lg); max-height:220px; overflow-y:auto; z-index:60; display:none;
}
.combo-panel.show{ display:block; }
.combo-option{ padding:9px 12px; font-size:12.5px; cursor:pointer; display:flex; align-items:center; gap:9px; }
.combo-option:hover,.combo-option.active{ background:var(--surface-2); }
.combo-option .cell-avatar{ width:24px; height:24px; font-size:10px; }

/* ============================================================
   Room grid (rooms.html)
   ============================================================ */
.room-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:14px; }
.room-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:15px; box-shadow:var(--shadow-sm); border-top:4px solid var(--success); }
.room-card.is-occupied{ border-top-color:var(--danger); }
.room-card.is-partial{ border-top-color:var(--warning); }
.room-card-top{ display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:10px; }
.room-card-top strong{ font-size:17px; font-family:var(--font-heading); }
.room-card .meta{ font-size:11.5px; color:var(--muted); margin-bottom:10px; }
.room-occ-bar{ display:flex; gap:3px; margin-bottom:8px; }
.room-occ-bar span{ flex:1; height:6px; border-radius:3px; background:var(--surface-3); }
.room-occ-bar span.filled{ background:var(--gradient-brand); }

/* ============================================================
   Menu grid (canteen-menu.html)
   ============================================================ */
.menu-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:10px; }
.menu-day-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:13px; box-shadow:var(--shadow-sm); }
.menu-day-card h4{ font-size:12.5px; text-transform:uppercase; letter-spacing:.03em; color:var(--primary); margin-bottom:10px; }
.menu-meal{ margin-bottom:10px; }
.menu-meal:last-child{ margin-bottom:0; }
.menu-meal span.meal-label{ font-size:10px; text-transform:uppercase; color:var(--muted-2); font-weight:700; }
.menu-meal p{ font-size:12px; margin-top:2px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width:1200px){
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
  .module-strip{ grid-template-columns:repeat(3,1fr); }
  .menu-grid{ grid-template-columns:repeat(4,1fr); }
}
@media (max-width:1100px){
  .panel-grid,.charts-grid,.detail-grid{ grid-template-columns:1fr; }
}
@media (max-width:900px){
  .sidebar{ transform:translateX(-100%); }
  .sidebar.open{ transform:translateX(0); box-shadow:var(--shadow-lg); }
  .main{ margin-left:0; }
  .menu-toggle{ display:flex; }
  .module-strip{ grid-template-columns:repeat(2,1fr); }
  .content{ padding:20px 16px 48px; }
  .topbar{ padding:0 16px; }
}
@media (max-width:760px){
  .stat-grid{ grid-template-columns:1fr 1fr; }
  .field-grid,.field-grid.cols-3{ grid-template-columns:1fr; }
  .field.span-2{ grid-column:span 1; }
  .topbar-user .who{ display:none; }
  .menu-grid{ grid-template-columns:repeat(2,1fr); }
  .hero-meta{ gap:16px; }
}
@media (max-width:600px){
  .stat-grid,.module-strip{ grid-template-columns:1fr; }
  .modal-box{ max-width:100%; }
  .page-header-row{ flex-direction:column; align-items:stretch; }
  .page-header-actions{ justify-content:flex-start; }
  .room-grid{ grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); }
}
@media (max-width:480px){
  .auth-card{ padding:28px 22px; }
  .search-box{ min-width:0; width:100%; }
  .table-toolbar{ flex-direction:column; align-items:stretch; }
  .menu-grid{ grid-template-columns:1fr 1fr; }
}
