:root {
    --bg: #080c11;
    --page: #0b1016;
    --panel: #111821;
    --panel-soft: #151d28;
    --panel-hover: #182230;
    --line: #243040;
    --line-soft: #1b2532;
    --text: #e7edf5;
    --muted: #8d9aab;
    --faint: #657386;
    --primary: #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-ink: #021312;
    --good: #34d399;
    --bad: #fb7185;
    --warn: #fbbf24;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-size: 28px;
    line-height: 1.15;
}

h2 {
    font-size: 18px;
    line-height: 1.2;
}

h3 {
    font-size: 15px;
    line-height: 1.2;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 60px;
    padding: 0 28px;
    background: rgba(8, 12, 17, 0.92);
    border-bottom: 1px solid var(--line-soft);
    backdrop-filter: blur(14px);
}

.brand {
    color: var(--text);
    font-size: 17px;
    font-weight: 800;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav a {
    color: var(--muted);
    border-radius: 8px;
    padding: 8px 10px;
    font-weight: 700;
}

.nav a:hover {
    color: var(--text);
    background: var(--panel-soft);
}

.page {
    width: min(1560px, calc(100% - 48px));
    margin: 28px auto 64px;
}

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

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

.muted {
    color: var(--muted);
    margin-top: 5px;
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.subvalue {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 16px;
}

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

.compact-form {
    padding: 14px 18px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 15px;
}

.metric span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.metric strong {
    display: block;
    font-size: 23px;
    line-height: 1.1;
}

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

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.018);
}

.lots-table-wrap {
    border-top: 1px solid var(--line-soft);
}

.lots-table th,
.lots-table td {
    padding: 13px 12px;
}

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

.lot-cell {
    width: 54%;
    min-width: 420px;
    cursor: pointer;
}

.lot-title {
    color: var(--text);
    font-weight: 700;
    line-height: 1.35;
}

.lot-meta {
    color: var(--faint);
    font-size: 12px;
    margin-top: 5px;
}

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

.num strong {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.num span {
    color: var(--muted);
    margin-left: 4px;
}

.actions-col {
    text-align: right;
    white-space: nowrap;
}

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

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

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #202a38;
    color: #c9d3df;
    font-size: 12px;
    font-weight: 800;
}

.badge.applied {
    background: rgba(52, 211, 153, 0.12);
    color: var(--good);
}

.badge.skipped {
    background: #222b38;
    color: #aeb9c8;
}

.badge.warning {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warn);
}

.badge.error {
    background: rgba(251, 113, 133, 0.12);
    color: var(--bad);
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--text);
    padding: 8px 13px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--panel-hover);
    border-color: #344356;
}

button.primary,
.button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-ink);
}

button.primary:hover,
.button.primary:hover {
    background: #5eead4;
    border-color: #5eead4;
}

.button.mini {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 12px;
}

.icon-btn {
    width: 38px;
    min-width: 38px;
    padding: 0;
}

.icon-btn.subtle {
    background: transparent;
    color: var(--muted);
    font-size: 24px;
}

.full {
    width: 100%;
}

.stack {
    display: grid;
    gap: 13px;
}

.inline-form {
    display: grid;
    grid-template-columns: 150px 170px 150px minmax(180px, 1fr) auto;
    gap: 10px;
    align-items: end;
}

label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-weight: 750;
}

label span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 39px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0b111a;
    color: var(--text);
    padding: 8px 10px;
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(45, 212, 191, 0.22);
    border-color: rgba(45, 212, 191, 0.72);
}

textarea {
    min-height: 130px;
    resize: vertical;
}

.check {
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-content: start;
}

.check input[type="checkbox"],
.switch-row input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    accent-color: var(--primary);
}

.hint-box {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #0d151d;
    color: #c7f9ee;
}

.hint-box strong {
    color: var(--text);
}

.buyer-prices-list {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #0b111a;
    padding: 11px;
}

.buyer-prices-list > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.buyer-prices-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.buyer-prices-list strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
}

.buyer-prices-list em {
    color: #c7f9ee;
    font-style: normal;
    font-weight: 800;
    white-space: nowrap;
}

.flash {
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-weight: 800;
}

.flash.ok {
    background: rgba(52, 211, 153, 0.1);
    color: #a7f3d0;
    border: 1px solid rgba(52, 211, 153, 0.22);
}

.flash.error {
    background: rgba(251, 113, 133, 0.1);
    color: #fecdd3;
    border: 1px solid rgba(251, 113, 133, 0.22);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.28);
}

.lot-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 70;
    width: min(560px, calc(100vw - 24px));
    height: 100dvh;
    overflow-y: auto;
    background: #0f151d;
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 22px;
}

.drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
}

.drawer-head h2 {
    max-width: 430px;
}

.drawer-flash {
    margin-top: 14px;
}

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

.drawer-metrics div {
    background: #0b111a;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 11px;
}

.drawer-metrics span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 5px;
}

.drawer-metrics strong {
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.drawer-section {
    padding: 16px 0;
    border-top: 1px solid var(--line-soft);
}

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

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

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

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

.conversion-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.conversion-strip span {
    display: block;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #0b111a;
    color: #c7f9ee;
    padding: 10px 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    color: var(--text);
}

.drawer-link {
    display: block;
    color: var(--muted);
    margin-top: 10px;
    text-align: center;
    font-weight: 800;
}

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

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--bg);
}

.login-panel {
    width: min(420px, calc(100% - 32px));
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.login-panel h1 {
    margin-bottom: 20px;
}

@media (max-width: 980px) {
    .grid.two {
        grid-template-columns: 1fr;
    }

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

    .toolbar-actions {
        flex-wrap: wrap;
    }

    .panel-head {
        flex-direction: column;
    }

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

    .lot-cell {
        min-width: 320px;
    }
}

@media (max-width: 680px) {
    .topbar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .nav {
        order: 3;
        width: 100%;
    }

    .page {
        width: min(100% - 20px, 1560px);
        margin-top: 18px;
    }

    .inline-form,
    .form-grid.two-cols,
    .drawer-metrics,
    .conversion-strip {
        grid-template-columns: 1fr;
    }

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

    .lot-drawer {
        width: 100vw;
        padding: 18px;
    }

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