/* AranID components: frosted-glass bento. Every value comes from tokens.css; nothing here is theme-specific.
   Glass recipe: translucent white fill + 1px light border + inset top highlight + soft tinted shadow.
   Blur is applied to the frame, popovers, dialogs and floating bars only. Cards inside the frame use a
   translucent fill without their own blur (no glass-on-glass, and far cheaper to render). */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* No background on <html>: then the body's backdrop is painted across the WHOLE canvas. (With one, the strip above
   the body, pushed down by the layout's top margin, showed a flat colour and a visible line.) */
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-ui); font-size: var(--fs-md); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  /* The backdrop: four soft pools of colour. Glass needs variation behind it to read as glass. */
  background-image:
    radial-gradient(40rem 32rem at 10% 6%, var(--blob-1), transparent 70%),
    radial-gradient(36rem 30rem at 90% 10%, var(--blob-3), transparent 70%),
    radial-gradient(42rem 34rem at 80% 96%, var(--blob-2), transparent 70%),
    radial-gradient(30rem 26rem at 4% 92%, var(--blob-4), transparent 70%);
  background-attachment: fixed;
}
::selection { background: var(--accent-soft); color: var(--text); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -0.015em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { color: var(--muted); font-size: var(--fs-sm); }
a { color: var(--accent); text-underline-offset: 0.2em; }
code, .mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Icons: thin line ──────────────────────────────────── */
.icon { width: 1.25rem; height: 1.25rem; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0 var(--sp-5);
  border: var(--glass-line); border-radius: var(--r-pill);
  background: var(--glass-3); color: var(--text); box-shadow: var(--edge);
  font: 500 var(--fs-sm)/1 var(--font-ui); cursor: pointer; text-decoration: none;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.btn:hover { box-shadow: var(--edge), 0 6px 18px rgba(25, 45, 90, 0.14); transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-busy="true"], .btn[aria-disabled="true"] { opacity: 0.5; cursor: default; transform: none; box-shadow: none; pointer-events: none; }
.btn--primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(0.94); }
.btn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--block { width: 100%; }
.btn--sm { min-height: 2.5rem; padding: 0 var(--sp-4); }
.btn--icon { width: var(--tap); padding: 0; background: var(--surface); border-color: transparent; box-shadow: none; }
.btn--icon.btn--sm { width: 2.5rem; }
.iconbtn { position: relative; width: var(--tap); height: var(--tap); display: grid; place-items: center; border: var(--glass-line); border-radius: 50%; background: var(--glass-2); color: var(--text); cursor: pointer; box-shadow: var(--edge); transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.iconbtn:hover { background: var(--glass-3); transform: translateY(-1px); }
.iconbtn .dot { position: absolute; top: 0.6rem; right: 0.65rem; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--warm); box-shadow: 0 0 0 2px var(--glass-3); }

/* ── Theme switch (system · light · dark) ──────────────── */
.seg { display: inline-flex; gap: var(--sp-1); padding: var(--sp-1); background: var(--surface); border-radius: var(--r-pill); }
.seg button { width: 2.375rem; height: 2.375rem; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: var(--edge); }
.theme-corner { position: fixed; top: var(--sp-4); right: var(--sp-4); z-index: 50; }

/* ── Fields ────────────────────────────────────────────── */
.field { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.field > label, .label { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }
.input, .textarea, .select {
  width: 100%; min-height: var(--tap); padding: var(--sp-3) var(--sp-4);
  border: var(--glass-line); border-radius: var(--r-inner); background: var(--glass-3); color: var(--text);
  font: var(--fs-md)/var(--lh-body) var(--font-ui);
  box-shadow: inset 0 1px 3px rgba(20, 40, 70, 0.08);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 0.75; }
.textarea { resize: vertical; min-height: 6rem; }
.input:hover, .textarea:hover { border-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.input:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.hint { font-size: var(--fs-xs); color: var(--muted); }
.error-text { font-size: var(--fs-xs); color: var(--danger); }
.alert { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-inner); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--warn { background: var(--warm-soft); color: var(--warm); }
.alert--ok { background: var(--accent-soft); color: var(--accent); }

/* ── Seal: ringed avatar / app monogram ────────────────── */
.seal {
  --size: 3rem;
  width: var(--size); height: var(--size); flex: none; border-radius: 50%; margin: var(--sp-1);
  display: grid; place-items: center; overflow: hidden;
  background: var(--accent-soft); color: var(--accent);
  font: 700 calc(var(--size) * 0.36)/1 var(--font-display);
  box-shadow: 0 0 0 2px var(--glass-3), 0 0 0 3.5px var(--accent);
}
.seal img { width: 100%; height: 100%; object-fit: cover; }
.seal--lg { --size: 5.75rem; }
.seal--sm { --size: 2.25rem; }

/* ── Lists: pill rows ──────────────────────────────────── */
.section-label { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; padding: var(--sp-5) var(--sp-4) var(--sp-2); }
.rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
.row {
  display: flex; align-items: center; gap: var(--sp-4);
  min-height: 3.5rem; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill); border: 0; background: transparent; color: var(--text);
  font: 500 var(--fs-md)/1.2 var(--font-ui); text-align: left; text-decoration: none; cursor: pointer; width: 100%;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.row .icon { color: var(--muted); }
.row:hover { background: var(--surface); }
.row__body { flex: 1; min-width: 0; }
.row__title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__sub { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__go { width: 2.5rem; height: 2.5rem; border-radius: var(--r-inner); background: var(--surface); display: grid; place-items: center; flex: none; color: var(--muted); }
.row--card { background: var(--glass-2); border: var(--glass-line); border-radius: var(--r-card); padding: var(--sp-3) var(--sp-4); min-height: 4.75rem; box-shadow: var(--edge), var(--shadow-soft); }
a.row--card:hover { background: var(--glass-3); transform: translateY(-2px); box-shadow: var(--edge), var(--shadow-lift); }

.badge { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-3); min-height: 1.75rem; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--surface); color: var(--muted); }
.badge--ok { background: var(--accent-soft); color: var(--accent); }
.badge--warn { background: var(--warm-soft); color: var(--warm); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }

/* ── App layout: header strip, icon rail, stage (no visible container) ─ */
.skiplink { position: absolute; left: var(--sp-4); top: -4rem; z-index: 100; }
.skiplink:focus { top: var(--sp-3); }
.frame {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "strip strip" "rail stage"; /* 1fr row absorbs spare height so the strip stays at the top */
  gap: var(--sp-4) var(--sp-4);
  max-width: 100rem; min-height: calc(100vh - var(--sp-5) * 2); margin: var(--sp-5) auto; padding: var(--sp-4) 0 var(--sp-5);
  /* No visible container: the header, rail and cards float directly on the plain page. The frame only
     provides the grid. (A translucent wrapper added a third layer and made everything feel heavier.) */
}
body.has-shell { padding: 0 var(--sp-5); }

/* Header strip: greeting · search · mode · alerts · account */
.strip { grid-area: strip; display: flex; align-items: center; gap: var(--sp-4); min-height: var(--strip-h); padding: 0 var(--sp-2); position: relative; z-index: 30; }
.strip__hello { display: grid; line-height: 1.2; min-width: 0; }
.strip__hello span { font-size: var(--fs-xs); color: var(--muted); }
.strip__hello strong { font: 700 var(--fs-lg)/1.2 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip__brand { display: none; font: 700 var(--fs-lg)/1 var(--font-display); letter-spacing: 0.01em; color: var(--text); text-decoration: none; }
.strip__spacer { flex: 1; }
.search { position: relative; flex: 1; max-width: 30rem; margin-left: auto; }
.search__field { display: flex; align-items: center; gap: var(--sp-2); height: var(--tap); padding: 0 var(--sp-4); border: var(--glass-line); border-radius: var(--r-pill); background: var(--glass-2); box-shadow: var(--edge); color: var(--muted); }
.search__field:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.search__field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: var(--fs-sm)/1 var(--font-ui); height: 100%; }
.search__field input::placeholder { color: var(--muted); opacity: 0.85; }
.search__list { position: absolute; left: 0; right: 0; top: calc(100% + var(--sp-2)); display: grid; gap: var(--sp-1); padding: var(--sp-2); list-style: none; background: var(--glass-3); border: var(--glass-line); border-radius: var(--r-card); box-shadow: var(--shadow-pop); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.search__list a { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--r-inner); color: var(--text); text-decoration: none; font-size: var(--fs-sm); }
.search__list a:hover, .search__list a[aria-selected="true"] { background: var(--accent-soft); }
.search__list small { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); }
.search__empty { padding: var(--sp-3); color: var(--muted); font-size: var(--fs-sm); }
.search-btn { display: none; }
.strip__tools { display: flex; align-items: center; gap: var(--sp-3); }
.pop-anchor { position: relative; }
.pop { position: absolute; right: 0; top: calc(100% + var(--sp-2)); width: min(22rem, 90vw); padding: var(--sp-3); background: var(--glass-3); border: var(--glass-line); border-radius: var(--r-card); box-shadow: var(--shadow-pop); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); z-index: 40; }
.pop__head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-2) var(--sp-3); border-bottom: var(--hairline); margin-bottom: var(--sp-2); }
.pop__head strong { display: block; font-family: var(--font-display); }
.pop__head p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop__title { padding: var(--sp-2) var(--sp-3); font: 700 var(--fs-md)/1 var(--font-display); }
.pop__item { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--r-inner); border: 0; background: transparent; color: var(--text); font: 500 var(--fs-sm)/1.2 var(--font-ui); text-decoration: none; cursor: pointer; width: 100%; text-align: left; }
.pop__item:hover { background: var(--surface); }
.pop__item .icon { color: var(--muted); }
.pop__row { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.pop__foot { padding: var(--sp-2) var(--sp-3) 0; }
.pop__foot a { font-size: var(--fs-sm); }

/* Icon rail: icons only, one raised active item, tooltips, collapse chevron */
.rail { grid-area: rail; align-self: start; position: sticky; top: var(--sp-5); display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-2); width: var(--rail-w); padding: var(--sp-3); background: var(--glass-2); border: var(--glass-line); border-radius: var(--r-pill); box-shadow: var(--edge), var(--shadow-soft); transition: width var(--dur-med) var(--ease); }
.rail--wide { width: var(--rail-w-wide); border-radius: var(--r-card); }
.rail__item { position: relative; display: flex; align-items: center; gap: var(--sp-3); min-height: 3.25rem; padding: 0 var(--sp-3); border-radius: var(--r-pill); color: var(--muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.rail__item .icon { width: 1.375rem; height: 1.375rem; }
.rail__item:hover { color: var(--text); background: var(--surface); }
.rail__item[aria-current="page"] { background: var(--glass-3); color: var(--accent); box-shadow: var(--edge), 0 6px 16px rgba(25, 45, 90, 0.16); }
.rail__label { display: none; white-space: nowrap; }
.rail--wide .rail__label { display: inline; }
.rail:not(.rail--wide) .rail__item { justify-content: center; padding: 0; }
.rail:not(.rail--wide) .rail__item::after { content: attr(data-tip); position: absolute; left: calc(100% + var(--sp-3)); top: 50%; transform: translateY(-50%) translateX(-4px); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-inner); background: var(--text); color: var(--bg); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); z-index: 60; }
.rail:not(.rail--wide) .rail__item:hover::after, .rail:not(.rail--wide) .rail__item:focus-visible::after { opacity: 1; transform: translateY(-50%); }
.rail__sep { height: 1px; background: var(--rule); margin: var(--sp-1) var(--sp-3); }
.rail__collapse { margin-top: var(--sp-1); display: grid; place-items: center; min-height: 2.75rem; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); cursor: pointer; }
.rail__collapse:hover { background: var(--surface); color: var(--text); }
.rail__collapse .icon { transition: transform var(--dur-med) var(--ease); }
.rail--wide .rail__collapse .icon { transform: rotate(180deg); }

