:root {
    --bg: #f7f4ef;
    --panel: #ffffff;
    --text: #2a2520;
    --muted: #6f665d;
    --border: #ddd4c8;
    --accent: #9a4d24;
    --accent-dark: #713617;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--accent-dark);
}

.site-header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    font-size: 1.3rem;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: auto;
    height: 52px;
    max-width: 220px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.nav-logout-form {
    margin: 0;
}

.nav-link-button {
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 0;
    text-decoration: underline;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 56px;
}

.page-wide {
    max-width: 1440px;
}

.hero,
.section {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 28px;
    margin-bottom: 24px;
}

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

.hero h1,
.section h1 {
    margin-top: 0;
}

.narrow {
    max-width: 720px;
}

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

.product-card,
.order-product {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    background: #fffdf9;
}

.product-card h3,
.order-product h3 {
    margin-top: 0;
}

.product-card {
    display: grid;
    gap: 20px;
    align-content: space-between;
    overflow: hidden;
    min-height: 250px;
}

.product-card-image {
    width: calc(100% + 36px);
    height: 180px;
    margin: -18px -18px 0;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
    background: #eee5da;
}

.product-card-body p {
    color: var(--muted);
}

.product-card-footer {
    display: grid;
    gap: 14px;
}

.add-to-cart-form {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 10px;
    align-items: end;
}

.button {
    display: inline-block;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    padding: 11px 16px;
    text-decoration: none;
}

.button.secondary {
    background: #4d4339;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

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

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    padding: 10px;
}

.order-form,
.status-form {
    display: grid;
    gap: 20px;
}

.order-products {
    display: grid;
    gap: 14px;
}

.order-product {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 18px;
    align-items: center;
}

.order-total {
    font-size: 1.2rem;
}

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

.cart-list {
    display: grid;
    gap: 12px;
}

.cart-line {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 140px 120px;
    gap: 18px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fffdf9;
    padding: 18px;
}

.cart-line-image {
    width: 96px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    background: #eee5da;
}

.cart-line h2 {
    font-size: 1.1rem;
    margin: 0 0 6px;
}

.cart-line p {
    color: var(--muted);
    margin: 0 0 8px;
}

.cart-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.checkout-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 24px;
    align-items: start;
}

.checkout-summary {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fffdf9;
    padding: 18px;
}

.checkout-summary h2 {
    margin-top: 0;
}

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

.cart-lines li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.cart-lines li span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.checkout-line-image {
    width: 42px;
    height: 32px;
    object-fit: cover;
    border-radius: 5px;
    background: #eee5da;
}

.cart-lines.compact {
    margin-bottom: 18px;
}

.empty-state {
    display: grid;
    justify-items: start;
    gap: 14px;
}

.messages {
    margin-bottom: 16px;
}

.message {
    border: 1px solid #8fc48f;
    border-radius: 6px;
    background: #eff9ef;
    padding: 12px 14px;
}

.filter-form {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.summary-list {
    display: grid;
    gap: 8px;
    margin-bottom: 24px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background: #fffdf9;
    min-width: 1200px;
}

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

th {
    background: #eee5da;
}

.production-row-ready {
    background: #f3fbf1;
}

.production-row-picked_up {
    color: var(--muted);
    background: #f4f1ed;
}

.production-row-cancelled {
    color: var(--muted);
    background: #f8eeee;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-width: 108px;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--body-fg, var(--text));
    font-weight: 800;
    padding: 6px 10px;
    white-space: nowrap;
}

.status-new,
.status-confirmed {
    background: #fff8e6;
    border-color: #e8c879;
}

.status-in_progress {
    background: #eaf1ff;
    border-color: #9db7e7;
}

.status-ready {
    background: #e8f8e4;
    border-color: #8fc48f;
}

.status-picked_up {
    background: #eee5da;
    border-color: #cfc2b4;
}

.status-cancelled {
    background: #f7e3e3;
    border-color: #d69a9a;
}

.status-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    min-width: 250px;
}

.status-actions form {
    margin: 0;
}

.status-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1;
    width: 56px;
    min-height: 56px;
    padding: 0;
    box-shadow: 0 1px 0 rgba(42, 37, 32, 0.06);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.status-action:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 16px rgba(42, 37, 32, 0.14);
    transform: translateY(-1px);
}

.status-action:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(42, 37, 32, 0.1);
}

.status-action-in_progress {
    background: #eaf1ff;
}

.status-action-ready {
    background: #e8f8e4;
}

.status-action-picked_up {
    background: var(--secondary, #2f2923);
    border-color: var(--secondary, #2f2923);
    color: #fff;
}

.status-action-cancelled {
    background: #f7e3e3;
    color: #8c1f1f;
}

.details {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
}

.details dt {
    font-weight: 800;
}

.details dd {
    margin: 0;
}

.item-list {
    padding-left: 20px;
}

.errorlist {
    color: #a11b1b;
    margin: 4px 0 0;
    padding-left: 18px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 700px) {
    .hero,
    .order-product,
    .cart-line,
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .hero {
        display: grid;
    }

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

    .brand-logo {
        height: 42px;
        max-width: 170px;
    }

    .cart-actions {
        justify-content: stretch;
    }

    .cart-actions .button {
        text-align: center;
        width: 100%;
    }

    .status-actions {
        display: flex;
        min-width: 0;
        gap: 8px;
    }

    .status-action {
        width: 52px;
        min-height: 52px;
        font-size: 1.3rem;
    }
}
