/* ── Brand display font (MyWord) ──────────────────────────────────
 * The same face thegilpin.co.uk uses on its main headings.
 * Bundled locally from /static/fonts/ for performance + reliability
 * (no dependency on the marketing site being up).
 */
@font-face {
  font-family: 'MyWord';
  src: url('/static/fonts/MyWord.woff2') format('woff2'),
       url('/static/fonts/MyWord.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  /* MyWord maps every accented Latin letter (À–ÿ, bar Ñ/ñ) to an EMPTY glyph —
   * "Châteaux" and "Zoë" rendered with holes in them. Scope the face to the
   * ranges that actually have ink so accents fall through to Playfair Display. */
  unicode-range: U+0020-007E, U+00A3, U+00A9, U+00AE, U+00B0, U+00B7,
                 U+00D1, U+00F1, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC;
}

/*
 * ═══════════════════════════════════════════════════════════════
 *  GILPIN DIAMOND DESIGN SYSTEM — Full Reference Sheet for Billy
 *  Version: 1.1 | April 2026
 *
 *  Sections:
 *   1. Design Tokens (CSS custom properties — all colours, spacing, etc.)
 *   2. Base Styles (body, scrollbar, typography, focus rings)
 *   3. Navbar
 *   4. Nav Action Buttons
 *   5. View Tabs (secondary tab bar)
 *   6. Badge System
 *   7. Status Pills
 *   8. Notification Toasts
 *   9. Animations & Keyframes
 *  10. Utility Classes
 *
 *  HOW TO USE:
 *  ─────────────────────────────────────────────────────────────
 *  1. Link this file FIRST in your <head>, before your own CSS:
 *     <link rel="stylesheet" href="gilpin-design-reference.css">
 *
 *  2. Add the Google Fonts link to your <head>:
 *     <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@400;500;600;700;900&display=swap" rel="stylesheet">
 *
 *  3. Set the theme on your root element:
 *     <html data-theme="dark">  ← default (preferred)
 *     <html data-theme="light"> ← light variant
 *
 *  4. Replace your existing colours / fonts with CSS variables:
 *     background: #f5f0eb  →  background: var(--bg-base)
 *     font-family: Helvetica  →  font-family: var(--font-sans)
 *     color: #333  →  color: var(--text-main)
 *
 *  KEY VALUES AT A GLANCE:
 *  Gold:        #C46A3A   var(--gilpin-gold)
 *  Dark bg:     #070707   var(--bg-base) in dark mode
 *  Light bg:    #fdfaf3   var(--bg-base) in light mode
 *  Serif font:  Playfair Display  var(--font-serif)
 *  Sans font:   Inter             var(--font-sans)
 *  Nav height:  70px      var(--nav-height)
 * ═══════════════════════════════════════════════════════════════
 */


/* ═══════════════════════════════════════════
   1. DESIGN TOKENS
   ═══════════════════════════════════════════ */

:root {
  /* ── Brand ── */
  --gilpin-gold:       #C46A3A;
  --gilpin-gold-light: #D68255;
  --gilpin-gold-dark:  #A3552A;

  /* ── Light mode colours ── */
  --bg-base:    #fdfaf3;
  --bg-dots:    #e8e1d4;
  --surface:    rgba(255, 255, 255, 0.7);
  --nav-bg:     rgba(253, 250, 243, 0.85);
  --nav-text:   #0f172a;
  --border-ui:  #C46A3A;
  --border-subtle: rgba(196, 106, 58, 0.2);

  /* ── Text ── */
  --text-main:    #0f172a;
  --text-muted:   #475569;
  --text-faint:   #94a3b8;

  /* ── Status colours ── */
  --color-success: #10b981;
  --color-error:   #ef4444;
  --color-warning: #f59e0b;
  --color-info:    #3b82f6;
  --color-vip:     #8b5cf6;

  /* ── Badge metals (badge/medal icons only — never the brand copper) ── */
  --medal-bronze: #9a5b34;
  --medal-silver: #8b95a3;
  --medal-gold:   #c9a227;

  /* ── Typography ── */
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Brand display font — matches the "MyWord" face used on thegilpin.co.uk for h1/h2/h3. */
  --font-display: 'MyWord', 'Playfair Display', Georgia, serif;

  /* ── Sizing ── */
  --nav-height:   70px;
  --alert-height: 28px;

  /* ── Spacing scale ── */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* ── Border radius ── */
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-2xl:  1.25rem;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm:  0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-lux: 0 20px 40px -10px rgba(0, 0, 0, 0.08);

  /* ── Animation ── */
  --duration-fast:   150ms;
  --duration-normal: 300ms;
  --duration-slow:   500ms;
  --ease-out:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce:     cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-premium:    cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Z-index ── */
  --z-dropdown: 100;
  --z-sticky:   500;
  --z-modal:    1000;
  --z-navbar:   1010;
  --z-toast:    9999;
}

/* Dark mode overrides */
[data-theme="dark"] {
  --bg-base:       #070707;
  --bg-dots:       #1a1a1a;
  --surface:       rgba(15, 15, 15, 0.8);
  --nav-bg:        rgba(7, 7, 7, 0.85);
  --nav-text:      #f8fafc;
  --border-ui:     rgba(196, 106, 58, 0.4);
  --border-subtle: rgba(196, 106, 58, 0.15);
  --text-main:     #f8fafc;
  --text-muted:    #94a3b8;
  --text-faint:    #64748b;
  --shadow-lux:    0 30px 60px -15px rgba(0, 0, 0, 0.9);
  --medal-bronze:  #ad7f55;
  --medal-silver:  #aab4c2;
  --medal-gold:    #d9b440;
}


/* ═══════════════════════════════════════════
   2. BASE STYLES
   ═══════════════════════════════════════════ */

html {
  scroll-behavior: smooth;
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--text-main);
  margin: 0;
  min-height: 100%;
  transition: background-color 0.6s var(--ease-out);
  overflow-x: hidden;
  line-height: 1.5;
  touch-action: manipulation;
}

