/* Opus Hub — app styles. Values are the canvas's (Opus Hub.dc.html, artboards of turns 2–5),
   lifted into the token names of css/tokens.css (UI spec §1, §9). Type sizes go through --u so they
   are exact design pixels at the default text size and follow the user's text-size setting.
   Phone first; the desktop layouts (single column 700–1100, grid above 1100) arrive in step 4 —
   until then every width shows the phone column, centred. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ground);
  color: var(--ink);
}

body {
  font-family: var(--font);
  font-size: calc(16 * var(--u));
  line-height: calc(21 * var(--u));
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; -webkit-appearance: none; appearance: none;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
a { color: inherit; text-decoration: none; }
h1 { margin: 0; font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- frame ---------- */
.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
}
/* iOS 26+ paints its own blur (the "Liquid Glass" edge effect) over the ~40 pt under the status bar of an
   installed web app. It is anchored to the screen edge and has no opt-out from the page (seen on Ljubo's
   iPhone 21.09.2026: the header date blurred, the line under it sharp). So in the installed iPhone app
   nothing starts inside that strip — which is also where native large titles begin. Elsewhere: 0. */
:root { --edge-clear: 0px; }
@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone) {
    :root { --edge-clear: 40px; }
  }
}
.screen {
  padding-top: calc(env(safe-area-inset-top) + var(--edge-clear));
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}
.gutter { margin: 0 var(--gutter); }

/* ---------- headers ---------- */
.home-header, .plain-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px var(--gutter) 16px;
}
.plain-header { padding: 6px var(--gutter) 14px; }
.plain-header.with-back { padding-top: 2px; }
.screen-title {
  font-size: calc(22 * var(--u)); line-height: calc(28 * var(--u));
  font-weight: 700; letter-spacing: -.01em;
}
.screen-sub { font-size: calc(12 * var(--u)); line-height: calc(16 * var(--u)); color: var(--ink-3); }

.sync-line {
  display: flex; align-items: center; gap: 5px;
  font-size: calc(12 * var(--u)); line-height: calc(16 * var(--u)); color: var(--ink-3);
}
.sync-line.is-stale { color: var(--attention); font-weight: 500; }

.back-link {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; margin-left: -4px;
  color: var(--accent); font-size: calc(16 * var(--u)); font-weight: 500;
}
.back-chevron {
  width: 9px; height: 9px; margin-left: 4px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.round-btn {
  flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--fill);
  display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.round-btn::after { content: ''; position: absolute; inset: -4px; }   /* 44 px tap target */

/* ---------- dots ---------- */
.dot { flex: none; width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--ok); }
.dot-attention { background: var(--attention); }
.dot-pending { background: var(--pending); }
.dot-pending.dot-hollow { background: none; border: 1.5px solid var(--pending); }

/* ---------- banner (spec §3.8) ---------- */
.banner-slot:empty { display: none; }
.banner-slot { margin: 0 var(--gutter) 16px; }
.banner {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 8px 12px 8px 14px; border-radius: var(--r-card);
  font-size: calc(14 * var(--u)); line-height: calc(19 * var(--u));
}
.banner-amber { background: var(--banner-amber); color: var(--banner-amber-ink); }
.banner-red { background: var(--banner-red); color: var(--banner-red-ink); }
.banner-text { flex: 1; min-width: 0; }
.banner-btn {
  flex: none; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--banner-button);
  font-weight: 600; font-size: calc(13 * var(--u)); color: var(--ink);
}

/* ---------- section title (spec §3.1) ---------- */
.section-title {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 32px 2px;
}
.section-title-text {
  display: inline-flex; align-items: center; min-height: 34px;
  font-size: calc(11 * var(--u)); line-height: calc(13 * var(--u));
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600;
}

/* ---------- cards ---------- */
.card {
  margin: 0 var(--gutter) var(--card-gap);
  background: var(--card); border-radius: var(--r-card);
}
.card-rows { padding: 4px var(--card-inset); }
.gutter > .card { margin-left: 0; margin-right: 0; }

.data-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 44px; padding: 6px 0;
  font-size: calc(15 * var(--u)); line-height: calc(20 * var(--u));
}
.data-row + .data-row { border-top: .5px solid var(--hairline); }
.data-label { flex: none; }
.data-value {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  color: var(--ink-2); text-align: right;
}

/* ---------- segmented (spec §3.6) ---------- */
.seg {
  display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-seg); background: var(--fill);
  font-size: calc(13 * var(--u)); font-weight: 500;
}
.seg-item {
  min-height: 26px; padding: 0 10px; border-radius: 6px;
  display: inline-flex; align-items: center; color: var(--ink-soft); white-space: nowrap;
}
.seg-item.is-on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--thumb-shadow); }

/* ---------- buttons ---------- */
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 16px; border-radius: 17px;
  font-size: calc(15 * var(--u)); font-weight: 600; white-space: nowrap;
}
.pill-primary { background: var(--accent); color: var(--card); }
.pill-quiet {
  height: 32px; padding: 0 12px; border-radius: 16px; background: var(--fill-2); color: var(--accent);
  font-size: calc(13 * var(--u));
}

/* ---------- never synced (spec §4, canvas 3h) ---------- */
.skeleton-card { padding: 14px 14px 12px; }
.skeleton-lines { display: flex; flex-direction: column; gap: 10px; }
.skeleton-line { display: block; height: 11px; border-radius: 5px; background: var(--skeleton); }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w92 { width: 92%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w88 { width: 88%; }
.skeleton-caption {
  margin-top: 14px; color: var(--ink-2);
  font-size: calc(13 * var(--u)); line-height: calc(18 * var(--u));
}
.skeleton-card .pill-quiet { margin-top: 8px; }

/* ---------- tab bar (canvas 2a) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--bar); border-top: .5px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-user-select: none; user-select: none;
}
.tabbar-inner {
  max-width: 640px; margin: 0 auto; padding: 6px 8px 4px;
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.tab {
  position: relative; height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-4);
}
.tab.is-on { color: var(--accent); }
.tab-label { font-size: calc(10 * var(--u)); line-height: calc(12 * var(--u)); font-weight: 500; }
.tab.is-on .tab-label { font-weight: 600; }
.tab-badge {
  position: absolute; top: 0; left: calc(50% + 4px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--ink); color: var(--card);
  font-size: calc(11 * var(--u)); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- icons ---------- */
.icon { display: block; flex: none; }
.icon-tab { width: 22px; height: 20px; }
.icon-gear { width: 16px; height: 16px; color: var(--ink-2); }
.icon-line { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-teeth { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-dasharray: 2.317 2.317; }

/* ---------- sign-in (not in the canvas; drawn in its language) ---------- */
.signin {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}
.signin-inner { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.signin-btn { height: 44px; padding: 0 24px; border-radius: 22px; font-size: calc(16 * var(--u)); }
.signin-note {
  margin: 0; max-width: 280px; color: var(--ink-3);
  font-size: calc(13 * var(--u)); line-height: calc(18 * var(--u));
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}
