/* JDS — components/bundle.css
   Color, spacing, and radius are defined by tokens.css (tokens.json). This file holds the motion/layout variables and the Chapter 13 standard component CSS. */
:root, html[data-theme="dark"] {
    color-scheme: dark;
    --font: var(--font-sans);
    --mono: var(--font-mono);
    --h: 40px;
    --head-h: 64px;
    --side-w: 232px;
    --max-w: 1080px;
    --fx-fast: 150ms;
    --fx: 220ms;
    --fx-slow: 300ms;
    --sp-fast: 280ms;
    --sp: 390ms;
    --sp-slow: 520ms;
    --ms-exit: 200ms;
    --load-delay: 180ms;
    --load-min: 360ms;
    --ease-fx: cubic-bezier(.2, .8, .2, 1);
    --ease-sp: cubic-bezier(.22, 1, .36, 1);
    --ease-away: cubic-bezier(.4, 0, 1, 1);
    --ms-1: var(--fx-fast);
    --ms-2: var(--fx);
    --ms-3: var(--fx-slow);
    --ms-4: var(--sp);
    --ms-5: var(--sp-slow);
    --ms-scroll: smooth;
    --ease: var(--ease-fx);
    --ease-out: var(--ease-sp);
}

html[data-theme="light"] {
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html {
    min-width: 320px;
    scroll-behavior: var(--ms-scroll);
    scroll-padding-top: 16px;
    scrollbar-color: var(--bd-2) transparent;
}
html:has(.topbar) { scroll-padding-top: calc(var(--head-h) + 16px); }
body {
    margin: 0;
    min-width: 320px;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--tx);
    font: 400 14px/1.55 var(--font);
    letter-spacing: -.01em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
    transition: background-color var(--ms-3) var(--ease), color var(--ms-3) var(--ease);
}
body, button, input, select, textarea { font-family: var(--font); }
button, input, select, textarea { font-size: inherit; }
button, input, select, textarea, output { color: inherit; }
button, a, input, textarea, select, summary, [tabindex] { -webkit-tap-highlight-color: transparent; }
button, select, summary { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .46; }
[hidden] { display: none !important; }
img, svg, video, canvas, iframe, embed, object { max-width: 100%; }
img, video, canvas { display: block; }
img { height: auto; }
iframe { border: 1px solid var(--bd); border-radius: var(--r-card); }
svg { vertical-align: middle; }
::selection { background: var(--sky); color: var(--sky-tx); }
::placeholder { color: var(--tx-3); opacity: 1; }
:where(button, a, input, textarea, select, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--sky-a);
    outline-offset: 2px;
}
a { color: var(--link); text-decoration: none; text-underline-offset: 4px;
    transition: color var(--fx) var(--ease-fx), background-color var(--fx) var(--ease-fx); }
a:active { opacity: .8; }
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, figure { margin: 0; }
h1, h2, h3, h4, h5, h6 { color: var(--tx); letter-spacing: -.025em; }
h1, .t-page { font-size: 28px; line-height: 1.25; font-weight: 650; letter-spacing: -.035em; }
h2, .t-section { font-size: 20px; line-height: 1.3; font-weight: 600; }
h3, .t-card { font-size: 16px; line-height: 1.4; font-weight: 600; }
h4 { font-size: 15px; line-height: 1.4; font-weight: 600; }
h5, h6 { font-size: 14px; line-height: 1.45; font-weight: 600; }
p { line-height: 1.55; }
small, .sub { font-size: 13px; line-height: 1.45; color: var(--tx-2); }
.lbl { display: block; font-size: 12px; line-height: 1.4; font-weight: 600; color: var(--tx-2); }
.muted { color: var(--tx-2); }
.dim { color: var(--tx-3); }
.num { font-size: 24px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
.tnum, time, data, output { font-variant-numeric: tabular-nums; }
strong, b { font-weight: 650; }
mark { background: var(--sky-soft); color: var(--tx); padding-inline: 2px; border-radius: 3px; }
abbr[title] { text-decoration: underline dotted var(--bd-2); text-underline-offset: 3px; }
del, s { color: var(--tx-2); }
ins { text-decoration-color: var(--sky-a); }
sub, sup { font-size: .73em; }
blockquote {
    margin-block: var(--s4);
    padding: var(--s3) var(--s4);
    border-inline-start: 2px solid var(--bd-2);
    color: var(--tx-2);
    background: var(--sf-2);
}
q, cite, dfn, em, i, var { font-style: inherit; }
em, cite, dfn { font-style: italic; }
address { font-style: normal; color: var(--tx-2); }
hr { border: 0; border-top: 1px solid var(--bd-2); margin: var(--s6) 0; }
ul, ol { padding-left: 22px; }
li + li { margin-top: 6px; }
dt { font-weight: 600; }
dd { margin-left: 0; color: var(--tx-2); }
dd + dt { margin-top: 12px; }
code, pre, kbd, samp { font: 400 12px/1.55 var(--mono); }
code:not(pre code), kbd, samp {
    background: var(--sf-2);
    border: 1px solid var(--bd);
    border-radius: 6px;
    padding: 2px 5px;
}
pre {
    overflow-x: auto;
    padding: 16px;
    background: var(--sf-2);
    border: 1px solid var(--bd);
    border-radius: var(--r-ctl);
}
pre code { background: transparent; border: 0; padding: 0; }
figure { display: grid; gap: 8px; }
figure > :is(img, video, canvas, iframe, picture) { border-radius: var(--r-card); }
figcaption { color: var(--tx-2); font-size: 12px; }
audio { width: 100%; max-width: 560px; }
video { width: 100%; background: var(--sf-2); border-radius: var(--r-card); }
noscript { display: block; background: var(--sf-2); padding: 12px; color: var(--tx); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--bd-2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

:where(.card, .panel, .topbar, .sidebar, .dialog, .toast, .badge, .alert,
       details, .menu, .drop, .tbl-wrap, .seg, .prog) {
    transition: background-color var(--ms-3) var(--ease),
                color var(--ms-3) var(--ease), border-color var(--ms-3) var(--ease);
}
.sq, .btn, .card, .field, .dialog, .menu, .badge, .alert, .nav-link,
.tab, .seg, .toast, .file-zone, .sidebar, .skel, details, .acc, pre,
.prog, .sw-track, .panel, .drop, select { corner-shape: squircle; }
/* Optional layout primitives that do not enforce structure */
.wrap { width: min(100% - 32px, var(--max-w)); margin-inline: auto; }
.wrap--wide { width: min(100% - 32px, 1440px); }
.wrap--read { width: min(100% - 32px, 64ch); }
.full { width: 100%; }
.section { padding-block: clamp(32px, 6vw, 80px); }
.section--tight { padding-block: 24px; }
.t-display { font-size: clamp(40px, 6vw, 72px); line-height: 1.08; font-weight: 650; letter-spacing: -.045em; }
.hero { display: grid; align-content: center; gap: 24px; padding-block: clamp(64px, 10vw, 144px); }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: clamp(24px, 4vw, 64px); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.media-grid :is(img, video) { width: 100%; object-fit: cover; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s3); }
.row--between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: var(--s2); }
.grow { flex: 1; min-width: 0; }
.trunc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sp-8 { margin-top: 8px; }
.sp-16 { margin-top: 16px; }
.sp-24 { margin-top: 24px; }
.sp-32 { margin-top: 32px; }
.w-full { width: 100%; }
.ic { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 18px; height: 18px; font-size: 18px; line-height: 1; color: currentColor; }
.ic--sm { width: 16px; height: 16px; font-size: 16px; }
.ic--lg { width: 20px; height: 20px; font-size: 20px; }
.ic img, .ic svg { width: 100%; height: 100%; object-fit: contain; }

.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--h);
    min-width: var(--h);
    padding: 0 14px;
    border: 1px solid var(--bd);
    border-radius: var(--r-ctl);
    background: var(--sf);
    color: var(--tx);
    font-size: 14px;
    font-weight: 550;
    line-height: 1.2;
    letter-spacing: -.012em;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    transition: background-color var(--ms-2) var(--ease), border-color var(--ms-2) var(--ease),
                color var(--ms-2) var(--ease), opacity var(--ms-2) var(--ease),
                transform var(--fx-fast) var(--ease-sp);
}
.btn--pri { background: var(--sky); border-color: var(--sky); color: var(--sky-tx); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--sm { height: 32px; min-width: 32px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); }
.btn--lg { height: 48px; min-width: 48px; padding: 0 18px; }
.btn--icon { width: var(--h); padding: 0; }
@media (pointer: coarse) {
    .btn--icon { min-width: 44px; min-height: 44px; }
}
.btn[aria-busy="true"] { cursor: progress; }
.btn .spin { display: none; }   /* the button ring is drawn by .btn[data-loading]::after (Loading block) */
@keyframes spin { to { transform: rotate(360deg); } }

.card, .panel {
    min-width: 0;
    background: var(--sf);
    border: 1px solid var(--bd);
    border-radius: var(--r-card);
    padding: var(--s6);
}
.card--interactive { display: block; color: var(--tx); text-decoration: none;
    transition: border-color var(--fx) var(--ease-fx), transform var(--sp-fast) var(--ease-sp); }
.media-btn { display: block; width: 100%; border: 0; padding: 0; background: none; color: var(--tx);
    text-align: left; cursor: pointer; outline: none; }
.media-surface { display: block; overflow: hidden; border: 1px solid var(--bd);
    border-radius: var(--r-card); background: var(--sf); transition: border-color var(--fx) var(--ease-fx),
    background-color var(--fx-slow) var(--ease-fx); }
.media-react { display: block; transition: transform var(--sp) var(--ease-sp); }
.media-btn:focus-visible .media-surface { outline: 2px solid var(--sky-a);
    outline-offset: 4px; border-color: var(--sky-a); }