/* ── Responsive media safety net ──────────────────────────────────
 * Stops any raw <img>/<video> a page drops in (SOP images, maps,
 * thumbnails) from overflowing narrow screens. Class-sized media
 * (.std-logo, .gilpin-wordmark) keep their explicit sizing because a
 * class selector out-ranks this element rule; scroll-wrapped wide
 * images keep their min-width because min-width beats max-width.
 */
img, video {
  max-width: 100%;
  height: auto;
}

/* Premium gold scrollbar */
::-webkit-scrollbar       { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(196, 106, 58, 0.25);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(196, 106, 58, 0.45);
  background-clip: content-box;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(196, 106, 58, 0.35);
  background-clip: content-box;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(196, 106, 58, 0.55);
  background-clip: content-box;
}

/* Gold focus rings */
input:focus, textarea:focus, select:focus,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(196, 106, 58, 0.4),
              0 0 12px rgba(196, 106, 58, 0.15) !important;
  border-color: var(--gilpin-gold) !important;
  transition: box-shadow 0.2s ease;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  color: #f5f5f4;
}


/* ═══════════════════════════════════════════
   3. NAVBAR
   ═══════════════════════════════════════════ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-ui);
  z-index: var(--z-navbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-sizing: border-box;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  color: var(--nav-text);
}

[data-theme="dark"] .navbar {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}


/* ═══════════════════════════════════════════
   3b. STANDARD HEADER — left cluster (shared)
   Back + logo→/welcome + "Plato › Section" breadcrumb.
   New class names so per-page inline .top-bar styles can't override these.
   Rendered by templates/_nav_left.html.
   ═══════════════════════════════════════════ */

.std-nav-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.std-nav-back {
  flex-shrink: 0; cursor: pointer; font-family: var(--font-sans);
  width: 34px; height: 34px; border-radius: 50%; font-size: 18px; line-height: 1;
  background: transparent; border: 1px solid var(--border-ui); color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .2s, border-color .2s, background .2s;
}
.std-nav-back:hover { color: var(--gilpin-gold); border-color: var(--gilpin-gold); background: rgba(196, 106, 58, 0.08); }

.std-nav-home { display: inline-flex; flex-shrink: 0; line-height: 0; }
.std-logo {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid rgba(196, 106, 58, 0.3); display: block; flex-shrink: 0;
}

.std-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.std-crumb {
  font-family: var(--font-serif); font-size: 20px; font-weight: 600;
  color: var(--text-main); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s;
}
/* Shrink weighting: flexbox distributes shrink by base size, so the longest
   crumb — always the CURRENT page — used to ellipsize first while its
   ancestors survived. Invert that: ancestors are the sacrificial ones. */
