@import url("/css/theme-modern-860967c9610d0423c0065e2b0f522985.css");

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --surface-subtle: #f1f5f9;
    --surface-raised: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --muted-strong: #334155;
    --accent: #0f766e;
    --brand: var(--accent);
    --accent-strong: #0d5f58;
    --accent-ink: #0b4b46;
    --accent-soft: rgba(15, 118, 110, 0.08);
    --accent-softer: rgba(15, 118, 110, 0.04);
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --success: #15803d;
    --danger: #dc2626;
    --danger-strong: #b91c1c;
    --warning: #b45309;
    --warning-strong: #92400e;
    --info: #2563eb;
    --theme-sales: #0f766e;
    --theme-ops: #2563eb;
    --theme-service: #ea580c;
    --theme-finance: #16a34a;
    --theme-system: #475569;
    --text: var(--ink);
    --surface-muted: var(--surface-subtle);
    --paper: var(--surface);
    --paper-strong: var(--surface-strong);
    --paper-soft: var(--surface-subtle);
    --gold: var(--accent);
    --gold-deep: var(--accent-strong);
    --green: var(--success);
    --green-soft: rgba(21, 128, 61, 0.08);
    --red: var(--danger);
    --red-soft: rgba(220, 38, 38, 0.08);
    --blue: var(--accent);
    --blue-soft: var(--accent-soft);
    --amber-soft: rgba(180, 83, 9, 0.08);
    --shadow: var(--shadow-sm);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-soft: var(--shadow-sm);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --focus-ring: 0 0 0 3px rgba(15, 118, 110, 0.18);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    min-height: 100vh;
    background: var(--bg);
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

a,
code,
pre,
.card,
.table-card,
.hero,
.filterbar {
    overflow-wrap: anywhere;
    max-width: 100%;
}

.mobile-filter-disclosure > summary {
    display: none;
}

.mobile-filter-disclosure > .filterbar {
    margin: 0;
}

@media (max-width: 680px) {
    .mobile-filter-disclosure {
        display: grid;
        gap: 8px;
    }

    .mobile-filter-disclosure > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 48px;
        padding: 10px 14px;
        border: 1px solid var(--line);
        border-radius: 16px;
        background: var(--surface);
        box-shadow: var(--shadow-sm);
        cursor: pointer;
        list-style: none;
        font-weight: 800;
    }

    .mobile-filter-disclosure > summary::-webkit-details-marker {
        display: none;
    }

    .mobile-filter-disclosure > summary::after {
        content: "+";
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        flex: 0 0 auto;
        border-radius: 50%;
        background: var(--surface-muted);
        color: var(--muted);
        font-size: 1rem;
    }

    .mobile-filter-disclosure[open] > summary::after {
        content: "−";
    }

    .mobile-filter-disclosure > summary small {
        display: none;
    }

    .mobile-filter-disclosure > .filterbar {
        margin-top: 2px;
    }
}

.money,
.number,
.amount,
.numeric-token,
.meta-token,
.badge,
.cell-nowrap,
.cell-date,
.cell-money,
.cell-number,
.breakdown-value,
.expense-donut-amount,
.expense-category-amount,
.cashflow-card strong,
.stat strong,
.metric strong,
.mini-box strong,
.kv strong,
.pending-suggestion-card strong,
.pending-component-suggestion strong,
td.money,
td.number,
td.cell-money,
td.cell-number,
th.money,
th.number,
th.cell-money,
th.cell-number {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    font-variant-numeric: tabular-nums;
}

td.money,
td.number,
td.cell-money,
td.cell-number,
th.money,
th.number,
th.cell-money,
th.cell-number {
    display: table-cell;
}

.numeric-token,
.meta-token {
    width: fit-content;
}

main {
    width: min(1320px, calc(100% - 32px));
    margin: 20px auto 36px;
    display: grid;
    gap: 20px;
    min-width: 0;
}

a {
    color: inherit;
}

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

.brand {
    display: grid;
    gap: 4px;
}

.brand strong {
    font-size: 1.35rem;
}

.brand span,
.muted {
    color: var(--muted);
}

.notice {
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin: 0;
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 16%, var(--line));
    font-weight: 700;
    line-height: 1.45;
}

.notice.error {
    background: color-mix(in srgb, var(--danger) 12%, var(--surface));
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 14%, var(--line));
}

.notice.warn,
.notice.warning {
    background: color-mix(in srgb, var(--warning) 12%, var(--surface));
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 18%, var(--line));
}

.notice.info {
    background: color-mix(in srgb, var(--info) 10%, var(--surface));
    color: var(--info);
    border-color: color-mix(in srgb, var(--info) 16%, var(--line));
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav a,
.button,
button {
    border: 1px solid var(--line);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-weight: 550;
    font-size: 0.88rem;
    background: var(--surface-strong);
    color: var(--ink);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.nav a.active,
.button.primary,
button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 1px 2px 0 rgba(15, 118, 110, 0.2);
}

.nav a:hover,
.button:hover,
button:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.button.secondary,
button.secondary {
    background: var(--surface-subtle);
    border-color: var(--line);
    color: var(--muted-strong);
}

.button.disabled,
button:disabled {
    cursor: default;
    opacity: 0.55;
    background: color-mix(in srgb, var(--surface-strong) 55%, transparent);
    color: var(--muted);
    pointer-events: none;
}

.page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    text-decoration: none;
    font-weight: 550;
    font-size: 0.86rem;
    color: var(--muted-strong);
    box-shadow: var(--shadow-sm);
    transition: all 120ms ease;
}

