/* ============================================================
   TRV RESTAURANT — OS MONITORING HUB (PHP)
   Theme: "Bento Box" — Dark mode, electric blue + magenta neon
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-base: #0a0a12;
  --bg-surface: #14141f;
  --bg-surface-2: #1b1b2c;
  --border-light: #26263a;
  --border-med: #34344f;

  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --primary-soft: rgba(59,130,246,.14);
  --primary-glow: rgba(59,130,246,.35);

  --gold: #ec4899;
  --gold-dark: #db2777;
  --gold-light: #f9a8d4;
  --gold-soft: rgba(236,72,153,.14);

  --accent-teal: #2dd4bf;
  --accent-rose: #f43f5e;
  --accent-green: #22c55e;

  --text-primary: #f4f4f9;
  --text-secondary: #a6a6c2;
  --text-muted: #6c6c88;

  --gray-100: #1c1c2c;
  --gray-200: #26263a;

  --shadow-sm: 0 2px 10px rgba(0,0,0,.35);
  --shadow-md: 0 10px 28px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55), 0 0 50px rgba(59,130,246,.08);
  --glow-blue: 0 0 0 1px var(--primary), 0 8px 30px rgba(59,130,246,.35);
  --glow-pink: 0 0 0 1px var(--gold), 0 8px 30px rgba(236,72,153,.3);

  --tint-blue: rgba(59,130,246,.14);
  --tint-pink: rgba(236,72,153,.10);
  --hero-grad: linear-gradient(120deg, #0f1730, #171025 55%, #200f28);
  --table-head-bg: #171726;
  --table-head-fg: var(--primary-light);

  --r-sm: 8px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg-base: #f7f4fd;
  --bg-surface: #ffffff;
  --bg-surface-2: #faf8ff;
  --border-light: #ece5fb;
  --border-med: #ddd0f7;

  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-light: #a78bfa;
  --primary-soft: #f3ecff;
  --primary-glow: rgba(124, 58, 237, .16);

  --gold: #c9971f;
  --gold-dark: #a5790e;
  --gold-light: #b8860f;
  --gold-soft: #fdf6e3;

  --accent-teal: #0d9488;
  --accent-rose: #be123c;
  --accent-green: #059669;

  --text-primary: #241b3d;
  --text-secondary: #675e82;
  --text-muted: #9b91b8;

  --gray-100: #f4f1fb;
  --gray-200: #ece5fb;

  --shadow-sm: 0 2px 8px rgba(90,40,180,.06), 0 1px 2px rgba(90,40,180,.04);
  --shadow-md: 0 8px 22px rgba(90,40,180,.09), 0 1px 3px rgba(90,40,180,.05);
  --shadow-lg: 0 18px 42px rgba(90,40,180,.13), 0 4px 10px rgba(90,40,180,.05);
  --glow-blue: 0 0 0 1px var(--primary), 0 8px 24px rgba(124,58,237,.18);
  --glow-pink: 0 0 0 1px var(--gold), 0 8px 24px rgba(201,151,31,.18);

  --tint-blue: rgba(124,58,237,.08);
  --tint-pink: rgba(201,151,31,.08);
  --hero-grad: linear-gradient(120deg, var(--primary-dark), var(--primary) 55%, var(--gold-dark));
  --table-head-bg: var(--primary-soft);
  --table-head-fg: var(--primary-dark);
}

body {
  background:
    radial-gradient(circle at 12% -10%, var(--tint-blue), transparent 42%),
    radial-gradient(circle at 88% 0%, var(--tint-pink), transparent 40%),
    var(--bg-base);
  font-family: var(--font);
  color: var(--text-primary);
  height: 100vh; overflow: hidden;
  font-size: .875rem; font-weight: 500;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ============================================================ SHELL */
.shell { display: flex; flex-direction: column; height: 100vh; width: 100%; }