.std-crumb:not(.is-current) { flex-shrink: 4; }
.std-crumb:hover { color: var(--gilpin-gold); }
.std-crumb.is-current { color: var(--gilpin-gold); }
.std-crumb-sep { flex-shrink: 0; color: var(--text-faint); font-size: 18px; }
.std-admin-links { display: contents; }

/* Right-cluster layout guard. Several pages ship a .nav-right /
   .top-bar-right with no CSS of their own, leaving a block container that
   wraps the account pill onto its own line. Zero-specificity (:where) so any
   page-level rule, loaded after this file, still wins every tie. */
:where(.top-bar, .navbar) > :where(.nav-right, .top-bar-right, .navbar-right) {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}

/* Identity chip — "Signed in as <name> · Sign out" (templates/_nav_left.html). */
.std-signed-in { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-sans); font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.std-signed-in strong { color: var(--text-main); }
.std-signed-in a { color: var(--gilpin-gold); text-decoration: none; }
.std-signed-in a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .std-nav-left { gap: 10px; }
  .std-crumb { font-size: 17px; }
  /* Keep a comfortable touch target on the back button (was 30px). */
  .std-nav-back { width: 40px; height: 40px; font-size: 17px; }
  /* Phones: the trail collapses to just the current page — the back button
     and logo already provide "up", and a full "Plato › Section › Page" trail
     was being crushed to one letter per crumb by the right cluster.
     :only-child keeps the bare root ("Plato" / "Prof Plato") on pages that
     set no section or page crumb. */
  .std-crumbs { flex: 1; }
  .std-crumbs .std-crumb-sep { display: none; }
  .std-crumbs .std-crumb:not(.is-current):not(:only-child) { display: none; }
  .std-crumb.is-current { flex: 1 1 auto; min-width: 0; }
  /* Prof Plato's Issue Log / Health quick links compete with the crumb for
     the same flex row (display:contents) — desktop-only. */
  .std-admin-links { display: none; }
  /* Prof Plato's Install / Notifications buttons are desktop affordances;
     in the phone bar there is no room for labelled buttons. */
  :where(.nav-right, .top-bar-right, .navbar-right) .nav-cross-link { display: none; }
}
@media (max-width: 480px) {
  .std-crumb { font-size: 15px; }
  .std-logo { width: 34px; height: 34px; }
}

/* Tappable links inside Plato's chat replies (e.g. "go to Log an Issue"). */
.bot-link {
  color: var(--gilpin-gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bot-link:hover { color: var(--gilpin-gold-light, var(--gilpin-gold)); }


/* ═══════════════════════════════════════════
   4. NAV ACTION BUTTONS
   ═══════════════════════════════════════════ */

.nav-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  border: 1.5px solid rgba(196, 106, 58, 0.3);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--nav-text);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring),
              background-color 0.15s ease,
              box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.nav-action-btn:hover {
  background: rgba(196, 106, 58, 0.15);
  border-color: var(--gilpin-gold);
  transform: scale(1.06) translateY(-1px);
  box-shadow: 0 4px 16px rgba(196, 106, 58, 0.25),
              0 0 0 2px rgba(196, 106, 58, 0.1);
}

.nav-action-btn:active { transform: scale(0.94); }

.nav-action-btn--active {
  background: var(--gilpin-gold) !important;
  color: white !important;
  border-color: var(--gilpin-gold) !important;
  box-shadow: 0 4px 16px rgba(196, 106, 58, 0.4);
}

