/* PhysicsHub V5 design language — "B 大气" (Ethan, 2026-10-20).
 *
 * Active only on pages whose root says html[data-ph-system="v5"]; pages on
 * "v1" are untouched. Part 1 holds the v5 token values (every v1 token name,
 * so page CSS keeps resolving, plus the new names). It moves into
 * design-tokens.css once that file is free. Part 2 gives the existing shared
 * .ph-* components their V5 look and adds the few missing ones (switch, chip,
 * list row, stepper, modal, menu, page head). Behaviour lives in
 * assets/js/ui-v5.js. Reference page: dev/ui-v5-lab.html.
 * Values and rationale: .codex-tmp/v5-design-language/tokens-proposal.md.
 *
 * Unit topic colours, official question/document surfaces and print/PDF
 * geometry never read these tokens. Dark mode comes later (V5 step 4).
 */

/* ===================== Part 1 — tokens ===================== */
html[data-ph-system="v5"] {
    color-scheme: light;
    /* surfaces and ink */
    --ph-bg: #f5f5f7;
    --ph-surface: #ffffff;
    --ph-surface-subtle: #fafafc;
    --ph-surface-raised: #ffffff;
    --ph-fill: rgba(0, 0, 0, .05);
    --ph-fill-strong: rgba(0, 0, 0, .09);
    --ph-ink: #1d1d1f;
    --ph-ink-secondary: #6e6e73;
    --ph-ink-tertiary: #86868b;
    --ph-line: rgba(0, 0, 0, .08);
    --ph-line-strong: rgba(0, 0, 0, .16);
    /* accent (personal themes recolour only this family) */
    --ph-chrome-accent: #12796f;
    --ph-chrome-accent-hover: #00675e;
    --ph-chrome-accent-pressed: #065a52;
    --ph-chrome-accent-soft: #e4f4f1;
    --ph-chrome-accent-soft-pressed: #d3ebe6;
    --ph-focus-ring: rgba(10, 122, 111, .45);
    --ph-focus-halo: rgba(10, 122, 111, .16);
    --ph-accent-halo: rgba(10, 122, 111, .08);
    --ph-brand-mark-filter: none;
    /* the primary button is ink in every theme */
    --ph-btn-primary: #1d1d1f;
    --ph-btn-primary-hover: #3a3a3c;
    --ph-btn-primary-pressed: #000000;
    --ph-btn-primary-ink: #ffffff;
    /* meaning colours */
    --ph-positive: #248a3d;
    --ph-warning: #b25d00;
    --ph-danger: #d70015;
    --ph-info: #0a64c8;
    --ph-positive-soft: rgba(36, 138, 61, .12);
    --ph-warning-soft: rgba(178, 93, 0, .12);
    --ph-danger-soft: rgba(215, 0, 21, .09);
    --ph-info-soft: rgba(10, 100, 200, .1);
    --ph-switch-on: var(--ph-chrome-accent);
    /* chrome and hero (hero kept from v1 for pages that still show one) */
    --ph-chrome: rgba(251, 251, 253, .8);
    --ph-chrome-blur: saturate(180%) blur(20px);
    --ph-hero: #071816;
    --ph-hero-halo: rgba(72, 205, 181, .23);
    --ph-hero-accent: #67d7c3;
    --ph-scrim: rgba(0, 0, 0, .2);

    /* type */
    --ph-font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Microsoft YaHei", sans-serif;
    --ph-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Microsoft YaHei", sans-serif;
    --ph-font-document: Arial, "Helvetica Neue", sans-serif;
    --ph-font-math: "STIX Two Math", "Times New Roman", serif;
    --ph-type-shift: 0px;
    --ph-text-meta: 12px;
    --ph-text-label: 14px;
    --ph-text-ui: 15px;
    --ph-text-body: 17px;
    --ph-text-card-title: 21px;
    --ph-text-section: 32px;
    --ph-text-page: 52px;
    --ph-weight-title: 600;
    --ph-tracking-title: -.028em;

    /* space and size */
    --ph-space-1: 4px;
    --ph-space-2: 8px;
    --ph-space-3: 12px;
    --ph-space-4: 16px;
    --ph-space-5: 24px;
    --ph-space-6: 32px;
    --ph-space-7: 48px;
    --ph-space-8: 72px;
    --ph-density-control-height: 40px;
    --ph-density-card-padding: 28px;
    --ph-density-panel-gap: 24px;
    --ph-control-h: var(--ph-density-control-height);
    --ph-control-h-sm: 32px;
    --ph-control-h-lg: 50px;
    --ph-btn-pad: 20px;
    --ph-shell-h: 56px;
    --ph-content-max: 1120px;
    --ph-layout-gutter: clamp(20px, 3.2vw, 96px);
    --ph-layout-gap: clamp(24px, 2.6vw, 48px);
    --ph-layout-inline-size: calc(100% - 2 * var(--ph-layout-gutter));
    --ph-section-gap: 72px;

    /* radius */
    --ph-radius-control: 12px;
    --ph-radius-button: 999px;
    --ph-radius-field: 999px;
    --ph-radius-card: 22px;
    --ph-radius-panel: 28px;
    --ph-radius-sheet: 28px;
    --ph-radius-hero: 28px;
    --ph-radius-pill: 999px;

    /* depth */
    --ph-shadow-control: 0 1px 2px rgba(0, 0, 0, .04);
    --ph-shadow-card: 0 1px 2px rgba(0, 0, 0, .03), 0 8px 28px rgba(0, 0, 0, .05);
    --ph-shadow-card-hover: 0 2px 4px rgba(0, 0, 0, .04), 0 18px 44px rgba(0, 0, 0, .09);
    --ph-shadow-raised: 0 2px 6px rgba(0, 0, 0, .1), 0 1px 1px rgba(0, 0, 0, .04);
    --ph-shadow-overlay: 0 30px 80px rgba(0, 0, 0, .22);
    --ph-card-lift: -3px;

    /* motion: press is quick; release and highlights use a spring */
    --ph-motion-press: 110ms;
    --ph-motion-fast: 160ms;
    --ph-motion-base: 340ms;
    --ph-motion-slow: 540ms;
    --ph-motion-sheet: 560ms;
    --ph-motion-panel: var(--ph-motion-base);
    --ph-press-scale: .96;
    --ph-ease-standard: cubic-bezier(.32, .72, 0, 1);
    --ph-ease-exit: cubic-bezier(.4, 0, 1, 1);
    --ph-motion-ease: var(--ph-ease-standard);
    /* damped springs sampled as linear(): .75 = soft 3% overshoot; .62 = press release */
    --ph-ease-spring: linear(0, 0.033, 0.116, 0.225, 0.345, 0.466, 0.578, 0.679, 0.766, 0.837, 0.895, 0.939, 0.972, 0.996, 1.012, 1.022, 1.027, 1.028, 1.028, 1.026, 1.023, 1.019, 1.016, 1.012, 1.01, 1.007, 1.005, 1.003, 1);
    --ph-ease-press: linear(0, 0.054, 0.183, 0.349, 0.52, 0.679, 0.814, 0.919, 0.996, 1.045, 1.073, 1.083, 1.081, 1.072, 1.059, 1.045, 1.031, 1.019, 1.009, 1.002, 0.997, 0.995, 0.993, 0.993, 0.994, 0.995, 0.996, 0.997, 1);
}

