/* =========================================================
   料卷 · Filament Inventory
   A small, tactile inventory UI built for one-hand use.
   ========================================================= */

:root {
    --bg: #f3f1ea;
    --bg-elevated: #f8f6f0;
    --surface: #fffdf8;
    --surface-2: #efebe2;
    --surface-3: #e7e2d7;
    --ink: #1c1b19;
    --ink-2: #3d3a34;
    --muted: #746f65;
    --muted-2: #6f6a60;
    --line: #ded9ce;
    --line-strong: #c9c2b4;
    --accent: #176b52;
    --accent-strong: #0e5640;
    --accent-soft: #e1f0e8;
    --accent-contrast: #ffffff;
    --warning: #a85811;
    --warning-soft: #fbefdc;
    --danger: #b42318;
    --danger-soft: #fbe9e6;
    --blue: #3e6fb0;
    --track: #e4dfd5;
    --metallic-gold: linear-gradient(135deg, #a67c00 0%, #ffe45c 18%, #fff4b8 34%, #ffd700 50%, #f7df7a 68%, #c99700 100%);
    --marble-texture: url("marble.png");
    --shadow-sm: 0 1px 2px rgba(28, 27, 25, .05);
    --shadow-md: 0 14px 38px rgba(28, 27, 25, .08);
    --shadow-lg: 0 28px 80px rgba(23, 22, 20, .22);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --header-h: 72px;
    --max: 1240px;
    --font: "Inter", "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #131412;
    --bg-elevated: #191a17;
    --surface: #1d1e1a;
    --surface-2: #25261f;
    --surface-3: #303129;
    --ink: #f3f0e6;
    --ink-2: #d9d4c7;
    --muted: #a39d90;
    --muted-2: #8c877c;
    --line: #34352d;
    --line-strong: #48493e;
    --accent: #72c7a4;
    --accent-strong: #94d8ba;
    --accent-soft: #1c3a2d;
    --accent-contrast: #0d241a;
    --warning: #f0a552;
    --warning-soft: #3a2b17;
    --danger: #ff8e82;
    --danger-soft: #3d211f;
    --blue: #8bb7f0;
    --track: #34352d;
    --metallic-gold: linear-gradient(135deg, #8a6a00 0%, #ffe45c 18%, #fff6c9 34%, #ffd700 50%, #f7df7a 68%, #b8860b 100%);
    --marble-texture: url("marble.png");
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28);
    --shadow-md: 0 16px 44px rgba(0, 0, 0, .34);
    --shadow-lg: 0 28px 90px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

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

[hidden] {
    display: none !important;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 460px at 95% -10%, rgba(23, 107, 82, .10), transparent 60%),
        radial-gradient(720px 420px at -10% 20%, rgba(176, 138, 82, .07), transparent 55%),
        var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.sheet-open {
    overflow: hidden;
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(900px 460px at 95% -10%, rgba(114, 199, 164, .09), transparent 60%),
        radial-gradient(720px 420px at -10% 20%, rgba(176, 138, 82, .05), transparent 55%),
        var(--bg);
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg {
    display: block;
}

strong,
b {
    font-weight: 600;
}

::selection {
    background: var(--accent);
    color: var(--accent-contrast);
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 2px;
}

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

.hidden {
    display: none !important;
}

.skip-link {
    position: fixed;
    top: -60px;
    left: 16px;
    z-index: 200;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--surface);
    transition: top .15s ease;
}

.skip-link:focus {
    top: 12px;
}

/* ---------------------------------------------------------
   Header / navigation
   --------------------------------------------------------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.header-inner {
    width: min(var(--max), calc(100% - 40px));
    height: var(--header-h);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 22px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--ink);
    color: var(--bg);
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease;
}

.brand:hover .brand-mark {
    transform: rotate(-5deg) scale(1.03);
}

.brand-icon {
    width: 24px;
    height: 24px;
}

.brand-text {
    display: grid;
    line-height: 1;
    gap: 5px;
}

.brand-text strong {
    font-size: 18px;
    letter-spacing: -.03em;
}

.brand-text small {
    font-size: 8px;
    letter-spacing: .17em;
    color: var(--muted);
    font-weight: 700;
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}

.nav-link:hover {
    color: var(--ink);
}

.nav-link.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.nav-icon {
    opacity: .8;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 9px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink-2);
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

.icon-btn:hover {
    background: var(--surface-2);
    color: var(--ink);
    border-color: var(--line-strong);
}

.icon-btn:active {
    transform: scale(.96);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.theme-toggle {
    position: relative;
    overflow: hidden;
}

.theme-sun,
.theme-moon {
    display: grid;
    place-items: center;
    transition: transform .25s ease, opacity .2s ease;
}

:root[data-theme="light"] .theme-moon {
    display: none;
}

:root[data-theme="dark"] .theme-sun {
    display: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.btn:active {
    transform: translateY(1px) scale(.99);
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
    border-color: var(--accent);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .06), inset 0 1px 0 rgba(255, 255, 255, .12);
}

.btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
}

.btn-secondary:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
}

.btn-soft {
    background: var(--surface-2);
    color: var(--ink-2);
    border-color: transparent;
}

.btn-soft:hover {
    background: var(--surface-3);
    color: var(--ink);
}

.btn-hero {
    background: #f4f1e8;
    color: #1c1b19;
    border-color: #f4f1e8;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}

.btn-hero:hover {
    background: #fffdf8;
    border-color: #fffdf8;
}

.btn-lg {
    min-height: 48px;
    padding: 0 20px;
    border-radius: 14px;
    font-size: 14px;
}

.btn-sm {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.header-add {
    min-height: 40px;
    padding: 0 14px;
}

.header-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 3px 11px 3px 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-2);
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.header-user:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
}

.header-user:active {
    transform: scale(.97);
}

.header-user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11.5px;
    font-weight: 550;
}

.header-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.app-main {
    width: min(var(--max), calc(100% - 48px));
    margin: 0 auto;
    padding: 30px 0 88px;
}

.bottom-nav {
    display: none;
}

/* ---------------------------------------------------------
   Type / shared surfaces
   --------------------------------------------------------- */

.eyebrow {
    display: inline-block;
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: .17em;
    text-transform: uppercase;
}

.eyebrow-light {
    color: rgba(244, 241, 232, .58);
}

.muted {
    color: var(--muted);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-sm);
}

.panel-heading {
    margin-bottom: 18px;
}

.panel-heading h2 {
    margin: 6px 0 0;
    font-size: 22px;
    line-height: 1.1;
    letter-spacing: -.035em;
}

.panel-heading p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.panel-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

/* ---------------------------------------------------------
   Hero / summary
   --------------------------------------------------------- */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 302px;
    padding: 40px 44px;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(600px 300px at 92% 15%, rgba(87, 184, 148, .24), transparent 66%),
        linear-gradient(125deg, #1c1b19 0%, #23221e 60%, #172a22 100%);
    color: #f4f1e8;
    box-shadow: 0 24px 60px rgba(20, 19, 17, .18);
    isolation: isolate;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .22;
    background-image: radial-gradient(rgba(255, 255, 255, .32) .7px, transparent .7px);
    background-size: 16px 16px;
    mask-image: linear-gradient(90deg, black, transparent 65%);
}

.hero::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -150px;
    bottom: -260px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
}

.hero-copy {
    position: relative;
    z-index: 2;
    max-width: 620px;
}

.hero-value {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 9px 0 8px;
    font-size: clamp(54px, 8vw, 86px);
    line-height: .92;
    letter-spacing: -.065em;
    font-weight: 560;
    font-variant-numeric: tabular-nums;
}

.hero-value small {
    font-size: 21px;
    font-weight: 500;
    letter-spacing: -.02em;
    color: rgba(244, 241, 232, .52);
}

.hero-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: rgba(244, 241, 232, .58);
    font-size: 12.5px;
}

.hero-meta strong {
    color: rgba(244, 241, 232, .95);
    font-weight: 600;
}

.hero-low strong {
    color: #f8c77a;
}