[data-theme="dark"] .nav-action-btn { background: rgba(255, 255, 255, 0.06); }
[data-theme="light"] .nav-action-btn { background: rgba(0, 0, 0, 0.04); color: #1e293b; }

/* Theme toggle button */
.theme-toggle-btn.nav-action-btn {
  padding: 8px 10px;
  min-width: unset;
  line-height: 1;
}
.theme-toggle-btn svg {
  display: block;
}


/* ═══════════════════════════════════════════
   5. VIEW TABS (secondary tab bar)
   ═══════════════════════════════════════════ */

.dashboard-view-tabs {
  z-index: 1005;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--gilpin-gold);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.view-tabs-container {
  display: flex;
  gap: 6px;
  padding: 2px;
  flex-wrap: wrap;
  justify-content: center;
}

.view-tab {
  flex-shrink: 0;
  padding: 8px 20px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  border: 1.5px solid rgba(196, 106, 58, 0.35);
  background: rgba(196, 106, 58, 0.12);
  color: var(--text-main);
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.view-tab:hover {
  background: rgba(196, 106, 58, 0.20);
  border-color: var(--gilpin-gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(196, 106, 58, 0.15);
}

.view-tab.active {
  background: var(--gilpin-gold);
  color: white;
  border-color: var(--gilpin-gold);
  box-shadow: 0 4px 16px rgba(196, 106, 58, 0.35);
  font-weight: 800;
}

/* Gold shimmer sweep on active tab */
.view-tab.active::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

[data-theme="dark"] .view-tab {
  background: rgba(196, 106, 58, 0.10);
  border-color: rgba(196, 106, 58, 0.30);
  color: #e2e8f0;
}


/* ═══════════════════════════════════════════
   6. BADGE SYSTEM
   ═══════════════════════════════════════════ */

.badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 10px;
  display: inline-block;
  margin: 1px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-sans);
}

.badge-gold {
  background: rgba(196, 106, 58, 0.15);
  color: var(--gilpin-gold);
  border: 1px solid rgba(196, 106, 58, 0.4);
}

.badge-vip {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-urgent {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: breathe 2s ease-in-out infinite;
}


/* ═══════════════════════════════════════════
   7. STATUS PILLS (connection / sync state)
   ═══════════════════════════════════════════ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.status-badge.connected {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

.status-badge.connecting {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

.status-badge.offline {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  cursor: pointer;
}

.status-badge:hover { transform: scale(1.05); }


/* ═══════════════════════════════════════════
   8. NOTIFICATION TOASTS
   ═══════════════════════════════════════════ */

.notification-toast-container {
  position: fixed;
  top: calc(var(--nav-height, 70px) + 10px);
  right: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(340px, calc(100vw - 32px));
  width: 100%;
  pointer-events: none;
}

.notification-toast-container > * { pointer-events: auto; }

.notification-toast {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-ui);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  position: relative;
  animation: toast-slide-in 0.35s var(--ease-bounce) forwards;
}

.notification-toast:hover {
  transform: translateX(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  border-color: var(--gilpin-gold);
}

.notification-toast-accent { width: 4px; flex-shrink: 0; }

.notification-toast-body {
  flex: 1;
  padding: 10px 12px;
  min-width: 0;
}

.notification-toast-dept {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notification-toast-message {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.notification-toast-guest {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--gilpin-gold);
  opacity: 0.6;
  animation: toast-progress linear forwards;
  width: 100%;
}


/* ═══════════════════════════════════════════
   9. ANIMATIONS & KEYFRAMES
   ═══════════════════════════════════════════ */

/* ── Entrance ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes card3DEntrance {
  from { opacity: 0; transform: perspective(800px) rotateX(8deg) translateY(30px) scale(0.92); }
  to   { opacity: 1; transform: perspective(800px) rotateX(0deg) translateY(0) scale(1); }
}

/* ── Loops ── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(196, 106, 58, 0.15); }
  50%       { box-shadow: 0 0 20px rgba(196, 106, 58, 0.3); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.06); opacity: 0.85; }
}

@keyframes floatingGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(196, 106, 58, 0.1), 0 4px 20px rgba(0,0,0,0.2); }
  50%       { box-shadow: 0 0 25px rgba(196, 106, 58, 0.25), 0 8px 30px rgba(0,0,0,0.15); }
}

@keyframes syncPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50%       { box-shadow: 0 0 6px 2px rgba(34, 197, 94, 0.2); }
}

/* ── Micro-interactions ── */
@keyframes statusChangePop {
  0%   { transform: scale(1); }
  20%  { transform: scale(1.28); }
  40%  { transform: scale(0.92); }
  60%  { transform: scale(1.08); }
  80%  { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@keyframes successRipple {
  0%   { box-shadow: 0 0 0 0 rgba(196, 106, 58, 0.5); }
  70%  { box-shadow: 0 0 0 14px rgba(196, 106, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(196, 106, 58, 0); }
}

@keyframes elasticScale {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.2); }
  50%  { transform: scale(0.9); }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes ripple {
  0%   { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}

/* ── UI transitions ── */
@keyframes toast-slide-in {
  0%   { opacity: 0; transform: translateX(100%); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes toast-progress {
  0%   { width: 100%; }
  100% { width: 0%; }
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

@keyframes tabSwitchIn {
  from { opacity: 0.6; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; transform: translateY(-8px); }
  to   { opacity: 1; max-height: 500px; transform: translateY(0); }
}

@keyframes skeletonShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Entrance utility classes ── */
.animate-entrance { animation: fadeSlideUp 0.5s var(--ease-premium) both; }
.animate-fade     { animation: fadeIn 0.4s ease both; }
.animate-scale    { animation: scaleIn 0.35s var(--ease-premium) both; }
.modal-enter      { animation: modalSlideUp 0.4s var(--ease-premium) both; }
.card-3d-enter    { animation: card3DEntrance 0.5s var(--ease-premium) both; }
.view-switch-animate { animation: tabSwitchIn 0.35s var(--ease-premium) both; }
.expand-row-enter { animation: slideDown 0.3s var(--ease-premium) both; overflow: hidden; }
.status-pop       { animation: statusChangePop 0.5s var(--ease-spring); }
.success-ripple   { animation: successRipple 0.6s ease-out; }
.elastic-pop      { animation: elasticScale 0.4s var(--ease-spring); }

/* ── Staggered delays ── */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.3s; }
.delay-7 { animation-delay: 0.35s; }

/* ── Persistent states ── */
.ai-highlighted { animation: floatingGlow 3s ease-in-out infinite; }
.sync-dot-connected { animation: syncPulse 3s ease-in-out infinite; }
.timeline-dot   { animation: glowPulse 2.5s ease-in-out infinite; }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, rgba(196, 106, 58, 0.08) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* ── Ripple click effect ── */
.ripple-container { position: relative; overflow: hidden; }
.ripple-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(196, 106, 58, 0.3) 0%, transparent 70%);
  transform: scale(0);
  opacity: 0;
  border-radius: inherit;
  pointer-events: none;
}
.ripple-container:active::after { animation: ripple 0.6s ease-out; }

/* ── Table row staggered entrance ── */
tbody tr {
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
  animation: fadeSlideUp 0.3s var(--ease-premium) both;
  will-change: opacity, transform;
  contain: layout style;
}
tbody tr:nth-child(1)  { animation-delay: 0.02s; }
tbody tr:nth-child(2)  { animation-delay: 0.04s; }
tbody tr:nth-child(3)  { animation-delay: 0.06s; }
tbody tr:nth-child(4)  { animation-delay: 0.08s; }
tbody tr:nth-child(5)  { animation-delay: 0.10s; }
tbody tr:nth-child(6)  { animation-delay: 0.12s; }
tbody tr:nth-child(7)  { animation-delay: 0.14s; }
tbody tr:nth-child(8)  { animation-delay: 0.16s; }
tbody tr:nth-child(9)  { animation-delay: 0.18s; }
tbody tr:nth-child(10) { animation-delay: 0.20s; }
tbody tr:nth-child(n+11) { animation-delay: 0.22s; }

tbody tr:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  z-index: 2;
  position: relative;
}

[data-theme="dark"] tbody tr:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ═══════════════════════════════════════════
   10. UTILITY CLASSES
   ═══════════════════════════════════════════ */

.heading-font       { font-family: var(--font-serif); }
.brand-heading      { font-family: var(--font-display); }
.text-gilpin-gold   { color: var(--gilpin-gold); }

/* ── Gilpin wordmark ──────────────────────────────────────────────
 * Drop-in replacement for the old "GILPIN HOTEL & LAKE HOUSE" uppercase
 * text label. Default is a small inline wordmark suitable for navbars;
 * use --lg for login/register card headers.
 * !important on sizing beats per-template img rules that would otherwise
 * try to stretch the image to fill flex containers.
 */
.gilpin-wordmark {
  height: 32px !important;
  width: auto !important;
  max-height: 32px !important;
  max-width: 160px !important;
  object-fit: contain !important;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.gilpin-wordmark--lg {
  height: 72px !important;
  max-height: 72px !important;
  max-width: 260px !important;
}
[data-theme="dark"] .gilpin-wordmark {
  filter: invert(1) brightness(1.1);
}

/* ── Brand-heading override ──────────────────────────────────────
 * Force the Gilpin MyWord display font onto the main per-page
 * headings across both apps. Uses !important because each template
 * sets its own font-family inline and would otherwise win on
 * specificity/source-order.
 * Covers:
 *   .top-bar h1        — Prof Plato admin pages, staff home top-bar
 *   .page-header h1    — admin.html, admin_progress.html, etc.
 *   .hero-title        — main staff home hero
 *   .welcome h2        — Plato / Prof Plato chat welcome screens
 *   .navbar-brand-title — chat.html trainer header
 */
.top-bar h1,
.page-header h1,
.hero-title,
.welcome h2,
.navbar-brand-title {
  font-family: var(--font-display) !important;
}

/* ── Navbar titles must stay on one line ─────────────────────────────────
 * Page titles in the top-left of every page (.nav-title, .navbar-title,
 * .navbar-brand-title — many small variants of the same idea) used to
 * wrap onto two lines on narrow viewports, e.g. "Plato — Your Trainer"
 * stacking on a phone. This rule keeps them on a single line, truncating
 * with an ellipsis if a title is genuinely too long for the viewport.
 * The min-width: 0 is essential — without it, the flex parent refuses
 * to let the title shrink and the ellipsis never kicks in.
 */
.navbar .nav-title,
.navbar .navbar-title,
.navbar .navbar-brand-title,
.nav-left .nav-title,
.nav-left .navbar-title,
.nav-left .navbar-brand-title,
.navbar-brand .navbar-brand-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
}
/* Allow the flex parent to actually shrink so ellipsis can fire. */
.navbar .nav-left,
.navbar .navbar-brand {
  min-width: 0;
  flex-shrink: 1;
}
.bg-gilpin-gold     { background-color: var(--gilpin-gold); }
.text-muted         { color: var(--text-muted); }
.transition-theme {
  transition: background-color var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out);
}

/* Tab notification dot */
.tab-badge-dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 900;
  color: white;
  border: 2px solid var(--bg-base, white);
  animation: badge-pulse 2s infinite;
}

/* Card hover lift */
.dashboard-stat-card {
  animation: fadeSlideUp 0.4s var(--ease-premium) both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dashboard-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .dashboard-stat-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}


/* ═══════════════════════════════════════════
   11. MOBILE RESPONSIVE — Global rules
   ═══════════════════════════════════════════ */

/* Tablet */
@media (max-width: 768px) {
  .navbar {
    padding: 0 16px;
    height: 60px;
  }
  :root { --nav-height: 60px; }
  [data-theme="dark"] { --nav-height: 60px; }

  .nav-action-btn {
    padding: 6px 12px;
    font-size: 9px;
  }

  .view-tab {
    padding: 6px 14px;
    font-size: 10px;
  }

  .dashboard-view-tabs {
    padding: 8px 12px;
  }

  /* Prevent iOS zoom-on-focus across the whole tablet/phone range.
   * iOS auto-zooms when a focused control is < 16px. Previously this
   * lived only in the <=480px block, leaving the 481–768px band
   * (iPad portrait, large phones in landscape) exposed; almost every
   * page ships 13–15px controls, so the fix belongs at <=768px. */
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .navbar {
    padding: 0 12px;
    height: 56px;
  }
  :root { --nav-height: 56px; }
  [data-theme="dark"] { --nav-height: 56px; }

  .nav-action-btn {
    padding: 5px 10px;
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .theme-toggle-btn.nav-action-btn {
    padding: 6px 8px;
  }

  .view-tab {
    padding: 5px 12px;
    font-size: 9px;
  }
  /* (iOS zoom-prevention input rule now lives in the <=768px block above
   * so the whole tablet range is covered, not just <=480px.) */
}


/* ═══════════════════════════════════════════
   12. PROF PLATO / ADMIN SHARED COMPONENTS
   Token-driven, additive (gp- prefix is unused elsewhere). Lets the
   admin pages share one polished card / table / form / empty-state
   vocabulary instead of each rolling its own inline styles.
   ═══════════════════════════════════════════ */

/* Surface card — pair with .dashboard-stat-card for the hover lift. */
.gp-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

/* Section label above a block of content. */
.gp-section-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 32px 0 16px;
}

/* Data table — consistent header / rows / hover across admin lists. */
.gp-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gp-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 14px;
}
.gp-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(196, 106, 58, 0.05);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.gp-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}
.gp-table tbody tr:last-child td { border-bottom: none; }
.gp-table tbody tr { transition: background var(--duration-fast) var(--ease-out); }
.gp-table tbody tr:hover { background: rgba(196, 106, 58, 0.04); }

/* Empty / no-results state. */
.gp-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}
.gp-empty-icon { font-size: 30px; opacity: 0.45; margin-bottom: 12px; display: block; }
.gp-empty-title { font-family: var(--font-serif); font-size: 18px; color: var(--text-main); margin-bottom: 6px; }