.media-btn:focus-visible .media-react { transform: scale(1.03); }
@media (hover: hover) and (pointer: fine) {
    .media-btn:hover .media-surface { border-color: var(--sky-a);
        background: color-mix(in srgb, var(--tx) 2.5%, var(--sf)); }
    .media-btn:hover .media-react { transform: scale(1.03); }
}
.card--selected { background: var(--sky-soft); border-color: var(--sky-a); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.badge {
    display: inline-flex; align-items: center; gap: 6px; min-height: 24px;
    padding: 3px 8px; border: 1px solid var(--bd); border-radius: var(--r-xs);
    background: var(--sf-2); color: var(--tx-2);
    font-size: 12px; font-weight: 550; line-height: 1.3;
}
.badge--sky { background: var(--sky-soft); border-color: transparent; color: var(--tx); }
.badge--ok { background: color-mix(in srgb, var(--ok) 24%, var(--sf)); border-color: transparent; color: var(--tx); }
.badge--warn { background: color-mix(in srgb, var(--warn) 25%, var(--sf)); border-color: transparent; color: var(--tx); }
.badge--err { background: color-mix(in srgb, var(--err) 25%, var(--sf)); border-color: transparent; color: var(--tx); }
.alert {
    padding: 12px 14px; border: 1px solid var(--bd); border-radius: var(--r-ctl);
    background: var(--sf-2); color: var(--tx); display: flex; align-items: flex-start; gap: 10px;
}
.alert--err { background: color-mix(in srgb, var(--err) 16%, var(--sf)); border-color: color-mix(in srgb, var(--err) 50%, var(--bd)); }
.alert--warn { background: color-mix(in srgb, var(--warn) 20%, var(--sf)); border-color: color-mix(in srgb, var(--warn) 50%, var(--bd)); }

.field-group { display: grid; gap: 16px; align-content: start; }
.field-wrap { display: grid; gap: 8px; min-width: 0; align-content: start; }
.field, :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"])),
textarea, select {
    appearance: none;
    width: 100%; min-width: 0; min-height: var(--h);
    padding: 0 12px;
    border: 1px solid var(--bd);
    border-radius: var(--r-ctl);
    background: var(--sf);
    color: var(--tx);
    font: 400 14px/1.45 var(--font);
    outline: none;
    transition: border-color var(--ms-2) var(--ease), background-color var(--ms-2) var(--ease),
                box-shadow var(--ms-2) var(--ease);
}
textarea { min-height: 112px; padding: 12px; resize: vertical; }
select {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%238C98A5' d='M3.5 6.3h9l-4.5 4.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
select[multiple], select[size]:not([size="1"]) { background-image: none; padding: 8px 10px; }
:where(.field, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select):is(:focus,:focus-visible) {
    border-color: var(--sky-a); outline: none; box-shadow: none;
}
.field-wrap:focus-within > .lbl { color: var(--sky-a); }
:where(.field, input, textarea, select)[aria-invalid="true"],
:where(.field, input, textarea, select)[aria-invalid="true"]:is(:hover,:focus,:focus-visible) {
    border-color: var(--err); outline: none; box-shadow: none;
}
.field-wrap.is-invalid > .lbl { color: var(--err); }
.field-error { color: var(--err); font-size: 12px; line-height: 1.4; margin: 0;
    animation: field-error-in var(--fx) var(--ease-fx) both; }
@keyframes field-error-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
@media (hover: hover) and (pointer: fine) {
    :where(.field, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select):hover:not(:disabled):not(:focus):not([aria-invalid="true"]) {
        border-color: color-mix(in srgb, var(--sky-a) 50%, var(--bd-2));
    }
}
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 12px; padding: 0; font-weight: 600; }
label { cursor: pointer; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.help { color: var(--tx-2); font-size: 12px; line-height: 1.45; }
.error { color: var(--err); font-size: 12px; line-height: 1.4; }
.field-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; }
.sw { position: relative; display: inline-flex; align-items: center; width: 40px; height: 24px; cursor: pointer; flex: 0 0 auto; }
.sw input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sw-track {
    width: 40px; height: 24px; border: 1px solid var(--bd-2); border-radius: 10px;
    background: var(--sf-3);
    transition: background-color var(--ms-2) var(--ease), border-color var(--ms-2) var(--ease);
}
.sw-track::after {
    content: ""; display: block; width: 16px; height: 16px; margin: 3px;
    border-radius: 6px; background: var(--tx-2);
    transition: transform var(--ms-2) var(--ease), background-color var(--ms-2) var(--ease);
}
.sw input:checked + .sw-track { background: var(--sky); border-color: var(--sky); }
.sw input:checked + .sw-track::after { transform: translateX(16px); background: var(--sky-tx); }
.sw input:focus-visible + .sw-track { outline: 2px solid var(--sky-a); outline-offset: 2px; }
.sw input:disabled + .sw-track { opacity: .46; }

.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--bd); }
.tab {
    min-height: 38px; padding: 0 12px; border: 0; border-radius: var(--r-sm) var(--r-sm) 0 0;
    background: transparent; color: var(--tx-2); font-weight: 550;
    border-bottom: 2px solid transparent;
    transition: color var(--ms-2) var(--ease), border-color var(--ms-2) var(--ease), background-color var(--ms-2) var(--ease);
}
.tab[aria-selected="true"] { color: var(--tx); border-bottom-color: var(--sky-a); }
.seg { display: inline-flex; align-items: center; gap: 4px; padding: 4px; background: var(--sf-2); border: 1px solid var(--bd); border-radius: var(--r-ctl); }
.seg button { border: 0; background: transparent; padding: 6px 10px; border-radius: var(--r-xs); color: var(--tx-2); }
.seg button[aria-pressed="true"] { background: var(--sf); color: var(--tx); box-shadow: 0 1px 3px var(--sh); }
details { border: 1px solid var(--bd); background: var(--sf); border-radius: var(--r-ctl); padding: 0 14px; }
summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; list-style: none; font-weight: 550; }
summary::-webkit-details-marker { display: none; }
.details-body { padding: 0 0 14px; animation: enter var(--ms-3) var(--ease-out) both; }
@supports (interpolate-size: allow-keywords) {
    details { interpolate-size: allow-keywords; }
    details::details-content {
        block-size: 0; overflow: hidden;
        transition: block-size var(--ms-3) var(--ease);
    }
    details[open]::details-content { block-size: auto; }
}
.acc { border: 1px solid var(--bd); border-radius: var(--r-ctl); background: var(--sf); }
.acc-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; min-height: 44px; padding: 0 14px;
    background: transparent; border: 0; color: var(--tx); font-weight: 550;
}
.acc-btn .ic { color: var(--tx-2); transition: transform var(--ms-3) var(--ease); }
.acc[data-open="true"] .acc-btn .ic { transform: rotate(180deg); }
.acc-body {
    display: grid; grid-template-rows: 0fr; opacity: 0;
    transition: grid-template-rows var(--ms-3) var(--ease), opacity var(--ms-3) var(--ease);
}
.acc[data-open="true"] .acc-body { grid-template-rows: 1fr; opacity: 1; }
.acc-inner { min-height: 0; overflow: hidden; }
.acc-inner > div { padding: 0 14px 14px; }
.menu, .drop {
    padding: 6px; border: 1px solid var(--bd); border-radius: var(--r-menu);
    background: var(--sf); box-shadow: 0 8px 30px var(--sh);
}
.menu { list-style: none; margin: 0; }
.menu li + li { margin-top: 2px; }
.menu-item {
    width: 100%; min-height: 36px; display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border: 0; border-radius: var(--r-sm);
    background: transparent; color: var(--tx); text-align: left; text-decoration: none;
    transition: background-color var(--ms-2) var(--ease);
}
.menu-item[aria-current="page"] { background: var(--sky-soft); }
[popover].drop { position: fixed; inset: auto; margin: 0; min-width: 180px; max-width: min(280px, calc(100vw - 16px)); max-height: min(360px, calc(100dvh - 16px)); overflow-y: auto; }
[popover].drop {
    opacity: 0; transform: translateY(-3px) scale(.99); transform-origin: top left;
    transition: opacity var(--ms-exit) var(--ease-away),
                transform var(--ms-exit) var(--ease-away),
                display var(--ms-exit) allow-discrete,
                overlay var(--ms-exit) allow-discrete;
}
[popover].drop:popover-open {
    opacity: 1; transform: translateY(0) scale(1);
    transition: opacity var(--sp-fast) var(--ease-sp),
                transform var(--sp-fast) var(--ease-sp),
                display var(--ms-exit) allow-discrete,
                overlay var(--ms-exit) allow-discrete;
}
@starting-style {
    [popover].drop:popover-open { opacity: 0; transform: translateY(-4px) scale(.99); }
}
.file-zone { display: grid; place-items: center; min-height: 112px; gap: 8px; border: 1px dashed var(--bd-2); background: var(--sf-2); border-radius: var(--r-ctl); padding: 16px; }
.skel { height: 18px; background: var(--sf-3); border-radius: var(--r-xs); animation: pulse .9s var(--ease-fx) alternate infinite; }
@keyframes pulse { to { opacity: .65; } }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.prog { overflow: hidden; height: 5px; border-radius: 4px; background: var(--sf-3); }
.prog > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--sky); transition: width var(--ms-5) var(--ease-out); }
progress { width: 100%; height: 6px; border: 0; overflow: hidden; border-radius: 4px; background: var(--sf-3); }
progress::-webkit-progress-bar { background: var(--sf-3); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--sky); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--sky); border-radius: 4px; }
.wizard-step { min-height: 144px; }
.wizard-step:not([hidden]) { animation: enter var(--ms-4) var(--ease-out) both; }

.tbl-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--bd); border-radius: var(--r-card); background: var(--sf); }
table { width: 100%; min-width: 480px; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
caption { padding: 12px 16px; color: var(--tx-2); text-align: left; font-size: 12px; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--bd); vertical-align: middle; }
th { color: var(--tx-2); background: var(--sf-2); font-size: 12px; font-weight: 600; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tbody tr { height: 48px; transition: background-color var(--ms-2) var(--ease); }
.tbl--dense tbody tr { height: 40px; }
.tbl--dense th, .tbl--dense td { padding: 8px 12px; }
.td-num { text-align: right; }
.empty { display: grid; justify-items: center; gap: 16px; padding: 40px 16px; text-align: center; color: var(--tx-2); }
.topbar {
    position: sticky; top: 0; z-index: 10; height: var(--head-h);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--bd);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--tx); text-decoration: none; letter-spacing: -.03em; }
.brand-mark { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; background: var(--sky); color: var(--sky-tx); }
.layout { display: flex; min-height: calc(100dvh - var(--head-h)); }
.sidebar {
    width: var(--side-w); flex: 0 0 var(--side-w);
    background: var(--bg); border-right: 1px solid var(--bd);
    padding: 20px 12px;
}
/* Use section navigation/scroll headers only when there are actual areas to navigate */
.nav-icons { display: flex; align-items: center; gap: 6px; }
.nav-icon {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--r-ctl);
    color: var(--tx-2); text-decoration: none;
    transition: background-color var(--fx) var(--ease-fx), color var(--fx) var(--ease-fx);
}
.nav-icon::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px;
    height: 2px; border-radius: 1px; background: var(--sky-a);
    transform: scaleX(0); opacity: 0; transform-origin: left center;
    transition: transform var(--sp-fast) var(--ease-sp), opacity var(--fx) var(--ease-fx);
}
.nav-icon[aria-current] { color: var(--sky-a); }
.nav-icon[aria-current]::after { transform: scaleX(1); opacity: 1; }
.nav-icon:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 2px; }
.mode-toggle { margin-left: auto; background: var(--sf); border-color: var(--bd-2); color: var(--tx); }
.mode-toggle:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 2px; }
.bar--sticky { position: sticky; top: 0; z-index: 10; display: flex; align-items: center;
    gap: 12px; min-height: var(--head-h); padding-inline: 32px; background: var(--bg);
    border-bottom: 1px solid transparent; transition: background-color var(--fx-slow) var(--ease-fx),
    border-color var(--fx) var(--ease-fx); }
