* { box-sizing: border-box; }
:root {
    color-scheme: light;
    font-family: system-ui, "Segoe UI", sans-serif;
    color: #1c3228;
    background: #f4f7f3;
    --green: #215c40;
    --forest: #153e2e;
    --orange: #b34416;
    --muted: #52675b;
    --line: #d8e3d9;
    --surface: #fff;
}
body { margin: 0; line-height: 1.5; }
a { color: var(--green); font-weight: 650; text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; width: fit-content; min-height: 44px; padding: .58rem .95rem; border: 1px solid transparent; border-radius: .65rem; background: var(--green); color: white; font-weight: 700; cursor: pointer; text-decoration: none; }
button.secondary, .secondary { color: var(--green); border-color: #c3d7c8; background: #f6fbf6; }
.primary { background: var(--orange); }
.danger { color: #9b2324; background: #fff3f2; border-color: #f0c6c6; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #b34b20; outline-offset: 2px; }
h1, h2, h3, p { margin: 0 0 .65rem; }
h1 { font-size: clamp(1.85rem, 4vw, 2.65rem); letter-spacing: -.045em; line-height: 1.1; }
h2 { font-size: 1.2rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; margin-top: .75rem; }
small { display: block; font-size: .8125rem; color: var(--muted); }
.muted, .empty, dt, .page-header p { color: var(--muted); }
.empty { padding: .7rem 0 0; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.content { width: min(100%, 92rem); padding: 1.15rem 1rem 7rem; margin: auto; }
.sidebar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 3; background: var(--forest); color: #fff; }
.sidebar nav { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); padding: .25rem .2rem max(.25rem, env(safe-area-inset-bottom)); }
.sidebar nav a { color: #fff; text-decoration: none; padding: .35rem .12rem; text-align: center; line-height: 1.15; font-size: clamp(.68rem, 2.4vw, .9rem); border-radius: .6rem; min-height: 52px; }
.sidebar nav a span { display: block; font-size: 1.3rem; margin-bottom: .18rem; }
.sidebar nav a[aria-current], .sidebar nav a:hover { background: #35634d; }
.brand { display: flex; align-items: center; gap: .75rem; font-size: 1.22rem; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; place-items: center; height: 44px; width: 44px; background: #e0efdc; color: var(--forest); border-radius: .9rem; font-size: .9rem; }
.sidebar .brand, .desktop-logout { display: none; }
.mobile-brand { margin-bottom: 1rem; }
.page-header, .section-header, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.page-header, .section-header { justify-content: space-between; }
.page-header { margin: .35rem 0 1.2rem; }
.page-header p { margin: .35rem 0 0; }
.section-header { margin-bottom: .65rem; }
.section-header h2 { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; margin-block: 1rem; }
.stat, .panel { border: 1px solid var(--line); border-radius: .95rem; background: var(--surface); padding: .95rem; }
.stat:first-child, .focus { border-color: #b6d1bb; background: #edf7eb; }
.stat span { display: block; color: var(--muted); font-size: .875rem; font-weight: 650; }
.stat strong { display: block; font-size: clamp(1.15rem, 3vw, 1.7rem); margin-top: .2rem; overflow-wrap: anywhere; }
.panel { margin-block: .9rem; min-width: 0; }
.stack { display: grid; gap: .8rem; }
.stack > .panel { margin-block: 0; }
.narrow { max-width: 38rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; }
.filters label { flex: 1 1 10rem; }
.filters label:has(input[type=search]) { flex-basis: 16rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap: .75rem; }
label { display: grid; gap: .26rem; font-weight: 650; font-size: .9rem; }
input, select, textarea { min-width: 0; width: 100%; padding: .55rem .65rem; min-height: 44px; border: 1px solid #aabfb0; border-radius: .55rem; background-color: #fff; color: #1c3228; font-size: 1rem; font-weight: 400; }
textarea { resize: vertical; }
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, #315c45 50%),linear-gradient(135deg, #315c45 50%, transparent 50%); background-position: calc(100% - 15px) 52%,calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.alert { padding: .75rem 1rem; border-radius: .65rem; border: 1px solid; }
.error { background: #fff1ef; color: #8e2822; }
.success { background: #ebf7e9; color: #23583a; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,22rem),1fr)); gap: .8rem; }
.split-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .62rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.split-row > :last-child { text-align: right; }
.total { font-size: 1.13rem; background: #edf7eb; border: 0; border-radius: .45rem; padding-inline: .6rem; margin-top: .25rem; font-weight: 750; }
.badge { display: inline-block; margin: .11rem 0; padding: .15rem .42rem; font-size: .82rem; font-weight: 700; color: #314b40; border-radius: .35rem; background: #e9efeb; }
.badge.baru, .badge.diproses { background: #e5efff; color: #254b85; }
.badge.belum_lunas, .badge.belum { background: #fff0d6; color: #734511; }
.badge.siap, .badge.selesai, .badge.diantar, .badge.diambil, .badge.lunas { background: #dff1e2; color: #205937; }
.badge.dibatalkan { background: #fbe4e5; color: #92272c; }
.dispatch { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.dispatch:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: .85rem; }
.line { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,11rem),1fr)); align-items: end; gap: .65rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.quantity { display: flex; gap: .25rem; }
.quantity button { padding: .4rem; min-width: 44px; }
.quantity input { text-align: center; }
.line-end { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
#order-lines { margin-bottom: .7rem; }
dd { margin: 0; overflow-wrap: anywhere; }
.subform { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .8rem; }
.login-page { min-height: 100dvh; display: grid; align-items: center; background: radial-gradient(ellipse at top left,#dbeed9,#f4f7f3 60%); }
.standalone { width: min(calc(100% - 2rem),28rem); margin: 2rem auto; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); padding: clamp(1.2rem,5vw,2.25rem); }
.login .brand { margin-bottom: 1.5rem; }
.login button { width: 100%; }
.print-only { display: none; }
@media screen and (max-width: 700px) {
    .cards, .cards tbody, .cards tr, .cards td { display: block; }
    .cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .cards tr { border: 1px solid var(--line); border-radius: .65rem; margin-block: .6rem; padding: .45rem .7rem; }
    .cards td { padding: .35rem 0; border: 0; }
    .cards td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-weight: 650; font-size: .8125rem; color: var(--muted); }
}
@media screen and (min-width: 900px) {
    body:not(.login-page) { padding-left: 15rem; }
    .sidebar { inset: 0 auto 0 0; width: 15rem; display: flex; flex-direction: column; padding: 1.2rem .9rem; }
    .sidebar .brand { display: flex; color: white; margin: .4rem .3rem 1.5rem; }
    .sidebar .brand small { color: #d7eadc; }
    .sidebar nav { display: grid; grid-template-columns: auto; gap: .2rem; padding: 0; }
    .sidebar nav a { display: flex; align-items: center; gap: .8rem; text-align: left; padding: .55rem .8rem; font-size: .95rem; min-height: 44px; }
    .sidebar nav a span { width: 1.25rem; margin: 0; }
    .desktop-logout { display: block; margin-top: auto; }
    .mobile-brand { display: none; }
    .content { padding: 2rem clamp(1.4rem,3vw,3.4rem); }
    .stats { grid-template-columns: repeat(auto-fit,minmax(9rem,1fr)); }
    .stat, .panel { padding: 1.2rem; }
}
@page { size: A4; margin: 12mm; }
@media print {
    :root, body { background: white; color: black; font-size: 10pt; }
    .no-print { display: none !important; }
    .print-only { display: block; }
    .content { width: auto; padding: 0; }
    .panel, .stat, .badge, .total { background: white !important; color: black; border-color: #bbb; }
    a { color: black; text-decoration: none; }
    .stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .table-wrap { overflow: visible; }
    table { table-layout: fixed; font-size: 8pt; }
    td, th { padding: .25rem; }
    .dispatch, tr, .split-row, .stat { break-inside: avoid; }
    h2, h3 { break-after: avoid; }
}[hidden] { display: none !important; }
.order-filters { flex: 1 0 100%; }
.order-filters .actions, .order-options .fields, details[open] > form { margin-top: .65rem; }
summary { color: var(--green); font-weight: 700; cursor: pointer; padding-block: .4rem; width: fit-content; }
.order-cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,19rem),1fr)); gap: .65rem; }
.order-card { display: grid; align-content: start; gap: .42rem; min-width: 0; padding: .9rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); text-decoration: none; color: inherit; font-weight: 400; }
.order-card:hover, .order-card:focus-visible { border-color: var(--green); background: #f7fbf6; }
.card-top { display: flex; align-items: start; justify-content: space-between; gap: .65rem; overflow-wrap: anywhere; }
.card-top > strong { color: var(--green); flex-shrink: 0; }
.card-meta { font-size: .875rem; color: var(--muted); }
.card-items { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.card-status { display: flex; flex-wrap: wrap; gap: .25rem; }
.manage-dialog { width: min(100% - 2rem,36rem); max-height: 90dvh; padding: 0; border: 1px solid var(--line); border-radius: 1rem; color: inherit; overscroll-behavior: contain; }
.manage-dialog::backdrop { background: #11261db3; }
body:has(.manage-dialog[open]) { overflow: hidden; }
.manage-head { position: sticky; top: 0; z-index: 1; background: var(--surface); display: flex; justify-content: space-between; align-items: start; gap: .65rem; border-bottom: 1px solid var(--line); padding: .85rem 1rem; }
.manage-head h2 { margin: .15rem 0; overflow-wrap: anywhere; }
.manage-head p { margin: 0; font-size: .875rem; color: var(--muted); }
.manage-dialog .alert { margin: .8rem 1rem 0; }
.manage-info { display: grid; gap: .25rem; background: #edf7eb; border-radius: .65rem; margin: .8rem 1rem; padding: .65rem .8rem; overflow-wrap: anywhere; }
.manage-actions { padding: 0 1rem; }
.manage-actions section { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.manage-label { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .45rem; }
.manage-label h3 { margin: 0; }
.status-buttons { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .35rem; }
.status-buttons button { width: 100%; padding-inline: .3rem; }
.manage-footer { padding: .85rem 1rem; }
.method-picker { border: 0; margin: .7rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.method-picker legend { font-size: .9rem; font-weight: 650; margin-bottom: .25rem; }
.choice { display: inline-flex; align-items: center; gap: .5rem; padding: .42rem .68rem; border: 1px solid var(--line); border-radius: .65rem; min-height: 44px; cursor: pointer; }
.choice:has(:checked) { border-color: var(--green); background: #e3f2e3; }
.choice input { width: 1.15rem; min-height: auto; height: 1.15rem; accent-color: var(--green); }
[data-address] { margin-top: .65rem; }
.menu-picker { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap: .4rem; }
.menu-tile { width: 100%; justify-content: space-between; text-align: left; gap: .6rem; padding: .45rem .65rem; min-height: 56px; }
.menu-tile small { font-weight: 500; }
.menu-tile.picked { border-color: var(--green); background: #e3f2e3; }
.pick-count { display: grid; place-items: center; min-width: 1.7rem; padding: .1rem .25rem; border-radius: .45rem; background: #d8eadb; }
.selected-menu { font-weight: 700; align-self: center; }
.item-note { grid-column: 1 / -1; }
.order-save { position: sticky; z-index: 2; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; padding: .65rem .9rem; box-shadow: 0 -4px 16px #153e2e12; }
.order-save output { font-size: 1.2rem; font-weight: 800; }
@media screen and (max-width: 899px) {
    .order-save { bottom: calc(58px + env(safe-area-inset-bottom)); }
    .manage-dialog { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 1rem 1rem 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
@media screen and (max-width: 480px) {
    .menu-picker { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .menu-tile { font-size: .875rem; min-width: 0; }
    .menu-tile span:first-child { overflow-wrap: anywhere; }
    #order-lines .line { grid-template-columns: minmax(0,1fr) auto; }
    #order-lines .line > :first-child + div, #order-lines [data-menu-select] { grid-column: 1 / -1; }
    #order-lines .line-end { flex-wrap: wrap; justify-content: end; }
}