.meta-sep {
    color: rgba(244, 241, 232, .25);
}

.hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 26px;
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 4px 2px;
    color: rgba(244, 241, 232, .75);
    font-size: 12.5px;
    font-weight: 500;
    transition: color .15s ease;
}

.hero-link:hover {
    color: #fff;
}

.hero-visual {
    position: relative;
    flex: 0 0 300px;
    height: 240px;
    display: grid;
    place-items: center;
    margin-left: 30px;
}

.hero-orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 50%;
}

.orbit-a {
    width: 270px;
    height: 270px;
}

.orbit-b {
    width: 330px;
    height: 330px;
    border-color: rgba(255, 255, 255, .05);
}

.hero-ring {
    position: relative;
    width: 214px;
    height: 214px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#5cc29a var(--p, 60%), rgba(255, 255, 255, .12) 0);
    box-shadow: 0 0 70px rgba(87, 184, 148, .18);
}

.hero-ring::after {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, .12);
}

.hero-ring-inner {
    width: 172px;
    height: 172px;
    display: grid;
    grid-template-columns: auto auto;
    align-content: center;
    justify-content: center;
    align-items: baseline;
    column-gap: 3px;
    border-radius: 50%;
    background: #1b1c19;
    border: 1px solid rgba(255, 255, 255, .08);
}

.hero-ring-inner strong {
    font-size: 43px;
    line-height: 1;
    font-weight: 500;
    letter-spacing: -.06em;
    font-variant-numeric: tabular-nums;
}

.hero-ring-inner span {
    font-size: 15px;
    color: rgba(244, 241, 232, .55);
}

.hero-ring-inner small {
    grid-column: 1 / -1;
    margin-top: 7px;
    text-align: center;
    font-size: 9px;
    letter-spacing: .14em;
    color: rgba(244, 241, 232, .45);
    text-transform: uppercase;
}

.subtle-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 12px;
    padding-left: 3px;
    color: var(--muted);
    font-size: 11.5px;
}

.subtle-stats strong {
    color: var(--ink-2);
    font-weight: 600;
}

/* ---------------------------------------------------------
   Wall / toolbar / cards
   --------------------------------------------------------- */

.wall-section {
    margin-top: 38px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 17px;
}

.section-heading h2 {
    margin: 5px 0 0;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -.045em;
}

.section-count {
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.section-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.section-empty-link {
    appearance: none;
    border: 0;
    min-height: 36px;
    padding: 6px 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.section-empty-link:hover {
    background: var(--warning-soft);
    color: var(--warning);
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 13px;
}

.searchbox {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1 1 300px;
    max-width: 420px;
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    color: var(--muted);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.searchbox:focus-within {
    border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.search-icon {
    flex: 0 0 auto;
    opacity: .7;
}

.searchbox input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12.5px;
}

.searchbox input::placeholder {
    color: var(--muted-2);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.chip:hover {
    border-color: var(--line-strong);
    color: var(--ink);
}

.filter-toggle {
    display: none;
}

.filter-panel {
    display: contents;
}

.filter-panel-head {
    display: none;
}

.filter-toggle-count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 10px;
    line-height: 18px;
    text-align: center;
}

.chip-toggle[aria-pressed="true"] {
    border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
    background: var(--warning-soft);
    color: var(--warning);
}

.chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
}

.select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.select-wrap::after {
    content: "";
    position: absolute;
    right: 13px;
    top: 50%;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: translateY(-68%) rotate(45deg);
    pointer-events: none;
}

.select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    min-height: 40px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11.5px;
    outline: 0;
    cursor: pointer;
}

.select-wrap select:hover {
    border-color: var(--line-strong);
    color: var(--ink);
}

.select-block,
.select-block select {
    width: 100%;
}

.select-block select {
    min-height: 46px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--ink);
}

.filter-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    flex-basis: 100%;
    gap: 7px;
    order: 5;
    margin: 0 0 18px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 11.5px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.filter-chip span {
    color: var(--muted-2);
    font-size: 10px;
}

.filter-chip:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.filter-chip.is-active {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.filter-chip.is-active span {
    color: var(--accent);
}

.spool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
    gap: 14px;
}

.spool-grid.hide-empty [data-status="empty"] {
    display: none;
}

.spool-card {
    position: relative;
    min-width: 0;
    padding: 16px 16px 14px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, opacity .18s ease;
}

.spool-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--line-strong) 80%, var(--accent));
    box-shadow: var(--shadow-md);
}

.spool-card:active {
    transform: translateY(-1px) scale(.995);
}

.spool-card.is-low {
    border-color: color-mix(in srgb, var(--warning) 25%, var(--line));
}

.spool-card.is-dim {
    opacity: .55;
    filter: saturate(.7);
}

.spool-card.is-dim:hover {
    opacity: .82;
}

.spool-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.material-chip {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 5px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 9.5px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: .08em;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

.status-sealed {
    background: var(--surface-2);
    color: var(--muted);
}

.status-in-use {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-drying {
    background: var(--warning-soft);
    color: var(--warning);
}

.status-empty {
    border: 1px solid var(--line);
    color: var(--muted-2);
}

.status-lost {
    background: var(--danger-soft);
    color: var(--danger);
}

.spool-ring {
    position: relative;
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    margin: 15px auto 12px;
    border-radius: 50%;
    background: conic-gradient(var(--spool, var(--accent)) var(--p, 50%), var(--track) 0);
    transition: background .2s ease;
}

.spool-ring::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--surface) 40%, transparent);
    pointer-events: none;
}

.spool-ring.is-light,
.spool-ring:has(.is-light) {
    box-shadow: inset 0 0 0 1px var(--line);
}

.spool-ring-inner {
    position: relative;
    z-index: 1;
    width: 72px;
    height: 72px;
    display: grid;
    grid-template-columns: auto auto;
    align-content: center;
    align-items: baseline;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 75%, transparent);
}

.spool-ring-inner strong {
    font-size: 24px;
    line-height: 1;
    font-weight: 550;
    letter-spacing: -.06em;
    font-variant-numeric: tabular-nums;
}

.spool-ring-inner small {
    margin-left: 1px;
    font-size: 10px;
    color: var(--muted);
}

.spool-card-copy {
    text-align: center;
}

