/* ═══════════════════════════════════════════════════════════════
   DrewsPro — Global Design System
   Brand: #0F1F3D (Navy) + #2EC4B6 (Teal) — matched to DrewsKiosk
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* Brand — navy primary with a teal accent (DrewsKiosk palette) */
  --brand:      #0F1F3D;
  --brand-dark: #1A3260;
  --brand-deep: #0a1730;
  --brand-light:#E8FAF8;
  --brand-glow: rgba(46,196,182,.18);

  /* Teal accent */
  --accent:      #2EC4B6;
  --accent-deep: #1AA99D;
  --accent-light:#E8FAF8;

  /* Neutrals */
  --white:  #ffffff;
  --bg:     #f4f6fb;
  --bg2:    #edf0f7;
  --card:   #ffffff;
  --border: #dde3ee;
  --border2:#c8d0e3;
  --text:   #0f172a;
  --text2:  #374151;
  --muted:  #64748b;
  --muted2: #94a3b8;

  /* Status */
  --green:       #059669;
  --green-light: #d1fae5;
  --red:         #dc2626;
  --red-light:   #fee2e2;
  --amber:       #d97706;
  --amber-light: #fef3c7;
  --blue-light:  #dbeafe;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15,31,61,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(15,31,61,.10), 0 1px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 40px rgba(15,31,61,.14), 0 2px 8px rgba(0,0,0,.06);
  --shadow-xl: 0 24px 64px rgba(15,31,61,.18), 0 4px 16px rgba(0,0,0,.08);

  /* Sidebar */
  --sidebar: 248px;

  /* Fonts */
  --font-body: 'Sora', -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'Consolas', monospace;
}

/* ── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Accessibility & interaction baseline (WCAG / industry standard) ──── */
/* Visible keyboard focus on every interactive element. :focus-visible keeps
   mouse clicks clean while giving keyboard / screen-reader users a clear ring —
   the single most impactful accessibility fix. */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }
.btn:focus-visible, .nav-item:focus-visible { outline-offset: 2px; }

/* Remove the grey mobile tap flash; let our own states show instead. */
a, button, .btn, .nav-item, .module-card, [role="button"], [tabindex] {
  -webkit-tap-highlight-color: transparent;
}
/* Cut the 300ms tap delay on touch and keep clickable affordance clear. */
button, [role="button"], .btn, summary { touch-action: manipulation; }
button:not(:disabled), [role="button"], summary { cursor: pointer; }

/* Brand-coloured native checkboxes / radios for consistency. */
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }

::selection { background: var(--brand-glow); color: var(--brand-deep); }

/* Honour users who request less motion (vestibular safety). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Typography ───────────────────────────────────────────────────── */
h1 { font-size: 28px; font-weight: 700; line-height: 1.2; }
h2 { font-size: 21px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }

.display { font-size: 40px; font-weight: 700; line-height: 1.15; }
.lead    { font-size: 16px; color: var(--muted); line-height: 1.7; }

.label {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
}

/* ── Layout ───────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.page-wrap { max-width: 760px; margin: 40px auto; padding: 0 20px 80px; }

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card-sm { padding: 16px; }
.card-lg { padding: 32px; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--r-sm); border: none;
  font-size: 13.5px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; white-space: nowrap; text-decoration: none; line-height: 1;
  /* Animate only paint/transform props (never layout) for smooth, jank-free states. */
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, transform .12s;
}
.btn:hover { text-decoration: none; }
/* Subtle press feedback — restores on release; never shifts surrounding layout. */
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand); color: var(--white);
  box-shadow: 0 2px 8px var(--brand-glow);
}
.btn-primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn-outline {
  background: transparent; color: var(--brand);
  border: 1.5px solid var(--brand);
}
.btn-outline:hover { background: var(--brand-light); }

.btn-ghost {
  background: transparent; color: var(--text2);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); border-color: var(--border2); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #047857; }