/* Top navigation bar (module tabs) */
.topnav {
  display: flex; align-items: center; gap: 16px; padding: 8px 22px;
  background: rgba(20,20,31,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0; z-index: 20;
}

.sb-brand {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding-right: 16px; margin-right: 2px; border-right: 1px solid var(--border-light);
}
.sb-logo {
  width: 44px; height: 44px; border-radius: 11px; object-fit: contain;
  box-shadow: 0 0 0 1px var(--border-med), 0 4px 14px rgba(59,130,246,.2);
  flex-shrink: 0; background: #fff; padding: 3px;
}
.sb-brand-name { font-weight: 800; font-size: .84rem; color: var(--text-primary); letter-spacing: -.1px; line-height: 1.25; }
.sb-brand-sub {
  font-size: .6rem; font-weight: 700; letter-spacing: .3px;
  background: linear-gradient(90deg, var(--primary-light), var(--gold-light));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.sb-section { display: none; } /* section labels aren't needed in a horizontal bar */

.sb-nav {
  display: flex; flex-direction: row; align-items: center; gap: 2px; padding: 0;
  overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0;
}
.sb-nav::-webkit-scrollbar { display: none; }
.sb-item {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: var(--r-sm);
  cursor: pointer; color: var(--text-secondary); font-weight: 600; font-size: .8rem;
  white-space: nowrap; flex-shrink: 0; transition: background .15s, color .15s; text-decoration: none;
}
.sb-item:hover { background: var(--primary-soft); color: var(--primary-light); }
.sb-item.active { background: linear-gradient(120deg, var(--primary), var(--gold) 150%); color: #fff; box-shadow: var(--glow-blue); }
.sb-item-icon { font-size: 1rem; }
.sb-badge {
  background: var(--gold-soft); color: var(--gold-light); font-size: .64rem; font-weight: 800;
  padding: 1px 7px; border-radius: 20px; border: 1px solid rgba(236,72,153,.35);
}
.sb-item.active .sb-badge { background: rgba(255,255,255,.22); color: #fff; border-color: transparent; }

.sb-footer, .topnav-account { display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: auto; padding: 0; border: none; }
.sb-home {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--r-sm);
  border: none; background: transparent; cursor: pointer; color: var(--text-secondary); font-weight: 700; font-size: .8rem;
  white-space: nowrap; text-decoration: none;
}
.sb-home:hover { background: var(--gold-soft); color: var(--gold-light); }

/* ============================================================ MAIN */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 26px;
  background: rgba(20,20,31,.6); border-bottom: 1px solid var(--border-light);
}
.topbar-title h2 { font-size: 1.05rem; font-weight: 800; color: var(--text-primary); }
.topbar-title p { font-size: .72rem; color: var(--text-muted); }

/* ============================================================ DASHBOARD */
.dash-inner { padding: 24px 28px; overflow-y: auto; flex: 1; }
.hero {
  display: flex; align-items: center; gap: 18px; padding: 28px 30px; border-radius: var(--r-lg);
  background: var(--hero-grad);
  border: 1px solid var(--border-light);
  color: #fff; margin-bottom: 24px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 85% 20%, var(--tint-pink), transparent 45%),
              radial-gradient(circle at 10% 90%, var(--tint-blue), transparent 45%);
}
.hero-icon { font-size: 2.2rem; filter: drop-shadow(0 0 14px rgba(59,130,246,.5)); position: relative; }
.hero-eyebrow { font-size: .7rem; font-weight: 800; letter-spacing: .16em; opacity: .8; text-transform: uppercase; position: relative; }
.hero-h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.01em; position: relative; }
.hero-h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--primary-light), var(--gold-light));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: .78rem; color: var(--text-secondary); margin-top: 3px; position: relative; }

.section-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.section-head h3 { font-size: .92rem; font-weight: 800; color: var(--text-primary); white-space: nowrap; }
.section-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-med), transparent); }