.spool-card-copy h3 {
    margin: 0;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: -.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spool-card-copy p {
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spool-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 13px;
    padding-top: 10px;
    border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    color: var(--muted);
    font-size: 10.5px;
}

.remaining-text {
    white-space: nowrap;
}

.remaining-text strong {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.location-text {
    overflow: hidden;
    max-width: 46%;
    color: var(--muted-2);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.low-flag {
    position: absolute;
    top: 47px;
    right: 12px;
    padding: 3px 6px;
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.2;
}

.static-flag {
    position: static;
    flex: 0 0 auto;
}

/* ---------------------------------------------------------
   Empty states
   --------------------------------------------------------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 52px 24px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 65%, transparent);
    text-align: center;
}

.empty-state h2,
.empty-state h3 {
    margin: 10px 0 5px;
    letter-spacing: -.035em;
}

.empty-state h2 {
    font-size: 28px;
}

.empty-state h3 {
    font-size: 20px;
}

.empty-state p {
    max-width: 470px;
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.7;
}

.empty-state-large {
    margin-top: 30px;
    padding: 72px 24px;
}

.empty-state-filter {
    padding: 42px 24px;
    margin-top: 14px;
}

.empty-illustration {
    position: relative;
    width: 108px;
    height: 108px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
}

.empty-spool-ring {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) 0 62%, var(--surface-2) 62%);
    box-shadow: inset 0 0 0 1px var(--line);
}

.empty-spool-ring::after {
    content: "";
    position: absolute;
    inset: 22px;
    border-radius: 50%;
    background: var(--surface);
}

.empty-spark {
    position: absolute;
    right: 4px;
    top: 5px;
    color: var(--accent);
}

.empty-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--accent-soft);
    color: var(--accent);
}

/* ---------------------------------------------------------
   Quick adjust sheet
   --------------------------------------------------------- */

.sheet {
    position: fixed;
    inset: auto 0 0 0;
    width: min(calc(100% - 24px), 560px);
    max-width: 560px;
    max-height: calc(100dvh - 24px);
    margin: 0 auto;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 28px 28px 0 0;
    background: transparent;
    color: var(--ink);
}

.sheet[open] {
    animation: sheetUp .28s cubic-bezier(.22, .8, .24, 1);
}

.sheet::backdrop {
    background: rgba(18, 18, 16, .58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

@media (min-width: 721px) {
    .sheet {
        inset: 0;
        height: max-content;
        margin: auto;
        border-radius: 28px;
    }

    .sheet-inner {
        padding: 24px 24px 22px;
        border-radius: 28px;
    }

    .sheet-handle {
        display: none;
    }
}

.sheet-inner {
    position: relative;
    max-height: calc(100dvh - 24px);
    padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 28px 28px 0 0;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.sheet-handle {
    width: 38px;
    height: 4px;
    margin: 0 auto 10px;
    border-radius: 999px;
    background: var(--line-strong);
}

.sheet-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-color: transparent;
    background: var(--surface-2);
}

.sheet-head {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 5px 34px 4px 0;
}

.sheet-ring {
    flex: 0 0 auto;
    width: 78px;
    height: 78px;
    margin: 0;
}

.sheet-ring .spool-ring-inner {
    width: 58px;
    height: 58px;
}

.sheet-ring .spool-ring-inner strong {
    font-size: 20px;
}

.sheet-title h2 {
    margin: 4px 0 2px;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -.045em;
}

.sheet-title p {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
}

.sheet-actions {
    display: grid;
    grid-template-columns: 1.2fr 1fr 0.8fr;
    gap: 8px;
    margin-top: 15px;
}

.sheet-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink-2);
    font-size: 11.5px;
    font-weight: 500;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.sheet-action:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
}

.sheet-action-danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 18%, var(--line));
}

.sheet-action-danger:hover {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
}

.sheet-delete-form {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.sheet-delete-form .link-danger {
    color: var(--danger);
    font-size: 11px;
}

.sheet-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 2px;
}

.status-chip {
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 550;
}

.status-chip.is-active {
    border-color: currentColor;
    background: var(--surface-2);
    color: var(--ink);
}

.status-chip.status-in-use.is-active {
    color: var(--accent);
}

.status-chip.status-drying.is-active {
    color: var(--warning);
}

.status-chip.status-empty.is-active,
.status-chip.status-lost.is-active {
    color: var(--danger);
}

.sheet-undo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
}

.sheet-undo button {
    border: 0;
    background: transparent;
    color: currentColor;
    font-size: 11px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------------------------------------------------------
   Remaining editor / slider
   --------------------------------------------------------- */

.remaining-editor {
    --p: 50%;
    --spool: var(--accent);
    margin-top: 16px;
    padding: 15px 16px 13px;
    border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    border-radius: 18px;
    background: var(--surface-2);
}

.editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: .02em;
}

.editor-label {
    color: var(--muted);
}

.save-state {
    color: var(--muted-2);
    font-size: 10px;
    text-align: right;
    transition: color .15s ease;
}

.save-state.is-saving {
    color: var(--warning);
}

.save-state.is-saved {
    color: var(--accent);
}

.save-state.is-error {
    color: var(--danger);
}

.editor-readout {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin: 7px 0 1px;
    line-height: 1;
}

.editor-readout strong {
    font-size: 38px;
    font-weight: 560;
    letter-spacing: -.06em;
    font-variant-numeric: tabular-nums;
}

.editor-unit {
    margin-left: 1px;
    color: var(--muted);
    font-size: 14px;
}

.editor-dot {
    margin: 0 5px;
    color: var(--line-strong);
    font-size: 12px;
}

.editor-readout .js-percent-value {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.percent-slider {
    display: block;
    width: 100%;
    height: 32px;
    margin: 7px 0 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: grab;
}

.percent-slider:active {
    cursor: grabbing;
}

.percent-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        var(--spool, var(--accent)) 0 var(--p, 50%),
        var(--track) var(--p, 50%) 100%
    );
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, .06);
}

.percent-slider::-moz-range-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        var(--spool, var(--accent)) 0 var(--p, 50%),
        var(--track) var(--p, 50%) 100%
    );
}

.percent-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: -8px;
    appearance: none;
    -webkit-appearance: none;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 3px 10px rgba(20, 19, 17, .22);
    transition: transform .1s ease;
}

.percent-slider:active::-webkit-slider-thumb {
    transform: scale(1.1);
}

.percent-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 3px 10px rgba(20, 19, 17, .22);
}

.slider-scale {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
    color: var(--muted-2);
    font-size: 9.5px;
}

.preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.preset-btn {
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    color: var(--muted);
    font-size: 10.5px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.preset-btn:hover,
.preset-btn.is-active {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
    background: var(--accent-soft);
    color: var(--accent);
}

.quick-deduct {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}

.quick-deduct-label {
    margin-right: 2px;
    color: var(--muted-2);
    font-size: 10.5px;
}

.deduct-chip {
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 10.5px;
    font-weight: 550;
}

.deduct-chip:hover {
    border-color: var(--warning);
    background: var(--warning-soft);
    color: var(--warning);
}

.deduct-custom {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.deduct-custom input {
    width: 58px;
    height: 30px;
    padding: 0 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    outline: 0;
    background: var(--surface);
    font-size: 11px;
}

.deduct-custom input:focus {
    border-color: var(--accent);
}

/* ---------------------------------------------------------
   Page intros / count
   --------------------------------------------------------- */

.page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin: 4px 0 28px;
}

.page-intro-copy h1 {
    margin: 7px 0 9px;
    font-size: clamp(38px, 5vw, 56px);
    line-height: .98;
    letter-spacing: -.06em;
    font-weight: 580;
}

.page-intro-copy p {
    max-width: 560px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.count-intro {
    align-items: center;
    padding: 28px 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.count-badge {
    flex: 0 0 auto;
    min-width: 122px;
    padding: 13px 18px;
    border-radius: 17px;
    background: var(--accent-soft);
    color: var(--accent);
    text-align: center;
}

.count-badge strong {
    display: block;
    font-size: 34px;
    line-height: 1;
    font-weight: 560;
    letter-spacing: -.05em;
    font-variant-numeric: tabular-nums;
}

.count-badge span {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    font-weight: 500;
    opacity: .72;
}

.count-section {
    margin-top: 24px;
}

.count-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.count-total {
    color: var(--muted);
    font-size: 11.5px;
}

.count-list {
    display: grid;
    gap: 9px;
}

.count-row {
    display: grid;
    grid-template-columns: minmax(180px, .95fr) minmax(280px, 1.65fr) auto;
    gap: 26px;
    align-items: center;
    padding: 15px 18px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.count-row.is-updated {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
    background: color-mix(in srgb, var(--accent-soft) 30%, var(--surface));
}

.count-identity {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.count-color-dot {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--spool, var(--accent));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2), 0 0 0 1px var(--line);
}

.count-color-dot.is-light {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 0 0 1px var(--line);
}

.count-name {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.count-name strong {
    overflow: hidden;
    font-size: 14px;
    letter-spacing: -.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.count-name span {
    overflow: hidden;
    color: var(--muted);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.count-editor {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.count-editor .editor-head {
    margin-bottom: 0;
}

.count-editor .editor-label {
    color: var(--ink-2);
    font-size: 12px;
}

.count-editor .editor-label strong {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.count-editor .js-percent-value {
    color: var(--muted);
    font-size: 10.5px;
}

.count-editor .save-state {
    flex: 1;
}

.count-editor .percent-slider {
    height: 28px;
    margin-top: 2px;
}

.count-editor .percent-slider::-webkit-slider-runnable-track {
    height: 9px;
}

.count-editor .percent-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -7.5px;
    border-width: 3px;
}

.count-editor .percent-slider::-moz-range-track {
    height: 9px;
}

.count-editor .percent-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
}

.count-status {
    display: flex;
    justify-content: flex-end;
}

.count-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 18px;
    padding: 15px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.count-hint {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 11px;
}

/* ---------------------------------------------------------
   Detail
   --------------------------------------------------------- */

.page-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11.5px;
    transition: color .15s ease;
}

.back-link:hover {
    color: var(--ink);
}

.back-link-icon {
    width: 40px;
    height: 40px;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink-2);
    box-shadow: var(--shadow-sm);
}

.back-link-icon:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
    color: var(--ink);
}

.topbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.topbar-actions form {
    display: flex;
    margin: 0;
}

.detail-hero {
    position: relative;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 46px;
    align-items: center;
    padding: 38px 42px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background:
        radial-gradient(500px 260px at 100% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 65%),
        var(--surface);
    box-shadow: var(--shadow-sm);
}

.detail-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 290px;
}

.detail-orbit {
    position: absolute;
    width: 290px;
    height: 290px;
    border: 1px dashed var(--line);
    border-radius: 50%;
}

.detail-ring {
    width: 238px;
    height: 238px;
    margin: 0;
    z-index: 1;
}

.detail-ring .spool-ring-inner {
    width: 184px;
    height: 184px;
}

.detail-ring .spool-ring-inner strong {
    font-size: 58px;
}

.detail-ring .spool-ring-inner small {
    font-size: 16px;
}

.detail-badges {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 18px;
}

.low-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 10px;
}

.detail-copy {
    min-width: 0;
}

.detail-eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 11.5px;
}