@supports not (transition-timing-function: linear(0, 1)) {
    html[data-ph-system="v5"] {
        --ph-ease-spring: cubic-bezier(.32, .72, 0, 1);
        --ph-ease-press: cubic-bezier(.34, 1.4, .64, 1);
    }
}

/* Personal accent themes: same choices as v1, accent family only. */
html[data-ph-system="v5"][data-theme="ocean"] {
    --ph-chrome-accent: #3664be; --ph-chrome-accent-hover: #2552aa; --ph-chrome-accent-pressed: #1f4590;
    --ph-chrome-accent-soft: #e5f1ff; --ph-chrome-accent-soft-pressed: #d3e4fb;
    --ph-focus-ring: rgba(54, 100, 190, .45); --ph-focus-halo: rgba(54, 100, 190, .16); --ph-accent-halo: rgba(54, 100, 190, .08);
    --ph-brand-mark-filter: hue-rotate(55deg) saturate(1.28) brightness(1.02);
}
html[data-ph-system="v5"][data-theme="rose"] {
    --ph-chrome-accent: #b0486d; --ph-chrome-accent-hover: #9c365c; --ph-chrome-accent-pressed: #86334f;
    --ph-chrome-accent-soft: #ffe9ef; --ph-chrome-accent-soft-pressed: #f3d6e1;
    --ph-focus-ring: rgba(185, 77, 114, .45); --ph-focus-halo: rgba(185, 77, 114, .16); --ph-accent-halo: rgba(185, 77, 114, .08);
    --ph-brand-mark-filter: hue-rotate(165deg) saturate(.9) brightness(1.04);
}
html[data-ph-system="v5"][data-theme="iris"] {
    --ph-chrome-accent: #6656b9; --ph-chrome-accent-hover: #5645a6; --ph-chrome-accent-pressed: #463a93;
    --ph-chrome-accent-soft: #eeeeff; --ph-chrome-accent-soft-pressed: #e0dcff;
    --ph-focus-ring: rgba(103, 87, 200, .45); --ph-focus-halo: rgba(103, 87, 200, .16); --ph-accent-halo: rgba(103, 87, 200, .08);
    --ph-brand-mark-filter: hue-rotate(82deg) saturate(.92) brightness(1.02);
}
html[data-ph-system="v5"][data-subject-id="chemistry"][data-theme="copper"] {
    --ph-chrome-accent: #a84f2a; --ph-chrome-accent-hover: #873d20; --ph-chrome-accent-pressed: #6f3119;
    --ph-chrome-accent-soft: #faeade; --ph-chrome-accent-soft-pressed: #f3d6c4;
    --ph-focus-ring: rgba(168, 79, 42, .45); --ph-focus-halo: rgba(168, 79, 42, .16); --ph-accent-halo: rgba(168, 79, 42, .08);
    --ph-brand-mark-filter: hue-rotate(255deg) saturate(1.18) brightness(1.02);
}
html[data-ph-system="v5"][data-subject-id="chemistry"][data-theme="cobalt"] {
    --ph-chrome-accent: #3156a3; --ph-chrome-accent-hover: #274584; --ph-chrome-accent-pressed: #1f386b;
    --ph-chrome-accent-soft: #e9effb; --ph-chrome-accent-soft-pressed: #d6e1f5;
    --ph-focus-ring: rgba(49, 86, 163, .45); --ph-focus-halo: rgba(49, 86, 163, .16); --ph-accent-halo: rgba(49, 86, 163, .08);
    --ph-brand-mark-filter: hue-rotate(58deg) saturate(1.02) brightness(.98);
}
html[data-ph-system="v5"][data-subject-id="chemistry"][data-theme="flame"] {
    --ph-chrome-accent: #a23f54; --ph-chrome-accent-hover: #843142; --ph-chrome-accent-pressed: #6b2736;
    --ph-chrome-accent-soft: #fae8ed; --ph-chrome-accent-soft-pressed: #f2d2db;
    --ph-focus-ring: rgba(162, 63, 84, .45); --ph-focus-halo: rgba(162, 63, 84, .16); --ph-accent-halo: rgba(162, 63, 84, .08);
    --ph-brand-mark-filter: hue-rotate(176deg) saturate(.98) brightness(1.01);
}

