/* Parcel — reset, typography, shell layout and layout primitives. */

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  /* Focused controls and scrollIntoView targets stay clear of the sticky nav bar and the tab bar. */
  scroll-padding-top: calc(var(--navbar-h) + var(--safe-top) + 8px);
  scroll-padding-bottom: calc(var(--tabbar-space, calc(var(--tabbar-h) + var(--safe-bottom))) + 8px);
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";   /* Inter: straight-sided digits read closer to SF */
  overflow-x: clip;   /* clip, not hidden: hidden would make body a scroll container and break sticky bars */
  overflow-wrap: break-word;   /* long unbroken strings (SKU-like CJ titles) wrap instead of widening the page */
}
/* Inline SVG art: optimizeLegibility (above) mis-kerns text that is scaled far down (ad thumbnails). */
svg text { text-rendering: geometricPrecision; }
h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
/* Icons are fixed-size glyphs: max-width must never shrink one to a narrow grid track or a collapsing slot
   (it scaled row chevrons in an 8px track to half size). A narrow slot overflows or clips the icon instead. */
svg.icon { max-width: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  margin: 0;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
button:disabled { cursor: default; }
input, textarea { border: 0; background: none; outline: none; }
input::placeholder, textarea::placeholder { color: var(--label-3); opacity: 1; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

:focus { outline: none; }
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* "Skip to content": the first Tab stop; hidden until it has keyboard focus, then a floating capsule. */
.skip-link {
  position: fixed; z-index: 200;
  left: max(12px, var(--safe-left)); top: calc(var(--safe-top) + 8px);
  padding: 10px 16px;
  border-radius: var(--r-full);
  background: var(--bg-elevated);
  color: var(--accent-text);
  font-size: 15px; line-height: 20px; font-weight: var(--w-semibold); letter-spacing: -0.1px;
  box-shadow: var(--shadow-float);
  transform: translateY(calc(-100% - var(--safe-top) - 16px));
  opacity: 0;
  pointer-events: none;
}
.skip-link:focus, .skip-link:focus-visible { transform: none; opacity: 1; pointer-events: auto; }

/* ---------------------------------------------------------------- typography utilities */
.t-large    { font-size: var(--fs-large);    line-height: var(--lh-large);    letter-spacing: var(--ls-large);    font-weight: var(--w-bold); }
.t-title1   { font-size: var(--fs-title1);   line-height: var(--lh-title1);   letter-spacing: var(--ls-title1);   font-weight: var(--w-bold); }
.t-title2   { font-size: var(--fs-title2);   line-height: var(--lh-title2);   letter-spacing: var(--ls-title2);   font-weight: var(--w-bold); }
.t-title3   { font-size: var(--fs-title3);   line-height: var(--lh-title3);   letter-spacing: var(--ls-title3);   font-weight: var(--w-semibold); }
.t-headline { font-size: var(--fs-headline); line-height: var(--lh-headline); letter-spacing: var(--ls-headline); font-weight: var(--w-semibold); }
.t-body     { font-size: var(--fs-body);     line-height: var(--lh-body);     letter-spacing: var(--ls-body); }
.t-callout  { font-size: var(--fs-callout);  line-height: var(--lh-callout);  letter-spacing: var(--ls-callout); }
.t-subhead  { font-size: var(--fs-subhead);  line-height: var(--lh-subhead);  letter-spacing: var(--ls-subhead); }
.t-footnote { font-size: var(--fs-footnote); line-height: var(--lh-footnote); letter-spacing: var(--ls-footnote); }
.t-caption  { font-size: var(--fs-caption);  line-height: var(--lh-caption); }
.t-caption2 { font-size: var(--fs-caption2); line-height: var(--lh-caption2); }
.t-hero {
  font-family: var(--font-rounded);
  font-size: var(--fs-hero); line-height: var(--lh-hero); letter-spacing: var(--ls-hero);
  font-weight: var(--w-bold);
  font-variant-numeric: tabular-nums;
}
.t-rounded  { font-family: var(--font-rounded); }
.t-num      { font-variant-numeric: tabular-nums; }
.t-mono     { font-family: var(--font-mono); font-size: .92em; letter-spacing: 0; }
.t-regular  { font-weight: var(--w-regular); }
.t-medium   { font-weight: var(--w-medium); }
.t-semibold { font-weight: var(--w-semibold); }
.t-bold     { font-weight: var(--w-bold); }
.t-secondary { color: var(--label-2); }
.t-tertiary  { color: var(--label-3); }
.t-accent    { color: var(--accent-text); }
.t-pos       { color: var(--green-text); }
.t-neg       { color: var(--red-text); }
.t-warn      { color: var(--orange-text); }
.t-center    { text-align: center; }
.t-right     { text-align: right; }
.t-upper     { text-transform: uppercase; letter-spacing: .02em; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2     { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3     { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pre-line    { white-space: pre-line; }
.nowrap      { white-space: nowrap; }

/* ---------------------------------------------------------------- layout primitives */
.stack    { display: flex; flex-direction: column; gap: var(--gap, var(--sp-4)); min-width: 0; }
.stack-xs { --gap: var(--sp-1); }
.stack-sm { --gap: var(--sp-2); }
.stack-md { --gap: var(--sp-3); }
.stack-lg { --gap: var(--sp-6); }
.stack-xl { --gap: var(--sp-7); }
.hstack   { display: flex; align-items: center; gap: var(--gap, var(--sp-2)); min-width: 0; }
.hstack.wrap { flex-wrap: wrap; }
.hstack.between { justify-content: space-between; }
.hstack.top { align-items: flex-start; }
.hstack.baseline { align-items: baseline; }
.spacer   { flex: 1 1 auto; }
.grow     { flex: 1 1 auto; min-width: 0; }
.center   { display: flex; align-items: center; justify-content: center; }

/* Responsive card grids. .grid = auto-fit; .grid-2 / .grid-3 = fixed columns from 768 / 1100. */
.grid   { display: grid; gap: var(--gap, var(--sp-4)); grid-template-columns: repeat(auto-fill, minmax(var(--min, 240px), 1fr)); }
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--gap, var(--sp-4)); grid-template-columns: 1fr; }
.grid-tiles { display: grid; gap: var(--gap, var(--sp-3)); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); --gap: var(--sp-4); }
  .span-2 { grid-column: span 2; }
}
@media (min-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .span-3 { grid-column: span 3; }
}

/* Page sections: vertical rhythm between blocks of a view. */
.section { margin-top: var(--sp-7); min-width: 0; }
.section:first-child { margin-top: var(--sp-2); }
.section-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3);
  margin: 0 0 var(--sp-3);
  padding: 0 var(--sp-1);
}
.section-title { font-size: var(--fs-title3); line-height: var(--lh-title3); font-weight: var(--w-bold); letter-spacing: var(--ls-title3); }
.section-action { font-size: var(--fs-subhead); color: var(--accent-text); font-weight: var(--w-regular); white-space: nowrap; }
.section-action:active { opacity: .5; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mt-7 { margin-top: var(--sp-7); } .mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); }
.px-1 { padding-inline: var(--sp-1); }
.w-full { width: 100%; }
/* Comfortable reading/form measure for list-heavy pages on wide screens (Settings, detail forms). */
.narrow { max-width: 720px; }
.narrow.centered { margin-inline: auto; }