/* Form fields. */
.gp-field { margin-bottom: 16px; }
.gp-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.gp-input, .gp-select, .gp-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-base);
  border: 1px solid var(--border-ui);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.gp-input:focus, .gp-select:focus, .gp-textarea:focus {
  outline: none;
  border-color: var(--gilpin-gold);
  box-shadow: 0 0 0 3px rgba(196, 106, 58, 0.15);
}
.gp-textarea { resize: vertical; min-height: 88px; }

/* Prof Plato admin brand — compact circular favicon + wordmark, matching the
   plato_* family. Used in the admin navbars, where a full "Prof Plato › Page"
   breadcrumb won't fit alongside the button-heavy section nav. */
.pp-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.pp-brand img { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid rgba(196, 106, 58, 0.35); }
.pp-brand span { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--text-main); }


/* ═══════════════════════════════════════════
   13. MOBILE TOUCH-TARGET HARDENING (launch)
   Bumps the two most widespread interactive components up toward a
   comfortable ~44px tap target on phones/tablets. Appended last so it
   wins on source order over the earlier mobile blocks (§11).
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .nav-action-btn { min-height: 44px; padding: 8px 12px; }
  .view-tab       { min-height: 44px; padding: 12px 18px; }
}


/* ═══════════════════════════════════════════
   14. ACCOUNT MENU (avatar + dropdown)
   Employment-Hero-style account control. Collapses the old crowded row
   ("Signed in as X · Sign out" chip + My Profile + Sign Out + theme toggle)
   into one avatar button that opens a dropdown. See templates/_nav_account.html
   and static/account-menu.js.
   ═══════════════════════════════════════════ */