html[data-ph-system="v5"][data-text-size="small"] { --ph-type-shift: -1px; }
html[data-ph-system="v5"][data-text-size="large"] { --ph-type-shift: 2px; }
/* Data-dense workspaces (grading, admin tables) stay roomy but tighter. */
html[data-ph-system="v5"][data-ui-density="workspace"] {
    --ph-density-control-height: 36px;
    --ph-density-card-padding: 20px;
    --ph-density-panel-gap: 16px;
    --ph-text-page: 40px;
    --ph-text-section: 26px;
    --ph-text-card-title: 19px;
}
@media (max-width: 720px) {
    html[data-ph-system="v5"] {
        --ph-density-control-height: 44px;
        --ph-density-card-padding: 22px;
        --ph-text-page: 40px;
        --ph-text-section: 26px;
        --ph-text-card-title: 19px;
        --ph-section-gap: 56px;
    }
}
@media (prefers-reduced-motion: reduce) {
    html[data-ph-system="v5"] {
        --ph-motion-press: 1ms; --ph-motion-fast: 1ms; --ph-motion-base: 1ms;
        --ph-motion-slow: 1ms; --ph-motion-sheet: 1ms; --ph-press-scale: 1; --ph-card-lift: 0px;
    }
}
html[data-ph-system="v5"][data-reduce-motion="1"] {
    --ph-motion-press: 1ms; --ph-motion-fast: 1ms; --ph-motion-base: 1ms;
    --ph-motion-slow: 1ms; --ph-motion-sheet: 1ms; --ph-press-scale: 1; --ph-card-lift: 0px;
}

/* ===================== Part 2 — components ===================== */
/* Selectors start with :root[data-ph-system="v5"] so they outrank the v1
 * ".ph-system-page .ph-*" rules (which use !important) without touching them. */

:root[data-ph-system="v5"] .ph-system-page {
    background: var(--ph-bg) !important;
    color: var(--ph-ink) !important;
    font-family: var(--ph-font-ui) !important;
    -webkit-font-smoothing: antialiased;
}
/* No global sup/sub line-height change: it would move official question lines on screen. */
:root[data-ph-system="v5"] .ph-system-page :where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--ph-focus-ring);
    outline-offset: 2px;
}

/* ---- page head ---- */
:root[data-ph-system="v5"] .ph-page-head { margin-bottom: var(--ph-space-7); }
:root[data-ph-system="v5"] .ph-eyebrow {
    margin: 0;
    color: var(--ph-chrome-accent);
    font-size: calc(15px + var(--ph-type-shift));
    font-weight: 600;
}
:root[data-ph-system="v5"] .ph-page-title {
    margin: 4px 0 0;
    font: var(--ph-weight-title) calc(var(--ph-text-page) + var(--ph-type-shift))/1.1 var(--ph-font-display);
    letter-spacing: var(--ph-tracking-title);
}
:root[data-ph-system="v5"] .ph-page-sub {
    margin: 10px 0 0;
    color: var(--ph-ink-secondary);
    font-size: calc(21px + var(--ph-type-shift));
    line-height: 1.38;
    letter-spacing: -.01em;
}
:root[data-ph-system="v5"] .ph-section-title {
    margin: 0;
    font: var(--ph-weight-title) calc(var(--ph-text-section) + var(--ph-type-shift))/1.15 var(--ph-font-display);
    letter-spacing: var(--ph-tracking-title);
}
:root[data-ph-system="v5"] .ph-card-title {
    margin: 0;
    font: 600 calc(var(--ph-text-card-title) + var(--ph-type-shift))/1.25 var(--ph-font-display);
    letter-spacing: -.012em;
}
@media (max-width: 720px) {
    :root[data-ph-system="v5"] .ph-page-sub { font-size: calc(18px + var(--ph-type-shift)); }
}

/* ---- buttons ---- */
:root[data-ph-system="v5"] .ph-button {
    min-height: var(--ph-control-h) !important;
    gap: 6px;
    padding: 0 var(--ph-btn-pad) !important;
    border: 0 !important;
    border-radius: var(--ph-radius-button) !important;
    background: var(--ph-fill) !important;
    color: var(--ph-ink) !important;
    box-shadow: none !important;
    font-size: calc(var(--ph-text-label) + var(--ph-type-shift)) !important;
    font-weight: 600 !important;
    letter-spacing: -.005em;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        transform var(--ph-motion-slow) var(--ph-ease-press),
        background-color var(--ph-motion-fast) var(--ph-ease-standard),
        color var(--ph-motion-fast) var(--ph-ease-standard);
}
:root[data-ph-system="v5"] .ph-button :where(svg) { width: 17px; height: 17px; flex: none; }
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-button:hover:not(:disabled) { transform: none; background: var(--ph-fill-strong) !important; }
}
:root[data-ph-system="v5"] .ph-button:active:not(:disabled) {
    transform: scale(var(--ph-press-scale));
    background: var(--ph-fill-strong) !important;
    transition-duration: var(--ph-motion-press);
    transition-timing-function: var(--ph-ease-standard);
}
:root[data-ph-system="v5"] .ph-button:disabled,
:root[data-ph-system="v5"] .ph-button[aria-disabled="true"] { opacity: .4; cursor: default; }

:root[data-ph-system="v5"] .ph-button-primary { background: var(--ph-btn-primary) !important; color: var(--ph-btn-primary-ink) !important; }
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-button-primary:hover:not(:disabled) { background: var(--ph-btn-primary-hover) !important; }
}
:root[data-ph-system="v5"] .ph-button-primary:active:not(:disabled) { background: var(--ph-btn-primary-pressed) !important; }

:root[data-ph-system="v5"] .ph-button-secondary { /* the default grey fill */ color: var(--ph-ink) !important; }

:root[data-ph-system="v5"] .ph-button-tinted { background: var(--ph-chrome-accent-soft) !important; color: var(--ph-chrome-accent) !important; }
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-button-tinted:hover:not(:disabled) { background: var(--ph-chrome-accent-soft-pressed) !important; }
}
:root[data-ph-system="v5"] .ph-button-tinted:active:not(:disabled) { background: var(--ph-chrome-accent-soft-pressed) !important; }