/* "phone" = the tab-bar layout (< 1024px: phones and tablets); "desktop" = the sidebar layout (≥ 1024px). */
.phone-only { }
.desktop-only { display: none !important; }
@media (min-width: 1024px) {
  .phone-only { display: none !important; }
  .desktop-only { display: revert !important; }
}

.divider { height: var(--hairline); background: var(--sep); border: 0; margin: 0; }

/* Press feedback for anything tappable that isn't a list row. */
.pressable {
  transition: transform var(--dur-press) var(--ease), opacity var(--dur-press) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.pressable:active { transform: scale(.97); opacity: .86; }

/* ---------------------------------------------------------------- app shell
   Layout: < 1024px = tab-bar layout (phones and tablets: bottom tab bar, content full width);
   ≥ 1024px = sidebar layout (DECISIONS §10). Tokens: --sidebar-w (0 / 256px) and --tabbar-space (room the tab bar
   takes at the bottom: tab bar + safe area, the safe area only when a page hides the tab bar, 0 at ≥ 1024px). */
.app { min-height: 100vh; min-height: 100dvh; }
.main { min-width: 0; position: relative; }

/* Nav bar */
.navbar {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-top);
}
.navbar-bg {
  position: absolute; inset: 0;
  background: var(--material);
  -webkit-backdrop-filter: var(--material-filter);
  backdrop-filter: var(--material-filter);
  box-shadow: 0 var(--hairline) 0 var(--sep);
  opacity: 0;
  transition: opacity var(--dur-fast) linear;
  pointer-events: none;
}
.navbar.is-scrolled .navbar-bg { opacity: 1; }
.navbar-row {
  position: relative;
  height: var(--navbar-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-2);
  padding: 0 max(var(--sp-2), var(--safe-left)) 0 max(var(--sp-2), var(--safe-left));
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin: 0 auto;
}
.navbar-leading, .navbar-trailing { display: flex; align-items: center; min-width: 0; gap: 2px; }
.navbar-trailing { justify-content: flex-end; }
.navbar-center {
  display: flex; flex-direction: column; align-items: center; min-width: 0;
  max-width: 56vw;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--dur-fast) linear, transform var(--dur-fast) var(--ease);
}
.navbar.show-title .navbar-center { opacity: 1; transform: none; }
.navbar-title {
  font-size: 17px; line-height: 22px; font-weight: var(--w-semibold); letter-spacing: -0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.navbar-subtitle {
  font-size: var(--fs-caption2); line-height: 13px; color: var(--label-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.navbar-subtitle:empty { display: none; }

/* Back button: chevron + parent title, iOS style */
.nav-back {
  display: inline-flex; align-items: center; gap: 1px;
  height: 44px; min-width: 44px; padding: 0 var(--sp-2) 0 4px; margin-left: -4px;
  color: var(--accent-text);
  font-size: 17px; letter-spacing: -0.2px;
  max-width: 100%;
  border-radius: var(--r-md);
  transition: opacity var(--dur-press) linear, background-color var(--dur-press) linear;
}
.nav-back svg { width: 24px; height: 24px; margin-left: -2px; }
.nav-back .nav-back-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-back:active { opacity: .45; }
/* 320px phones: a long centred title leaves ~70px; a slimmer right edge lets "‹ Back" fit instead of a bare chevron. */
@media (max-width: 359.98px) { .nav-back { padding-right: 3px; } }

.nav-action {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-1);
  min-width: 44px; height: 44px; padding: 0 var(--sp-2);
  color: var(--accent-text);
  font-size: 17px; letter-spacing: -0.2px;
  border-radius: var(--r-md);
  transition: opacity var(--dur-press) linear, background-color var(--dur-press) linear;
}
.nav-action svg { width: 22px; height: 22px; }
.nav-action.is-prominent { font-weight: var(--w-semibold); }
.nav-action:active { opacity: .45; }
.nav-action:disabled { color: var(--label-3); }
/* Mac / iPad with a pointer: toolbar-button hover. */
@media (hover: hover) and (pointer: fine) {
  .nav-back:hover, .nav-action:not(:disabled):hover { background: var(--fill-4); }
}

/* Viewport + pages */
.viewport { display: block; outline: none; }
.page {
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 max(var(--gutter), var(--safe-right)) calc(var(--tabbar-space, calc(var(--tabbar-h) + var(--safe-bottom))) + var(--sp-8)) max(var(--gutter), var(--safe-left));
  min-height: calc(100dvh - var(--navbar-h));
  will-change: auto;
}
.page-header { padding: 0 0 var(--sp-4); }
.page--pushed .page-header { padding: var(--sp-2) 0 0; }
.page--pushed .page-subtitle { display: none; }   /* pushed pages show their subtitle in the nav bar */
.large-title {
  font-size: var(--fs-large); line-height: var(--lh-large); letter-spacing: var(--ls-large);
  font-weight: var(--w-bold);
  padding: 2px 0 0;
  overflow-wrap: anywhere;
}
.page-subtitle {
  margin-top: 2px;
  font-size: var(--fs-subhead); line-height: var(--lh-subhead);
  color: var(--label-2);
}
.page-subtitle:empty { display: none; }
.view { display: block; min-width: 0; }

/* Sample data pill (quiet, persistent) */
.sample-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px 0 8px;
  border-radius: var(--r-full);
  background: var(--fill-3);
  color: var(--label-2);
  font-size: 12px; line-height: 1; font-weight: var(--w-semibold); letter-spacing: 0;
  white-space: nowrap;
  transition: gap var(--dur-fast) var(--ease), padding var(--dur-fast) var(--ease);
}
.sample-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--orange);
}
.sample-pill-text {
  display: inline-block; overflow: hidden; max-width: 8em;
  transition: max-width var(--dur-fast) var(--ease), opacity var(--dur-fast) linear;
}
/* The nav bar's leading pills (top-level pages below 1024px): "Sample data" and, while it's on, "Away mode" (js/app.js). Where
   they don't both fit beside the title, js/app.js adds .is-tight (Sample data → its dot), then .is-tighter (Away mode → its moon). */