.acct-menu { position: relative; display: inline-flex; flex-shrink: 0; }

/* Any bar hosting the account menu must sit above page content. Most page
   headers carry backdrop-filter, which creates a stacking context that traps
   .acct-dropdown's z-index:1050 inside the bar; page cards with their own
   backdrop-filter then paint over the open dropdown purely by DOM order
   (seen on the Prof Plato dashboard, 2026-07-26). :where() keeps specificity
   at a single class, so pages that position their bar themselves (the fixed
   z-50 staff navbars in home/choose/operations/transport) still win with
   their own later-in-cascade declarations. */
.top-bar:where(:has(.acct-menu)),
.navbar:where(:has(.acct-menu)) {
  position: relative;
  z-index: 100;
}

.acct-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1.5px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.06);
  color: var(--nav-text);
  font-family: var(--font-sans);
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.2s var(--ease-spring);
}
[data-theme="light"] .acct-trigger { background: rgba(0, 0, 0, 0.04); }
.acct-trigger:hover { border-color: var(--gilpin-gold); background: rgba(196, 106, 58, 0.12); }
.acct-trigger:active { transform: scale(0.97); }
.acct-trigger:focus-visible { outline: 2px solid var(--gilpin-gold); outline-offset: 2px; }

.acct-avatar {
  position: relative;
  width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gilpin-gold), var(--gilpin-gold-light));
  color: #fff; font-family: var(--font-sans); font-weight: 700; font-size: 13px;
  flex-shrink: 0; text-transform: uppercase;
}
/* The initial is always rendered as the avatar's text; the photo (when set)
   overlays it. If the photo 404s/errors, `onerror` removes the <img> and the
   initial shows through — so a broken photo never leaves an empty "?" box. */