.detail-copy h1 {
    margin: 8px 0 3px;
    font-size: clamp(38px, 5vw, 58px);
    line-height: 1;
    letter-spacing: -.06em;
    font-weight: 580;
}

.detail-sub {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

.detail-editor {
    max-width: 580px;
}

.detail-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--muted);
    font-size: 11.5px;
}

.text-link:hover {
    color: var(--accent);
}

.detail-grid {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 18px;
    margin-top: 18px;
}

.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 22px;
    margin: 0;
}

.meta-grid dt {
    margin-bottom: 3px;
    color: var(--muted-2);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.meta-grid dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--ink-2);
    font-size: 13px;
}

.meta-grid-compact {
    gap: 14px 18px;
}

.note-block {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.note-block p {
    margin: 7px 0 0;
    color: var(--ink-2);
    font-size: 12.5px;
    line-height: 1.7;
}

.history-panel {
    min-width: 0;
}

/* ---------------------------------------------------------
   Logs
   --------------------------------------------------------- */

.log-groups {
    display: grid;
    gap: 0;
}

.log-date {
    padding: 13px 0 7px;
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
}

.log-date:first-child {
    padding-top: 2px;
}

.log-item {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 11px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.log-item:last-child {
    border-bottom: 0;
}

.log-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--spool, var(--accent));
    box-shadow: 0 0 0 1px var(--line);
}

.log-dot.is-light {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), 0 0 0 1px var(--line);
}

.log-main {
    min-width: 0;
}

.log-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 20px;
}

.log-type {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .04em;
}

.log-use {
    background: var(--warning-soft);
    color: var(--warning);
}

.log-adjust,
.log-initial {
    background: var(--accent-soft);
    color: var(--accent);
}

.log-stocktake {
    background: color-mix(in srgb, var(--blue) 12%, var(--surface));
    color: var(--blue);
}

.log-status {
    background: var(--surface-2);
    color: var(--muted);
}

.log-spool-link {
    font-size: 12px;
    font-weight: 600;
}

.log-spool-link:hover {
    color: var(--accent);
}

.log-delta {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.log-delta.is-positive {
    color: var(--accent);
}

.log-delta.is-negative {
    color: var(--warning);
}

.log-note {
    margin: 2px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-time {
    color: var(--muted-2);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.log-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 36px 10px;
    color: var(--muted-2);
    text-align: center;
}

.log-empty p {
    margin: 0;
    font-size: 11.5px;
}

.history-section {
    margin-top: 4px;
}

.history-filters {
    margin-bottom: 14px;
}

.history-toolbar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.history-field {
    flex: 1 1 170px;
    gap: 5px;
}

.history-field .field-label {
    font-size: 10.5px;
}

.history-field .text-input {
    height: 38px;
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
}

.history-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.history-result-meta {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 11.5px;
}

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 18px 0 4px;
}

.history-page-count {
    color: var(--muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.btn.is-disabled {
    opacity: .45;
    pointer-events: none;
}

.history-page-panel {
    padding-top: 18px;
    padding-bottom: 18px;
}

/* ---------------------------------------------------------
   Forms
   --------------------------------------------------------- */

.form-page {
    width: min(820px, 100%);
    margin: 0 auto;
}

.form-heading {
    margin: 0 0 22px;
}

.form-heading h1 {
    margin: 7px 0 8px;
    font-size: clamp(34px, 4.5vw, 48px);
    line-height: 1;
    letter-spacing: -.055em;
    font-weight: 580;
}

.form-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

.form-panel {
    padding: 8px 30px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.form-section {
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
    border-bottom: 0;
}

.form-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 19px;
}

.section-number {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 7px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
}

.form-section-heading h2 {
    margin: 0;
    font-size: 19px;
    line-height: 1.15;
    letter-spacing: -.035em;
}

.form-section-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11.5px;
}

.field {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.field + .field {
    margin-top: 18px;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.field-label {
    color: var(--ink-2);
    font-size: 11.5px;
    font-weight: 600;
}

.field-label small {
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 400;
}

.field-hint {
    color: var(--muted-2);
    font-size: 10.5px;
}

.field-error {
    color: var(--danger);
    font-size: 10.5px;
}

.text-input {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: 0;
    background: var(--bg-elevated);
    color: var(--ink);
    font-size: 13px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.text-input::placeholder {
    color: var(--muted-2);
}

.text-input:focus {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    background: var(--surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
}

.text-input.has-error {
    border-color: var(--danger);
}

.textarea {
    min-height: 86px;
    padding: 11px 13px;
    resize: vertical;
    line-height: 1.6;
}

.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 9px;
}

.choice-chip {
    min-height: 31px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.choice-chip:hover {
    border-color: var(--line-strong);
    color: var(--ink);
}

.choice-chip.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.input-with-unit {
    position: relative;
}

.input-with-unit .text-input {
    padding-right: 38px;
}

.input-with-unit > span:last-child {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--muted-2);
    font-size: 11.5px;
    pointer-events: none;
}

.input-with-unit .unit-prefix {
    right: auto;
    left: 14px;
}

.input-with-unit .unit-prefix + .text-input {
    padding-left: 30px;
    padding-right: 13px;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--bg-elevated);
}

.color-preview {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--spool, var(--accent));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 0 0 1px var(--line);
}

.color-mode-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.segmented {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
}

.segment {
    min-height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.segment.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.color-target {
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.color-target.is-target {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.color-target.is-hidden {
    display: none;
}

.color-target-hint {
    margin: 8px 0 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.color-picker-copy {
    display: grid;
    gap: 2px;
    flex: 1;
}

.color-hex-label {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    text-transform: uppercase;
}

.color-name-label {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.02em;
}

.native-color {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 10.5px;
    cursor: pointer;
}

.native-color input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.swatch-group {
    margin-top: 16px;
}

.swatch-group-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .06em;
}

.swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 10px 6px;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    cursor: pointer;
}

.color-option-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10.5px;
    line-height: 1.2;
}

.color-option:hover .color-option-name,
.color-option.is-active .color-option-name {
    color: var(--ink);
    font-weight: 600;
}

.color-swatch {
    display: block;
    width: 40px;
    height: 40px;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--swatch, var(--accent));
    box-shadow: 0 0 0 1px var(--line);
    transition: transform .12s ease, box-shadow .12s ease;
}

.color-option:hover .color-swatch {
    transform: scale(1.08);
}

.color-option.is-active .color-swatch,
.color-swatch.is-active {
    box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--surface);
}

.color-swatch.is-light {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), 0 0 0 1px var(--line);
}

.form-editor {
    margin-top: 18px;
}

.more-fields {
    border-bottom: 1px solid var(--line);
}

.more-fields summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.more-fields summary::-webkit-details-marker {
    display: none;
}

.more-fields summary > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.more-fields summary small {
    color: var(--muted-2);
    font-size: 10.5px;
    font-weight: 400;
}

.summary-plus {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 50%;
    transition: transform .18s ease;
}

.more-fields[open] .summary-plus {
    transform: rotate(45deg);
}

.more-fields-body {
    display: grid;
    gap: 16px;
    padding: 0 0 24px;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 22px;
}

.delete-form {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.link-danger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    background: transparent;
    color: var(--muted-2);
    font-size: 11px;
}

.link-danger:hover {
    color: var(--danger);
}

.form-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 11px 13px;
    border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--line));
    border-radius: 11px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 11.5px;
}

