
:root {

    --c-spruce-900: #0B2E22;
    --c-spruce-800: #123F2E;
    --c-spruce-700: #14563C;
    --c-spruce-600: #1B6B48;
    --c-spruce-200: #BFD9CB;
    --c-spruce-100: #DEEBE3;
    --c-spruce-050: #F1F7F3;

    --c-ink-900: #14161A;
    --c-ink-700: #33383F;
    --c-ink-500: #565C66;
    --c-ink-400: #8A9099;
    --c-rule-200: #DADDE1;
    --c-rule-100: #E9EBEE;
    --c-paper: #FFFFFF;
    --c-stone-100: #F4F4F1;
    --c-stone-200: #E8E8E3;

    --c-stop-700: #A32319;


    --bg-page: var(--c-stone-100);
    --bg-surface: var(--c-paper);
    --bg-sunken: var(--c-stone-200);
    --bg-band: var(--c-spruce-050);
    --bg-inverse: var(--c-spruce-900);
    --bg-selected: var(--c-spruce-100);

    --text-primary: var(--c-ink-900);
    --text-secondary: var(--c-ink-700);
    --text-muted: var(--c-ink-500);
    --text-placeholder: var(--c-ink-400);
    --text-inverse: var(--c-paper);
    --text-on-inverse-dim: var(--c-spruce-200);

    --border: var(--c-rule-200);
    --border-subtle: var(--c-rule-100);
    --border-strong: var(--c-ink-400);
    --border-inverse: var(--c-spruce-800);

    --action: var(--c-spruce-700);
    --action-hover: var(--c-spruce-600);
    --action-text: var(--c-paper);
    --link: var(--c-spruce-600);
    --focus: var(--c-spruce-700);
    --danger-fg: var(--c-stop-700);

    --state-success: var(--c-spruce-700);
    --state-failed: var(--c-stop-700);
    --state-pending: var(--c-ink-500);


    --btn-primary-bg: var(--action);
    --btn-primary-bg-hover: var(--action-hover);
    --btn-primary-bg-active: var(--c-spruce-800);
    --btn-primary-text: var(--action-text);

    --btn-quiet-bg: var(--bg-surface);
    --btn-quiet-bg-hover: var(--bg-band);
    --btn-quiet-border: var(--border);
    --btn-quiet-border-hover: var(--action);
    --btn-quiet-text: var(--text-primary);

    --btn-inverse-bg: var(--c-paper);
    --btn-inverse-text: var(--c-spruce-900);
    --btn-inverse-ghost-border: rgba(255, 255, 255, 0.45);

    --field-bg: var(--bg-surface);
    --field-border: var(--border);
    --field-border-hover: var(--border-strong);
    --field-border-focus: var(--focus);
    --field-text: var(--text-primary);
    --field-placeholder: var(--text-placeholder);
    --field-disabled-bg: var(--bg-sunken);

    --card-bg: var(--bg-surface);
    --card-border: var(--border);
    --card-radius: var(--r-2);

    --sheet-bg: var(--bg-surface);
    --sheet-header-bg: var(--bg-band);
    --sheet-rule: var(--border-subtle);

    --nav-bg: var(--bg-surface);
    --nav-border: var(--border);
    --nav-text: var(--text-secondary);
    --nav-text-active: var(--text-primary);

    --band-bg: var(--bg-inverse);
    --band-bg-raised: var(--c-spruce-800);
    --band-text: var(--text-inverse);
    --band-text-dim: var(--text-on-inverse-dim);
    --band-rule: var(--border-inverse);
    --band-rule-raised: var(--c-spruce-700);
    --band-rule-hover: var(--c-spruce-200);
    --band-detail-bg: var(--c-spruce-700);
    --band-focus: var(--c-spruce-200);

    --preset-active-bg: var(--bg-selected);
    --preset-active-border: var(--action);

    --font-display: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-ui: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --fs-xs: 12px;
    --fs-sm: 14px;
    --fs-md: 16px;
    --fs-lg: 20px;
    --fs-xl: 26px;
    --fs-2xl: 34px;
    --fs-3xl: 44px;
    --fs-4xl: 60px;

    --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
    --sp-5: 24px;  --sp-6: 32px;  --sp-7: 48px;  --sp-8: 64px;  --sp-9: 96px;

    --r-0: 0px;    --r-1: 4px;    --r-2: 10px;   --r-3: 16px;

    --el-1: 0 1px 2px rgba(20, 22, 26, .05), 0 1px 3px rgba(20, 22, 26, .05);
    --el-2: 0 2px 4px rgba(20, 22, 26, .05), 0 10px 20px -8px rgba(20, 22, 26, .12);
    --el-3: 0 4px 8px rgba(20, 22, 26, .06), 0 20px 40px -12px rgba(20, 22, 26, .20);

    --measure: 1200px;
    --measure-wizard: 1120px;
    --nav-height: 64px;
    --transition: all 0.18s ease;


    --primary: var(--action);
    --primary-hover: var(--action-hover);
    --primary-light: var(--c-spruce-100);
    --secondary: var(--c-spruce-700);
    --accent: var(--c-spruce-600);
    --danger: var(--c-stop-700);
    --white: var(--c-paper);

    --gray-50: var(--c-stone-100);
    --gray-100: var(--c-rule-100);
    --gray-200: var(--c-rule-200);
    --gray-300: var(--c-rule-200);
    --gray-400: var(--c-ink-400);
    --gray-500: var(--c-ink-500);
    --gray-600: var(--c-ink-500);
    --gray-700: var(--c-ink-700);
    --gray-800: var(--c-ink-900);
    --gray-900: var(--c-ink-900);

    --shadow-sm: var(--el-1);
    --shadow: var(--el-1);
    --shadow-md: var(--el-2);
    --shadow-lg: var(--el-2);
    --shadow-xl: var(--el-3);

    --radius-sm: var(--r-1);
    --radius: var(--r-1);
    --radius-md: var(--r-2);
    --radius-lg: var(--r-2);
    --radius-xl: var(--r-3);
}