.acct-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.acct-avatar--lg { width: 44px; height: 44px; font-size: 18px; }

.acct-name {
  font-size: 14px; font-weight: 600; color: var(--text-main);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-chev { color: var(--text-muted); transition: transform 0.2s var(--ease-out); flex-shrink: 0; }
.acct-trigger[aria-expanded="true"] .acct-chev { transform: rotate(180deg); }

.acct-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 260px; max-width: calc(100vw - 24px);
  background: var(--surface);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  z-index: 1050;
  animation: acct-drop-in 0.16s var(--ease-out) both;
}
.acct-dropdown[hidden] { display: none; }
@keyframes acct-drop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.acct-dropdown-head { display: flex; align-items: center; gap: 12px; padding: 16px; }
.acct-identity { display: flex; flex-direction: column; min-width: 0; }
.acct-fullname { font-family: var(--font-sans); font-size: 15px; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.acct-email { font-size: 12px; color: var(--text-faint); line-height: 1.3; word-break: break-all; }

.acct-divider { height: 1px; background: var(--border-subtle); }

.acct-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; box-sizing: border-box;
  padding: 13px 16px; min-height: 46px;
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  color: var(--text-main); text-decoration: none;
  background: transparent; border: none; text-align: left; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.acct-item:hover { background: rgba(196, 106, 58, 0.1); color: var(--gilpin-gold); }
.acct-item:focus-visible { outline: 2px solid var(--gilpin-gold); outline-offset: -2px; }
.acct-item-chev { color: var(--text-muted); font-size: 18px; line-height: 1; }
.acct-item:hover .acct-item-chev { color: var(--gilpin-gold); }
.acct-signout { color: var(--gilpin-gold); font-weight: 600; }

/* "Finish profile setup" nudge — shown only when the admin has no department. */
.acct-item--attn { color: var(--color-error); font-weight: 600; }
.acct-item-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-error); flex-shrink: 0; }

