:root { --ink: #15202b; --mute: #5b6875; --canvas: #eef1f4; --card: #fff; --line: #d3dae2; --accent: #0d6e5f; --bad: #b42318; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0 0 .75rem; line-height: 1.2; }
h2 { font-size: 1.2rem; } h3 { font-size: 1rem; color: var(--mute); }
a { color: var(--accent); }
small, .hint, .k { color: var(--mute); }
.k { font-size: .85rem; display: block; }
main { max-width: 1200px; margin: 0 auto; padding: 1rem; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; background: var(--ink); color: #fff; }
.brand { font-size: 1.1rem; letter-spacing: .02em; }
.who { flex: 1; color: #c3ccd5; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; gap: .25rem; padding: 0 1rem; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.nav a { display: flex; align-items: center; gap: .4rem; padding: .85rem 1rem; color: var(--mute); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.nav a[aria-current=page] { color: var(--ink); border-bottom-color: var(--accent); }
.badge { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
.cards { display: grid; gap: .75rem; }
.cards p { margin: .35rem 0; }
.form { max-width: 520px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.actions > * { flex: 1 1 180px; }
.empty { color: var(--mute); padding: 1rem 0; }
.kv { margin: .5rem 0; }
.kv .v { overflow-wrap: anywhere; }
.big .v { font-size: 1.2rem; }
.big .name { font-weight: 700; }
.warn { background: #fdecc8; color: #6b4300; border-radius: 6px; padding: .4rem .7rem; font-size: .9rem; }

label { display: block; margin-bottom: .75rem; font-size: .9rem; color: var(--mute); }
input, select, textarea, button { font: inherit; }
input, select, textarea { display: block; width: 100%; min-height: 40px; margin-top: .25rem; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
textarea { min-height: 80px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 1rem; padding: .6rem .75rem; }
legend { padding: 0 .35rem; font-size: .9rem; color: var(--mute); }
.radio, .check { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: var(--ink); }
.radio input[type=radio], .check input { width: auto; min-height: 0; margin: 0; }
.radio input[name=pickup] { flex: 1 1 100%; }

button { min-height: 44px; padding: .5rem 1rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
button.ghost { background: transparent; color: inherit; border: 1px solid var(--line); }
.top button.ghost { border-color: #44525f; }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid #4c9ffe; outline-offset: 2px; }

.tools { display: flex; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.tools input { max-width: 340px; margin: 0; }
.tools select { max-width: 200px; margin: 0; }
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: .75rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--mute); font-weight: 600; white-space: nowrap; }
td input, td select, td textarea { margin: 0; min-width: 130px; }
tr.open { cursor: pointer; }
tr.open:hover td { background: #f6f8fa; }

.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: #e4e8ee; color: #33404d; }
.chip.assigned { background: #fdecc8; color: #7a4e00; }
.chip.picked_up { background: #d9e7ff; color: #1b4aa6; }
.chip.delivered { background: #d5f0e3; color: #0b6a40; }
.chip.cancelled { background: #f1dede; color: #8c2a2a; }
.chip.district { background: #e7e3f7; color: #43348a; }
.chip.nodistrict { background: #f1dede; color: #8c2a2a; }

.dlg { width: min(720px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); overflow: auto; border: 0; border-radius: 10px; padding: 1.25rem; }
.dlg::backdrop { background: rgba(10, 20, 30, .5); }
.grid2 { display: grid; gap: 0 1.5rem; grid-template-columns: 1fr 1fr; margin: .5rem 0 1rem; }

.login { max-width: 380px; margin: 10vh auto 0; }
.err { color: var(--bad); min-height: 1.5em; margin: .5rem 0 0; }
#toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); padding: .6rem 1rem; border-radius: 6px; background: var(--ink); color: #fff; opacity: 0; pointer-events: none; max-width: 92vw; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .tools input, .tools select { max-width: none; }
  .cards button { flex: 1 1 100%; }
  .who { display: none; }
  .top { justify-content: space-between; }
}