.btn-amber { background: var(--amber); color: #fff; }
.btn-amber:hover { background: #b45309; }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: var(--r-md); }
.btn-xl { padding: 17px 36px; font-size: 16px; border-radius: var(--r-md); }
.btn-block { width: 100%; justify-content: center; }

/* ── Form Elements ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

label, .form-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 6px;
}
.form-hint { font-size: 11px; color: var(--muted2); margin-top: 4px; }

input[type=text], input[type=email], input[type=password],
input[type=tel], input[type=number], input[type=url],
select, textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px; font-family: var(--font-body);
  color: var(--text); background: var(--white);
  outline: none; transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
input:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled) { border-color: var(--border2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
input::placeholder, textarea::placeholder { color: var(--muted2); }
input:disabled, select:disabled, textarea:disabled {
  background: var(--bg2); color: var(--muted); cursor: not-allowed; opacity: .7;
}
textarea { resize: vertical; min-height: 80px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

.input-err { border-color: var(--red) !important; }
.field-error { font-size: 11.5px; color: var(--red); margin-top: 4px; }

/* Native inline validation — only flags a field AFTER the user has interacted
   with it (`:user-invalid`), so forms aren't red on first load. Progressive
   enhancement: older browsers simply ignore it. */
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--red); }
input:user-invalid:focus, select:user-invalid:focus, textarea:user-invalid:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light);
}

/* Read-only is visually distinct from disabled (skill: read-only-distinction). */
input[readonly], textarea[readonly] {
  background: var(--bg2); color: var(--text2); cursor: default; border-style: dashed;
}

/* Required-field marker: add <span class="req">*</span> after a label. */
.req { color: var(--red); font-weight: 700; margin-left: 2px; }

/* Inline success confirmation next to a field/section. */
.field-ok { font-size: 11.5px; color: var(--green); margin-top: 4px; font-weight: 600; }