/* "Plato (team app)" cross-app switch link (Prof Plato header) — styled globally
   so it reads consistently regardless of the host page's own nav CSS. */
.nav-cross-link { color: var(--text-muted); text-decoration: none; font-family: var(--font-sans); font-size: 13px; white-space: nowrap; transition: color 0.15s ease; }
.nav-cross-link:hover { color: var(--gilpin-gold); }

.acct-switch {
  position: relative; flex-shrink: 0;
  width: 40px; height: 22px; border-radius: 999px;
  background: var(--border-ui);
  transition: background-color 0.18s ease;
}
.acct-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform 0.18s var(--ease-out);
}
.acct-theme-toggle.is-on .acct-switch { background: var(--gilpin-gold); }
.acct-theme-toggle.is-on .acct-switch::after { transform: translateX(18px); }

/* 480, not 380: the old breakpoint missed the 390px iPhone 12–15, where the
   120px name cap let the account pill crush the breadcrumb to one letter. */
@media (max-width: 480px) {
  .acct-name { max-width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .acct-dropdown { animation: none; }
  .acct-chev, .acct-switch, .acct-switch::after { transition: none; }
}


/* ═══════════════════════════════════════════
   GILPIN ICONS — static/icons/gilpin-icons.svg
   Rendered by icon() in templates/_icons.html and gi() in static/icons.js.
   Direction A "Fine Line" by default: outline, 1.75 stroke, the ink of the
   surrounding text. Gold only for active/important states (.gi-gold).
   Direction C "Heritage Roundel" (.gi-roundel) for hero moments only.
   ═══════════════════════════════════════════ */
.gi {
  width: 1.15em; height: 1.15em;
  vertical-align: -0.2em;
  flex: none;
}
.gi-gold  { color: var(--gilpin-gold); }
.gi-muted { color: var(--text-muted); }
.gi-roundel {
  --gi-sw: 1.25;
  width: 2.6em; height: 2.6em;
  padding: 0.45em;
  box-sizing: border-box;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--gilpin-gold);
  vertical-align: middle;
}
.gi-medal-bronze { color: var(--medal-bronze); }
.gi-medal-silver { color: var(--medal-silver); }
.gi-medal-gold   { color: var(--medal-gold); }
/* Status colour, for status only (ticks, crosses, coloured status dots). */
.gi-success { color: var(--color-success); }
.gi-warning { color: var(--color-warning); }
.gi-error   { color: var(--color-error); }