.nav-pills { display: inline-flex; align-items: center; gap: 6px; flex: none; margin-left: var(--sp-2); }
.nav-pills.is-measuring, .nav-pills.is-measuring * { transition: none !important; }
.nav-pills.is-tight .sample-pill { gap: 0; padding: 0 9px; }
.nav-pills.is-tight .sample-pill-text { max-width: 0; opacity: 0; }
.nav-pills.is-tighter .away-pill { gap: 0; padding: 0 6px; }
.nav-pills.is-tighter .away-pill-text { max-width: 0; opacity: 0; }
/* Narrow phones: when the inline title shows, the pills shrink to their dot / moon so the bar reads as one title
   (the words stay in the accessibility tree and the tooltip). */
@media (max-width: 399.98px) {
  .navbar.show-title .navbar-leading .sample-pill { gap: 0; padding: 0 9px; }
  .navbar.show-title .navbar-leading .sample-pill-text { max-width: 0; opacity: 0; }
  .navbar.show-title .navbar-leading .away-pill { gap: 0; padding: 0 6px; }
  .navbar.show-title .navbar-leading .away-pill-text { max-width: 0; opacity: 0; }
}

/* Tab bar (< 1024px) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--material);
  -webkit-backdrop-filter: var(--material-filter);
  backdrop-filter: var(--material-filter);
  box-shadow: 0 calc(-1 * var(--hairline)) 0 var(--sep);
  transition: transform var(--dur) var(--ease), visibility 0s;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 1px; padding-top: 6px;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}
.tab-icon {
  position: relative; display: grid; place-items: center;
  color: var(--gray);
  transition: color var(--dur-fast) linear;
}
.tab-icon svg { width: 28px; height: 26px; transition: transform var(--dur-press) var(--ease); }
/* Label text uses the text-safe shades (AA at 10px on the bar material); icons keep the system fills. */
.tab-label {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--gray-text);
  font-size: 10px; line-height: 12px; font-weight: var(--w-medium); letter-spacing: .1px;
  transition: color var(--dur-fast) linear;
}
.tab[aria-current="page"] .tab-icon { color: var(--accent); }
.tab[aria-current="page"] .tab-label { color: var(--accent-text); }
.tab:active svg { transform: scale(.92); }
@media (hover: hover) and (pointer: fine) {
  .tab:not([aria-current="page"]):hover .tab-icon,
  .tab:not([aria-current="page"]):hover .tab-label { color: var(--label); }
}
/* iOS badge: red capsule with a count at the icon's top-right (a step darker than systemRed: white text ≥ 4.5:1). */
.tab-badge {
  position: absolute; top: -3px; left: calc(50% + 5px);
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--red) 80%, #000);
  color: #fff;
  font-size: 12px; line-height: 18px; font-weight: var(--w-semibold); letter-spacing: 0;
  text-align: center; font-variant-numeric: tabular-nums;
}
/* Wider phones in landscape and tablets: icon beside the label, items centred (iPadOS). */
@media (min-width: 600px) {
  .tabbar { grid-template-columns: repeat(5, minmax(0, 150px)); justify-content: center; }
  .tab { flex-direction: row; justify-content: center; align-items: center; gap: 8px; padding: 0 6px; height: var(--tabbar-h); }
  .tab-icon svg { width: 25px; height: 24px; }
  .tab-label { font-size: 13px; line-height: 16px; letter-spacing: -0.08px; }
  .tab-badge { top: -7px; left: 13px; }   /* on the icon's top-right corner, clear of the label */
}
/* Full-screen flows (route.hideTabbar) slide the tab bar away and give its room back. */
@media (max-width: 1023.98px) {
  html.tabbar-hidden { --tabbar-space: var(--safe-bottom); }
  html.tabbar-hidden .tabbar {
    transform: translateY(100%); visibility: hidden;
    transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  }
}