/* ── Alerts ───────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--r-sm);
  font-size: 13.5px; line-height: 1.5; margin-bottom: 16px;
}
.alert-error   { background: var(--red-light);   border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: var(--green-light);  border: 1px solid #6ee7b7; color: #065f46; }
.alert-info    { background: var(--blue-light);   border: 1px solid #93c5fd; color: #1e40af; }
.alert-warning { background: var(--amber-light);  border: 1px solid #fcd34d; color: #92400e; }

/* ── Tables ───────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--card); border-radius: var(--r-lg);
  border: 1px solid var(--border); overflow: hidden; overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: #f8fafc; padding: 11px 14px; text-align: left;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td {
  padding: 11px 14px; border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  /* Tabular figures keep numeric columns aligned (only affects digits). */
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color .12s; }
tbody tr:hover td { background: #fafbfd; }

/* Thin, unobtrusive scrollbar for tables that scroll horizontally. */
.table-wrap { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
.table-wrap::-webkit-scrollbar { height: 9px; width: 9px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 6px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }

/* Opt-in sticky header for long tables: <div class="table-wrap sticky">.
   The header stays visible while the body scrolls within a bounded height. */
.table-wrap.sticky { max-height: 70vh; overflow-y: auto; }
.table-wrap.sticky thead th { position: sticky; top: 0; z-index: 2; }

/* Lighter variant for tables NOT wrapped in .table-wrap (plain scroll divs).
   Add class="sticky-head" to the scroll container around the <table>. */
.sticky-head { max-height: 70vh; overflow-y: auto; }
.sticky-head thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; }

/* ── Status Pills ─────────────────────────────────────────────────── */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 50px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill-green  { background: var(--green-light);  color: #065f46; }
.pill-red    { background: var(--red-light);    color: #991b1b; }
.pill-amber  { background: var(--amber-light);  color: #92400e; }
.pill-blue   { background: var(--blue-light);   color: #1e40af; }
.pill-grey   { background: #f1f5f9; color: #475569; }

/* ── Admin Layout ─────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar); background: var(--brand-deep);
  flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; display: flex; flex-direction: column;
  transition: transform .25s;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
}
.sidebar-icon {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: var(--brand); display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -.3px;
}
.sidebar-brand-sub {
  font-size: 10.5px; color: rgba(255,255,255,.45); margin-top: 1px;
}
.sidebar-org {
  margin-top: 14px; padding: 10px 12px;
  background: rgba(255,255,255,.06); border-radius: var(--r-sm);
}
.sidebar-org-name { font-size: 12px; color: rgba(255,255,255,.8); font-weight: 600; }
.sidebar-org-plan { font-size: 10px; color: rgba(255,255,255,.4); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-section-label {
  font-size: 9.5px; font-weight: 700; color: rgba(255,255,255,.3);
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 16px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  cursor: pointer; color: rgba(255,255,255,.6);
  font-size: 13.5px; font-weight: 500;
  transition: all .14s; margin-bottom: 2px;
  text-decoration: none; border: none; background: none; width: 100%;
}
.nav-item .nav-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.nav-item.active {
  color: #fff; background: var(--brand);
  box-shadow: 0 2px 8px rgba(15,31,61,.4);
}

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer .nav-item { font-size: 12.5px; color: rgba(255,255,255,.4); }
.sidebar-footer .nav-item:hover { color: rgba(255,255,255,.7); }

/* min-width:0 lets the flex item shrink below its content's intrinsic width
   so wide tables scroll inside their own wrapper instead of pushing the whole
   page sideways (no left/right page scrollbar). */
.main-area { margin-left: var(--sidebar); flex: 1; min-width: 0; min-height: 100vh; }

.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 50;
  gap: 16px;
}
.topbar-left h1 {
  font-size: 18px; font-weight: 700; color: var(--brand-deep);
  margin: 0;
}
.topbar-left .breadcrumb {
  font-size: 11px; color: var(--muted); margin-top: 1px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: none; border: 1px solid var(--border);
  font-size: 18px; cursor: pointer; color: var(--brand-deep);
  flex-shrink: 0;
}

/* Desktop: the topbar ☰ hides/shows the sidebar; the choice is remembered
   per browser (localStorage). On ≤1024px the same button drives the
   hamburger overlay below instead. */
@media (min-width: 1025px) {
  .admin-layout.sidebar-hidden .sidebar { transform: translateX(-100%); }
  .admin-layout.sidebar-hidden .main-area { margin-left: 0; }
}

.table-responsive { overflow-x: auto; }

/* ── Toggle switch + settings rows ────────────────────────────────── */
.notif-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.notif-row:last-child { border-bottom: none; }
.notif-row-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.notif-row-desc  { font-size: 12px; color: var(--muted); margin-top: 2px; max-width: 460px; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle .toggle-slider {
  position: absolute; inset: 0; background: var(--border2);
  border-radius: 24px; transition: background .18s;
}
.toggle .toggle-slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--brand); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.page-content { padding: 24px 28px 60px; min-width: 0; max-width: 100%; }

/* ── Stat Cards ───────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }

.stat-card {
  background: var(--card); border-radius: var(--r-lg);
  border: 1px solid var(--border); padding: 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--brand);
}
.stat-card.green::before  { background: var(--green); }
.stat-card.amber::before  { background: var(--amber); }
.stat-card.red::before    { background: var(--red); }

.stat-card .s-label { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.stat-card .s-value { font-size: 30px; font-weight: 700; color: var(--brand-deep); margin: 6px 0 2px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card .s-sub   { font-size: 12px; color: var(--muted); }
.stat-card .s-icon  { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 28px; opacity: .12; }

/* ── Section Headers ──────────────────────────────────────────────── */
.section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.section-hdr h2 { font-size: 15px; font-weight: 600; color: var(--brand-deep); }

/* ── Panel Tabs ───────────────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Module / Section Grid (launcher-style navigation) ───────────────── */
.admin-breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; font-weight: 600; color: var(--muted);
  margin-bottom: 18px;
}
.admin-breadcrumb a { color: var(--brand); text-decoration: none; }
.admin-breadcrumb a:hover { text-decoration: underline; }
.admin-breadcrumb .bc-sep { color: var(--muted2); }
.admin-breadcrumb .bc-current { color: var(--brand-deep); }

/* Row layout: sections stack vertically and scroll down rather than
   expanding sideways into a wide card grid. */
.module-grid {
  display: flex; flex-direction: column;
  gap: 10px;
}
.module-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 14px 18px; cursor: pointer; text-decoration: none; color: inherit;
  display: flex; flex-direction: row; align-items: center; gap: 16px;
  transition: all .15s;
}
.module-card:hover {
  border-color: var(--brand); box-shadow: var(--shadow-md);
}

/* Grid style: cards laid out in a responsive multi-column grid with their
   contents stacked vertically (icon → title → description → Open link). */
.module-grid.as-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
/* Always keep at least two cards per row on tablets and phones. */
@media (max-width: 720px) {
  .module-grid.as-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .module-grid.as-cards .module-card { min-height: 132px; padding: 14px; gap: 8px; }
  .module-grid.as-cards .module-card .mc-title { font-size: 13.5px; }
  .module-grid.as-cards .module-card .mc-desc { font-size: 11.5px; }
}
.module-grid.as-cards .module-card {
  flex-direction: column; align-items: flex-start; gap: 10px;
  position: relative; min-height: 150px;
}
.module-grid.as-cards .module-card .mc-title { flex: none; }
.module-grid.as-cards .module-card .mc-desc  { flex: none; }
.module-grid.as-cards .module-card .mc-go    { margin-top: auto; }
.module-grid.as-cards .module-card .mc-badge {
  position: absolute; top: 14px; right: 14px; order: 0;
}
.module-card .mc-icon {
  width: 42px; height: 42px; border-radius: var(--r-md);
  background: var(--brand-light); display: flex; align-items: center;
  justify-content: center; font-size: 21px; flex-shrink: 0;
}
.module-card .mc-title { font-size: 14.5px; font-weight: 700; color: var(--brand-deep); flex: 0 0 180px; }
.module-card .mc-desc  { font-size: 12.5px; color: var(--muted); line-height: 1.5; flex: 1; }
.module-card .mc-go    { font-size: 12px; font-weight: 700; color: var(--brand); flex-shrink: 0; white-space: nowrap; }
.module-card .mc-badge {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; padding: 3px 9px;
  border-radius: 10px; background: var(--brand-light); color: var(--brand);
  flex-shrink: 0; order: 99;
}

/* ── Home dashboard: stat widgets, agenda & activity ─────────────────── */
.home-stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px; margin-bottom: 18px;
}
.home-stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 14px 16px; cursor: pointer; transition: all .15s;
}
.home-stat-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.home-stat-card .hs-icon { font-size: 20px; margin-bottom: 6px; }
.home-stat-card .hs-count { font-size: 26px; font-weight: 800; color: var(--brand-deep); line-height: 1; font-variant-numeric: tabular-nums; }
.home-stat-card .hs-label { font-size: 12.5px; font-weight: 700; color: var(--brand-deep); margin-top: 4px; }
.home-stat-card .hs-detail { font-size: 11.5px; color: var(--muted); }

.home-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px;
}
@media (max-width: 800px) { .home-cols { grid-template-columns: 1fr; } }

