/* ============================================================
   Grand OS · The Grand
   Shared stylesheet
   ----------------------------------------------------------------
   1. Tokens (typography, spacing, radius, shadow, motion)
   2. Per-site brand variables
   3. Reset and base
   4. Layout primitives
   5. Header, site switcher, sign-in picker
   6. Tile grid and tile component
   7. Buttons
   8. Forms
   9. Badges, chips, avatars
   10. Toasts and modals
   11. Tables and lists
   12. Utilities
   ============================================================ */

/* ----- 0. Brand fonts ----- */
/* Futura is self-hosted for Grand22 (not on Google Fonts). Lato and Manrope come from Google Fonts loaded in <head>. */
@font-face {
  font-family: 'Futura G22';
  src: url('fonts/Futura-Book.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Futura G22';
  src: url('fonts/Futura-Medium.ttf') format('truetype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Futura G22';
  src: url('fonts/Futura-Demi.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Futura G22';
  src: url('fonts/Futura-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ----- 1. Tokens ----- */

:root {
  --font-body: 'Lato', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'Lato', system-ui, sans-serif;
  --heading-weight: 300;
  --heading-letter-spacing: -0.01em;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12);

  --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  --touch-target: 44px;
  --max-content-width: 1200px;

  /* Defaults, overridden by site classes below */
  --color-primary: #2F5D74;
  --color-primary-dark: #244A5E;
  --color-accent: #D19874;
  --color-accent-dark: #B8794F;
  --color-bg: #FAF7F2;
  --color-surface: #FFFFFF;
  --color-surface-elevated: #FFFFFF;
  --color-text: #2A2A2A;
  --color-text-muted: #6B6B6B;
  --color-border: #E5DFD3;
  --color-border-strong: #C9C0B0;
  --color-success: #5A8B5A;
  --color-warning: #C77B2E;
  --color-danger: #B53A2B;
  --color-overlay: rgba(20, 20, 20, 0.55);
}

/* ----- 2. Per-site brand variables ----- */

body.site-lytham {
  /* The Grand Hotel: Grand Blue and Grand Gold, from official design system */
  --color-primary: #2F5D74;        /* Grand Blue */
  --color-primary-dark: #1B3D4F;   /* Grand Blue Deep */
  --color-accent: #D19874;         /* Grand Gold */
  --color-accent-dark: #B17A57;    /* Grand Gold Deep */
  --color-bg: #FFFFFF;             /* Paper, per spec */
  --color-surface: #FFFFFF;
  --color-border: #E0DACE;
  --color-border-strong: #C0B6A2;
  --color-text: #2F5D74;           /* Grand Blue is the fg colour */
  --color-text-muted: #6E8694;
  --font-heading: 'Lato', system-ui, sans-serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --heading-weight: 300;           /* Lato Light for headings at scale */
  --heading-letter-spacing: -0.01em;
}

body.site-grasmere {
  /* Grand at Grasmere: Slate, Stone, Moss and Fell Mist, from official design system */
  --color-primary: #3C3C3A;        /* Slate */
  --color-primary-dark: #2A2A29;   /* Stone-900 */
  --color-accent: #5C6B5A;         /* Moss */
  --color-accent-dark: #3F4A3D;    /* Moss Deep */
  --color-bg: #E8E4DD;             /* Fell Mist (never pure white per spec) */
  --color-surface: #F0EDE7;        /* bg-raised, slightly lifted card surface */
  --color-border: #D6D2CB;         /* stone-200 */
  --color-border-strong: #BFB9B0;  /* stone-300 */
  --color-text: #3C3C3A;
  --color-text-muted: #8C877F;     /* stone-500 */
  --font-heading: 'Lato', system-ui, sans-serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --heading-weight: 300;
  --heading-letter-spacing: -0.01em;
}

body.site-grand22 {
  /* Grand22: pale blue and white. Gold as accent, midnight as primary text/buttons. */
  --color-primary: #0A0A0A;        /* Midnight */
  --color-primary-dark: #000000;
  --color-accent: #F2CE74;         /* Gold */
  --color-accent-dark: #DCB861;
  --color-bg: #FFFFFF;             /* White page */
  --color-surface: #FFFFFF;
  --color-border: #DCE6EB;         /* Cool pale-blue tinted border */
  --color-border-strong: #B4C9D5;
  --color-text: #1F1F1F;
  --color-text-muted: rgba(10, 10, 10, 0.62);
  --g22-pale-blue: #AAC5D3;        /* Brand pale blue, used as feature surface */
  --g22-pale-blue-soft: #E6EEF3;   /* Light tint for subtle backgrounds */
  --font-heading: 'Lato', system-ui, sans-serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --heading-weight: 300;
  --heading-letter-spacing: -0.01em;
}
/* Grand22 feature surfaces: lean into the pale blue */
body.site-grand22 .stat-bar { background: var(--g22-pale-blue-soft); }
body.site-grand22 .nugget-card {
  background: var(--g22-pale-blue-soft);
  border-color: var(--g22-pale-blue);
  border-left-color: var(--g22-pale-blue);
}
body.site-grand22 .nugget-card .nugget-kind { color: var(--color-primary); }
body.site-grand22 .filter-bar { background: var(--g22-pale-blue-soft); }
body.site-grand22 .live-tile .meta-chip { background: var(--g22-pale-blue-soft); color: var(--color-primary); }
body.site-grand22 .tile-icon { background: var(--g22-pale-blue-soft); }
body.site-grand22 .user-pill { background: var(--g22-pale-blue-soft); border-color: var(--color-border); }
body.site-grand22 .site-switcher { background: var(--g22-pale-blue-soft); border-color: var(--color-border); }
/* Grand22: gold doing more visible work on Grand22 surfaces */
body.site-grand22 .section-divider .line { background: var(--color-accent); opacity: 0.85; height: 2px; }
body.site-grand22 .stat-cell .value { color: var(--color-accent-dark); }
body.site-grand22 .stat-cell .value.warn { color: #C77B2E; }
body.site-grand22 .stat-cell .value.alert { color: #B53A2B; }
body.site-grand22 .stat-cell .label { color: var(--color-primary); }
body.site-grand22 .featured-tile { border-top: 4px solid var(--color-accent); }
body.site-grand22 .badge-live {
  background: var(--color-accent);
  color: var(--color-primary);
}
body.site-grand22 .live-tile:hover {
  border-color: var(--color-accent);
  box-shadow: 0 12px 24px rgba(242, 206, 116, 0.25), var(--shadow-md);
}
body.site-grand22 .tile:hover .tile-name,
body.site-grand22 .live-tile:hover h4 { color: var(--color-accent-dark); }
body.site-grand22 .header-emblem {
  background: var(--color-accent);
  padding: 4px;
  border-radius: var(--radius-sm);
}
body.site-grand22 .header-site { color: var(--color-accent-dark); }
body.site-grand22 .admin-band { border-top: 4px solid var(--color-accent); }
body.site-grand22 .empty-state h3 { color: var(--color-accent-dark); }
body.site-grand22 a:not(.btn):not(.tile):not(.live-tile):not(.user-card):not(.header-logo):not(.featured-tile):not(.admin-tile):not(.soon-tile) {
  color: var(--color-accent-dark);
}

/* ----- 3. Reset and base ----- */

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  margin: 0 0 var(--space-3) 0;
  color: var(--color-primary);
  line-height: 1.18;
}
h1, h2 {
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-letter-spacing);
}
h3, h4 {
  font-weight: 700;
  letter-spacing: 0;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.625rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
}

p { margin: 0 0 var(--space-3) 0; }

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-dark); }

img { max-width: 100%; height: auto; display: block; }

button { font: inherit; cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ----- 4. Layout primitives ----- */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

@media (min-width: 768px) {
  .main { padding: var(--space-7) var(--space-5); }
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 var(--space-4) 0;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.section-heading h2 { margin: 0; }

.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--space-3); }
.stack-lg > * + * { margin-top: var(--space-5); }

.row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }

.muted { color: var(--color-text-muted); font-size: 0.92em; }

.surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-slow), border-color var(--transition-slow);
}