@media (max-width: 900px) {
    :root { --fs-4xl: 40px; --fs-3xl: 32px; --fs-2xl: 26px; --fs-xl: 22px; }
}

@media (max-width: 480px) {
    :root { --nav-height: 60px; --fs-4xl: 34px; --sp-9: 56px; --sp-8: 40px; }
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-ui);
    font-size: var(--fs-md);
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'kern' 1;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4, h5, h6 { font-size: var(--fs-md); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: var(--r-1);
}

::selection { background: var(--bg-selected); color: var(--text-primary); }


.display-1 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-4xl); line-height: 1.04; letter-spacing: -0.03em; color: var(--text-primary); }
.display-2 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-3xl); line-height: 1.08; letter-spacing: -0.02em; color: var(--text-primary); }
.display-3 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl); line-height: 1.12; letter-spacing: -0.02em; color: var(--text-primary); }

.lead { font-size: var(--fs-lg); line-height: 1.5; color: var(--text-muted); }

.eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 500;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

.band { padding: var(--sp-9) 0; }
.band--tight { padding: var(--sp-7) 0; }
.band--tint { background: var(--bg-band); }
.band--sunken { background: var(--bg-sunken); }
.band--paper { background: var(--bg-surface); }

.band--inverse { background: var(--band-bg); color: var(--band-text-dim); }
.band--inverse h1, .band--inverse h2, .band--inverse h3,
.band--inverse .display-1, .band--inverse .display-2, .band--inverse .display-3 { color: var(--band-text); }
.band--inverse .eyebrow { color: var(--band-text-dim); }
.band--inverse .lead { color: var(--band-text-dim); }
.band--inverse a:not(.btn) { color: var(--band-text); }
.band--inverse hr, .band--inverse .rule { border-color: var(--band-rule); }

.band--bleed {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: var(--sp-5);
    padding-right: var(--sp-5);
}
.band__inner { max-width: var(--measure); margin: 0 auto; }


.sheet {
    background: var(--sheet-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-2);
    box-shadow: var(--el-2);
    overflow: hidden;
}

.sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--sheet-header-bg);
    border-bottom: 1px solid var(--card-border);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.sheet__body { padding: 0; }

.sheet__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--sheet-rule);
}
.sheet__row:last-child { border-bottom: 0; }