:root[data-ph-system="v5"] .ph-button-quiet { background: transparent !important; color: var(--ph-chrome-accent) !important; }
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-button-quiet:hover:not(:disabled) { background: var(--ph-fill) !important; color: var(--ph-chrome-accent-hover) !important; }
}
:root[data-ph-system="v5"] .ph-button-quiet:active:not(:disabled) { background: var(--ph-fill-strong) !important; }

:root[data-ph-system="v5"] .ph-button-danger { background: var(--ph-danger-soft) !important; color: var(--ph-danger) !important; }
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-button-danger:hover:not(:disabled) { background: rgba(215, 0, 21, .14) !important; }
}
:root[data-ph-system="v5"] .ph-button-danger:active:not(:disabled) { background: rgba(215, 0, 21, .18) !important; }
:root[data-ph-system="v5"] .ph-button-danger-solid { background: var(--ph-danger) !important; color: #fff !important; }

:root[data-ph-system="v5"] .ph-button-compact {
    min-height: var(--ph-control-h-sm) !important;
    padding-inline: 14px !important;
    font-size: calc(13px + var(--ph-type-shift)) !important;
}
:root[data-ph-system="v5"] .ph-button-large {
    min-height: var(--ph-control-h-lg) !important;
    padding-inline: 28px !important;
    font-size: calc(var(--ph-text-ui) + var(--ph-type-shift)) !important;
}
:root[data-ph-system="v5"] .ph-button-block { width: 100%; }
:root[data-ph-system="v5"] .ph-button-icon {
    width: var(--ph-control-h);
    min-width: var(--ph-control-h);
    padding: 0 !important;
    border-radius: 50% !important;
}
:root[data-ph-system="v5"] .ph-button-icon:not(.ph-button-primary, .ph-button-tinted) { background: transparent !important; color: var(--ph-ink-secondary) !important; }
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-button-icon:not(.ph-button-primary, .ph-button-tinted):hover:not(:disabled) { background: var(--ph-fill) !important; color: var(--ph-ink) !important; }
}
:root[data-ph-system="v5"] .ph-button-icon:active:not(:disabled) { transform: scale(.9); }

/* Busy → done (e.g. 导出 PDF). Put .ph-spinner inside; ui-v5.js setBusy() toggles. */
:root[data-ph-system="v5"] .ph-spinner {
    width: 15px;
    height: 15px;
    flex: none;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
    border-top-color: currentColor;
    animation: ph5-spin .8s linear infinite;
}
:root[data-ph-system="v5"] .ph-button[aria-busy="true"] { cursor: progress; }
:root[data-ph-system="v5"] .ph-button.is-done { background: var(--ph-positive) !important; color: #fff !important; }
@keyframes ph5-spin { to { rotate: 360deg; } }

/* ---- cards and panels ---- */
:root[data-ph-system="v5"] .ph-card,
:root[data-ph-system="v5"] .ph-panel {
    border: 0 !important;
    background: var(--ph-surface) !important;
    box-shadow: var(--ph-shadow-card) !important;
}
:root[data-ph-system="v5"] .ph-card { border-radius: var(--ph-radius-card) !important; }
:root[data-ph-system="v5"] .ph-panel { border-radius: var(--ph-radius-panel) !important; }
:root[data-ph-system="v5"] .ph-card-interactive {
    cursor: pointer;
    transition: transform var(--ph-motion-slow) var(--ph-ease-spring), box-shadow var(--ph-motion-base) var(--ph-ease-standard);
}
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-card-interactive:hover {
        transform: translateY(var(--ph-card-lift));
        border-color: transparent !important;
        box-shadow: var(--ph-shadow-card-hover) !important;
    }
}
:root[data-ph-system="v5"] .ph-card-interactive:active {
    transform: scale(.985);
    transition-duration: var(--ph-motion-press);
    transition-timing-function: var(--ph-ease-standard);
}

/* ---- fields ---- */
:root[data-ph-system="v5"] .ph-field { gap: 8px; }
:root[data-ph-system="v5"] .ph-label {
    color: var(--ph-ink-secondary) !important;
    font-size: calc(13px + var(--ph-type-shift)) !important;
    font-weight: 600 !important;
}
:root[data-ph-system="v5"] .ph-input,
:root[data-ph-system="v5"] .ph-select {
    height: var(--ph-control-h) !important;
    min-height: var(--ph-control-h) !important;
    padding: 0 18px !important;
    border: 1px solid transparent !important;
    border-radius: var(--ph-radius-field) !important;
    background-color: var(--ph-fill) !important;
    color: var(--ph-ink) !important;
    font-size: calc(var(--ph-text-ui) + var(--ph-type-shift)) !important;
    transition: background-color var(--ph-motion-fast) var(--ph-ease-standard), box-shadow var(--ph-motion-fast) var(--ph-ease-standard), border-color var(--ph-motion-fast);
}
:root[data-ph-system="v5"] .ph-input::placeholder { color: var(--ph-ink-tertiary); }
:root[data-ph-system="v5"] :is(.ph-input, .ph-select):focus {
    background-color: var(--ph-surface) !important;
    border-color: var(--ph-chrome-accent) !important;
    box-shadow: 0 0 0 4px var(--ph-focus-halo) !important;
    outline: none;
}
:root[data-ph-system="v5"] textarea.ph-input {
    height: auto !important;
    min-height: 96px !important;
    padding: 12px 18px !important;
    border-radius: 18px !important;
    line-height: 1.5;
    resize: vertical;
}
:root[data-ph-system="v5"] .ph-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5l5.5 5.5 5.5-5.5'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    background-size: 16px !important;
}
/* Search field: <label class="ph-search"><svg/><input class="ph-input"></label> */
:root[data-ph-system="v5"] .ph-search { position: relative; display: block; min-width: 0; }
:root[data-ph-system="v5"] .ph-search > svg {
    position: absolute; left: 16px; top: 50%; width: 17px; height: 17px; translate: 0 -50%;
    color: var(--ph-ink-tertiary); pointer-events: none;
}
:root[data-ph-system="v5"] .ph-search > .ph-input { padding-left: 42px !important; }