/* ----- 5. Header, site switcher, sign-in picker ----- */

.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color var(--transition-slow), border-color var(--transition-slow);
}

.header-inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--touch-target);
  text-decoration: none;
  color: inherit;
}
.header-emblem {
  height: 48px;
  width: 48px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.header-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 1px;
}
.header-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary);
  letter-spacing: 0.5px;
}
.header-site {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
}
@media (max-width: 600px) {
  .header-emblem { height: 40px; width: 40px; }
  .header-brand { font-size: 0.95rem; }
  .header-site { font-size: 0.62rem; letter-spacing: 0.12em; }
}

.header-tagline { display: none; } /* kept hidden for legacy callers */

.header-spacer { flex: 1; }

.site-switcher { display: flex; gap: var(--space-1); padding: 3px; background: var(--color-bg); border-radius: var(--radius-pill); border: 1px solid var(--color-border); }
.site-switcher button {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--color-text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: background-color var(--transition), color var(--transition);
  min-height: 36px;
}
.site-switcher button[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-surface);
}
.site-switcher button:hover:not([aria-pressed="true"]) { color: var(--color-primary); }

.user-pill { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-pill); font-size: 0.9rem; min-height: var(--touch-target); }
.user-pill .avatar { width: 28px; height: 28px; flex-shrink: 0; }
.user-pill-text { display: flex; flex-direction: column; line-height: 1.1; }
.user-pill-text .name { font-weight: 600; color: var(--color-text); }
.user-pill-text .role { font-size: 0.75rem; color: var(--color-text-muted); }