.sheet__key {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.sheet__val {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}
.sheet__val--unset { color: var(--text-placeholder); }

.sheet__foot {
    padding: var(--sp-3) var(--sp-4);
    background: var(--sheet-header-bg);
    border-top: 1px solid var(--card-border);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: var(--sp-2);
    vertical-align: middle;
    background: var(--state-pending);
}
.dot--success { background: var(--state-success); }
.dot--failed  { background: var(--state-failed); }
.dot--pending { background: var(--state-pending); }

.status--success { color: var(--state-success); }
.status--failed  { color: var(--state-failed); }
.status--pending { color: var(--state-pending); }

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--el-1);
}
.card--flat { box-shadow: none; }
.card--lifted { box-shadow: var(--el-2); }
.card--pad { padding: var(--sp-6); }

.rule { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }

.chip {
    display: inline-block;
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--r-1);
    background: var(--bg-band);
    border: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.chip--filled {
    background: var(--bg-inverse);
    border-color: var(--bg-inverse);
    color: var(--text-inverse);
}
.chip--selected {
    background: var(--bg-selected);
    border-color: var(--action);
    color: var(--c-spruce-900);
}


.panel-inverse {
    background: var(--band-bg);
    color: var(--band-text-dim);
    border: 1px solid var(--band-rule);
    border-radius: var(--r-2);
    padding: var(--sp-6);
}
.panel-inverse h1, .panel-inverse h2, .panel-inverse h3, .panel-inverse h4 { color: var(--band-text); }
.panel-inverse .eyebrow { color: var(--band-text-dim); }
.panel-inverse .num, .panel-inverse strong { color: var(--band-text); }
.panel-inverse a:not(.btn) { color: var(--band-text); }
.panel-inverse hr, .panel-inverse .rule { border-color: var(--band-rule); }
.panel-inverse__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--band-rule);
}
.panel-inverse__row:last-child { border-bottom: 0; }
.panel-inverse__total {
    margin-top: var(--sp-3);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--band-rule);
    font-size: var(--fs-lg);
    color: var(--band-text);
}

.strip-inverse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-5);
    background: var(--band-bg);
    color: var(--band-text);
    border-radius: var(--r-2) var(--r-2) 0 0;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.strip-inverse .num { color: var(--band-text); letter-spacing: 0; }

.canvas-inverse {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-6);
    background: var(--band-bg);
    border: 1px solid var(--band-rule);
    border-radius: var(--r-2);
}
.canvas-inverse__label {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--band-text);
}

.row-selected {
    background: var(--bg-selected);
    box-shadow: inset 3px 0 0 var(--action);
}


.navbar-wrapper {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
}

.navbar {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--sp-5);
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-5);
}

.logo-link {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-lg);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}
.logo-link:hover { text-decoration: none; color: var(--text-primary); }

.logo-image { height: 30px; width: auto; }

.logo-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-1);
    background: var(--c-spruce-900);
    color: var(--text-inverse);
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: 700;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    list-style: none;
    margin: 0 auto 0 var(--sp-6);
}

.nav-link {
    position: relative;
    display: inline-block;
    padding: var(--sp-2) 0;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--nav-text);
    text-decoration: none;
    transition: var(--transition);
}
.nav-link:hover { color: var(--nav-text-active); text-decoration: none; }

.nav-link.active { color: var(--nav-text-active); font-weight: 600; }
.nav-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--action);
}

.user-section {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.credits-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-1);
    background: var(--bg-band);
    border: 1px solid var(--c-spruce-100);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--c-spruce-700);
    white-space: nowrap;
    text-decoration: none;
}
.credits-badge:hover { border-color: var(--action); text-decoration: none; }
.credits-badge i { font-size: var(--fs-xs); }

.user-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-1);
    background: var(--c-spruce-900);
    color: var(--text-inverse);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
}
.user-avatar:hover { background: var(--c-spruce-800); text-decoration: none; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.navbar-wrapper--app {
    --nav-bg: var(--bg-inverse);
    --nav-border: var(--border-inverse);
    --nav-text: var(--text-on-inverse-dim);
    --nav-text-active: var(--text-inverse);
}
.navbar-wrapper--app .logo-link,
.navbar-wrapper--app .logo-link:hover { color: var(--text-inverse); }
.navbar-wrapper--app .logo-icon {
    background: var(--band-bg-raised);
    color: var(--text-inverse);
}
.navbar-wrapper--app .nav-link.active::after { background: var(--text-inverse); }
.navbar-wrapper--app .user-avatar { background: var(--band-bg-raised); }
.navbar-wrapper--app .user-avatar:hover { background: var(--action); }
.navbar-wrapper--app .mobile-toggle {
    background: var(--band-bg-raised);
    border-color: var(--band-rule);
}
.navbar-wrapper--app .mobile-toggle:hover { border-color: var(--text-inverse); }
.navbar-wrapper--app .hamburger span { background: var(--text-inverse); }


.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 44px;
    padding: var(--sp-3) var(--sp-5);
    border: 1px solid transparent;
    border-radius: var(--r-1);
    font-family: var(--font-ui);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
}
.btn:hover { text-decoration: none; }
.btn:disabled,
.btn.is-disabled {
    background: var(--field-disabled-bg);
    border-color: var(--border);
    color: var(--text-placeholder);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-lg { min-height: 48px; padding: var(--sp-3) var(--sp-6); font-size: var(--fs-md); }
.btn-sm { min-height: 36px; padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); }
.btn-block { width: 100%; }

