:root {
    --bg: #f2f3f5;
    --surface: #ffffff;
    --surface-soft: #f8f8f9;
    --text: #17181b;
    --muted: #6d7078;
    --border: #dedfe3;
    --black: #111214;
    --sidebar: #17181b;
    --sidebar-muted: #91949d;
    --success: #196d3b;
    --success-bg: #edf8f1;
    --danger: #9e2424;
    --danger-bg: #fff0f0;
    --warning: #765a0a;
    --warning-bg: #fff8df;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.07);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

button, input, select, textarea { font: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }

code {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.92em;
}

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(0, 0, 0, 0.07), transparent 34%),
        var(--bg);
}

.auth-shell { width: 100%; max-width: 470px; }
.upgrade-shell { max-width: 620px; }

.auth-card {
    padding: 42px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: 26px;
    border-radius: 12px;
    background: var(--black);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
}

.brand-mark-small {
    width: 38px;
    height: 38px;
    margin: 0;
    border-radius: 9px;
    background: #fff;
    color: var(--black);
    font-size: 14px;
}

.eyebrow {
    margin: 0 0 7px;
    color: #64676f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.55px;
}

.auth-card h1, .page-heading h1 {
    margin-bottom: 10px;
    font-size: clamp(28px, 4vw, 39px);
    line-height: 1.06;
    letter-spacing: -1px;
}

.muted { color: var(--muted); line-height: 1.6; }

.form-stack { margin-top: 30px; }

.field { margin-bottom: 17px; }

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 750;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 45px;
    padding: 10px 12px;
    border: 1px solid #cfd1d7;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

.field textarea {
    min-height: 100px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--black);
    outline: 3px solid rgba(17, 18, 20, 0.10);
}

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

.field-span-2 { grid-column: span 2; }

.check-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 13px;
    color: #4f5259;
    font-size: 13px;
    line-height: 1.4;
}

.check-field input { margin-top: 2px; }

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr;
    margin-bottom: 12px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 750;
}

.button-primary {
    width: 100%;
    background: var(--black);
    color: #fff;
}