.demo-pill {
  background: rgba(0, 0, 0, 0.04);
  border: 1px dashed var(--color-border-strong);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.sign-in-as { position: relative; }
.sign-in-as summary { list-style: none; cursor: pointer; min-height: var(--touch-target); display: flex; align-items: center; }
.sign-in-as summary::-webkit-details-marker { display: none; }
.sign-in-as[open] .sign-in-as-menu { display: block; }
.sign-in-as-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 260px;
  z-index: 60;
  padding: var(--space-2);
  max-height: 70vh;
  overflow-y: auto;
}
.sign-in-as-menu-title {
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
}
.sign-in-as-option {
  display: flex;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: var(--space-3);
  gap: var(--space-3);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition);
  align-items: center;
}
.sign-in-as-option:hover { background: var(--color-bg); }
.sign-in-as-option.active { background: var(--color-bg); }
.sign-in-as-option .avatar { width: 32px; height: 32px; flex-shrink: 0; }
.sign-in-as-option-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sign-in-as-option-text .name { font-weight: 600; }
.sign-in-as-option-text .role { font-size: 0.78rem; color: var(--color-text-muted); }

/* ----- 6. Tile grid and tile component ----- */

.tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 600px) { .tile-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .tile-grid { grid-template-columns: repeat(4, 1fr); } }

.tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background-color var(--transition-slow);
  min-height: 160px;
  position: relative;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-border-strong); }
.tile:active { transform: translateY(0); }

.tile-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}
.tile-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.tile-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; color: var(--color-primary); margin: 0; letter-spacing: 0; }
.tile-description { font-size: 0.92rem; color: var(--color-text-muted); margin: 0; flex: 1; }

.tile-status {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
}

.tile.dimmed {
  opacity: 0.55;
  pointer-events: auto;
}
.tile.dimmed:hover { transform: none; box-shadow: var(--shadow-sm); }
.tile.dimmed .tile-icon { background: transparent; }

/* ----- 7. Buttons ----- */

.btn {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  min-height: var(--touch-target);
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--color-primary); color: var(--color-surface); }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-primary:disabled { background: var(--color-border-strong); cursor: not-allowed; }
.btn-secondary { background: var(--color-surface); color: var(--color-primary); border: 1px solid var(--color-border-strong); }
.btn-secondary:hover { background: var(--color-bg); }
.btn-ghost { background: transparent; color: var(--color-primary); padding: var(--space-2) var(--space-3); }
.btn-ghost:hover { background: var(--color-bg); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: #95301F; }
.btn-block { width: 100%; }

/* ----- 8. Forms ----- */

.form-group { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.form-group.required label::after { content: ' *'; color: var(--color-danger); }
label { font-weight: 600; font-size: 0.92rem; color: var(--color-text); }
.help-text { font-size: 0.82rem; color: var(--color-text-muted); }

input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="password"], textarea, select {
  width: 100%;
  padding: var(--space-3);
  min-height: var(--touch-target);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent);
}
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' width='20' height='20' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }

.checkbox-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
@media (min-width: 600px) { .checkbox-grid { grid-template-columns: 1fr 1fr; } }
.checkbox-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); cursor: pointer; min-height: var(--touch-target); transition: border-color var(--transition), background-color var(--transition); }
.checkbox-item:hover { border-color: var(--color-border-strong); }
.checkbox-item input { width: 20px; height: 20px; accent-color: var(--color-primary); margin: 0; }
.checkbox-item.checked { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)); }

.photo-upload {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  background: var(--color-surface);
  transition: border-color var(--transition), background-color var(--transition);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.photo-upload.dragover { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)); }
.photo-upload .avatar-preview { width: 100px; height: 100px; border-radius: var(--radius-pill); object-fit: cover; }