.btn-primary {
    background: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}
.btn-primary:hover {
    background: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
    color: var(--btn-primary-text);
}
.btn-primary:active {
    background: var(--btn-primary-bg-active);
    border-color: var(--btn-primary-bg-active);
}

.btn-outline {
    background: var(--btn-quiet-bg);
    border-color: var(--btn-quiet-border);
    color: var(--btn-quiet-text);
}
.btn-outline:hover,
.btn-secondary:hover {
    background: var(--btn-quiet-bg-hover);
    border-color: var(--btn-quiet-border-hover);
    color: var(--btn-quiet-text);
}
.btn-outline:active,
.btn-secondary:active { background: var(--bg-selected); }

.btn-inverse {
    background: var(--btn-inverse-bg);
    border-color: var(--btn-inverse-bg);
    color: var(--btn-inverse-text);
}
.btn-inverse:hover { background: var(--c-spruce-050); color: var(--btn-inverse-text); }

.btn-ghost-inverse {
    background: transparent;
    border-color: var(--btn-inverse-ghost-border);
    color: var(--text-inverse);
}
.btn-ghost-inverse:hover { background: var(--c-spruce-800); border-color: var(--c-paper); color: var(--text-inverse); }

.btn-danger {
    background: var(--c-stop-700);
    border-color: var(--c-stop-700);
    color: var(--c-paper);
}
.btn-danger:hover { background: var(--c-stop-700); border-color: var(--c-stop-700); color: var(--c-paper); }



.form-label,
label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--sp-2);
}

.form-control,
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    min-height: 44px;
    padding: var(--sp-3);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--r-1);
    font-family: var(--font-ui);
    font-size: var(--fs-md);
    color: var(--field-text);
    transition: var(--transition);
}
.form-control:hover,
.form-input:hover,
.form-select:hover,
.form-textarea:hover { border-color: var(--field-border-hover); }

.form-control:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: 2px solid var(--field-border-focus);
    outline-offset: 2px;
    border-color: var(--field-border-focus);
}

.form-control::placeholder,
.form-input::placeholder,
.form-textarea::placeholder { color: var(--field-placeholder); }

.form-control:disabled,
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled { background: var(--field-disabled-bg); color: var(--text-muted); cursor: not-allowed; }

.form-hint { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-2); }
.form-error { font-size: var(--fs-sm); color: var(--danger-fg); margin-top: var(--sp-2); }
.is-invalid { border-color: var(--danger-fg) !important; }

.form-input.num, .form-control.num { font-family: var(--font-mono); }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.form-group { margin-bottom: var(--sp-5); }
@media (max-width: 900px) {
    .form-row { grid-template-columns: 1fr; }
}


.mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-1);
    cursor: pointer;
}
.mobile-toggle:hover { border-color: var(--border-strong); }

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 18px;
    height: 14px;
}
.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

.mobile-toggle.active .hamburger { gap: 0; }
.mobile-toggle.active .hamburger span:nth-child(1) { transform: translateY(2px) rotate(45deg); }
.mobile-toggle.active .hamburger span:nth-child(2) { opacity: 0; }
.mobile-toggle.active .hamburger span:nth-child(3) { transform: translateY(-2px) rotate(-45deg); }

.mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(20, 22, 26, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}
.mobile-backdrop.active { opacity: 1; visibility: visible; }

body.menu-open { overflow: hidden; }