.bar--sticky.is-scrolled { background: color-mix(in srgb, var(--bg) 85%, transparent);
    border-bottom-color: var(--bd); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
@media (hover: hover) and (pointer: fine) {
    .nav-icon:hover { color: var(--sky-a); background: color-mix(in srgb, var(--tx) 5%, var(--bg)); }
    .mode-toggle:hover:not(:disabled) { background: var(--sf-2); border-color: var(--sky-a); }
}

.nav-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.nav-list li + li { margin: 0; }
.nav-link {
    min-height: 40px; display: flex; align-items: center; gap: 12px;
    padding: 0 12px; border: 1px solid transparent; border-radius: var(--r-ctl);
    background: transparent; color: var(--tx-2); font-weight: 550;
    transition: background-color var(--ms-2) var(--ease), color var(--ms-2) var(--ease), border-color var(--ms-2) var(--ease);
}
.nav-link[aria-current="page"] { background: var(--sky-soft); color: var(--tx); }
.nav-link[aria-current="page"] .ic { color: var(--sky-a); }
/* Prevents hover sticking on touch. Selected states persist outside the media query below. */
.menu-item[aria-selected="true"] { background: var(--sky-soft); text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
    a:not(.btn):hover { color: var(--sky-a); text-decoration: none; }
    a[data-external="true"]:hover, a.link--external:hover { text-decoration: underline; }
    .btn:hover:not(:disabled):not([aria-busy="true"]) {
        background: color-mix(in srgb, var(--tx) 6%, var(--sf));
        border-color: var(--bd-2); text-decoration: none;
    }
    .btn--pri:hover:not(:disabled):not([aria-busy="true"]) {
        background: var(--sky-h); border-color: var(--sky-h);
    }
    .btn--ghost:hover:not(:disabled):not([aria-busy="true"]) {
        background: color-mix(in srgb, var(--tx) 6%, var(--bg)); border-color: transparent;
    }
    .btn--danger:hover:not(:disabled):not([aria-busy="true"]) {
        background: color-mix(in srgb, var(--err) 24%, var(--sf)); border-color: var(--err);
    }
    .card--interactive:hover { border-color: var(--bd-2); text-decoration: none; }
    /* Input hover is handled by the 50% sky border rule (above). Do not override it twice. */
    .tab:hover { background: var(--sf-2); color: var(--tx); }
    .menu-item:hover { background: color-mix(in srgb, var(--tx) 6%, var(--sf)); text-decoration: none; }
    .menu-item[aria-selected="true"]:hover, .menu-item[aria-current="page"]:hover { background: var(--sky-soft); }
    tbody tr:hover { background: var(--sf-2); }
    .brand:hover { text-decoration: none; }
    .nav-link:hover { background: var(--sf-2); color: var(--tx); text-decoration: none; }
    .nav-link[aria-current="page"]:hover { background: var(--sky-soft); }
}
/* The pressed state below takes priority over hover. */
.btn:active:not(:disabled):not([aria-busy="true"]) {
    transform: scale(.985);
    background: color-mix(in srgb, var(--tx) 12%, var(--sf));
}
.btn--pri:active:not(:disabled):not([aria-busy="true"]) { background: var(--sky-a); }
.main { flex: 1 1 0; min-width: 0; padding: 32px max(32px, env(safe-area-inset-right)) 64px max(32px, env(safe-area-inset-left)); }
.main-inner { width: 100%; max-width: var(--max-w); margin: 0 auto; }
.titlebar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.view { animation: enter var(--ms-4) var(--ease-out) both; }
.view > .stack { gap: 24px; }
.mobile-only { display: none; }
.mobile-toggle { display: none; }
.mobile-menu { position: fixed; top: var(--head-h); left: 0; right: 0; z-index: 40;
    max-height: calc(100dvh - var(--head-h)); overflow-y: auto;
    padding: 12px 16px 16px; background: var(--sf); border-bottom: 1px solid var(--bd-2);
    display: grid; gap: 4px; opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity var(--fx) var(--ease-fx), transform var(--sp-fast) var(--ease-sp),
    visibility var(--ms-exit); }
.mobile-menu.is-open { opacity: 1; visibility: visible; transform: none; }
body.nav-open .bar--sticky { z-index: 45; }
.mobile-menu a { display: flex; align-items: center; gap: 12px; min-height: 44px;
    padding: 10px 12px; border-radius: var(--r-sm); color: var(--tx);
    transition: color var(--fx) var(--ease-fx), background-color var(--fx) var(--ease-fx); }
@media (min-width: 640px) { .mobile-menu { display: none; } }

.nav-veil {
    position: fixed; inset: 0; z-index: 35; border: 0; background: var(--veil);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--ms-4) var(--ease), visibility var(--ms-4);
}
body.nav-open .nav-veil { opacity: 1; visibility: visible; pointer-events: auto; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog {
    width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
    overflow-y: auto; border: 1px solid var(--bd); border-radius: var(--r-pop);
    padding: 24px; background: var(--sf); color: var(--tx);
    box-shadow: 0 16px 48px var(--sh);
}
.dialog { opacity: 0; transform: translateY(6px) scale(.99); }
.dialog[open] { opacity: 1; transform: none; animation: dialog-in var(--sp) var(--ease-sp) both; }
.dialog::backdrop { background: var(--veil); animation: fade var(--fx-slow) var(--ease-fx) both; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.toast {
    position: fixed; z-index: 80;
    right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
    max-width: min(360px, calc(100vw - 32px)); min-height: 44px;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border: 1px solid var(--bd); border-radius: var(--r-ctl);
    background: var(--sf); color: var(--tx); box-shadow: 0 8px 24px var(--sh);
    font-size: 13px; opacity: 0; transform: translateY(8px);
    transition: opacity var(--fx) var(--ease-fx), transform var(--sp-fast) var(--ease-sp);
}
.toast[data-state="in"] { opacity: 1; transform: none; }
.toast[data-state="out"] {
    opacity: 0; transform: translateY(6px);
    transition-duration: var(--ms-exit);
    transition-timing-function: var(--ease-away);
}
.tip { position: relative; }
.tip:focus-visible::after, .tip:hover::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px);
    transform: translateX(-50%); white-space: nowrap;
    padding: 5px 8px; border-radius: 7px; background: var(--tx); color: var(--bg);
    font-size: 12px; line-height: 1.2; pointer-events: none;
    animation: fade var(--fx) var(--ease-fx) both;
}
@media (hover: hover) and (pointer: fine) {
    .tip:hover:not(:focus-visible)::after { animation-delay: 450ms; }
}
@media (hover: none) { .tip:hover:not(:focus-visible)::after { display: none; } }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--tx-2); font-size: 12px; }
.crumb a { color: var(--tx-2); }
.crumb .here { color: var(--tx); font-weight: 550; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sep { width: 1px; height: 20px; background: var(--bd-2); flex: 0 0 auto; }
.divider { height: 1px; border: 0; background: var(--bd-2); }
.search-box { position: relative; min-width: 0; }
.search-box .ic { position: absolute; z-index: 1; left: 12px; top: 50%; transform: translateY(-50%); color: var(--tx-2); }
.search-box input[type="search"] { padding-left: 38px; }

::view-transition-old(root) { animation: fade-out var(--ms-2) var(--ease) both; }
::view-transition-new(root) { animation: fade var(--ms-4) var(--ease-out) both; }
@keyframes fade-out { to { opacity: 0; } }

@media (max-width: 1023.98px) {
    .main { padding: 24px max(24px, env(safe-area-inset-right)) 48px max(24px, env(safe-area-inset-left)); }
    .sidebar {
        position: fixed; top: var(--head-h); left: 0; bottom: 0; z-index: 40;
        width: min(304px, 88vw); padding-bottom: max(20px, env(safe-area-inset-bottom));
        overflow-y: auto; background: var(--sf);
        transform: translateX(-105%); visibility: hidden;
        transition: transform var(--ms-4) var(--ease-out), visibility var(--ms-4),
                    background-color var(--ms-3) var(--ease);
    }
    body.nav-open .sidebar { visibility: visible; transform: translateX(0); }
    .mobile-only { display: inline-flex; }
    .topbar { padding: 0 20px; }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639.98px) {
    :root { --head-h: 56px; }
    .bar--sticky { padding-inline: 16px; }
    .mobile-toggle { display: inline-flex; }
    h1, .t-page { font-size: 24px; }
    h2, .t-section { font-size: 19px; }
    .topbar { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
    .main { padding: 20px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
    .titlebar { align-items: flex-start; margin-bottom: 24px; }
    .card, .panel { padding: 16px; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .wrap, .wrap--wide, .wrap--read { width: calc(100% - 32px); }
    .card-head { margin-bottom: 16px; }
    .card-foot { margin-top: 20px; }
    .actions--stack { flex-direction: column-reverse; align-items: stretch; }
    .actions--stack > .btn { width: 100%; }
    .dialog { padding: 20px; }
    input:where(:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"])),
    textarea, select { font-size: 16px !important; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

:root {
    --jds-i-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.3 5.6a1 1 0 0 1 1.4 0L8 8.9l3.3-3.3a1 1 0 1 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
    --jds-i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M13.7 4.3a1 1 0 0 1 0 1.4l-6.5 6.5a1 1 0 0 1-1.4 0L2.3 8.7a1 1 0 1 1 1.4-1.4l2.8 2.8 5.8-5.8a1 1 0 0 1 1.4 0z'/%3E%3C/svg%3E");
    --jds-i-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 7h9a1 1 0 0 1 0 2h-9a1 1 0 0 1 0-2z'/%3E%3C/svg%3E");
    --jds-i-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 2a1 1 0 0 1 1 1v4h4a1 1 0 0 1 0 2H9v4a1 1 0 0 1-2 0V9H3a1 1 0 0 1 0-2h4V3a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
    --jds-i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.2 2.8 8 6.6l3.8-3.8a1 1 0 1 1 1.4 1.4L9.4 8l3.8 3.8a1 1 0 0 1-1.4 1.4L8 9.4l-3.8 3.8a1 1 0 0 1-1.4-1.4L6.6 8 2.8 4.2a1 1 0 0 1 1.4-1.4z'/%3E%3C/svg%3E");
    --jds-i-cal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 1a1 1 0 0 1 1 1v1h4V2a1 1 0 1 1 2 0v1h1a2 2 0 0 1 2 2v1H1V5a2 2 0 0 1 2-2h1V2a1 1 0 0 1 1-1zM1 7.5h14V13a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7.5z'/%3E%3C/svg%3E");
    --jds-i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 3a.9.9 0 0 0-.9.9V8c0 .3.1.5.3.7l2.2 2.2a.9.9 0 0 0 1.3-1.3L8.9 7.6V4.9A.9.9 0 0 0 8 4z'/%3E%3C/svg%3E");
    --jds-i-eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 3c3.6 0 6.2 2.7 7 5-.8 2.3-3.4 5-7 5S1.8 10.3 1 8c.8-2.3 3.4-5 7-5zm0 2.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z'/%3E%3C/svg%3E");
    --jds-i-eyeoff: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cdefs%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='white'/%3E%3Cpath d='M2 1.5 14.5 14' stroke='black' stroke-width='3.4'/%3E%3C/mask%3E%3C/defs%3E%3Cpath mask='url%28%23m%29' fill-rule='evenodd' d='M8 3c3.6 0 6.2 2.7 7 5-.8 2.3-3.4 5-7 5S1.8 10.3 1 8c.8-2.3 3.4-5 7-5zm0 2.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z'/%3E%3Cpath d='M2.2 1.8 14.2 13.8' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
    --jds-i-file: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 1h5l4 4v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2zm5 1v3a1 1 0 0 0 1 1h3z'/%3E%3C/svg%3E");
}

/* ==========================================================================
   JDS native control unification — default browser UI is not used.
   What CSS alone can do (checkbox, radio, slider, progress, meter, autofill background) is done in CSS;
   things whose popup is fixed browser UI (select, date, time, color, datalist, number spinner, file,
   search clear, password reveal) are implemented directly by JDS.enhance() in bundle.js.
   ========================================================================== */

/* Icons: Filled silhouette masks, colored with currentColor */
.jds-ic {
    display: inline-block; flex: 0 0 auto; width: 16px; height: 16px;
    background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
}
.jds-ic--chev { --i: var(--jds-i-chev); }
.jds-ic--up { --i: var(--jds-i-chev); transform: rotate(180deg); }
.jds-ic--left { --i: var(--jds-i-chev); transform: rotate(90deg); }
.jds-ic--right { --i: var(--jds-i-chev); transform: rotate(-90deg); }
.jds-ic--check { --i: var(--jds-i-check); }
.jds-ic--dash { --i: var(--jds-i-dash); }
.jds-ic--plus { --i: var(--jds-i-plus); }
.jds-ic--x { --i: var(--jds-i-x); }
.jds-ic--cal { --i: var(--jds-i-cal); }
.jds-ic--clock { --i: var(--jds-i-clock); }
.jds-ic--eye { --i: var(--jds-i-eye); }
.jds-ic--eyeoff { --i: var(--jds-i-eyeoff); }
.jds-ic--file { --i: var(--jds-i-file); }

/* Remove default browser accessory UI */
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
input::-ms-reveal, input::-ms-clear { display: none; }
input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
input::-webkit-contacts-auto-fill-button, input::-webkit-credentials-auto-fill-button { visibility: hidden; position: absolute; right: 0; }
input::-webkit-list-button { display: none !important; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus,
textarea:-webkit-autofill, select:-webkit-autofill {
    -webkit-text-fill-color: var(--tx); caret-color: var(--tx);
    -webkit-box-shadow: 0 0 0 1000px var(--sf) inset; box-shadow: 0 0 0 1000px var(--sf) inset;
    transition: background-color 9999s 0s;
}
textarea::-webkit-resizer { background: transparent; }
select option, select optgroup { background: var(--sf); color: var(--tx); }

/* Original element: keeps value, name, and validation; hidden only on screen */
.jds-native {
    position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important;
    padding: 0 !important; margin: -1px !important; border: 0 !important;
    overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; opacity: 0 !important;
    pointer-events: none !important;
}

/* ---------- Checkbox · Radio ---------- */
input[type="checkbox"], input[type="radio"] {
    appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 auto;
    width: 18px; height: 18px; margin: 0; padding: 0;
    border: 1.5px solid var(--bd-2); background: var(--sf); color: var(--sky-tx);
    display: inline-grid; place-content: center; vertical-align: middle; cursor: pointer;
    transition: background-color var(--fx) var(--ease-fx), border-color var(--fx) var(--ease-fx), transform var(--fx-fast) var(--ease-sp);
}
input[type="checkbox"] { border-radius: 5px; corner-shape: squircle; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::after {
    content: ""; width: 14px; height: 14px; background: currentColor;
    -webkit-mask: var(--jds-i-check) center / contain no-repeat; mask: var(--jds-i-check) center / contain no-repeat;
    transform: scale(.6); opacity: 0;
    transition: transform var(--sp-fast) var(--ease-sp), opacity var(--fx) var(--ease-fx);
}
input[type="checkbox"]:indeterminate::after { -webkit-mask-image: var(--jds-i-dash); mask-image: var(--jds-i-dash); }
input[type="radio"]::after {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
    transform: scale(.4); opacity: 0;
    transition: transform var(--sp-fast) var(--ease-sp), opacity var(--fx) var(--ease-fx);
}
input:is([type="checkbox"], [type="radio"]):is(:checked, :indeterminate) { background: var(--sky); border-color: var(--sky); }
input:is([type="checkbox"], [type="radio"]):is(:checked, :indeterminate)::after { transform: none; opacity: 1; }
input:is([type="checkbox"], [type="radio"]):active:not(:disabled) { transform: scale(.92); }
input:is([type="checkbox"], [type="radio"]):focus-visible { outline: 2px solid var(--sky-a); outline-offset: 2px; }
input:is([type="checkbox"], [type="radio"])[aria-invalid="true"] { border-color: var(--err); }
@media (hover: hover) and (pointer: fine) {
    input:is([type="checkbox"], [type="radio"]):hover:not(:disabled):not(:checked):not(:indeterminate) {
        border-color: color-mix(in srgb, var(--sky-a) 60%, var(--bd-2));
        background: color-mix(in srgb, var(--tx) 6%, var(--sf));
    }
}
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 24px; cursor: pointer; }
.check input { margin-top: 1px; }
.check:has(input:disabled) { cursor: not-allowed; color: var(--tx-3); }

/* ---------- Slider ---------- */
input[type="range"] {
    --fill: 50%;
    appearance: none; -webkit-appearance: none; width: 100%; height: 24px; margin: 0; padding: 0;
    background: transparent; cursor: pointer; border: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 6px; border-radius: 4px;
    background: linear-gradient(to right, var(--sky) 0 var(--fill), var(--sf-3) var(--fill) 100%);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 4px; background: var(--sf-3); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 4px; background: var(--sky); }
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; box-sizing: border-box;
    width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
    border: 3px solid var(--sky); background: var(--sf);
    transition: transform var(--fx-fast) var(--ease-sp), box-shadow var(--fx) var(--ease-fx);
}
input[type="range"]::-moz-range-thumb {
    box-sizing: border-box; width: 18px; height: 18px; border-radius: 50%;
    border: 3px solid var(--sky); background: var(--sf);
    transition: transform var(--fx-fast) var(--ease-sp), box-shadow var(--fx) var(--ease-fx);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sky-a); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sky-a); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.1); }
input[type="range"]:active::-moz-range-thumb { transform: scale(1.1); }
@media (hover: hover) and (pointer: fine) {
    input[type="range"]:hover:not(:disabled)::-webkit-slider-thumb { box-shadow: 0 0 0 6px color-mix(in srgb, var(--sky) 16%, transparent); }
    input[type="range"]:hover:not(:disabled)::-moz-range-thumb { box-shadow: 0 0 0 6px color-mix(in srgb, var(--sky) 16%, transparent); }
}
.jds-range { display: flex; align-items: center; gap: 12px; }
.jds-range output { min-width: 40px; text-align: right; font-size: 13px; color: var(--tx-2); font-variant-numeric: tabular-nums; }

/* ---------- progress · meter ---------- */
progress, meter { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 4px; overflow: hidden; background: var(--sf-3); }
progress::-webkit-progress-bar { background: var(--sf-3); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--sky); border-radius: 4px; transition: width var(--sp-slow) var(--ease-sp); }
progress::-moz-progress-bar { background: var(--sky); border-radius: 4px; }
progress:indeterminate { background: var(--sf-3); }
progress:indeterminate::-moz-progress-bar { background: transparent; }
meter::-webkit-meter-bar { height: 6px; border: 0; border-radius: 4px; background: var(--sf-3); }
meter::-webkit-meter-optimum-value { background: var(--sky); border-radius: 4px; }
meter::-webkit-meter-suboptimum-value { background: var(--warn); border-radius: 4px; }
meter::-webkit-meter-even-less-good-value { background: var(--err); border-radius: 4px; }
meter::-moz-meter-bar { background: var(--sky); border-radius: 4px; }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warn); }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--err); }