/* ---------------------------------------------------------
   Settings
   --------------------------------------------------------- */

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.settings-panel {
    min-width: 0;
}

.settings-form {
    display: grid;
    gap: 16px;
}

.settings-form .field + .field {
    margin-top: 0;
}

.settings-users {
    grid-column: 1 / -1;
}

.settings-colors {
    grid-column: 1 / -1;
}

.custom-color-list {
    display: grid;
    margin-bottom: 16px;
    border-top: 1px solid var(--line);
}

.custom-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.custom-color-swatch {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--spool, var(--accent));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 0 0 1px var(--line);
}

.custom-color-copy {
    display: grid;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.custom-color-copy strong {
    font-size: 12.5px;
}

.custom-color-copy small {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 10px;
    letter-spacing: .04em;
}

.custom-color-delete {
    margin-left: auto;
}

.color-add-form {
    gap: 10px;
}

.color-add-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.color-add-row .field {
    flex: 1 1 200px;
}

.color-add-row .color-add-picker {
    flex: 0 0 88px;
}

.color-input {
    width: 100%;
    height: 44px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.color-add-button {
    min-height: 44px;
}

.user-list {
    display: grid;
    border-top: 1px solid var(--line);
}

.user-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 650;
    overflow: hidden;
}

.user-avatar.has-image {
    padding: 0;
    background: var(--surface-2);
}

.user-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-profile {
    grid-column: 1 / -1;
}

.profile-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.profile-avatar-preview {
    flex: 0 0 92px;
    width: 92px;
    height: 92px;
}

.profile-avatar-preview > .user-avatar,
.profile-avatar-preview > img {
    width: 100%;
    height: 100%;
}

.profile-avatar-preview > img {
    display: block;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    font-size: 32px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 72%, transparent);
}

.profile-copy {
    display: grid;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.profile-identity {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-identity strong {
    font-size: 16px;
    letter-spacing: -.02em;
}

.profile-identity span {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 10px;
}

.profile-identity small {
    color: var(--muted-2);
    font-size: 10.5px;
}

.avatar-form {
    max-width: 560px;
}

.avatar-drop {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    background: var(--surface-2);
    transition: border-color .15s ease, background .15s ease;
}

.avatar-drop:hover,
.avatar-drop:focus-visible,
.avatar-drop.is-dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

.avatar-file-native {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.avatar-file-name {
    min-width: 0;
    color: var(--ink-2);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.avatar-drop .field-hint {
    flex-basis: 100%;
    margin-top: -2px;
}

.avatar-form-actions {
    display: flex;
    align-items: center;
}

.avatar-remove-form {
    display: flex;
    justify-content: flex-start;
}

.settings-import,
.settings-import-preview {
    grid-column: 1 / -1;
}

.import-file-input {
    padding: 10px 12px;
    line-height: 1.4;
}

.import-form-actions {
    padding-top: 0;
}

.import-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.import-summary > div {
    display: grid;
    gap: 3px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-2);
}

.import-summary strong {
    font-size: 20px;
    letter-spacing: -.04em;
}

.import-summary span {
    color: var(--muted);
    font-size: 11px;
}

.import-materials {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.import-materials .material-chip strong {
    color: var(--muted);
}

.import-warning {
    align-items: flex-start;
    margin-bottom: 14px;
}

.import-mode {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-2);
    cursor: pointer;
}

.import-mode input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.import-mode span {
    display: grid;
    gap: 3px;
}

.import-mode strong {
    font-size: 12.5px;
}

.import-mode small {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.55;
}

.avatar-crop-dialog {
    position: fixed;
    inset: 0;
    width: min(calc(100% - 28px), 430px);
    max-height: calc(100vh - 28px);
    margin: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
}

.avatar-crop-dialog::backdrop {
    background: rgba(18, 18, 16, .62);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.avatar-crop-panel {
    display: grid;
    gap: 16px;
    max-height: calc(100vh - 28px);
    padding: 22px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.avatar-crop-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.avatar-crop-head h2 {
    margin: 4px 0 0;
    font-size: 24px;
    line-height: 1.05;
    letter-spacing: -.04em;
}

.avatar-crop-hint {
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.65;
}

.avatar-crop-stage {
    position: relative;
    width: min(100%, 340px);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 18px;
    background: var(--surface-2);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.avatar-crop-stage.is-dragging {
    cursor: grabbing;
}

.avatar-crop-stage img {
    position: absolute;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    max-width: none;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.avatar-crop-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, .28) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, .28) 1px, transparent 1px);
    background-size: 33.333% 100%, 100% 33.333%;
}

.avatar-crop-mask {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 50%;
    box-shadow: 0 0 0 999px rgba(18, 18, 16, .46);
    pointer-events: none;
}

.avatar-crop-zoom {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 11.5px;
}

.avatar-crop-zoom input {
    flex: 1 1 auto;
    accent-color: var(--accent);
}

.avatar-crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.user-copy {
    display: grid;
    gap: 2px;
    flex: 1 1 120px;
    min-width: 0;
}

.user-copy strong {
    font-size: 12.5px;
}

.user-copy small {
    color: var(--muted);
    font-size: 10.5px;
}

.user-reset-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-left: auto;
}

.user-reset-form .text-input {
    width: 104px;
    min-height: 34px;
    padding: 0 9px;
    border-radius: 9px;
    font-size: 11px;
}

.user-reset-form .btn {
    min-height: 34px;
    padding: 0 10px;
    font-size: 10.5px;
}

.user-delete-form {
    display: flex;
    align-items: center;
    margin: 0;
}

.check-field {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.check-field input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.data-list {
    display: grid;
    border-top: 1px solid var(--line);
}

.data-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
    transition: color .15s ease;
}

.data-row:hover {
    color: var(--accent);
}

.data-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--muted);
}

.data-copy {
    display: grid;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.data-copy strong {
    font-size: 12.5px;
}

.data-copy small {
    color: var(--muted);
    font-size: 10.5px;
}

.settings-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    color: var(--muted-2);
    font-size: 10.5px;
}

.settings-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.settings-actions form {
    margin: 0;
}

.settings-about {
    display: flex;
    flex-direction: column;
}

.settings-about .settings-actions {
    margin-top: auto;
}

/* ---------------------------------------------------------
   History
   --------------------------------------------------------- */

.history-page-panel {
    overflow: hidden;
}

/* ---------------------------------------------------------
   Auth
   --------------------------------------------------------- */

.auth-body {
    background:
        radial-gradient(900px 500px at 90% -10%, rgba(23, 107, 82, .10), transparent 60%),
        var(--bg);
}

.auth-shell {
    width: min(1180px, calc(100% - 48px));
    min-height: calc(100vh - 48px);
    margin: 24px auto;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 24px;
}

.auth-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 620px;
    padding: 38px 40px;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(600px 320px at 90% 10%, rgba(87, 184, 148, .28), transparent 65%),
        linear-gradient(135deg, #1c1b19, #1b2721);
    color: #f4f1e8;
    box-shadow: 0 26px 70px rgba(20, 19, 17, .2);
}