/* Bottom accessory (< 1024px: a bar attached to the top of the tab bar, like Music's mini player; ≥ 1024px: js/app.js
   moves it into the sidebar's footer, see below). Holds the calm "Everything is stopped · Resume" bar while autopilot is
   stopped. js/app.js sets html.has-accessory; below 1024px --accessory-space (and so --tabbar-space) grows by its
   height, so page padding, toasts, sticky action bars and scroll-padding all clear it without knowing it exists.
   Hidden on full-screen flows (route.hideTabbar) and on routes with stopBanner: false. */
.accessory {
  position: fixed; z-index: 39; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  height: var(--accessory-h);
  padding: 0 max(var(--sp-4), var(--safe-right)) 0 max(var(--sp-4), var(--safe-left));
  display: flex; align-items: center; justify-content: center;
  background: var(--material-thick);   /* thicker than the tab bar: two lines of text must read over any content */
  -webkit-backdrop-filter: var(--material-filter);
  backdrop-filter: var(--material-filter);
  box-shadow: 0 calc(-1 * var(--hairline)) 0 var(--sep);
  transform: translateY(100%); opacity: 0; visibility: hidden;
  transition: transform var(--dur) var(--ease), opacity var(--dur-fast) linear, visibility 0s linear var(--dur);
}
html.has-accessory { --accessory-space: var(--accessory-h); }
html.has-accessory .accessory {
  transform: none; opacity: 1; visibility: visible;
  transition: transform var(--dur) var(--ease), opacity var(--dur-fast) linear, visibility 0s;
}
.accessory-inner { display: flex; align-items: center; gap: var(--sp-3); width: 100%; max-width: 640px; min-width: 0; }