/* ---------- details · summary ---------- */
summary::after {
    content: ""; width: 16px; height: 16px; background: var(--tx-2);
    -webkit-mask: var(--jds-i-chev) center / contain no-repeat; mask: var(--jds-i-chev) center / contain no-repeat;
    transition: transform var(--sp-fast) var(--ease-sp);
}
details[open] > summary::after { transform: rotate(180deg); }

/* ---------- Common trigger field (select · date · time · color) ---------- */
.jds-trigger {
    appearance: none; display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: var(--h);
    padding: 0 12px; border: 1px solid var(--bd); border-radius: var(--r-ctl); corner-shape: squircle;
    background: var(--sf); color: var(--tx); font: 400 14px/1.45 var(--font); letter-spacing: -.01em;
    text-align: left; cursor: pointer;
    transition: border-color var(--fx) var(--ease-fx), background-color var(--fx) var(--ease-fx);
}
.jds-trigger > .jds-val { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.jds-trigger > .jds-val.is-empty { color: var(--tx-3); }
.jds-trigger > .jds-ic { color: var(--tx-2); transition: transform var(--sp-fast) var(--ease-sp), color var(--fx) var(--ease-fx); }
.jds-trigger[aria-expanded="true"] { border-color: var(--sky-a); }
.jds-trigger[aria-expanded="true"] > .jds-ic--chev { transform: rotate(180deg); color: var(--sky-a); }
.jds-trigger:focus-visible { outline: none; border-color: var(--sky-a); }
.jds-trigger[aria-invalid="true"] { border-color: var(--err); }
.jds-trigger:disabled { opacity: .46; cursor: not-allowed; }
.jds-swatch { width: 20px; height: 20px; flex: 0 0 auto; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--tx) 16%, transparent); }
@media (hover: hover) and (pointer: fine) {
    .jds-trigger:hover:not(:disabled):not([aria-expanded="true"]):not([aria-invalid="true"]) { border-color: color-mix(in srgb, var(--sky-a) 50%, var(--bd-2)); }
}

/* ---------- In-field accessory buttons (number · search · password) ---------- */
.jds-box { position: relative; display: flex; align-items: center; width: 100%; min-width: 0; }
.jds-box > input { padding-right: var(--pad-r, 12px); }
.jds-box > .jds-addons { position: absolute; right: 4px; top: 4px; bottom: 4px; display: flex; align-items: stretch; gap: 2px; }
.jds-mini {
    appearance: none; display: inline-grid; place-items: center; width: 32px; padding: 0;
    border: 0; border-radius: var(--r-xs); background: transparent; color: var(--tx-2); cursor: pointer;
    transition: background-color var(--fx) var(--ease-fx), color var(--fx) var(--ease-fx), transform var(--fx-fast) var(--ease-sp);
}
.jds-mini:active:not(:disabled) { transform: scale(.92); background: color-mix(in srgb, var(--tx) 12%, var(--sf)); }
.jds-mini:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 0; }
.jds-mini:disabled { opacity: .35; cursor: not-allowed; }
.jds-mini[hidden] { display: none; }
.jds-addons .jds-sep { width: 1px; margin: 6px 0; background: var(--bd); }
@media (hover: hover) and (pointer: fine) { .jds-mini:hover:not(:disabled) { background: color-mix(in srgb, var(--tx) 6%, var(--sf)); color: var(--tx); } }
@media (pointer: coarse) { .jds-mini { width: 40px; } }

/* ---------- File ---------- */
input[type="file"] { color: var(--tx-2); font: 400 13px var(--font); }
input[type="file"]::file-selector-button {
    min-height: 32px; margin-right: 12px; padding: 0 12px; border: 1px solid var(--bd); border-radius: var(--r-ctl);
    background: var(--sf); color: var(--tx); font: 550 13px var(--font); cursor: pointer;
}
.jds-file { display: flex; align-items: center; gap: 12px; min-height: var(--h); padding: 4px 4px 4px 4px;
    border: 1px solid var(--bd); border-radius: var(--r-ctl); corner-shape: squircle; background: var(--sf); min-width: 0;
    transition: border-color var(--fx) var(--ease-fx); }
.jds-file .btn { flex: 0 0 auto; }
.jds-file .jds-val { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--tx); }
.jds-file .jds-val.is-empty { color: var(--tx-3); }
.jds-file:focus-within { border-color: var(--sky-a); }
.jds-file.is-drag { border-color: var(--sky-a); background: var(--sky-soft); }

/* ---------- Color (when native is used) ---------- */
input[type="color"] { appearance: none; -webkit-appearance: none; width: 40px; height: 40px; padding: 5px;
    border: 1px solid var(--bd); border-radius: var(--r-ctl); background: var(--sf); cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }

/* ---------- Floating panel (shared by every custom popup) ---------- */
.jds-pop {
    position: fixed; inset: auto; margin: 0; z-index: 70;
    min-width: 200px; max-width: min(360px, calc(100vw - 16px)); max-height: min(460px, calc(100dvh - 16px));
    overflow: auto; padding: 6px; border: 1px solid var(--bd); border-radius: var(--r-menu); corner-shape: squircle;
    background: var(--sf); color: var(--tx); box-shadow: 0 12px 32px var(--sh);
    font: 400 14px/1.45 var(--font); letter-spacing: -.01em;
    opacity: 0; transform: translateY(var(--from, -4px));
    transition: opacity var(--ms-exit) var(--ease-away), transform var(--ms-exit) var(--ease-away);
}
.jds-pop.is-in { opacity: 1; transform: none;
    transition: opacity var(--fx) var(--ease-fx), transform var(--sp-fast) var(--ease-sp); }
.jds-pop.is-up { --from: 4px; }
.jds-pop:popover-open { display: block; }
.jds-pop:focus { outline: none; }

/* List options */
.jds-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.jds-list:focus { outline: none; }
.jds-group { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--tx-2); }
.jds-opt {
    display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px;
    border-radius: var(--r-sm); corner-shape: squircle; color: var(--tx); cursor: pointer; user-select: none;
    transition: background-color var(--fx) var(--ease-fx), color var(--fx) var(--ease-fx);
}
.jds-opt > .jds-txt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jds-opt > .jds-ic--check { color: var(--sky-a); opacity: 0; }
.jds-opt[aria-selected="true"] { background: var(--sky-soft); font-weight: 600; }
.jds-opt[aria-selected="true"] > .jds-ic--check { opacity: 1; }
.jds-opt.is-active { background: color-mix(in srgb, var(--tx) 10%, var(--sf)); }
.jds-opt[aria-selected="true"].is-active { background: color-mix(in srgb, var(--tx) 6%, var(--sky-soft)); }
.jds-opt[aria-disabled="true"] { color: var(--tx-3); cursor: not-allowed; }
.jds-opt .jds-box-ic { width: 18px; height: 18px; flex: 0 0 auto; border: 1.5px solid var(--bd-2); border-radius: 5px; display: grid; place-content: center; color: var(--sky-tx);
    transition: background-color var(--fx) var(--ease-fx), border-color var(--fx) var(--ease-fx); }
.jds-opt .jds-box-ic::after { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--jds-i-check) center / contain no-repeat; mask: var(--jds-i-check) center / contain no-repeat; opacity: 0; }
.jds-opt[aria-selected="true"] .jds-box-ic { background: var(--sky); border-color: var(--sky); }
.jds-opt[aria-selected="true"] .jds-box-ic::after { opacity: 1; }
.jds-empty { padding: 10px; color: var(--tx-3); font-size: 13px; }
.jds-opt mark { background: transparent; color: var(--link); font-weight: 600; padding: 0; }
@media (hover: hover) and (pointer: fine) { .jds-opt:hover:not([aria-disabled="true"]):not(.is-active):not([aria-selected="true"]) { background: color-mix(in srgb, var(--tx) 6%, var(--sf)); } }