.stage { grid-area: stage; min-width: 0; padding-bottom: 6rem; }
.stage .content { max-width: 56rem; margin: 0 auto; padding: 0 var(--sp-2) var(--sp-6); min-width: 0; }
.stage .content[data-layout="narrow"] { max-width: 44rem; }
.stage .content[data-layout="wide"] { max-width: none; }
.content:focus { outline: none; }
/* A light fade when the app swaps pages in place */
.content.enter { animation: contentIn var(--dur-med) var(--ease); }
@keyframes contentIn { from { opacity: 0; transform: translateY(6px); } }
.page-head { display: flex; align-items: flex-end; gap: var(--sp-4); justify-content: space-between; margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-xl); }
.page-head p { margin-top: var(--sp-2); }

/* Floating pill switcher: scope (all apps / one app) and a detached + */
.switcher { position: fixed; left: 50%; bottom: var(--sp-5); transform: translateX(-50%); z-index: 35; display: flex; align-items: center; gap: var(--sp-3); max-width: calc(100vw - var(--sp-5) * 2); }
.switcher__pills { display: flex; align-items: center; gap: var(--sp-1); padding: var(--sp-1); background: var(--glass-1); border: var(--glass-line); border-radius: var(--r-pill); box-shadow: var(--edge), var(--shadow-pop); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); overflow-x: auto; scrollbar-width: none; }
.switcher__pills::-webkit-scrollbar { display: none; }
.pill { flex: none; min-height: var(--tap); padding: 0 var(--sp-5); border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font: 500 var(--fs-sm)/1 var(--font-ui); cursor: pointer; white-space: nowrap; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.pill:hover { color: var(--text); }
.pill[aria-pressed="true"] { background: var(--glass-3); color: var(--text); box-shadow: var(--edge), 0 6px 16px rgba(25, 45, 90, 0.18); }
.switcher__add { width: var(--tap); height: var(--tap); display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--glass-1); border: var(--glass-line); color: var(--text); text-decoration: none; box-shadow: var(--edge), var(--shadow-pop); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.switcher__add:hover { background: var(--glass-3); }

/* ── Bento grid ────────────────────────────────────────── */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--sp-4); }
.tile { grid-column: span 12; min-width: 0; padding: var(--sp-5); background: var(--glass-2); border: var(--glass-line); border-radius: var(--r-card); box-shadow: var(--edge), var(--shadow-soft); display: flex; flex-direction: column; gap: var(--sp-3); opacity: 0; transform: translateY(14px); animation: rise var(--dur-slow) var(--ease) forwards; animation-delay: calc(var(--i, 0) * 55ms); transition: background var(--dur-fast) var(--ease), transform var(--dur-med) var(--ease), box-shadow var(--dur-med) var(--ease); }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tile { animation: none; opacity: 1; transform: none; } }
a.tile, button.tile { text-decoration: none; color: inherit; cursor: pointer; text-align: left; font: inherit; }
a.tile:hover, button.tile:hover, .tile--hover:hover { background: var(--glass-3); transform: translateY(-2px); box-shadow: var(--edge), var(--shadow-lift); }
.bento--static .tile { animation: none; opacity: 1; transform: none; }
.tile h2 { font-size: var(--fs-md); }
.tile__head { display: flex; align-items: center; gap: var(--sp-3); }
.tile__head .grow { flex: 1; min-width: 0; }
.tile__go { margin-left: auto; color: var(--muted); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }
.chip-icon { width: 2.75rem; height: 2.75rem; flex: none; display: grid; place-items: center; border-radius: var(--r-inner); background: var(--accent-soft); color: var(--accent); }
.chip-icon--warm { background: var(--warm-soft); color: var(--warm); }
.chip-icon--danger { background: var(--danger-soft); color: var(--danger); }
.stat__label { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.stat__num { font: 700 var(--fs-stat)/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat__unit { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; margin-left: var(--sp-2); letter-spacing: 0; font-family: var(--font-ui); }
.stat__foot { font-size: var(--fs-xs); color: var(--muted); margin-top: auto; }
.welcome h2 { font-size: var(--fs-xl); }
.welcome p { color: var(--muted); }
.statline { display: flex; align-items: baseline; flex-wrap: wrap; }

/* Hero rings: the focal points and the only place with a strong accent */
.hero { flex-direction: row; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.hero__ring { flex: none; }
.hero__body { flex: 1 1 14rem; min-width: 0; display: grid; gap: var(--sp-3); align-content: center; }
.ring { position: relative; width: 11rem; height: 11rem; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--surface-strong); stroke-width: 9; }
.ring__bar { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset var(--dur-ring) var(--ease); }
.ring__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring__value { font: 700 var(--fs-2xl)/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring__label { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); font-weight: 500; }
.checks { display: grid; gap: var(--sp-1); list-style: none; }
.check-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 2.5rem; font-size: var(--fs-sm); }
.check-row .mark { width: 1.5rem; height: 1.5rem; flex: none; display: grid; place-items: center; border-radius: 50%; }
.check-row .mark--ok { background: var(--accent-soft); color: var(--accent); }
.check-row .mark--no { background: var(--warm-soft); color: var(--warm); }
.check-row .mark .icon { width: 0.875rem; height: 0.875rem; stroke-width: 2; }
.check-row small { color: var(--muted); font-size: var(--fs-xs); display: block; }
.check-row .grow { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { min-height: 2.75rem; padding: 0 var(--sp-4); display: inline-flex; align-items: center; gap: var(--sp-2); border: var(--glass-line); border-radius: var(--r-pill); background: var(--glass-3); color: var(--text); font: 500 var(--fs-sm)/1 var(--font-ui); cursor: pointer; text-decoration: none; box-shadow: var(--edge); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.chip:hover { background: var(--surface); }
.chip[aria-pressed="true"], .chip--on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.mini-apps { display: grid; gap: var(--sp-1); }
.mini-app { display: flex; align-items: center; gap: var(--sp-3); min-height: 3rem; padding: 0 var(--sp-3); border-radius: var(--r-inner); color: var(--text); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; }
.mini-app:hover, .mini-app[aria-current="true"] { background: var(--accent-soft); }
.mini-app span:last-child { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }

/* Mini chart: muted bars, ONE highlighted datum with a tooltip, direct labels */
.bars { position: relative; display: flex; align-items: flex-end; gap: var(--sp-1); height: 6.5rem; margin-top: auto; }
.bar { position: relative; flex: 1; min-width: 2.75rem; height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0; border: 0; background: transparent; cursor: pointer; }
.bar i { display: block; width: 62%; max-width: 1.75rem; min-height: 0.3125rem; border-radius: var(--r-pill); background: var(--surface-strong); transition: background var(--dur-fast) var(--ease), height var(--dur-slow) var(--ease); }
.bar[data-hi="true"] i { background: var(--accent); }
.bar:hover i, .bar:focus-visible i { background: var(--accent); }
.bar-days { display: flex; gap: var(--sp-1); }
.bar-days span { flex: 1; min-width: 2.75rem; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.tip { position: absolute; bottom: calc(100% + var(--sp-2)); left: 50%; transform: translateX(-50%); padding: var(--sp-1) var(--sp-3); border-radius: var(--r-inner); background: var(--text); color: var(--bg); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-fast) var(--ease); z-index: 5; }
.bar:hover .tip, .bar:focus-visible .tip, .bar[data-hi="true"] .tip[data-show] { opacity: 1; }

/* Toggle + status row */
.toggle { position: relative; width: 3.25rem; height: 1.875rem; flex: none; border: 0; border-radius: var(--r-pill); background: var(--surface-strong); cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.toggle::after { content: ''; position: absolute; top: 0.1875rem; left: 0.1875rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); transition: transform var(--dur-med) var(--ease); }
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"]::after { transform: translateX(1.375rem); }
.toggle-hit { display: flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); }
.status { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); margin-top: auto; }
.status strong { color: var(--text); font-weight: 600; }
.status .on { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--surface-strong); flex: none; }
.status .on[data-on="true"] { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Slide to confirm (risky actions) */
.slide { position: relative; height: 3.25rem; margin-top: auto; border-radius: var(--r-pill); background: var(--surface); border: var(--glass-line); overflow: hidden; touch-action: none; user-select: none; }
.slide__fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent-soft); }
.slide__label { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 3rem; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); pointer-events: none; }
.slide__thumb { position: absolute; top: 0.25rem; left: 0.25rem; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); cursor: grab; box-shadow: 0 4px 12px rgba(27, 95, 191, 0.35); transition: transform var(--dur-med) var(--ease); }
.slide[data-dragging] .slide__thumb { transition: none; cursor: grabbing; }
.slide[data-done] .slide__label { color: var(--accent); }
.slide__alt { margin-top: var(--sp-1); font-size: var(--fs-xs); color: var(--muted); }

