/* =====================================================================
   TRAVEL GATE — Design System (Apple-style)
   Light surfaces, near-black text, one restrained accent color (blue),
   generous whitespace, soft shadows, large radii. Minimal chrome —
   the content and data are the interface, not decoration.
   ===================================================================== */

:root {
  /* Color — Night Mode is now the true default for the WHOLE app (not just chrome): dark
     page background, dark cards, light text. Light Mode (below) restores the original
     bright palette. Any page built on these core variables — which is the vast majority
     of the app — adapts automatically with no per-page changes. */
  --tg-navy:        #f2f2f7;
  --tg-navy-dark:   #1c1c1e;
  --tg-navy-mid:    #2c2c2e;
  --tg-navy-light:  #1c1d24;
  --tg-red:         #ff453a;
  --tg-gold:        #b98a2f;   /* kept only for legacy references (e.g. partner badge) */
  --tg-sky:         #7c6cf9;   /* the SAME indigo family as the sidebar accent — one accent
                                   colour across the whole app, chrome and content alike */
  --tg-success:     #32d74b;
  --tg-warning:     #ff9f0a;
  --tg-danger:      #ff453a;

  --tg-bg:          #0c0d11;
  --tg-surface:     #16171e;
  --tg-surface-2:   #1e1f28;
  --tg-border:      rgba(255,255,255,.10);
  --tg-text:        #f2f2f7;
  --tg-text-muted:  #9a9aa6;

  /* Premium chrome — near-black with an indigo→violet→cyan accent gradient. This is the
     signature "modern tech" identity: sidebar, topbar, flyout panels, avatar, badges. */
  --tg-chrome-1:     #08090d;
  --tg-chrome-2:     #101319;
  --tg-chrome-border: rgba(255,255,255,.08);
  --tg-chrome-text:      #a6adbb;
  --tg-chrome-text-dim:  #5c6472;
  --tg-accent-1:    #6d5ef8;   /* indigo */
  --tg-accent-2:    #a855f7;   /* violet */
  --tg-accent-3:    #22d3ee;   /* cyan */
  --tg-accent-grad:  linear-gradient(135deg, var(--tg-accent-1), var(--tg-accent-2));
  --tg-accent-glow:  rgba(109,94,248,.45);
  --tg-glass-bg:     rgba(15,16,22,.86);
  --tg-glass-border: rgba(255,255,255,.10);
  /* Topbar reads its background from the SAME chrome family as the sidebar in both modes
     (a translucent version of --tg-chrome-1), so it is never a separately-hardcoded colour. */
  --tg-topbar-bg: rgba(12,13,17,.72);
  --tg-topbar-border: rgba(255,255,255,.08);

  /* Type — one neutral humanist sans throughout, Space Grotesk for chrome headings */
  --tg-font-display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --tg-font-body:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --tg-font-mono:     'JetBrains Mono', monospace;

  /* Radius / shadow / motion — soft, generous, understated */
  --tg-radius: 18px;
  --tg-radius-sm: 12px;
  --tg-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 2px 12px rgba(0,0,0,0.05);
  --tg-shadow-lg: 0 20px 45px rgba(0,0,0,0.12);
  --tg-ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }

body {
  font-family: var(--tg-font-body);
  background: var(--tg-bg);
  color: var(--tg-text);
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.006em;
  transition: background .25s var(--tg-ease), color .25s var(--tg-ease);
}

h1, h2, h3, h4 {
  font-family: var(--tg-font-display);
  color: var(--tg-text);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
h2 { font-size: 24px; }
h3 { font-size: 16px; margin-top: 30px; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--tg-sky); text-decoration: none; transition: opacity .15s var(--tg-ease); }
a:hover { opacity: .65; text-decoration: none; }

/* ---- Global loading overlay: transparent, logo + fast progress bar ---- */
#tg-loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 10000;
  background: rgba(245,245,247,0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  opacity: 0; pointer-events: none; transition: opacity .15s ease-out;
}
#tg-loading-overlay.visible { opacity: 1; pointer-events: all; }
.tg-loading-logo { width: 96px; height: auto; animation: tg-pulse 1.1s ease-in-out infinite; }
@keyframes tg-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: .85; } }
.tg-loading-track { width: 160px; height: 4px; background: rgba(0,0,0,0.08); border-radius: 999px; overflow: hidden; }
.tg-loading-fill { height: 100%; width: 0%; background: var(--tg-sky); border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .tg-loading-logo { animation: none; } }

/* ---- Icons ---- */
.tg-icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.tg-icon-sm { width: 15px; height: 15px; }
.tg-icon-lg { width: 26px; height: 26px; }

/* ---- Brand mark ---- */
.tg-brandmark { display: flex; align-items: center; gap: 10px; }
.tg-brandmark img { height: 32px; width: auto; display: block; }
.tg-brandmark span.name { font-family: var(--tg-font-display); font-weight: 700; }
.tg-logo-plate { display: inline-flex; align-items: center; justify-content: center; }

/* ---- Layout shell — compact icon-rail sidebar (expandable) + hover flyout previews.
   Content area is untouched; only the app "chrome" gets the premium tech treatment. ---- */
.tg-shell { display: flex; align-items: stretch; min-height: 100vh; }

/* =========================================================================
   RTL (Arabic) — the sidebar isn't fixed-positioned, it's a flex child, so
   flipping the shell's flex-direction moves it to the right edge for free.
   Everything that IS fixed-positioned (topbar, flyouts) gets an explicit
   mirror below. Scoped to body[dir="rtl"] so LTR/English is untouched.
   ========================================================================= */
body[dir="rtl"] {
  font-family: 'Tahoma', 'Segoe UI', var(--tg-font-body);
}
/* No flex-direction override needed here: .tg-shell's default `flex-direction: row` is
   already direction-relative — under dir="rtl" it flows right-to-left on its own, which is
   exactly what moves the sidebar to the right edge. Explicitly setting row-reverse would
   cancel that out and silently put everything back in LTR order (the bug this replaces). */