/* ---- Bento grid: one featured tile, the rest fill in around it ---- */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 132px;
  grid-auto-flow: dense; gap: 14px; margin-bottom: 28px; perspective: 900px;
}
.stat-card {
  background: linear-gradient(150deg, var(--bg-surface), var(--bg-surface-2));
  border: 1px solid var(--border-light); border-radius: var(--r-md);
  padding: 16px; cursor: pointer; display: flex; flex-direction: column;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s;
  transform-style: preserve-3d; position: relative; overflow: hidden;
}
.stat-card:hover {
  transform: perspective(800px) rotateX(3deg) rotateY(-4deg) translateY(-4px);
  box-shadow: var(--glow-blue); border-color: var(--primary);
}
.stat-card:nth-child(4n+2):hover, .stat-card:nth-child(4n+4):hover { box-shadow: var(--glow-pink); border-color: var(--gold); }
.stat-card:first-child { grid-column: span 2; grid-row: span 2; }
.stat-card:first-child .stat-icon { font-size: 2.4rem; }
.stat-card:first-child .stat-num { font-size: 2.6rem; }
.stat-card:first-child .stat-label { font-size: .95rem; }
.stat-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.stat-icon { font-size: 1.4rem; filter: drop-shadow(0 0 10px rgba(59,130,246,.35)); }
.stat-arrow { color: var(--gold-light); font-weight: 800; }
.stat-num { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: .8rem; font-weight: 700; margin-top: 2px; color: var(--text-primary); }
.stat-sub { font-size: .68rem; color: var(--text-muted); margin: 3px 0 10px; }
.stat-footer { display: flex; justify-content: space-between; font-size: .68rem; color: var(--gold-light); font-weight: 700;
  border-top: 1px dashed var(--border-med); padding-top: 8px; margin-top: auto; }

/* Reports */
.rpt-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
  background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--r-md); padding: 12px 16px; }
.rpt-ctrl-label { font-size: .72rem; font-weight: 700; color: var(--text-secondary); }
.rpt-date-input, .rpt-area-sel {
  border: 1px solid var(--border-med); border-radius: var(--r-sm); padding: 6px 10px; font-size: .78rem; color: var(--text-primary);
  background: var(--gray-100);
}
.rpt-btn {
  border: none; border-radius: var(--r-sm); padding: 7px 14px; font-size: .78rem; font-weight: 700; cursor: pointer;
  background: linear-gradient(120deg, var(--primary), var(--primary-dark)); color: #fff;
}
.rpt-btn:hover { filter: brightness(1.15); box-shadow: var(--glow-blue); }
.rpt-btn-ghost { background: var(--gray-100); color: var(--text-secondary); box-shadow: none; }
.rpt-btn-ghost:hover { background: var(--gray-200); filter: none; box-shadow: none; }
.rpt-btn-excel { background: linear-gradient(120deg, var(--gold), var(--gold-dark)); color: #fff; }

.rpt-card { background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); overflow: hidden; }
.rpt-card-hd { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border-light); }
.rpt-card-hd h4 { font-size: .85rem; font-weight: 800; flex: 1; color: var(--text-primary); }
.rpt-card-badge { font-size: .68rem; font-weight: 700; color: var(--primary-light); background: var(--primary-soft);
  padding: 3px 10px; border-radius: 20px; }
.rpt-kpi-row { display: grid; gap: 10px; padding: 16px 18px; }
.rpt-kpi { text-align: center; padding: 10px; background: var(--gray-100); border-radius: var(--r-sm); border: 1px solid var(--border-light); }
.rpt-kpi-val { font-size: 1.15rem; font-weight: 800; color: var(--text-primary); }
.rpt-kpi-lbl { font-size: .65rem; color: var(--text-muted); font-weight: 700; margin-top: 2px; }

.rpt-tabs { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.rpt-tab { border: 1px solid var(--border-light); border-bottom: none; background: var(--gray-100);
  padding: 9px 16px; border-radius: var(--r-sm) var(--r-sm) 0 0; font-size: .76rem; font-weight: 700;
  color: var(--text-secondary); cursor: pointer; }
.rpt-tab.active { background: var(--bg-surface); color: var(--primary-light); border-color: var(--border-light); }
.rpt-card-body { padding: 16px 18px; overflow-x: auto; }
.rpt-tab-panel table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.rpt-tab-panel th { text-align: left; background: var(--primary-soft); color: var(--primary-light); padding: 8px 10px;
  font-weight: 800; white-space: nowrap; border-bottom: 2px solid var(--border-med); }
.rpt-tab-panel td { padding: 7px 10px; border-bottom: 1px solid var(--border-light); white-space: nowrap; color: var(--text-secondary); }
.rpt-tab-panel tr:hover td { background: var(--gray-100); }
.rpt-loading { text-align: center; padding: 30px; color: var(--text-muted); }

/* ============================================================ TABLE VIEW */
.tv-wrap { padding: 20px 26px; height: 100%; display: flex; flex-direction: column; }
.tbl-card { background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--gray-100); border: 1px solid var(--border-light); border-radius: 20px;
  padding: 7px 14px; flex: 1; min-width: 180px; }