.auth-brand-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .17;
    background-image: radial-gradient(rgba(255, 255, 255, .32) .7px, transparent .7px);
    background-size: 18px 18px;
    mask-image: linear-gradient(135deg, black, transparent 60%);
}

.auth-brand-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark-large {
    width: 50px;
    height: 50px;
    background: #f4f1e8;
    color: #1c1b19;
}

.auth-brand-top div {
    display: grid;
    gap: 5px;
}

.auth-brand-top strong {
    font-size: 21px;
    letter-spacing: -.04em;
}

.auth-brand-top small {
    color: rgba(244, 241, 232, .55);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .18em;
}

.auth-visual {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    min-height: 330px;
}

.auth-orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 50%;
}

.orbit-one {
    width: 300px;
    height: 300px;
}

.orbit-two {
    width: 380px;
    height: 380px;
    border-color: rgba(255, 255, 255, .05);
}

.auth-ring {
    position: relative;
    width: 210px;
    height: 210px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#5cc29a 0 62%, rgba(255, 255, 255, .12) 62%);
    box-shadow: 0 0 80px rgba(87, 184, 148, .2);
}

.auth-ring::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 166px;
    height: 166px;
    border-radius: 50%;
    background: #1b1c19;
    border: 1px solid rgba(255, 255, 255, .08);
    transform: translate(-50%, -50%);
}

.auth-ring span {
    position: relative;
    z-index: 1;
    font-size: 46px;
    line-height: 1;
    letter-spacing: -.06em;
}

.auth-ring small {
    font-size: 15px;
    color: rgba(244, 241, 232, .5);
}

.auth-spool-card {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(12px);
    color: rgba(244, 241, 232, .8);
    font-size: 10.5px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .18);
}

.auth-spool-card strong {
    margin-left: 2px;
    color: #f4f1e8;
    font-size: 11px;
}

.card-a {
    top: 60px;
    left: 10%;
    transform: rotate(-5deg);
}

.card-b {
    right: 8%;
    bottom: 52px;
    transform: rotate(5deg);
}

.mini-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--spool, var(--accent));
}

.auth-tagline {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: clamp(25px, 3vw, 36px);
    line-height: 1.25;
    letter-spacing: -.045em;
    color: rgba(244, 241, 232, .9);
}

.auth-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 46px clamp(20px, 5vw, 70px);
}

.auth-mobile-brand {
    display: none;
}

.auth-heading {
    margin-bottom: 24px;
}

.auth-heading h1 {
    margin: 9px 0 10px;
    font-size: clamp(34px, 4.5vw, 48px);
    line-height: 1.06;
    letter-spacing: -.06em;
    font-weight: 580;
}

.auth-heading p {
    max-width: 380px;
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.7;
}

.auth-form {
    display: grid;
    gap: 16px;
    max-width: 400px;
}

.input-wrap {
    position: relative;
    display: block;
}

.input-wrap input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 43px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: 0;
    background: var(--bg-elevated);
    font-size: 13px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.input-wrap input:focus {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    background: var(--surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-2);
    pointer-events: none;
}

.auth-help {
    max-width: 400px;
    margin: 18px 0 0;
    color: var(--muted-2);
    font-size: 10.5px;
    line-height: 1.6;
}

.auth-footnote {
    max-width: 400px;
    margin: 40px 0 0;
    color: var(--muted-2);
    font-size: 9.5px;
    letter-spacing: .04em;
}

.auth-form-panel .form-alert {
    max-width: 400px;
}

/* ---------------------------------------------------------
   Toast
   --------------------------------------------------------- */

.toast-root {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 200;
    display: grid;
    gap: 8px;
    width: min(440px, calc(100% - 32px));
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 13px;
    background: var(--ink);
    color: var(--bg);
    box-shadow: var(--shadow-lg);
    font-size: 11.5px;
    animation: toastIn .22s ease both;
    pointer-events: auto;
}

.toast.is-error {
    background: var(--danger);
    color: #fff;
}

.toast-message {
    flex: 1;
}

.toast-action {
    padding: 3px 0;
    border: 0;
    background: transparent;
    color: #9edfc3;
    font-size: 11px;
    font-weight: 600;
}

.toast.is-error .toast-action {
    color: #fff;
}

/* ---------------------------------------------------------
   Error
   --------------------------------------------------------- */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 56vh;
    text-align: center;
}

.error-code {
    font-size: clamp(80px, 15vw, 160px);
    line-height: .8;
    letter-spacing: -.09em;
    color: var(--line-strong);
    font-weight: 600;
}

.error-page h1 {
    margin: 12px 0 6px;
    font-size: 32px;
    letter-spacing: -.05em;
}

.error-page p {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 12.5px;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 1050px) {
    .hero {
        padding: 34px;
    }

    .hero-visual {
        flex-basis: 250px;
        margin-left: 10px;
    }

    .hero-ring {
        width: 184px;
        height: 184px;
    }

    .hero-ring-inner {
        width: 146px;
        height: 146px;
    }

    .hero-ring-inner strong {
        font-size: 36px;
    }

    .detail-hero {
        grid-template-columns: 300px minmax(0, 1fr);
        gap: 28px;
        padding: 30px;
    }

    .detail-ring {
        width: 210px;
        height: 210px;
    }

    .detail-ring .spool-ring-inner {
        width: 162px;
        height: 162px;
    }

    .detail-ring .spool-ring-inner strong {
        font-size: 48px;
    }

    .count-row {
        grid-template-columns: minmax(170px, .85fr) minmax(250px, 1.5fr) auto;
        gap: 18px;
    }
}