.page-tab:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.page-tab.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.hero,
.card,
.filterbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    backdrop-filter: none;
    min-width: 0;
}

.hero {
    position: relative;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    background: var(--surface);
}

.hero::before {
    display: none;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2vw, 1.85rem);
    line-height: 1.18;
    max-width: 900px;
    letter-spacing: -0.025em;
    font-weight: 650;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.stat,
.card {
    padding: 16px 18px;
}

.card > h2,
.card > h3,
.table-card > h2 {
    margin: 0 0 12px;
    letter-spacing: -0.018em;
    font-weight: 650;
}

.stat {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.stat::before {
    display: none;
}

.stat strong {
    display: block;
    margin-top: 6px;
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.025em;
}

.stat span:first-child,
.stat small:first-child {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.section-header h2,
.section-header p {
    margin-top: 0;
}

.eyebrow {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.miner-dashboard {
    display: grid;
    grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.6fr);
    gap: 14px;
    margin-top: 16px;
}

.miner-primary-card {
    min-height: 100%;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background:
            radial-gradient(circle at top right, color-mix(in srgb, var(--info) 16%, transparent), transparent 42%),
            linear-gradient(145deg, var(--surface-strong), var(--surface-raised));
}

.miner-primary-card strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(2.3rem, 5vw, 4.2rem);
    line-height: 0.9;
    letter-spacing: -0.05em;
}

.miner-primary-card p {
    color: var(--muted);
}

.miner-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.miner-health {
    display: grid;
    grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.6fr);
    gap: 14px;
    margin-top: 14px;
}

.miner-rate-panel,
.miner-detail-grid > div {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-strong);
}

.miner-rate-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-weight: 900;
}

.miner-rate-bar {
    display: flex;
    height: 14px;
    overflow: hidden;
    margin: 16px 0 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.miner-rate-bar span {
    display: block;
    min-width: 0;
}

.miner-rate-bar .ok,
.miner-legend .ok {
    background: var(--success);
}

.miner-rate-bar .warn,
.miner-legend .warn {
    background: var(--warning);
}

.miner-rate-bar .danger,
.miner-legend .danger {
    background: var(--danger);
}

.miner-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: 0.86rem;
}

.miner-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 999px;
}

.miner-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 12px;
}

.miner-detail-grid strong,
.miner-detail-grid small {
    display: block;
}

.miner-detail-grid strong {
    margin-top: 6px;
    font-size: 1.05rem;
}

.miner-detail-grid small {
    margin-top: 4px;
    color: var(--muted);
}

.miner-html-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.miner-html-panel h3 {
    margin: 0 0 6px;
}

@media (max-width: 900px) {
    .miner-dashboard,
    .miner-health {
        grid-template-columns: 1fr;
    }

    .miner-metric-grid,
    .miner-detail-grid {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }
}

@media (max-width: 620px) {
    .miner-metric-grid,
    .miner-detail-grid {
        grid-template-columns: 1fr;
    }
}

.filterbar {
    padding: 16px 18px;
    display: grid;
    gap: 12px;
    background: var(--surface);
}

.filterbar::before {
    display: none;
}

.filterbar-active-summary {
    justify-self: start;
    width: fit-content;
    margin-top: -4px;
    padding: 5px 10px;
    border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-strong) 76%, transparent);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 760;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.filterbar.has-active-filters .filterbar-active-summary {
    border-color: color-mix(in srgb, var(--accent) 20%, var(--line));
    background: var(--accent-softer);
    color: var(--accent-strong);
}

.filtergrid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.filtergrid > label {
    flex: 1 1 150px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--muted-strong);
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.filtergrid > label:first-child:has(input[type="text"]:not([type="date"]):not([type="number"])) {
    flex: 3 1 260px;
    min-width: 220px;
}

.filtergrid > label:has(> button),
.filtergrid > label:has(> .button),
.filtergrid > label:has(> a.button) {
    flex: 0 0 auto;
    min-width: max-content;
    color: transparent;
    user-select: none;
    font-size: 0.74rem;
}

.filtergrid > label > :is(button, .button, a.button) {
    margin-top: auto;
    width: 100%;
}

.filter-row-primary {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    flex: 1 1 auto;
}

.filter-field--search {
    flex: 3 1 280px;
    min-width: 220px;
}

.filter-field--compact {
    flex: 1 1 130px;
    max-width: 180px;
}

.filter-label,
.filter-field > span:first-child {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--muted-strong);
    letter-spacing: 0.025em;
    text-transform: uppercase;
    margin: 0;
    white-space: nowrap;
}

.filter-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
    align-self: flex-end;
}

.filter-advanced-details {
    width: 100%;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    margin-top: 4px;
}

.filter-advanced-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted-strong);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background 120ms ease, color 120ms ease;
    list-style: none;
    user-select: none;
}

.filter-advanced-summary::-webkit-details-marker {
    display: none;
}

.filter-advanced-summary::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 140ms ease;
    margin-right: 2px;
}

.filter-advanced-details[open] > .filter-advanced-summary::before {
    transform: rotate(45deg);
}

.filter-advanced-summary:hover {
    color: var(--ink);
    background: var(--surface-subtle);
}

.filter-grid-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding-top: 10px;
    align-items: flex-end;
}

.filter-dot-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--muted-strong);
    letter-spacing: 0.025em;
    text-transform: uppercase;
    min-width: 0;
}