.search-box svg { color: var(--text-muted); }
.search-box input { border: none; background: transparent; outline: none; font-size: .8rem; flex: 1; color: var(--text-primary); }
.flt-group { display: flex; align-items: center; gap: 6px; }
.flt-label { font-size: .7rem; color: var(--text-muted); font-weight: 700; }
.flt-sel { border: 1px solid var(--border-med); border-radius: var(--r-sm); padding: 6px 10px; font-size: .76rem; background: var(--gray-100); color: var(--text-primary); }
.clear-filter-btn { background: none; border: none; color: var(--accent-rose); font-size: .72rem; font-weight: 700; cursor: pointer; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rec-chip { font-size: .72rem; color: var(--text-muted); background: var(--gray-100); padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border-light); }
.rec-chip strong { color: var(--primary-light); }

.btn { border: none; border-radius: var(--r-sm); padding: 8px 16px; font-size: .78rem; font-weight: 700; cursor: pointer; }
.btn-primary { background: linear-gradient(120deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.15); box-shadow: var(--glow-blue); }
.btn-gold { background: linear-gradient(120deg, var(--gold), var(--gold-dark)); color: #fff; }
.btn-gold:hover { filter: brightness(1.1); box-shadow: var(--glow-pink); }
.btn-ghost { background: var(--gray-100); color: var(--text-secondary); border: 1px solid var(--border-light); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-success { background: var(--accent-green); color: #fff; }
.btn-danger { background: var(--accent-rose); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: .7rem; }

.tbl-wrap { flex: 1; overflow: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .76rem; }
table.data-table th { position: sticky; top: 0; background: var(--table-head-bg); color: var(--table-head-fg);
  text-align: left; padding: 9px 12px; font-weight: 800; white-space: nowrap; z-index: 2; border-bottom: 2px solid var(--border-med); }
table.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); white-space: nowrap; color: var(--text-secondary); }
table.data-table tr:hover td { background: var(--gray-100); color: var(--text-primary); }
.row-actions { display: flex; gap: 6px; }
.icon-btn { border: 1px solid var(--border-light); background: var(--gray-100); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font-size: .75rem; }
.icon-btn.edit:hover { background: var(--primary-soft); border-color: var(--primary); }
.icon-btn.del:hover { background: rgba(244,63,94,.14); border-color: var(--accent-rose); }
.empty-row td { text-align: center; padding: 40px; color: var(--text-muted); }

.pg-bar { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-top: 1px solid var(--border-light); }
.pg-btn { border: 1px solid var(--border-med); background: var(--gray-100); border-radius: var(--r-sm); padding: 5px 11px; font-size: .74rem;
  cursor: pointer; font-weight: 700; color: var(--text-secondary); }
.pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pg-btn:disabled { opacity: .4; cursor: default; }

/* ============================================================ MODAL */
.modal-bg { position: fixed; inset: 0; background: rgba(4,4,10,.7); display: none; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(3px); }
.modal-bg.visible { display: flex; }
.modal { background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--r-lg); width: 95%; max-width: 1240px; max-height: 92vh; display: flex;
  flex-direction: column; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.modal-hd { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border-light);
  background: linear-gradient(120deg, var(--tint-blue), var(--tint-pink)); }