/* The stop bar inside it: a link to Autopilot (icon + two lines) and a Resume button. */
.stop-bar-main {
  display: flex; align-items: center; gap: var(--sp-3);
  flex: 1 1 auto; min-width: 0; min-height: var(--hit);
  border-radius: var(--r-md);
  -webkit-tap-highlight-color: transparent;
  transition: opacity var(--dur-press) linear;
}
.stop-bar-main:active { opacity: .55; }
.stop-bar-icon {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: color-mix(in srgb, var(--orange) 16%, transparent);
  color: var(--orange-text);
}
.stop-bar-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.stop-bar-title { font-size: 15px; line-height: 20px; font-weight: var(--w-semibold); letter-spacing: -0.15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-bar-sub { font-size: 13px; line-height: 17px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-bar-sub [hidden] { display: none !important; }   /* js/app.js drops "· since …" where it doesn't fit */
.stop-bar-resume { flex: none; }
@media (max-width: 359.98px) {
  .accessory { padding-inline: max(var(--sp-3), var(--safe-left)) max(var(--sp-3), var(--safe-right)); }
  .accessory-inner, .stop-bar-main { gap: 10px; }
  .stop-bar-icon { width: 28px; height: 28px; }
}
@media (hover: hover) and (pointer: fine) {
  .stop-bar-main:hover .stop-bar-title { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
}

/* Sidebar (≥ 1024px) */
.sidebar { display: none; }

@media (min-width: 768px) {
  .navbar-row { padding: 0 calc(var(--gutter) - var(--sp-2)); }
}

@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: var(--sidebar-w, 256px) minmax(0, 1fr);
  }
  .tabbar { display: none; }
  .page { padding-bottom: calc(var(--tabbar-space) + var(--sp-10)); min-height: calc(100dvh - var(--navbar-h)); }

  .sidebar {
    display: block;
    position: sticky; top: 0;
    height: 100vh; height: 100dvh;
    padding: 10px 0 10px 10px;
    z-index: 35;
  }
  .sidebar-inner {
    height: 100%;
    display: flex; flex-direction: column;
    padding: 14px 10px 12px;
    border-radius: 20px;
    background: var(--material-sidebar);
    -webkit-backdrop-filter: var(--material-filter);
    backdrop-filter: var(--material-filter);
    box-shadow: var(--shadow-sidebar);
    overflow-y: auto;
  }
  .sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 2px 8px 18px;
    font-size: 17px; font-weight: var(--w-bold); letter-spacing: -0.3px;
  }
  .app-mark {
    width: 30px; height: 30px; border-radius: 7px; overflow: hidden; flex: none;
    background: linear-gradient(160deg, #3D9BFF, #0A5BE0);
    box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .12);
    display: grid; place-items: center; color: #fff;
  }
  .app-mark img { width: 100%; height: 100%; display: block; }
  .app-mark svg { width: 18px; height: 18px; }
  .sidebar-nav ul { display: flex; flex-direction: column; gap: 2px; }
  .side-item {
    display: flex; align-items: center; gap: 10px;
    height: 38px; padding: 0 10px;
    border-radius: 10px;
    color: var(--label);
    font-size: 15px; font-weight: var(--w-medium); letter-spacing: -0.15px;
    transition: background-color var(--dur-press) linear, color var(--dur-press) linear;
  }
  .side-item svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
  .side-item .side-count {
    margin-left: auto; font-size: 13px; font-weight: var(--w-medium); color: var(--label-2);
    font-variant-numeric: tabular-nums;
  }
  .side-item:hover { background: var(--fill-4); }
  .side-item:active { background: var(--fill-3); }
  .side-item[aria-current="page"] {
    background: var(--accent-fill);
    color: #fff;
  }
  .side-item[aria-current="page"] svg,
  .side-item[aria-current="page"] .side-count { color: #fff; }
  .sidebar-foot {
    margin-top: auto;
    display: flex; flex-direction: column; gap: 10px;
    padding-top: var(--sp-3);
  }
  .sidebar-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 10px; }
  .navbar-leading .nav-pills { display: none; }

  /* The stopped bar as a small card in the sidebar footer, above Settings: it never covers the content, and the page
     needs no bottom room for it. Its two lines may wrap here; Resume runs the card's width. */
  html.has-accessory { --accessory-space: 0px; }
  .sidebar-stop:empty { display: none; }
  .sidebar .accessory {
    position: static; height: auto; padding: 0;
    display: block;
    background: none; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none;
    transform: none; opacity: 1; visibility: visible; transition: none;
  }
  html:not(.has-accessory) .sidebar .accessory { display: none; }
  .sidebar .accessory.is-entering { animation: side-stop-in var(--dur) var(--ease); }
  .sidebar .accessory-inner {
    flex-direction: column; align-items: stretch; gap: 10px;
    max-width: none; padding: 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--orange) 9%, var(--bg-2));
    box-shadow: inset 0 0 0 var(--hairline) color-mix(in srgb, var(--orange) 22%, transparent);
  }
  .sidebar .stop-bar-main { align-items: flex-start; gap: 10px; min-height: 0; }
  .sidebar .stop-bar-icon { width: 28px; height: 28px; margin-top: 1px; }
  .sidebar .stop-bar-title, .sidebar .stop-bar-sub { white-space: normal; overflow: visible; text-overflow: clip; }
  .sidebar .stop-bar-sep { display: none; }
  .sidebar .stop-bar-since { display: block; }
  .sidebar .stop-bar-since::first-letter { text-transform: uppercase; }
  .sidebar .stop-bar-resume { width: 100%; }
}
@keyframes side-stop-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Shown only if the app hasn't replaced it after 4s (offline with nothing cached, a failed module): never a blank page. */
.boot-fallback {
  grid-column: 1 / -1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 24px max(24px, var(--safe-left));
  text-align: center;
  visibility: hidden;
  animation: boot-fallback-show 0s linear 4s forwards;
}
.boot-fallback-icon { width: 64px; height: 64px; margin-bottom: 14px; border-radius: 22.5%; }
.boot-fallback-title { font-size: 20px; line-height: 25px; font-weight: var(--w-semibold); letter-spacing: -0.4px; }
.boot-fallback-text { max-width: 34ch; color: var(--label-2); font-size: 15px; line-height: 20px; }
.boot-fallback-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; margin-top: 14px; padding: 0 24px;
  border-radius: var(--r-full);
  background: var(--accent-fill); color: #fff;
  font-size: 17px; font-weight: var(--w-semibold);
}
@keyframes boot-fallback-show { to { visibility: visible; } }
@media (scripting: none) { .boot-fallback { display: none; } }   /* the <noscript> note says why */