@media (max-width: 820px) {
    :root {
        --header-h: 64px;
    }

    .header-inner {
        width: calc(100% - 28px);
        gap: 12px;
    }

    .desktop-nav {
        display: none;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 11px;
    }

    .brand-text strong {
        font-size: 16px;
    }

    .brand-text small {
        font-size: 7px;
    }

    .header-add span {
        display: none;
    }

    .header-add {
        width: 40px;
        padding: 0;
    }

    .header-actions {
        gap: 7px;
    }

    .filter-toggle {
        display: inline-flex;
        flex: 0 0 auto;
        margin-left: auto;
    }

    .toolbar .searchbox {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
    }

    .filter-panel {
        display: none;
    }

    .wall-section.filters-open .filter-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(64px + env(safe-area-inset-bottom));
        z-index: 70;
        display: flex;
        flex-direction: column;
        max-height: 72vh;
        padding: 16px;
        overflow: auto;
        border-top: 1px solid var(--line);
        border-radius: 22px 22px 0 0;
        background: var(--surface);
        box-shadow: 0 -18px 50px rgba(23, 22, 20, .22);
    }

    .filter-panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 14px;
    }

    .filter-panel-head strong {
        font-size: 16px;
        letter-spacing: -.03em;
    }

    .filter-panel .toolbar-actions {
        display: flex;
        flex-basis: auto;
        order: 0;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .filter-panel .filter-chips {
        display: flex;
        flex: 0 0 auto;
        order: 0;
        margin: 14px 0 0;
    }

    .header-user {
        width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 2px;
        justify-content: center;
    }

    .header-user-name {
        display: none;
    }

    .header-user .header-avatar {
        width: 34px;
        height: 34px;
    }

    .app-main {
        width: calc(100% - 28px);
        padding: 20px 0 calc(86px + env(safe-area-inset-bottom));
    }

    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        display: flex;
        justify-content: space-around;
        gap: 4px;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
        border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
        background: color-mix(in srgb, var(--surface) 88%, transparent);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    .bottom-nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        min-width: 64px;
        padding: 4px 10px;
        border-radius: 10px;
        color: var(--muted);
        font-size: 9px;
    }

    .bottom-nav-link.is-active {
        background: var(--accent-soft);
        color: var(--accent);
    }

    .bottom-nav-icon {
        display: grid;
        place-items: center;
    }

    .hero {
        min-height: 0;
        padding: 28px 24px;
        border-radius: 24px;
    }

    .hero-value {
        font-size: clamp(50px, 14vw, 72px);
    }

    .hero-visual {
        position: absolute;
        right: -52px;
        bottom: -58px;
        width: 220px;
        height: 220px;
        opacity: .45;
        margin: 0;
    }

    .hero-ring {
        width: 180px;
        height: 180px;
    }

    .hero-ring-inner {
        width: 144px;
        height: 144px;
    }

    .hero-ring-inner strong {
        font-size: 36px;
    }

    .hero-copy {
        max-width: 100%;
    }

    .hero-actions {
        position: relative;
        z-index: 3;
    }

    .wall-section {
        margin-top: 28px;
    }

    .section-heading h2 {
        font-size: 24px;
    }

    .toolbar {
        align-items: stretch;
    }

    .searchbox {
        max-width: none;
        flex-basis: 100%;
    }

    .toolbar-actions {
        justify-content: space-between;
        flex-wrap: nowrap;
    }

    .toolbar-actions .select-wrap {
        flex: 1;
        min-width: 0;
    }

    .toolbar-actions .select-wrap select {
        width: 100%;
    }

    .filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 3px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .filter-chips::-webkit-scrollbar {
        display: none;
    }

    .filter-chips .filter-chip {
        flex: 0 0 auto;
    }

    .spool-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .spool-card {
        padding: 13px 12px 12px;
        border-radius: 17px;
    }

    .spool-ring {
        width: 78px;
        height: 78px;
        margin: 13px auto 10px;
    }

    .spool-ring-inner {
        width: 58px;
        height: 58px;
    }

    .spool-ring-inner strong {
        font-size: 20px;
    }

    .spool-card-copy h3 {
        font-size: 14px;
    }

    .spool-card-copy p {
        font-size: 10px;
    }

    .spool-card-foot {
        display: grid;
        gap: 2px;
        justify-content: initial;
        font-size: 9.5px;
    }

    .location-text {
        max-width: 100%;
    }

    .low-flag {
        top: 43px;
        right: 8px;
        font-size: 8px;
    }

    .sheet {
        width: 100%;
        max-width: none;
        border-radius: 24px 24px 0 0;
    }

    .sheet-inner {
        border-radius: 24px 24px 0 0;
        padding-left: 16px;
        padding-right: 16px;
    }

    .sheet-actions {
        grid-template-columns: 1fr 1fr;
    }

    .sheet-action-danger {
        grid-column: 1 / -1;
        order: 3;
    }

    .page-intro {
        display: block;
        margin-bottom: 20px;
    }

    .page-intro-copy h1 {
        font-size: 42px;
    }

    .page-intro .btn {
        margin-top: 16px;
    }

    .count-intro {
        display: flex;
        align-items: flex-end;
        gap: 14px;
        padding: 22px 18px;
    }

    .count-badge {
        min-width: 88px;
        padding: 10px 12px;
    }

    .count-badge strong {
        font-size: 26px;
    }

    .count-row {
        grid-template-columns: 1fr auto;
        gap: 12px 14px;
        padding: 14px;
    }

    .count-identity {
        grid-column: 1;
    }

    .count-status {
        grid-column: 2;
        grid-row: 1;
    }

    .count-editor {
        grid-column: 1 / -1;
    }

    .count-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .count-footer .btn {
        width: 100%;
    }

    .detail-hero {
        display: block;
        padding: 24px 20px;
        border-radius: 24px;
    }

    .detail-visual {
        min-height: 0;
        margin-bottom: 24px;
    }

    .detail-ring {
        width: 180px;
        height: 180px;
    }

    .detail-ring .spool-ring-inner {
        width: 140px;
        height: 140px;
    }

    .detail-ring .spool-ring-inner strong {
        font-size: 42px;
    }

    .detail-badges {
        margin-top: 14px;
    }

    .detail-copy h1 {
        font-size: 42px;
    }

    .detail-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .page-topbar {
        align-items: flex-start;
    }

    .topbar-actions .btn span {
        display: none;
    }

    .form-panel {
        padding: 4px 18px calc(96px + env(safe-area-inset-bottom));
        border-radius: 24px;
    }

    .field-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-section {
        padding: 22px 0;
    }

    .swatch-grid {
        grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
        gap: 10px 4px;
    }

    .color-swatch {
        width: 36px;
        height: 36px;
    }

    .form-actions {
        position: sticky;
        bottom: calc(66px + env(safe-area-inset-bottom));
        z-index: 5;
        margin: 0 -18px -18px;
        padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        backdrop-filter: blur(12px);
    }

    .form-actions .btn-primary {
        flex: 1;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .import-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .history-field {
        flex-basis: calc(50% - 5px);
    }

    .history-toolbar-actions {
        width: 100%;
    }

    .profile-layout {
        flex-direction: column;
        gap: 16px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
        font-size: 28px;
    }

    .profile-avatar-preview {
        flex-basis: 80px;
        width: 80px;
        height: 80px;
    }

    .avatar-crop-dialog {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
    }

    .avatar-crop-panel {
        max-height: calc(100vh - 20px);
        padding: 18px;
        border-radius: 20px;
    }

    .avatar-crop-stage {
        width: min(100%, 300px);
    }

    .auth-shell {
        display: block;
        width: min(100% - 24px, 480px);
        min-height: 0;
        margin: 12px auto;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        min-height: calc(100vh - 24px);
        padding: 34px 22px;
    }

    .auth-mobile-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 50px;
    }

    .auth-mobile-brand div {
        display: grid;
        gap: 4px;
    }

    .auth-mobile-brand strong {
        font-size: 17px;
        letter-spacing: -.03em;
    }

    .auth-mobile-brand small {
        color: var(--muted);
        font-size: 7px;
        font-weight: 700;
        letter-spacing: .16em;
    }

    .auth-form-panel .form-alert,
    .auth-form,
    .auth-help,
    .auth-footnote {
        max-width: none;
    }

    .toast-root {
        bottom: calc(78px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 420px) {
    .page-topbar {
        align-items: center;
        gap: 8px;
    }

    .back-link {
        width: 40px;
        height: 40px;
        flex: 0 0 auto;
        justify-content: center;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface);
    }

    .back-link span {
        display: none;
    }

    .topbar-actions {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .topbar-actions .btn,
    .topbar-delete-form .btn {
        width: 40px;
        padding: 0;
        justify-content: center;
    }

    .spool-grid {
        gap: 8px;
    }

    .spool-card {
        padding: 11px 10px;
    }

    .spool-card .spool-ring {
        width: 72px;
        height: 72px;
    }

    .spool-card .spool-ring-inner {
        width: 54px;
        height: 54px;
    }

    .spool-card .spool-ring-inner strong {
        font-size: 18px;
    }

    .material-chip {
        font-size: 8.5px;
    }

    .status-pill {
        font-size: 9px;
    }

    .hero {
        padding: 24px 20px;
    }

    .hero-actions {
        gap: 12px;
    }

    .hero-link {
        font-size: 12.5px;
    }

    .section-heading {
        align-items: center;
    }

    .section-count {
        font-size: 10px;
    }

    .toolbar-actions .chip {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .swatch-grid {
        grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
        gap: 8px 2px;
    }

    .color-option-name {
        font-size: 10px;
    }

    .color-swatch {
        width: 32px;
        height: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

.field-hint,
.log-time,
.auth-help,
.auth-footnote,
.user-copy small,
.profile-identity small,
.subtle-stats,
.searchbox input::placeholder,
.text-input::placeholder {
    font-size: 12px;
}

.user-delete-form .link-danger {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 6px 8px;
}

/* Translucent filament is drawn as glassy plastic instead of a flat color. */
.spool-ring.is-translucent {
    background: conic-gradient(
        from -90deg,
        color-mix(in srgb, var(--spool, var(--accent)) 58%, transparent) var(--p, 50%),
        color-mix(in srgb, var(--track) 55%, transparent) 0
    );
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .55),
        inset 0 0 24px rgba(255, 255, 255, .18);
}

.spool-ring.is-translucent::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .82), rgba(255, 255, 255, 0) 42%),
        linear-gradient(140deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .22) 64%, rgba(255, 255, 255, .42));
    pointer-events: none;
}