.modal-hd-icon { font-size: 1.4rem; }
.modal-hd h3 { font-size: 1rem; font-weight: 800; color: var(--text-primary); flex: 1; }
.modal-hd h3 small { display: block; font-size: .68rem; font-weight: 600; color: var(--text-muted); }
.modal-close { border: 1px solid var(--border-light); background: var(--gray-100); color: var(--text-secondary); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.val-banner { display: none; background: rgba(244,63,94,.12); border: 1px solid rgba(244,63,94,.4); color: var(--accent-rose); font-size: .76rem;
  font-weight: 700; padding: 9px 14px; border-radius: var(--r-sm); margin-bottom: 14px; }
.val-banner.visible { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; }
@media (min-width: 1000px) {
  .form-grid { grid-template-columns: repeat(4, 1fr); gap: 16px 22px; }
}
.fsec { grid-column: 1 / -1; font-size: .72rem; font-weight: 800; color: var(--gold-light); text-transform: uppercase;
  letter-spacing: .06em; margin-top: 10px; padding-bottom: 4px; border-bottom: 1px solid var(--border-light); }
.fsec:first-child { margin-top: 0; }
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg.wide { grid-column: span 2; }
.fg.full { grid-column: 1 / -1; }
.fg label { font-size: .72rem; font-weight: 700; color: var(--text-secondary); }
.fg input, .fg select, .fg textarea {
  border: 1px solid var(--border-med); border-radius: var(--r-sm); padding: 8px 10px; font-size: .8rem;
  font-family: inherit; color: var(--text-primary); background: var(--gray-100);
}
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.fg.has-error input, .fg.has-error select { border-color: var(--accent-rose); background: rgba(244,63,94,.08); }
.field-hint { font-size: .65rem; color: var(--text-muted); font-weight: 500; }
.consent-readout { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  background: var(--gray-100); border: 1px solid var(--border-light); border-radius: var(--r-sm); padding: 12px 14px; }
.consent-pill { font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 20px; }
.consent-pill.yes { background: rgba(34,197,94,.14); color: var(--accent-green); }
.consent-pill.no { background: rgba(244,63,94,.14); color: var(--accent-rose); }
.consent-channels, .consent-code { font-size: .74rem; color: var(--text-secondary); font-weight: 600; }
.consent-code { width: 100%; color: var(--text-muted); font-weight: 500; }
.rating-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rating-row label { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 700;
  border: 1.5px solid var(--border-med); border-radius: var(--r-sm); padding: 7px 4px; cursor: pointer; flex: 1; min-width: 46px;
  transition: all .12s; color: var(--text-secondary); background: var(--gray-100); }
.rating-row label .rp-emoji { font-size: 1.3rem; line-height: 1; }
.rating-row input { width: auto; position: absolute; opacity: 0; pointer-events: none; }
.rating-row label:hover { border-color: var(--primary-light); background: var(--primary-soft); }
.rating-row label.picked { background: linear-gradient(135deg, var(--gold-soft), var(--gray-100)); border-color: var(--gold); color: var(--gold-light); box-shadow: 0 2px 12px rgba(236,72,153,.25); }

/* ============================================================ TOPBAR USER MENU */
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tb-user-chip { display: flex; align-items: center; gap: 8px; background: var(--gray-100); border: 1px solid var(--border-light); border-radius: 20px; padding: 6px 12px 6px 6px; }
.tb-user-avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--gold));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; }
.tb-user-name { font-size: .74rem; font-weight: 700; color: var(--text-primary); }
.tb-user-role { font-size: .62rem; color: var(--gold-light); font-weight: 800; text-transform: uppercase; }
.tb-link { font-size: .74rem; font-weight: 700; color: var(--primary-light); text-decoration: none; padding: 6px 10px; border-radius: var(--r-sm); }
.tb-link:hover { background: var(--primary-soft); }