/* Multi-select list (an inline box, not a popup) */
.jds-listbox { max-height: 220px; overflow: auto; padding: 4px; border: 1px solid var(--bd); border-radius: var(--r-ctl); corner-shape: squircle; background: var(--sf); transition: border-color var(--fx) var(--ease-fx); }
.jds-listbox:focus-visible, .jds-listbox:focus-within { outline: none; border-color: var(--sky-a); }
.jds-listbox[aria-invalid="true"] { border-color: var(--err); }
.jds-listbox[aria-disabled="true"] { opacity: .46; pointer-events: none; }
.jds-listbox .jds-opt[aria-selected="true"] { background: transparent; font-weight: 400; }
.jds-listbox .jds-opt.is-active { background: color-mix(in srgb, var(--tx) 10%, var(--sf)); }

/* Calendar */
.jds-cal { display: grid; gap: 8px; width: 268px; padding: 4px; }
.jds-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.jds-cal-title { appearance: none; border: 0; background: transparent; color: var(--tx); font: 600 14px var(--font); letter-spacing: -.012em; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; font-variant-numeric: tabular-nums;
    transition: background-color var(--fx) var(--ease-fx); }
.jds-cal-title:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 0; }
.jds-cal-nav { display: flex; gap: 2px; }
.jds-cal-nav .jds-mini { height: 32px; }
.jds-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jds-cal-grid--3 { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.jds-wd { height: 28px; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--tx-3); }
.jds-day {
    appearance: none; height: 36px; padding: 0; border: 1px solid transparent; border-radius: var(--r-sm); corner-shape: squircle;
    background: transparent; color: var(--tx); font: 400 13px var(--font); font-variant-numeric: tabular-nums; cursor: pointer;
    transition: background-color var(--fx) var(--ease-fx), color var(--fx) var(--ease-fx), border-color var(--fx) var(--ease-fx);
}
.jds-cal-grid--3 .jds-day { height: 44px; }
.jds-day.is-out { color: var(--tx-3); }
.jds-day.is-today { border-color: var(--bd-2); }
.jds-day.is-in-week { background: var(--sky-soft); border-radius: 0; }
.jds-day[aria-selected="true"] { background: var(--sky); color: var(--sky-tx); font-weight: 650; border-color: var(--sky); }
.jds-day:disabled { color: var(--tx-3); opacity: .45; cursor: not-allowed; }
.jds-day:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 0; }
.jds-day:active:not(:disabled) { transform: scale(.96); }
.jds-wk { height: 36px; display: grid; place-items: center; font-size: 11px; color: var(--tx-3); font-variant-numeric: tabular-nums; }
.jds-cal-grid--wk { grid-template-columns: 28px repeat(7, 1fr); }
.jds-cal-foot { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--bd); }
@media (hover: hover) and (pointer: fine) {
    .jds-day:hover:not(:disabled):not([aria-selected="true"]) { background: color-mix(in srgb, var(--tx) 6%, var(--sf)); }
    .jds-cal-title:hover { background: color-mix(in srgb, var(--tx) 6%, var(--sf)); }
}

/* Time */
.jds-time { display: flex; gap: 4px; }
.jds-time-col { display: grid; gap: 2px; align-content: start; width: 64px; height: 216px; overflow-y: auto; padding: 2px; scrollbar-width: thin; scroll-padding: 4px; }
.jds-time-col .jds-opt { justify-content: center; min-height: 32px; padding: 0; font-variant-numeric: tabular-nums; }
.jds-time-col .jds-opt > .jds-ic--check { display: none; }
.jds-time-head { display: flex; gap: 4px; padding: 2px 2px 6px; border-bottom: 1px solid var(--bd); margin-bottom: 4px; }
.jds-time-head span { width: 64px; text-align: center; font-size: 12px; font-weight: 600; color: var(--tx-2); }
.jds-dt { display: flex; gap: 12px; align-items: flex-start; }
.jds-dt > .jds-time-wrap { padding-left: 12px; border-left: 1px solid var(--bd); }

/* Color picker */
.jds-color { display: grid; gap: 12px; width: 248px; padding: 6px; }
.jds-sv { position: relative; height: 152px; border-radius: var(--r-sm); cursor: crosshair; touch-action: none;
    background: linear-gradient(to top, rgb(0 0 0), rgb(0 0 0 / 0)), linear-gradient(to right, rgb(255 255 255), hsl(var(--h, 200) 100% 50%)); }
.jds-sv:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 2px; }
.jds-knob { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid var(--tx); box-shadow: 0 0 0 1px var(--bg); pointer-events: none; }
.jds-hue { --fill: 0%; }
.jds-hue::-webkit-slider-runnable-track { background: linear-gradient(to right, rgb(255 0 0), rgb(255 255 0), rgb(0 255 0), rgb(0 255 255), rgb(0 0 255), rgb(255 0 255), rgb(255 0 0)) !important; }
.jds-hue::-moz-range-track { background: linear-gradient(to right, rgb(255 0 0), rgb(255 255 0), rgb(0 255 0), rgb(0 255 255), rgb(0 0 255), rgb(255 0 255), rgb(255 0 0)); }
.jds-hue::-moz-range-progress { background: transparent; }
.jds-hue::-webkit-slider-thumb { border-color: var(--tx) !important; }
.jds-hue::-moz-range-thumb { border-color: var(--tx); }
.jds-color-row { display: flex; align-items: center; gap: 8px; }
.jds-color-row input { min-height: 32px; font-family: var(--mono); font-size: 13px; text-transform: uppercase; }
.jds-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.jds-preset { appearance: none; aspect-ratio: 1; padding: 0; border: 1px solid color-mix(in srgb, var(--tx) 16%, transparent); border-radius: 6px; cursor: pointer;
    transition: transform var(--fx-fast) var(--ease-sp); }
.jds-preset[aria-pressed="true"] { outline: 2px solid var(--sky-a); outline-offset: 2px; }
.jds-preset:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 2px; }
.jds-preset:active { transform: scale(.92); }

@media (max-width: 639.98px) {
    .jds-trigger { font-size: 16px; }
}

/* Switch guard: redeclared so the checkbox rules above (input[type="checkbox"]) do not override the hidden input inside .sw */
.sw > input[type="checkbox"],
.sw > input[type="checkbox"]:is(:checked, :indeterminate, :active, :hover) {
    appearance: none; -webkit-appearance: none; position: absolute; inset: 0;
    width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
    background: transparent; opacity: 0; transform: none; cursor: pointer;
}
.sw > input[type="checkbox"]::after { content: none; }

/* ==========================================================================
   Pastel palette pool — multi-purpose colors with no fixed meaning
   Pick a hue with data-hue="<name>"; children use --hue / --hue-soft / --hue-ink / --hue-tx
   ========================================================================== */
[data-hue="rose"] { --hue: var(--p-rose); --hue-soft: var(--p-rose-soft); --hue-ink: var(--p-rose-ink); --hue-tx: var(--p-rose-tx); }
[data-hue="coral"] { --hue: var(--p-coral); --hue-soft: var(--p-coral-soft); --hue-ink: var(--p-coral-ink); --hue-tx: var(--p-coral-tx); }
[data-hue="amber"] { --hue: var(--p-amber); --hue-soft: var(--p-amber-soft); --hue-ink: var(--p-amber-ink); --hue-tx: var(--p-amber-tx); }
[data-hue="lime"] { --hue: var(--p-lime); --hue-soft: var(--p-lime-soft); --hue-ink: var(--p-lime-ink); --hue-tx: var(--p-lime-tx); }
[data-hue="mint"] { --hue: var(--p-mint); --hue-soft: var(--p-mint-soft); --hue-ink: var(--p-mint-ink); --hue-tx: var(--p-mint-tx); }
[data-hue="teal"] { --hue: var(--p-teal); --hue-soft: var(--p-teal-soft); --hue-ink: var(--p-teal-ink); --hue-tx: var(--p-teal-tx); }
[data-hue="sky"] { --hue: var(--p-sky); --hue-soft: var(--p-sky-soft); --hue-ink: var(--p-sky-ink); --hue-tx: var(--p-sky-tx); }
[data-hue="periwinkle"] { --hue: var(--p-periwinkle); --hue-soft: var(--p-periwinkle-soft); --hue-ink: var(--p-periwinkle-ink); --hue-tx: var(--p-periwinkle-tx); }
[data-hue="lavender"] { --hue: var(--p-lavender); --hue-soft: var(--p-lavender-soft); --hue-ink: var(--p-lavender-ink); --hue-tx: var(--p-lavender-tx); }
[data-hue="pink"] { --hue: var(--p-pink); --hue-soft: var(--p-pink-soft); --hue-ink: var(--p-pink-ink); --hue-tx: var(--p-pink-tx); }
.badge--hue { background: var(--hue-soft); border-color: transparent; color: var(--hue-tx); }
.badge--hue-solid { background: var(--hue); border-color: transparent; color: var(--hue-ink); }
.hue-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--hue-tx); }
.hue-avatar {
    display: inline-grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px;
    border-radius: var(--r-sm); corner-shape: squircle; background: var(--hue); color: var(--hue-ink);
    font-size: 13px; font-weight: 600; line-height: 1;
}
.hue-block { display: grid; gap: var(--s1); padding: 8px 12px; border-radius: var(--r-sm); corner-shape: squircle; background: var(--hue-soft); color: var(--tx); }
.hue-block > .hue-title { color: var(--hue-tx); font-weight: 600; }

/* ==========================================================================
   Spacing relationships (spec 03.1) — no two visible elements touch by accident
   1) Block containers space their children automatically (flow)
   2) Layout containers that already use gap opt out, so spacing is never doubled
   3) Rows wrap instead of squeezing items together
   Specificity is kept deliberate: flow rules (0,0,1) beat the base margin reset by order,
   and the opt-out rules (0,1,0) always beat flow rules
   ========================================================================== */
:root { --flow: var(--s4); --flow-tight: var(--s3); --flow-head: var(--s3); --flow-block: var(--s6); --flow-section: var(--s8); }

/* 1. Flow: default gap between siblings in block containers */
:where(main, section, article, aside, .wrap, .wrap--read, .wrap--wide, .card, .panel, .dialog, .details-body, .acc-inner > div, .flow, li, dd, td, blockquote)
    > :where(:not(script, style, template, link, meta))
    + :not(script, style, template, link, meta, hr) { margin-block-start: var(--flow); }
/* Consecutive paragraphs of running text sit closer */
:where(p) + p { margin-block-start: var(--flow-tight); }
/* A heading belongs to what follows it: more space above, less below */
:where(h1, h2, h3, h4, h5, h6, .t-page, .t-section, .t-card, .t-display) + :not(script, style, template, link, meta, hr) { margin-block-start: var(--flow-head); }
:where(.lbl, legend) + :not(script, style, template, link, meta, hr) { margin-block-start: var(--s2); }
:where(*) + :is(h2, .t-section) { margin-block-start: var(--flow-section); }
:where(*) + :is(h3, h4, .t-card) { margin-block-start: var(--flow-block); }
/* Stacked sections */
:where(section) + section { margin-block-start: var(--flow-section); }
:where(.section) + .section { margin-block-start: 0; }   /* .section already carries padding-block */

/* 2. Gap-based layout containers own their spacing: children get no flow margin */
:is(.stack, .row, .grid-2, .grid-3, .actions, .actions--stack, .split, .media-grid, .hero, .field-group, .field-wrap,
    .card-head, .card-foot, .dialog-head, .dialog-foot, .empty, .titlebar, .tabs, .seg, .menu, .jds-list,
    .jds-box, .jds-addons, .jds-file, .jds-trigger, .jds-cal, .jds-cal-foot, .jds-dt, .jds-time, .jds-time-head,
    .jds-color, .jds-color-row, .jds-presets, .jds-range, .pager, .crumb, .nav-icons, .nav-list, .topbar, .layout,
    .no-flow, figure, fieldset) > * {
    margin-block-start: 0;
}