body[dir="rtl"] .tg-sidebar { border-right: none; border-left: 1px solid var(--tg-chrome-border); }
body[dir="rtl"] .tg-sidebar-toggle { right: auto; left: -13px; }
body[dir="rtl"] .tg-sidebar-toggle svg { transform: scaleX(-1); }
body[dir="rtl"] .tg-topbar { left: 0; right: 88px; }
body[dir="rtl"].tg-sidebar-expanded .tg-topbar { right: 240px; left: 0; }
body[dir="rtl"] .tg-flyout-panel {
  left: auto; right: 88px; border-right: none; border-left: 1px solid var(--tg-glass-border);
  box-shadow: -30px 0 60px rgba(0,0,0,.35); transform: translateX(12px);
}
body[dir="rtl"] .tg-flyout-panel.open { transform: translateX(0); }
body[dir="rtl"].tg-sidebar-expanded .tg-flyout-panel { right: 240px; }
body[dir="rtl"] .tg-topbar-brand { border-right: none; border-left: 1px solid rgba(210,210,215,.7); padding-right: 0; padding-left: 16px; margin-right: 0; margin-left: 2px; }
body[dir="rtl"] .tg-topbar-right { margin-left: 0; margin-right: auto; }
body[dir="rtl"] .tg-global-search-btn kbd { margin-left: 0; margin-right: auto; }
body[dir="rtl"] .tg-avatar-dropdown, body[dir="rtl"] .tg-notif-dropdown { right: auto; left: 0; }
body[dir="rtl"] .tg-nav-rail-item .tg-rail-dot { right: auto; left: 12px; }
body[dir="rtl"].tg-sidebar-expanded .tg-nav-rail-item .tg-rail-dot { margin-left: 0; margin-right: auto; }
body[dir="rtl"] .tg-flyout-card:hover { transform: translateX(-3px); }
body[dir="rtl"] .tg-hub-arrow svg, body[dir="rtl"] .tg-page-back svg { transform: scaleX(-1); }
body[dir="rtl"] .tg-search-esc { margin-left: 0; }

@media (max-width: 860px) {
  body[dir="rtl"] .tg-topbar { right: 0; left: 0; }
  body[dir="rtl"] .tg-topbar-brand { border-left: none; }
  body[dir="rtl"] .tg-avatar-dropdown { left: -6px; right: auto; }
  body[dir="rtl"] .tg-bottombar-item.active::before { left: 50%; right: auto; }
}
.tg-sidebar {
  width: 88px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 20px 0 14px;
  background: var(--tg-chrome-1);
  background-image:
    radial-gradient(circle at 15% 8%, rgba(109,94,248,.28) 0%, transparent 45%),
    radial-gradient(circle at 85% 88%, rgba(34,211,238,.16) 0%, transparent 45%);
  border-right: 1px solid var(--tg-chrome-border);
  transition: width .25s var(--tg-ease);
}
.tg-sidebar::-webkit-scrollbar { width: 0; }
.tg-sidebar-brand { width: 76px; height: 76px; border-radius: 20px; overflow: hidden; margin-bottom: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; background: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  transition: .25s var(--tg-ease); }
.tg-sidebar-brand:hover { transform: scale(1.04); box-shadow: 0 8px 24px rgba(109,94,248,.4); }
.tg-sidebar-brand img { width: 62px; height: auto; display: block; }

