:root {
    color-scheme: dark;
    --page: oklch(12.4% 0.026 253);
    --surface: oklch(16.7% 0.028 253);
    --surface-strong: oklch(20.5% 0.032 253);
    --panel: oklch(14.8% 0.027 253);
    --panel-quiet: oklch(18.5% 0.027 253);
    --text: oklch(94.2% 0.012 253);
    --muted: oklch(70% 0.022 253);
    --subtle: oklch(55.5% 0.024 253);
    --line: oklch(27.5% 0.031 253);
    --line-strong: oklch(37% 0.041 253);
    --accent: oklch(62% 0.17 257);
    --accent-hover: oklch(68% 0.17 257);
    --accent-soft: oklch(26% 0.075 257);
    --success: oklch(72% 0.15 158);
    --success-soft: oklch(25% 0.069 158);
    --danger: oklch(68% 0.18 24);
    --danger-soft: oklch(25% 0.07 24);
    --warning: oklch(75% 0.13 82);
    --shadow: 0 18px 48px oklch(6% 0.02 253 / 0.52);
    --shadow-soft: 0 10px 28px oklch(6% 0.02 253 / 0.36);
    --shadow-hairline: 0 1px 0 oklch(96% 0.006 253 / 0.06) inset;
    --radius: 8px;
    --topbar-height: 72px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    letter-spacing: 0;
}

body.main-screen {
    background:
        linear-gradient(180deg, oklch(16% 0.04 253), var(--page) 190px),
        var(--page);
}

body.main-screen {
    height: 100svh;
    overflow: hidden;
}

body.main-screen .topbar {
    position: relative;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
}

.topbar-inner {
    width: min(1760px, calc(100% - 24px));
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

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

button,
input,
select,
textarea {
    font: inherit;
    letter-spacing: 0;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

img {
    display: block;
    max-width: 100%;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--topbar-height);
    padding: 0;
    background: color-mix(in oklch, var(--surface) 88%, var(--page));
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-hairline);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    font-weight: 800;
    font-size: 18px;
}

.brand-lockup img {
    width: 92px;
    height: 52px;
    object-fit: contain;
    border-radius: 7px;
    filter: invert(1) brightness(1.18) contrast(1.05);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link,
.primary-button,
.secondary-button,
.icon-action,
.icon-only,
.side-filter,
.pagination button,
.segment,
.qty-step {
    min-height: 40px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out, box-shadow 160ms ease-out, transform 160ms ease-out;
}

.nav-link {
    position: relative;
    padding: 0 11px;
    color: var(--muted);
    background: var(--panel-quiet);
    border-color: var(--line);
    font-weight: 750;
}

.compact-actions .nav-link {
    width: 40px;
    padding: 0;
}

.compact-actions .nav-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.compact-actions .cart-link {
    width: 54px;
    justify-content: flex-start;
    padding-left: 10px;
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-strong);
    border-color: color-mix(in oklch, var(--accent) 36%, var(--line-strong));
}

.nav-link svg,
.primary-button svg,
.secondary-button svg,
.icon-action svg,
.icon-only svg,
.panel-heading svg,
.qty-step svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.1;
}

.cart-link b {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: oklch(98% 0.012 257);
    font-size: 11px;
}

.flash-stack {
    position: fixed;
    right: 24px;
    top: 86px;
    z-index: 50;
    display: grid;
    gap: 10px;
}

.flash,
.toast {
    max-width: min(420px, calc(100vw - 32px));
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    color: var(--text);
}

.flash.success {
    background: var(--success-soft);
    border-color: color-mix(in oklch, var(--success) 36%, var(--line));
}

.flash.warning {
    background: oklch(24% 0.062 82);
    border-color: color-mix(in oklch, var(--warning) 36%, var(--line));
}

.flash.danger {
    background: var(--danger-soft);
    border-color: color-mix(in oklch, var(--danger) 36%, var(--line));
}

.flash.leaving {
    opacity: 0;
    transform: translateY(-6px);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.auth-page {
    min-height: calc(100vh - var(--topbar-height));
    display: grid;
    place-items: start center;
    padding: 86px 24px 48px;
    background: var(--surface);
}

.auth-panel {
    width: min(424px, 100%);
    display: block;
}

.auth-panel-wide {
    width: min(720px, 100%);
}

.auth-form-shell,
.side-panel,
.filter-box,
.table-surface,
.order-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft), var(--shadow-hairline);
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent);
}

.auth-form-shell {
    padding: 34px 32px 30px;
}

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

.auth-heading h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
}

.auth-heading p:last-child {
    margin: 10px auto 0;
    max-width: 34ch;
    color: var(--muted);
    font-size: 14px;
}

.segmented-control {
    display: flex;
    gap: 0;
    padding: 0;
    margin-bottom: 24px;
    background: transparent;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
}

.segment {
    flex: 1 1 0;
    background: transparent;
    color: var(--muted);
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-weight: 850;
}

.segment.active {
    background: transparent;
    color: var(--accent);
    border-bottom-color: var(--accent);
    box-shadow: none;
}

.auth-form,
.order-form {
    display: grid;
    gap: 14px;
}

.auth-form .primary-button {
    min-height: 48px;
    margin-top: 4px;
}

.form-section-title {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
}

.hidden {
    display: none !important;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-quiet);
    color: var(--text);
    padding: 0 12px;
    outline: none;
}

input[type="file"] {
    padding: 9px 12px;
    color: var(--muted);
}

input[type="file"]::file-selector-button {
    min-height: 28px;
    margin-right: 10px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-weight: 800;
}

textarea {
    min-height: 96px;
    padding-top: 10px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 16%, transparent);
}

.form-grid {
    display: grid;
    gap: 12px;
}

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

.address-grid {
    grid-template-columns: minmax(110px, 0.42fr) minmax(0, 1fr);
}

.address-block {
    display: grid;
    gap: 12px;
}

.postcode-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.42fr) auto;
    gap: 10px;
    align-items: end;
}

.secondary-button.postcode-lookup {
    min-height: 42px;
    padding: 0 14px;
    border-color: color-mix(in oklch, var(--accent) 76%, var(--line));
    background: color-mix(in oklch, var(--accent) 28%, var(--surface));
    color: oklch(94% 0.055 257);
    font-weight: 950;
    box-shadow:
        0 0 0 1px color-mix(in oklch, var(--accent) 22%, transparent) inset,
        0 8px 18px oklch(7% 0.03 253 / 0.22);
}