/* Activity feed + sessions */
.feed { display: grid; gap: var(--sp-1); list-style: none; }
.feed li { display: flex; align-items: center; gap: var(--sp-3); min-height: 3.25rem; padding: var(--sp-2) var(--sp-2); border-radius: var(--r-inner); }
.feed .chip-icon { width: 2.25rem; height: 2.25rem; }
.feed .grow { flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--text); }
.feed time, .feed small { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.feed .grow small { display: block; white-space: normal; }
.day-label { font: 700 var(--fs-sm)/1 var(--font-display); color: var(--muted); padding: var(--sp-4) var(--sp-2) var(--sp-1); letter-spacing: 0.02em; }
.sess { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) 0; border-bottom: var(--hairline); }
.sess:last-child { border-bottom: 0; }
.sess .grow { flex: 1; min-width: 0; }
.sess strong { font-weight: 600; font-size: var(--fs-sm); }
.sess p { font-size: var(--fs-xs); }

/* ── Panels (console, forms) ───────────────────────────── */
.panel { background: var(--glass-2); border: var(--glass-line); border-radius: var(--r-card); padding: var(--sp-6) var(--sp-5); margin-bottom: var(--sp-5); box-shadow: var(--edge), var(--shadow-soft); }
.panel > h2 { margin-bottom: var(--sp-1); }
.panel > p { margin-bottom: var(--sp-4); }
.panel--danger { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.steps { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.steps li { list-style: none; flex: 1; height: 0.3125rem; border-radius: var(--r-pill); background: var(--surface-strong); }
.steps li[data-done="true"] { background: var(--accent); }
.step-label { font-size: var(--fs-xs); color: var(--muted); margin-bottom: var(--sp-2); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.choice { display: grid; gap: var(--sp-3); }
.choice label { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); background: var(--glass-2); border: var(--glass-line); border-radius: var(--r-inner); cursor: pointer; box-shadow: var(--edge); transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.choice label:hover { background: var(--glass-3); }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice input { margin-top: 0.3rem; accent-color: var(--accent); }
.choice strong { display: block; font-size: var(--fs-sm); }
.choice span { font-size: var(--fs-xs); color: var(--muted); }
.uri-list { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.uri-item { display: flex; gap: var(--sp-2); align-items: center; }
.uri-item .input { font-family: var(--font-mono); font-size: var(--fs-sm); }
.cred { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border: var(--hairline); border-radius: var(--r-pill); background: var(--surface); }
.cred code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codeblock { background: var(--code-bg); color: var(--code-text); border: 1px solid var(--code-rule); border-radius: var(--r-inner); padding: var(--sp-4); overflow-x: auto; font: var(--fs-sm)/1.65 var(--font-mono); white-space: pre; margin-bottom: var(--sp-3); }
.secret-box { border: 1.5px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-radius: var(--r-card); padding: var(--sp-5); background: var(--accent-soft); margin-bottom: var(--sp-5); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
.check { display: flex; gap: var(--sp-3); align-items: center; font-size: var(--fs-sm); cursor: pointer; min-height: var(--tap); }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-5); }
.actions--end { justify-content: flex-end; }

/* ── Empty / skeleton / toast / dialog ─────────────────── */
.empty { text-align: center; padding: var(--sp-8) var(--sp-4); background: var(--glass-2); border: 1.5px dashed var(--rule); border-radius: var(--r-card); display: grid; justify-items: center; gap: var(--sp-3); }
.empty h2 { font-weight: 500; }
.skeleton { height: 4.75rem; border-radius: var(--r-card); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-strong) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; margin-bottom: var(--sp-2); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.toasts { position: fixed; z-index: 80; inset: auto var(--sp-4) calc(var(--sp-5) + 4.5rem) var(--sp-4); display: grid; justify-items: center; gap: var(--sp-2); pointer-events: none; }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); padding: var(--sp-3) var(--sp-5); border-radius: var(--r-pill); font-size: var(--fs-sm); box-shadow: var(--shadow-pop); animation: rise var(--dur-med) var(--ease) both; }
.toast--error { background: var(--danger); color: var(--bg); }
dialog { margin: auto; border: var(--glass-line); border-radius: var(--r-card); padding: var(--sp-6) var(--sp-5); width: min(28rem, 92vw); max-height: 92vh; overflow-y: auto; background: var(--glass-3); color: var(--text); box-shadow: var(--shadow-pop); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog h2 { margin-bottom: var(--sp-2); }
dialog p { margin-bottom: var(--sp-4); }
.qr { display: grid; place-items: center; padding: var(--sp-3); margin-bottom: var(--sp-4); background: #fff; border-radius: var(--r-inner); }
.qr img { width: 11rem; height: 11rem; display: block; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); margin-bottom: var(--sp-4); }
.codes code { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-inner); background: var(--surface); text-align: center; letter-spacing: 0.08em; }

/* ── Centered auth cards (sign in, register, consent) ──── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-5) var(--sp-4); }
@media (max-width: 40rem) { .auth-wrap { padding-top: calc(var(--sp-8) + var(--sp-3)); align-items: start; } }
.auth-card { width: min(27rem, 100%); background: var(--glass-1); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: var(--glass-line); border-radius: var(--r-frame); padding: var(--sp-7) var(--sp-6); box-shadow: var(--edge), var(--shadow-pop); }
.auth-card .brand { text-align: center; font: 700 var(--fs-lg)/1 var(--font-display); margin-bottom: var(--sp-6); letter-spacing: 0.01em; }
.auth-card h1 { text-align: center; margin-bottom: var(--sp-1); }
.auth-card > p, .auth-card h1 + p { text-align: center; margin-bottom: var(--sp-6); }
.auth-card .foot { text-align: center; margin-top: var(--sp-5); font-size: var(--fs-xs); color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; min-height: var(--tap); }
.pair { display: flex; align-items: center; justify-content: center; gap: var(--sp-4); margin-bottom: var(--sp-5); color: var(--muted); }
.perm { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-pill); background: var(--surface); font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.perm .icon { color: var(--muted); }
#auth-content { transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease); }
#auth-content.fade-out { opacity: 0; transform: translateY(0.5rem); }
.input--code { text-align: center; letter-spacing: 0.4em; font: 500 var(--fs-lg)/1 var(--font-mono); }

/* ── Docs (public developer guide) ─────────────────────── */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--glass-1); border-bottom: var(--glass-line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.docs__bar { gap: var(--sp-4); }
.docs__brand { font: 700 var(--fs-lg)/1 var(--font-display); color: var(--text); text-decoration: none; flex: 1; }
.docs__nav { display: flex; align-items: center; gap: var(--sp-4); }
.docs__nav a:not(.btn) { color: var(--muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; }
.docs__nav a[aria-current="page"] { color: var(--text); }
.docs__layout { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 72rem; margin: 0 auto; padding: var(--sp-6) var(--sp-4) var(--sp-8); gap: var(--sp-6); }
.docs__toc { display: none; }
.doc { min-width: 0; max-width: 46rem; }
.doc h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-3); }
.doc h2 { font-size: var(--fs-xl); margin: var(--sp-7) 0 var(--sp-3); padding-top: var(--sp-5); border-top: var(--hairline); scroll-margin-top: var(--sp-8); }
.doc h3 { font-size: var(--fs-md); margin: var(--sp-5) 0 var(--sp-2); }
.doc p, .doc li { font-size: var(--fs-md); color: var(--text); line-height: var(--lh-body); }
.doc p { margin: var(--sp-3) 0; }
.doc ul, .doc ol { margin: var(--sp-3) 0 var(--sp-3) var(--sp-5); display: grid; gap: var(--sp-2); }
.doc li.task { list-style: none; margin-left: calc(var(--sp-5) * -1); display: flex; gap: var(--sp-2); align-items: flex-start; }
.doc li.task input { margin-top: 0.4rem; accent-color: var(--accent); }
.doc code { background: var(--surface); border-radius: var(--r-inner); padding: 0.1rem 0.4rem; font-size: 0.875em; overflow-wrap: anywhere; }
.doc .codeblock code { background: none; padding: 0; overflow-wrap: normal; }
.doc .codeblock { margin: var(--sp-4) 0; }
.doc blockquote { margin: var(--sp-4) 0; padding: var(--sp-4) var(--sp-5); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-inner) var(--r-inner) 0; }
.doc hr { display: none; }
.doc .table-wrap { overflow-x: auto; margin: var(--sp-4) 0; border: var(--glass-line); border-radius: var(--r-inner); background: var(--glass-2); box-shadow: var(--edge); }
.doc table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.doc th, .doc td { text-align: left; padding: var(--sp-3) var(--sp-4); border-bottom: var(--hairline); vertical-align: top; }
.doc th { background: var(--surface); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.doc tr:last-child td { border-bottom: 0; }
.doc__foot { margin-top: var(--sp-7); font-size: var(--fs-xs); color: var(--muted); }

/* ── Responsive ────────────────────────────────────────── */
@media (min-width: 64rem) {
  .docs__layout { grid-template-columns: 14rem minmax(0, 1fr); padding-top: var(--sp-7); }
  .docs__toc { display: grid; align-content: start; gap: var(--sp-1); position: sticky; top: 5.5rem; max-height: calc(100vh - 6.5rem); overflow-y: auto; }
  .docs__toc .label { margin-bottom: var(--sp-2); padding-left: var(--sp-3); }
  .docs__toc a { color: var(--muted); text-decoration: none; font-size: var(--fs-sm); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-pill); }
  .docs__toc a:hover { background: var(--surface); color: var(--text); }
}
.tabbar { display: none; }
@media (max-width: 63.99rem) {
  /* Tablet: two columns, hero cards first */
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .span-2, .span-3, .span-4 { grid-column: span 3; }
  .span-5, .span-6, .span-7, .span-8 { grid-column: span 6; }
  .tile--hero { order: -1; }
  /* Rail becomes a bottom tab bar; the frame loses its own blur and border to save paint cost */
  body.has-shell { padding: 0; }
  .frame { margin: 0; padding: 0 var(--sp-3) calc(var(--tabbar-h) + var(--sp-8)); border: 0; border-radius: 0; box-shadow: none; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; grid-template-columns: minmax(0, 1fr); grid-template-areas: "strip" "stage"; min-height: 100vh; }
  .rail { display: none; }
  .stage { padding-bottom: 0; }
  .strip { position: sticky; top: 0; padding: var(--sp-2) var(--sp-1); margin: 0 calc(var(--sp-3) * -1); padding-inline: var(--sp-4); background: var(--glass-1); border-bottom: var(--glass-line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
  .strip__hello, .strip__tools > .seg { display: none; } /* the account menu keeps its own theme switch */
  .strip__brand { display: block; }
  .search { position: static; margin-left: auto; max-width: none; flex: none; }
  .search__field { display: none; }
  .search-btn { display: grid; }
  .search--open { position: fixed; inset: 0 0 auto 0; z-index: 70; padding: var(--sp-3); background: var(--glass-3); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
  .search--open .search__field { display: flex; }
  .search--open .search-btn { display: none; }
  .search--open .search__list { left: var(--sp-3); right: var(--sp-3); }
  .tabbar { position: fixed; z-index: 45; left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); height: var(--tabbar-h); display: flex; align-items: stretch; gap: var(--sp-1); padding: var(--sp-2); background: var(--glass-1); border: var(--glass-line); border-radius: var(--r-pill); box-shadow: var(--edge), var(--shadow-pop); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
  .tabbar a { flex: 1; min-width: 0; display: grid; justify-items: center; align-content: center; gap: 2px; border-radius: var(--r-pill); color: var(--muted); text-decoration: none; font-size: 0.6875rem; font-weight: 600; }
  .tabbar a[aria-current="page"] { background: var(--glass-3); color: var(--accent); box-shadow: var(--edge); }
  .switcher { bottom: calc(var(--tabbar-h) + var(--sp-3) + var(--sp-3)); left: var(--sp-3); right: var(--sp-3); transform: none; max-width: none; }
  .switcher__pills { flex: 1; min-width: 0; }
  .toasts { inset-block-end: calc(var(--tabbar-h) + var(--sp-8) + var(--sp-5)); }
}
@media (max-width: 39.99rem) {
  .bento { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 1; }
  .hero { flex-direction: column; align-items: stretch; }
  .hero__ring { align-self: center; }
  .tile { padding: var(--sp-5) var(--sp-4); }
  .stage .content { padding-inline: 0; }
}

/* ── Fallbacks: solid surfaces when blur is unavailable or transparency is reduced ─ */
@media (prefers-reduced-transparency: reduce) {
  :root:root:root { --glass-1: var(--solid-1); --glass-2: var(--solid-2); --glass-3: var(--solid-3); }
  .frame, .auth-card, .topbar, .pop, .search__list, .switcher__pills, .switcher__add, .tabbar, dialog, .strip { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root:root:root { --glass-1: var(--solid-1); --glass-2: var(--solid-2); --glass-3: var(--solid-3); }
}