.mobile-menu-outer {
    position: fixed;
    top: var(--nav-height);
    right: 0;
    bottom: 0;
    z-index: 999;
    width: min(360px, 88vw);
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--el-3);
    transform: translateX(101%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s ease;
}
.mobile-menu-outer.active { transform: translateX(0); visibility: visible; }

.mobile-menu-inner {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.mobile-menu-inner::-webkit-scrollbar { width: 0; height: 0; display: none; }

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: var(--sp-5);
}

.mm-header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid var(--border);
}

.mm-avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-1);
    background: var(--c-spruce-900);
    color: var(--text-inverse);
    font-size: var(--fs-lg);
    font-weight: 600;
}

.mm-user-info { min-width: 0; }
.mm-user-name { font-weight: 600; font-size: var(--fs-md); color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-user-email { font-size: var(--fs-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mm-credits {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin: var(--sp-5) 0;
    padding: var(--sp-4);
    border: 1px solid var(--c-spruce-100);
    border-radius: var(--r-2);
    background: var(--bg-band);
}

.mm-credits-info {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--c-spruce-700);
}
.mm-credits-info i { font-size: var(--fs-sm); color: var(--c-spruce-600); }

.mm-add-btn {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-1);
    background: var(--action);
    color: var(--action-text);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.mm-add-btn:hover { background: var(--action-hover); text-decoration: none; }

.mm-nav { display: flex; flex-direction: column; }

.mm-section-title {
    margin: var(--sp-5) 0 var(--sp-2);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.mm-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 48px;
    padding: var(--sp-3);
    border-radius: var(--r-1);
    font-size: var(--fs-md);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}
.mm-link i { width: 20px; font-size: var(--fs-sm); color: var(--text-muted); text-align: center; }
.mm-link.active { background: var(--bg-selected); color: var(--c-spruce-900); font-weight: 600; }
.mm-link.active i { color: var(--c-spruce-700); }

@media (hover: hover) {
    .mm-link:hover { background: var(--bg-band); color: var(--text-primary); text-decoration: none; }
}

.mm-footer {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-top: var(--sp-6);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--border-subtle);
}
.mm-footer .btn { width: 100%; }

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 44px;
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--c-rule-200);
    border-radius: var(--r-1);
    background: var(--bg-surface);
    color: var(--danger-fg);
    font-family: var(--font-ui);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}
.btn-logout:hover {
    border-color: var(--danger-fg);
    background: var(--bg-page);
    color: var(--danger-fg);
    text-decoration: none;
}

.mm-guest-header {
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
}

.mm-guest-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: var(--sp-3);
    border-radius: var(--r-1);
    background: var(--c-spruce-900);
    color: var(--text-inverse);
    font-size: var(--fs-lg);
}