label:focus-within,
label.has-value {
    color: var(--ink);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select {
    width: 100%;
    box-sizing: border-box;
    height: 38px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.875rem;
    box-shadow: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    min-width: 0;
}

textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.875rem;
    box-shadow: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    min-width: 0;
    resize: vertical;
    min-height: 100px;
    line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.table-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm), var(--shadow-md);
}

.table-card > h2 {
    padding: 18px 20px 0;
}

.table-scroll,
.history-table-wrap,
.reference-table-wrap,
.analysis-table-wrap,
.table-wrap,
.table-shell {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}

.table-scroll-enhanced {
    scroll-behavior: smooth;
}

.app-sticky-table-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 19;
    display: none;
    width: 0;
    max-width: 100vw;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0 0 14px 14px;
    background: var(--surface-strong);
    box-shadow: 0 14px 28px color-mix(in srgb, var(--ink) 12%, transparent);
}

.app-sticky-table-header.is-visible {
    display: block;
}

.app-sticky-table-header table {
    margin: 0;
    border-radius: 0;
    overflow: visible;
    background: var(--surface-strong);
}

.app-sticky-table-header thead th {
    position: static !important;
    background: var(--surface-strong) !important;
}

.table-scroll-controls {
    position: sticky;
    left: 0;
    top: 8px;
    z-index: 4;
    display: none;
    align-items: center;
    gap: 6px;
    width: fit-content;
    margin: 8px 8px -2px auto;
    padding: 5px;
    border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.is-scrollable-table > .table-scroll-controls {
    display: flex;
}

.table-scroll-controls span {
    padding: 0 6px;
    color: var(--muted-strong);
    font-size: 0.72rem;
    font-weight: 780;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .table-scroll-controls span {
        max-width: 112px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.table-scroll-control {
    min-width: 28px;
    min-height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.9rem;
    line-height: 1;
}

.table-scroll-control:disabled {
    opacity: 0.34;
}

.card:has(> table),
.card:has(> .leaderboard),
.card:has(> .month-table),
.card:has(> .analysis-table),
.table-card:has(> table),
.dash-card:has(> table),
.metric-card:has(> table),
.leader-card:has(> table),
.summary-card:has(> table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}

.card > table,
.card > .leaderboard,
.card > .month-table,
.card > .analysis-table,
.table-card > table,
.dash-card > table,
.metric-card > table,
.leader-card > table,
.summary-card > table {
    min-width: 720px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.94rem;
    background: var(--surface);
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--surface-raised) 98%, transparent);
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: inset 0 -1px 0 var(--line);
}

th:first-child {
    border-top-left-radius: 12px;
}

th:last-child {
    border-top-right-radius: 12px;
}

th .sort-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

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

th .sort-link.active {
    color: var(--ink);
}

.sort-indicator {
    font-size: 0.78rem;
    line-height: 1;
    opacity: 0.7;
}

.row-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease;
}

tr:hover .row-quick-actions,
tr:focus-within .row-quick-actions {
    opacity: 1;
    pointer-events: auto;
}

.quick-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    text-decoration: none;
    font-size: 0.76rem;
    font-weight: 800;
    color: inherit;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.quick-action.copy {
    cursor: pointer;
}

.quick-action:hover,
.quick-action:focus-visible {
    color: var(--accent-strong);
    border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
    background: var(--accent-softer);
    transform: translateY(-1px);
}

.timeline-rail {
    display: grid;
    gap: 14px;
    position: relative;
}

.timeline-rail::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: color-mix(in srgb, var(--ink) 12%, transparent);
}

.timeline-step {
    position: relative;
    display: grid;
    gap: 4px;
    padding: 0 0 0 40px;
}

.timeline-step::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 2px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--surface-strong);
    border: 2px solid color-mix(in srgb, var(--ink) 16%, var(--line));
}

.timeline-step.complete::before {
    background: var(--success);
    border-color: var(--success);
}

.timeline-step.active::before {
    background: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 72%, var(--warning));
}

.timeline-step.danger::before {
    background: var(--danger);
    border-color: var(--danger);
}

.timeline-step strong {
    font-size: 0.92rem;
}

.timeline-step small {
    color: var(--muted);
}

.timeline-step p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.clickable-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.metric-glossary {
    border-radius: 18px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 50%, transparent);
    padding: 12px 14px;
}

.metric-glossary summary {
    cursor: pointer;
    font-weight: 900;
}

.metric-glossary div {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    line-height: 1.35;
}

.metric-glossary strong {
    color: var(--ink);
}

.metric-glossary--compact {
    padding: 10px 12px;
    font-size: 0.86rem;
}

.empty-state,
.empty,
[class$="-empty-cell"],
[class*="-empty-cell"] {
    color: var(--muted);
}

.empty-state,
.empty {
    display: grid;
    gap: 8px;
    align-content: center;
    min-height: 120px;
    padding: 22px;
    border: 1px dashed color-mix(in srgb, var(--line-strong) 78%, transparent);
    border-radius: var(--radius-lg);
    background:
            linear-gradient(135deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 44%),
            color-mix(in srgb, var(--surface-strong) 72%, transparent);
    text-align: left;
}

.empty-state strong,
.empty strong,
.empty-state h2,
.empty h2 {
    margin: 0;
    color: var(--ink);
}

.empty-state p,
.empty p {
    margin: 0;
}

td.empty,
td.empty-state,
td[class$="-empty-cell"],
td[class*="-empty-cell"],
td[colspan]:only-child {
    position: relative;
    padding: 30px 24px 30px 62px !important;
    text-align: center;
    color: var(--muted);
    background:
            linear-gradient(135deg, color-mix(in srgb, var(--accent) 4%, transparent), transparent 42%),
            color-mix(in srgb, var(--surface-subtle) 64%, transparent);
    font-weight: 720;
    line-height: 1.45;
}