.field-row { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
@media (min-width: 600px) { .field-row { grid-template-columns: 1fr 1fr; } }
@media (min-width: 600px) { .field-row-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* ----- 9. Badges, chips, avatars ----- */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; }
.badge-live { background: color-mix(in srgb, var(--color-success) 18%, var(--color-surface)); color: var(--color-success); }
.badge-phase { background: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge-admin { background: color-mix(in srgb, var(--color-accent) 22%, var(--color-surface)); color: var(--color-accent-dark); }
.badge-compliance { background: color-mix(in srgb, var(--color-warning) 18%, var(--color-surface)); color: var(--color-warning); }

/* Beta banner — shown across the top of every page in a not-yet-live module.
   Rendered via GRAND.betaBannerHtml(slug); collapses to nothing once live. */
.beta-banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; margin-bottom: var(--space-4);
  background: color-mix(in srgb, var(--color-warning) 14%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-warning) 45%, var(--color-surface));
  border-radius: var(--radius-lg); color: var(--color-text); font-size: 0.86rem; line-height: 1.4; }
.beta-banner-tag { flex: none; background: var(--color-warning); color: #fff; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; font-size: 0.66rem; padding: 3px 9px; border-radius: var(--radius-pill); }

/* Compliance RAG status chips (dashboard + contractor tracker) */
.rag-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; white-space: nowrap; }
.rag-current  { background: color-mix(in srgb, var(--color-success) 18%, var(--color-surface)); color: var(--color-success); }
.rag-due_soon { background: color-mix(in srgb, var(--color-warning) 20%, var(--color-surface)); color: var(--color-warning); }
.rag-warning  { background: color-mix(in srgb, var(--color-warning) 20%, var(--color-surface)); color: var(--color-warning); }
.rag-partial  { background: color-mix(in srgb, var(--color-warning) 20%, var(--color-surface)); color: var(--color-warning); }
.rag-expired  { background: color-mix(in srgb, var(--color-danger) 16%, var(--color-surface)); color: var(--color-danger); }
.rag-missing  { background: color-mix(in srgb, var(--color-danger) 16%, var(--color-surface)); color: var(--color-danger); border: 1px dashed color-mix(in srgb, var(--color-danger) 50%, var(--color-surface)); }
.rag-unknown  { background: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }

.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.78rem; background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text); }
.chip-primary { background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface)); border-color: var(--color-primary); color: var(--color-primary); }
.chip-accent { background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface)); border-color: var(--color-accent); color: var(--color-accent-dark); }

.avatar { width: 40px; height: 40px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--color-primary) 18%, var(--color-surface)); color: var(--color-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; flex-shrink: 0; }
.avatar-lg { width: 80px; height: 80px; font-size: 1.6rem; }

/* ----- 10. Toasts and modals ----- */

.toast {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--color-primary);
  color: var(--color-surface);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform var(--transition);
  max-width: 90vw;
  text-align: center;
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* Reusable progress card for long / multi-step tasks (GRAND.progress). */
.gr-progress {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%) translateY(160%);
  width: min(420px, 92vw);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.8rem 1rem 0.9rem;
  z-index: 140;
  transition: transform 0.24s ease;
}
.gr-progress.show { transform: translateX(-50%) translateY(0); }
.gr-progress .grp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; margin-bottom: 0.5rem; }
.gr-progress .grp-label { font-weight: 700; font-size: 0.9rem; color: var(--color-text); }
.gr-progress .grp-count { font-size: 0.78rem; color: var(--color-text-muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.gr-progress .grp-track { height: 8px; border-radius: 999px; background: var(--color-bg); overflow: hidden; }
.gr-progress .grp-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--color-primary); transition: width 0.2s ease; }
.gr-progress.done .grp-fill { background: var(--color-success); }
.gr-progress.fail .grp-fill { background: var(--color-danger); }
.gr-progress.fail .grp-label { color: var(--color-danger); }
.gr-progress.indeterminate .grp-fill { width: 40% !important; animation: grp-indet 1.1s ease-in-out infinite; }
@keyframes grp-indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: var(--space-4);
}
.modal-backdrop.visible { display: flex; }
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  /* keep the modal within the viewport: the body scrolls, title + actions stay put */
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-title { margin-bottom: var(--space-3); flex: 0 0 auto; }
.modal-body { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-5); flex: 0 0 auto; }

/* ----- 11. Tables and lists ----- */