.mm-guest-title {
    margin: 0 0 var(--sp-1);
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.mm-guest-subtitle {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.main-wrapper {
    min-height: calc(100vh - var(--nav-height));
    padding: var(--sp-7) 0 var(--sp-8);
}

.container {
    width: 100%;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--sp-5);
}

@media (max-width: 768px) {
    .nav-menu { display: none; }
    .mobile-toggle { display: flex; }

    .navbar { padding: 0 var(--sp-4); }
    .user-section .credits-badge,
    .user-section .user-avatar,
    .user-section .btn { display: none; }

    .main-wrapper { padding: var(--sp-6) 0 var(--sp-7); }
    .container { padding: 0 var(--sp-4); }

    .desktop-only { display: none !important; }
}

@media (max-width: 480px) {
    .container { padding: 0 var(--sp-4); }
    .logo-link { font-size: var(--fs-md); }
    .logo-image, .logo-icon { width: 28px; height: 28px; }
    .main-wrapper { padding: var(--sp-5) 0 var(--sp-6); }
    .mobile-menu-outer { width: 100%; }
}

@media (max-width: 360px) {
    .navbar { padding: 0 var(--sp-3); }
    .container { padding: 0 var(--sp-3); }
    .mobile-menu-content { padding: var(--sp-4); }
}

.text-center { text-align: center; }

.mt-1 { margin-top: var(--sp-2); }
.mt-2 { margin-top: var(--sp-4); }
.mt-3 { margin-top: var(--sp-5); }
.mt-4 { margin-top: var(--sp-6); }

.mb-1 { margin-bottom: var(--sp-2); }
.mb-2 { margin-bottom: var(--sp-4); }
.mb-3 { margin-bottom: var(--sp-5); }
.mb-4 { margin-bottom: var(--sp-6); }

.d-none { display: none; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }

.gap-1 { gap: var(--sp-2); }
.gap-2 { gap: var(--sp-4); }
.gap-3 { gap: var(--sp-5); }

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

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    position: absolute;
    z-index: 1100;
    top: var(--sp-3);
    left: var(--sp-3);
    width: auto;
    height: auto;
    margin: 0;
    padding: var(--sp-3) var(--sp-4);
    clip: auto;
    overflow: visible;
    background: var(--bg-surface);
    border: 1px solid var(--action);
    border-radius: var(--r-1);
    color: var(--action);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--el-2);
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--sp-5);
}
.stat {
    padding-left: var(--sp-5);
    border-left: 1px solid var(--border);
}
.stat:first-child {
    padding-left: 0;
    border-left: 0;
}
.stat__value {
    display: block;
    font-size: var(--fs-2xl);
    line-height: 1.05;
    color: var(--text-primary);
}
.stat__label {
    display: block;
    margin-top: var(--sp-2);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.stat .eyebrow { margin-top: var(--sp-2); }

@media (max-width: 640px) {
    .stat-row { gap: var(--sp-4); }
    .stat,
    .stat:first-child {
        padding-left: 0;
        border-left: 0;
    }
}

.data-grid-wrap { width: 100%; overflow-x: auto; }

.data-grid { width: 100%; border-collapse: collapse; }

.data-grid th {
    text-align: left;
    padding: var(--sp-3) var(--sp-5);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-grid td {
    padding: var(--sp-4) var(--sp-5);
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}
.data-grid tr:last-child td { border-bottom: 0; }
.data-grid tbody tr:hover td { background: var(--bg-band); }


.data-grid .cell-num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.data-grid .cell-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; white-space: nowrap; }

@media (max-width: 768px) {
    .data-grid, .data-grid tbody { display: block; }
    .data-grid thead { display: none; }
    .data-grid tr {
        display: block;
        padding: var(--sp-4) var(--sp-5);
        border-bottom: 1px solid var(--border);
    }
    .data-grid tr:last-child { border-bottom: 0; }
    .data-grid td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--sp-4);
        padding: var(--sp-2) 0;
        border-bottom: 0;
    }
    .data-grid tbody tr:hover td { background: transparent; }
    .data-grid td::before {
        content: attr(data-label);
        font-family: var(--font-mono);
        font-size: var(--fs-xs);
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-muted);
    }
    .data-grid .cell-num,
    .data-grid .cell-actions { justify-content: space-between; text-align: left; }
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-bottom: var(--sp-6);
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 var(--sp-3);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-1);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}
.page-btn:hover { border-color: var(--border-strong); color: var(--text-primary); text-decoration: none; }
.page-btn.active { background: var(--action); border-color: var(--action); color: var(--action-text); }
.page-btn.is-disabled { color: var(--text-placeholder); cursor: default; }
.page-gap {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    padding: 0 var(--sp-1);
}

.admin-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: var(--sp-6);
    align-items: start;
}

.admin-rail {
    position: sticky;
    top: calc(var(--nav-height) + var(--sp-4));
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: var(--sp-4);
}
.admin-rail__group + .admin-rail__group { margin-top: var(--sp-5); }
.admin-rail__label {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: var(--sp-2);
}
.admin-rail__link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 44px;
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid transparent;
    border-radius: var(--r-1);
    font-family: var(--font-ui);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}
.admin-rail__link i { width: 1rem; text-align: center; color: var(--text-secondary); }
.admin-rail__link.active {
    background: var(--bg-selected);
    border-color: var(--action);
    box-shadow: inset 3px 0 0 var(--action);
    color: var(--text-primary);
    font-weight: 600;
}
.admin-rail__link.active i { color: var(--action); }

@media (hover: hover) {
    .admin-rail__link:hover { background: var(--bg-sunken); color: var(--text-primary); text-decoration: none; }
}