.tg-nav-rail-item {
  width: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 9px 4px; border-radius: 13px; color: var(--tg-chrome-text-dim); text-decoration: none;
  font-size: 9.5px; font-weight: 600; letter-spacing: .01em; text-align: center; line-height: 1.15;
  border: none; background: none; font-family: inherit; cursor: pointer; position: relative; flex-shrink: 0;
  transition: background .15s var(--tg-ease), color .15s var(--tg-ease), width .25s var(--tg-ease);
}
.tg-nav-rail-item .tg-icon { width: 19px; height: 19px; opacity: .85; transition: transform .15s var(--tg-ease); flex-shrink: 0; }
.tg-nav-rail-item:hover { background: rgba(255,255,255,.06); color: #e4e6eb; text-decoration: none; }
.tg-nav-rail-item:hover .tg-icon { transform: translateY(-1px); }
.tg-nav-rail-item.active, .tg-nav-rail-item.tg-flyout-open {
  color: #fff; background: linear-gradient(135deg, rgba(109,94,248,.28), rgba(168,85,247,.22));
  box-shadow: inset 0 0 0 1px rgba(168,85,247,.4), 0 0 18px rgba(109,94,248,.35);
}
.tg-nav-rail-item.active .tg-icon, .tg-nav-rail-item.tg-flyout-open .tg-icon { opacity: 1; }
.tg-nav-rail-item .tg-rail-dot {
  position: absolute; top: 6px; right: 12px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--tg-accent-3); box-shadow: 0 0 6px var(--tg-accent-3); display: none;
}
.tg-nav-rail-item.has-children .tg-rail-dot { display: block; }
.tg-nav-rail-spacer { flex: 1; }
.tg-nav-rail-item.tg-nav-logout { color: #ff8a80; }
.tg-nav-rail-item.tg-nav-logout:hover { background: rgba(255,59,48,.12); color: #ff9a90; }
.tg-sidebar-expand-toggle .tg-icon { transform: rotate(-90deg); transition: transform .25s var(--tg-ease); }

/* ---- Expanded sidebar: icon + label sit side by side, like a traditional wide sidebar ---- */
body.tg-sidebar-expanded .tg-sidebar { width: 240px; align-items: stretch; padding-left: 14px; padding-right: 14px; }
body.tg-sidebar-expanded .tg-sidebar-brand { align-self: center; width: 92px; height: 92px; }
body.tg-sidebar-expanded .tg-sidebar-brand img { width: 76px; }
body.tg-sidebar-expanded .tg-nav-rail-item {
  width: 100%; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 12px; font-size: 13.5px;
}
body.tg-sidebar-expanded .tg-nav-rail-item .tg-rail-dot { position: static; margin-left: auto; box-shadow: none; width: 5px; height: 5px; }
body.tg-sidebar-expanded .tg-sidebar-expand-toggle .tg-icon { transform: rotate(90deg); }
body.tg-sidebar-expanded .tg-topbar,
body.tg-sidebar-expanded .tg-flyout-panel { left: 240px; }

/* ---- Flyout preview panel: appears on hover beside the rail. Sized to its own content
   (not the full viewport) and laid out as a 2-column grid of compact, description-free
   cards, so even a 9-item group like Tools fits with zero scrolling on any normal screen —
   the full descriptions still live on the group's own hub page one click away. ---- */
.tg-flyout-panel {
  position: fixed; top: 78px; left: 88px; width: 400px; max-height: calc(100vh - 100px); z-index: 65;
  background: var(--tg-glass-bg); backdrop-filter: blur(28px) saturate(180%); -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--tg-glass-border); border-radius: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.4);
  padding: 20px; overflow-y: auto; overflow-x: hidden;
  transform: translateX(-12px); opacity: 0; pointer-events: none;
  transition: transform .22s var(--tg-ease), opacity .18s, left .25s var(--tg-ease);
}
.tg-flyout-panel.open { transform: translateX(0); opacity: 1; pointer-events: auto; }
.tg-flyout-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tg-flyout-title { font-family: var(--tg-font-display); font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.tg-flyout-sub { font-size: 11px; color: var(--tg-chrome-text-dim); }
.tg-flyout-open-all {
  flex-shrink: 0; font-size: 11px; font-weight: 700; color: var(--tg-accent-3); text-decoration: none;
  white-space: nowrap; padding: 5px 9px; border-radius: 100px; background: rgba(34,211,238,.10); transition: .15s;
}
.tg-flyout-open-all:hover { background: rgba(34,211,238,.2); text-decoration: none; }
.tg-flyout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tg-flyout-card {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 12px;
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06);
  color: #e4e6eb; text-decoration: none; transition: .15s var(--tg-ease); position: relative; overflow: hidden;
}
.tg-flyout-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .2s;
  background: linear-gradient(135deg, rgba(109,94,248,.16), rgba(34,211,238,.10));
}
.tg-flyout-card:hover { border-color: rgba(168,85,247,.45); text-decoration: none; color: #fff; }
.tg-flyout-card:hover::before { opacity: 1; }
.tg-flyout-card-icon {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--tg-accent-1), var(--tg-accent-2)); box-shadow: 0 3px 9px rgba(109,94,248,.4);
}
.tg-flyout-card-icon .tg-icon { width: 15px; height: 15px; color: #fff; opacity: 1; }
.tg-flyout-card-text { position: relative; z-index: 1; min-width: 0; }
.tg-flyout-card-text b { display: block; font-size: 12px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-flyout-card-text span { display: none; }

.tg-main { flex: 1; min-width: 0; padding: 96px 40px 34px; }

/* ---- Premium topbar: global search, notifications, avatar ---- */
.tg-topbar {
  position: fixed; top: 0; left: 88px; right: 0; height: 68px; z-index: 60;
  display: flex; align-items: center; gap: 16px; padding: 0 32px;
  background: var(--tg-topbar-bg); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--tg-topbar-border);
  transition: left .25s var(--tg-ease), background .25s var(--tg-ease), border-color .25s var(--tg-ease);
}
.tg-topbar-brand {
  display: flex; align-items: center; gap: 11px; text-decoration: none; flex-shrink: 0; padding-right: 16px;
  border-right: 1px solid rgba(210,210,215,.7); margin-right: 2px;
}
.tg-topbar-brand-logo {
  width: 40px; height: 40px; border-radius: 11px; overflow: hidden; flex-shrink: 0; padding: 3px;
  display: flex; align-items: center; justify-content: center; background: var(--tg-surface); border: 1px solid var(--tg-border);
  box-shadow: var(--tg-shadow);
}
/* object-fit: contain (not cover) — the logo is shown exactly as uploaded, never cropped,
   and this frame is a plain neutral surface so no accent colour bleeds around it. */
.tg-topbar-brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tg-topbar-brand-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--tg-accent-1), var(--tg-accent-2)); color: #fff; font-weight: 800; font-size: 13px; border-radius: 8px;
}
.tg-topbar-brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tg-topbar-brand-name { font-size: 13.5px; font-weight: 700; color: var(--tg-text); white-space: nowrap; max-width: 170px; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.tg-topbar-brand-agent { font-size: 10px; font-weight: 600; color: var(--tg-text-muted); white-space: nowrap; letter-spacing: .02em; }
.tg-topbar-brand:hover .tg-topbar-brand-name { color: var(--tg-accent-1); }
.tg-global-search-btn {
  flex: 1; max-width: 420px; height: 42px; display: flex; align-items: center; gap: 10px;
  background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: 100px;
  padding: 0 16px; color: var(--tg-text-muted); font-size: 13px; cursor: pointer; font-family: inherit;
  transition: .18s var(--tg-ease);
}
.tg-global-search-btn:hover { border-color: var(--tg-accent-1); box-shadow: 0 4px 14px rgba(109,94,248,.15); color: var(--tg-text); }
.tg-global-search-btn .tg-icon { width: 16px; height: 16px; opacity: .7; flex-shrink: 0; }
.tg-global-search-btn kbd {
  margin-left: auto; font-family: var(--tg-font-mono); font-size: 10px; color: var(--tg-text-muted);
  background: var(--tg-bg); border: 1px solid var(--tg-border); border-radius: 5px; padding: 2px 6px;
}
.tg-topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.tg-topbar-icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--tg-surface); color: var(--tg-text-muted); border: 1px solid var(--tg-border);
  transition: .15s var(--tg-ease); cursor: pointer; flex-shrink: 0;
}
.tg-topbar-icon-btn:hover { background: rgba(109,94,248,.10); color: var(--tg-accent-1); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.08); }

