:root {
    --bg: #eef1f5;
    --surface: #ffffff;
    --surface-alt: #f6f8fb;
    --sidebar: #1c2430;
    --sidebar-border: #2d3948;
    --line: #d5dce5;
    --line-strong: #c4ccd7;
    --text: #1a2430;
    --muted: #697586;
    --accent: #285e86;
    --accent-deep: #1d4867;
    --accent-soft: #edf4fb;
    --success: #2f6b45;
    --danger: #a0443e;
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.07);
    --radius: 12px;
    --radius-sm: 9px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
        linear-gradient(90deg, rgba(40, 94, 134, 0.03) 0, rgba(40, 94, 134, 0.03) 1px, transparent 1px, transparent 80px),
        var(--bg);
    color: var(--text);
}

.login-body {
    display: grid;
    place-items: center;
    padding: 28px 16px;
}

.login-shell {
    width: min(100%, 440px);
}

.login-card {
    background: var(--surface);
    border: 1px solid rgba(26, 36, 48, 0.08);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(16, 24, 40, 0.12);
    padding: 28px;
    display: grid;
    gap: 18px;
}

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

.login-brand h1 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.2;
}

.login-brand p,
.login-note p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.login-note {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: grid;
    gap: 6px;
}

.login-note strong {
    font-size: 0.85rem;
}

.login-note code {
    font-size: 0.84rem;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
    border: none;
    box-shadow: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 238px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--sidebar) 0%, #161d27 100%);
    color: #eef3f8;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-right: 1px solid var(--sidebar-border);
}

.brand-block {
    display: grid;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-kicker,
.nav-title {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.7rem;
    color: rgba(238, 243, 248, 0.56);
}

.brand-block h1 {
    margin: 0;
    font-size: 1.04rem;
    line-height: 1.35;
    font-weight: 700;
}

.brand-block p,
.sidebar small,
.sidebar label,
.sidebar-card p {
    color: rgba(238, 243, 248, 0.72);
}

.brand-block p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.5;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-nav a {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(238, 243, 248, 0.84);
    font-size: 0.92rem;
    font-weight: 600;
    transition: 0.16s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.is-active {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    padding: 14px;
    display: grid;
    gap: 10px;
}

.sidebar-card strong {
    font-size: 0.97rem;
}

.sidebar form {
    display: grid;
    gap: 9px;
}

.sidebar select,
.sidebar button {
    width: 100%;
}

.main-content {
    padding: 18px 20px 24px;
    display: grid;
    gap: 16px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid rgba(26, 36, 48, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.page-heading {
    display: grid;
    gap: 8px;
}

.page-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    font-weight: 700;
}

.page-header h2 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.2;
}

.page-header p {
    margin: 0;
    color: var(--muted);
    max-width: 800px;
    line-height: 1.48;
    font-size: 0.93rem;
}

.page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.meta-chip,
.status-pill,
.payment-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.meta-chip {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    color: var(--text);
}

.status-pill.open {
    color: var(--success);
    background: rgba(47, 107, 69, 0.12);
}

.status-pill.closed {
    color: var(--muted);
    background: rgba(105, 117, 134, 0.14);
}

.payment-pill {
    background: var(--accent-soft);
    color: var(--accent-deep);
}

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

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    box-shadow: var(--shadow);
    font-size: 0.92rem;
}

.alert.success {
    background: #edf7ef;
    border-color: rgba(47, 107, 69, 0.18);
    color: #205137;
}

.alert.error {
    background: #fbefee;
    border-color: rgba(160, 68, 62, 0.18);
    color: #7b312d;
}

.stats-grid,
.content-grid,
.two-column {
    display: grid;
    gap: 16px;
}

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

.content-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.two-column {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(26, 36, 48, 0.08);
}

.card.alt {
    background: var(--surface-alt);
}

.compact-card {
    padding: 16px 18px;
}

.card h3,
.card h4 {
    margin: 0 0 6px;
    font-size: 1rem;
    line-height: 1.3;
}

.card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.46;
    font-size: 0.92rem;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.history-layout {
    align-items: start;
}

.history-summary-list {
    margin-top: 16px;
}

.history-note {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.history-note strong {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
}

.history-note p {
    margin: 0;
}

.edit-banner {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(40, 94, 134, 0.08);
    border: 1px solid rgba(40, 94, 134, 0.14);
}

.edit-banner strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 3px;
}

.edit-banner small {
    color: var(--muted);
    font-size: 0.82rem;
}

.metric-card {
    display: grid;
    gap: 9px;
    align-content: start;
    border-top: 3px solid rgba(40, 94, 134, 0.16);
}

.metric-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
}