.secondary-button.postcode-lookup:hover {
    border-color: var(--accent-hover);
    background: color-mix(in oklch, var(--accent) 42%, var(--surface-strong));
    color: var(--text);
}

.secondary-button.postcode-lookup svg {
    color: currentColor;
}

.address-block input[readonly] {
    cursor: default;
    background: color-mix(in oklch, var(--panel-quiet) 72%, var(--surface));
    color: var(--text);
}

.primary-button,
.secondary-button {
    min-height: 42px;
    padding: 0 14px;
    font-weight: 800;
}

.primary-button {
    background: var(--accent);
    color: oklch(98% 0.012 257);
    border-color: var(--accent);
}

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

.secondary-button,
.icon-only {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}

.secondary-button:hover,
.icon-only:hover {
    background: var(--surface-strong);
    border-color: var(--line-strong);
}

.full-width {
    width: 100%;
}

.workspace-grid {
    --pagination-space: 40px;
    width: min(1760px, calc(100% - 24px));
    height: calc(100svh - var(--topbar-height) - 24px);
    margin: 12px auto;
    display: grid;
    grid-template-columns: minmax(150px, 11vw) minmax(0, 1fr) minmax(155px, 12vw);
    gap: 12px;
    align-items: stretch;
    overflow: hidden;
}

.side-panel {
    position: static;
    height: calc(100% - var(--pagination-space));
    min-height: 0;
    padding: 13px;
    overflow: hidden;
}

.panel-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
}

.panel-heading svg {
    color: var(--accent);
    padding: 4px;
    border-radius: 7px;
    background: var(--accent-soft);
}

.left-panel,
.user-rail {
    display: flex;
    flex-direction: column;
    align-self: start;
    padding-bottom: 10px;
}

.main-membership-panel {
    margin-bottom: 10px;
    padding: 12px 13px;
    display: grid;
    gap: 6px;
    border: 1px solid color-mix(in oklch, var(--accent) 54%, var(--line));
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, color-mix(in oklch, var(--accent-soft) 42%, var(--surface)), var(--panel-quiet));
    box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 12%, transparent) inset, var(--shadow-hairline);
}

.main-membership-panel span,
.main-membership-panel small {
    font-size: 11px;
    font-weight: 850;
}

.main-membership-panel span {
    width: fit-content;
    min-height: 22px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    border: 1px solid color-mix(in oklch, var(--accent) 44%, var(--line));
    border-radius: 999px;
    background: color-mix(in oklch, var(--accent-soft) 70%, transparent);
    color: var(--accent-hover);
}

.main-membership-panel strong {
    color: oklch(96% 0.032 257);
    font-size: 24px;
    line-height: 1.1;
    font-weight: 950;
}

.main-membership-panel small {
    color: var(--text);
    opacity: 0.86;
}

.live-order-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius);
    background: var(--panel-quiet);
}

.live-order-stage::before,
.live-order-stage::after {
    display: none;
}

.live-order-track {
    --live-order-card-height: 50px;
    --live-order-gap: 7px;
    height: 100%;
    padding: 7px;
    display: flex;
    flex-direction: column;
    gap: var(--live-order-gap);
    justify-content: flex-end;
    overflow: hidden;
}

.live-order-card {
    height: var(--live-order-card-height);
    min-height: var(--live-order-card-height);
    max-height: var(--live-order-card-height);
    min-width: 0;
    display: grid;
    grid-template-rows: 16px 18px;
    align-content: stretch;
    gap: 4px;
    padding: 5px 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 2px oklch(6% 0.02 253 / 0.18);
}

.live-order-card.feed-empty {
    border-style: dashed;
    background: var(--panel-quiet);
}

.live-order-card.kream-update-card {
    border-color: color-mix(in oklch, var(--accent) 48%, var(--line));
    background: color-mix(in oklch, var(--accent-soft) 30%, var(--surface));
    box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 12%, transparent) inset;
}

.live-order-card.live-order-new {
    animation: live-order-in 180ms ease-out;
}

.trade-meta {
    height: 16px;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    overflow: hidden;
}

.trade-meta span {
    min-width: 0;
    height: 16px;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    color: var(--muted);
    font-size: 11px;
    line-height: 16px;
    font-weight: 850;
}

.trade-meta b {
    height: 16px;
    min-height: 16px;
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 9.5px;
    font-weight: 900;
}

.kream-update-card .trade-meta b {
    background: color-mix(in oklch, var(--accent) 24%, var(--accent-soft));
    color: oklch(94% 0.055 257);
}

.live-order-card strong {
    height: 18px;
    min-width: 0;
    overflow: hidden;
    display: block;
    text-overflow: clip;
    white-space: nowrap;
    font-size: 12px;
    line-height: 18px;
}

.live-order-card p {
    display: none;
}

@keyframes live-order-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quick-filters {
    display: grid;
    gap: 8px;
}

.side-filter {
    width: 100%;
    justify-content: flex-start;
    padding: 0 12px;
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}

.side-filter:hover {
    background: var(--surface-strong);
    color: var(--text);
}

.side-filter.active {
    background: var(--accent-soft);
    color: var(--accent-hover);
    border-color: color-mix(in oklch, var(--accent) 28%, var(--line));
}

.panel-divider {
    height: 1px;
    background: var(--line);
    margin: 18px 0;
}

.metric-list,
.info-stack,
.cart-summary {
    display: grid;
    gap: 12px;
}

.metric-list div,
.info-stack div {
    display: grid;
    gap: 3px;
}

.metric-list span,
.info-stack span,
.cart-summary span,
.bank-box span,
.order-total span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.metric-list strong,
.info-stack strong,
.cart-summary strong {
    font-size: 18px;
}

.catalog-content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) 32px;
    gap: 8px;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.filter-box {
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(128px, 1.2fr) repeat(6, minmax(68px, 0.82fr)) minmax(120px, 1fr) 128px;
    gap: 7px;
    align-items: end;
}

.filter-actions {
    display: flex;
    align-items: end;
    gap: 8px;
}

.filter-actions .primary-button {
    min-width: 78px;
}

.date-filter-control {
    position: relative;
    min-width: 0;
}

.date-filter-display {
    padding-right: 42px;
    cursor: pointer;
}

.date-picker-button {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 38px;
    min-height: calc(100% - 2px);
    padding: 0;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0 var(--radius) var(--radius) 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in oklch, var(--panel-quiet) 76%, var(--surface));
    color: var(--muted);
}

