:root {
    color-scheme: light;
    --bg: #f4f5f7;
    --panel: #ffffff;
    --ink: #1f2328;
    --muted: #667085;
    --line: #d9dee7;
    --accent: #d81920;
    --accent-dark: #9f1118;
    --ok: #087443;
    --warn: #b54708;
}

* {
    box-sizing: border-box;
}

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

button,
input,
select {
    font: inherit;
}

.bo-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.bo-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px;
    background: #202327;
    color: #fff;
}

.bo-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

.bo-brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.bo-nav {
    display: grid;
    gap: 8px;
}

.nav-item,
.logout-button {
    width: 100%;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    text-align: left;
    padding: 0 12px;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.is-active {
    background: #32363c;
}

.logout-button {
    margin-top: auto;
    border-color: #454b54;
}

.bo-main {
    min-width: 0;
    padding: 24px;
}

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

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

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    margin-bottom: 12px;
    font-size: 18px;
}

.user-chip {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    white-space: nowrap;
}

.login-panel,
.workspace {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.login-panel {
    max-width: 420px;
    padding: 24px;
}

.login-form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

input,
select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 0 10px;
}

.primary-button,
.secondary-button,
.small-button {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 12px;
    cursor: pointer;
    font-weight: 700;
}

.primary-button {
    background: var(--accent);
    color: #fff;
}

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

.secondary-button,
.small-button {
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
}

.small-button {
    min-height: 34px;
}

.workspace {
    padding: 18px;
}

.is-hidden,
.view-panel {
    display: none;
}

.view-panel.is-active {
    display: block;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.toolbar input {
    min-width: 260px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

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

th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

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

.order-detail-row td {
    background: #fbfcfe;
}

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

.order-detail h3 {
    margin: 0 0 8px;
    font-size: 14px;
}

.order-detail ul {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.order-detail li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.empty-detail {
    margin: 0;
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    background: #eef2f6;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.status-pill.is-ok {
    background: #dcfae6;
    color: var(--ok);
}

.status-pill.is-warn {
    background: #fef0c7;
    color: var(--warn);
}

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

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

.edit-card {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.edit-card img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: contain;
    background: #f8fafc;
}

.edit-card h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.edit-grid {
    display: grid;
    grid-template-columns: 90px 90px 1fr auto;
    gap: 8px;
    align-items: center;
}

.edit-grid input[type="checkbox"] {
    min-height: auto;
}

.stock-input {
    width: 96px;
}

.form-message {
    min-height: 18px;
    margin: 0;
    color: var(--accent);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    max-width: 360px;
    min-height: 44px;
    border-radius: 6px;
    background: #202327;
    color: #fff;
    padding: 12px 14px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease;
}

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

@media (max-width: 860px) {
    .bo-shell {
        grid-template-columns: 1fr;
    }

    .bo-sidebar {
        position: sticky;
        top: 0;
        z-index: 2;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .bo-nav {
        display: flex;
    }

    .nav-item,
    .logout-button {
        white-space: nowrap;
    }

    .logout-button {
        margin-top: 0;
    }

    .bo-main {
        padding: 16px;
    }

    .bo-topbar,
    .split-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .toolbar input {
        min-width: 100%;
    }

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

    .order-detail {
        grid-template-columns: 1fr;
    }
}