/* ============================================================ PENDING SURVEY BADGE / SUBNAV */
.subnav { display: flex; gap: 8px; padding: 0 0 12px; }
.subnav-btn { border: 1px solid var(--border-med); background: var(--gray-100); padding: 8px 16px; border-radius: 20px; font-size: .78rem;
  font-weight: 700; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.subnav-btn.active { background: linear-gradient(120deg, var(--primary), var(--gold) 150%); color: #fff; border-color: transparent; box-shadow: var(--glow-blue); }
.subnav-badge { background: var(--accent-rose); color: #fff; font-size: .65rem; font-weight: 800; padding: 1px 7px; border-radius: 10px; }
.subnav-btn.active .subnav-badge { background: rgba(255,255,255,.3); }

/* ============================================================ ADMIN / QR PAGES */
.page-wrap { padding: 24px 28px; overflow-y: auto; height: 100vh; }
.page-hd { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.page-hd h2 { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); flex: 1; }
.qr-box { text-align: center; background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--r-md); padding: 24px; }
.qr-box img { border-radius: var(--r-sm); border: 6px solid #fff; box-shadow: var(--shadow-md); }
.module-chip { display: inline-block; background: var(--primary-soft); color: var(--primary-light); font-size: .68rem; font-weight: 700;
  padding: 2px 9px; border-radius: 12px; margin: 2px; }
.role-chip { font-size: .68rem; font-weight: 800; padding: 3px 10px; border-radius: 12px; text-transform: uppercase; }
.role-chip.admin { background: var(--gold-soft); color: var(--gold-light); }
.role-chip.user { background: var(--primary-soft); color: var(--primary-light); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.status-dot.on { background: var(--accent-green); box-shadow: 0 0 8px rgba(34,197,94,.6); } .status-dot.off { background: var(--accent-rose); }
.checkbox-row { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; background: var(--gray-100);
  border: 1px solid var(--border-light); padding: 7px 12px; border-radius: var(--r-sm); cursor: pointer; color: var(--text-secondary); }
.checkbox-row input { width: auto; }

.modal-ft { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px;
  border-top: 1px solid var(--border-light); }
.req-legend { font-size: .68rem; color: var(--text-muted); }
.modal-ft-right { display: flex; gap: 10px; }

.saving-overlay { position: absolute; inset: 0; background: rgba(10,10,18,.92); display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; z-index: 5; }
.saving-overlay.visible { display: flex; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border-med); border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.saving-label { font-weight: 800; color: var(--text-primary); }
.saving-sub { font-size: .72rem; color: var(--text-muted); }

/* ============================================================ CONFIRM */
.confirm-bg { position: fixed; inset: 0; background: rgba(4,4,10,.7); display: none; align-items: center; justify-content: center; z-index: 110; }
.confirm-bg.visible { display: flex; }
.confirm-box { background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--r-lg); padding: 28px; width: 92%; max-width: 380px; text-align: center;
  box-shadow: var(--shadow-lg); }
.confirm-icon-ring { width: 56px; height: 56px; border-radius: 50%; background: rgba(244,63,94,.14); display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem; margin: 0 auto 14px; }
.confirm-box h3 { font-size: 1rem; font-weight: 800; margin-bottom: 8px; color: var(--text-primary); }
.confirm-box p { font-size: .8rem; color: var(--text-muted); margin-bottom: 18px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ============================================================ TOAST */
#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(120deg, var(--primary-dark), var(--gold-dark));
  color: #fff; padding: 11px 22px; border-radius: 30px; font-size: .8rem; font-weight: 700; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 200; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================ THEME TOGGLE */
#theme-toggle { font-size: .95rem; padding: 8px 10px; }

/* ============================================================ DROPDOWN LIST ADMIN */
.dd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.dd-card { background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--r-md);
  padding: 14px 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.dd-card-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dd-card-hd h4 { font-size: .82rem; font-weight: 800; color: var(--text-primary); }
.dd-card-count { font-size: .64rem; font-weight: 700; color: var(--primary-light); background: var(--primary-soft);
  padding: 2px 8px; border-radius: 20px; }
.dd-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.dd-chip { display: flex; align-items: center; gap: 6px; background: var(--gray-100); border: 1px solid var(--border-light);
  color: var(--text-secondary); font-size: .72rem; font-weight: 600; padding: 4px 6px 4px 10px; border-radius: 20px; }
.dd-chip button { border: none; background: none; color: var(--accent-rose); cursor: pointer; font-size: .8rem;
  width: 16px; height: 16px; line-height: 1; border-radius: 50%; }
.dd-chip button:hover { background: rgba(244,63,94,.18); }
.dd-chip-empty { font-size: .72rem; color: var(--text-muted); font-style: italic; }
.dd-add-row { display: flex; gap: 6px; }
.dd-add-row input { flex: 1; border: 1px solid var(--border-med); border-radius: var(--r-sm); padding: 7px 10px;
  font-size: .76rem; background: var(--gray-100); color: var(--text-primary); }
.dd-add-row button { border: none; border-radius: var(--r-sm); padding: 7px 12px; font-size: .76rem; font-weight: 700;
  cursor: pointer; background: linear-gradient(120deg, var(--primary), var(--primary-dark)); color: #fff; }
.dd-add-row button:hover { filter: brightness(1.15); }
.dd-area-del { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: .72rem; font-weight: 700; }
.dd-area-del:hover { color: var(--accent-rose); }
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-card:first-child { grid-column: span 2; grid-row: span 1; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .stats-row { grid-template-columns: 1fr; }
  .stat-card:first-child { grid-column: span 1; }
  .form-grid { grid-template-columns: 1fr; }
  .topnav { padding: 8px 12px; gap: 10px; }
  .sb-brand-sub { display: none; }
}