.table-wrap { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: var(--space-3) var(--space-4); text-align: left; border-bottom: 1px solid var(--color-border); }
th { font-weight: 700; font-size: 0.85rem; letter-spacing: 0.5px; text-transform: uppercase; color: var(--color-text-muted); background: var(--color-bg); }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; transition: background-color var(--transition); }
tr.clickable:hover { background: var(--color-bg); }

.user-card-list { display: flex; flex-direction: column; gap: var(--space-2); }
.user-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer; transition: border-color var(--transition); }
.user-card:hover { border-color: var(--color-primary); }
.user-card-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.user-card-name { font-weight: 600; color: var(--color-text); }
.user-card-meta { font-size: 0.85rem; color: var(--color-text-muted); }
.user-card-tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ----- 12. Utilities ----- */

.hide { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-3 { margin-top: var(--space-3); }
.mt-5 { margin-top: var(--space-5); }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: var(--space-3); }
.mb-5 { margin-bottom: var(--space-5); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.attention-widget {
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-accent) 25%, var(--color-border));
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.attention-widget-icon { width: 44px; height: 44px; flex-shrink: 0; color: var(--color-accent-dark); }
.attention-widget-text { flex: 1; }
.attention-widget-text h3 { margin: 0 0 4px 0; color: var(--color-accent-dark); font-size: 1rem; font-family: var(--font-body); font-weight: 700; letter-spacing: normal; }
.attention-widget-text p { margin: 0; color: var(--color-text-muted); font-size: 0.92rem; }

.empty-state { text-align: center; padding: var(--space-7) var(--space-5); color: var(--color-text-muted); }
.empty-state h3 { color: var(--color-text-muted); margin-bottom: var(--space-2); }

.completion-banner {
  background: var(--color-primary);
  color: var(--color-surface);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}
.completion-banner h2 { color: var(--color-surface); margin: 0 0 var(--space-2) 0; }
.completion-banner p { margin: 0; opacity: 0.92; }

.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); margin-bottom: var(--space-4); }
.filter-bar select, .filter-bar input { min-height: 38px; padding-block: 6px; }
.filter-bar .filter-label { font-size: 0.8rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.8px; align-self: center; margin-right: var(--space-2); }

/* ============================================================
   13. Hybrid landing: hero band, stats bar, attention, nugget,
   featured tile, admin band. Per-site visual treatments.
   ============================================================ */

/* Section that breaks out of the centered .main container */
.bleed {
  position: relative;
  margin-left: calc(-1 * var(--space-4));
  margin-right: calc(-1 * var(--space-4));
}
@media (min-width: 768px) {
  .bleed {
    margin-left: calc(-1 * var(--space-5));
    margin-right: calc(-1 * var(--space-5));
  }
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0;
}
.eyebrow-on-dark { color: var(--color-accent); }

/* ----- 13a. Hero band ----- */
.hero-band {
  position: relative;
  padding: 56px 24px 48px;
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
}
@media (min-width: 768px) {
  .hero-band { padding: 88px 56px 72px; }
}
.hero-band-inner { position: relative; z-index: 2; max-width: 720px; }
.hero-band h1 {
  font-family: var(--font-heading);
  font-weight: 300;
  font-size: 2.5rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  margin: 12px 0 16px;
}
@media (min-width: 768px) {
  .hero-band h1 { font-size: 3.5rem; }
}
.hero-band p.lead {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.05rem;
  margin: 0;
  max-width: 560px;
}
@media (min-width: 768px) {
  .hero-band p.lead { font-size: 1.15rem; }
}

/* Shared geometric pattern under every hero. Per-site differences are colour gradient overlays only. */
.hero-band {
  background-image: url('hero-pattern.png');
  background-size: 480px;
  background-repeat: repeat;
  background-position: center;
}
.hero-band::before {
  content: '';
  position: absolute; inset: 0;
  z-index: 1;
}
body.site-lytham .hero-band::before {
  background: linear-gradient(135deg, rgba(47, 93, 116, 0.94) 0%, rgba(27, 61, 79, 0.96) 100%);
}
body.site-grasmere .hero-band::before {
  background: linear-gradient(135deg, rgba(42, 42, 41, 0.94) 0%, rgba(60, 60, 58, 0.96) 100%);
}
body.site-grand22 .hero-band::before {
  background: linear-gradient(135deg, rgba(10, 10, 10, 0.92) 0%, rgba(10, 10, 10, 0.88) 60%, rgba(0, 0, 0, 0.95) 100%);
}

/* Emblem watermark in hero (top-right) */
.hero-emblem {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 100px;
  height: 100px;
  opacity: 0.18;
  z-index: 1;
  filter: brightness(0) invert(1);
}
@media (min-width: 768px) {
  .hero-emblem { width: 140px; height: 140px; top: 32px; right: 40px; }
}