td.empty::before,
td.empty-state::before,
td[class$="-empty-cell"]::before,
td[class*="-empty-cell"]::before,
td[colspan]:only-child::before {
    content: "";
    position: absolute;
    left: max(18px, calc(50% - 240px));
    top: 50%;
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
    background:
            linear-gradient(var(--accent), var(--accent)) 8px 9px / 12px 2px no-repeat,
            linear-gradient(var(--accent), var(--accent)) 8px 14px / 12px 2px no-repeat,
            linear-gradient(var(--accent), var(--accent)) 8px 19px / 8px 2px no-repeat,
            color-mix(in srgb, var(--accent) 7%, var(--surface-strong));
    opacity: 0.78;
}

td[colspan]:only-child:has(:is(form, table, .empty-state, .card, .actions, .row-quick-actions)) {
    padding-left: 24px !important;
    text-align: left;
    font-weight: inherit;
}

td[colspan]:only-child:has(:is(form, table, .empty-state, .card, .actions, .row-quick-actions))::before {
    display: none;
}

@media (max-width: 860px) {
    .row-quick-actions {
        opacity: 1;
        pointer-events: auto;
    }
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.35;
    white-space: normal;
}

th {
    white-space: nowrap;
}

td {
    font-variant-numeric: tabular-nums;
}

td:has(.money),
td:has(.number),
td:has(.amount),
td:has(.numeric-token),
td:has(.meta-token),
td:has(.badge),
td:has(.cell-nowrap),
td:has(.cell-date),
td:has(.cell-money),
td:has(.cell-number),
th:has(.money),
th:has(.number),
th:has(.amount),
th:has(.numeric-token),
th:has(.meta-token),
th:has(.badge),
th:has(.cell-nowrap),
th:has(.cell-date),
th:has(.cell-money),
th:has(.cell-number) {
    white-space: nowrap;
}

td :is(.money, .number, .amount, .numeric-token, .meta-token, .badge, .cell-nowrap, .cell-date, .cell-money, .cell-number),
th :is(.money, .number, .amount, .numeric-token, .meta-token, .badge, .cell-nowrap, .cell-date, .cell-money, .cell-number) {
    display: inline-flex;
    align-items: center;
    max-width: max-content;
    white-space: nowrap;
}

table :is(.titlecell, .listing-cell, .products-listing-cell, .competitor-visual-cell, .competitor-visual-cell--compact, .muted, .description, .note, .details, .wrap-text) {
    white-space: normal;
    overflow-wrap: anywhere;
}

td:has(:is(.titlecell, .listing-cell, .products-listing-cell, .competitor-visual-cell, .competitor-visual-cell--compact, .description, .note, .details, .wrap-text, form, textarea)),
th:has(:is(.titlecell, .listing-cell, .products-listing-cell, .competitor-visual-cell, .competitor-visual-cell--compact, .description, .note, .details, .wrap-text)) {
    white-space: normal;
}

.app-density-compact main {
    gap: 14px;
    margin-top: 14px;
    margin-bottom: 24px;
}

.app-density-compact .hero,
.app-density-compact .card,
.app-density-compact .stat,
.app-density-compact .filterbar,
.app-density-compact .dash-card,
.app-density-compact .table-card {
    padding: 13px;
}

.app-density-compact .hero {
    gap: 8px;
}

.app-density-compact .hero h1 {
    font-size: clamp(1.35rem, 2.3vw, 2.15rem);
}

.app-density-compact .stats {
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.app-density-compact .stat strong {
    margin-top: 4px;
    font-size: 1.22rem;
}

.app-density-compact .filtergrid {
    gap: 9px;
}

.app-density-compact label {
    gap: 5px;
}

.app-density-compact input,
.app-density-compact select,
.app-density-compact textarea,
.app-density-compact .button,
.app-density-compact button {
    min-height: 34px;
    padding-block: 7px;
}

.app-density-compact th,
.app-density-compact td {
    padding: 8px 10px;
    line-height: 1.26;
}

.app-density-compact .thumb {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.app-density-compact .badge,
.app-density-compact .meta-token,
.app-density-compact .numeric-token {
    padding: 3px 7px;
    font-size: 0.72rem;
}

.app-density-compact .row-quick-actions,
.app-density-compact .listing-inline-actions,
.app-density-compact .pagination,
.app-density-compact .page-tabs {
    gap: 6px;
}

tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

tbody tr:focus-within {
    background: color-mix(in srgb, var(--accent) 7%, var(--surface));
    box-shadow: inset 3px 0 0 var(--accent);
}

tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-raised) 44%, transparent);
}

tbody tr:nth-child(even):hover {
    background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

@media (max-width: 760px) {
    main {
        width: min(100% - 20px, 1320px);
        margin-top: 14px;
        gap: 14px;
    }

    .hero,
    .card,
    .filterbar,
    .table-card {
        border-radius: 14px;
    }

    .hero {
        padding: 20px 18px;
    }

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

    th,
    td {
        padding: 10px 12px;
    }

    table {
        font-size: 0.88rem;
    }
}

.titlecell {
    display: grid;
    gap: 5px;
}

.thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    flex-shrink: 0;
}

.listing-cell {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.titlecell a {
    font-weight: 800;
    text-decoration: none;
}

.badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.78rem;
    font-weight: 800;
    background: color-mix(in srgb, var(--muted) 10%, var(--surface));
    color: var(--muted);
}