.button-primary:hover { background: #292a2e; }

.button-secondary {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

.button-auto { width: auto; }

.button-ghost {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: transparent;
    color: #fff;
}

.button-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 5px;
}

.alert {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 9px;
    line-height: 1.5;
}

.alert a { font-weight: 700; }

.alert-error {
    border: 1px solid #e8b3b3;
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-success {
    border: 1px solid #acd9ba;
    background: var(--success-bg);
    color: var(--success);
}

.alert-warning {
    border: 1px solid #e6d08a;
    background: var(--warning-bg);
    color: var(--warning);
}

.auth-footnote {
    margin: 25px 0 0;
    color: #858891;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.erp-frame {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 20px 15px;
    background: var(--sidebar);
    color: #fff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 3px 8px 20px;
    text-decoration: none;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand strong { font-size: 14px; }
.sidebar-brand small {
    margin-top: 2px;
    color: var(--sidebar-muted);
    font-size: 12px;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
}

.sidebar-nav a,
.nav-disabled {
    display: flex;
    min-height: 39px;
    align-items: center;
    padding: 9px 11px;
    border-radius: 7px;
    text-decoration: none;
    color: #d7d8dc;
    font-size: 13px;
}

.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.06); }

.sidebar-nav a.is-active {
    background: #fff;
    color: var(--black);
    font-weight: 750;
}

.nav-section {
    margin: 19px 10px 7px;
    color: #71747d;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.25px;
}

.nav-disabled {
    color: #60636b;
    cursor: not-allowed;
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
    padding: 12px 26px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    display: block;
    font-size: 17px;
    letter-spacing: -0.35px;
}

.topbar-subtitle {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-copy {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-copy span { font-size: 13px; font-weight: 700; }
.user-copy small { margin-top: 2px; color: var(--muted); }

.topbar .button-ghost {
    border-color: var(--border);
    color: var(--text);
}

.content-shell {
    width: min(1380px, calc(100% - 42px));
    margin: 0 auto;
    padding: 34px 0 65px;
}

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

.compact-heading h1 { margin-bottom: 6px; }

.status-pill {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #b9dec7;
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 12px;
    font-weight: 800;
}

.panel {
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

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

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.panel-heading h2,
.form-panel h2 {
    margin-bottom: 20px;
    font-size: 20px;
    letter-spacing: -0.4px;
}

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

.stat-card {
    display: flex;
    flex-direction: column;
    min-height: 118px;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    text-decoration: none;
}

.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { margin-top: auto; font-size: 32px; }

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

.module-card {
    position: relative;
    min-height: 210px;
    padding: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
}

.module-card-active {
    background: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
}

.module-card h3 {
    margin: 30px 0 10px;
    font-size: 21px;
}

.module-card p {
    margin-bottom: 22px;
    color: var(--muted);
    line-height: 1.5;
}

.module-number {
    position: absolute;
    top: 20px;
    right: 22px;
    color: #d9dade;
    font-size: 37px;
    font-weight: 800;
}

.module-state {
    display: inline-flex;
    padding: 6px 9px;
    border-radius: 6px;
    background: var(--black);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.module-state-muted {
    background: #e9eaed;
    color: #777a82;
}

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

.setup-card {
    display: flex;
    flex-direction: column;
    min-height: 135px;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    text-decoration: none;
}

.setup-card:hover { border-color: #aeb0b7; }
.setup-label { color: #8a8d95; font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.setup-card strong { margin-top: 20px; font-size: 17px; }
.setup-card small { margin-top: auto; color: var(--muted); }

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.wide-list { grid-template-columns: minmax(0, 1fr) 390px; }

.side-form {
    position: sticky;
    top: 88px;
}

.form-panel .button + .button {
    width: 100%;
    margin-top: 8px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    color: #72757d;
    font-size: 10px;
    letter-spacing: 0.7px;
    text-align: left;
    text-transform: uppercase;
}

td {
    padding: 13px 12px;
    border-bottom: 1px solid #ececef;
    vertical-align: top;
}

tbody tr:last-child td { border-bottom: 0; }

.actions-cell {
    min-width: 150px;
    text-align: right;
}

.inline-form { display: inline; }

.text-link,
.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #32343a;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
}

.text-button { margin-left: 9px; color: #7a3a3a; }

.badge {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}

.badge-active { background: var(--success-bg); color: var(--success); }
.badge-muted { background: #eceef0; color: #71747b; }

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

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

.check-list li {
    position: relative;
    padding-left: 24px;
    color: #4f5259;
    line-height: 1.45;
}

.check-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 900;
}

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

.migration-list {
    display: grid;
    gap: 10px;
    margin: 23px 0;
}

.migration-list div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.migration-list strong,
.migration-list small { display: block; }
.migration-list small { margin-top: 5px; color: var(--muted); }

.pagination {
    display: flex;
    gap: 6px;
    margin-top: 20px;
}

.pagination a {
    display: inline-flex;
    min-width: 34px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    text-decoration: none;
}

.pagination a.is-current {
    background: var(--black);
    color: #fff;
}

@media (max-width: 1100px) {
    .setup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-layout, .wide-list { grid-template-columns: 1fr; }
    .side-form { position: static; }
}

@media (max-width: 760px) {
    .auth-card { padding: 30px 24px; }
    .erp-frame { display: block; }
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding-bottom: 12px;
    }
    .sidebar-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .nav-section { grid-column: span 2; }
    .topbar { padding: 12px 16px; }
    .user-copy { display: none; }
    .content-shell {
        width: min(100% - 24px, 1380px);
        padding-top: 25px;
    }
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }
    .module-grid,
    .setup-grid,
    .stats-grid,
    .form-grid,
    .columns-two {
        grid-template-columns: 1fr;
    }
    .field-span-2 { grid-column: auto; }
    .panel { padding: 18px; }
}

/* Supplier module v0.2 */
.heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.supplier-form-stack {
    display: grid;
    gap: 18px;
}

.supplier-form-stack .panel + .panel {
    margin-top: 0;
}

.form-note {
    margin: -2px 0 0;
    font-size: 12px;
}

.form-actions-between {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filter-panel {
    margin-bottom: 18px;
    padding-bottom: 8px;
}

.filter-grid {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(180px, 1fr) minmax(150px, 0.8fr) auto;
    gap: 14px;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 8px;
    padding-bottom: 17px;
}

.filter-actions .button {
    white-space: nowrap;
}

.record-link {
    font-weight: 800;
    text-decoration: none;
}

.record-link:hover {
    text-decoration: underline;
}

.table-subline {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.badge-info {
    background: #edf1f8;
    color: #35516f;
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

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

.summary-card {
    min-height: 126px;
}

.summary-card .summary-label,
.summary-card strong,
.summary-card small {
    display: block;
}

.summary-card .summary-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.summary-card strong {
    margin-top: 22px;
    font-size: 20px;
}

.summary-card small {
    margin-top: 7px;
    color: var(--muted);
}

.supplier-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.detail-list {
    margin: 0;
}

.detail-list > div {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.2fr);
    gap: 18px;
    padding: 12px 0;
    border-bottom: 1px solid #ececef;
}

.detail-list > div:last-child {
    border-bottom: 0;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

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

.notes-box {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.notes-box p {
    margin: 8px 0 0;
    color: #4f5259;
    font-size: 13px;
    line-height: 1.55;
}

.supplier-related-layout {
    margin-top: 18px;
}

.custom-check {
    min-height: 45px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid #cfd1d7;
    border-radius: 8px;
}

@media (max-width: 1100px) {
    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-actions {
        padding-bottom: 17px;
    }
}

@media (max-width: 760px) {
    .heading-actions,
    .form-actions-between,
    .filter-actions {
        width: 100%;
        flex-direction: column;
    }

    .heading-actions .button,
    .form-actions-between .button,
    .filter-actions .button {
        width: 100%;
    }

    .filter-grid,
    .supplier-summary-grid,
    .supplier-detail-grid,
    .detail-list-grid {
        grid-template-columns: 1fr;
    }

    .detail-list > div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .detail-list dd {
        text-align: left;
    }
}

/* ERP v0.3 — Items & Variants */
.subnav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
}

.subnav-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #dfe1e6;
    border-radius: 9px;
    background: #fff;
    color: #40434b;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.subnav-tabs a:hover,
.subnav-tabs a.is-active {
    border-color: #17181c;
    background: #17181c;
    color: #fff;
}

.columns-two-wide {
    grid-template-columns: minmax(300px, .8fr) minmax(0, 1.6fr);
    align-items: start;
}

.filter-grid-items {
    grid-template-columns: minmax(280px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
}

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

.metric-grid-five,
.stats-grid-five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid #e0e2e7;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(17, 19, 24, .045);
}

.metric-card span,
.metric-card small {
    display: block;
    color: #70737b;
    font-size: 12px;
    line-height: 1.35;
}

.metric-card strong {
    display: block;
    margin: 7px 0 4px;
    color: #17181c;
    font-size: 22px;
    line-height: 1.15;
}

.table-link {
    display: block;
    margin-bottom: 3px;
    color: #17181c;
    font-weight: 800;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.table-primary,
.table-secondary {
    display: block;
}

.table-primary {
    color: #292b31;
    font-weight: 600;
}

.table-secondary {
    margin-top: 3px;
    color: #777a82;
    font-size: 11px;
    line-height: 1.35;
}

.warning-text {
    color: #9a6500;
}

.row-selected td {
    background: #f5f7fa;
}

.readonly-field {
    display: flex;
    flex-direction: column;
}

.readonly-value {
    min-height: 43px;
    padding: 11px 13px;
    border: 1px dashed #cfd2d9;
    border-radius: 8px;
    background: #f7f8fa;
    color: #383a40;
    font-weight: 700;
}

.calculation-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    border: 1px solid #dfe2e8;
    border-radius: 10px;
    background: #f7f8fa;
}

.calculation-strip > div {
    padding: 4px 8px;
}

.calculation-strip span,
.calculation-strip small {
    display: block;
    color: #72757d;
    font-size: 11px;
}

.calculation-strip strong {
    display: block;
    margin-top: 5px;
    font-size: 20px;
}

.info-stack {
    display: grid;
    gap: 11px;
}

.info-row {
    padding: 13px 14px;
    border: 1px solid #e3e5e9;
    border-radius: 9px;
    background: #fafafb;
}

.info-row strong,
.info-row span {
    display: block;
}

.info-row strong {
    margin-bottom: 4px;
    font-size: 13px;
}

.info-row span {
    color: #696c74;
    font-size: 12px;
    line-height: 1.45;
}

.compact-alert {
    margin: 16px 0 0;
}

.compact-table-wrap {
    margin-top: 22px;
    border-top: 1px solid #eceef1;
    padding-top: 18px;
}

.custom-fields-block {
    padding-top: 16px;
    border-top: 1px solid #eceef1;
}

.field small {
    display: block;
    margin-top: 5px;
    color: #777a82;
    font-size: 11px;
    line-height: 1.4;
}

@media (max-width: 1280px) {
    .metric-grid-five,
    .stats-grid-five {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 900px) {
    .columns-two-wide,
    .metric-grid,
    .metric-grid-five,
    .stats-grid-five,
    .calculation-strip,
    .filter-grid-items {
        grid-template-columns: 1fr;
    }

    .subnav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .subnav-tabs a {
        white-space: nowrap;
    }
}

/* ERP v0.3.1 — supplier tabs and import attribute mappings */
.supplier-summary-grid-four,
.stats-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.supplier-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
}

.notice {
    margin: 0 0 18px;
    padding: 13px 15px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.5;
}

.notice-info {
    border: 1px solid #cfd9e7;
    background: #f2f6fb;
    color: #35516f;
}

.prose-box {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-soft);
    color: #4f5259;
    font-size: 13px;
    line-height: 1.65;
}

.compact-prose {
    margin-top: 18px;
}

.filter-grid-wide {
    grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(150px, 1fr)) auto;
}

.mapping-inline-form {
    display: flex;
    min-width: 310px;
    align-items: center;
    gap: 8px;
}

.mapping-inline-form select {
    min-width: 190px;
}

.large-empty-state {
    padding: 48px 24px;
    text-align: center;
}

.large-empty-state h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.large-empty-state p {
    max-width: 720px;
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.6;
}

@media (max-width: 1280px) {
    .supplier-summary-grid-four,
    .stats-grid-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 760px) {
    .supplier-summary-grid-four,
    .stats-grid-four,
    .filter-grid-wide {
        grid-template-columns: 1fr;
    }

    .supplier-tabs {
        position: static;
    }

    .mapping-inline-form {
        min-width: 250px;
        align-items: stretch;
        flex-direction: column;
    }
}

/* Item Imports v0.4 */
.alert-info {
    background: #eef5ff;
    border: 1px solid #b9d2f5;
    color: #214a78;
}

.compact-alert {
    margin-top: 14px;
    margin-bottom: 0;
}

.field-help,
.field small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

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

.process-list {
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
    line-height: 1.65;
}

.process-list li + li {
    margin-top: 9px;
}

.mapping-heading {
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.mapping-heading h3 {
    margin: 3px 0 7px;
}

.mapping-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.mapping-field {
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafafa;
}

.mapping-field textarea {
    min-height: 92px;
    resize: vertical;
}

.mapping-required {
    border-color: #d8b45d;
    background: #fffaf0;
}

.import-confirm-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.import-confirm-panel h2 {
    margin: 3px 0 7px;
}

.import-stats {
    margin-bottom: 18px;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.data-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f7f8f9;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.compact-table table {
    min-width: 520px;
}

.wide-import-table {
    min-width: 1320px;
}

.import-row-error td {
    background: #fff6f6;
}

.import-row-warning td {
    background: #fffaf0;
}

.identifier-line {
    display: block;
    white-space: nowrap;
    color: var(--muted);
    line-height: 1.55;
}

.import-message {
    max-width: 340px;
    margin-top: 6px;
    white-space: normal;
    color: #8a4c16;
}

.small-link {
    display: inline-block;
    margin-top: 7px;
    font-size: 12px;
}

.large-badge {
    padding: 9px 13px;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .mapping-grid,
    .form-grid-three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .import-confirm-panel {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Item Imports v0.4.0.1 — visible actions on light content surfaces */
.content-shell .button-ghost {
    border-color: var(--border);
    background: #ffffff;
    color: var(--text);
}

.content-shell .button-ghost:hover {
    background: var(--surface-soft);
}

.actions-cell .button-ghost {
    white-space: nowrap;
}

/* v0.4.1 — destructive actions */
.danger-text,
.button-danger {
    color: #b42318 !important;
}

.button-danger:hover,
.danger-text:hover {
    color: #7a271a !important;
}

/* ERP v0.5.1 — purchases totals, grouped preview and item inventory integration */
.purchase-stats-grid,
.purchase-import-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metric-grid-six {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metric-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.item-card-tabs {
    margin-top: -4px;
}

.stock-link {
    display: inline-block;
    font-size: 16px;
}

.action-explanation {
    margin: 14px 0 0;
}

.purchase-preview-stack {
    display: grid;
    gap: 18px;
}

.purchase-preview-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
}

.purchase-preview-card-error {
    border-color: #e3b6a8;
}

.purchase-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: #f8f9fa;
}

.purchase-preview-header h3 {
    margin: 3px 0 5px;
    font-size: 20px;
}

.purchase-preview-header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.preview-doc-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.preview-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    border-bottom: 1px solid var(--border);
    background: var(--border);
}

.preview-metrics > div {
    min-width: 0;
    padding: 13px 15px;
    background: #fff;
}

.preview-metrics span,
.preview-metrics strong {
    display: block;
}

.preview-metrics span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
}

.preview-metrics strong {
    font-size: 15px;
}

.purchase-preview-table {
    min-width: 1120px;
}

.number-positive {
    color: #18723a;
    font-weight: 700;
}

.number-negative {
    color: #a3332b;
    font-weight: 700;
}

.item-movements-table {
    min-width: 1180px;
}

@media (max-width: 1280px) {
    .purchase-stats-grid,
    .purchase-import-stats,
    .metric-grid-six,
    .preview-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .purchase-stats-grid,
    .purchase-import-stats,
    .metric-grid-six,
    .metric-grid-four,
    .preview-metrics {
        grid-template-columns: 1fr;
    }

    .purchase-preview-header {
        flex-direction: column;
    }
}

/* UI & Navigation v0.5.2 */
.nav-group {
    min-width: 0;
    border-radius: 8px;
}

.nav-group summary {
    position: relative;
    display: flex;
    min-height: 40px;
    align-items: center;
    padding: 10px 32px 10px 11px;
    border-radius: 7px;
    color: #d7d8dc;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.55px;
    list-style: none;
    user-select: none;
}

.nav-group summary::-webkit-details-marker { display: none; }

.nav-group summary::after {
    content: "›";
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    color: #858891;
    font-size: 18px;
    line-height: 1;
    transition: transform 0.15s ease;
}

.nav-group[open] summary::after {
    transform: translateY(-50%) rotate(90deg);
}

.nav-group summary:hover,
.nav-group[open] > summary {
    background: rgba(255, 255, 255, 0.055);
    color: #fff;
}

.nav-group-links {
    display: grid;
    gap: 3px;
    padding: 3px 0 7px 10px;
}

.nav-group-links a,
.nav-group-links .nav-disabled {
    min-height: 36px;
    padding: 8px 10px 8px 14px;
    font-size: 12px;
}

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

.document-meta-item {
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-soft);
}

.document-meta-item span,
.document-meta-item strong {
    display: block;
}

.document-meta-item span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.55px;
}

.document-meta-item strong {
    font-size: 14px;
    overflow-wrap: anywhere;
}

.purchase-line-highlight td {
    background: #fff4bf;
    border-top: 2px solid #d39b00;
    border-bottom: 2px solid #d39b00;
}

.purchase-line-highlight td:first-child {
    box-shadow: inset 4px 0 0 #d39b00;
}

.highlight-label {
    display: inline-flex;
    margin-top: 6px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #6f5200;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.45px;
    text-transform: uppercase;
}

@media (max-width: 1000px) {
    .document-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .nav-group { min-width: 0; }
    .nav-group-links { padding-left: 5px; }
    .document-meta-grid { grid-template-columns: 1fr; }
}

tr[id^="purchase-line-"] {
    scroll-margin-top: 24px;
}

@media (max-width: 760px) {
    .sidebar-nav > .nav-group { grid-column: 1 / -1; }
}

/* v0.6 unified party roles */
.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.choice-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border-color, #d9dce2);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}
.choice-card input {
    width: auto;
    margin-top: 3px;
}
.choice-card span, .choice-card strong, .choice-card small {
    display: block;
}
.choice-card small {
    margin-top: 4px;
    color: var(--muted-color, #6b6f78);
    line-height: 1.45;
}
@media (max-width: 760px) {
    .choice-grid { grid-template-columns: 1fr; }
}

/* v0.6.1 — consistent forms, checkboxes and customer/sales screens */
.field input[type="checkbox"],
.field input[type="radio"],
.check-field input[type="checkbox"],
.check-field input[type="radio"],
.checkbox-line input[type="checkbox"],
.checkbox-line input[type="radio"],
.choice-card input[type="checkbox"],
.choice-card input[type="radio"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 18px;
    flex: 0 0 18px;
    margin: 0;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--black);
}

.field label.checkbox-line {
    display: flex;
    min-height: 45px;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #cfd1d7;
    border-radius: 8px;
    background: #fff;
    color: #4f5259;
    line-height: 1.35;
}

.check-field {
    align-items: center;
}

.choice-card {
    min-height: 92px;
    align-items: flex-start;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.choice-card:hover {
    border-color: #aeb0b7;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.04);
}

.choice-card:has(input:checked) {
    border-color: var(--black);
    background: var(--surface-soft);
}

.party-form {
    display: grid;
    gap: 18px;
    margin-top: 0;
}

.party-form .panel + .panel {
    margin-top: 0;
}

.role-settings-panel .notice {
    margin-bottom: 20px;
}

.form-submit-panel {
    padding-top: 18px;
    padding-bottom: 18px;
}

.compact-form-stack {
    margin-top: 0;
}

.button {
    line-height: 1.2;
    white-space: nowrap;
}

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

.side-form > .button + .button {
    margin-top: 9px;
}

@media (max-width: 760px) {
    .button {
        white-space: normal;
    }

    .party-form .form-actions-between {
        align-items: stretch;
    }
}

/* v0.6.2 — Document Entry Workspace */
.content-shell:has(.document-workspace) {
    width: calc(100% - 24px);
    max-width: none;
    padding-top: 16px;
}

.document-workspace {
    overflow: visible;
    border: 1px solid #cfd3da;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(17, 24, 39, .06);
}

.document-workspace-toolbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 68px;
    padding: 10px 14px;
    border-bottom: 1px solid #cfd3da;
    border-radius: 10px 10px 0 0;
    background: #253148;
    color: #fff;
    box-shadow: 0 5px 16px rgba(17, 24, 39, .12);
}

.document-workspace-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.document-workspace-title h1 {
    overflow: hidden;
    margin: 0;
    color: #fff;
    font-size: 19px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-workspace-title p {
    overflow: hidden;
    margin: 3px 0 0;
    color: #c7cfdd;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-workspace-title .eyebrow {
    margin: 0 0 2px;
    color: #8fd0ff;
    font-size: 9px;
}

.workspace-back {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 7px;
    color: #fff;
    font-size: 19px;
    text-decoration: none;
}

.workspace-back:hover { background: rgba(255, 255, 255, .1); }

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

.workspace-toolbar-actions form { margin: 0; }

.button-compact {
    min-height: 35px;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
}

.document-workspace-toolbar .button-secondary {
    border-color: rgba(255, 255, 255, .32);
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.document-workspace-toolbar .button-primary {
    background: #2788d8;
    color: #fff;
}

.workspace-status {
    display: inline-flex;
    min-height: 29px;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    background: rgba(255, 255, 255, .09);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .45px;
    text-transform: uppercase;
}

.workspace-status-finalized { border-color: #76c997; background: rgba(36, 157, 84, .24); }
.workspace-status-cancelled { border-color: #e29b9b; background: rgba(174, 45, 45, .23); }

.document-header-form {
    padding: 14px 15px 10px;
    border-bottom: 1px solid #d9dde4;
    background: #f5f7fa;
}

.workspace-header-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(145px, 1fr));
    gap: 9px 12px;
}

.workspace-header-grid-purchase,
.workspace-header-grid-sales {
    grid-template-columns: minmax(125px, .8fr) minmax(170px, 1.15fr) minmax(260px, 1.8fr) minmax(140px, .9fr) minmax(160px, 1fr);
}

.workspace-field { min-width: 0; }
.workspace-field-wide { grid-column: span 1; }
.workspace-field-notes { grid-column: span 3; }

.workspace-field label {
    display: block;
    margin: 0 0 4px;
    color: #526074;
    font-size: 10px;
    font-weight: 800;
}

.workspace-field input,
.workspace-field select,
.workspace-field textarea {
    width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid #cbd1da;
    border-radius: 4px;
    background: #fff;
    color: #1f2937;
    font-size: 12px;
}

.workspace-field textarea {
    min-height: 58px;
    resize: vertical;
}

.workspace-field input:focus,
.workspace-field select:focus,
.workspace-field textarea:focus,
.document-entry-grid input:focus,
.document-entry-grid select:focus {
    border-color: #2788d8;
    outline: 2px solid rgba(39, 136, 216, .13);
}

.workspace-more-fields {
    margin-top: 9px;
    border-top: 1px solid #dde1e7;
}

.workspace-more-fields summary,
.workspace-support-panel summary {
    padding: 9px 0 2px;
    color: #315d8c;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.workspace-more-fields[open] summary { margin-bottom: 9px; }

.workspace-readonly-header {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-bottom: 1px solid #d9dde4;
    background: #f5f7fa;
}

.workspace-readonly-header > div {
    min-width: 0;
    padding: 12px 14px;
    border-right: 1px solid #d9dde4;
}

.workspace-readonly-header > div:last-child { border-right: 0; }
.workspace-readonly-header span,
.workspace-readonly-header strong { display: block; }
.workspace-readonly-header span { color: #687386; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.workspace-readonly-header strong { overflow: hidden; margin-top: 5px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.workspace-readonly-header a { color: #1c5f9c; text-decoration: none; }

.document-lines-region { background: #fff; }

.document-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 8px 14px;
    border-bottom: 1px solid #d7dce4;
    background: #edf2f8;
    color: #506077;
    font-size: 11px;
}

.document-section-heading span,
.document-section-heading strong { display: block; }
.document-section-heading span { color: #2788d8; font-size: 9px; font-weight: 900; letter-spacing: .8px; }
.document-section-heading strong { margin-top: 2px; color: #253148; font-size: 13px; }

.document-grid-wrap {
    width: 100%;
    max-height: min(52vh, 560px);
    overflow: auto;
    background: repeating-linear-gradient(to bottom, #fff 0, #fff 35px, #f5f7f9 36px);
}

.document-entry-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11px;
}

.purchase-entry-grid { min-width: 1550px; }
.sales-entry-grid { min-width: 1850px; }

.document-entry-grid th {
    position: sticky;
    top: 0;
    z-index: 8;
    padding: 7px 8px;
    border-right: 1px solid #d6dbe3;
    border-bottom: 1px solid #bcc5d1;
    background: #f1f4f8;
    color: #315d8c;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.document-entry-grid td {
    height: 38px;
    padding: 5px 8px;
    border-right: 1px solid #e0e4ea;
    border-bottom: 1px solid #e0e4ea;
    background: rgba(255, 255, 255, .97);
    vertical-align: middle;
}

.document-entry-grid tbody tr:hover td { background: #f5f9fd; }
.document-entry-grid td:first-child,
.document-entry-grid th:first-child { position: sticky; left: 0; z-index: 5; width: 42px; min-width: 42px; text-align: center; }
.document-entry-grid th:first-child { z-index: 10; }
.document-entry-grid td:first-child { background: #f7f8fa; color: #607087; font-weight: 800; }
.document-entry-grid td strong,
.document-entry-grid td small { display: block; }
.document-entry-grid td small { margin-top: 2px; color: #7b8492; font-size: 9px; line-height: 1.25; }
.document-entry-grid code { color: #174f82; font-size: 10px; font-weight: 800; }
.number-cell { text-align: right; white-space: nowrap; }

.document-input-row td {
    position: sticky;
    bottom: 0;
    z-index: 7;
    background: #eaf3fb !important;
    border-top: 2px solid #2788d8;
}

.document-input-row td:first-child { z-index: 9; background: #d9ebfa !important; color: #135f9d; font-size: 17px; }
.document-input-row.is-editing td { background: #fff6d9 !important; border-top-color: #d9a321; }
.document-input-row.is-editing td:first-child { background: #ffedb7 !important; color: #7c5b00; }

.document-entry-grid input,
.document-entry-grid select {
    width: 100%;
    min-width: 70px;
    height: 28px;
    padding: 4px 6px;
    border: 1px solid #bfc7d2;
    border-radius: 3px;
    background: #fff;
    font-size: 10px;
}

.document-entry-grid input[name="identifier"] { min-width: 175px; }
.grid-vat-cell { display: grid; grid-template-columns: 74px 1fr; gap: 4px; }
.input-row-help { display: block; max-width: 180px; color: #6b7686; font-size: 9px; line-height: 1.25; }

.document-row-actions {
    width: 72px;
    min-width: 72px;
    text-align: center;
    white-space: nowrap;
}

.document-row-actions form { display: inline; margin: 0; }
.document-row-actions a,
.document-row-actions button {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    margin: 0 1px;
    padding: 0;
    border: 1px solid #bdc5d0;
    border-radius: 4px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.document-row-actions button:hover,
.document-row-actions a:hover { border-color: #2788d8; color: #176cae; }
.document-row-actions button[title="Διαγραφή"] { color: #b42318; }
.grid-save-button { border-color: #2788d8 !important; background: #2788d8 !important; color: #fff !important; font-weight: 900; }

.document-row-highlight td {
    background: #fff2b6 !important;
    border-top: 2px solid #d59d00;
    border-bottom: 2px solid #d59d00;
}

.document-totals-footer {
    position: sticky;
    bottom: 0;
    z-index: 25;
    display: flex;
    justify-content: flex-end;
    min-height: 60px;
    border-top: 1px solid #bcc5d1;
    border-radius: 0 0 10px 10px;
    background: #f1f4f8;
    box-shadow: 0 -5px 16px rgba(17, 24, 39, .08);
}

.document-totals-footer > div {
    display: flex;
    min-width: 128px;
    flex-direction: column;
    justify-content: center;
    padding: 9px 13px;
    border-left: 1px solid #d3d9e1;
    text-align: right;
}

.document-totals-footer span,
.document-totals-footer strong,
.document-totals-footer small { display: block; }
.document-totals-footer span { color: #687386; font-size: 9px; font-weight: 800; }
.document-totals-footer strong { margin-top: 4px; color: #253148; font-size: 15px; }
.document-totals-footer small { margin-top: 2px; color: #607087; font-size: 9px; }
.document-total-primary { min-width: 165px !important; background: #253148; }
.document-total-primary span { color: #aebbd0; }
.document-total-primary strong { color: #fff; font-size: 19px; }
.document-totals-footer.is-disabled { opacity: .65; }

.document-lines-region.is-disabled { opacity: .7; }
.document-grid-placeholder { display: flex; min-height: 230px; flex-direction: column; align-items: center; justify-content: center; padding: 30px; color: #6a7483; text-align: center; }
.document-grid-placeholder strong { color: #374151; }
.document-grid-placeholder span { margin-top: 7px; font-size: 12px; }

.workspace-payment-panel,
.workspace-support-panel { margin-top: 18px; }
.workspace-support-panel { padding: 0 22px 18px; }
.workspace-support-panel summary { padding: 18px 0 10px; font-size: 13px; }
.workspace-payments-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.workspace-payment-form { display: grid; gap: 8px; padding: 14px; border: 1px solid #d9dde4; border-radius: 8px; background: #f7f9fb; }
.workspace-payment-form .button { width: 100%; }
.workspace-danger-zone { display: flex; justify-content: flex-end; margin-top: 18px; padding: 12px 0; }

@media (max-width: 1450px) {
    .workspace-header-grid-purchase,
    .workspace-header-grid-sales { grid-template-columns: repeat(4, minmax(145px, 1fr)); }
    .workspace-readonly-header { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .document-totals-footer { overflow-x: auto; justify-content: flex-start; }
    .document-totals-footer > div { min-width: 120px; }
}

@media (max-width: 980px) {
    .content-shell:has(.document-workspace) { width: calc(100% - 16px); }
    .document-workspace-toolbar { position: static; align-items: flex-start; flex-direction: column; }
    .workspace-toolbar-actions { width: 100%; flex-wrap: wrap; }
    .workspace-header-grid,
    .workspace-header-grid-purchase,
    .workspace-header-grid-sales,
    .workspace-readonly-header { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workspace-field-notes { grid-column: span 2; }
    .workspace-payments-layout { grid-template-columns: 1fr; }
    .document-totals-footer { position: static; }
}

@media (max-width: 620px) {
    .workspace-header-grid,
    .workspace-header-grid-purchase,
    .workspace-header-grid-sales,
    .workspace-readonly-header { grid-template-columns: 1fr; }
    .workspace-field-notes { grid-column: auto; }
    .workspace-toolbar-actions .button,
    .workspace-toolbar-actions form { width: 100%; }
    .workspace-toolbar-actions form .button { width: 100%; }
    .document-workspace-title h1 { max-width: 235px; }
}
.workspace-payment-panel .button-ghost {
    border-color: var(--border);
    background: #fff;
    color: var(--text);
}

/* v0.6.3 — Retail POS / Λιανική workspace */
.content-shell:has(.retail-workspace),
.content-shell:has(.retail-launcher) {
    width: calc(100% - 24px);
    max-width: none;
    padding-top: 14px;
}

.retail-launcher {
    display: grid;
    gap: 18px;
}

.retail-launcher-card {
    display: flex;
    min-height: 250px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #253148, #344563);
    color: #fff;
    box-shadow: 0 14px 34px rgba(17, 24, 39, .16);
}

.retail-launcher-card h1 {
    margin: 3px 0 8px;
    color: #fff;
    font-size: 32px;
}

.retail-launcher-card p:not(.eyebrow) {
    max-width: 620px;
    margin: 0 0 22px;
    color: #d5dceb;
    font-size: 14px;
    line-height: 1.55;
}

.retail-launcher-card .eyebrow { color: #8fd0ff; }
.retail-recent-panel { margin: 0; }

.retail-workspace {
    overflow: hidden;
    border: 1px solid #cbd2dc;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(17, 24, 39, .08);
}

.retail-hero {
    display: flex;
    min-height: 128px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 26px;
    background: #3d4964;
    color: #fff;
}

.retail-hero-copy { min-width: 0; }
.retail-hero-copy .eyebrow {
    margin: 0 0 5px;
    color: #8fd0ff;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .9px;
}

.retail-hero-copy h1 {
    overflow: hidden;
    margin: 0;
    color: #fff;
    font-size: 28px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.retail-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 13px;
}

.retail-hero-meta span {
    padding: 5px 9px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    background: rgba(255,255,255,.07);
    color: #d8dfeb;
    font-size: 10px;
}

.retail-grand-total {
    flex: 0 0 auto;
    text-align: right;
}

.retail-grand-total span,
.retail-grand-total strong { display: block; }
.retail-grand-total span {
    color: #b8c3d6;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.2px;
}

.retail-grand-total strong {
    margin-top: 4px;
    color: #fff;
    font-size: clamp(35px, 4.3vw, 66px);
    font-weight: 300;
    line-height: 1;
    white-space: nowrap;
}

.retail-commandbar {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-bottom: 1px solid #cbd2dc;
    background: #2f83c9;
}

.retail-commandbar form { margin: 0; }
.retail-commandbar .button-secondary {
    border-color: rgba(255,255,255,.34);
    background: rgba(255,255,255,.1);
    color: #fff;
}
.retail-commandbar .button-primary { background: #fff; color: #1d69a4; }
.retail-commandbar .button:disabled { opacity: .48; cursor: not-allowed; }
.retail-shortcut-hint {
    margin-left: auto;
    color: rgba(255,255,255,.82);
    font-size: 10px;
}

.retail-header-form {
    padding: 10px 13px;
    border-bottom: 1px solid #d8dde5;
    background: #f5f7fa;
}

.retail-header-grid {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) 110px 145px minmax(240px, 1.5fr) minmax(170px, 1fr) minmax(170px, 1fr);
    gap: 8px 11px;
}

.retail-header-grid .workspace-field label { color: #3977ad; }
.retail-header-grid input[readonly] { background: #e9edf2; color: #667085; }

.retail-header-readonly {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-bottom: 1px solid #d8dde5;
    background: #f5f7fa;
}

.retail-header-readonly > div {
    min-width: 0;
    padding: 11px 13px;
    border-right: 1px solid #d8dde5;
}
.retail-header-readonly > div:last-child { border-right: 0; }
.retail-header-readonly span,
.retail-header-readonly strong { display: block; }
.retail-header-readonly span { color: #6b7789; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.retail-header-readonly strong { overflow: hidden; margin-top: 4px; color: #263449; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.retail-items-section { background: #fff; }
.retail-section-title {
    display: flex;
    min-height: 43px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid #d8dde5;
    background: #f7f9fb;
}
.retail-section-title strong { color: #263449; font-size: 14px; }
.retail-section-title span { color: #677487; font-size: 10px; }

.retail-grid-wrap {
    min-height: 330px;
    max-height: 52vh;
    overflow: auto;
    background: repeating-linear-gradient(to bottom, #fff 0, #fff 35px, #f6f8fa 36px);
}

.retail-entry-grid {
    width: 100%;
    min-width: 1260px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 10.5px;
}

.retail-entry-grid th {
    position: sticky;
    top: 0;
    z-index: 6;
    height: 34px;
    padding: 7px 8px;
    border-right: 1px solid #d4dae3;
    border-bottom: 1px solid #bdc7d4;
    background: #f1f4f8;
    color: #2d73ad;
    font-size: 9.5px;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
}

.retail-entry-grid td {
    height: 37px;
    padding: 5px 7px;
    border-right: 1px solid #e0e5eb;
    border-bottom: 1px solid #e0e5eb;
    background: rgba(255,255,255,.98);
    vertical-align: middle;
}

.retail-entry-grid tbody tr:hover td { background: #f5f9fd; }
.retail-entry-grid td:first-child,
.retail-entry-grid th:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    width: 34px;
    min-width: 34px;
    background: #f4f6f9;
    text-align: center;
}
.retail-entry-grid th:first-child { z-index: 8; }
.retail-entry-grid code { color: #185c95; font-size: 10px; font-weight: 800; }
.retail-entry-grid strong { color: #263449; }

.retail-input-row td {
    position: sticky;
    top: 34px;
    z-index: 4;
    background: #eaf3fb !important;
    border-bottom: 2px solid #2f83c9;
}
.retail-input-row td:first-child { z-index: 7; background: #d8ebfa !important; color: #176da9; font-size: 16px; }
.retail-input-row.is-editing td { background: #fff6d9 !important; border-bottom-color: #d9a321; }

.retail-entry-grid input,
.retail-entry-grid select {
    width: 100%;
    min-width: 68px;
    height: 28px;
    padding: 4px 6px;
    border: 1px solid #bcc6d2;
    border-radius: 3px;
    background: #fff;
    font-size: 10px;
}
.retail-entry-grid input:focus,
.retail-entry-grid select:focus { border-color: #2f83c9; outline: 2px solid rgba(47,131,201,.14); }
.retail-entry-grid input[name="identifier"] { min-width: 225px; font-weight: 700; }
.retail-input-row span { color: #697789; font-size: 9px; }

.retail-row-actions {
    width: 68px;
    min-width: 68px;
    text-align: center;
    white-space: nowrap;
}
.retail-row-actions form { display: inline; margin: 0; }
.retail-row-actions a,
.retail-row-actions button {
    display: inline-flex;
    width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    margin: 0 1px;
    padding: 0;
    border: 1px solid #bdc6d1;
    border-radius: 3px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    text-decoration: none;
}

.retail-payment-area {
    display: grid;
    grid-template-columns: minmax(310px, .8fr) minmax(560px, 1.65fr);
    gap: 15px;
    padding: 14px;
    border-top: 1px solid #cfd6df;
    background: #f5f7fa;
}

.retail-payment-summary,
.retail-payment-grid {
    border: 1px solid #d5dbe3;
    border-radius: 6px;
    background: #fff;
}

.retail-payment-summary { padding: 13px; }
.retail-payment-summary h2 { margin: 0 0 10px; color: #263449; font-size: 13px; }
.retail-payment-summary dl { margin: 0; }
.retail-payment-summary dl > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 29px;
    border-bottom: 1px solid #edf0f4;
}
.retail-payment-summary dt { color: #667386; font-size: 10px; }
.retail-payment-summary dd { margin: 0; color: #263449; font-size: 11px; font-weight: 800; }
.retail-payment-summary .retail-outstanding dt,
.retail-payment-summary .retail-outstanding dd { color: #b42318; }
.retail-payment-summary .retail-change dt,
.retail-payment-summary .retail-change dd { color: #1c7d43; }

.retail-quick-payments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.retail-quick-payments form { margin: 0; }

.retail-payment-grid-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 39px;
    padding: 8px 11px;
    border-bottom: 1px solid #d5dbe3;
    background: #f7f9fb;
}
.retail-payment-grid-heading strong { color: #263449; font-size: 12px; }
.retail-payment-grid-heading span { color: #2d73ad; font-size: 11px; font-weight: 800; }
.retail-payment-grid table { font-size: 10px; }
.retail-payment-entry {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 120px minmax(160px, 1fr) auto;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border-top: 1px solid #d5dbe3;
    background: #f7f9fb;
}
.retail-payment-entry .button { min-height: 34px; }
.retail-clear-payments { display: flex; justify-content: flex-end; margin: 0; padding: 0 10px 10px; background: #f7f9fb; }

.retail-footer-totals {
    display: flex;
    justify-content: flex-end;
    min-height: 62px;
    border-top: 1px solid #bdc7d4;
    background: #eef2f6;
}
.retail-footer-totals > div {
    display: flex;
    min-width: 135px;
    flex-direction: column;
    justify-content: center;
    padding: 8px 13px;
    border-left: 1px solid #d2d9e2;
    text-align: right;
}
.retail-footer-totals span,
.retail-footer-totals strong { display: block; }
.retail-footer-totals span { color: #697689; font-size: 9px; font-weight: 900; }
.retail-footer-totals strong { margin-top: 4px; color: #263449; font-size: 15px; }
.retail-footer-primary { min-width: 190px !important; background: #3d4964; }
.retail-footer-primary span { color: #bec8d9; }
.retail-footer-primary strong { color: #fff; font-size: 23px; }

@media (max-width: 1450px) {
    .retail-header-grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
    .retail-header-readonly { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .retail-payment-area { grid-template-columns: minmax(280px, .75fr) minmax(480px, 1.45fr); }
}

@media (max-width: 1050px) {
    .content-shell:has(.retail-workspace),
    .content-shell:has(.retail-launcher) { width: calc(100% - 16px); }
    .retail-hero { align-items: flex-start; flex-direction: column; }
    .retail-grand-total { width: 100%; text-align: left; }
    .retail-commandbar { flex-wrap: wrap; }
    .retail-shortcut-hint { width: 100%; margin-left: 0; }
    .retail-header-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .retail-payment-area { grid-template-columns: 1fr; }
    .retail-payment-entry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .retail-footer-totals { overflow-x: auto; justify-content: flex-start; }
}

@media (max-width: 650px) {
    .retail-launcher-card { padding: 25px; }
    .retail-hero { padding: 18px; }
    .retail-hero-copy h1 { font-size: 22px; }
    .retail-grand-total strong { font-size: 38px; }
    .retail-header-grid,
    .retail-header-readonly { grid-template-columns: 1fr; }
    .retail-payment-entry { grid-template-columns: 1fr; }
    .retail-commandbar form,
    .retail-commandbar .button { width: 100%; }
    .retail-commandbar form .button { width: 100%; }
}

/* Returns & supplier credit transformations v0.6.4 */
.return-tabs { margin-bottom: 18px; }
.compact-number-input {
    width: 92px;
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid #cfd1d7;
    border-radius: 7px;
    text-align: right;
}
.transform-source-card { margin-bottom: 18px; }
.document-header-readonly {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--border);
}
.document-header-readonly > div {
    min-width: 0;
    padding: 13px 15px;
    background: #fff;
}
.document-header-readonly span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .45px;
    text-transform: uppercase;
}
.document-header-readonly strong { display: block; overflow-wrap: anywhere; }
.inline-edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; min-width: 210px; }
.inline-edit-fields input {
    width: 100%;
    min-height: 36px;
    padding: 7px 8px;
    border: 1px solid #cfd1d7;
    border-radius: 6px;
}
@media (max-width: 980px) {
    .document-header-readonly { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .document-header-readonly { grid-template-columns: 1fr; }
    .compact-number-input { width: 78px; }
}

/* v0.6.5 — unified supplier-return workspace */
.supplier-return-secondary-header {
    border-top: 1px solid #e6eaf0;
    background: #fbfcfe;
}
.supplier-return-entry-grid { min-width: 1500px; }
.workspace-field-actions { align-self: end; }
.workspace-field-actions .button { min-height: 42px; }
@media (max-width: 760px) {
    .supplier-return-entry-grid { min-width: 1280px; }
}

/* v0.6.6 — document quick party creation */
.select-with-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}
.select-create-button {
    white-space: nowrap;
    min-height: 38px;
}
.erp-dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    padding: 0;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 22px 80px rgba(15, 23, 42, .28);
    background: var(--surface, #fff);
    color: inherit;
}
.erp-dialog::backdrop {
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(2px);
}
.erp-dialog-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.erp-dialog-header h2 { margin: 2px 0 4px; }
.erp-dialog-header p:last-child { margin: 0; color: var(--muted, #64748b); }
.dialog-close {
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted, #64748b);
}
.quick-party-create-form { padding: 20px 24px 24px; }
.quick-party-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quick-party-grid .field-span-2 { grid-column: span 2; }
.quick-party-grid small { display: block; margin-top: 4px; color: var(--muted, #64748b); }
.quick-party-other-role { margin-top: 4px; }
.quick-party-message { min-height: 24px; margin-top: 10px; font-size: 14px; }
.quick-party-message.is-error { color: #b91c1c; }
.quick-party-message.is-success { color: #047857; }
.quick-party-message.is-loading { color: var(--muted, #64748b); }
.erp-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border, #e5e7eb);
}
@media (max-width: 720px) {
    .select-with-action { grid-template-columns: 1fr; }
    .quick-party-grid { grid-template-columns: 1fr; }
    .quick-party-grid .field-span-2 { grid-column: span 1; }
    .erp-dialog-header, .quick-party-create-form { padding-left: 16px; padding-right: 16px; }
}

/* v0.6.6 — unified document effects */
.document-effect-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

/* v0.6.7 — supplier analysis alignment, sellout and visible quick-create actions */
.supplier-analysis-table {
    width: 100%;
    table-layout: fixed;
}
.supplier-analysis-table th,
.supplier-analysis-table td {
    vertical-align: top;
}
.supplier-analysis-table th.number-cell,
.supplier-analysis-table td.number-cell {
    text-align: right;
}
.supplier-analysis-monthly {
    min-width: 1120px;
}
.purchase-analysis-grid-wide {
    grid-template-columns: 1fr;
}
.supplier-sellout-table {
    min-width: 980px;
}
.supplier-sellout-table th:first-child,
.supplier-sellout-table td:first-child {
    width: 22%;
    text-align: left;
}
.supplier-sellout-table th:nth-child(2),
.supplier-sellout-table td:nth-child(2),
.supplier-sellout-table th:nth-child(4),
.supplier-sellout-table td:nth-child(4),
.supplier-sellout-table th:nth-child(6),
.supplier-sellout-table td:nth-child(6) {
    width: 12%;
}
.supplier-sellout-table th:nth-child(3),
.supplier-sellout-table td:nth-child(3),
.supplier-sellout-table th:nth-child(5),
.supplier-sellout-table td:nth-child(5) {
    width: 21%;
}
.sellout-rate {
    display: inline-flex;
    min-width: 64px;
    justify-content: flex-end;
    font-weight: 900;
    color: #0f766e;
}
.quick-party-toolbar-button {
    white-space: nowrap;
    border-color: rgba(255, 255, 255, .45);
    color: #fff;
}
.document-workspace-toolbar .quick-party-toolbar-button:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}
.select-create-button {
    min-width: 142px;
    justify-content: center;
}
@media (max-width: 980px) {
    .quick-party-toolbar-button { display: none; }
    .select-create-button { min-width: 0; }
}

/* v0.6.7.1 — price history alignment and robust quick-party dialog */
.supplier-price-history-table {
    min-width: 1240px;
    table-layout: fixed;
}
.supplier-price-history-table col.col-date { width: 112px; }
.supplier-price-history-table col.col-document { width: 180px; }
.supplier-price-history-table col.col-item { width: 390px; }
.supplier-price-history-table col.col-brand-season { width: 170px; }
.supplier-price-history-table col.col-quantity { width: 72px; }
.supplier-price-history-table col.col-cost { width: 142px; }
.supplier-price-history-table col.col-wholesale { width: 148px; }
.supplier-price-history-table col.col-retail { width: 115px; }
.supplier-price-history-table th,
.supplier-price-history-table td {
    box-sizing: border-box;
}
.supplier-price-history-table th.number-cell,
.supplier-price-history-table td.number-cell {
    text-align: right;
}
.supplier-price-history-table th {
    white-space: nowrap;
}
.erp-dialog[open] {
    display: block;
}
html.erp-dialog-is-open {
    overflow: hidden;
}

/* v0.7.0 — Shop n Trade SellOut */
.sellout-period-table { min-width: 1120px; }
.sellout-lines-table { min-width: 1720px; table-layout: fixed; }
.sellout-lines-table th:nth-child(1), .sellout-lines-table td:nth-child(1) { width: 54px; }
.sellout-lines-table th:nth-child(2), .sellout-lines-table td:nth-child(2) { width: 125px; }
.sellout-lines-table th:nth-child(3), .sellout-lines-table td:nth-child(3) { width: 155px; }
.sellout-lines-table th:nth-child(4), .sellout-lines-table td:nth-child(4) { width: 145px; }
.sellout-lines-table th:nth-child(5), .sellout-lines-table td:nth-child(5) { width: 310px; }
.sellout-lines-table th:nth-child(n+6):nth-child(-n+12),
.sellout-lines-table td:nth-child(n+6):nth-child(-n+12) { width: 105px; }
.sellout-lines-table th:nth-child(13), .sellout-lines-table td:nth-child(13) { width: 185px; }
.sellout-workspace { overflow: hidden; }
.sellout-summary-grid { grid-template-columns: repeat(8, minmax(110px, 1fr)); }
.sellout-allocation-row td { background: #f8fafc; padding-top: 8px; padding-bottom: 8px; }
.sellout-allocation-row summary { cursor: pointer; font-weight: 700; color: #334155; }
.allocation-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.allocation-chips span { display: inline-flex; gap: 4px; align-items: center; padding: 6px 9px; border: 1px solid #dbe3ed; border-radius: 999px; background: #fff; font-size: 12px; }
.row-error > td { background: #fff3f3; }
.badge-error { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 22px; border-color: #fecaca; }
.document-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 1200px) {
    .sellout-summary-grid { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
}
@media (max-width: 760px) {
    .sellout-summary-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
    .danger-zone { align-items: stretch; flex-direction: column; }
}

/* v0.7.0.2 — SellOut UI polish */
.sellout-shell {
    overflow: visible;
    border-color: #cbd3df;
    background: #eef2f6;
}

.sellout-workspace-toolbar {
    position: sticky;
    top: 0;
    z-index: 35;
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 14px;
    border-radius: 10px 10px 0 0;
    background: #253148;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .18);
    color: #fff;
}

.sellout-toolbar-identity,
.sellout-toolbar-actions,
.sellout-period-heading,
.sellout-section-heading,
.sellout-section-heading-badges,
.sellout-notice,
.sellout-danger-zone {
    display: flex;
    align-items: center;
}

.sellout-toolbar-identity {
    min-width: 0;
    gap: 12px;
}

.sellout-back-button {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 8px;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
}

.sellout-back-button:hover { background: rgba(255, 255, 255, .1); }

.sellout-toolbar-title { min-width: 0; }
.sellout-toolbar-title p {
    margin: 0 0 2px;
    color: #94cfff;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.2px;
}
.sellout-toolbar-title h1 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    line-height: 1.1;
}

.sellout-status {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .45px;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.sellout-workspace-toolbar .sellout-status-draft {
    border-color: rgba(147, 197, 253, .38);
    background: rgba(37, 99, 235, .22);
    color: #dbeafe;
}
.sellout-workspace-toolbar .sellout-status-review {
    border-color: rgba(253, 224, 71, .42);
    background: rgba(202, 138, 4, .24);
    color: #fef9c3;
}
.sellout-workspace-toolbar .sellout-status-finalized {
    border-color: rgba(134, 239, 172, .42);
    background: rgba(22, 163, 74, .24);
    color: #dcfce7;
}

.sellout-toolbar-actions {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.sellout-toolbar-actions form { margin: 0; }

.sellout-action-button {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 800;
}
.sellout-action-secondary {
    border-color: rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .08);
    color: #fff;
}
.sellout-action-secondary:hover { background: rgba(255, 255, 255, .15); }
.sellout-action-primary {
    border-color: #2588d8;
    background: #2588d8;
    color: #fff;
}
.sellout-export-button {
    border-color: #d8e6f4;
    background: #fff;
    color: #174f82;
}
.sellout-export-button:hover { border-color: #9cc3e8; background: #eef7ff; }
.sellout-export-detailed {
    border-color: #a8d9c0;
    background: #edf9f2;
    color: #17663a;
}
.sellout-export-detailed:hover { border-color: #75bf98; background: #e1f5ea; }

.sellout-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(560px, 1fr);
    gap: 22px;
    padding: 24px;
    border-bottom: 1px solid #d6dde6;
    background: linear-gradient(135deg, #ffffff 0%, #f5f8fc 100%);
}

.sellout-overview-main { min-width: 0; }
.sellout-overview-eyebrow {
    margin: 0 0 8px;
    color: #607086;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.4px;
}
.sellout-period-heading {
    gap: 12px;
    margin-bottom: 7px;
}
.sellout-period-heading h2 {
    margin: 0;
    color: #152238;
    font-size: 34px;
    line-height: 1;
}
.sellout-period-heading .sellout-status-draft { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.sellout-period-heading .sellout-status-review { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.sellout-period-heading .sellout-status-finalized { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.sellout-overview-main h3 {
    margin: 0;
    color: #374151;
    font-size: 15px;
    font-weight: 700;
}

.sellout-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 19px;
}
.sellout-meta-row > span {
    display: flex;
    min-width: 170px;
    flex-direction: column;
    padding: 9px 12px;
    border: 1px solid #dce3ec;
    border-radius: 8px;
    background: rgba(255, 255, 255, .82);
}
.sellout-meta-row small {
    color: #7a8797;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}
.sellout-meta-row strong {
    margin-top: 4px;
    color: #26364c;
    font-size: 12px;
}

.sellout-overview-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-self: stretch;
}
.sellout-feature-metric {
    display: flex;
    min-height: 132px;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
    border: 1px solid #d9e1eb;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 7px 18px rgba(31, 41, 55, .05);
}
.sellout-feature-metric > span {
    color: #68778a;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}
.sellout-feature-metric > strong {
    margin-top: 9px;
    color: #1f2f46;
    font-size: 25px;
    line-height: 1.05;
    white-space: nowrap;
}
.sellout-feature-metric > strong small { font-size: 11px; }
.sellout-feature-metric > em {
    margin-top: 8px;
    color: #8590a0;
    font-size: 9px;
    font-style: normal;
}
.sellout-feature-metric-accent {
    border-color: #8ab9e4;
    background: #26364d;
}
.sellout-feature-metric-accent > span { color: #b8c9dd; }
.sellout-feature-metric-accent > strong { color: #fff; }
.sellout-feature-metric-accent > em { color: #aebdd0; }
.sellout-feature-metric-profit {
    border-color: #b7dfc8;
    background: #f2fbf6;
}
.sellout-feature-metric-profit > span { color: #42765a; }
.sellout-feature-metric-profit > strong { color: #17663a; }
.sellout-feature-metric-profit > em { color: #648673; }

.sellout-kpi-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(115px, 1fr));
    gap: 1px;
    border-bottom: 1px solid #d6dde6;
    background: #d6dde6;
}
.sellout-kpi-grid article {
    display: flex;
    min-height: 92px;
    flex-direction: column;
    justify-content: center;
    padding: 13px 15px;
    background: #fff;
}
.sellout-kpi-grid span,
.sellout-kpi-grid strong,
.sellout-kpi-grid small { display: block; }
.sellout-kpi-grid span {
    color: #7a8797;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}
.sellout-kpi-grid strong {
    margin-top: 7px;
    color: #27364b;
    font-size: 20px;
}
.sellout-kpi-grid small {
    margin-top: 3px;
    color: #929cab;
    font-size: 9px;
}
.sellout-kpi-grid .sellout-kpi-emphasis { background: #f1f7fd; }
.sellout-kpi-grid .sellout-kpi-emphasis strong { color: #176cae; }

.sellout-notice {
    gap: 12px;
    margin: 18px 20px 0;
    padding: 13px 15px;
    border: 1px solid;
    border-radius: 9px;
}
.sellout-notice-icon {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 900;
}
.sellout-notice strong,
.sellout-notice span { display: block; }
.sellout-notice strong { font-size: 12px; }
.sellout-notice span { margin-top: 2px; font-size: 10px; }
.sellout-notice-success { border-color: #b7dfc5; background: #f0faf4; color: #17643a; }
.sellout-notice-success .sellout-notice-icon { background: #d9f2e2; }
.sellout-notice-error { border-color: #f1bcbc; background: #fff4f4; color: #982727; }
.sellout-notice-error .sellout-notice-icon { background: #fbe0e0; }

.sellout-section-card {
    margin: 18px 20px 0;
    overflow: hidden;
    border: 1px solid #d4dce6;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(31, 41, 55, .035);
}
.sellout-section-heading {
    min-height: 70px;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 16px;
    border-bottom: 1px solid #dbe1e9;
    background: #f7f9fc;
}
.sellout-section-heading > div:first-child { min-width: 0; }
.sellout-section-heading p {
    margin: 0 0 3px;
    color: #2981c5;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.15px;
}
.sellout-section-heading h2 {
    margin: 0;
    color: #25344a;
    font-size: 16px;
}
.sellout-section-heading > div:first-child > span {
    display: block;
    margin-top: 3px;
    color: #818c9b;
    font-size: 9px;
}
.sellout-section-heading-badges { flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.sellout-count-pill,
.sellout-ready-pill {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.sellout-count-pill { border-color: #cbd7e5; background: #fff; color: #52647a; }
.sellout-ready-pill { border-color: #b9dfc8; background: #f0faf4; color: #17643a; }

.sellout-table-wrap {
    max-height: min(58vh, 650px);
    overflow: auto;
    background: #fff;
}
.sellout-lines-table { min-width: 1690px; }
.sellout-lines-table thead th {
    position: sticky;
    top: 0;
    z-index: 8;
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #bec9d7;
    background: #edf2f8;
    color: #53647a;
    font-size: 9px;
    letter-spacing: .25px;
    text-transform: uppercase;
}
.sellout-lines-table td {
    padding-top: 11px;
    padding-bottom: 11px;
    vertical-align: middle;
}
.sellout-data-row:hover > td { background: #f7fbff; }
.sellout-return-row > td { background: #fffaf2; }
.sellout-return-row:hover > td { background: #fff5e5; }
.sellout-line-number { color: #768397; font-weight: 800; }
.sellout-product-title { display: block; max-width: 300px; line-height: 1.25; }

.sellout-type-pill,
.sellout-check-pill,
.sellout-export-type {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}
.sellout-type-sale { border-color: #b9dfc8; background: #f0faf4; color: #17643a; }
.sellout-type-return { border-color: #f1d19d; background: #fff8eb; color: #985c08; }
.sellout-check-ready { border-color: #b9dfc8; background: #f0faf4; color: #17643a; }
.sellout-check-error { border-color: #f0baba; background: #fff1f1; color: #9b2929; }
.sellout-export-type { border-color: #c9d8e9; background: #f2f7fc; color: #315d8c; text-transform: uppercase; }

.sellout-allocation-row td {
    padding: 0 12px 10px;
    border-bottom: 1px solid #dce3eb;
    background: #f7f9fc;
}
.sellout-fifo-details {
    overflow: hidden;
    border: 1px solid #d9e1eb;
    border-radius: 8px;
    background: #fff;
}
.sellout-fifo-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    color: #37516f;
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
    list-style-position: inside;
}
.sellout-fifo-details summary small { color: #7e8998; font-size: 9px; font-weight: 700; }
.sellout-fifo-details[open] summary { border-bottom: 1px solid #e0e6ed; background: #f6f9fc; }
.sellout-allocation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
    padding: 10px;
}
.sellout-allocation-grid article {
    padding: 10px;
    border: 1px solid #dce4ed;
    border-radius: 7px;
    background: #fbfcfe;
}
.sellout-allocation-grid span,
.sellout-allocation-grid strong,
.sellout-allocation-grid small { display: block; }
.sellout-allocation-grid span { color: #7b8797; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.sellout-allocation-grid strong { margin-top: 4px; color: #26364c; font-size: 11px; }
.sellout-allocation-grid small { margin-top: 3px; color: #69778a; font-size: 9px; }

.sellout-export-history-table { min-width: 820px; }
.sellout-export-history-table td code { font-size: 10px; }

.sellout-danger-zone {
    gap: 15px;
    margin: 18px 20px 20px;
    padding: 16px;
    border: 1px solid #efb6b6;
    border-radius: 10px;
    background: #fff7f7;
}
.sellout-danger-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f9dddd;
    color: #9e2424;
    font-size: 18px;
    font-weight: 900;
}
.sellout-danger-copy { min-width: 0; flex: 1 1 auto; }
.sellout-danger-copy p {
    margin: 0 0 3px;
    color: #a33a3a;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1px;
}
.sellout-danger-copy h2 { margin: 0; color: #7f2525; font-size: 15px; }
.sellout-danger-copy span { display: block; margin-top: 4px; color: #8d6666; font-size: 10px; }
.sellout-danger-zone form { margin: 0; flex: 0 0 auto; }
.sellout-delete-button { min-height: 38px; border-radius: 7px; }

@media (max-width: 1350px) {
    .sellout-overview { grid-template-columns: 1fr; }
    .sellout-overview-totals { max-width: 720px; }
    .sellout-kpi-grid { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
}

@media (max-width: 980px) {
    .sellout-workspace-toolbar { position: static; align-items: flex-start; flex-direction: column; }
    .sellout-toolbar-actions { width: 100%; justify-content: flex-start; }
    .sellout-overview-totals { grid-template-columns: 1fr; width: 100%; max-width: none; }
    .sellout-feature-metric { min-height: 110px; }
}

@media (max-width: 760px) {
    .sellout-overview { padding: 18px 14px; }
    .sellout-period-heading { align-items: flex-start; flex-direction: column; }
    .sellout-period-heading h2 { font-size: 29px; }
    .sellout-meta-row { flex-direction: column; }
    .sellout-meta-row > span { min-width: 0; width: 100%; }
    .sellout-kpi-grid { grid-template-columns: repeat(2, minmax(115px, 1fr)); }
    .sellout-notice,
    .sellout-section-card,
    .sellout-danger-zone { margin-left: 10px; margin-right: 10px; }
    .sellout-section-heading { align-items: flex-start; flex-direction: column; }
    .sellout-section-heading-badges { justify-content: flex-start; }
    .sellout-danger-zone { align-items: flex-start; flex-wrap: wrap; }
    .sellout-danger-zone form { width: 100%; }
    .sellout-delete-button { width: 100%; }
}

/* Financials v0.7.1 */
.field-span-full { grid-column: 1 / -1; }
.financial-workspace { display: grid; gap: 18px; }
.financial-summary-grid { margin: 0; }
.financial-allocation-panel .allocation-input { min-width: 120px; text-align: right; }
.financial-danger-zone { margin-top: 0; }
.financial-danger-zone .heading-actions { align-items: center; flex-wrap: wrap; }
.financial-workspace .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 980px) {
    .financial-workspace .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .financial-workspace .detail-grid { grid-template-columns: 1fr; }
    .financial-allocation-panel .allocation-input { min-width: 96px; }
}

/* Financial Document View Polish v0.7.1.1 */
.financial-workspace {
    display: block;
    overflow: hidden;
    background: #f3f5f8;
}

.financial-toolbar { border-bottom: 0; }
.financial-direction-out .financial-toolbar { background: linear-gradient(105deg, #293449 0%, #353f53 100%); }
.financial-direction-in .financial-toolbar { background: linear-gradient(105deg, #203a37 0%, #2d4a45 100%); }
.financial-toolbar-copy { min-width: 0; }

.financial-overview {
    display: grid;
    grid-template-columns: minmax(380px, 1.2fr) minmax(520px, 1fr);
    gap: 16px;
    padding: 18px;
    border-bottom: 1px solid #d9dee6;
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
}

.financial-identity-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 18px;
    padding: 20px;
    border: 1px solid #d9dee7;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(24, 36, 55, .05);
}

.financial-direction-mark {
    display: inline-flex;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 32px;
    font-weight: 800;
}
.financial-direction-out .financial-direction-mark { background: #fff1ed; color: #c44a2f; }
.financial-direction-in .financial-direction-mark { background: #e9f8f1; color: #177653; }
.financial-identity-copy { min-width: 0; }
.financial-overline {
    margin: 0 0 5px;
    color: #6c7788;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .75px;
}
.financial-identity-copy h2 {
    overflow: hidden;
    margin: 0;
    color: #1f2937;
    font-size: 24px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.financial-identity-copy > p:not(.financial-overline) { margin: 6px 0 0; color: #6a7483; font-size: 12px; }
.financial-meta-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.financial-meta-chips span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 29px;
    padding: 5px 9px;
    border: 1px solid #dce1e8;
    border-radius: 7px;
    background: #f7f8fa;
    color: #384457;
    font-size: 10px;
}
.financial-meta-chips b { color: #788394; font-size: 8px; letter-spacing: .45px; text-transform: uppercase; }

.financial-feature-metrics { display: grid; grid-template-columns: repeat(3, minmax(145px, 1fr)); gap: 10px; }
.financial-feature-card {
    display: flex;
    min-height: 135px;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
    border: 1px solid #d9dee7;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(24, 36, 55, .04);
}
.financial-feature-card span { color: #768195; font-size: 10px; font-weight: 800; letter-spacing: .35px; text-transform: uppercase; }
.financial-feature-card strong { margin-top: 8px; color: #253044; font-size: 24px; line-height: 1.05; }
.financial-feature-card small { margin-top: 8px; color: #8490a0; font-size: 10px; line-height: 1.4; }
.financial-feature-primary { border-color: #aac9e6; background: linear-gradient(145deg, #eef7ff, #ffffff); }
.financial-direction-out .financial-feature-primary { border-color: #efc9be; background: linear-gradient(145deg, #fff5f1, #ffffff); }
.financial-direction-in .financial-feature-primary { border-color: #b7dfcd; background: linear-gradient(145deg, #eefaf5, #ffffff); }
.financial-feature-warning { border-color: #ecd6a4; background: #fffaf0; }

.financial-document-form { display: grid; gap: 14px; padding: 16px 18px 0; }
.financial-section-card {
    margin: 16px 18px 0;
    overflow: hidden;
    border: 1px solid #d9dee7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(25, 35, 52, .035);
}
.financial-document-form .financial-section-card { margin: 0; }
.financial-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 17px;
    border-bottom: 1px solid #e2e6ec;
    background: #fbfcfd;
}
.financial-section-heading h2 { margin: 1px 0 0; color: #263247; font-size: 16px; }
.financial-section-heading .eyebrow { margin: 0; font-size: 9px; }
.financial-section-heading p:not(.eyebrow) { margin: 4px 0 0; color: #7b8594; font-size: 10px; }
.financial-count-pill {
    display: inline-flex;
    min-height: 28px;
    flex: 0 0 auto;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid #d5dbe4;
    border-radius: 999px;
    background: #f5f7fa;
    color: #4b586b;
    font-size: 10px;
    font-weight: 800;
}
.financial-form-grid { padding: 16px 17px 18px; }
.financial-form-grid textarea { min-height: 74px; }

.financial-detail-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}
.financial-detail-group { min-width: 0; padding: 18px; border-right: 1px solid #e5e8ed; }
.financial-detail-group:last-child { border-right: 0; }
.financial-detail-eyebrow { margin: 0 0 12px; color: #798498; font-size: 9px; font-weight: 900; letter-spacing: .8px; }
.financial-detail-group dl { margin: 0; }
.financial-detail-group dl > div { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(0, 1.2fr); gap: 12px; padding: 8px 0; border-bottom: 1px dashed #e4e7ec; }
.financial-detail-group dl > div:last-child { border-bottom: 0; }
.financial-detail-group dt { color: #7e8998; font-size: 10px; }
.financial-detail-group dd { overflow-wrap: anywhere; margin: 0; color: #263247; font-size: 11px; font-weight: 750; text-align: right; }
.financial-text-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border-top: 1px solid #e3e7ed; background: #e3e7ed; }
.financial-text-notes > div { padding: 14px 18px; background: #fafbfc; }
.financial-text-notes span { color: #7a8696; font-size: 9px; font-weight: 850; letter-spacing: .55px; text-transform: uppercase; }
.financial-text-notes p { margin: 5px 0 0; color: #354156; font-size: 11px; line-height: 1.55; }

.financial-table-wrap { border: 0; }
.financial-allocation-table { table-layout: fixed; }
.financial-allocation-table th:nth-child(1) { width: 115px; }
.financial-allocation-table th:nth-child(2) { width: 190px; }
.financial-allocation-table th:nth-child(3) { width: 190px; }
.financial-allocation-table th:nth-child(4),
.financial-allocation-table th:nth-child(5),
.financial-allocation-table th:nth-child(6) { width: 145px; }
.financial-allocation-table th { background: #f6f8fa; color: #616d7f; font-size: 9px; letter-spacing: .35px; text-transform: uppercase; }
.financial-allocation-table td { vertical-align: middle; }
.financial-allocation-table tbody tr:hover { background: #f8fbfe; }
.financial-allocation-panel .allocation-input { width: 118px; min-width: 0; text-align: right; }

.financial-delete-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 16px 18px 18px;
    padding: 15px 17px;
    border: 1px solid #efc8c8;
    border-radius: 10px;
    background: #fff8f8;
}
.financial-delete-copy { min-width: 0; }
.financial-delete-copy p { margin: 0 0 3px; color: #ac4545; font-size: 9px; font-weight: 900; letter-spacing: .85px; }
.financial-delete-copy h2 { margin: 0; color: #792d2d; font-size: 15px; }
.financial-delete-copy span { display: block; margin-top: 4px; color: #936c6c; font-size: 10px; line-height: 1.4; }
.financial-delete-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.financial-delete-actions form { margin: 0; }

@media (max-width: 1280px) {
    .financial-overview { grid-template-columns: 1fr; }
    .financial-feature-card { min-height: 112px; }
}
@media (max-width: 980px) {
    .financial-detail-columns { grid-template-columns: 1fr; }
    .financial-detail-group { border-right: 0; border-bottom: 1px solid #e5e8ed; }
    .financial-detail-group:last-child { border-bottom: 0; }
}
@media (max-width: 760px) {
    .financial-overview { padding: 12px; }
    .financial-identity-card { align-items: flex-start; padding: 16px; }
    .financial-identity-copy h2 { white-space: normal; }
    .financial-feature-metrics { grid-template-columns: 1fr; }
    .financial-feature-card { min-height: 96px; }
    .financial-section-card { margin-left: 10px; margin-right: 10px; }
    .financial-document-form { padding-left: 10px; padding-right: 10px; }
    .financial-text-notes { grid-template-columns: 1fr; }
    .financial-delete-zone { align-items: stretch; flex-direction: column; margin-left: 10px; margin-right: 10px; }
    .financial-delete-actions { align-items: stretch; flex-direction: column; }
    .financial-delete-actions form,
    .financial-delete-actions button { width: 100%; }
}

/* Product Image Manager v0.7.3 */
.item-heading-with-image .item-heading-identity {
    display: flex;
    align-items: center;
    gap: 16px;
}
.item-heading-thumbnail {
    width: 78px;
    height: 94px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color, #dfe4ea);
    background: #fff;
    display: block;
    flex: 0 0 auto;
}
.item-heading-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.product-image-search-panel {
    overflow: hidden;
}
.product-image-search-identity {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.product-image-search-identity > div {
    padding: 14px;
    border: 1px solid #e4e8ee;
    border-radius: 12px;
    background: #fafbfc;
    min-width: 0;
}
.product-image-search-identity span,
.product-image-search-identity small {
    display: block;
    color: #667085;
    font-size: 12px;
}
.product-image-search-identity strong {
    display: block;
    margin: 4px 0;
    font-size: 15px;
    overflow-wrap: anywhere;
}
.image-color-chip-list,
.image-source-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.image-color-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    background: #f1f4f8;
    color: #344054;
    font-size: 12px;
}
.image-color-chip strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.image-last-run {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e6eaf0;
    font-size: 13px;
}
.image-last-run details {
    margin-top: 8px;
}
.image-last-run pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 180px;
    overflow: auto;
    margin: 8px 0 0;
    font-size: 11px;
}
.image-color-group {
    border-top: 1px solid #e7ebf0;
    padding-top: 18px;
    margin-top: 18px;
}
.image-color-group:first-of-type {
    border-top: 0;
    padding-top: 0;
}
.image-color-group-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.image-color-group-heading > div {
    display: flex;
    align-items: center;
    gap: 10px;
}
.image-color-group-heading h3 {
    margin: 0;
    font-size: 16px;
}
.image-color-code {
    display: inline-flex;
    min-width: 52px;
    justify-content: center;
    padding: 6px 8px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.product-image-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.product-image-card {
    position: relative;
    min-width: 0;
    border: 1px solid #e1e6ed;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.05);
}
.product-image-card.is-primary-image {
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.08);
}
.product-image-preview {
    position: relative;
    aspect-ratio: 5 / 6;
    background: linear-gradient(135deg, #f8fafc, #eef2f6);
    overflow: hidden;
}
.product-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.product-image-card-body {
    padding: 12px;
}
.image-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
}
.image-card-meta strong {
    font-size: 13px;
}
.product-image-card-body > small {
    display: block;
    color: #667085;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.primary-image-ribbon {
    position: absolute;
    top: 9px;
    left: 9px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.image-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}
.candidate-image-card {
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.candidate-image-card:hover {
    transform: translateY(-2px);
    border-color: #98a2b3;
}
.candidate-image-card:has(.candidate-select:checked) {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}
.candidate-select {
    position: absolute;
    z-index: 3;
    top: 10px;
    right: 10px;
    width: 22px !important;
    height: 22px !important;
    accent-color: #111827;
}
.candidate-source-name {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}
.candidate-source-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 700;
}
.candidate-review-actions {
    position: sticky;
    bottom: 12px;
    z-index: 4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.96);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0,0,0,.18);
}
.candidate-review-actions p {
    margin: 0;
    font-size: 12px;
    max-width: 620px;
}
.candidate-review-actions > div {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}
.image-source-layout {
    align-items: start;
}
.text-danger {
    color: #b42318 !important;
}

@media (max-width: 1280px) {
    .product-image-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .product-image-search-identity {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 820px) {
    .product-image-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .candidate-review-actions {
        position: static;
        flex-direction: column;
        align-items: stretch;
    }
    .candidate-review-actions > div {
        flex-wrap: wrap;
    }
}
@media (max-width: 560px) {
    .product-image-grid,
    .product-image-search-identity {
        grid-template-columns: 1fr;
    }
    .image-color-group-heading {
        align-items: flex-start;
    }
    .item-heading-with-image .item-heading-identity {
        align-items: flex-start;
    }
    .item-heading-thumbnail {
        width: 62px;
        height: 76px;
    }
}

/* Product Image Manager v0.7.3.2 — manual local uploads */
.product-image-manual-panel {
    overflow: hidden;
}

.manual-image-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.manual-image-upload-card {
    border: 1px solid var(--border-color, #dfe4ea);
    border-radius: 14px;
    background: #fff;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.manual-image-upload-card.is-complete {
    background: #f8fafc;
}

.manual-image-upload-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.manual-image-upload-heading > div {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.manual-image-upload-heading h3 {
    margin: 0;
    line-height: 1.2;
}

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

.manual-image-upload-form label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.manual-image-upload-form input[type="file"] {
    width: 100%;
    border: 1px dashed #b8c2cc;
    border-radius: 10px;
    background: #f8fafc;
    padding: 12px;
    font: inherit;
}

.manual-image-upload-form small,
.manual-upload-complete-message span,
.image-upload-guidance span,
.image-original-filename {
    color: var(--muted-color, #64748b);
}

.manual-upload-complete-message {
    display: grid;
    gap: 5px;
    padding: 14px;
    border-radius: 10px;
    background: #eef7f1;
}

.image-upload-guidance {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e8edf2;
}

.image-original-filename {
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .manual-image-upload-grid {
        grid-template-columns: 1fr;
    }
}

/* Dashboard & Core KPIs v0.8.0 */
.dashboard-heading {
    align-items: flex-end;
    margin-bottom: 18px;
}

.dashboard-version-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-filter-panel {
    padding: 14px 16px;
    margin-bottom: 18px;
}

.dashboard-period-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.dashboard-period-presets,
.dashboard-custom-dates,
.dashboard-detail-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dashboard-preset,
.dashboard-detail-tabs a {
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}

.dashboard-preset:hover,
.dashboard-detail-tabs a:hover,
.dashboard-preset.is-active,
.dashboard-detail-tabs a.is-active {
    border-color: var(--black);
    background: var(--black);
    color: #fff;
}

.dashboard-custom-dates label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.dashboard-custom-dates input {
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
    margin-bottom: 18px;
}

.dashboard-kpi-card {
    position: relative;
    display: flex;
    min-height: 132px;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    padding: 17px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.035);
    text-decoration: none;
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.dashboard-kpi-card:hover {
    transform: translateY(-2px);
    border-color: #b9bbc2;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.07);
}

.dashboard-kpi-card > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.15px;
}

.dashboard-kpi-card > strong {
    font-size: clamp(22px, 2.2vw, 31px);
    line-height: 1;
    letter-spacing: -0.7px;
}

.dashboard-kpi-card > small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.dashboard-kpi-card.kpi-primary {
    border-color: #27282c;
    background: #17181b;
    color: #fff;
}

.dashboard-kpi-card.kpi-primary > span,
.dashboard-kpi-card.kpi-primary > small { color: #c4c6cc; }

.dashboard-kpi-card.kpi-profit {
    border-color: #bdddc9;
    background: #f0faf4;
}

.kpi-change.is-up { color: var(--success) !important; }
.kpi-change.is-down { color: var(--danger) !important; }
.kpi-change.is-neutral { color: var(--muted) !important; }

.dashboard-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.dashboard-two-column > .panel { margin-bottom: 0; }
.dashboard-chart-row { align-items: stretch; }
.dashboard-chart-panel { min-width: 0; }

.chart-legend {
    display: flex;
    gap: 16px;
    margin: -3px 0 12px;
    color: var(--muted);
    font-size: 11px;
}

.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 12px; height: 5px; border-radius: 4px; }
.legend-sales { background: #232428; }
.legend-profit { background: #56a876; }
.legend-receipt { background: #3f8b65; }
.legend-payment { background: #bd6969; }

.dashboard-column-chart {
    display: flex;
    align-items: stretch;
    gap: 3px;
    height: 230px;
    padding: 14px 8px 0;
    overflow-x: auto;
    border-top: 1px solid #ececef;
    background-image: linear-gradient(to bottom, transparent 24%, #eeeeef 25%, transparent 25.5%, transparent 49%, #eeeeef 50%, transparent 50.5%, transparent 74%, #eeeeef 75%, transparent 75.5%);
}

.dashboard-chart-column {
    display: flex;
    flex: 1 0 15px;
    min-width: 13px;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
}

.dashboard-bar-pair {
    display: flex;
    width: 100%;
    height: 184px;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

.dashboard-bar {
    display: block;
    width: 42%;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
    opacity: 0.92;
}

.bar-sales { background: #232428; }
.bar-profit { background: #56a876; }
.bar-receipt { background: #3f8b65; }
.bar-payment { background: #bd6969; }
.dashboard-bar.is-negative { background: #b44c4c; }
.dashboard-chart-column small { min-height: 13px; color: #80828a; font-size: 9px; white-space: nowrap; }

.dashboard-table th,
.dashboard-table td { vertical-align: middle; }
.dashboard-table th.numeric,
.dashboard-table td.numeric,
.dashboard-detail-table th.numeric,
.dashboard-detail-table td.numeric { text-align: right; white-space: nowrap; }

.dashboard-ranking-list,
.dashboard-product-list,
.dashboard-alert-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-ranking-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(145px, 0.8fr);
    gap: 18px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #ededf0;
}

.dashboard-ranking-row:last-child { border-bottom: 0; }
.ranking-copy,
.ranking-value { display: flex; flex-direction: column; gap: 4px; }
.ranking-copy small { color: var(--muted); font-size: 11px; }
.ranking-value { text-align: right; }
.ranking-value strong { font-size: 13px; }
.ranking-value span { display: block; height: 5px; overflow: hidden; border-radius: 5px; background: #ececef; }
.ranking-value span i { display: block; height: 100%; border-radius: inherit; background: #26272b; }

.dashboard-product-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    padding: 10px 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    text-decoration: none;
}

.dashboard-product-row:hover { border-color: var(--border); background: var(--surface-soft); }
.product-rank {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eeeef0;
    font-size: 12px;
    font-weight: 800;
}
.product-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.product-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.product-copy small { color: var(--muted); font-size: 11px; }
.product-qty { display: flex; align-items: baseline; gap: 3px; font-size: 18px; font-weight: 850; }
.product-qty small { color: var(--muted); font-size: 10px; }

.dashboard-alert-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 45px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
}
.dashboard-alert-list a:hover { background: var(--surface-soft); }
.dashboard-alert-list span { font-size: 12px; font-weight: 700; }
.dashboard-alert-list strong {
    display: inline-flex;
    min-width: 30px;
    height: 26px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 13px;
    background: #ededf0;
    font-size: 12px;
}

.dashboard-activity-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.dashboard-activity-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 9px;
    text-decoration: none;
}
.dashboard-activity-card:hover { background: var(--surface-soft); }
.dashboard-activity-card.is-positive { border-left-color: #438b62; }
.dashboard-activity-card.is-negative { border-left-color: #b85656; }
.dashboard-activity-card.is-neutral { border-left-color: #777a82; }
.dashboard-activity-card span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.dashboard-activity-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.dashboard-activity-card small { color: var(--muted); font-size: 11px; }

.dashboard-detail-toolbar { margin-bottom: 14px; }
.dashboard-detail-tabs { flex: 1; }
.dashboard-detail-filter { justify-content: flex-end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dashboard-row-count { padding: 7px 10px; border-radius: 8px; background: #eeeef0; color: #55575e; font-size: 12px; font-weight: 800; }
.dashboard-detail-table-wrap { max-height: calc(100vh - 320px); }
.dashboard-detail-table { min-width: 980px; }
.dashboard-detail-table thead th { position: sticky; top: 0; z-index: 2; background: #f8f8f9; }
.dashboard-negative-value { color: var(--danger); }
.dashboard-limit-note { margin: 13px 0 0; color: var(--muted); font-size: 11px; }

@media (max-width: 1250px) {
    .dashboard-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-activity-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-two-column { grid-template-columns: 1fr; }
    .dashboard-activity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-period-form { align-items: flex-start; flex-direction: column; }
    .dashboard-custom-dates { width: 100%; }
}

@media (max-width: 640px) {
    .dashboard-heading { align-items: flex-start; }
    .dashboard-version-block { align-items: flex-start; }
    .dashboard-kpi-grid { grid-template-columns: 1fr; }
    .dashboard-kpi-card { min-height: 118px; }
    .dashboard-activity-grid { grid-template-columns: 1fr; }
    .dashboard-custom-dates { align-items: stretch; flex-direction: column; }
    .dashboard-custom-dates label { justify-content: space-between; }
    .dashboard-custom-dates input { flex: 1; }
    .dashboard-ranking-row { grid-template-columns: 1fr; gap: 7px; }
    .ranking-value { text-align: left; }
    .dashboard-column-chart { height: 210px; }
    .dashboard-bar-pair { height: 165px; }
}

/* v0.8.1 - Parametric SellOut report */
.sellthrough-toolbar-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 15px;
}

.sellthrough-group-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 4px;
    border-radius: 10px;
    background: #efeff1;
}

.sellthrough-group-tabs a {
    padding: 8px 13px;
    border-radius: 7px;
    color: #5d5f66;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.sellthrough-group-tabs a:hover { background: #fff; }
.sellthrough-group-tabs a.is-active {
    background: #232428;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.sellthrough-period-presets { justify-content: flex-end; }

.sellthrough-filter-panel .panel-heading { margin-bottom: 13px; }
.sellthrough-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(145px, 1fr));
    gap: 12px;
    align-items: end;
}
.sellthrough-filter-grid label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}
.sellthrough-filter-grid label > span {
    color: #676970;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.sellthrough-filter-grid select,
.sellthrough-filter-grid input { width: 100%; }
.sellthrough-filter-submit { display: flex; align-items: flex-end; }
.sellthrough-filter-submit .button { width: 100%; }

.sellthrough-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.sellthrough-summary-grid .dashboard-kpi-card { min-height: 118px; }

.sellthrough-results-panel { overflow: hidden; }
.sellthrough-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 11px;
    color: var(--muted);
    font-size: 10px;
}
.sellthrough-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sellthrough-legend i { width: 8px; height: 8px; border-radius: 50%; }
.sellthrough-legend .is-purchase { background: #73777e; }
.sellthrough-legend .is-sale { background: #3f8b65; }
.sellthrough-legend .is-stock { background: #4c74a8; }

.sellthrough-table-wrap { max-height: calc(100vh - 365px); }
.sellthrough-table { min-width: 1120px; }
.sellthrough-table thead th {
    position: sticky;
    z-index: 3;
    background: #f8f8f9;
    vertical-align: middle;
}
.sellthrough-table thead tr:first-child th { top: 0; }
.sellthrough-table thead tr:nth-child(2) th { top: 38px; z-index: 4; }
.sellthrough-table th.numeric,
.sellthrough-table td.numeric { text-align: right; white-space: nowrap; }
.sellthrough-table thead tr:first-child th:not(:first-child) { text-align: center; }
.sellthrough-table tbody td { vertical-align: middle; }
.sellthrough-table tbody tr:hover { background: #fafafb; }
.sellthrough-table .cell-subtitle {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
}
.sellthrough-th-purchase { border-bottom: 3px solid #858990 !important; }
.sellthrough-th-sale { border-bottom: 3px solid #4f9b6c !important; }
.sellthrough-th-rate { border-bottom: 3px solid #c18d43 !important; }
.sellthrough-rate-subhead { text-align: center !important; }
.sellthrough-th-stock { border-bottom: 3px solid #587faf !important; }
.sellthrough-table tfoot th {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #f0f0f2;
    border-top: 2px solid #cfd0d4;
}

.sellthrough-rate {
    display: inline-flex;
    min-width: 58px;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: #efeff1;
    font-size: 11px;
    font-weight: 850;
}
.sellthrough-rate.is-high { background: #dfeee5; color: #2e724a; }
.sellthrough-rate.is-medium { background: #f4ead6; color: #8b641f; }
.sellthrough-rate.is-low { background: #f1e0e0; color: #995050; }
.sellthrough-rate.is-empty { color: #8a8c92; }

.sellthrough-notes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.sellthrough-notes p {
    margin: 0;
    padding: 10px 11px;
    border-radius: 8px;
    background: #f6f6f7;
    color: #686a70;
    font-size: 10px;
    line-height: 1.55;
}

@media (max-width: 1200px) {
    .sellthrough-filter-grid { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
    .sellthrough-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sellthrough-toolbar-panel { align-items: flex-start; flex-direction: column; }
    .sellthrough-period-presets { justify-content: flex-start; }
}

@media (max-width: 760px) {
    .sellthrough-filter-grid { grid-template-columns: 1fr 1fr; }
    .sellthrough-summary-grid { grid-template-columns: 1fr; }
    .sellthrough-notes { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .sellthrough-filter-grid { grid-template-columns: 1fr; }
    .sellthrough-group-tabs { width: 100%; }
    .sellthrough-group-tabs a { flex: 1; text-align: center; }
}

/* v0.8.2 — Inventory & Stock Aging reports */
.inventory-report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
}

.inventory-mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inventory-mode-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-soft);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.inventory-mode-tabs a:hover,
.inventory-mode-tabs a.is-active {
    border-color: var(--black);
    background: var(--black);
    color: #fff;
}

.inventory-period-presets {
    justify-content: flex-end;
}

.inventory-filter-panel {
    margin-top: 14px;
}

.inventory-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.inventory-filter-grid label {
    min-width: 0;
}

.inventory-filter-grid label > span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.inventory-filter-grid input,
.inventory-filter-grid select {
    width: 100%;
}

.inventory-filter-submit {
    display: flex;
    align-items: flex-end;
}

.inventory-filter-submit .button {
    width: 100%;
    min-height: 42px;
}

.inventory-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
}

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

.inventory-results-panel,
.inventory-aging-panel,
.inventory-summary-panel {
    margin-top: 14px;
}

.inventory-panel-note {
    margin: 0;
    max-width: 440px;
    text-align: right;
    font-size: 12px;
}

.inventory-stock-table {
    min-width: 1500px;
}

.inventory-stock-table th:nth-child(1) { min-width: 290px; }
.inventory-stock-table th:nth-child(2) { min-width: 145px; }
.inventory-stock-table th:nth-child(3) { min-width: 190px; }
.inventory-stock-table th:nth-child(9) { min-width: 155px; }

.inventory-aging-list {
    display: grid;
    gap: 10px;
}

.inventory-aging-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.15fr) minmax(220px, 3fr) 90px minmax(150px, 1fr);
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.inventory-aging-copy,
.inventory-aging-retail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inventory-aging-copy strong,
.inventory-aging-retail strong,
.inventory-aging-percent strong {
    font-size: 14px;
}

.inventory-aging-copy span,
.inventory-aging-retail span,
.inventory-aging-percent small {
    color: var(--muted);
    font-size: 12px;
}

.inventory-aging-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6e7ea;
}

.inventory-aging-bar span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
    background: var(--black);
}

.inventory-aging-percent {
    text-align: right;
}

.inventory-aging-retail {
    text-align: right;
}

.inventory-days-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 12px;
    font-weight: 800;
}

.inventory-days-pill.is-medium {
    background: var(--warning-bg);
    color: var(--warning);
}

.inventory-days-pill.is-low {
    background: var(--danger-bg);
    color: var(--danger);
}

.inventory-summary-intro {
    margin-top: 14px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.inventory-summary-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.inventory-summary-panel .data-table {
    min-width: 920px;
}

.kpi-alert {
    border-color: #efc6c6;
    background: var(--danger-bg);
}

.kpi-alert strong {
    color: var(--danger);
}

@media (max-width: 1180px) {
    .inventory-report-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .inventory-period-presets {
        justify-content: flex-start;
    }
    .inventory-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .inventory-filter-grid,
    .inventory-kpi-grid,
    .inventory-kpi-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .inventory-aging-row {
        grid-template-columns: 1fr 1fr;
    }
    .inventory-aging-bar {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    .inventory-aging-percent,
    .inventory-aging-retail {
        text-align: left;
    }
}

@media (max-width: 620px) {
    .inventory-filter-grid,
    .inventory-kpi-grid,
    .inventory-kpi-grid-3,
    .inventory-aging-row {
        grid-template-columns: 1fr;
    }
    .inventory-aging-bar {
        grid-column: auto;
        grid-row: auto;
    }
    .inventory-mode-tabs a {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
    }
    .inventory-panel-note {
        text-align: left;
    }
}

/* v0.8.5.1 — clickable import status filters */
.stat-card-filter {
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.stat-card-filter:hover {
    border-color: #9ea4ab;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .06);
    transform: translateY(-1px);
}

.stat-card-filter.is-active {
    border-color: #16181b;
    box-shadow: inset 0 0 0 1px #16181b;
}

.stat-card-filter small {
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
}

.import-status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 16px;
}

.import-status-filter {
    min-height: 36px;
    padding: 8px 12px;
}

.import-status-filter span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: #eef0f2;
    font-size: 11px;
    font-weight: 700;
}

.import-status-filter.is-active {
    border-color: #16181b;
    background: #16181b;
    color: #fff;
}

.import-status-filter.is-active span {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

.compact-empty-state {
    min-height: 110px;
    padding: 24px;
}

/* v0.8.5.2 — grouped markup report + drill-down */
.markup-expand-column,
.markup-expand-cell {
    width: 42px;
    text-align: center;
}

.markup-expand-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #d8dce1;
    border-radius: 7px;
    background: #fff;
    color: #15171a;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.markup-expand-toggle:hover,
.markup-expand-toggle[aria-expanded="true"] {
    border-color: #15171a;
    background: #15171a;
    color: #fff;
}

.markup-brand-row > td {
    background: #fff;
}

.markup-season-row > td {
    background: #fafbfc;
}

.markup-season-indent {
    display: inline-block;
    margin-right: 5px;
    color: var(--muted);
}

.markup-count-link {
    display: inline-flex;
    text-decoration: none;
}

.markup-count-link:hover .badge,
.markup-grouped-table .table-link:hover {
    text-decoration: underline;
}

.markup-detail-panel {
    scroll-margin-top: 18px;
}

.button-small {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 12px;
}

@media (max-width: 900px) {
    .markup-expand-column,
    .markup-expand-cell {
        width: 34px;
    }
}


/* v0.8.7.5 — Markup report visual polish */
.markup-grouped-table-wrap {
    position: relative;
    max-height: calc(100vh - 190px);
    min-height: 360px;
    overflow: auto;
    overscroll-behavior: contain;
}

.markup-grouped-table {
    min-width: 880px;
}

.markup-grouped-table thead th {
    position: sticky;
    top: 0;
    z-index: 6;
    background: #f8f8f9;
    box-shadow: 0 1px 0 var(--border);
}

.markup-item-variant-column,
.markup-item-variant-cell {
    white-space: nowrap;
}

.markup-item-variant-counts {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.markup-item-variant-counts .table-link {
    display: inline;
    margin: 0;
}

.markup-count-column,
.markup-count-cell {
    text-align: center;
    white-space: nowrap;
}

.markup-count-cell {
    vertical-align: middle;
}

.markup-count-link,
.markup-zero-count {
    display: inline-flex;
    min-width: 34px;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
    .markup-grouped-table-wrap {
        min-height: 300px;
        max-height: calc(100vh - 145px);
    }
}

/* v0.8.7.6 — Retail editable final line value */
.retail-entry-grid .retail-value-input {
    min-width: 88px;
    text-align: right;
}

.retail-value-cell {
    min-width: 126px;
}

.retail-inline-value-form {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin: 0;
    white-space: nowrap;
}

.retail-inline-value-input {
    width: 82px;
    min-width: 82px;
    padding: 6px 7px;
    text-align: right;
    font: inherit;
    border: 1px solid var(--border-color, #d9dee7);
    border-radius: 6px;
    background: #fff;
}

.retail-inline-value-save {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-color, #d9dee7);
    border-radius: 6px;
    background: #fff;
    color: inherit;
    cursor: pointer;
    font-weight: 700;
}

.retail-inline-value-save:hover,
.retail-inline-value-save:focus-visible {
    border-color: #111;
}

/* v0.8.7.8 — SellOut informational gross FIFO settlement + profit card */

/* v0.8.7.8 — legacy retail returns */
.retail-legacy-return-hint {
    margin: 0 0 12px;
    padding: 9px 12px;
    border: 1px solid #e5c96b;
    border-radius: 8px;
    background: #fff8dc;
    color: #6b5200;
    font-size: 12px;
    line-height: 1.45;
}
.retail-legacy-return-hint code {
    font-weight: 700;
}
.retail-entry-grid tr.retail-legacy-return-row td {
    background: #fff8ed;
}
.retail-entry-grid tr.retail-legacy-return-row td:first-child {
    box-shadow: inset 3px 0 0 #d58b1f;
}

/* v0.8.7.10 - supplier return whole-document / multi-document credit transform */
.bulk-select-cell { width: 78px; text-align: center; white-space: nowrap; }
.bulk-select-cell input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; vertical-align: middle; }
.supplier-return-bulk-transform .panel-heading .heading-actions { align-items: center; gap: 10px; }

/* v0.8.7.12 — supplier credit document-level gross total adjustment */
.credit-total-adjustment-panel {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    padding: 16px 18px;
    border-top: 1px solid var(--border-color, #e2e7ef);
    background: #f8fafc;
}
.credit-total-adjustment-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(145px, 1fr));
    gap: 12px;
    flex: 1 1 auto;
}
.credit-total-adjustment-summary > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.credit-total-adjustment-summary span {
    font-size: 11px;
    color: #667085;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.credit-total-adjustment-summary span small {
    font-size: 10px;
    text-transform: none;
    letter-spacing: 0;
}
.credit-total-adjustment-summary strong {
    font-variant-numeric: tabular-nums;
}
.credit-adjustment-discount { color: #147d50; }
.credit-adjustment-surcharge { color: #a04a16; }
.credit-total-adjustment-form {
    flex: 0 0 405px;
    margin: 0;
}
.credit-final-total-field { margin: 0; }
.credit-final-total-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.credit-final-total-input-row input {
    width: 118px;
    min-width: 118px;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.credit-final-total-field small {
    display: block;
    margin-top: 6px;
    color: #667085;
    line-height: 1.35;
}
@media (max-width: 1100px) {
    .credit-total-adjustment-panel { flex-direction: column; }
    .credit-total-adjustment-summary { grid-template-columns: repeat(2, minmax(150px, 1fr)); width: 100%; }
    .credit-total-adjustment-form { flex-basis: auto; width: 100%; }
}

/* v0.8.7.13 — editable supplier-credit payable total directly in totals footer */
.credit-total-adjustment-help {
    flex: 0 0 360px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #475467;
}
.credit-total-adjustment-help strong { color: #344054; }
.credit-total-adjustment-help small { line-height: 1.4; }
.credit-payable-total-cell { min-width: 245px; }
.credit-payable-inline-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin: 4px 0 0;
}
.credit-payable-inline-input {
    width: 112px;
    min-width: 112px;
    padding: 7px 8px;
    border: 1px solid #98a2b3;
    border-radius: 7px;
    background: #fff;
    color: #101828;
    font-weight: 800;
    font-size: 17px;
    line-height: 1.2;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.credit-payable-inline-input:focus {
    outline: 2px solid rgba(47, 86, 212, .18);
    border-color: #2f56d4;
}
.credit-payable-currency { font-weight: 800; }
.credit-payable-save { flex: 0 0 auto; }
.credit-payable-reset {
    border: 0;
    background: transparent;
    color: #667085;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
}
.credit-payable-hint {
    display: block;
    margin-top: 4px;
    color: #667085;
    font-size: 10px;
    line-height: 1.25;
    text-transform: none;
    letter-spacing: 0;
}
@media (max-width: 1100px) {
    .credit-total-adjustment-help { flex-basis: auto; width: 100%; }
}

/* v0.8.7.14 - make document-level credit adjustment visible in totals */
.credit-total-adjustment-footer {
    min-width: 190px;
}
.credit-total-adjustment-footer small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    color: #667085;
    white-space: nowrap;
}