/* 3. Inline neighbors (buttons, badges) never touch; gap-based rows handle their own spacing */
:where(.btn, .badge) + :is(.btn, .badge) { margin-inline-start: var(--s2); }
:is(.stack, .row, .grid-2, .grid-3, .actions, .actions--stack, .card-head, .card-foot, .dialog-head, .dialog-foot,
    .titlebar, .pager, .empty, .seg, .tabs, .jds-cal-foot, .jds-file, .no-flow) > :is(.btn, .badge) {
    margin-inline-start: 0;
}
.row, .card-head, .titlebar, .dialog-head { flex-wrap: wrap; row-gap: var(--s2); }
/* .card--interactive sets display:block; keep a layout class on the same element working */
.card--interactive.stack, .card--interactive.row { display: flex; }

/* ==========================================================================
   Loading (spec 10.6) — one ring, four scopes: page · region · element (skeleton) · control
   aria-busy="true" is set at once (blocks re-entry); data-loading="true" is set after 180ms (shows the loader)
   ========================================================================== */
:root { --spin-track: 25%; }

/* Ring: always a perfect circle, never squeezed by flex, centered by its parent */
.spin {
    --spin-size: 16px;
    display: inline-block; flex: none; box-sizing: border-box;
    width: var(--spin-size); height: var(--spin-size); aspect-ratio: 1;
    border: 2px solid color-mix(in srgb, currentColor var(--spin-track), transparent);
    border-top-color: currentColor; border-radius: 50%;
    vertical-align: middle; animation: spin 700ms linear infinite;
}
.spin--md { --spin-size: 20px; }
.spin--lg { --spin-size: 24px; }

/* Control loading: the label keeps its width but turns invisible; the ring sits in the exact center */
.btn { position: relative; --btn-fg: var(--tx); }
.btn--pri { --btn-fg: var(--sky-tx); }
.btn[data-loading="true"] { color: transparent; cursor: progress; transition: none; }   /* label disappears at once, never fades over the ring */
.btn[data-loading="true"]:disabled { opacity: 1; }
.btn[data-loading="true"] > * { visibility: hidden; }
.btn[data-loading="true"]::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 16px; height: 16px; margin: -8px 0 0 -8px; box-sizing: border-box;
    border: 2px solid color-mix(in srgb, var(--btn-fg) var(--spin-track), transparent);
    border-top-color: var(--btn-fg); border-radius: 50%;
    animation: spin 700ms linear infinite;
}
.btn--sm[data-loading="true"]::after { width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.btn--lg[data-loading="true"]::after { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
:is(.btn, .menu-item, .tab, a)[aria-busy="true"] { pointer-events: none; }

/* Inline status: a ring next to short text, e.g. "Loading" under a list */
.load-inline { display: inline-flex; align-items: center; gap: var(--s2); color: var(--tx-2); font-size: 13px; }

/* Region loading: existing content stays in place, dimmed, with a ring over its center */
.load-region { position: relative; }
.load-region[data-loading="true"] > * { opacity: .5; pointer-events: none; transition: opacity var(--fx) var(--ease-fx); }
.load-region[data-loading="true"]::after {
    content: ""; position: absolute; left: 50%; top: min(50%, 160px);
    width: 20px; height: 20px; margin: -10px 0 0 -10px; box-sizing: border-box;
    border: 2px solid color-mix(in srgb, var(--tx-2) var(--spin-track), transparent);
    border-top-color: var(--tx-2); border-radius: 50%;
    animation: spin 700ms linear infinite;
}

/* Element loading (first load): skeletons match the final layout */
.skel--text { height: 14px; border-radius: 4px; }
.skel--title { height: 20px; width: 40%; border-radius: 6px; }
.skel--block { height: auto; min-height: 120px; border-radius: var(--r-card); }
.skel--circle { width: 32px; height: 32px; border-radius: 50%; }
.skel + .skel { margin-block-start: var(--s2); }

/* Page loading: a thin bar at the very top; never a full-screen splash */
.page-load {
    position: fixed; top: 0; left: 0; right: 0; z-index: 90; height: 3px; overflow: hidden;
    pointer-events: none; opacity: 0; transition: opacity var(--fx) var(--ease-fx);
}
.page-load[data-loading="true"] { opacity: 1; }
.page-load::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
    background: var(--sky); border-radius: 0 2px 2px 0;
    animation: page-load 1.2s var(--ease-sp) infinite;
}
.page-load[data-value]::before { width: var(--value, 0%); animation: none; transition: width var(--sp-slow) var(--ease-sp); }
@keyframes page-load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
/* App boot only: nothing can render yet → a centered ring on the background, no logo animation */
.boot { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: var(--bg); color: var(--tx-2); }

@media (prefers-reduced-motion: reduce) {
    /* A loader must still read as "working": rotate slowly instead of stopping */
    .spin, .btn[data-loading="true"]::after, .load-region[data-loading="true"]::after {
        animation-duration: 1.6s !important; animation-iteration-count: infinite !important;
    }
    .page-load::before { animation: none !important; width: 100%; opacity: .6; }
}

/* ==========================================================================
   Navigation and overlays (spec 14.14) — app bar, drawer, bottom sheet, dialog, confirm, alert, toast, tab bar
   ========================================================================== */
:root {
    --jds-i-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M7.13 1.5a1 1 0 0 1 1.74 0l6.5 11.5A1 1 0 0 1 14.5 14.5h-13a1 1 0 0 1-.87-1.5zM8 5a.9.9 0 0 0-.9.9v3.2a.9.9 0 0 0 1.8 0V5.9A.9.9 0 0 0 8 5zm0 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z'/%3E%3C/svg%3E");
    --jds-i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 6a.9.9 0 0 0-.9.9v3.2a.9.9 0 0 0 1.8 0V7.9A.9.9 0 0 0 8 7zm0-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z'/%3E%3C/svg%3E");
    --jds-i-ok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm3.2 4.3a.9.9 0 0 0-1.27 0L7.1 8.13 6.07 7.1A.9.9 0 1 0 4.8 8.37l1.66 1.66a.9.9 0 0 0 1.27 0l3.47-3.46a.9.9 0 0 0 0-1.27z'/%3E%3C/svg%3E");
    --jds-i-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 3.5a1 1 0 0 1 1-1h10a1 1 0 1 1 0 2H3a1 1 0 0 1-1-1zm0 4.5a1 1 0 0 1 1-1h10a1 1 0 1 1 0 2H3a1 1 0 0 1-1-1zm1 3.5a1 1 0 1 0 0 2h10a1 1 0 1 0 0-2z'/%3E%3C/svg%3E");
}
.jds-ic--warn { --i: var(--jds-i-warn); }
.jds-ic--info { --i: var(--jds-i-info); }
.jds-ic--ok { --i: var(--jds-i-ok); }
.jds-ic--menu { --i: var(--jds-i-menu); }
/* ---------- Danger button (was missing a default state) ---------- */
.btn--danger { background: color-mix(in srgb, var(--err) 16%, var(--sf)); border-color: color-mix(in srgb, var(--err) 55%, var(--bd)); color: var(--tx); }

/* ---------- App bar: menu button at the top left, title, optional inline nav, actions on the right ---------- */
.appbar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--s3);
    height: var(--head-h); padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
    background: var(--bg); border-bottom: 1px solid transparent;
    transition: background-color var(--fx) var(--ease-fx), border-color var(--fx) var(--ease-fx);
}
.appbar.is-scrolled { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom-color: var(--bd); }
.appbar > .menu-btn { order: -1; flex: none; }
.appbar-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; letter-spacing: -.018em; color: var(--tx); }
.appbar-nav { display: flex; align-items: center; gap: var(--s1); }
.appbar-nav a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: var(--r-sm); color: var(--tx-2); font-weight: 550;
    transition: color var(--fx) var(--ease-fx), background-color var(--fx) var(--ease-fx); }
.appbar-nav a[aria-current="page"] { color: var(--tx); background: var(--sky-soft); }
.appbar-actions { display: flex; align-items: center; gap: var(--s2); margin-inline-start: auto; }
@media (hover: hover) and (pointer: fine) { .appbar-nav a:hover:not([aria-current="page"]) { color: var(--tx); background: color-mix(in srgb, var(--tx) 6%, var(--bg)); } }
@media (max-width: 1023.98px) { .appbar-nav { display: none; } }

/* ---------- Shared overlay mechanics (drawer, sheet, dialog, confirm) built on <dialog> ---------- */
html:has(dialog.jds-ov[open]) { overflow: hidden; }
dialog.jds-ov::backdrop { background: var(--veil); animation: jds-fade-in var(--fx-slow) var(--ease-fx) both; }
dialog.jds-ov.is-closing::backdrop { animation: jds-fade-out var(--ms-exit) var(--ease-away) both; }
@keyframes jds-fade-in { from { opacity: 0; } }
@keyframes jds-fade-out { to { opacity: 0; } }
.dialog.is-closing { animation: jds-dialog-out var(--ms-exit) var(--ease-away) both; }
@keyframes jds-dialog-out { to { opacity: 0; transform: translateY(6px) scale(.99); } }

/* ---------- Navigation drawer: slides in from the left ---------- */
.drawer {
    position: fixed; inset: 0 auto 0 0; margin: 0; width: min(304px, 88vw); max-width: none; height: 100dvh; max-height: none;
    padding: max(8px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border: 0; border-inline-end: 1px solid var(--bd); border-radius: 0 var(--r-pop) var(--r-pop) 0; corner-shape: squircle;
    background: var(--sf); color: var(--tx); box-shadow: 0 16px 48px var(--sh); overflow: hidden;
}
.drawer[open] { display: flex; flex-direction: column; gap: var(--s2); animation: jds-drawer-in var(--sp) var(--ease-sp) both; }
.drawer.is-closing { animation: jds-drawer-out var(--ms-exit) var(--ease-away) both; }
@keyframes jds-drawer-in { from { transform: translateX(-105%); } }
@keyframes jds-drawer-out { to { transform: translateX(-105%); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 48px; padding-inline-start: 4px; }
.drawer-title { font-size: 16px; font-weight: 600; letter-spacing: -.018em; }
.drawer-nav { display: grid; align-content: start; gap: 2px; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.drawer-nav a, .drawer-nav button {
    display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 44px; padding: 0 12px;
    border: 0; border-radius: var(--r-sm); corner-shape: squircle; background: transparent; color: var(--tx); font: 500 14px var(--font); text-align: left;
    transition: background-color var(--fx) var(--ease-fx);
}
.drawer-nav .ic, .drawer-nav .jds-ic { color: var(--tx-2); }
.drawer-nav [aria-current="page"] { background: var(--sky-soft); font-weight: 600; }
.drawer-nav [aria-current="page"] :is(.ic, .jds-ic) { color: var(--sky-a); }
.drawer-group { padding: 12px 12px 4px; font-size: 12px; font-weight: 600; color: var(--tx-2); }
.drawer-foot { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--bd); display: grid; gap: var(--s2); }
@media (hover: hover) and (pointer: fine) { .drawer-nav :is(a, button):hover:not([aria-current="page"]) { background: color-mix(in srgb, var(--tx) 6%, var(--sf)); } }

/* ---------- Bottom sheet: rises from the bottom edge ---------- */
.sheet {
    position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(640px, 100%); max-width: none; max-height: 85dvh;
    padding: 4px 20px max(20px, env(safe-area-inset-bottom));
    border: 1px solid var(--bd); border-bottom: 0; border-radius: var(--r-pop) var(--r-pop) 0 0; corner-shape: squircle;
    background: var(--sf); color: var(--tx); box-shadow: 0 -8px 32px var(--sh); overflow-y: auto; overscroll-behavior: contain;
}
.sheet[open] { animation: jds-sheet-in var(--sp) var(--ease-sp) both; }
.sheet.is-closing { animation: jds-sheet-out var(--ms-exit) var(--ease-away) both; }
@keyframes jds-sheet-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes jds-sheet-out { to { opacity: 0; transform: translateY(12px); } }
.sheet-handle { display: block; width: 100%; height: 24px; padding: 0; border: 0; background: transparent; cursor: grab; touch-action: none; }
.sheet-handle::before { content: ""; display: block; width: 36px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--bd-2); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }

/* ---------- Confirm / warning dialog ---------- */
.dialog--confirm { width: min(400px, calc(100vw - 32px)); }
.confirm-ic { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-ctl); corner-shape: squircle;
    background: color-mix(in srgb, var(--warn) 25%, var(--sf)); color: var(--tx); }