@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-rail { position: static; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stagger-children > * { animation: slideUp 0.24s ease both; }
.stagger-children > :nth-child(2) { animation-delay: 0.04s; }
.stagger-children > :nth-child(3) { animation-delay: 0.08s; }
.stagger-children > :nth-child(4) { animation-delay: 0.12s; }
.stagger-children > :nth-child(5) { animation-delay: 0.16s; }
.stagger-children > :nth-child(6) { animation-delay: 0.20s; }
.stagger-children > :nth-child(n + 7) { animation-delay: 0.24s; }

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

/* Ported from Rare UI (https://rareui.com) — Copyright (c) 2026 Swami Malode,
   MIT + Commons Clause + Attribution. Consumed by assets/rare-counter.js on
   dashboard, builds and orders. The wheel inherits font, size, line-height and
   tabular figures from its host (.stat__value.num), so the box does not change. */
.rare-counter {
    display: inline-flex;
    vertical-align: top;
    white-space: nowrap;
    user-select: none;
}
.rare-counter__digit {
    position: relative;
    overflow: hidden;
}
.rare-counter__sizer { visibility: hidden; }
.rare-counter__wheel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.rare-counter__wheel > span {
    display: block;
    text-align: center;
}
@media (prefers-reduced-motion: reduce) {
    .rare-counter__wheel { transition: none; }
}

/* Ported from Rare UI (https://rareui.com) — Copyright (c) 2026 Swami Malode, MIT + Commons Clause + Attribution
   Icon-only nav link in includes/header.php. The 44px hit box is pulled back
   with negative inline margin so only the glyph occupies layout width: the
   .nav-menu gap between the bell and its neighbours stays identical to every
   other nav item. No count badge: there is no unread concept in this product. */
.nav-bell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin-inline: calc((var(--fs-md) - 44px) / 2);
    font-size: var(--fs-md);
    line-height: 1;
    border-radius: var(--r-1);
    vertical-align: middle;
}
.nav-bell:focus-visible { outline-color: var(--band-focus); }
.nav-bell.active::after {
    left: var(--sp-3);
    right: var(--sp-3);
    bottom: var(--sp-1);
}

/* Ported from Rare UI (https://rareui.com) - Copyright (c) 2026 Swami Malode.
   Built by assets/rare-scroll-progress.js; nothing renders without JS.
   Fixed, so it never shifts page layout. Tokens only; no pill, no blur. */
.rsp-target { scroll-margin-top: calc(var(--nav-height) + var(--sp-4)); }

.rsp {
    position: fixed;
    right: calc(var(--sp-4) + env(safe-area-inset-right, 0px));
    bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--sp-2);
    max-width: calc(100vw - (2 * var(--sp-4)));
    transition: opacity 0.18s ease, visibility 0.18s ease;
}
.rsp--away { opacity: 0; visibility: hidden; }

.rsp__btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    min-width: 44px;
    min-height: 44px;
    max-width: 18rem;
    padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--el-2);
    font: 500 var(--fs-sm)/1.2 var(--font-ui);
    cursor: pointer;
    transition: border-color 0.18s ease;
}
.rsp__btn:hover { border-color: var(--action); }
.rsp__ring { width: 20px; height: 20px; flex-shrink: 0; transform: rotate(-90deg); }
.rsp__track,
.rsp__bar { fill: none; stroke-width: 2.5; }
.rsp__track { stroke: var(--border); }
.rsp__bar { stroke: var(--action); stroke-linecap: round; }
.rsp__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rsp__menu {
    width: min(20rem, calc(100vw - (2 * var(--sp-4))));
    max-height: calc(100vh - var(--nav-height) - 44px - var(--sp-7));
    max-height: calc(100dvh - var(--nav-height) - 44px - var(--sp-7));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--sp-2);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    background: var(--bg-surface);
    box-shadow: var(--el-3);
    animation: slideUp 0.24s ease both;
}
.rsp__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}
.rsp__link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 44px;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-2);
    color: var(--text-muted);
    font: 500 var(--fs-sm)/1.3 var(--font-ui);
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease;
}
.rsp__link:hover { background: var(--bg-band); color: var(--text-primary); }
.rsp__link[aria-current] { background: var(--bg-selected); color: var(--text-primary); }
.rsp__dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--border-strong);
}
.rsp__link[aria-current] .rsp__dot { background: var(--action); }

@media (min-width: 768px) {
    .rsp {
        right: calc(var(--sp-5) + env(safe-area-inset-right, 0px));
        bottom: calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
    }
}
@media (max-width: 480px) {
    .rsp__label { display: none; }
    .rsp__btn { width: 44px; height: 44px; padding: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .rsp__menu { animation: none; }
    .rsp, .rsp__btn, .rsp__link { transition: none; }
}