.agenda-item, .activity-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 6px;
  font-size: 12.5px;
}
.agenda-item { display: flex; align-items: center; gap: 8px; cursor: pointer; transition: all .15s; }
.agenda-item:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.agenda-item .agenda-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.agenda-item .agenda-date { font-weight: 700; color: var(--brand-deep); flex-shrink: 0; }
.agenda-item .agenda-title { flex: 1; color: var(--text); }
.agenda-item .agenda-meta { color: var(--muted); font-size: 11.5px; flex-shrink: 0; }

.activity-item .activity-action { font-weight: 700; color: var(--brand-deep); }
.activity-item .activity-detail { color: var(--text); margin-top: 2px; }
.activity-item .activity-time { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* ── Collapsible section wrapper ──────────────────────────────────── */
.collapsible-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 5px 12px; margin-bottom: 10px;
}
.collapsible-toggle:hover { color: var(--brand); border-color: var(--brand); }
.collapsible.collapsed > .module-grid,
.collapsible.collapsed > .section-list,
.collapsible.collapsed > .table-wrap { display: none; }

@media (max-width: 600px) {
  .module-card { padding: 12px 14px; gap: 12px; flex-wrap: wrap; }
  .module-card .mc-icon { width: 38px; height: 38px; font-size: 19px; }
  .module-card .mc-title { flex: 1 1 100%; order: -1; }
  .module-card .mc-desc { flex: 1 1 auto; }
}