.dialog--danger .confirm-ic { background: color-mix(in srgb, var(--err) 25%, var(--sf)); }
.dialog--confirm .confirm-ic .jds-ic { width: 20px; height: 20px; }
.dialog--confirm .confirm-body { color: var(--tx-2); }

/* ---------- Alerts and banners ---------- */
.alert--ok { background: color-mix(in srgb, var(--ok) 18%, var(--sf)); border-color: color-mix(in srgb, var(--ok) 50%, var(--bd)); }
.alert > .jds-ic { margin-top: 2px; }
.alert-body { flex: 1 1 auto; min-width: 0; display: grid; gap: var(--s1); }
.alert-title { font-weight: 600; }
.alert-actions { display: flex; align-items: center; gap: var(--s2); flex: none; margin-inline-start: auto; }
.alert--banner { border-radius: 0; border-inline: 0; padding-inline: max(16px, env(safe-area-inset-left)); align-items: center; }

/* ---------- Toast: one at a time, optional action ---------- */
.toast { gap: var(--s3); }
.toast .btn { flex: none; }
.toast--ok .jds-ic { color: var(--ok); }
.toast--warn .jds-ic { color: var(--warn); }
.toast--err .jds-ic { color: var(--err); }
@media (max-width: 639.98px) { .toast { left: 16px; right: 16px; max-width: none; } }
body:has(.tabbar) .toast { bottom: calc(56px + 16px + env(safe-area-inset-bottom)); }

/* ---------- Bottom navigation bar (mobile, 3–5 top-level destinations) ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--bd);
}
.tabbar a { display: grid; place-items: center; align-content: center; gap: 2px; min-width: 0; color: var(--tx-2); font-size: 11px; font-weight: 550;
    transition: color var(--fx) var(--ease-fx); }
.tabbar a :is(.ic, .jds-ic) { width: 20px; height: 20px; font-size: 20px; }
.tabbar a[aria-current="page"] { color: var(--tx); }
.tabbar a[aria-current="page"] :is(.ic, .jds-ic) { color: var(--sky-a); }
body:has(.tabbar) { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
@media (min-width: 1024px) { .tabbar { display: none; } body:has(.tabbar) { padding-bottom: 0; } }

/* Spacing: overlay and navigation containers own their gaps */
:is(.appbar, .appbar-nav, .appbar-actions, .drawer, .drawer-head, .drawer-nav, .drawer-foot, .sheet-head, .tabbar, .alert, .alert-body, .alert-actions, .toast) > * { margin-block-start: 0; }
:is(.appbar, .appbar-actions, .alert-actions, .toast, .sheet-head, .drawer-head, .drawer-foot) > :is(.btn, .badge) { margin-inline-start: 0; }
:where(.sheet) > :where(:not(script, style, template, .sheet-handle)) + :not(script, style, template, hr) { margin-block-start: var(--flow); }

@media (prefers-reduced-motion: reduce) {
    .drawer[open], .drawer.is-closing, .sheet[open], .sheet.is-closing, .dialog.is-closing { animation-duration: .01ms !important; }
}

/* ==========================================================================
   Motion, page transitions, tooltips, information-page patterns, additional components (spec 07.5–07.6, 14.15–14.17)
   ========================================================================== */
:root {
    --jds-i-help: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm.1-7.2c-1.5 0-2.6.9-2.7 2.2a.85.85 0 0 0 1.7.1c.05-.4.4-.7 1-.7.6 0 1 .35 1 .8 0 .4-.2.6-.75.95-.7.45-1.2.95-1.15 1.95a.85.85 0 0 0 1.7-.05c0-.35.15-.5.6-.8.75-.5 1.3-1.05 1.3-2.05 0-1.45-1.2-2.4-2.7-2.4z'/%3E%3C/svg%3E");
    --jds-i-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.2l2.06 4.18 4.6.67-3.33 3.25.79 4.58L8 11.72l-4.12 2.16.79-4.58L1.34 6.05l4.6-.67z'/%3E%3C/svg%3E");
    --jds-i-arrow-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 2.5a1 1 0 0 1 .7.3l4 4a1 1 0 1 1-1.4 1.4L9 5.9V13a1 1 0 1 1-2 0V5.9L4.7 8.2a1 1 0 0 1-1.4-1.4l4-4a1 1 0 0 1 .7-.3z'/%3E%3C/svg%3E");
    --jds-i-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 1.5h6.5A1.5 1.5 0 0 1 13 3v8.5a1.5 1.5 0 0 1-1.5 1.5H11V5.5A2 2 0 0 0 9 3.5H3.5V3A1.5 1.5 0 0 1 5 1.5zM3 5h6a1 1 0 0 1 1 1v7.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
}
.jds-ic--help { --i: var(--jds-i-help); }
.jds-ic--star { --i: var(--jds-i-star); }
.jds-ic--arrow-up { --i: var(--jds-i-arrow-up); }
.jds-ic--copy { --i: var(--jds-i-copy); }
/* ==========================================================================
   Motion completeness (spec 07.5): every state change animates both ways
   ========================================================================== */
/* details: close animates too (content-visibility must transition discretely) */
@supports (interpolate-size: allow-keywords) {
    details::details-content {
        transition: block-size var(--sp) var(--ease-sp), opacity var(--fx) var(--ease-fx),
                    content-visibility var(--sp) allow-discrete;
        opacity: 0;
    }
    details[open]::details-content { opacity: 1; }
}
.acc-body { transition: grid-template-rows var(--sp) var(--ease-sp), opacity var(--fx) var(--ease-fx); }
/* Content that replaces other content in place (tab panels, views, wizard steps): the new one rises in */
[role="tabpanel"]:not([hidden]), .view, .wizard-step:not([hidden]) { animation: enter var(--sp-fast) var(--ease-sp) both; }
/* Inline errors and help text fade out as well as in */
.field-error { transition: opacity var(--fx-fast) var(--ease-away), display var(--fx-fast) allow-discrete; }
@starting-style { .field-error:not([hidden]) { opacity: 0; } }
/* Legacy drop-down mobile menu now behaves as a left drawer, both ways */
.mobile-menu {
    top: 0; bottom: 0; right: auto; width: min(304px, 88vw); max-height: none; height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) 12px 16px; border: 0; border-inline-end: 1px solid var(--bd);
    border-radius: 0 var(--r-pop) var(--r-pop) 0; align-content: start; z-index: 50;
    transform: translateX(-105%); opacity: 1;
    transition: transform var(--ms-exit) var(--ease-away), visibility var(--ms-exit);
}
.mobile-menu.is-open { transform: none; transition: transform var(--sp) var(--ease-sp), visibility 0s; }
.nav-veil { transition: opacity var(--fx-slow) var(--ease-fx), visibility var(--fx-slow); }

/* ---------- Press feedback (spec 07.5): small, quick, only confirms the click ---------- */
:is(.btn, .tab, .seg button, .chip, .jds-mini, .tabbar a, .appbar-nav a, .nav-icon, .tip-icon, .carousel-nav) {
    transition-property: background-color, border-color, color, opacity, transform, box-shadow;
    transition-duration: var(--fx), var(--fx), var(--fx), var(--fx), var(--fx), var(--fx);
    transition-timing-function: var(--ease-fx), var(--ease-fx), var(--ease-fx), var(--ease-fx), var(--ease-sp), var(--ease-fx);
}
.btn:active:not(:disabled):not([aria-busy="true"]),
:is(.tab, .seg button, .chip, .jds-mini, .nav-icon, .tip-icon, .carousel-nav):active:not(:disabled) {
    transform: scale(.97); transition-duration: var(--fx-fast);
}
.btn--lg:active:not(:disabled):not([aria-busy="true"]) { transform: scale(.98); }
.tabbar a:active, .appbar-nav a:active { transform: scale(.94); transition-duration: var(--fx-fast); }
:is(.card--interactive, .media-btn, .plan):active { transform: scale(.99); transition: transform var(--fx-fast) var(--ease-sp); }
:is(.menu-item, .jds-opt, .drawer-nav a, .drawer-nav button, .mobile-menu a, .nav-link, .notif):active {
    background: color-mix(in srgb, var(--tx) 12%, var(--sf)); transition-duration: var(--fx-fast);
}
:is(input[type="checkbox"], input[type="radio"]):active:not(:disabled) { transform: scale(.9); }
.sw:active .sw-track::after { transform: scale(.9); }
.sw:active input:checked + .sw-track::after { transform: translateX(16px) scale(.9); }

/* ---------- Page transitions (spec 07.6): cross-document View Transitions ---------- */
@view-transition { navigation: auto; types: page; }
html:active-view-transition-type(page)::view-transition-old(root) { animation: jds-page-out var(--ms-exit) var(--ease-away) both; }
html:active-view-transition-type(page)::view-transition-new(root) { animation: jds-page-in var(--sp) var(--ease-sp) both; }
@keyframes jds-page-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes jds-page-in { from { opacity: 0; transform: translateY(8px); } }
.appbar { view-transition-name: jds-appbar; }
.tabbar { view-transition-name: jds-tabbar; }
::view-transition-group(jds-appbar), ::view-transition-group(jds-tabbar) { animation: none; }
::view-transition-group(*) { animation-duration: var(--sp); animation-timing-function: var(--ease-sp); }

/* ---------- Tooltips (spec 14.15) ---------- */
.tip::after { content: none !important; }   /* the legacy CSS-only tooltip is replaced by the JS tooltip below */
.tip-term { text-decoration: underline dotted var(--tx-3); text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: help; }
.tip-term:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 2px; border-radius: 4px; }
.tip-icon {
    display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; margin-inline-start: 4px; vertical-align: -4px;
    border: 0; border-radius: 50%; background: transparent; color: var(--tx-3); cursor: help;
}
.tip-icon > .jds-ic { width: 16px; height: 16px; }
.tip-icon:focus-visible { outline: 2px solid var(--sky-a); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) { .tip-icon:hover { color: var(--tx); } }
@media (pointer: coarse) { .tip-icon { position: relative; } .tip-icon::before { content: ""; position: absolute; inset: -12px; } }
.jds-tip {
    position: fixed; z-index: 85; max-width: min(240px, calc(100vw - 16px)); padding: 7px 10px;
    border-radius: var(--r-sm); corner-shape: squircle; background: var(--tx); color: var(--bg);
    font: 500 13px/1.4 var(--font); letter-spacing: -.005em; pointer-events: none;
    opacity: 0; transform: translateY(var(--tip-from, 4px));
    transition: opacity var(--fx-fast) var(--ease-away), transform var(--fx-fast) var(--ease-away);
}
.jds-tip.is-up { --tip-from: -4px; }
.jds-tip.is-in { opacity: 1; transform: none; transition: opacity var(--fx) var(--ease-fx), transform var(--sp-fast) var(--ease-sp); }
.jds-tip.has-arrow::before {
    content: ""; position: absolute; left: var(--arrow-x, 50%); width: 10px; height: 10px; margin-left: -5px;
    background: inherit; border-radius: 2px; transform: rotate(45deg); top: -4px;
}
.jds-tip.has-arrow.is-up::before { top: auto; bottom: -4px; }

/* ==========================================================================
   Information pages: scroll reveal, sticky, numbers (spec 14.16)
   ========================================================================== */