.date-picker-button:hover,
.date-filter-control:focus-within .date-picker-button {
    color: var(--text);
    background: var(--surface-strong);
}

.date-picker-button svg {
    width: 16px;
    height: 16px;
}

.date-calendar {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    width: 288px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: color-mix(in oklch, var(--surface) 94%, var(--panel));
    box-shadow: var(--shadow);
}

.date-calendar-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.date-calendar-head strong {
    text-align: center;
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
}

.date-nav-button,
.date-text-button,
.date-day-button {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
}

.date-nav-button {
    width: 34px;
    min-height: 34px;
    padding: 0;
    border-color: var(--line);
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-quiet);
    color: var(--muted);
}

.date-nav-button svg {
    width: 16px;
    height: 16px;
}

.date-nav-button:hover,
.date-text-button:hover,
.date-day-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-strong);
    color: var(--text);
}

.date-calendar-weekdays,
.date-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.date-calendar-weekdays {
    margin-bottom: 5px;
}

.date-calendar-weekdays span {
    min-height: 22px;
    display: grid;
    place-items: center;
    color: var(--subtle);
    font-size: 11px;
    font-weight: 900;
}

.date-day-button {
    min-width: 0;
    min-height: 31px;
    padding: 0;
    border-radius: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.date-day-button.is-outside {
    color: color-mix(in oklch, var(--subtle) 64%, transparent);
}

.date-day-button.is-today {
    border-color: color-mix(in oklch, var(--accent) 56%, var(--line));
    color: var(--accent-hover);
}

.date-day-button.is-selected {
    border-color: var(--accent);
    background: var(--accent);
    color: oklch(98% 0.01 253);
}

.date-day-button:focus-visible,
.date-nav-button:focus-visible,
.date-text-button:focus-visible {
    outline: none;
    border-color: var(--accent-hover);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent);
}

.date-calendar-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.date-text-button {
    min-height: 30px;
    padding: 0 10px;
    border-color: var(--line);
    border-radius: 7px;
    background: var(--panel);
    color: var(--accent-hover);
    font-size: 12px;
    font-weight: 900;
}

.date-text-button.muted {
    color: var(--muted);
}

.icon-only,
.icon-action {
    width: 42px;
    padding: 0;
}

.table-surface {
    overflow: hidden;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
}

.table-toolbar {
    min-height: 58px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in oklch, var(--surface) 92%, var(--accent-soft));
}

.table-toolbar h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
    font-weight: 850;
}

.toolbar-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-weight: 800;
}

.market-tabs {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.market-tab {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.market-tab:hover {
    border-color: var(--line-strong);
    background: var(--surface-strong);
    color: var(--text);
}

.market-tab.active {
    background: var(--accent-soft);
    border-color: color-mix(in oklch, var(--accent) 56%, var(--line));
    color: var(--text);
    box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 14%, transparent) inset;
}

.toolbar-meta select {
    width: 112px;
}

.fit-mode {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-quiet);
    color: var(--muted);
    font-size: 12px;
}