/* ---- segmented control (add data-ph-slide for the sliding highlight) ---- */
:root[data-ph-system="v5"] .ph-segmented {
    box-sizing: border-box;
    position: relative;
    isolation: isolate;
    min-height: var(--ph-control-h);
    gap: 0;
    padding: 3px;
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--ph-fill) !important;
}
:root[data-ph-system="v5"] .ph-segment {
    position: relative;
    z-index: 1;
    min-height: calc(var(--ph-control-h) - 6px) !important;
    padding: 0 16px !important;
    border-radius: 999px !important;
    color: var(--ph-ink-secondary) !important;
    font-size: calc(var(--ph-text-label) + var(--ph-type-shift)) !important;
    font-weight: 500 !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--ph-motion-fast) var(--ph-ease-standard), transform var(--ph-motion-slow) var(--ph-ease-press);
}
:root[data-ph-system="v5"] .ph-segment:active { transform: scale(.95); transition-duration: var(--ph-motion-press); transition-timing-function: var(--ph-ease-standard); }
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-segment:hover { color: var(--ph-ink) !important; }
}
:root[data-ph-system="v5"] .ph-segment:is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"], [aria-current="page"], [aria-current="true"]) {
    color: var(--ph-ink) !important;
    font-weight: 600 !important;
    background: var(--ph-surface) !important;
    box-shadow: var(--ph-shadow-raised);
}
:root[data-ph-system="v5"] .ph-segmented.ph-has-thumb .ph-segment { background: transparent !important; box-shadow: none; }
:root[data-ph-system="v5"] .ph-segment-thumb {
    position: absolute;
    z-index: 0;
    top: 3px;
    bottom: 3px;
    left: 0;
    width: 0;
    border-radius: 999px;
    background: var(--ph-surface);
    box-shadow: var(--ph-shadow-raised);
    pointer-events: none;
    transition: transform var(--ph-motion-slow) var(--ph-ease-spring), width var(--ph-motion-slow) var(--ph-ease-spring), opacity var(--ph-motion-fast);
}
:root[data-ph-system="v5"] .ph-segmented.ph-thumb-instant .ph-segment-thumb { transition: none; }
:root[data-ph-system="v5"] .ph-segmented-block { display: flex; width: 100%; }
:root[data-ph-system="v5"] .ph-segmented-block .ph-segment { flex: 1 1 0; min-width: 0; }
:root[data-ph-system="v5"] .ph-segment :where(em) { margin-left: 3px; color: var(--ph-ink-tertiary); font-style: normal; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---- tabs ---- */
:root[data-ph-system="v5"] .ph-tabs { gap: 8px; border-bottom: .5px solid var(--ph-line-strong) !important; }
:root[data-ph-system="v5"] .ph-tab {
    min-height: 44px;
    padding: 0 6px;
    border-radius: 0 !important;
    color: var(--ph-ink-secondary) !important;
    font-size: calc(var(--ph-text-ui) + var(--ph-type-shift)) !important;
    font-weight: 500 !important;
}
:root[data-ph-system="v5"] .ph-tab + .ph-tab { margin-left: 12px; }
:root[data-ph-system="v5"] .ph-tab:hover:not(:disabled) { background: transparent !important; color: var(--ph-ink) !important; }
:root[data-ph-system="v5"] .ph-tab[aria-selected="true"] { color: var(--ph-ink) !important; font-weight: 600 !important; }
:root[data-ph-system="v5"] .ph-tab::after {
    position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; border-radius: 2px;
    background: var(--ph-ink); content: ""; transform: scaleX(0);
    transition: transform var(--ph-motion-slow) var(--ph-ease-spring);
}
:root[data-ph-system="v5"] .ph-tab[aria-selected="true"]::after { right: 0; left: 0; background: var(--ph-ink); transform: scaleX(1); }

/* ---- chips (filters) ---- */
:root[data-ph-system="v5"] .ph-chip {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--ph-fill);
    color: var(--ph-ink-secondary);
    font: 500 calc(var(--ph-text-label) + var(--ph-type-shift))/1 var(--ph-font-ui);
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--ph-motion-fast) var(--ph-ease-standard), color var(--ph-motion-fast), transform var(--ph-motion-slow) var(--ph-ease-press);
}
@media (hover: hover) {
    :root[data-ph-system="v5"] .ph-chip:hover:not([aria-pressed="true"]) { background: var(--ph-fill-strong); color: var(--ph-ink); }
}
:root[data-ph-system="v5"] .ph-chip:active { transform: scale(.94); transition-duration: var(--ph-motion-press); transition-timing-function: var(--ph-ease-standard); }
:root[data-ph-system="v5"] .ph-chip[aria-pressed="true"] { background: var(--ph-btn-primary); color: var(--ph-btn-primary-ink); }
:root[data-ph-system="v5"] .ph-chip-group { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- badges and status (shape here; colours by meaning) ---- */
:root[data-ph-system="v5"] .ph-badge,
:root[data-ph-system="v5"] .ph-status {
    min-height: 26px;
    padding: 0 12px !important;
    border-radius: 999px !important;
    font-size: calc(13px + var(--ph-type-shift)) !important;
    font-weight: 600 !important;
}
:root[data-ph-system="v5"] .ph-badge::before { width: 6px; height: 6px; }
:root[data-ph-system="v5"] .ph-badge:not([class*="role-"], [class*="status-"], [class*="ph-badge-"]),
:root[data-ph-system="v5"] .ph-status-neutral { border-color: transparent !important; background: var(--ph-fill) !important; color: var(--ph-ink-secondary) !important; }
:root[data-ph-system="v5"] :is(.ph-badge-info, .ph-status-info) { border-color: transparent !important; background: var(--ph-info-soft) !important; color: var(--ph-info) !important; }
:root[data-ph-system="v5"] :is(.ph-badge-positive, .ph-status-positive) { border-color: transparent !important; background: var(--ph-positive-soft) !important; color: var(--ph-positive) !important; }
:root[data-ph-system="v5"] :is(.ph-badge-warning, .ph-status-warning) { border-color: transparent !important; background: var(--ph-warning-soft) !important; color: var(--ph-warning) !important; }
:root[data-ph-system="v5"] :is(.ph-badge-danger, .ph-status-danger) { border-color: transparent !important; background: var(--ph-danger-soft) !important; color: var(--ph-danger) !important; }
:root[data-ph-system="v5"] .ph-badge-accent { border-color: transparent !important; background: var(--ph-chrome-accent-soft) !important; color: var(--ph-chrome-accent) !important; }

/* ---- grouped list ---- */
/* <ul class="ph-list"><li><a class="ph-row">
 *   <span class="ph-row-icon"/><span class="ph-row-main"><span class="ph-row-title"/><span class="ph-row-sub"/></span>
 *   <span class="ph-row-end"/><svg class="ph-row-chevron"/></a></li></ul> */
:root[data-ph-system="v5"] .ph-list {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
    border-radius: var(--ph-radius-card);
    background: var(--ph-surface);
    box-shadow: var(--ph-shadow-card);
}
:root[data-ph-system="v5"] .ph-list-inset { background: var(--ph-surface-subtle); box-shadow: none; }
:root[data-ph-system="v5"] .ph-list > li { position: relative; }
:root[data-ph-system="v5"] .ph-list > li + li::before {
    position: absolute; top: 0; right: 0; left: var(--ph-row-inset, var(--ph-density-card-padding));
    border-top: .5px solid var(--ph-line); content: ""; z-index: 1;
}
:root[data-ph-system="v5"] .ph-list:has(.ph-row-icon) { --ph-row-inset: calc(var(--ph-density-card-padding) + 56px); }
:root[data-ph-system="v5"] .ph-row {
    width: 100%;
    min-height: 72px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px var(--ph-density-card-padding);
    border: 0;
    background: transparent;
    color: var(--ph-ink);
    font: inherit;
    text-align: left;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--ph-motion-fast) var(--ph-ease-standard);
}
:root[data-ph-system="v5"] :is(a, button, [tabindex]).ph-row { cursor: pointer; }
@media (hover: hover) {
    :root[data-ph-system="v5"] :is(a, button, [tabindex]).ph-row:hover { background: var(--ph-surface-subtle); }
}
:root[data-ph-system="v5"] :is(a, button, [tabindex]).ph-row:active { background: var(--ph-fill); transition-duration: 0ms; }
:root[data-ph-system="v5"] .ph-row:focus-visible { outline-offset: -3px !important; }
:root[data-ph-system="v5"] .ph-row-compact { min-height: 52px; padding-block: 8px; }
:root[data-ph-system="v5"] .ph-row-icon {
    width: 40px; height: 40px; flex: none; display: grid; place-items: center;
    border-radius: 12px; background: var(--ph-chrome-accent); color: var(--ph-chrome-accent-ink, #fff);
}
:root[data-ph-system="v5"] .ph-row-icon > svg { width: 21px; height: 21px; }
:root[data-ph-system="v5"] .ph-row-main { min-width: 0; flex: 1; display: grid; gap: 2px; }
:root[data-ph-system="v5"] .ph-row-title { font-size: calc(var(--ph-text-body) + var(--ph-type-shift)); font-weight: 600; }
:root[data-ph-system="v5"] .ph-row-sub { color: var(--ph-ink-tertiary); font-size: calc(var(--ph-text-label) + var(--ph-type-shift)); }
:root[data-ph-system="v5"] .ph-row-end { color: var(--ph-ink-secondary); font-size: calc(var(--ph-text-label) + var(--ph-type-shift)); font-variant-numeric: tabular-nums; white-space: nowrap; }
:root[data-ph-system="v5"] .ph-row-chevron { width: 15px; height: 15px; flex: none; color: var(--ph-ink-tertiary); }

/* ---- switch: <button class="ph-switch" role="switch" aria-checked="true"><i></i></button> ---- */
:root[data-ph-system="v5"] .ph-switch {
    position: relative; width: 51px; height: 31px; flex: none; padding: 0; border: 0; border-radius: 999px;
    background: var(--ph-fill-strong); cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: background-color var(--ph-motion-base) var(--ph-ease-standard);
}
:root[data-ph-system="v5"] .ph-switch > i {
    position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 999px; background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .08);
    transition: transform var(--ph-motion-slow) var(--ph-ease-spring), width var(--ph-motion-fast) var(--ph-ease-standard);
}
:root[data-ph-system="v5"] .ph-switch[aria-checked="true"] { background: var(--ph-switch-on); }
:root[data-ph-system="v5"] .ph-switch[aria-checked="true"] > i { transform: translateX(20px); }
:root[data-ph-system="v5"] .ph-switch:active > i { width: 33px; }
:root[data-ph-system="v5"] .ph-switch[aria-checked="true"]:active > i { transform: translateX(14px); }
:root[data-ph-system="v5"] .ph-switch:disabled { opacity: .4; cursor: default; }