/* ── Pool / Room Cards ────────────────────────────────────────────── */
.list-card {
  background: var(--card); border-radius: var(--r-lg);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 20px;
}
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #f1f5f9; gap: 12px;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #fafbfd; }
.list-item-info .name  { font-weight: 600; font-size: 14px; }
.list-item-info .sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item-info .meta  { font-size: 11px; color: var(--brand); margin-top: 2px; }
.list-item-actions { display: flex; gap: 7px; flex-shrink: 0; }

/* ── Form Builder ─────────────────────────────────────────────────── */
.fb-drag-handle { cursor: grab; color: var(--muted2); font-size: 16px; user-select: none; }
.fb-field-section { background: #f8fafc; }

/* ── Add Form ─────────────────────────────────────────────────────── */
.add-form {
  background: var(--card); border-radius: var(--r-lg);
  border: 1px solid var(--border); padding: 20px; margin-bottom: 20px;
}
.add-form h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--brand-deep); }
.add-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
@media (max-width: 760px) { .add-row { grid-template-columns: 1fr; } }
.add-form input { margin-bottom: 0; }

/* ── Debug Panel ──────────────────────────────────────────────────── */
.debug-panel {
  background: #0d1117; border-radius: var(--r-lg);
  border: 1px solid #21262d; padding: 0; overflow: hidden;
  transition: all .2s;
}
.debug-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #21262d;
}
.debug-header h3 {
  font-family: var(--font-mono); font-size: 12px; color: #58a6ff;
  display: flex; align-items: center; gap: 8px;
}
.debug-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ea043; }
.debug-dot.off { background: #6e7681; }
.debug-actions { display: flex; gap: 8px; }
.debug-body { padding: 16px 18px; }
#debug-log {
  height: 280px; overflow-y: auto;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.8;
}
.log-info  { color: #3fb950; }
.log-error { color: #f85149; }
.log-debug { color: #58a6ff; }
.log-warn  { color: #d29922; }
.log-diag  { color: #bc8cff; }

.diag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 10px; margin-bottom: 16px; }
.diag-item {
  background: #161b22; border-radius: var(--r-sm); padding: 14px;
  border-left: 3px solid #21262d; display: flex; gap: 10px; align-items: flex-start;
}
.diag-item.ok   { border-left-color: #2ea043; }
.diag-item.fail { border-left-color: #f85149; }
.diag-name   { font-family: var(--font-mono); font-size: 11.5px; color: #58a6ff; font-weight: 600; }
.diag-detail { font-size: 11px; color: #8b949e; margin-top: 2px; word-break: break-all; }

/* ── Toast ────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 28px; right: 28px;
  padding: 13px 22px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 600; color: #fff;
  display: none; z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
#toast.ok  { background: var(--green); }
#toast.err { background: var(--red); }
#toast.info { background: var(--brand); }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Empty State ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* ── Loading: spinner + skeleton (consistent async feedback) ──────── */
.spinner {
  display: inline-block; width: 18px; height: 18px; flex-shrink: 0;
  border: 2.5px solid var(--border2); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px;
}
.spinner-lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inline {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.skeleton {
  background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
  border-radius: 6px; color: transparent !important;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  align-items: center; justify-content: center;
  z-index: 2000; padding: 24px 20px; display: none;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border-radius: var(--r-xl);
  padding: 28px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-xl);
  /* Never taller than the viewport — content scrolls inside so the footer
     (action buttons) is always reachable instead of falling off-screen. */
  max-height: calc(100vh - 48px); overflow-y: auto; margin: auto;
}
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.modal .modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin: 20px -28px -28px; padding: 16px 28px;
  position: sticky; bottom: -28px;
  background: var(--card);
  border-top: 1px solid var(--border, #e8eaed);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ── Section calendars (Catering / Housekeeping / generic) ────────── */
.sec-cal { width: 100%; }
.sec-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.sec-cal-title { font-size: 15px; font-weight: 700; color: var(--brand-deep); min-width: 150px; text-align: center; }
.sec-cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sec-cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(96px, 1fr));
  min-width: 680px;
}
.sec-cal-dow {
  padding: 8px 6px; text-align: center; font-size: 10.5px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
  background: #f8fafc; border-bottom: 1px solid var(--border);
}
.sec-cal-day {
  min-height: 86px; border-bottom: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9;
  padding: 6px; font-size: 11px; background: var(--card); cursor: pointer;
  transition: background .12s;
}
.sec-cal-day:hover { background: var(--brand-light); }
.sec-cal-day.dim { background: #fafbfd; color: var(--muted2); cursor: default; }
.sec-cal-day.dim:hover { background: #fafbfd; }
.sec-cal-day.today { box-shadow: inset 0 0 0 2px var(--brand); border-radius: 4px; }
.sec-cal-daynum { font-weight: 700; color: var(--text2); margin-bottom: 4px; font-size: 11.5px; }
.sec-cal-chip {
  display: block; font-size: 10px; padding: 2px 6px; border-radius: 6px;
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600;
}
.sec-cal-more { font-size: 10px; color: var(--muted); font-weight: 600; }

/* ── Responsive ───────────────────────────────────────────────────── */
/* Tablets & phones (≤1024px): sidebar collapses to a hamburger menu. */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); z-index: 200; box-shadow: var(--shadow-xl); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 150;
  }
  .sidebar-backdrop.open { display: block; }
}
@media (max-width: 768px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .topbar-right { flex-wrap: wrap; }
  .topbar h1 { font-size: 18px; }
  .page-content { padding: 16px 12px 72px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }

  /* Tap-friendly controls and stacking */
  .btn { padding: 11px 16px; }
  .btn-sm { padding: 8px 12px; }
  .card { padding: 16px; }
  .modal { padding: 20px; max-height: calc(100dvh - 24px); }
  .modal-overlay { padding: 12px 10px; }
  .modal-footer { margin: 16px -20px -20px; padding: 12px 16px; bottom: -20px; }
  .modal-footer .btn { flex: 1; justify-content: center; }
  /* Two-column form grids collapse to a single column on phones */
  .modal [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  .tab-panel h2 { font-size: 16px; }
  input, select, textarea { font-size: 16px !important; } /* prevent iOS zoom-on-focus */
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .page-content { padding: 12px 10px 80px; }
}

/* ── Utility ──────────────────────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex  { display: flex; }
.gap-2 { gap: 10px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }

/* ── Subscription warning banner ─────────────────────────────────── */
.sub-banner {
  background: var(--amber-light); border-bottom: 1px solid #fcd34d;
  padding: 10px 28px; font-size: 13px; color: #92400e;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.sub-banner strong { font-weight: 700; }