/* No backdrop-filter support: go opaque so text stays readable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --material: var(--bg); --material-sidebar: var(--bg-2); --material-thick: var(--bg-2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
  .pressable:active { transform: none; }
}

/* Bare pages (route.bare → html.is-bare; M2: the sign-in screen): no app chrome at all. No nav bar, tab bar, sidebar or stopped
   bar; the page's <h1> stays, for screen readers only (the view draws its own centred title). */
html.is-bare { --tabbar-space: var(--safe-bottom); --accessory-space: 0px; --sidebar-w: 0px; }
html.is-bare .navbar, html.is-bare .tabbar, html.is-bare .sidebar, html.is-bare .accessory { display: none !important; }
html.is-bare .page-header {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
html.is-bare .page { min-height: 100dvh; padding-top: var(--safe-top); }
@media (min-width: 1024px) { html.is-bare .app { grid-template-columns: minmax(0, 1fr); } }

/* Windows High Contrast / forced colours: backgrounds and shadows are dropped, so give the shell real edges and
   mark the selected tab with the system highlight plus an underline (never colour alone). */
@media (forced-colors: active) {
  .tabbar { border-top: 1px solid CanvasText; background: Canvas; }
  .navbar-bg { border-bottom: 1px solid CanvasText; background: Canvas; }
  .sidebar-inner { border: 1px solid CanvasText; }
  .tab[aria-current="page"] .tab-icon, .tab[aria-current="page"] .tab-label,
  .side-item[aria-current="page"], .side-item[aria-current="page"] svg, .side-item[aria-current="page"] .side-count { color: Highlight; }
  .tab[aria-current="page"] .tab-label, .side-item[aria-current="page"] .side-label {
    text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
  }
  .tab[aria-current="page"] .tab-label { overflow: visible; text-underline-offset: 2px; }
  .side-item[aria-current="page"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .tab-badge, .sample-pill, .away-pill, .skip-link, .boot-fallback-btn { border: 1px solid CanvasText; }
  .accessory { border-top: 1px solid CanvasText; background: Canvas; }
  .stop-bar-icon { border: 1px solid CanvasText; }
}
@media (forced-colors: active) and (min-width: 1024px) {
  .sidebar .accessory { border-top: 0; background: none; }
  .sidebar .accessory-inner { border: 1px solid CanvasText; background: Canvas; }
}

@media print {
  .tabbar, .sidebar, .navbar, .skip-link, .accessory { display: none !important; }
  body { background: #fff; }
}