.badge.ok {
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    color: var(--success);
}

.badge.warn {
    background: color-mix(in srgb, var(--warning) 14%, var(--surface));
    color: var(--warning);
}

.badge.danger {
    background: color-mix(in srgb, var(--danger) 12%, var(--surface));
    color: var(--danger);
}

.competitor-match-card {
    display: grid;
    gap: 6px;
    min-width: 280px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, var(--line));
}

.competitor-match-card:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.competitor-visual-cell {
    display: grid;
    grid-template-columns: 74px minmax(220px, 1fr);
    align-items: start;
    gap: 12px;
    min-width: 320px;
}

.competitor-visual-cell--compact {
    grid-template-columns: 58px minmax(180px, 1fr);
    min-width: 280px;
}

.competitor-thumb {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    box-shadow: var(--shadow-sm);
}

.competitor-thumb--large {
    width: 74px;
    height: 74px;
    border-radius: 16px;
}

.competitor-thumb--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.image-fallback-placeholder {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.inventory-valuation-table {
    font-size: 0.84rem;
}

.inventory-valuation-table th,
.inventory-valuation-table td {
    padding: 9px 10px;
}

.inventory-valuation-table th {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.inventory-valuation-table .competitor-visual-cell--compact {
    grid-template-columns: 44px minmax(160px, 1fr);
    gap: 9px;
    min-width: 230px;
}

.inventory-valuation-table .competitor-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.inventory-valuation-table .titlecell {
    gap: 2px;
}

.inventory-valuation-table .badge {
    padding: 3px 7px;
    font-size: 0.7rem;
}

.inventory-valuation-table .muted {
    font-size: 0.78rem;
}

.app-shell-body table .meta-token,
.app-shell-body .orders-table .titlecell .meta-token,
.app-shell-body .products-table .titlecell .meta-token,
.app-shell-body .full-replenishment-meta span {
    display: inline-flex !important;
    width: fit-content;
    max-width: max-content;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    font-variant-numeric: tabular-nums;
}

.app-shell-body :is(.money, .number, .amount, .numeric-token, .cell-nowrap, .cell-date, .cell-money, .cell-number, .breakdown-value, .expense-donut-amount, .expense-category-amount) {
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    font-variant-numeric: tabular-nums;
}

.match-review-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.match-review-form {
    display: grid;
    grid-template-columns: minmax(130px, 0.9fr) minmax(150px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}

.match-review-form select,
.match-review-form input {
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 12px;
}

.match-review-form button {
    min-height: 36px;
    padding: 8px 12px;
}

.match-review-form.is-saving {
    opacity: 0.72;
}

.match-review-feedback {
    min-width: 74px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.match-review-feedback.ok {
    color: var(--success);
}

.match-review-feedback.error {
    color: var(--danger);
}

@media (max-width: 760px) {
    .match-review-form {
        grid-template-columns: 1fr;
    }
}

.money {
    font-weight: 900;
}

.money-in { color: var(--success); font-weight: 900; }
.money-out { color: var(--danger); font-weight: 900; }
.money-out::before { content: "− "; }

.stat.stat-in strong { color: var(--success); }
.stat.stat-out strong { color: var(--danger); }
.stat .direction {
    display: inline-block;
    margin-right: 6px;
    font-size: 0.9em;
}

.cashflow-panel {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 16px;
    margin: 22px 0 8px;
}
.cashflow-card {
    padding: 20px 22px;
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.cashflow-card--link {
    display: block;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.cashflow-card--link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}
.cashflow-card--link::after {
    content: "Open";
    position: absolute;
    right: 18px;
    bottom: 16px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--accent);
}
.cashflow-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
}
.cashflow-card.inflow { background: linear-gradient(135deg, color-mix(in srgb, var(--success) 8%, transparent), color-mix(in srgb, var(--surface-strong) 96%, transparent)); }
.cashflow-card.inflow::before { background: var(--success); }
.cashflow-card.outflow { background: linear-gradient(135deg, color-mix(in srgb, var(--danger) 8%, transparent), color-mix(in srgb, var(--surface-strong) 96%, transparent)); }
.cashflow-card.outflow::before { background: var(--danger); }
.cashflow-card.result { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), color-mix(in srgb, var(--surface-strong) 96%, transparent)); }
.cashflow-card.result::before { background: var(--warning); }
.cashflow-card h3 {
    margin: 0 0 10px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 800;
}
.cashflow-card .amount {
    font-size: 2rem;
    font-weight: 900;
    margin: 4px 0;
    line-height: 1.1;
}
.cashflow-card.inflow .amount { color: var(--success); }
.cashflow-card.outflow .amount { color: var(--danger); font-size: 2.3rem; }
.cashflow-card .sub {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 6px;
}
.cashflow-card .icon {
    position: absolute;
    right: 18px;
    top: 18px;
    font-size: 1.4rem;
    opacity: 0.35;
}

tr.overdue {
    background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}
tr.overdue td:first-child::before {
    content: "⚠ ";
    color: var(--danger);
    font-weight: 900;
    margin-right: 2px;
}

.section-divider {
    margin: 32px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}
.section-divider h2 {
    margin: 0;
    font-size: 1.1rem;
}
.section-divider .hint {
    color: var(--muted);
    font-size: 0.82rem;
}

details.card {
    padding: 16px 22px;
}
details.card > summary {
    cursor: pointer;
    font-weight: 800;
    font-size: 1rem;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after {
    content: "▼";
    font-size: 0.7rem;
    color: var(--muted);
    transition: transform 0.2s;
    margin-left: 12px;
}
details.card[open] > summary::after {
    transform: rotate(180deg);
}
details.card[open] > summary {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.kpi-compare {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: color-mix(in srgb, var(--ink) 8%, transparent);
    margin-top: 10px;
}
.kpi-compare .bar-in { background: var(--success); }
.kpi-compare .bar-out { background: var(--danger); }

.expense-breakdown-card {
    padding: 20px 22px 24px;
}

.expense-month-header {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.expense-month-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 900;
}

.expense-month-nav {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 2rem;
    line-height: 1;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--accent);
}

.expense-month-nav.disabled {
    pointer-events: none;
    opacity: 0.35;
    color: var(--muted);
}

.expense-card-shell {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    overflow: hidden;
}

.expense-card-title-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: baseline;
    flex-wrap: wrap;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line);
}

