/* Skyread app shell, loaded by every customer page: one set of colour tokens, the light/dark theme, the top app bar,
   the phone tab bar, page transitions and the touches that make the installed app feel native. */
:root {
  color-scheme: light;
  --bg: #f6f7f9; --surface-1: #ffffff; --surface-2: #f1f3f6; --surface-3: #e9ecf1; --border: #e3e6eb; --border-strong: #cdd2da;
  --text-primary: #0e1116; --text-secondary: #464c58; --text-muted: #646a77; --accent: #2557d6; --accent-soft: #e9efff;
  --series-1: #2a6fdb; --grid: #e8eaee;
  --good: #0f7b3e; --good-soft: #e6f4ec; --warn: #9a6400; --warn-soft: #fbf1dc; --crit: #b42318; --crit-soft: #fdecea;
  --header: #0f1726; --header-text: #e9edf5; --header-muted: #9aa4b8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --bar: rgba(255, 255, 255, .82); --tabbar-h: 60px; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0b0d11; --surface-1: #14171d; --surface-2: #1a1e26; --surface-3: #222732; --border: #262b35; --border-strong: #363c48;
    --text-primary: #eceef2; --text-secondary: #bcc2cd; --text-muted: #8d94a2; --accent: #6f9dff; --accent-soft: #1b2744;
    --series-1: #5b93f5; --grid: #232833;
    --good: #4cc27e; --good-soft: #13271c; --warn: #e0a83a; --warn-soft: #2b2211; --crit: #f07167; --crit-soft: #311715;
    --header: #090b10; --shadow: none; --bar: rgba(20, 23, 29, .8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d11; --surface-1: #14171d; --surface-2: #1a1e26; --surface-3: #222732; --border: #262b35; --border-strong: #363c48;
  --text-primary: #eceef2; --text-secondary: #bcc2cd; --text-muted: #8d94a2; --accent: #6f9dff; --accent-soft: #1b2744;
  --series-1: #5b93f5; --grid: #232833;
  --good: #4cc27e; --good-soft: #13271c; --warn: #e0a83a; --warn-soft: #2b2211; --crit: #f07167; --crit-soft: #311715;
  --header: #090b10; --shadow: none; --bar: rgba(20, 23, 29, .8);
}
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text-primary); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; font-feature-settings: "cv11", "ss01"; }

/* ---- top app bar (translucent, stays put while the page scrolls) */
.app-bar { position: sticky; top: 0; z-index: 30; background: var(--bar); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  padding-top: env(safe-area-inset-top); view-transition-name: app-bar; }
.app-bar-in { max-width: 1536px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; min-height: 56px; }
.app-brand { display: flex; align-items: center; gap: 10px; color: var(--text-primary); font-weight: 650; font-size: 16px; letter-spacing: -.01em;
  text-decoration: none; flex: none; }
.app-brand:hover { text-decoration: none; }
.app-brand img { width: 28px; height: 28px; border-radius: 7px; }
.app-brand small { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); letter-spacing: 0; }
.app-bar-mid { flex: 1 1 360px; min-width: 0; display: flex; justify-content: center; }
.app-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.app-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
@media (min-width: 1281px) { .app-bar-in { flex-wrap: nowrap; } .app-bar-mid { flex: 1 1 280px; } }
@media (max-width: 1280px) { .app-bar-mid { order: 3; flex-basis: 100%; } }  /* the search gets its own row */
@media (max-width: 1599px) { .app-brand small { display: none; } }
.app-nav a { color: var(--text-secondary); font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.app-nav a:hover { color: var(--text-primary); background: var(--surface-2); text-decoration: none; }
.app-nav a[aria-current="page"] { color: var(--text-primary); background: var(--surface-2); font-weight: 600; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-secondary); cursor: pointer; flex: none; padding: 0; }
.icon-btn:hover { color: var(--text-primary); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; } :root[data-theme="dark"] .theme-icon-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .theme-icon-light { display: none; }
  :root:where(:not([data-theme="light"])) .theme-icon-dark { display: block; }
}

/* ---- phone tab bar (the app's main navigation on small screens, like a native app) */
.tabbar { display: none; }
@media (max-width: 720px) {
  .app-nav a:not(.nav-extra) { display: none; }
  .app-nav { gap: 0; } .app-nav a.nav-extra { font-size: 13px; padding: 6px 8px; }
  .app-brand small { display: none; }
  .app-bar-in { min-height: 52px; padding-top: 8px; padding-bottom: 8px; }
  .app-bar.tall { position: static; }  /* a header with a search row scrolls away; the tab bar stays */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: var(--bar); border-top: 1px solid var(--border); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); view-transition-name: tabbar; user-select: none; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tabbar-h);
    color: var(--text-muted); font-size: 10.5px; font-weight: 550; text-decoration: none; letter-spacing: .01em; }
  .tabbar a svg { width: 23px; height: 23px; stroke-width: 1.8; transition: transform .12s ease; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar a:active svg { transform: scale(.88); }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

/* ---- installed app: no rubber-band bounce behind the bars, no accidental text selection on controls */
@media (display-mode: standalone) {
  html, body { overscroll-behavior-y: none; }
  .app-nav, .icon-btn, .tabbar { -webkit-user-select: none; user-select: none; }
}

/* ---- page-to-page transitions (Chrome, Edge, Safari 18.2+); the bars stay still while the page cross-fades */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; animation-timing-function: ease-out; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- install invitation and toasts: bottom-right on desktop, above the tab bar on phones */
.install-invite, .hiq-toast { position: fixed; z-index: 55; right: 20px; bottom: 20px; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.16); animation: hiq-rise .22s ease-out; }
.install-invite { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center; width: min(380px, calc(100vw - 32px)); padding: 16px; }
.install-invite img { border-radius: 11px; }
.ii-text b { display: block; font-size: 15px; } .ii-text span { display: block; font-size: 13px; line-height: 1.45; color: var(--text-secondary); margin-top: 2px; }
.ii-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.ii-actions button, .hiq-toast button { font: inherit; font-size: 14px; font-weight: 600; border-radius: 10px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); }
.ii-actions .ii-yes { background: var(--accent); border-color: var(--accent); color: #fff; }
.hiq-toast { display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 16px; font-size: 14px; }
@keyframes hiq-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 720px) {
  .install-invite, .hiq-toast { left: 12px; right: 12px; width: auto; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
}
@media (prefers-reduced-motion: reduce) { .install-invite, .hiq-toast { animation: none; } }