.metric-card .label {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.73rem;
    font-weight: 700;
}

.metric-card small {
    color: var(--muted);
    font-size: 0.84rem;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 14px;
}

.filter-form {
    gap: 12px;
}

.filter-form .actions {
    justify-content: flex-start;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

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

th {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(246, 248, 251, 0.8);
}

td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
}

.list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.list-row strong {
    font-size: 0.93rem;
}

.product-category {
    margin-top: 14px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.product-button {
    border: 1px solid rgba(40, 94, 134, 0.14);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 12px;
    text-align: left;
    display: grid;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.product-button:hover {
    transform: translateY(-1px);
    border-color: rgba(40, 94, 134, 0.28);
    box-shadow: 0 8px 18px rgba(40, 94, 134, 0.08);
}

.product-button strong {
    font-size: 0.91rem;
    line-height: 1.32;
}

.product-button span,
.product-button small {
    color: var(--muted);
    font-size: 0.82rem;
}

form {
    display: grid;
    gap: 14px;
}

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

.field {
    display: grid;
    gap: 6px;
}

label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    font-size: 0.82rem;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: #ffffff;
    color: var(--text);
    font-size: 0.92rem;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(40, 94, 134, 0.5);
    box-shadow: 0 0 0 3px rgba(40, 94, 134, 0.1);
}

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

button {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--accent);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 0.14s ease, transform 0.14s ease;
}

button:hover {
    background: var(--accent-deep);
    transform: translateY(-1px);
}

button.secondary {
    background: #2f6b45;
}

button.ghost {
    background: #ffffff;
    border: 1px solid var(--line);
    color: var(--text);
}

button.danger {
    color: var(--danger);
    border-color: rgba(160, 68, 62, 0.24);
}

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

.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-alt);
}

.cart-summary small {
    color: var(--muted);
}

.cart-total {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.empty-state {
    padding: 14px;
    border-radius: var(--radius-sm);
    background: rgba(40, 94, 134, 0.08);
    color: var(--accent-deep);
    font-size: 0.9rem;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
}

.qty-control span {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
}

.qty-control button {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--line);
    font-weight: 700;
}

.highlight {
    color: var(--accent-deep);
    font-weight: 700;
}

.difference-positive {
    color: var(--success);
    font-weight: 700;
}

.difference-negative {
    color: var(--danger);
    font-weight: 700;
}

.footer-note {
    color: var(--muted);
    font-size: 0.84rem;
}

.text-link {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    color: var(--accent-deep);
    font-size: 0.85rem;
    font-weight: 700;
}

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

.table-actions {
    white-space: nowrap;
}

.lock-message,
.readonly-value {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-alt);
    padding: 12px 14px;
}

.lock-message {
    display: grid;
    gap: 5px;
}

.lock-message strong {
    font-size: 0.88rem;
}

.lock-message small {
    color: var(--muted);
    line-height: 1.45;
}

.readonly-value {
    min-height: 42px;
    display: flex;
    align-items: center;
    color: var(--text);
    font-size: 0.92rem;
}

.table-muted {
    color: var(--muted);
    font-size: 0.83rem;
    font-weight: 700;
}

.user-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    align-items: end;
}

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

    .sidebar {
        gap: 12px;
    }

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

@media (max-width: 720px) {
    .main-content {
        padding: 14px;
    }

    .page-header {
        flex-direction: column;
        padding: 16px;
    }

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

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

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    }

    .section-heading {
        flex-direction: column;
    }

    .login-card {
        padding: 22px 18px;
    }
}