.table-scroll {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.product-table {
    width: 100%;
    height: 100%;
    border-collapse: collapse;
    min-width: 0;
    table-layout: fixed;
    font-variant-numeric: tabular-nums;
}

.product-table th,
.product-table td {
    height: 52px;
    padding: 0 8px;
    border-bottom: 1px solid var(--line);
    text-align: center;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

.product-table th:not(:last-child),
.product-table td:not(:last-child) {
    box-shadow: inset -1px 0 color-mix(in oklch, var(--line) 38%, transparent);
}

.product-table th {
    background: var(--panel);
    color: var(--subtle);
    font-size: 11px;
    font-weight: 850;
}

.sort-header {
    width: 100%;
    min-height: 28px;
    padding: 0 14px 0 4px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.sort-header::after {
    content: "↕";
    position: absolute;
    right: 2px;
    color: var(--subtle);
    font-size: 10px;
    opacity: 0.65;
}

.sort-header:hover {
    background: var(--panel-quiet);
    color: var(--text);
}

.sort-header.active {
    color: var(--accent-hover);
    background: color-mix(in oklch, var(--accent-soft) 54%, transparent);
}

.sort-header.active.asc::after {
    content: "↑";
    color: var(--accent-hover);
    opacity: 1;
}

.sort-header.active.desc::after {
    content: "↓";
    color: var(--accent-hover);
    opacity: 1;
}

.product-table td {
    color: var(--text);
    background: var(--surface);
}

.product-table tbody tr:hover {
    background: var(--panel-quiet);
}

.product-table tbody tr:hover td {
    background: color-mix(in oklch, var(--surface-strong) 72%, var(--accent-soft));
}

.product-table tbody tr.table-filler-row:hover td {
    background: var(--surface);
}

.table-filler-row td {
    border-bottom-color: transparent;
    box-shadow: none !important;
    color: transparent;
    pointer-events: none;
}

.product-cell {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.product-cell strong,
.product-code-cell strong {
    display: block;
    max-width: 100%;
    font-size: 13px;
    font-weight: 820;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

.product-code-link {
    display: block;
    max-width: 100%;
    color: var(--text);
    cursor: pointer;
}

.product-code-link:hover,
.product-code-link:focus {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.product-cell span,
.product-code-cell span {
    display: block;
    color: var(--subtle);
    font-size: 11px;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

.product-cell span {
    margin-top: 3px;
}

.product-code-cell {
    min-width: 0;
    display: grid;
    gap: 3px;
    justify-items: stretch;
    text-align: left;
}

.product-number {
    display: block;
    font-size: 13px;
    font-weight: 850;
}

.product-badge {
    min-height: 18px;
    margin-top: 4px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
}

.product-badge.new {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.product-badge.hot {
    background: oklch(24% 0.062 82);
    color: var(--warning);
}

.product-badge.soldout {
    background: var(--danger-soft);
    color: var(--danger);
}

.product-thumb {
    width: 36px;
    height: 36px;
    margin: 0 auto;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    color: var(--accent-hover);
    font-weight: 850;
    font-size: 12px;
}

.product-thumb.image-trigger[data-image-url] {
    cursor: zoom-in;
}

.product-thumb.image-trigger[data-image-url]:hover,
.product-thumb.image-trigger[data-image-url]:focus-visible {
    border-color: color-mix(in oklch, var(--accent) 62%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
    outline: none;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-thumb.image-fallback {
    cursor: default;
}

.product-thumb .product-placeholder-image {
    padding: 0;
    background: var(--panel);
}

.category-pill,
.rate-pill,
.status-pill,
.signal-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.signal-pill.buy {
    background: var(--success-soft);
    color: var(--success);
}

.signal-pill.watch {
    background: oklch(24% 0.062 82);
    color: var(--warning);
}

.signal-pill.hold {
    background: var(--panel);
    color: var(--muted);
}

.category-pill {
    background: var(--panel);
    color: var(--muted);
}

.rate-pill.positive,
.money.positive {
    color: var(--success);
}

.rate-pill.positive {
    background: var(--success-soft);
}

.rate-pill.negative,
.money.negative {
    color: var(--danger);
}

.rate-pill.negative {
    background: var(--danger-soft);
}

.rate-pill.neutral {
    background: var(--panel);
    color: var(--muted);
}

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

.money {
    font-weight: 850;
    white-space: nowrap;
}

.numeric-cell,
.product-table .col-buy-price,
.product-table .col-last-price,
.product-table .col-bid-price,
.product-table .col-margin,
.product-table .col-rate,
.product-table .col-volume,
.product-table td.col-buy-price,
.product-table td.col-last-price,
.product-table td.col-bid-price,
.product-table td.col-margin,
.product-table td.col-rate,
.product-table td.col-volume {
    text-align: center;
}

.icon-action {
    background: var(--panel-quiet);
    border-color: var(--line);
    color: var(--text);
    flex: 0 0 auto;
}

.product-table .icon-action {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
}

.product-table .col-action,
.product-table td.col-action {
    width: 48px;
    text-align: center;
    overflow: visible;
    text-overflow: clip;
}

.product-table .col-photo,
.product-table td.col-photo {
    width: 48px;
    text-align: center;
}

.product-table .col-product-no,
.product-table td.col-product-no {
    width: 72px;
}

.product-table .col-style-code,
.product-table td.col-style-code {
    width: 140px;
    text-align: center;
}

.product-table td.col-style-code {
    text-align: left;
    text-overflow: clip;
}

.product-table td.col-style-code .product-code-cell strong {
    color: var(--text);
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
}

.product-table .col-buy-price,
.product-table .col-last-price,
.product-table .col-bid-price,
.product-table .col-margin,
.product-table td.col-buy-price,
.product-table td.col-last-price,
.product-table td.col-bid-price,
.product-table td.col-margin {
    width: 92px;
}

.product-table .col-rate,
.product-table td.col-rate {
    width: 64px;
}

.product-table .col-volume,
.product-table td.col-volume {
    width: 62px;
}

.product-table .col-seven-days,
.product-table td.col-seven-days {
    width: 64px;
    text-align: center;
}

.product-table .col-updated,
.product-table td.col-updated {
    width: 88px;
    text-align: center;
}

.product-table td.col-updated {
    padding: 3px 4px;
    font-size: 11.5px;
    line-height: 1.08;
}

.updated-stamp {
    display: inline-grid;
    gap: 1px;
    justify-items: center;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 780;
    line-height: 1.08;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.updated-stamp span {
    display: block;
}

.mini-chart {
    width: 78px;
    height: 34px;
    display: block;
    margin: 0 auto;
}

.mini-chart path {
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mini-chart.up path {
    stroke: var(--success);
}

.mini-chart.down path {
    stroke: var(--danger);
}

.icon-action:hover {
    background: var(--accent);
    border-color: color-mix(in oklch, var(--accent) 30%, var(--line));
    color: oklch(98% 0.012 257);
}

.icon-action.is-pending {
    background: var(--accent-soft);
    border-color: color-mix(in oklch, var(--accent) 44%, var(--line));
    color: var(--accent-hover);
}

.icon-action.cart-resetting,
.icon-action.cart-resetting:hover {
    background: var(--panel-quiet);
    border-color: var(--line);
    color: var(--text);
}

.empty-cell,
.empty-state {
    padding: 36px;
    text-align: center;
    color: var(--muted);
}

.pagination-bar {
    min-height: 32px;
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.page-range {
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.pagination {
    grid-column: 2;
    display: flex;
    justify-content: center;
    gap: 4px;
    min-height: 32px;
    padding-top: 0;
    overflow: hidden;
}

.pagination button {
    min-width: 30px;
    min-height: 30px;
    padding: 0 9px;
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.pagination button.active {
    background: var(--panel-quiet);
    border-color: var(--line);
    color: var(--text);
}

.pagination button:hover:not(:disabled) {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text);
}

.resource-strip {
    flex: 1 1 auto;
    min-height: 0;
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 12px;
    opacity: 1 !important;
    visibility: visible !important;
}

.resource-link-group {
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(3, auto);
    align-content: end;
    gap: 10px;
}

.resource-link {
    display: block;
    border-radius: var(--radius);
    text-decoration: none;
}

.resource-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.resource-image {
    display: block !important;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-width: 100%;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: hidden;
    border: 1px solid color-mix(in oklch, var(--line) 74%, var(--accent));
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--panel);
    box-shadow: var(--shadow-hairline);
}

.resource-link-image {
    height: auto;
    aspect-ratio: 341 / 130;
    object-fit: cover;
    object-position: center;
    padding: 0;
    border-color: color-mix(in oklch, var(--line) 68%, var(--accent));
    background: color-mix(in oklch, var(--surface) 88%, var(--accent-soft));
}

.image-float-preview {
    position: fixed;
    z-index: 80;
    width: 220px;
    height: 280px;
    padding: 6px;
    border: 1px solid color-mix(in oklch, var(--accent) 38%, var(--line));
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 140ms ease-out, transform 140ms ease-out;
}

.image-float-preview.visible {
    opacity: 1;
    transform: translateY(0);
}

.image-float-preview img {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    object-fit: cover;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 28px;
    background: oklch(8% 0.018 253 / 0.82);
}

.image-modal img {
    max-width: min(860px, calc(100vw - 56px));
    max-height: calc(100vh - 56px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    object-fit: contain;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.image-modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-option-modal {
    position: fixed;
    inset: 0;
    z-index: 88;
    display: grid;
    place-items: center;
    padding: 22px;
    background: oklch(8% 0.018 253 / 0.78);
}

.cart-option-dialog {
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100svh - 44px);
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.cart-option-head h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.cart-option-product {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.cart-option-product strong,
.cart-option-product span {
    display: block;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
}

.cart-option-product span {
    margin-top: 4px;
    color: var(--subtle);
    font-size: 12px;
}

.cart-option-thumb {
    width: 56px;
    height: 56px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-quiet);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--accent-hover);
    font-weight: 850;
}

.cart-option-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-option-list {
    min-height: 0;
    max-height: min(44svh, 420px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.cart-option-list table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.cart-option-list th,
.cart-option-list td {
    padding: 9px 10px;
    border-bottom: 1px solid color-mix(in oklch, var(--line) 82%, transparent);
    text-align: left;
    vertical-align: middle;
}

.cart-option-list th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--panel-quiet);
    color: var(--subtle);
    font-size: 11px;
    font-weight: 900;
}

.cart-option-list th:last-child,
.cart-option-list td:last-child {
    width: 170px;
    text-align: center;
}

.cart-option-list tbody tr:last-child td {
    border-bottom: 0;
}

.cart-option-list tbody tr.has-quantity td {
    background: color-mix(in oklch, var(--accent-soft) 38%, transparent);
}

.cart-option-list tbody tr.is-soldout {
    opacity: 0.55;
}

.cart-option-name strong,
.cart-option-name span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

.cart-option-name strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
}

.cart-option-name span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.cart-option-qty {
    display: grid;
    grid-template-columns: 34px minmax(48px, 1fr) 34px;
    gap: 6px;
    align-items: center;
}

.cart-option-qty .qty-step {
    min-height: 34px;
    padding: 0;
}

.cart-option-count {
    height: 34px;
    padding: 0 6px;
    text-align: center;
    font-weight: 850;
}

.cart-option-summary {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid color-mix(in oklch, var(--accent) 32%, var(--line));
    border-radius: var(--radius);
    background: color-mix(in oklch, var(--accent-soft) 34%, var(--panel));
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
}

.cart-layout {
    width: min(1260px, calc(100% - 36px));
    margin: 24px auto 48px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 18px;
    align-items: start;
}

.cart-items {
    display: grid;
}

.cart-item {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 144px 120px 42px;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.quantity-control {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
    gap: 6px;
    align-items: center;
}

.qty-step {
    width: 38px;
    min-height: 38px;
    background: var(--surface);
    border-color: var(--line-strong);
}

.qty-step:hover {
    background: var(--surface-strong);
}

.qty-input {
    min-height: 38px;
    padding: 0 6px;
    text-align: center;
}

.cart-price {
    text-align: right;
    white-space: nowrap;
}

.order-panel {
    position: sticky;
    top: calc(var(--topbar-height) + 18px);
    padding: 20px;
    display: grid;
    gap: 18px;
}

.order-total {
    display: grid;
    gap: 4px;
}

.order-total strong {
    font-size: 28px;
}

.bank-box {
    display: grid;
    gap: 3px;
    padding: 14px;
    background: var(--accent-soft);
    border: 1px solid color-mix(in oklch, var(--accent) 24%, var(--line));
    border-radius: var(--radius);
}

.bank-box strong {
    font-size: 16px;
}

.bank-box small {
    color: var(--muted);
}

.page-column {
    width: min(1100px, calc(100% - 36px));
    margin: 24px auto 48px;
}

.settings-page {
    width: min(1180px, calc(100% - 36px));
    display: grid;
    gap: 14px;
}

.settings-hero,
.settings-summary,
.settings-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft), var(--shadow-hairline);
}

.settings-hero {
    min-height: 78px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.settings-hero h1 {
    margin: 0;
    font-size: 24px;
}

.settings-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
}

.settings-summary div {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    background: var(--panel);
}

.settings-summary span,
.settings-panel-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.settings-summary strong {
    font-size: 18px;
}

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

.settings-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-panel > label,
.settings-panel > .form-grid,
.settings-panel > .radio-row,
.settings-panel > .setting-toggle-row,
.settings-panel > .pending-box,
.settings-panel > .mini-order-list {
    width: 100%;
}

.settings-panel > .primary-button {
    width: 124px;
    min-height: 40px;
    margin-top: auto;
    align-self: flex-end;
}

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

.settings-panel-head h2 {
    margin: 0;
    font-size: 17px;
}

.settings-panel-head a {
    color: var(--accent-hover);
    font-size: 12px;
    font-weight: 850;
}

.radio-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.radio-row label {
    min-height: 42px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-quiet);
    color: var(--text);
}

.radio-row input {
    width: auto;
    min-height: auto;
}

.setting-toggle-row {
    min-height: 42px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-quiet);
    color: var(--text);
    font-size: 12px;
    font-weight: 760;
}

.setting-toggle-row input {
    width: auto;
    min-height: auto;
}

.pending-box {
    padding: 10px 12px;
    border: 1px solid color-mix(in oklch, var(--warning) 35%, var(--line));
    border-radius: var(--radius);
    background: oklch(24% 0.062 82);
    color: var(--warning);
    font-size: 12px;
    font-weight: 850;
}

.mini-order-list {
    display: grid;
    gap: 8px;
}

.mini-order-list div {
    display: grid;
    gap: 3px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.mini-order-list span {
    color: var(--muted);
    font-size: 12px;
}

.order-history-surface {
    min-height: 520px;
}

.status-pill {
    background: oklch(24% 0.062 82);
    color: var(--warning);
}

.pending-page {
    min-height: calc(100vh - var(--topbar-height));
    display: grid;
    place-items: center;
    padding: 32px 18px;
}

.pending-panel {
    width: min(560px, 100%);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft), var(--shadow-hairline);
}

.pending-panel h1 {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.2;
}

.pending-panel p {
    margin: 0 0 18px;
    color: var(--muted);
}

.pending-summary {
    display: grid;
    gap: 10px;
    margin: 0 0 20px;
}

.pending-summary div {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.pending-summary dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.pending-summary dd {
    margin: 0;
    color: var(--text);
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-screen {
    min-height: 100svh;
}

.admin-layout {
    width: min(1760px, calc(100% - 24px));
    margin: 12px auto 32px;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.admin-sidebar,
.admin-content,
.admin-user-tools,
.admin-table-surface,
.admin-placeholder {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft), var(--shadow-hairline);
}

.admin-sidebar {
    position: sticky;
    top: calc(var(--topbar-height) + 12px);
    padding: 14px;
}

.admin-profile {
    display: grid;
    gap: 3px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.admin-profile span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.admin-profile strong {
    font-size: 18px;
}

.admin-nav {
    display: grid;
    gap: 6px;
}

.admin-nav a {
    min-height: 42px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: var(--text);
    background: var(--panel-quiet);
    border-color: var(--line);
}

.admin-nav svg {
    width: 18px;
    height: 18px;
}

.admin-nav b {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: oklch(98% 0.012 257);
    font-size: 11px;
}

.admin-content {
    min-width: 0;
    padding: 16px;
}

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

.admin-head h1 {
    margin: 0;
    font-size: 22px;
}

.admin-user-tools {
    margin-bottom: 14px;
    padding: 14px;
    display: grid;
    gap: 14px;
}

.admin-membership-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 8px;
}

.admin-membership-summary div {
    min-height: 68px;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.admin-membership-summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.admin-membership-summary strong {
    font-size: 24px;
    line-height: 1;
}

.admin-filter-form {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) repeat(2, minmax(150px, 1fr)) auto;
    gap: 10px;
    align-items: end;
}

.admin-filter-actions,
.membership-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-filter-actions .primary-button,
.admin-filter-actions .secondary-button {
    min-height: 42px;
    padding: 0 12px;
}

.admin-table-surface {
    overflow: hidden;
}

.admin-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    background: var(--panel);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.admin-table td strong,
.admin-table td span,
.admin-table td small {
    display: block;
    max-width: 28ch;
    overflow-wrap: anywhere;
}

.admin-table td span,
.admin-table td small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.admin-file-links,
.admin-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.admin-file-links a,
.admin-file-links button {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
}

.admin-file-links button {
    cursor: pointer;
}

.admin-file-links a:hover,
.admin-file-links button:hover {
    border-color: var(--line-strong);
    background: var(--surface-strong);
}

.admin-row-actions .primary-button,
.admin-row-actions .secondary-button {
    min-height: 34px;
    padding: 0 10px;
}

.admin-user-table {
    min-width: 1240px;
}

.membership-pill {
    width: fit-content;
    min-height: 28px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.membership-normal {
    background: var(--panel);
    color: var(--muted);
}

.membership-pro {
    border-color: color-mix(in oklch, var(--success) 40%, var(--line));
    background: color-mix(in oklch, var(--success-soft) 86%, var(--surface));
    color: var(--success);
}

.membership-form select,
.membership-form input {
    width: 112px;
    min-height: 34px;
}

.membership-form input {
    width: 138px;
}

.membership-form .secondary-button {
    min-height: 34px;
    padding: 0 10px;
}

.admin-placeholder {
    min-height: 320px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 32px;
    text-align: center;
}

.admin-placeholder svg {
    width: 34px;
    height: 34px;
    color: var(--accent-hover);
}

.admin-placeholder h2 {
    margin: 0;
    font-size: 20px;
}

.admin-placeholder p {
    margin: 0;
    color: var(--muted);
}

.admin-attachment-modal {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: grid;
    place-items: center;
    padding: 24px;
    background: oklch(8% 0.018 253 / 0.82);
}

.admin-attachment-dialog {
    width: min(1040px, calc(100vw - 36px));
    max-height: calc(100svh - 48px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.admin-attachment-head {
    min-height: 64px;
    padding: 14px 16px;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in oklch, var(--surface) 88%, var(--panel));
}

.admin-attachment-head h2 {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
}

.admin-attachment-body {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) 340px;
    gap: 0;
}

.admin-attachment-preview {
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 16px;
    display: grid;
    place-items: center;
    background: var(--panel);
    border-right: 1px solid var(--line);
}

.admin-attachment-preview img {
    max-width: 100%;
    max-height: calc(100svh - 156px);
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.admin-attachment-info {
    min-width: 0;
    padding: 18px;
    overflow: auto;
}

.admin-attachment-info h3 {
    margin: 0 0 12px;
    font-size: 17px;
}

.admin-attachment-info dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.admin-attachment-info dl div {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.admin-attachment-info dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.admin-attachment-info dd {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

@media (max-width: 1280px) {
    .workspace-grid {
        grid-template-columns: 200px minmax(0, 1fr);
    }

    .user-rail {
        grid-column: 1 / -1;
        position: static;
        display: grid;
        grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
        align-items: center;
        gap: 18px;
    }

    .user-rail .panel-divider {
        width: 1px;
        height: 100%;
        margin: 0;
    }

    .filter-box {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 920px) {
    .topbar {
        height: auto;
        min-height: var(--topbar-height);
        align-items: flex-start;
        flex-direction: column;
        padding: 10px 16px 12px;
    }

    .top-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .nav-link {
        flex: 0 0 auto;
    }

    .workspace-grid,
    .cart-layout {
        grid-template-columns: 1fr;
        width: min(100% - 24px, 720px);
    }

    .auth-panel {
        width: min(100% - 24px, 424px);
    }

    .side-panel,
    .order-panel {
        position: static;
    }

    .left-panel {
        order: 1;
    }

    .catalog-content {
        order: 2;
    }

    .user-rail {
        order: 3;
        grid-template-columns: 1fr;
    }

    .user-rail .panel-divider {
        width: 100%;
        height: 1px;
    }

    .filter-box {
        grid-template-columns: 1fr 1fr;
    }

    .cart-item {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .cart-price {
        text-align: left;
    }

    .admin-layout {
        grid-template-columns: 1fr;
        width: min(100% - 24px, 900px);
    }

    .admin-sidebar {
        position: static;
    }

    .admin-membership-summary,
    .admin-filter-form {
        grid-template-columns: 1fr;
    }

    .admin-filter-actions {
        justify-content: flex-end;
    }

    .admin-attachment-body {
        grid-template-columns: 1fr;
    }

    .admin-attachment-preview {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .admin-attachment-preview img {
        max-height: 46svh;
    }
}

@media (max-width: 620px) {
    body {
        font-size: 14px;
    }

    .brand-lockup img {
        width: 78px;
        height: 44px;
    }

    .nav-link span {
        display: none;
    }

    .auth-page {
        padding: 20px 12px;
    }

    .auth-form-shell,
    .side-panel,
    .filter-box,
    .table-toolbar,
    .order-panel {
        padding: 16px;
    }

    .form-grid.two,
    .filter-box,
    .postcode-row {
        grid-template-columns: 1fr;
    }

    .settings-panel > .primary-button {
        width: 100%;
        align-self: stretch;
    }

    .date-calendar {
        left: 0;
        right: auto;
        width: min(288px, calc(100vw - 42px));
    }

    .table-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-meta {
        justify-content: space-between;
    }

    .product-cell {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .product-thumb {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 1280px) {
    body.main-screen .topbar-inner {
        width: calc(100% - 16px);
    }

    body.main-screen .workspace-grid {
        width: calc(100% - 16px);
        height: calc(100svh - var(--topbar-height) - 16px);
        margin: 8px auto;
        grid-template-columns: minmax(140px, 12vw) minmax(0, 1fr) minmax(145px, 12vw);
        gap: 8px;
    }

    body.main-screen .user-rail {
        grid-column: auto;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    body.main-screen .filter-box {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    body.main-screen .product-table .col-volume {
        display: none;
    }
}

@media (max-width: 1040px) {
    body.main-screen .workspace-grid {
        grid-template-columns: 118px minmax(0, 1fr) 118px;
    }

    body.main-screen .filter-box {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    body.main-screen .product-table .col-bid-price,
    body.main-screen .product-table .col-volume,
    body.main-screen .product-table .col-seven-days {
        display: none;
    }

    body.main-screen .market-tabs {
        justify-content: flex-start;
    }

    body.main-screen .market-tab {
        padding: 0 8px;
    }

    body.main-screen .resource-image {
        padding: 0;
    }
}

@media (max-width: 920px) {
    body.main-screen .topbar {
        height: var(--topbar-height);
        min-height: var(--topbar-height);
        padding: 0;
    }

    body.main-screen .topbar-inner {
        width: calc(100% - 10px);
    }

    body.main-screen .top-actions {
        width: auto;
        overflow: visible;
        padding-bottom: 0;
    }

    body.main-screen .workspace-grid {
        width: calc(100% - 10px);
        grid-template-columns: 92px minmax(0, 1fr) 92px;
        gap: 5px;
    }

    body.main-screen .side-panel,
    body.main-screen .filter-box,
    body.main-screen .table-toolbar {
        padding: 8px;
    }

    body.main-screen .panel-heading {
        font-size: 12px;
    }

    body.main-screen .panel-heading svg {
        width: 15px;
        height: 15px;
    }

    body.main-screen .metric-list,
    body.main-screen .panel-divider {
        display: none;
    }

    body.main-screen .live-order-track {
        --live-order-card-height: 46px;
        --live-order-gap: 6px;
        padding: 6px;
    }

    body.main-screen .live-order-card {
        grid-template-rows: 15px 17px;
        padding: 5px 7px;
    }

    body.main-screen .live-order-card p {
        display: none;
    }

    body.main-screen .resource-strip {
        gap: 6px;
    }

    body.main-screen .resource-image {
        padding: 0;
    }

    body.main-screen .filter-box {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.main-screen .filter-actions {
        justify-content: flex-end;
    }

    body.main-screen .product-table th,
    body.main-screen .product-table td {
        height: 44px;
        padding: 0 6px;
        font-size: 12px;
    }

    body.main-screen .product-table .col-bid-price,
    body.main-screen .product-table .col-volume,
    body.main-screen .product-table .col-seven-days {
        display: none;
    }

    body.main-screen .product-table .col-photo,
    body.main-screen .product-table td.col-photo {
        width: 42px;
    }

    body.main-screen .product-table .col-product-no,
    body.main-screen .product-table td.col-product-no {
        width: 54px;
    }

    body.main-screen .product-table .col-style-code,
    body.main-screen .product-table td.col-style-code {
        width: 112px;
    }

    body.main-screen .product-table .col-buy-price,
    body.main-screen .product-table .col-last-price,
    body.main-screen .product-table .col-margin,
    body.main-screen .product-table td.col-buy-price,
    body.main-screen .product-table td.col-last-price,
    body.main-screen .product-table td.col-margin {
        width: 88px;
    }

    body.main-screen .product-table .col-rate,
    body.main-screen .product-table td.col-rate {
        width: 58px;
    }

    body.main-screen .product-table .col-action,
    body.main-screen .product-table td.col-action {
        width: 40px;
    }

    body.main-screen .product-table .icon-action {
        width: 30px;
        min-width: 30px;
        min-height: 30px;
    }

    body.main-screen .product-thumb {
        width: 30px;
        height: 30px;
        font-size: 10px;
    }
}

@media (max-width: 700px) {
    body.main-screen .workspace-grid {
        grid-template-columns: 64px minmax(0, 1fr) 64px;
    }

    body.main-screen .brand-lockup img {
        width: 66px;
        height: 38px;
    }

    body.main-screen .nav-link {
        padding: 0 8px;
    }

    body.main-screen .panel-heading span,
    body.main-screen .trade-meta,
    body.main-screen .resource-image span,
    body.main-screen .resource-image strong,
    body.main-screen .resource-image small,
    body.main-screen .product-table .col-last-price,
    body.main-screen .product-table .col-product-no,
    body.main-screen .product-table .col-rate {
        display: none;
    }

    body.main-screen .product-table .col-photo,
    body.main-screen .product-table td.col-photo {
        width: 36px;
    }

    body.main-screen .product-table .col-product-no,
    body.main-screen .product-table td.col-product-no {
        width: 42px;
    }

    body.main-screen .product-table .col-style-code,
    body.main-screen .product-table td.col-style-code {
        width: 94px;
    }

    body.main-screen .product-table .col-buy-price,
    body.main-screen .product-table .col-margin,
    body.main-screen .product-table td.col-buy-price,
    body.main-screen .product-table td.col-margin {
        width: 78px;
    }

    body.main-screen .product-table .col-action,
    body.main-screen .product-table td.col-action {
        width: 40px;
    }

    body.main-screen .product-table .icon-action {
        width: 28px;
        min-width: 28px;
        min-height: 28px;
    }

    body.main-screen .live-order-card {
        grid-template-rows: minmax(0, 1fr);
        align-items: center;
        justify-items: center;
    }

    body.main-screen .live-order-card strong {
        width: 100%;
        text-align: center;
        font-size: 11px;
        line-height: 1.15;
    }

    body.main-screen .resource-image {
        justify-content: center;
        align-items: center;
    }

    body.main-screen .resource-image::before {
        position: static;
    }
}

@media (max-height: 760px) {
    body.main-screen .filter-box {
        padding: 8px;
    }

    body.main-screen label {
        gap: 4px;
        font-size: 11px;
    }

    body.main-screen input,
    body.main-screen select {
        min-height: 34px;
    }

    body.main-screen .primary-button,
    body.main-screen .secondary-button {
        min-height: 34px;
    }

    body.main-screen .table-toolbar {
        min-height: 46px;
        padding: 8px 10px;
    }

    body.main-screen .table-toolbar .eyebrow {
        display: none;
    }

    body.main-screen .table-toolbar h2 {
        font-size: 16px;
    }

    body.main-screen .pagination,
    body.main-screen .pagination-bar,
    body.main-screen .pagination button {
        min-height: 32px;
    }
}

@media (max-width: 1320px), (max-height: 560px) {
    body.main-screen {
        height: auto;
        min-height: 100svh;
        overflow: auto;
    }

    body.main-screen .topbar-inner,
    body.main-screen .workspace-grid {
        width: calc(100% - 16px);
    }

    body.main-screen .workspace-grid {
        height: auto;
        min-height: calc(100svh - var(--topbar-height) - 16px);
        margin: 8px auto 18px;
        grid-template-columns: 1fr;
        gap: 8px;
        overflow: visible;
    }

    body.main-screen .catalog-content {
        order: 1;
        height: calc(100svh - var(--topbar-height) - 16px);
        min-height: 560px;
    }

    body.main-screen .left-panel {
        order: 2;
        height: 260px;
        min-height: 240px;
    }

    body.main-screen .user-rail {
        order: 3;
        height: 230px;
        min-height: 210px;
    }

    body.main-screen .side-panel {
        width: 100%;
        align-self: stretch;
    }

    body.main-screen .resource-strip {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-template-rows: 1fr;
        gap: 8px;
    }

    body.main-screen .resource-link-group {
        display: contents;
    }

    body.main-screen .live-order-stage {
        height: 100%;
    }

    body.main-screen .live-order-card {
        justify-items: stretch;
    }

    body.main-screen .filter-box {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    body.main-screen .product-table th,
    body.main-screen .product-table td {
        height: 44px;
        padding: 0 5px;
        font-size: 11px;
    }

    body.main-screen .product-code-cell strong,
    body.main-screen .product-number,
    body.main-screen .money {
        font-size: 11px;
    }

    body.main-screen .product-code-cell span {
        font-size: 9px;
    }

    body.main-screen .rate-pill {
        min-height: 20px;
        padding: 0 5px;
        font-size: 10px;
    }

    body.main-screen .product-table .col-photo,
    body.main-screen .product-table td.col-photo {
        width: 38px;
        display: table-cell;
    }

    body.main-screen .product-table .col-product-no,
    body.main-screen .product-table td.col-product-no {
        width: 50px;
        display: table-cell;
    }

    body.main-screen .product-table .col-style-code,
    body.main-screen .product-table td.col-style-code {
        width: 106px;
        display: table-cell;
    }

    body.main-screen .product-table .col-buy-price,
    body.main-screen .product-table .col-last-price,
    body.main-screen .product-table .col-bid-price,
    body.main-screen .product-table .col-margin,
    body.main-screen .product-table td.col-buy-price,
    body.main-screen .product-table td.col-last-price,
    body.main-screen .product-table td.col-bid-price,
    body.main-screen .product-table td.col-margin {
        width: 72px;
        display: table-cell;
    }

    body.main-screen .product-table .col-rate,
    body.main-screen .product-table td.col-rate {
        width: 48px;
        display: table-cell;
    }

    body.main-screen .product-table .col-volume,
    body.main-screen .product-table td.col-volume,
    body.main-screen .product-table .col-seven-days,
    body.main-screen .product-table td.col-seven-days {
        width: 42px;
        display: table-cell;
    }

    body.main-screen .product-table .col-updated,
    body.main-screen .product-table td.col-updated {
        width: 72px;
        display: table-cell;
    }

    body.main-screen .product-table td.col-updated {
        padding: 2px;
    }

    body.main-screen .updated-stamp {
        font-size: 10.8px;
        line-height: 1.05;
    }

    body.main-screen .product-table .col-action,
    body.main-screen .product-table td.col-action {
        width: 34px;
        display: table-cell;
    }

    body.main-screen .product-thumb {
        width: 30px;
        height: 30px;
    }

    body.main-screen .product-table .icon-action {
        width: 28px;
        min-width: 28px;
        min-height: 28px;
    }
}

@media (max-width: 720px) {
    body.main-screen .catalog-content {
        min-height: 540px;
    }

    body.main-screen .filter-box {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.main-screen .user-rail {
        height: auto;
    }

    body.main-screen .resource-strip {
        grid-template-columns: 1fr;
        grid-template-rows: 150px 150px auto;
    }

    body.main-screen .resource-link-group {
        display: grid;
        grid-template-rows: repeat(3, auto);
        gap: 10px;
    }

    body.main-screen .product-table th,
    body.main-screen .product-table td {
        height: 40px;
        padding: 0 4px;
        font-size: 10px;
    }

    body.main-screen .product-table .col-product-no,
    body.main-screen .product-table .col-last-price,
    body.main-screen .product-table .col-bid-price,
    body.main-screen .product-table .col-volume,
    body.main-screen .product-table .col-seven-days,
    body.main-screen .product-table .col-updated,
    body.main-screen .product-table td.col-product-no,
    body.main-screen .product-table td.col-last-price,
    body.main-screen .product-table td.col-bid-price,
    body.main-screen .product-table td.col-volume,
    body.main-screen .product-table td.col-seven-days,
    body.main-screen .product-table td.col-updated {
        display: none;
    }

    body.main-screen .product-table .col-photo,
    body.main-screen .product-table td.col-photo {
        width: 34px;
    }

    body.main-screen .product-table .col-style-code,
    body.main-screen .product-table td.col-style-code {
        width: 104px;
    }

    body.main-screen .product-table .col-buy-price,
    body.main-screen .product-table .col-margin,
    body.main-screen .product-table td.col-buy-price,
    body.main-screen .product-table td.col-margin {
        width: 72px;
    }

    body.main-screen .product-table .col-rate,
    body.main-screen .product-table td.col-rate {
        width: 48px;
    }

    body.main-screen .product-table .col-action,
    body.main-screen .product-table td.col-action {
        width: 34px;
    }

    body.main-screen .product-thumb {
        width: 26px;
        height: 26px;
    }

    .image-float-preview {
        display: none;
    }

    body.main-screen .pagination-bar {
        grid-template-columns: auto minmax(0, 1fr);
    }

    body.main-screen .pagination {
        grid-column: 2;
        justify-content: flex-end;
    }
}