/* ----- 13b. Stats bar ----- */
.stat-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
}
@media (min-width: 600px) {
  .stat-bar { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .stat-bar { grid-template-columns: repeat(5, 1fr); }
}
.stat-cell {
  padding: var(--space-4) var(--space-4);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.stat-cell:last-child { border-right: 0; }
.stat-cell .label {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}
.stat-cell .value {
  display: block;
  font-family: var(--font-heading);
  font-weight: 300;
  font-size: 1.6rem;
  color: var(--color-primary);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.stat-cell .value.warn { color: var(--color-warning, #C28A3D); }
.stat-cell .value.alert { color: var(--color-danger, #B53A2B); }
/* Grand22 stat bar uses the same shape as the hotels */

/* ----- 13c. Attention card (gold gradient) ----- */
.attention-card {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: #FFFFFF;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  position: relative;
  overflow: hidden;
}
.attention-card::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  background-image: var(--emblem-url, none);
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.12;
  filter: brightness(0) invert(1);
}
.attention-card .badge {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.attention-card .body { flex: 1; }
.attention-card h3 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.1rem;
  color: #FFFFFF;
  margin: 0 0 4px;
  letter-spacing: 0;
}
.attention-card p { color: rgba(255, 255, 255, 0.92); margin: 0; font-size: 0.95rem; }
/* Grand22 attention card: same shape, but text needs darker contrast because the accent is light gold */
body.site-grand22 .attention-card { color: var(--color-primary); }
body.site-grand22 .attention-card h3 { color: var(--color-primary); }
body.site-grand22 .attention-card p { color: rgba(10, 10, 10, 0.78); }
body.site-grand22 .attention-card .badge { background: rgba(10, 10, 10, 0.18); color: var(--color-primary); }

/* ----- 13d. Section divider with emblem ----- */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-4);
}
.section-divider .line {
  flex: 1;
  height: 1px;
  background: var(--color-border-strong);
}
.section-divider .emblem-dot {
  width: 28px;
  height: 28px;
  opacity: 0.6;
}
.section-divider h2 {
  margin: 0;
  font-size: 1.5rem;
  white-space: nowrap;
}
@media (min-width: 768px) {
  .section-divider h2 { font-size: 1.875rem; }
}

/* ----- 13e. Featured tile (large) and small tile grid ----- */
.featured-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
@media (min-width: 900px) {
  .featured-grid {
    grid-template-columns: 1.4fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
}
.featured-tile {
  position: relative;
  background: var(--color-primary);
  color: #FFFFFF;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 240px;
  overflow: hidden;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition);
}
@media (min-width: 900px) {
  .featured-tile { grid-row: span 2; min-height: 340px; padding: var(--space-6); }
}
.featured-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.featured-tile::after {
  content: '';
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 280px;
  height: 280px;
  background-image: var(--emblem-url, none);
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.10;
  filter: brightness(0) invert(1);
}
.featured-tile > * { position: relative; z-index: 1; }
.featured-tile .eyebrow { color: var(--color-accent); }
.featured-tile h3 {
  font-family: var(--font-heading);
  font-weight: 300;
  font-size: 2rem;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  margin: 0;
}
@media (min-width: 768px) { .featured-tile h3 { font-size: 2.5rem; } }
.featured-tile p { color: rgba(255, 255, 255, 0.82); margin: 0; flex: 1; max-width: 420px; }
.featured-tile .featured-cta {
  align-self: flex-start;
  background: var(--color-accent);
  color: var(--color-primary);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--transition);
}
.featured-tile .featured-cta:hover { background: var(--color-accent-dark); }
/* Grand22 featured tile uses the same shape and typography as the hotels */

/* Status-rich live tile (small, with chips) */
.live-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  min-height: 156px;
  position: relative;
}
.live-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-accent); }
.live-tile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.live-tile-icon { width: 36px; height: 36px; color: var(--color-accent); }
.live-tile-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.7; }
.live-tile h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary);
  margin: 0;
  letter-spacing: 0;
}
.live-tile p {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin: 0;
  flex: 1;
  line-height: 1.45;
}
.live-tile .meta-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--color-border);
  margin-top: 2px;
}
.live-tile .meta-chip {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 600;
}
.live-tile .meta-chip.warn { background: color-mix(in srgb, var(--color-warning, #C28A3D) 18%, transparent); color: var(--color-warning, #C28A3D); }
.live-tile .meta-chip.alert { background: color-mix(in srgb, var(--color-danger, #B53A2B) 18%, transparent); color: var(--color-danger, #B53A2B); }
.live-tile.dim { opacity: 0.62; }
.live-tile.dim:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--color-border); }
/* Grand22 live tiles use the same shape as the hotels */

/* ----- 13f. Nugget card (fact / tip of the day) ----- */
.nugget-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-4);
  align-items: center;
  margin-bottom: var(--space-5);
}
.nugget-card .nugget-kind {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 700;
  flex-shrink: 0;
  min-width: 88px;
}
.nugget-card .nugget-body {
  font-style: italic;
  color: var(--color-text);
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 0;
}
/* Grand22 nugget card uses the same shape and italic body as the hotels */

/* ----- 13g. Admin band (deep, distinct zone) ----- */
.admin-band {
  position: relative;
  padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--space-6);
  color: #FFFFFF;
}
@media (min-width: 768px) {
  .admin-band { padding: var(--space-7) var(--space-6); }
}
body.site-lytham .admin-band {
  background: linear-gradient(135deg, #0F2A38 0%, #1B3D4F 100%);
}
body.site-grasmere .admin-band {
  background: linear-gradient(135deg, #1A1A19 0%, #2A2A29 100%);
}
body.site-grand22 .admin-band {
  background: linear-gradient(135deg, #000000 0%, #1A1A1A 100%);
}
.admin-band::after {
  content: '';
  position: absolute;
  right: -80px;
  top: -80px;
  width: 300px;
  height: 300px;
  background-image: var(--emblem-url, none);
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.08;
  filter: brightness(0) invert(1);
}
.admin-band > * { position: relative; z-index: 1; }
.admin-band .eyebrow { color: var(--color-accent); }
.admin-band h2 {
  font-family: var(--font-heading);
  font-weight: 300;
  font-size: 1.875rem;
  color: #FFFFFF;
  margin: 6px 0 var(--space-5);
  letter-spacing: -0.01em;
}
/* Grand22 admin band heading uses the same Lato Light treatment as the hotels */
.admin-tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
@media (min-width: 600px) { .admin-tile-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .admin-tile-grid { grid-template-columns: 1fr 1fr 1fr; } }
.admin-tile {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  text-decoration: none;
  color: #FFFFFF;
  transition: background-color var(--transition), border-color var(--transition);
  min-height: 140px;
}
.admin-tile:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--color-accent); }
.admin-tile-icon { width: 32px; height: 32px; color: var(--color-accent); }
.admin-tile-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.7; }
.admin-tile h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: #FFFFFF;
  margin: 0;
}
.admin-tile p { color: rgba(255, 255, 255, 0.78); font-size: 0.88rem; margin: 0; flex: 1; }
/* Grand22 admin tiles use the same shape as the hotels */