.expense-card-title-row h2 {
    margin: 0;
}

.expense-breakdown-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr);
    gap: 22px;
    padding: 20px 22px 8px;
}

.expense-donut-wrap {
    display: grid;
    justify-items: center;
    gap: 16px;
    align-content: start;
}

.expense-donut {
    width: min(360px, 100%);
    aspect-ratio: 1;
    border-radius: 50%;
    position: relative;
    display: grid;
    place-items: center;
}

.expense-donut::after {
    content: "";
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    background: var(--surface-strong);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 5%, transparent);
}

.expense-donut-center {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 6px;
    justify-items: center;
    text-align: center;
}

.expense-donut-label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.expense-donut-amount {
    font-size: clamp(1.6rem, 2.6vw, 2.6rem);
    font-weight: 900;
}

.expense-breakdown-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    color: var(--muted);
    font-size: 0.88rem;
}

.expense-breakdown-meta strong {
    color: var(--ink);
}

.expense-breakdown-list {
    display: grid;
}

.expense-category-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.expense-category-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.expense-category-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ink) 3%, transparent);
}

.expense-category-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.expense-category-copy strong {
    font-size: 1.05rem;
}

.expense-category-amount {
    display: grid;
    gap: 4px;
    justify-items: end;
    text-align: right;
    flex-shrink: 0;
}

.expense-category-amount strong {
    font-size: 1.05rem;
}

.manual-review-callout {
    margin: 0 22px 18px;
    padding: 16px 18px;
    border: 1px solid color-mix(in srgb, var(--danger) 18%, var(--line));
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, color-mix(in srgb, var(--danger) 8%, transparent), color-mix(in srgb, var(--accent) 6%, transparent));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.manual-review-callout strong {
    display: block;
    margin-top: 8px;
    font-size: 1.08rem;
}

.manual-review-callout p {
    margin: 6px 0 0;
    color: var(--muted);
}

.manual-review-row,
.unclassified-row {
    background: linear-gradient(90deg, color-mix(in srgb, var(--warning) 10%, transparent), color-mix(in srgb, var(--warning) 3%, transparent));
    box-shadow: inset 4px 0 0 var(--warning);
}

.manual-review-flags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.cashout-edit-form {
    width: 100%;
}