.spool-ring.is-translucent .spool-ring-inner {
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .6),
        inset 0 -6px 14px rgba(255, 255, 255, .2);
}

.count-color-dot.is-translucent,
.log-dot.is-translucent,
.color-preview.is-translucent,
.mini-dot.is-translucent {
    background:
        radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 45%),
        linear-gradient(135deg,
            color-mix(in srgb, var(--spool, var(--accent)) 55%, transparent),
            color-mix(in srgb, var(--spool, var(--accent)) 78%, transparent));
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .55),
        inset 0 -5px 10px rgba(255, 255, 255, .22),
        0 0 0 1px color-mix(in srgb, var(--spool, var(--accent)) 45%, var(--line));
}

.color-swatch.is-translucent {
    background:
        radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 45%),
        linear-gradient(135deg,
            color-mix(in srgb, var(--swatch, var(--accent)) 55%, transparent),
            color-mix(in srgb, var(--swatch, var(--accent)) 78%, transparent));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55), 0 0 0 1px color-mix(in srgb, var(--swatch, var(--accent)) 42%, var(--line));
}

.remaining-editor.is-translucent .percent-slider::-webkit-slider-runnable-track {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 42%),
        linear-gradient(90deg,
            color-mix(in srgb, var(--spool, var(--accent)) 62%, transparent) 0 var(--p, 50%),
            var(--track) var(--p, 50%) 100%);
}

.remaining-editor.is-translucent .percent-slider::-moz-range-track {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 42%),
        linear-gradient(90deg,
            color-mix(in srgb, var(--spool, var(--accent)) 62%, transparent) 0 var(--p, 50%),
            var(--track) var(--p, 50%) 100%);
}

.spool-card.is-translucent-color .material-chip {
    background: color-mix(in srgb, var(--spool, var(--accent)) 16%, var(--surface));
    color: color-mix(in srgb, var(--spool, var(--accent)) 72%, var(--ink));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--spool, var(--accent)) 35%, transparent);
}

/* Marble is drawn with layered veins on top of the base colour. */
.spool-ring.is-marble {
    background: conic-gradient(var(--spool, var(--accent)) var(--p, 50%), var(--track) 0);
}

.spool-ring.is-marble::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 50%;
    background-image: var(--marble-texture);
    background-size: 220px 220px;
    background-repeat: repeat;
    opacity: .9;
    pointer-events: none;
    -webkit-mask-image: conic-gradient(from -90deg, #000 var(--p, 50%), transparent 0);
    mask-image: conic-gradient(from -90deg, #000 var(--p, 50%), transparent 0);
}

.count-color-dot.is-marble,
.log-dot.is-marble,
.color-preview.is-marble,
.mini-dot.is-marble {
    background-color: var(--spool, var(--accent));
    background-image: var(--marble-texture);
    background-size: 110px 110px;
    background-repeat: repeat;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 0 0 1px var(--line);
}

.color-swatch.is-marble {
    background-color: var(--swatch, var(--accent));
    background-image: var(--marble-texture);
    background-size: 90px 90px;
    background-repeat: repeat;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 0 0 1px var(--line);
}

.remaining-editor.is-marble .percent-slider::-webkit-slider-runnable-track {
    background:
        linear-gradient(90deg, transparent 0 var(--p, 50%), var(--track) var(--p, 50%) 100%),
        var(--marble-texture) 0 0 / 140px 140px repeat;
}

.remaining-editor.is-marble .percent-slider::-moz-range-track {
    background:
        linear-gradient(90deg, transparent 0 var(--p, 50%), var(--track) var(--p, 50%) 100%),
        var(--marble-texture) 0 0 / 140px 140px repeat;
}

/* Two-colour filament is drawn as a split/gradient mix. */
.spool-ring.is-mixed {
    background: conic-gradient(
        from -90deg,
        var(--spool, var(--accent)) 0 calc(var(--p, 50%) / 2),
        var(--spool-2, var(--spool, var(--accent))) calc(var(--p, 50%) / 2) var(--p, 50%),
        var(--track) var(--p, 50%) 100%
    );
}

.spool-ring.is-mixed.is-translucent {
    background: conic-gradient(
        from -90deg,
        color-mix(in srgb, var(--spool, var(--accent)) 58%, transparent) 0 calc(var(--p, 50%) / 2),
        color-mix(in srgb, var(--spool-2, var(--spool, var(--accent))) 58%, transparent) calc(var(--p, 50%) / 2) var(--p, 50%),
        color-mix(in srgb, var(--track) 55%, transparent) var(--p, 50%) 100%
    );
}

.count-color-dot.is-mixed,
.log-dot.is-mixed,
.color-preview.is-mixed {
    background: linear-gradient(135deg, var(--spool, var(--accent)) 0 48%, var(--spool-2, var(--spool, var(--accent))) 52% 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4), 0 0 0 1px var(--line);
}

.remaining-editor.is-mixed .percent-slider::-webkit-slider-runnable-track {
    background:
        linear-gradient(90deg, transparent 0 var(--p, 50%), var(--track) var(--p, 50%) 100%),
        linear-gradient(135deg, var(--spool, var(--accent)), var(--spool-2, var(--spool, var(--accent))));
}

.remaining-editor.is-mixed .percent-slider::-moz-range-track {
    background:
        linear-gradient(90deg, transparent 0 var(--p, 50%), var(--track) var(--p, 50%) 100%),
        linear-gradient(135deg, var(--spool, var(--accent)), var(--spool-2, var(--spool, var(--accent))));
}

.remaining-editor.is-mixed.is-translucent .percent-slider::-webkit-slider-runnable-track {
    background:
        linear-gradient(90deg, transparent 0 var(--p, 50%), var(--track) var(--p, 50%) 100%),
        linear-gradient(135deg,
            color-mix(in srgb, var(--spool, var(--accent)) 62%, transparent),
            color-mix(in srgb, var(--spool-2, var(--spool, var(--accent))) 62%, transparent));
}

.remaining-editor.is-mixed.is-translucent .percent-slider::-moz-range-track {
    background:
        linear-gradient(90deg, transparent 0 var(--p, 50%), var(--track) var(--p, 50%) 100%),
        linear-gradient(135deg,
            color-mix(in srgb, var(--spool, var(--accent)) 62%, transparent),
            color-mix(in srgb, var(--spool-2, var(--spool, var(--accent))) 62%, transparent));
}

/* Gold is drawn as a metallic sheen instead of a flat swatch. */
.spool-ring.is-metallic {
    --spool: #D4AF37 !important;
}

.spool-ring.is-metallic::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 248, 190, .62), rgba(255, 255, 255, 0) 34%, rgba(255, 226, 92, .38) 54%, rgba(120, 80, 0, .24) 78%, rgba(255, 248, 190, .3));
    mix-blend-mode: soft-light;
    pointer-events: none;
}

.count-color-dot.is-metallic,
.log-dot.is-metallic,
.color-preview.is-metallic,
.color-swatch.is-metallic,
.mini-dot.is-metallic {
    background: var(--metallic-gold);
}

.count-color-dot.is-metallic,
.log-dot.is-metallic {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 0 0 1px rgba(166, 124, 0, .42);
}

.remaining-editor.is-metallic .percent-slider::-webkit-slider-runnable-track {
    background:
        linear-gradient(90deg, transparent 0 var(--p, 50%), var(--track) var(--p, 50%) 100%),
        var(--metallic-gold);
}

.remaining-editor.is-metallic .percent-slider::-moz-range-track {
    background:
        linear-gradient(90deg, transparent 0 var(--p, 50%), var(--track) var(--p, 50%) 100%),
        var(--metallic-gold);
}

@keyframes sheetUp {
    from {
        opacity: .5;
        transform: translateY(26px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