/* ---- Avatar + dropdown (dark glass with an accent-gradient glow — visually distinct "opened panel" layer) ---- */
.tg-avatar-wrap { position: relative; }
.tg-avatar-circle {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer; overflow: hidden; padding: 0;
  background: linear-gradient(135deg, var(--tg-accent-1), var(--tg-accent-2)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14.5px;
  box-shadow: 0 3px 12px rgba(109,94,248,.5); border: 2px solid #fff; transition: .18s var(--tg-ease);
}
.tg-avatar-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tg-avatar-circle .tg-icon { width: 19px; height: 19px; opacity: 1; }
.tg-avatar-circle:hover { transform: scale(1.06); box-shadow: 0 5px 18px rgba(109,94,248,.65); }
.tg-avatar-circle:focus-visible, .tg-topbar-icon-btn:focus-visible, .tg-global-search-btn:focus-visible, .tg-notif-bell:focus-visible {
  outline: 2px solid var(--tg-accent-1); outline-offset: 2px;
}
.tg-avatar-dropdown, .tg-notif-dropdown-glass {
  position: absolute; top: calc(100% + 12px); right: 0; width: 250px;
  background: var(--tg-glass-bg); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--tg-glass-border); border-radius: 16px; box-shadow: var(--tg-shadow-lg);
  padding: 8px; opacity: 0; transform: translateY(-8px) scale(.98); pointer-events: none;
  transition: .18s var(--tg-ease); z-index: 200;
}
.tg-avatar-dropdown.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.tg-avatar-dropdown-head { padding: 12px 12px 10px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 6px; }
.tg-avatar-dropdown-head b { display: block; font-size: 13.5px; color: #fff; }
.tg-avatar-dropdown-head span { font-size: 11px; color: var(--tg-chrome-text-dim); }
.tg-avatar-dropdown a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: #d5d8de; text-decoration: none; font-size: 13px; font-weight: 500; transition: .12s;
}
.tg-avatar-dropdown a:hover { background: rgba(109,94,248,.18); text-decoration: none; color: #fff; }
.tg-avatar-dropdown a .tg-icon { width: 16px; height: 16px; color: var(--tg-accent-3); }
.tg-avatar-dropdown a.tg-nav-logout { color: #ff8a80; }
.tg-avatar-dropdown a.tg-nav-logout .tg-icon { color: #ff8a80; }
.tg-avatar-dropdown hr { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 6px 4px; }

/* ---- Global search overlay ---- */
.tg-search-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(4,5,10,.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 10vh 20px 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.tg-search-overlay.open { opacity: 1; pointer-events: auto; }
.tg-search-panel {
  width: 100%; max-width: 620px; background: var(--tg-glass-bg); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--tg-glass-border); border-radius: 20px; box-shadow: var(--tg-shadow-lg);
  overflow: hidden; transform: translateY(-14px); transition: transform .2s var(--tg-ease);
}
.tg-search-overlay.open .tg-search-panel { transform: translateY(0); }
.tg-search-input-row { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.tg-search-input-row .tg-icon { width: 19px; height: 19px; color: var(--tg-accent-3); flex-shrink: 0; }
.tg-search-input-row input { border: none; background: none; outline: none; font-size: 16px; flex: 1; color: #fff; font-family: inherit; }
.tg-search-input-row input::placeholder { color: var(--tg-chrome-text-dim); }
.tg-search-esc { font-size: 10px; color: var(--tg-chrome-text-dim); background: rgba(255,255,255,.06); border-radius: 5px; padding: 3px 7px; font-family: var(--tg-font-mono); }
.tg-search-body { max-height: 50vh; overflow-y: auto; padding: 10px; }
.tg-search-cat-label { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--tg-chrome-text-dim); padding: 10px 10px 6px; }
.tg-search-result {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: #dcdee3; text-decoration: none; transition: .1s;
}
.tg-search-result:hover, .tg-search-result.hl { background: rgba(109,94,248,.18); text-decoration: none; color: #fff; }
.tg-search-result .tg-icon { width: 17px; height: 17px; color: var(--tg-accent-3); flex-shrink: 0; }
.tg-search-result span { font-size: 13.5px; font-weight: 600; }
.tg-search-empty { padding: 30px 10px; text-align: center; color: var(--tg-chrome-text-dim); font-size: 13px; }
.tg-search-hint { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: var(--tg-chrome-text-dim); background: rgba(255,255,255,.02); }

/* =========================================================================
   LIGHT MODE — the dark/near-black chrome above is "Night Mode" (the default,
   and the look explicitly kept as-is). This block is the "Day Mode" variant:
   same structure, same indigo/violet/cyan accent family, bright surfaces.
   Scoped entirely under body.tg-light-mode so night mode is never touched.
   ========================================================================= */
/* Override the shared chrome/glass variables first — every "glass" panel
   (flyout, avatar menu, search, notifications, mobile More sheet) reads
   these directly, so this one block re-themes all of them at once. */
body.tg-light-mode {
  --tg-chrome-1: #fbfaff;
  --tg-chrome-2: #f1f0fb;
  --tg-chrome-border: rgba(0,0,0,.07);
  --tg-chrome-text: #6b6e7d;
  --tg-chrome-text-dim: #9a9aa6;
  --tg-glass-bg: rgba(255,255,255,.92);
  --tg-glass-border: rgba(109,94,248,.18);
  --tg-topbar-bg: rgba(251,250,255,.78);
  --tg-topbar-border: rgba(109,94,248,.14);

  /* Restore the original bright content palette for the whole app — cards, page
     backgrounds, and text everywhere, not just the sidebar/topbar chrome. */
  --tg-navy: #1d1d1f;
  --tg-red: #ff3b30;
  --tg-sky: #6d5ef8;
  --tg-success: #34c759;
  --tg-warning: #ff9500;
  --tg-danger: #ff3b30;
  --tg-bg: #f7f6fd;
  --tg-surface: #ffffff;
  --tg-surface-2: #f5f5f7;
  --tg-border: #d2d2d7;
  --tg-text: #1d1d1f;
  --tg-text-muted: #6e6e73;
  --tg-navy-light: #f5f5f7;
  --tg-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 2px 12px rgba(0,0,0,0.05);
  --tg-shadow-lg: 0 20px 45px rgba(0,0,0,0.12);
}
body.tg-light-mode {
  background-image:
    radial-gradient(circle at 12% 0%, rgba(109,94,248,.07) 0%, transparent 45%),
    radial-gradient(circle at 90% 18%, rgba(34,211,238,.05) 0%, transparent 40%);
  background-attachment: fixed;
}
body.tg-light-mode .tg-sidebar {
  background: #fbfaff;
  background-image:
    radial-gradient(circle at 15% 8%, rgba(109,94,248,.10) 0%, transparent 45%),
    radial-gradient(circle at 85% 88%, rgba(34,211,238,.08) 0%, transparent 45%);
  border-right: 1px solid rgba(0,0,0,.07);
  box-shadow: 2px 0 16px rgba(109,94,248,.06);
}
body.tg-light-mode .tg-sidebar-brand { box-shadow: 0 4px 14px rgba(109,94,248,.18); border: 1px solid rgba(0,0,0,.06); }
body.tg-light-mode .tg-nav-rail-item { color: #6b6e7d; }
body.tg-light-mode .tg-nav-rail-item.active,
body.tg-light-mode .tg-nav-rail-item.tg-flyout-open { color: #241b4d; }
body.tg-light-mode .tg-nav-rail-item.active .tg-icon,
body.tg-light-mode .tg-nav-rail-item.tg-flyout-open .tg-icon { color: #241b4d; }
body.tg-light-mode .tg-nav-rail-item:hover { background: rgba(109,94,248,.08); color: #1a1b23; }
body.tg-light-mode .tg-nav-rail-item.tg-nav-logout { color: #d43a30; }
body.tg-light-mode .tg-nav-rail-item.tg-nav-logout:hover { background: rgba(255,59,48,.08); color: #d43a30; }
body.tg-light-mode .tg-sidebar-toggle { background: #fff; }

body.tg-light-mode .tg-flyout-panel { box-shadow: 0 24px 60px rgba(109,94,248,.18); }
body.tg-light-mode .tg-flyout-title { color: #1a1b23; }
body.tg-light-mode .tg-flyout-card { background: rgba(109,94,248,.045); border: 1px solid rgba(109,94,248,.10); color: #3f4250; }
body.tg-light-mode .tg-flyout-card:hover { border-color: rgba(168,85,247,.4); color: #1a1b23; }

body.tg-light-mode .tg-avatar-dropdown-head { border-bottom: 1px solid rgba(109,94,248,.14); }
body.tg-light-mode .tg-avatar-dropdown-head b { color: #1a1b23; }
body.tg-light-mode .tg-avatar-dropdown a { color: #3f4250; }
body.tg-light-mode .tg-avatar-dropdown a:hover { background: rgba(109,94,248,.10); color: #1a1b23; }
body.tg-light-mode .tg-avatar-dropdown a.tg-nav-logout { color: #d43a30; }
body.tg-light-mode .tg-avatar-dropdown a.tg-nav-logout .tg-icon { color: #d43a30; }
body.tg-light-mode .tg-avatar-dropdown hr { border-top: 1px solid rgba(109,94,248,.12); }

body.tg-light-mode .tg-search-overlay { background: rgba(80,80,100,.35); }
body.tg-light-mode .tg-search-input-row { border-bottom: 1px solid rgba(109,94,248,.12); }
body.tg-light-mode .tg-search-input-row input { color: #1a1b23; }
body.tg-light-mode .tg-search-esc { background: rgba(109,94,248,.08); color: #6b6e7d; }
body.tg-light-mode .tg-search-result { color: #3f4250; }
body.tg-light-mode .tg-search-result:hover, body.tg-light-mode .tg-search-result.hl { background: rgba(109,94,248,.10); color: #1a1b23; }
body.tg-light-mode .tg-search-hint { border-top: 1px solid rgba(109,94,248,.12); background: rgba(109,94,248,.03); }

/* ---- Theme toggle button (sun / moon) ---- */
.tg-lang-toggle {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--tg-surface); color: var(--tg-text-muted); border: 1px solid var(--tg-border);
  transition: .15s var(--tg-ease); cursor: pointer; flex-shrink: 0; text-decoration: none;
  font-size: 13px; font-weight: 700;
}
.tg-lang-toggle:hover { background: rgba(109,94,248,.10); color: var(--tg-accent-1); text-decoration: none; }
.tg-theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--tg-surface); color: var(--tg-text-muted); border: 1px solid var(--tg-border);
  transition: .15s var(--tg-ease); cursor: pointer; flex-shrink: 0; position: relative; overflow: hidden;
}
.tg-theme-toggle:hover { background: rgba(109,94,248,.10); color: var(--tg-accent-1); transform: translateY(-1px); }
.tg-theme-toggle .tg-icon { width: 18px; height: 18px; position: absolute; transition: transform .35s var(--tg-ease), opacity .25s; }
.tg-theme-toggle .tg-icon-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
.tg-theme-toggle .tg-icon-moon { opacity: 1; transform: rotate(0) scale(1); }
body.tg-light-mode .tg-theme-toggle .tg-icon-sun { opacity: 1; transform: rotate(0) scale(1); }
body.tg-light-mode .tg-theme-toggle .tg-icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }

@media (max-width: 860px) {
  .tg-topbar { left: 0; height: 60px; padding: 0 12px; gap: 8px; }
  .tg-topbar-brand { padding-right: 8px; gap: 8px; }
  .tg-topbar-brand-logo { width: 34px; height: 34px; }
  .tg-topbar-brand-text { display: flex; }
  .tg-topbar-brand-name { max-width: 92px; font-size: 12px; }
  .tg-topbar-brand-agent { display: none; }
  .tg-global-search-btn span.tg-search-placeholder-text { display: none; }
  .tg-global-search-btn kbd { display: none; }
  .tg-global-search-btn { flex: 0 0 auto; width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 50%; }
  .tg-topbar-right { gap: 6px; }
  .tg-theme-toggle, .tg-topbar-icon-btn, .tg-avatar-circle { width: 36px; height: 36px; }
  .tg-avatar-dropdown { width: min(280px, calc(100vw - 24px)); right: -6px; }
}

/* ---- Shared "hub page" cards — used by Tools / Allocation / Visas / Bookings / Manage / Ops
   index pages, so every section landing page shares one consistent, premium look. ---- */
.tg-hub-header { margin-bottom: 24px; max-width: 640px; }
.tg-hub-header h1 { font-family: var(--tg-font-display); font-size: 25px; font-weight: 700; margin: 0 0 6px; color: var(--tg-navy); letter-spacing: -.01em; }
.tg-hub-header p { margin: 0; color: var(--tg-text-muted); font-size: 13.5px; line-height: 1.55; }
.tg-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; max-width: 1160px; }
.tg-hub-card {
  background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: 18px; padding: 20px 22px;
  text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 14px; position: relative;
  overflow: hidden; min-height: 168px; transition: transform .2s var(--tg-ease), box-shadow .2s var(--tg-ease), border-color .2s var(--tg-ease);
}
.tg-hub-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; opacity: 0; transition: opacity .2s;
  background: linear-gradient(90deg, var(--tg-accent-1), var(--tg-accent-2), var(--tg-accent-3));
}
.tg-hub-card:hover { transform: translateY(-4px); box-shadow: 0 18px 38px rgba(109,94,248,.18); border-color: rgba(168,85,247,.4); text-decoration: none; }
.tg-hub-card:hover::before { opacity: 1; }
.tg-hub-card.disabled { opacity: .55; cursor: default; pointer-events: none; }
.tg-hub-card-icon {
  width: 52px; height: 52px; border-radius: 15px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--tg-accent-1), var(--tg-accent-2)); box-shadow: 0 6px 16px rgba(109,94,248,.35);
}
.tg-hub-card-icon .tg-icon, .tg-hub-card-icon svg { width: 25px; height: 25px; color: #fff; opacity: 1; }
.tg-hub-card-body { min-width: 0; flex: 1; }
.tg-hub-card h4 { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--tg-navy); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tg-hub-card p { margin: 0; font-size: 12.5px; color: var(--tg-text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tg-hub-card .tg-hub-arrow { margin-top: auto; flex-shrink: 0; display: flex; align-items: center; gap: 4px; color: var(--tg-accent-1); font-size: 12.5px; font-weight: 700; }
.tg-hub-badge { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--tg-bg); color: var(--tg-text-muted); padding: 3px 8px; border-radius: 100px; display: inline-block; }

/* ---- Cards / stat tiles ---- */
.tg-card {
  background: var(--tg-surface); border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius); box-shadow: var(--tg-shadow);
  padding: 24px;
}
.tg-stat-grid { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
.tg-stat {
  flex: 1; min-width: 170px; background: var(--tg-surface);
  border: 1px solid var(--tg-border); border-radius: var(--tg-radius);
  padding: 20px 22px; box-shadow: var(--tg-shadow); transition: transform .18s var(--tg-ease), box-shadow .18s var(--tg-ease);
}
.tg-stat:hover { transform: translateY(-2px); box-shadow: var(--tg-shadow-lg); }
.tg-stat .tg-stat-icon { color: var(--tg-sky); margin-bottom: 8px; opacity: .85; }
.tg-stat .tg-stat-num { font-family: var(--tg-font-display); font-size: 34px; font-weight: 800; color: var(--tg-text); letter-spacing: -0.025em; line-height: 1.1; }
.tg-stat .tg-stat-label { font-size: 11.5px; color: var(--tg-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; font-weight: 600; }

/* ---- Report menu cards ---- */
.tg-report-card {
  display: flex; margin-bottom: 12px; border-radius: var(--tg-radius);
  overflow: hidden; box-shadow: var(--tg-shadow); background: var(--tg-surface);
  border: 1px solid var(--tg-border); transition: box-shadow .18s var(--tg-ease), transform .18s var(--tg-ease);
}
.tg-report-card:hover { box-shadow: var(--tg-shadow-lg); transform: translateY(-1px); }
.tg-report-icon { width: 92px; flex-shrink: 0; color: #fff; display: flex; align-items: center; justify-content: center; }
.tg-report-body { flex: 1; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.tg-report-body strong { display: block; font-size: 14px; color: var(--tg-text); }
.tg-report-body span.tg-report-desc { color: var(--tg-text-muted); font-size: 12.5px; }

/* ---- Alerts ---- */
.tg-alert { border-radius: var(--tg-radius-sm); padding: 13px 16px; margin-bottom: 16px; font-size: 13.5px; border-left: 3px solid transparent; }
.tg-alert-warning { background: #fff8ec; border-left-color: var(--tg-warning); color: #8a5a0a; }
.tg-alert-success { background: #eafbf1; border-left-color: var(--tg-success); color: #0d6b3a; }
.tg-alert-danger  { background: #fdeceb; border-left-color: var(--tg-danger); color: #9c1c22; }

/* ---- Badges ---- */
.tg-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff; letter-spacing: 0.02em; }
.tg-badge-pending   { background: var(--tg-warning); }
.tg-badge-approved  { background: var(--tg-success); }
.tg-badge-rejected  { background: var(--tg-danger); }
.tg-badge-suspended { background: #86868b; }

/* ---- Forms ---- */
label { display: block; font-size: 12.5px; font-weight: 600; color: #3a3a3c; margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], input[type=file],
select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius-sm); font-size: 13.5px; font-family: inherit;
  background: var(--tg-surface); color: var(--tg-text);
  transition: border-color .15s var(--tg-ease), box-shadow .15s var(--tg-ease);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--tg-sky);
  box-shadow: 0 0 0 3.5px rgba(0,113,227,0.12);
}
fieldset { border: 1px solid var(--tg-border); border-radius: var(--tg-radius); padding: 16px 18px; margin-bottom: 18px; }
legend { font-weight: 700; color: var(--tg-text); padding: 0 6px; font-size: 13px; }

/* ---- Buttons — solid blue pill primary, neutral ghost secondary ---- */
button, .tg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--tg-sky); color: #fff; border: none; cursor: pointer;
  padding: 10px 20px; border-radius: 980px; font-size: 13.5px;
  font-weight: 600; font-family: inherit; transition: background .15s var(--tg-ease), transform .1s var(--tg-ease), opacity .15s var(--tg-ease);
}
button:hover, .tg-btn:hover { background: #0077ed; text-decoration: none; opacity: 1; }
button:active, .tg-btn:active { transform: translateY(1px); }
.tg-btn-accent { background: var(--tg-navy); }
.tg-btn-accent:hover { background: #000; }
.tg-btn-ghost { background: var(--tg-navy-light); color: var(--tg-text); border: 1px solid var(--tg-border); }
.tg-btn-ghost:hover { background: #ebebed; opacity: 1; }
.tg-btn[disabled] { opacity: .5; cursor: default; pointer-events: none; }
.tg-btn-busy, button.tg-btn-busy { opacity: .6; pointer-events: none; cursor: default; }
.tg-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: tg-spin .7s linear infinite; }
@keyframes tg-spin { to { transform: rotate(360deg); } }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; background: var(--tg-surface); }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--tg-text-muted); padding: 11px 14px; border-bottom: 1px solid var(--tg-border);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--tg-border); font-size: 13.5px; }
tr { transition: background .12s var(--tg-ease); }
tr:hover td { background: var(--tg-navy-light); }

/* ---- Auth pages — centered minimal card (Apple ID style), no split-screen ---- */
.tg-auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--tg-bg); padding: 40px 20px;
}
.tg-auth-brand {
  display: none; /* the dark split-brand-panel concept is retired in the Apple-style layout */
}
.tg-auth-card {
  width: 100%; max-width: 420px; background: var(--tg-surface); border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow-lg); padding: 44px 40px; text-align: center;
}
.tg-auth-card .tg-brandmark { justify-content: center; margin-bottom: 22px; }
.tg-auth-card .tg-brandmark img { height: 40px; }
.tg-auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.tg-auth-card p.lead { color: var(--tg-text-muted); font-size: 13.5px; margin-bottom: 24px; }
.tg-auth-card form { text-align: left; }
.tg-route-line { display: none; }

@media (max-width: 860px) {
  .tg-sidebar { display: none; }
  .tg-main { padding: 74px 14px 88px; }

  /* ---- App-style bottom tab bar (mobile only) — premium navy chrome to match the sidebar ---- */
  .tg-bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    display: flex; align-items: stretch;
    background: var(--tg-chrome-1);
    background-image: radial-gradient(circle at 20% 0%, rgba(109,94,248,.22) 0%, transparent 50%);
    border-top: 1px solid rgba(255,255,255,.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -6px 24px rgba(0,0,0,.25);
  }
  .tg-bottombar-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 8px 2px 7px; color: var(--tg-chrome-text-dim); text-decoration: none; font-size: 10.5px; font-weight: 600;
    border: none; background: none; font-family: inherit; cursor: pointer; position: relative;
  }
  .tg-bottombar-item .tg-icon { width: 22px; height: 22px; opacity: .8; }
  .tg-bottombar-item.active { color: var(--tg-accent-3); }
  .tg-bottombar-item.active .tg-icon { opacity: 1; }
  .tg-bottombar-item.active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, var(--tg-accent-1), var(--tg-accent-3));
  }
  .tg-bottombar-fab {
    width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--tg-accent-1), var(--tg-accent-2)); color: #fff;
    display: flex; align-items: center; justify-content: center; margin: -14px auto 0;
    box-shadow: 0 6px 16px rgba(109,94,248,.55); border: 3px solid var(--tg-chrome-1);
  }
  .tg-bottombar-fab .tg-icon { width: 22px; height: 22px; opacity: 1; }
  .tg-bottombar-item.tg-fab-wrap span { margin-top: 1px; }

  /* ---- "New Booking" popover (glass, matches the desktop dropdown treatment) ---- */
  .tg-nb-popover {
    position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%) translateY(8px); z-index: 75;
    background: var(--tg-glass-bg); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--tg-glass-border); border-radius: 16px; box-shadow: var(--tg-shadow-lg);
    padding: 8px; min-width: 200px; opacity: 0; pointer-events: none; transition: .18s var(--tg-ease, ease);
  }
  .tg-nb-popover.open { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
  .tg-nb-popover a {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
    color: #d5d8de; text-decoration: none; font-size: 13.5px; font-weight: 600;
  }
  .tg-nb-popover a:hover, .tg-nb-popover a:active { background: rgba(109,94,248,.14); }
  .tg-nb-popover .tg-icon { width: 18px; height: 18px; color: var(--tg-accent-1); }
  .tg-nb-backdrop { position: fixed; inset: 0; z-index: 74; background: transparent; display: none; }
  .tg-nb-backdrop.open { display: block; }

  /* ---- "More" full menu sheet (glass, gold-tinted — the "opened panel" layer) ---- */
  .tg-more-backdrop {
    position: fixed; inset: 0; z-index: 79; background: rgba(4,5,10,.6);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .tg-more-backdrop.open { opacity: 1; pointer-events: auto; }
  .tg-more-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; max-height: 82vh; overflow-y: auto;
    background: var(--tg-glass-bg); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid var(--tg-glass-border);
    border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.3);
    padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0));
    transform: translateY(100%); transition: transform .25s var(--tg-ease, ease);
  }
  .tg-more-sheet.open { transform: translateY(0); }
  .tg-more-handle { width: 38px; height: 4px; border-radius: 4px; background: rgba(109,94,248,.4); margin: 8px auto 14px; }
  .tg-more-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .tg-more-head h3 { margin: 0; font-size: 16px; color: #fff; }
  .tg-more-close { background: rgba(109,94,248,.14); border: none; width: 30px; height: 30px; border-radius: 50%; color: var(--tg-accent-1); font-size: 15px; cursor: pointer; }
  .tg-more-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 6px 10px; border-radius: 8px; margin-bottom: 14px; text-align: center; }
  .tg-more-section-label { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--tg-chrome-text-dim); margin: 16px 0 8px; }
  .tg-more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .tg-more-grid a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
    padding: 12px 4px; border-radius: 14px; background: rgba(109,94,248,.08); text-decoration: none;
    color: #d5d8de; font-size: 10.5px; font-weight: 600; text-align: center; line-height: 1.25;
  }
  .tg-more-grid a:active { background: rgba(109,94,248,.22); }
  .tg-more-grid a.tg-more-active { background: linear-gradient(135deg, var(--tg-accent-1), var(--tg-accent-2)); color: #fff; }
  .tg-more-grid a.tg-more-active .tg-icon { color: #fff; opacity: 1; }
  .tg-more-grid a .tg-icon { width: 20px; height: 20px; color: var(--tg-accent-3); opacity: .95; }
  .tg-more-grid a.tg-more-logout .tg-icon { color: #ff8a80; }
  .tg-more-grid a.tg-more-logout { color: #ff8a80; }
}
@media (min-width: 861px) {
  .tg-bottombar, .tg-more-sheet, .tg-more-backdrop, .tg-nb-popover, .tg-nb-backdrop { display: none !important; }
}

/* ---- Mobile chrome, light mode ---- */
@media (max-width: 860px) {
  body.tg-light-mode .tg-bottombar {
    background: #fbfaff;
    background-image: radial-gradient(circle at 20% 0%, rgba(109,94,248,.08) 0%, transparent 50%);
    border-top: 1px solid rgba(0,0,0,.07);
    box-shadow: 0 -6px 20px rgba(109,94,248,.08);
  }
  body.tg-light-mode .tg-bottombar-fab { border-color: #fbfaff; }
  body.tg-light-mode .tg-nb-popover a { color: #3f4250; }
  body.tg-light-mode .tg-nb-popover a:hover, body.tg-light-mode .tg-nb-popover a:active { background: rgba(109,94,248,.10); }
  body.tg-light-mode .tg-more-backdrop { background: rgba(80,80,100,.35); }
  body.tg-light-mode .tg-more-head h3 { color: #1a1b23; }
  body.tg-light-mode .tg-more-grid a { color: #3f4250; background: rgba(109,94,248,.05); }
  body.tg-light-mode .tg-more-grid a:active { background: rgba(109,94,248,.16); }
  body.tg-light-mode .tg-more-grid a.tg-more-logout { color: #d43a30; }
  body.tg-light-mode .tg-more-grid a.tg-more-logout .tg-icon { color: #d43a30; }
}

/* ---- Search hero (connected search bar, Apple dark-section + light card) ---- */
.tg-search-hero {
  background: linear-gradient(135deg, #0a3d91 0%, #0071e3 100%);
  border-radius: var(--tg-radius); padding: 34px 32px 90px; position: relative; overflow: visible;
  margin-bottom: 56px;
}
.tg-search-hero h2 { color: #fff; font-size: 24px; margin-bottom: 4px; }
.tg-search-hero p.sub { color: #a1a1a6; margin-bottom: 20px; font-size: 13.5px; }
.tg-search-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.tg-search-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: #c7c7cc; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1); cursor: pointer; transition: .15s;
}
.tg-search-tab.active { background: #fff; color: var(--tg-sky); border-color: #fff; }
.tg-search-tab .tg-icon { width: 15px; height: 15px; }

.tg-search-bar {
  position: absolute; left: 32px; right: 32px; bottom: -46px;
  background: #fff; border-radius: var(--tg-radius); box-shadow: var(--tg-shadow-lg);
  display: flex; align-items: stretch; border: 1px solid var(--tg-border);
}
.tg-search-bar > .tg-search-field:first-child { border-radius: var(--tg-radius) 0 0 var(--tg-radius); }
.tg-search-bar > .tg-search-submit:last-child { border-radius: 0 var(--tg-radius) var(--tg-radius) 0; }
.tg-search-field {
  flex: 1; min-width: 0; padding: 11px 18px; position: relative; border-right: 1px solid var(--tg-border);
}
.tg-search-field:last-of-type { border-right: none; }
.tg-search-field .tg-field-icon { position: absolute; left: 18px; bottom: 12px; color: var(--tg-text-muted); pointer-events: none; }
.tg-search-field.has-icon input { padding-left: 22px; }
.tg-search-field label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--tg-text-muted);
  font-weight: 700; margin: 0 0 3px; display: block;
}
.tg-search-field input, .tg-search-field select {
  border: none; padding: 0; font-size: 14px; font-weight: 600; color: var(--tg-text);
  background: transparent; box-shadow: none; width: 100%;
}
.tg-search-field input:focus, .tg-search-field select:focus { box-shadow: none; }
.tg-search-swap { display: flex; align-items: center; justify-content: center; width: 0; position: relative; }
.tg-search-swap span {
  position: absolute; left: -15px; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 1px solid var(--tg-border);
  display: flex; align-items: center; justify-content: center; color: var(--tg-text); box-shadow: var(--tg-shadow);
}
.tg-search-submit {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; padding: 0 30px;
  background: var(--tg-sky); color: #fff; font-weight: 700; font-size: 14px; border: none; cursor: pointer;
  transition: background .15s var(--tg-ease);
}
.tg-search-submit:hover { background: #0077ed; }
.tg-search-extra { display: flex; gap: 22px; margin-top: 60px; flex-wrap: wrap; }
.tg-search-extra label { display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13px; color: var(--tg-text-muted); margin: 0; }
.tg-search-extra input[type=checkbox] { width: auto; }

@media (max-width: 900px) {
  .tg-search-bar { position: static; flex-direction: column; margin-top: 20px; }
  .tg-search-field { border-right: none; border-bottom: 1px solid var(--tg-border); }
  .tg-search-hero { padding-bottom: 34px; }
  .tg-search-extra { margin-top: 20px; }
}

/* =====================================================================
   Motion & reflections — iOS-style tactile feel
   ===================================================================== */

/* Gentle fade-up entrance for cards/stats as the page loads, staggered */
@keyframes tg-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tg-card, .tg-stat, .tg-report-card, .tg-auth-card, .tg-quick-card {
  animation: tg-rise .5s cubic-bezier(.2,.8,.2,1) both;
}
.tg-stat-grid .tg-stat:nth-child(1) { animation-delay: 0s; }
.tg-stat-grid .tg-stat:nth-child(2) { animation-delay: .05s; }
.tg-stat-grid .tg-stat:nth-child(3) { animation-delay: .1s; }
.tg-stat-grid .tg-stat:nth-child(4) { animation-delay: .15s; }
@media (prefers-reduced-motion: reduce) {
  .tg-card, .tg-stat, .tg-report-card, .tg-auth-card { animation: none; }
}

/* Tactile press feedback — iOS controls compress slightly on tap, not just darken */
button, .tg-btn, .tg-search-tab, .tg-search-submit, .tg-stat, .tg-report-card {
  transition: transform .16s cubic-bezier(.2,.8,.2,1), background .15s var(--tg-ease),
              box-shadow .18s var(--tg-ease), opacity .15s var(--tg-ease);
}
button:active, .tg-btn:active { transform: scale(.97); }
.tg-stat:hover, .tg-report-card:hover { transform: translateY(-3px) scale(1.01); }

/* Glossy top-highlight sheen on primary buttons — subtle, not the flat 2013-era gloss */
button, .tg-btn {
  position: relative; overflow: hidden;
}
button::before, .tg-btn::before {
  content: ''; position: absolute; inset: 0 0 50% 0; border-radius: inherit;
  background: linear-gradient(to bottom, rgba(255,255,255,0.18), rgba(255,255,255,0));
  pointer-events: none;
}

/* Reflection under the brand mark on auth cards / hero — classic Apple product-page mirror */
.tg-brandmark img, .tg-auth-card .tg-brandmark img {
  -webkit-box-reflect: below 2px linear-gradient(transparent 40%, rgba(0,0,0,0.08));
}

/* Smooth focus/hover glow used throughout — softer than a hard outline */
input:focus, select:focus, textarea:focus {
  transition: border-color .2s var(--tg-ease), box-shadow .25s var(--tg-ease);
}

/* ---- Required-field validation: highlight empty required fields in red, but only after
   the user has actually tried to submit — not on first page load, which would look broken. ---- */
form.tg-validated :required:invalid,
form.tg-validated :required:placeholder-shown {
  border-color: var(--tg-danger) !important;
  box-shadow: 0 0 0 3px rgba(255,59,48,0.12) !important;
}