.cashout-edit-grid {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(260px, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.cashout-edit-grid input,
.cashout-edit-grid select {
    width: 100%;
}

.bank-transaction-edit-form {
    min-width: 520px;
}

.bank-transaction-edit-grid {
    display: grid;
    grid-template-columns: minmax(160px, 210px) minmax(180px, 1fr) minmax(160px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.bank-transaction-edit-grid input,
.bank-transaction-edit-grid select {
    width: 100%;
}

@media (max-width: 900px) {
    .cashflow-panel {
        grid-template-columns: 1fr;
    }

    .expense-breakdown-layout {
        grid-template-columns: 1fr;
    }

    .expense-month-header {
        grid-template-columns: 44px 1fr 44px;
    }

    .expense-month-title {
        font-size: 1.35rem;
    }

    .cashout-edit-grid {
        grid-template-columns: 1fr;
    }

    .manual-review-callout {
        align-items: flex-start;
        flex-direction: column;
    }

    .bank-transaction-edit-form {
        min-width: 0;
    }

    .bank-transaction-edit-grid {
        grid-template-columns: 1fr;
    }
}

.products-table {
    min-width: 1680px;
    table-layout: fixed;
}

.orders-table {
    min-width: 1160px;
}

.products-table th,
.products-table td {
    overflow: hidden;
}

.products-table .products-listing-cell,
.products-table .titlecell {
    min-width: 0;
}

.products-table .titlecell a,
.products-table .titlecell .muted {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.products-table .products-listing-cell {
    white-space: normal;
}

.products-listing-titlecell {
    gap: 7px;
}

.products-table .listing-title-link {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    line-height: 1.24;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
}

.listing-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.82rem;
    line-height: 1.2;
}

.listing-inline-actions a {
    font-weight: 700;
}

.products-table .products-sales-cell,
.products-table .cell-nowrap {
    white-space: nowrap;
}

.products-table .cell-nowrap {
    text-overflow: ellipsis;
}

.products-table .cell-date {
    font-size: 0.86rem;
}

@media (max-width: 1600px) and (min-width: 1101px) {
    main {
        width: min(1780px, calc(100% - 18px));
        margin-top: 20px;
    }

    .table-card > h2,
    .table-card > h3 {
        padding-left: 16px;
        padding-right: 16px;
    }

    .table-scroll {
        overflow-x: auto;
        scrollbar-gutter: stable both-edges;
    }

    th,
    td {
        padding: 12px 12px;
    }

    .products-table {
        min-width: 1580px;
    }

    .orders-table {
        min-width: 1020px;
    }

    .products-table,
    .orders-table {
        font-size: 0.9rem;
    }

    .orders-table .titlecell,
    .products-table .titlecell {
        gap: 4px;
    }

    .products-table .titlecell a,
    .orders-table .titlecell a {
        line-height: 1.25;
    }

    .products-table .listing-title-link {
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
}

@media (max-width: 1100px) {
    main {
        width: calc(100% - 20px);
        margin-top: 18px;
        margin-bottom: 28px;
        gap: 16px;
    }

    .table-card > h2,
    .table-card > h3 {
        padding-left: 14px;
        padding-right: 14px;
    }

    .table-scroll {
        overflow-x: auto;
        scrollbar-gutter: stable both-edges;
    }

    th,
    td {
        padding: 10px 10px;
    }

    .products-table,
    .orders-table {
        font-size: 0.88rem;
    }

    .products-table {
        min-width: 1520px;
    }

    .orders-table {
        min-width: 980px;
    }

    .products-table .titlecell,
    .orders-table .titlecell {
        gap: 4px;
    }

    .products-table .titlecell a,
    .orders-table .titlecell a,
    .products-table .titlecell .muted,
    .orders-table .titlecell .muted {
        line-height: 1.22;
    }
}

.pagination {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 16px 18px;
    border-top: 1px solid var(--line);
}

.pager {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pager a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    font-weight: 800;
    text-decoration: none;
}

.pager a:hover {
    background: var(--accent-soft);
}

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

.actions > form {
    margin: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
    gap: 18px;
    align-items: start;
}

.product-section-wide {
    grid-column: 1 / -1;
}

.detail-grid > .product-section-listing-media { order: 1; }
.detail-grid > .product-section-commercial-snapshot { order: 2; }
.detail-grid > .product-section-decision-support { order: 3; }
.detail-grid > .product-section-sales-snapshot { order: 4; }
.detail-grid > .product-section-local-product-model { order: 5; }
.detail-grid > .product-section-price-history { order: 6; }
.detail-grid > .product-section-repricer { order: 7; }
.detail-grid > .product-section-local-stock-actions { order: 8; }
.detail-grid > .product-section-inventory-history { order: 9; }
.detail-grid > .product-section-lot-cost-tracking { order: 10; }
.detail-grid > .product-section-recent-inventory-movements { order: 11; }
.detail-grid > .product-section-raw-json { order: 12; }

.detail-grid > .product-section-price-history {
    overflow: hidden;
    contain: layout paint;
}

.inventory-grid {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
}

.kv {
    display: grid;
    gap: 10px;
}

.kv div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    min-width: 0;
}

.inline-form {
    display: grid;
    grid-template-columns: 1.1fr 90px auto;
    gap: 8px;
    align-items: center;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

li {
    background: var(--surface-strong);
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid var(--line);
}

li span,
li small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .detail-grid,
    .inventory-grid {
        grid-template-columns: 1fr;
    }

    .product-section-wide {
        grid-column: auto;
    }

    .inline-form {
        grid-template-columns: 1fr;
    }

    .kv div {
        align-items: flex-start;
        gap: 10px;
    }

    .kv span,
    .kv strong {
        min-width: 0;
    }

    .kv span {
        overflow-wrap: anywhere;
    }

    .kv strong {
        max-width: 58%;
        text-align: right;
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: normal;
        font-variant-numeric: tabular-nums;
    }
}

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

pre {
    margin: 0;
    max-height: 620px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--ink);
    color: var(--surface-strong);
    border-radius: 18px;
    padding: 16px;
    font-size: 0.86rem;
}

@media (max-width: 780px) {
    .filtergrid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    table {
        min-width: 760px;
    }
}

@media (max-width: 680px) {
    :root {
        font-size: 15px;
    }

    body {
        background: var(--bg);
    }

    main {
        width: calc(100% - 14px);
        margin: 14px auto 26px;
        gap: 14px;
    }

    .hero,
    .card,
    .filterbar,
    .table-card,
    .stat {
        border-radius: 20px;
    }

    .hero {
        padding: 20px;
        gap: 12px;
    }

    .hero h1 {
        font-size: clamp(1.85rem, 9.2vw, 2.45rem);
        line-height: 1.02;
    }

    .stats,
    .filtergrid,
    .form-grid,
    .detail-grid,
    .inventory-grid,
    .cashflow-panel,
    .pending-resolution-grid {
        grid-template-columns: 1fr !important;
    }

    .section-header,
    .topbar,
    .pending-resolution-card__header {
        align-items: stretch;
        flex-direction: column;
    }

    .actions,
    .sync-actions,
    .page-tabs,
    .nav {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .actions > *,
    .actions form,
    .actions a,
    .actions button,
    .sync-actions form,
    .sync-actions button,
    .button,
    button,
    .page-tab,
    .nav a {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    input,
    select,
    textarea {
        min-height: 44px;
        font-size: 16px;
    }

    .table-card > h2,
    .table-card > h3,
    .table-card .section-header {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .table-scroll {
        margin: 0;
        padding-bottom: 6px;
        border-top: 1px solid color-mix(in srgb, var(--ink) 6%, var(--line));
    }

    table {
        min-width: 720px;
        font-size: 0.84rem;
    }

    th,
    td {
        padding: 9px 10px;
    }

    .products-table {
        min-width: 1160px;
    }

    .orders-table {
        min-width: 920px;
    }

    .mini-table {
        min-width: 620px;
    }

    .listing-cell,
    .competitor-visual-cell,
    .competitor-visual-cell--compact {
        min-width: 0;
    }

    .badge {
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    .pagination,
    .pager {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .pager a {
        width: 100%;
    }
}

.pending-resolution-list {
    display: grid;
    gap: 18px;
}

.pending-resolution-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    padding: 18px;
    display: grid;
    gap: 16px;
}

.pending-resolution-card__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.pending-resolution-card__header h3 {
    margin: 0 0 4px;
}

.pending-resolution-card__cost {
    display: grid;
    justify-items: end;
    gap: 4px;
}

.pending-resolution-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pending-resolution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.pending-resolution-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
    background: var(--surface-strong);
}

.pending-resolution-panel h4 {
    margin: 0 0 12px;
}

.pending-suggestion-card {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    background: var(--surface-strong);
}

.pending-suggestion-card + .pending-suggestion-card {
    margin-top: 10px;
}

.pending-component-suggestions {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.pending-component-suggestion {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.lot-stats {
    margin-top: 14px;
}

.listing-health-details {
    margin-top: 8px;
    max-width: 230px;
}

.listing-health-details summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.listing-health-details ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.app-toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 10000;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.app-toast {
    transform: translateY(10px);
    opacity: 0;
    transition: opacity 160ms ease, transform 160ms ease;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
    box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    color: var(--ink);
    font-weight: 800;
    pointer-events: auto;
}

.app-toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.app-toast--success {
    border-color: color-mix(in srgb, var(--success) 24%, var(--line));
}

.app-toast--error {
    border-color: color-mix(in srgb, var(--danger) 26%, var(--line));
    color: var(--danger);
}

.app-global-loading {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 10001;
    height: 3px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.app-global-loading.is-visible {
    opacity: 1;
}

.app-global-loading span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--success), var(--accent));
    box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 42%, transparent);
    animation: app-global-loading-sweep 1s ease-in-out infinite;
}

.app-is-loading {
    cursor: progress;
}

.is-dynamic-loading {
    opacity: 0.68;
    cursor: progress;
}

a.is-dynamic-loading,
button.is-dynamic-loading {
    pointer-events: none;
}

.is-dynamic-submit-primary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.is-dynamic-submit-primary::after {
    content: "";
    width: 0.82em;
    height: 0.82em;
    border-radius: 999px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: dynamic-submit-spin 740ms linear infinite;
}

@keyframes dynamic-submit-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes app-global-loading-sweep {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(245%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .is-dynamic-submit-primary::after {
        animation: none;
    }

    .app-global-loading span {
        width: 100%;
        animation: none;
    }
}

@media (max-width: 900px) {
    .pending-resolution-card__cost {
        justify-items: start;
    }

    .pending-suggestion-card {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Interface polish layer: loaded last so page-specific CSS keeps content, while shared UX stays consistent. */
.app-shell-body :is(.filterbar, .card, .table-card) :is(input, select, textarea) {
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.app-shell-body :is(.filterbar, .card, .table-card) :is(input, select, textarea):hover {
    border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
}

.app-shell-body :is(.filterbar, .card, .table-card) label > :is(span, small):first-child {
    color: var(--muted-strong);
    font-size: 0.74rem;
    font-weight: 760;
    letter-spacing: 0.045em;
}

.app-shell-body :is(.table-card, .card:has(table)) table {
    border-radius: 14px;
    overflow: hidden;
}

.app-shell-body :is(.table-card, .card:has(table)) thead th {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 96%, transparent), color-mix(in srgb, var(--surface-subtle) 94%, transparent));
    color: var(--muted-strong);
    border-bottom: 1px solid color-mix(in srgb, var(--line-strong) 70%, var(--line));
}

.app-shell-body :is(.table-card, .card:has(table)) tbody td {
    border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.app-shell-body :is(.table-card, .card:has(table)) tbody tr:last-child td {
    border-bottom-color: transparent;
}

.app-shell-body :is(.table-scroll, .table-wrap, .table-shell, .history-table-wrap, .reference-table-wrap, .analysis-table-wrap):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 20%, transparent);
    outline-offset: 3px;
}

.app-shell-body :is(.cell-money, .cell-number, .money, .number, .amount) {
    font-feature-settings: "tnum" 1;
}

@media (max-width: 760px) {
    .app-shell-body :is(.page-tabs, .filter-presets, .orders-period-tabs, .range-tabs) {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        width: 100%;
        padding-bottom: 3px;
        scrollbar-width: thin;
    }

    .app-shell-body :is(.page-tabs, .filter-presets, .orders-period-tabs, .range-tabs) > * {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .app-shell-body :is(.filterbar, .card, .table-card) {
        box-shadow: var(--shadow-sm);
    }

    .app-shell-body .filterbar::before {
        margin-bottom: -2px;
    }
}

@media (max-width: 520px) {
    .app-shell-body main {
        width: calc(100% - 12px);
    }

    .app-shell-body :is(.stat, .summary-card, .metric-card, .analysis-kpi, .cashflow-card) {
        min-height: auto;
    }

    .app-shell-body :is(.table-scroll, .table-wrap, .table-shell, .history-table-wrap, .reference-table-wrap, .analysis-table-wrap) {
        margin-inline: -6px;
        border-inline: 0;
    }
}

.filter-quick-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-quick-chips__label {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: 4px;
}

.filter-quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--muted-strong);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.filter-quick-chip:hover {
    border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
    color: var(--accent-strong);
    transform: translateY(-1px);
}

.filter-quick-chip.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.stat small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.3;
}