/* ---- stepper: <div class="ph-stepper"><button>−</button><output>6</output><button>+</button></div> ---- */
:root[data-ph-system="v5"] .ph-stepper { display: inline-flex; align-items: center; height: 36px; border-radius: 999px; background: var(--ph-fill); }
:root[data-ph-system="v5"] .ph-stepper > button {
    width: 44px; height: 100%; border: 0; border-radius: 999px; background: transparent; color: var(--ph-ink);
    font-size: 18px; cursor: pointer; transition: background-color var(--ph-motion-fast);
}
:root[data-ph-system="v5"] .ph-stepper > button:active { background: var(--ph-fill-strong); }
:root[data-ph-system="v5"] .ph-stepper > output { min-width: 36px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- empty / state ---- */
:root[data-ph-system="v5"] .ph-empty-state {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 56px 24px !important;
    border: 0 !important;
    border-radius: var(--ph-radius-card) !important;
    background: transparent !important;
    color: var(--ph-ink-secondary) !important;
    font-size: calc(var(--ph-text-ui) + var(--ph-type-shift)) !important;
}
:root[data-ph-system="v5"] .ph-empty-state strong { font: 600 calc(var(--ph-text-card-title) + var(--ph-type-shift))/1.25 var(--ph-font-display); letter-spacing: -.012em; }
:root[data-ph-system="v5"] .ph-empty-icon {
    width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 4px;
    border-radius: 20px; background: var(--ph-fill); color: var(--ph-ink-tertiary);
}
:root[data-ph-system="v5"] .ph-empty-icon > svg { width: 30px; height: 30px; }
:root[data-ph-system="v5"] .ph-state {
    padding: 14px 18px !important;
    border: 0 !important;
    border-radius: var(--ph-radius-card) !important;
    box-shadow: var(--ph-shadow-card) !important;
}
:root[data-ph-system="v5"] .ph-state-info { background: var(--ph-info-soft) !important; box-shadow: none !important; }
:root[data-ph-system="v5"] .ph-state-warning { background: var(--ph-warning-soft) !important; box-shadow: none !important; }
:root[data-ph-system="v5"] .ph-state-danger { background: var(--ph-danger-soft) !important; box-shadow: none !important; }
:root[data-ph-system="v5"] .ph-state-positive { background: var(--ph-positive-soft) !important; box-shadow: none !important; }

/* ---- tables (data pages) ---- */
:root[data-ph-system="v5"] .ph-table-shell { border: 0 !important; border-radius: var(--ph-radius-card) !important; box-shadow: var(--ph-shadow-card) !important; background: var(--ph-surface) !important; }
:root[data-ph-system="v5"] .ph-table :where(th, td) { padding: 12px 16px; border-bottom: .5px solid var(--ph-line); }
:root[data-ph-system="v5"] .ph-table th { background: var(--ph-surface-subtle); color: var(--ph-ink-secondary); font-weight: 600; font-size: calc(13px + var(--ph-type-shift)); }

/* ---- existing dialogs and drawers: surface only, geometry stays with each page ---- */
:root[data-ph-system="v5"] :is(.ph-dialog, .ph-confirm-dialog) {
    border: 0 !important;
    border-radius: var(--ph-radius-sheet) !important;
    background: var(--ph-surface) !important;
    box-shadow: var(--ph-shadow-overlay) !important;
}
:root[data-ph-system="v5"] :is(.ph-dialog, .ph-confirm-dialog)[open] { animation: ph5-pop var(--ph-motion-sheet) var(--ph-ease-spring); }
:root[data-ph-system="v5"] :is(.ph-dialog, .ph-confirm-dialog, .ph-modal)::backdrop {
    background: var(--ph-scrim);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
:root[data-ph-system="v5"] .ph-confirm-dialog { width: min(400px, calc(100vw - 40px)); }
:root[data-ph-system="v5"] .ph-dialog-copy { gap: 10px; padding: 32px 32px 20px; }
:root[data-ph-system="v5"] .ph-dialog-copy h2 { font: 600 calc(24px + var(--ph-type-shift))/1.25 var(--ph-font-display); letter-spacing: -.02em; }
:root[data-ph-system="v5"] .ph-dialog-copy p { font-size: calc(var(--ph-text-ui) + var(--ph-type-shift)); }
:root[data-ph-system="v5"] .ph-dialog-actions { gap: 10px; padding: 0 32px 32px; border-top: 0 !important; }
:root[data-ph-system="v5"] .ph-confirm-dialog .ph-dialog-actions > .ph-button { flex: 1; min-height: var(--ph-control-h-lg) !important; }
:root[data-ph-system="v5"] .ph-sheet {
    border: 0 !important;
    background: var(--ph-surface) !important;
    box-shadow: var(--ph-shadow-overlay) !important;
}
:root[data-ph-system="v5"] .ph-sheet-backdrop { background: var(--ph-scrim) !important; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes ph5-pop { from { opacity: 0; transform: scale(.94); } }

/* ---- modal: centred on desktop, bottom sheet on phones (ui-v5.js openModal) ----
 * <dialog class="ph-modal" aria-labelledby="…"><div class="ph-modal-grabber"></div>
 *   <header class="ph-modal-head"><h2 class="ph-modal-title"/><p/></header>
 *   <div class="ph-modal-body"/> <footer class="ph-modal-actions"/></dialog> */
:root[data-ph-system="v5"] .ph-modal {
    width: min(500px, calc(100vw - 40px));
    max-width: none;
    max-height: calc(100dvh - 48px);
    box-sizing: border-box;
    margin: auto;
    padding: 36px;
    overflow: auto;
    border: 0;
    border-radius: var(--ph-radius-sheet);
    background: var(--ph-surface);
    color: var(--ph-ink);
    box-shadow: var(--ph-shadow-overlay);
    font-family: var(--ph-font-ui);
    overscroll-behavior: contain;
}
:root[data-ph-system="v5"] .ph-modal[open] { display: grid; gap: 24px; }
:root[data-ph-system="v5"] .ph-modal:focus-visible { outline: none; }
:root[data-ph-system="v5"] .ph-modal-head { display: grid; gap: 4px; }
:root[data-ph-system="v5"] .ph-modal-title { margin: 0; font: 600 calc(28px + var(--ph-type-shift))/1.2 var(--ph-font-display); letter-spacing: -.02em; }
:root[data-ph-system="v5"] .ph-modal-head p { margin: 0; color: var(--ph-ink-secondary); }
:root[data-ph-system="v5"] .ph-modal-body { display: grid; gap: 12px; min-width: 0; }
:root[data-ph-system="v5"] .ph-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; }
:root[data-ph-system="v5"] .ph-modal-grabber { display: none; }
:root[data-ph-system="v5"] .ph-modal-alert { width: min(380px, calc(100vw - 40px)); padding: 0; text-align: center; }
:root[data-ph-system="v5"] .ph-modal-alert[open] { gap: 0; }
:root[data-ph-system="v5"] .ph-modal-alert .ph-modal-head { padding: 36px 32px 24px; gap: 10px; }
:root[data-ph-system="v5"] .ph-modal-alert .ph-modal-title { font-size: calc(22px + var(--ph-type-shift)); }
:root[data-ph-system="v5"] .ph-modal-alert .ph-modal-actions { display: grid; grid-template-columns: 1fr 1fr; padding: 0 32px 32px; }
@media (max-width: 720px) {
    :root[data-ph-system="v5"] .ph-modal:not(.ph-modal-alert) {
        width: 100%;
        max-height: 90dvh;
        margin: auto 0 0;
        padding: 8px 24px calc(28px + env(safe-area-inset-bottom, 0px));
        border-radius: var(--ph-radius-sheet) var(--ph-radius-sheet) 0 0;
        touch-action: pan-y;
    }
    :root[data-ph-system="v5"] .ph-modal:not(.ph-modal-alert)[open] { gap: 20px; }
    :root[data-ph-system="v5"] .ph-modal:not(.ph-modal-alert) .ph-modal-grabber {
        display: block; width: 36px; height: 5px; margin: 0 auto -8px; border-radius: 3px; background: var(--ph-fill-strong);
    }
    :root[data-ph-system="v5"] .ph-modal:not(.ph-modal-alert) .ph-modal-title { font-size: calc(24px + var(--ph-type-shift)); }
    :root[data-ph-system="v5"] .ph-modal-actions > .ph-button { flex: 1; min-height: var(--ph-control-h-lg) !important; }
}

/* ---- menu (popover list) ---- */
:root[data-ph-system="v5"] .ph-menu {
    min-width: 240px;
    margin: 0;
    padding: 8px;
    border: 0;
    border-radius: 22px;
    background: rgba(255, 255, 255, .88);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
    box-shadow: var(--ph-shadow-overlay);
    color: var(--ph-ink);
    list-style: none;
    transform-origin: top left;
}
:root[data-ph-system="v5"] .ph-menu-item {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    font: 500 calc(var(--ph-text-ui) + var(--ph-type-shift))/1.3 var(--ph-font-ui);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--ph-motion-fast) var(--ph-ease-standard);
}
@media (hover: hover) { :root[data-ph-system="v5"] .ph-menu-item:hover { background: var(--ph-fill); } }
:root[data-ph-system="v5"] .ph-menu-item:active { background: var(--ph-fill-strong); }
:root[data-ph-system="v5"] .ph-menu-item-danger { color: var(--ph-danger); }
:root[data-ph-system="v5"] .ph-menu-separator { height: .5px; margin: 6px 14px; background: var(--ph-line-strong); }

/* ---- toasts: bottom centre, a pill on the raised surface (white in light, graphite in dark) ---- */
:root[data-ph-system="v5"][data-appearance="dark"] { --ph-toast-surface: rgba(42, 41, 37, .94); }
:root[data-ph-system="v5"] .ph-toast-stack {
    position: fixed;
    display: grid;
    gap: 8px;
    pointer-events: none;
    top: auto;
    right: auto;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    z-index: 1000;
    width: max-content;
    max-width: calc(100vw - 32px);
    justify-items: center;
    translate: -50% 0;
}
:root[data-ph-system="v5"] .ph-toast {
    min-height: 48px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    opacity: 0;
    gap: 12px;
    padding: 8px 8px 8px 20px;
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--ph-toast-surface, rgba(255, 255, 255, .94)) !important;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 18px 48px rgba(0, 0, 0, .14) !important;
    color: var(--ph-ink);
    font-size: calc(var(--ph-text-label) + var(--ph-type-shift));
    font-weight: 500;
    pointer-events: auto;
    transform: translateY(16px) scale(.94);
    transition: opacity var(--ph-motion-fast) var(--ph-ease-standard), transform var(--ph-motion-slow) var(--ph-ease-spring);
}
:root[data-ph-system="v5"] .ph-toast:not(:has(.ph-toast-action)) { padding-right: 20px; }
:root[data-ph-system="v5"] .ph-toast.is-visible { opacity: 1; transform: none; }
:root[data-ph-system="v5"] .ph-toast.is-leaving { opacity: 0; transform: translateY(8px) scale(.97); transition-duration: var(--ph-motion-fast); transition-timing-function: var(--ph-ease-exit); }
:root[data-ph-system="v5"] .ph-toast::before { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--ph-positive); content: ""; }
:root[data-ph-system="v5"] .ph-toast-positive { color: var(--ph-ink); }
:root[data-ph-system="v5"] .ph-toast-info { color: var(--ph-ink); }
:root[data-ph-system="v5"] .ph-toast-info::before { background: var(--ph-info); }
:root[data-ph-system="v5"] .ph-toast-danger { color: var(--ph-ink); }
:root[data-ph-system="v5"] .ph-toast-danger::before { background: var(--ph-danger); }
:root[data-ph-system="v5"] .ph-toast-action {
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--ph-fill);
    color: var(--ph-chrome-accent);
    font: 600 13px/1 var(--ph-font-ui);
    cursor: pointer;
}
:root[data-ph-system="v5"] .ph-toast-action:active { background: var(--ph-fill-strong); }

@media (prefers-reduced-motion: reduce) {
    :root[data-ph-system="v5"] :is(.ph-dialog, .ph-confirm-dialog, .ph-modal)[open] { animation: none; }
}
:root[data-ph-system="v5"][data-reduce-motion="1"] :is(.ph-dialog, .ph-confirm-dialog, .ph-modal)[open] { animation: none; }

/* Outside v5 the sliding highlight element must never take space. */
html:not([data-ph-system="v5"]) .ph-segment-thumb { display: none; }