/* ----- 13h. Soon-grid (smaller dimmed tiles for Phase 4/5) ----- */
.soon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
@media (min-width: 768px) { .soon-grid { grid-template-columns: repeat(4, 1fr); } }
.soon-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  opacity: 0.78;
  cursor: pointer;
  transition: opacity var(--transition), border-color var(--transition);
  min-height: 116px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.soon-tile:hover { opacity: 1; border-color: var(--color-accent); }
.soon-tile .badge { font-size: 0.62rem; padding: 2px 8px; letter-spacing: 0.1em; align-self: flex-start; }
.soon-tile h5 { font-family: var(--font-heading); font-weight: 700; font-size: 0.95rem; color: var(--color-primary); margin: 4px 0 2px; }
.soon-tile p { font-size: 0.8rem; color: var(--color-text-muted); margin: 0; line-height: 1.4; }
/* Grand22 soon tiles use the same shape as the hotels */

/* ============================================================
   Reusable status timeline (issues, maintenance, any lifecycle)
   Render via GRAND.statusTimeline([{label, done, current}]).
   ============================================================ */
.status-timeline { display: flex; align-items: flex-start; margin: 0.6rem 0; }
.status-timeline .tl-step {
  flex: 1 1 0; min-width: 56px; position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.status-timeline .tl-step::before {
  content: ''; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px;
  background: var(--color-border); z-index: 0;
}
.status-timeline .tl-step:first-child::before { display: none; }
.status-timeline .tl-step.done::before { background: #4c9a6d; }
.status-timeline .tl-dot {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--color-border);
  background: #fff; color: #fff; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
.status-timeline .tl-step.done .tl-dot { background: #4c9a6d; border-color: #4c9a6d; }
.status-timeline .tl-step.current .tl-dot { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(209, 152, 116, 0.25); }
.status-timeline .tl-label { font-size: 0.68rem; color: var(--color-text-muted); margin-top: 0.28rem; line-height: 1.2; }
.status-timeline .tl-step.done .tl-label,
.status-timeline .tl-step.current .tl-label { color: var(--color-text); font-weight: 600; }

/* =================================================================
   App shell — persistent left sidebar (global navigation)
   Injected by GRAND.renderHeader on every signed-in page. On wide
   screens it sits to the left of the content; below 900px it becomes
   a slide-in drawer toggled by a hamburger in the header.
   ================================================================= */
.app-body { flex: 1; display: flex; align-items: flex-start; width: 100%; }
.app-sidebar {
  flex: 0 0 214px; width: 214px; align-self: stretch;
  background: var(--color-surface); border-right: 1px solid var(--color-border);
  position: sticky; top: var(--hdr-h, 61px);
  max-height: calc(100vh - var(--hdr-h, 61px)); overflow-y: auto;
  padding: 0.7rem 0.55rem 2rem; z-index: 40;
}
.app-body > .main { flex: 1 1 auto; min-width: 0; }
.nav-group { margin-bottom: 0.1rem; }
/* Collapsible section header (accordion). Tap to expand its sub-items. */
.nav-ghead {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.62rem 0.6rem; border: 0; background: transparent; cursor: pointer;
  border-radius: var(--radius-md); font-family: inherit; text-align: left;
  font-size: 0.9rem; font-weight: 700; color: var(--color-text); line-height: 1.2;
}
.nav-ghead:hover { background: var(--color-bg); }
.nav-ghead .ng-ic { width: 18px; height: 18px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); }
.nav-ghead .ng-ic svg { width: 18px; height: 18px; }
.nav-ghead .ng-label { flex: 1 1 auto; }
.nav-ghead .ng-chev { width: 15px; height: 15px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); transition: transform 0.2s ease; }
.nav-ghead .ng-chev svg { width: 15px; height: 15px; }
.nav-group.open > .nav-ghead { color: var(--color-primary); }
.nav-group.open > .nav-ghead .ng-ic { color: var(--color-primary); }
.nav-group.open > .nav-ghead .ng-chev { transform: rotate(90deg); color: var(--color-primary); }
/* Sub-items: clipped to 0 height when collapsed, revealed when the group is open. */
.nav-sub { overflow: hidden; max-height: 0; transition: max-height 0.24s ease; }
.nav-group.open > .nav-sub { max-height: 460px; }
.nav-sub-inner { margin: 0.1rem 0 0.3rem 1.2rem; padding-left: 0.35rem; border-left: 1px solid var(--color-border); }
.nav-item {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.44rem 0.6rem;
  border-radius: var(--radius-md); font-size: 0.85rem; font-weight: 600;
  color: var(--color-text); text-decoration: none; margin-bottom: 0.08rem; line-height: 1.2;
}
.nav-item.nav-solo { margin-bottom: 0.45rem; font-weight: 700; }
.nav-item:hover { background: var(--color-bg); }
.nav-item.on { background: var(--color-primary); color: #fff; }
.nav-item .ni-ic { width: 18px; height: 18px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); }
.nav-item .ni-ic svg { width: 18px; height: 18px; }
.nav-item:hover .ni-ic { color: var(--color-text); }
.nav-item.on .ni-ic { color: #fff; }

/* hamburger lives in the header; hidden on wide screens */
.nav-burger {
  display: none; width: 38px; height: 34px; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-bg); cursor: pointer;
  flex-direction: column; gap: 3px; align-items: center; justify-content: center; flex: 0 0 auto;
}
.nav-burger span { width: 16px; height: 2px; background: var(--color-primary); border-radius: 2px; }
.app-scrim {
  position: fixed; inset: 0; background: var(--color-overlay, rgba(20,30,38,.42));
  z-index: 110; opacity: 0; pointer-events: none; transition: opacity 0.18s;
}

@media (max-width: 900px) {
  .nav-burger { display: flex; }
  .app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; max-height: none;
    width: 256px; flex-basis: 256px; transform: translateX(-100%);
    transition: transform 0.2s ease; box-shadow: 8px 0 34px rgba(0,0,0,0.22); z-index: 130;
    padding-top: 0.6rem;
  }
  .app-sidebar.open { transform: none; }
  .app-scrim.open { opacity: 1; pointer-events: auto; }
  .app-body > .main { width: 100%; }
}
