:root {
    --bg: #fffaf3;
    --card: #ffffff;
    --ink: #241f1a;
    --muted: #766d64;
    --line: #e8ded2;
    --accent: #c85b21;
    --accent-dark: #a94615;
    --ok: #116b3a;
    --warn: #8a5a00;
    --bad: #9e1c1c;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: .9rem 1rem;
    background: #2a1810;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.brand { color: white; font-weight: 800; font-size: 1.15rem; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: flex-end; }
.topbar nav a { color: white; }
.container { width: min(1100px, calc(100% - 2rem)); margin: 1.25rem auto 3rem; }
h1 { margin: .5rem 0 1rem; line-height: 1.15; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 8px 24px rgba(66,40,15,.06);
    margin-bottom: 1rem;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.menu-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.menu-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #eee; }
.menu-card .body { padding: .9rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.price { font-weight: 800; font-size: 1.1rem; }
.muted { color: var(--muted); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.space-between { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
label { display: block; font-weight: 650; margin: .5rem 0 .25rem; }
input, select, textarea, button {
    font: inherit;
    border-radius: 10px;
}
input, select, textarea {
    width: 100%;
    padding: .75rem;
    border: 1px solid var(--line);
    background: white;
}
input[type="checkbox"] { width: auto; }
input[type="number"] { max-width: 110px; }
textarea { min-height: 90px; }
button, .button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .35rem;
    padding: .72rem 1rem;
    border: 0;
    background: var(--accent);
    color: white;
    font-weight: 750;
    cursor: pointer;
    border-radius: 999px;
    text-decoration: none;
}
button:hover, .button:hover { background: var(--accent-dark); text-decoration: none; }
button.secondary, .button.secondary { background: #61574e; }
button.danger, .button.danger { background: var(--bad); }
button.ok, .button.ok { background: var(--ok); }
button:disabled { opacity: .55; cursor: not-allowed; }
.form-card { max-width: 560px; }
.alert { padding: .8rem 1rem; border-radius: 12px; margin: .8rem 0; border: 1px solid var(--line); background: white; }
.alert-success { border-color: #b8e2c7; color: var(--ok); }
.alert-error { border-color: #f0b6b6; color: var(--bad); }
.alert-info { border-color: #bdd7ff; color: #1f4d8a; }
.alert-warning { border-color: #f1d392; color: var(--warn); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; border-radius: 14px; overflow: hidden; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #fff1e6; }
.badge { display: inline-block; padding: .25rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 800; background: #eee; }
.badge.NEW { background: #e8f1ff; color: #245294; }
.badge.ACCEPTED { background: #fff3cd; color: #785500; }
.badge.PREPARING { background: #ffe0c2; color: #924500; }
.badge.READY { background: #d9f7e8; color: #096338; }
.badge.COMPLETED { background: #e7e7e7; color: #444; }
.badge.CANCELLED { background: #ffe1e1; color: #8e1a1a; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab { border-radius: 999px; padding: .7rem 1rem; background: white; border: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.order-section { margin: 1.25rem 0; }
.order-section h2 { margin: 0 0 .75rem; }
.order-card { border-left: 6px solid var(--accent); }
.order-card.pack-now { border-left-color: var(--bad); }
.order-card.prep-soon { border-left-color: var(--warn); }
.order-items { margin: .5rem 0; padding-left: 1.1rem; }
.kpi { display: inline-flex; flex-direction: column; gap: .1rem; padding: .7rem .9rem; border-radius: 14px; border: 1px solid var(--line); background: white; }
.kpi strong { font-size: 1.25rem; }
.small { font-size: .9rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
@media (max-width: 640px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .container { width: min(100% - 1rem, 1100px); margin-top: .75rem; }
    .grid { grid-template-columns: 1fr; }
    .space-between { align-items: flex-start; flex-direction: column; }
    button, .button { width: 100%; }
    .actions button, .actions .button { width: auto; flex: 1; }
}
.checkbox-row { display: flex; gap: .5rem; align-items: center; font-weight: 650; margin: .75rem 0; }
.checkbox-row input { width: auto; }
.approval-code strong { letter-spacing: .12em; font-size: 1.6rem; }
.approval-input { max-width: 160px; }
.table-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.table-actions form { margin: 0; }
.small-button { padding: .45rem .7rem; font-size: .85rem; }
.form-actions-end { align-self: end; }
@media (max-width: 640px) {
    .table-actions { min-width: 180px; }
    .small-button { width: auto; }
    .form-actions-end { width: 100%; }
}
.topbar-brand-title { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; min-width: 0; }
.topbar-title { color: #fff1e6; font-weight: 750; font-size: 1rem; white-space: nowrap; }
.service-tabs { margin-top: 0; margin-bottom: .55rem; }
.service-tabs .tab { padding: .55rem .85rem; }
.service-orders-card { padding: .65rem; }
.compact-section { margin: .6rem 0 .85rem; }
.compact-section h2 { margin: .15rem 0 .45rem; font-size: 1.05rem; }
.compact-empty { margin: .25rem 0 .55rem; }
.order-row {
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    border-radius: 12px;
    padding: .45rem .55rem;
    margin-bottom: .45rem;
    box-shadow: 0 4px 12px rgba(66,40,15,.04);
}
.order-row.pack-now { border-left-color: var(--bad); }
.order-row.prep-soon { border-left-color: var(--warn); }
.order-row-main {
    display: grid;
    grid-template-columns: minmax(92px, auto) minmax(140px, 1fr) minmax(180px, auto) minmax(220px, 2fr) minmax(70px, auto) minmax(180px, auto);
    gap: .4rem .65rem;
    align-items: center;
}
.order-no { white-space: nowrap; }
.order-customer,
.order-collection {
    display: flex;
    flex-direction: column;
    gap: .05rem;
    min-width: 0;
}
.order-customer span,
.order-collection span { color: var(--muted); font-size: .82rem; }
.order-collection strong { white-space: nowrap; }
.order-items-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    font-weight: 650;
}
.order-total { white-space: nowrap; text-align: right; }
.compact-actions {
    margin-top: 0;
    gap: .3rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}
.compact-actions button { padding: .42rem .58rem; font-size: .82rem; }
.order-remarks {
    margin-top: .35rem;
    padding: .35rem .45rem;
    border-radius: 8px;
    background: #fff7ef;
    color: var(--warn);
    font-size: .9rem;
}
@media (max-width: 980px) {
    .order-row-main { grid-template-columns: minmax(86px, auto) 1fr minmax(160px, auto); }
    .order-items-line { grid-column: 1 / -1; }
    .order-total { text-align: left; }
    .compact-actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
    .topbar-brand-title { width: 100%; justify-content: space-between; }
    .topbar-title { font-size: .95rem; }
    .service-orders-card { padding: .5rem; }
    .order-row-main { grid-template-columns: 1fr; }
    .order-customer,
    .order-collection { flex-direction: row; justify-content: space-between; gap: .4rem; }
    .order-items-line { white-space: normal; }
    .compact-actions { flex-wrap: wrap; }
    .compact-actions button { width: auto; flex: 1; }
}