html.jds-reveal [data-reveal]:not(.is-revealed) { opacity: 0; }
html.jds-reveal [data-reveal=""]:not(.is-revealed), html.jds-reveal [data-reveal="up"]:not(.is-revealed) { transform: translateY(24px); }
html.jds-reveal [data-reveal="scale"]:not(.is-revealed) { transform: scale(.96); }
html.jds-reveal [data-reveal="blur"]:not(.is-revealed) { filter: blur(6px); transform: translateY(12px); }
html.jds-reveal [data-reveal="mask"]:not(.is-revealed) { opacity: 1; clip-path: inset(0 0 100% 0); }
[data-reveal] {
    transition: opacity var(--sp-slow) var(--ease-sp), transform var(--sp-slow) var(--ease-sp),
                filter var(--sp-slow) var(--ease-sp), clip-path 700ms var(--ease-sp);
    transition-delay: calc(var(--i, 0) * 70ms);
}
/* Headline word stagger (data-reveal="words"): words rise one after another */
html.jds-reveal [data-reveal="words"] { opacity: 1; }
[data-reveal="words"] .jds-w { display: inline-block; transition: opacity var(--sp-slow) var(--ease-sp), transform var(--sp-slow) var(--ease-sp); transition-delay: calc(var(--w, 0) * 45ms); }
html.jds-reveal [data-reveal="words"]:not(.is-revealed) .jds-w { opacity: 0; transform: translateY(.4em); }
/* Highlight marker that sweeps in when revealed */
.mark-sweep { background: linear-gradient(var(--sky-soft), var(--sky-soft)) no-repeat 0 85% / 0% 40%; color: inherit; padding: 0 2px; transition: background-size 700ms var(--ease-sp) 200ms; }
.is-revealed .mark-sweep, .mark-sweep.is-revealed, html:not(.jds-reveal) .mark-sweep { background-size: 100% 40%; }
/* Numbers */
[data-count] { font-variant-numeric: tabular-nums; }

/* Sticky patterns */
.sticky { position: sticky; top: calc(var(--head-h) + var(--s6)); }
.scrolly { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); }
.scrolly-media { position: sticky; top: calc(var(--head-h) + 32px); align-self: start; height: min(70dvh, 560px); display: grid; }
.scrolly-media > * { grid-area: 1 / 1; opacity: 0; transform: scale(.98); transition: opacity var(--sp) var(--ease-sp), transform var(--sp) var(--ease-sp); }
.scrolly-media > .is-active { opacity: 1; transform: none; }
.scrolly-steps { display: grid; gap: 0; }
.scrolly-step { min-height: 70dvh; display: grid; align-content: center; gap: var(--s3); opacity: .35; transition: opacity var(--sp) var(--ease-sp); }
.scrolly-step.is-active { opacity: 1; }
@media (max-width: 1023.98px) {
    .scrolly { grid-template-columns: 1fr; }
    .scrolly-media { top: var(--head-h); height: 40dvh; z-index: 1; background: var(--bg); }
    .scrolly-step { min-height: 60dvh; }
}
.stack-cards { display: grid; gap: var(--s6); }
.stack-cards > * { position: sticky; top: calc(var(--head-h) + 24px + var(--i, 0) * 12px); }
.read-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 89; height: 2px; background: var(--sky); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
@supports (animation-timeline: scroll()) {
    .read-progress { animation: jds-grow linear both; animation-timeline: scroll(root); }
    @keyframes jds-grow { to { transform: scaleX(1); } }
}
@supports not (animation-timeline: scroll()) { .read-progress { display: none; } }
.to-top {
    position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 20;
    opacity: 0; transform: translateY(8px); pointer-events: none;
    transition: opacity var(--fx) var(--ease-fx), transform var(--sp-fast) var(--ease-sp);
}
.to-top.is-in { opacity: 1; transform: none; pointer-events: auto; }
body:has(.tabbar) .to-top { bottom: calc(56px + 16px + env(safe-area-inset-bottom)); }

/* ==========================================================================
   Additional components (spec 14.17)
   ========================================================================== */
/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s6); }
.stat { display: grid; gap: var(--s1); }
.stat-num { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--tx-2); font-size: 13px; }
/* Timeline */
.timeline { list-style: none; padding: 0; display: grid; gap: var(--s6); position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; border-radius: 1px; background: var(--bd); }
.timeline > li { position: relative; padding-left: 28px; display: grid; gap: var(--s1); }
.timeline > li::before { content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--bd-2); }
.timeline > li.is-current::before { border-color: var(--sky-a); background: var(--sky); }
.timeline time { font-size: 12px; color: var(--tx-2); }
/* Pricing */
.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); align-items: stretch; }
.plan { display: grid; align-content: start; gap: var(--s4); padding: var(--s6); border: 1px solid var(--bd); border-radius: var(--r-card); corner-shape: squircle; background: var(--sf); }
.plan--featured { border-color: var(--sky-a); }
.plan-price { font-size: 32px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.plan-price small { font-size: 13px; font-weight: 400; color: var(--tx-2); }
.plan ul { list-style: none; padding: 0; display: grid; gap: var(--s2); }
.plan li { display: flex; gap: var(--s2); align-items: flex-start; }
.plan li > .jds-ic { color: var(--sky-a); margin-top: 2px; }
.plan > .btn { margin-top: auto; }
/* Testimonial */
.quote-card { display: grid; gap: var(--s4); padding: var(--s6); border: 1px solid var(--bd); border-radius: var(--r-card); corner-shape: squircle; background: var(--sf); margin-inline: 0; }
.quote-card blockquote { margin: 0; padding: 0; border: 0; background: none; color: var(--tx); font-size: 15px; line-height: 1.6; }
.quote-by { display: flex; align-items: center; gap: var(--s3); }
.quote-by .sub { display: block; }
/* Logo cloud */
.logos { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s6) var(--s10); }
.logos img { height: 28px; width: auto; opacity: .7; filter: grayscale(1); transition: opacity var(--fx) var(--ease-fx), filter var(--fx) var(--ease-fx); }
@media (hover: hover) and (pointer: fine) { .logos img:hover { opacity: 1; filter: none; } }
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: var(--s10); width: max-content; animation: jds-marquee var(--marquee-time, 40s) linear infinite; }
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
@keyframes jds-marquee { to { transform: translateX(calc(-50% - var(--s10) / 2)); } }
/* Carousel */
.carousel { position: relative; display: grid; gap: var(--s3); }
.carousel-track { display: grid; grid-auto-flow: column; grid-auto-columns: var(--slide, 85%); gap: var(--s4); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; overscroll-behavior-x: contain; scrollbar-width: none; padding-bottom: 2px; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > * { scroll-snap-align: start; min-width: 0; }
@media (min-width: 640px) { .carousel-track { --slide: calc((100% - var(--s4)) / 2); } }
@media (min-width: 1024px) { .carousel-track { --slide: calc((100% - 2 * var(--s4)) / 3); } }
.carousel-ctl { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); }
.carousel-dots { display: flex; gap: 6px; margin-inline-end: auto; }
.carousel-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 4px; background: var(--bd-2); transition: width var(--sp-fast) var(--ease-sp), background-color var(--fx) var(--ease-fx); }
.carousel-dots button[aria-current="true"] { width: 20px; background: var(--sky-a); }
/* Lightbox */
.lightbox { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: max(16px, env(safe-area-inset-top)) 16px 16px; border: 0; background: transparent; color: var(--tx); }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; gap: var(--s3); animation: jds-fade-in var(--fx) var(--ease-fx) both; }
.lightbox.is-closing { animation: jds-fade-out var(--ms-exit) var(--ease-away) both; }
.lightbox::backdrop { background: color-mix(in srgb, var(--bg) 92%, transparent); }
.lightbox-bar { display: flex; justify-content: flex-end; gap: var(--s2); }
.lightbox-stage { display: grid; place-items: center; min-height: 0; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-card); animation: jds-zoom-in var(--sp) var(--ease-sp) both; }
@keyframes jds-zoom-in { from { opacity: 0; transform: scale(.96); } }
.lightbox-cap { text-align: center; color: var(--tx-2); font-size: 13px; }
[data-lightbox] { cursor: zoom-in; }
/* Table of contents with scroll-spy */
.toc { display: grid; gap: 2px; padding-left: var(--s3); border-left: 1px solid var(--bd); font-size: 13px; }
.toc a { color: var(--tx-2); padding: 4px 0; transition: color var(--fx) var(--ease-fx); }
.toc a[aria-current="true"] { color: var(--tx); font-weight: 600; }
/* Chips */
.chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
    border: 1px solid var(--bd); border-radius: var(--r-sm); corner-shape: squircle; background: var(--sf); color: var(--tx-2);
    font: 550 13px var(--font); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--sky-soft); border-color: transparent; color: var(--tx); }
.chip[aria-pressed="true"]::before { content: ""; width: 14px; height: 14px; background: var(--sky-a); -webkit-mask: var(--jds-i-check) center / contain no-repeat; mask: var(--jds-i-check) center / contain no-repeat; }
@media (hover: hover) and (pointer: fine) { .chip:hover:not([aria-pressed="true"]) { border-color: var(--bd-2); color: var(--tx); } }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
/* Tag input */
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: var(--h); padding: 4px 8px; border: 1px solid var(--bd); border-radius: var(--r-ctl); corner-shape: squircle; background: var(--sf); cursor: text; transition: border-color var(--fx) var(--ease-fx); }
.tag-input:focus-within { border-color: var(--sky-a); }
.tag-input > input { flex: 1 1 80px; min-width: 80px; min-height: 30px; border: 0 !important; padding: 0 4px !important; background: transparent !important; }
.tag { display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 4px 0 8px; border-radius: var(--r-xs); background: var(--sf-2); font-size: 13px; animation: jds-pop .22s var(--ease-sp) both; }
.tag > button { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--tx-2); cursor: pointer; }
@keyframes jds-pop { from { opacity: 0; transform: scale(.9); } }
/* OTP */
.otp { display: flex; gap: var(--s2); }
.otp input { width: 44px !important; height: 52px; padding: 0 !important; text-align: center; font-size: 20px !important; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Rating (radio based, keyboard accessible) */
.rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; width: max-content; gap: 2px; border: 0; padding: 0; margin-inline: 0; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating label { width: 24px; height: 24px; cursor: pointer; background: var(--sf-3); -webkit-mask: var(--jds-i-star) center / contain no-repeat; mask: var(--jds-i-star) center / contain no-repeat; transition: background-color var(--fx) var(--ease-fx), transform var(--fx-fast) var(--ease-sp); }
.rating input:checked ~ label, .rating label:hover, .rating label:hover ~ label { background: var(--p-amber); }
.rating label:active { transform: scale(.9); }
.rating input:focus-visible + label { outline: 2px solid var(--sky-a); outline-offset: 2px; border-radius: 4px; }
/* Avatar group and status dot */
.avatars { display: flex; }
.avatars > * { box-shadow: 0 0 0 2px var(--bg); }
.avatars > * + * { margin-inline-start: -8px !important; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tx-3); flex: none; }
.status-dot--online { background: var(--ok); } .status-dot--away { background: var(--warn); } .status-dot--busy { background: var(--err); }
/* Notification list */
.notif-list { list-style: none; padding: 0; display: grid; gap: 2px; }
.notif { display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--s3); align-items: start; padding: 12px; border-radius: var(--r-sm); transition: background-color var(--fx) var(--ease-fx); }
.notif.is-unread .notif-title { font-weight: 600; }
.notif.is-unread::after { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--sky-a); }
.notif time { font-size: 12px; color: var(--tx-3); }
/* Divider with a label */
.divider-label { display: flex; align-items: center; gap: var(--s3); color: var(--tx-3); font-size: 12px; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--bd); }
/* Required mark */
.req { color: var(--err); margin-inline-start: 2px; }
/* Code block with copy */
.code { position: relative; }
.code > .jds-mini, .code > .copy-btn { position: absolute; top: 8px; right: 8px; }
/* Consent (cookie) banner */
.consent { position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 75; max-width: 560px; margin-inline: auto; }

/* Spacing opt-outs for the new layout containers */
:is(.stats, .stat, .timeline, .timeline > li, .pricing, .plan, .plan ul, .quote-card, .quote-by, .logos, .marquee-track, .carousel, .carousel-track, .carousel-ctl, .carousel-dots, .lightbox, .lightbox-bar, .toc, .chips, .tag-input, .otp, .rating, .avatars, .notif-list, .notif, .scrolly, .scrolly-media, .scrolly-steps, .scrolly-step, .stack-cards) > * { margin-block-start: 0; }

@media (prefers-reduced-motion: reduce) {
    html.jds-reveal [data-reveal]:not(.is-revealed), html.jds-reveal [data-reveal="words"]:not(.is-revealed) .jds-w { opacity: 1; transform: none; filter: none; clip-path: none; }
    .marquee-track { animation: none !important; flex-wrap: wrap; width: auto; }
    .marquee { mask-image: none; }
    .scrolly-media > *, .scrolly-step { transition-duration: .01ms !important; }
    @view-transition { navigation: none; }
}
