@import url('/brand/palette.css');

@font-face { font-family: 'DM Sans'; src: url('/brand/fonts/DMSans-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/brand/fonts/DMSans-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/brand/fonts/DMSans-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/brand/fonts/DMSans-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Bricolage'; src: url('/brand/fonts/BricolageGrotesque-Text-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --bg: var(--linen, #F8F6F0);
  --surface: #fff;
  --text: var(--ink, #12211D);
  --muted: var(--stone, #6B7F79);
  --line: #E4E1D6;
  --field: #CBC8BC;
  --primary: var(--spruce, #0B4F45);
  --accent: var(--teal, #0C6B5C);
  --warn: #A63F27;
  --warn-bg: #FBE9E3;
  --sun-bg: #FDF0D5;
  --blue: #1D4E89;
  --blue-bg: #E5EEF9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 33, 29, .05), 0 2px 10px rgba(18, 33, 29, .04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 'DM Sans', system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); }
h1, h2, h3 { font-family: 'Bricolage', 'DM Sans', sans-serif; font-weight: 700; line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--accent); }
p { margin: 0 0 .6rem; }
code { font-size: .9em; background: #EFEDE5; padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--primary); color: #fff; padding: 22px 14px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.sidebar .logo img { width: 184px; display: block; margin: 0 6px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: #DCEDE7; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .15); color: #fff; font-weight: 600; }
.who { margin-top: auto; padding: 10px; font-size: .85rem; color: #CFE3DC; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.linkish { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.main { padding: 26px 34px 56px; max-width: 1200px; width: 100%; }
.main.bare { max-width: none; padding: 24px; }
.topbar, .tabbar, .mobile-only { display: none; }

@media (max-width: 768px) {
  .shell { display: block; }
  .sidebar, .desktop-only { display: none !important; }
  .mobile-only { display: revert; }
  .main { padding: 0 14px calc(92px + env(safe-area-inset-bottom)); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 15; margin: 0 -14px 12px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: rgba(248, 246, 240, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); font-weight: 700; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: .7rem; font-weight: 600; color: var(--muted); text-decoration: none; }
  .tabbar a.active { color: var(--primary); }
  .tabbar a.scan svg { background: var(--primary); color: #fff; border-radius: 12px; padding: 4px; width: 34px; height: 34px; margin-top: -10px; box-shadow: 0 2px 8px rgba(11, 79, 69, .3); }
  h1 { font-size: 1.4rem; }
  .card { padding: 14px; }
}

/* ---------- layout helpers */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sub { color: var(--muted); }
.stack > * + * { margin-top: 14px; }
.narrow { max-width: 520px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.row { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card .pad, .card.flush h2 { padding: 14px 16px 0; }
.scroll-x { overflow-x: auto; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.big { font-family: 'Bricolage', sans-serif; font-size: 1.7rem; font-weight: 700; }
.err-text { color: var(--warn); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.notice { padding: 11px 14px; border-radius: 10px; margin: 0 0 14px; background: var(--rinse, #DFF0EA); color: var(--primary); font-weight: 600; }
.notice.err { background: var(--warn-bg); color: var(--warn); }
.notice.sun { background: var(--sun-bg); color: #664500; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
ul.plain, ul.msgs, ul.timeline { list-style: none; padding: 0; margin: 0; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
ul.msgs li, ul.timeline li { padding: 6px 0; border-top: 1px solid var(--line); }
ul.msgs li:first-child, ul.timeline li:first-child, ul.plain li:first-child { border-top: 0; }
details summary { cursor: pointer; }
.inline-details { display: inline-block; }

/* ---------- forms */
label { display: block; font-weight: 600; font-size: .88rem; margin: 0 0 5px; }
.field { margin-bottom: 12px; }
.hint { color: var(--muted); font-size: .84rem; font-weight: 400; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], input[type=month],
input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--field); border-radius: 10px;
  background: #fff; font: inherit; color: inherit; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input:disabled { background: #F2F0EA; color: var(--muted); }
textarea { min-height: 76px; resize: vertical; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; min-height: 36px; margin: 0; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }
.big-check { font-size: 1.1rem; font-weight: 700; min-height: 48px; border-bottom: 1px solid var(--line); }
.search { margin-bottom: 14px; }
.zone-row { display: flex; gap: 8px; align-items: center; }
.zone-row.wrap { flex-wrap: wrap; }
.zone-row input[type=text] { flex: 1; min-width: 90px; }
.zone-row .check { white-space: nowrap; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--field); background: #fff; color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #083D35; }
.btn.accent { background: var(--sun, #F2B33D); border-color: var(--sun, #F2B33D); color: var(--ink); }
.btn.danger { color: var(--warn); border-color: #E8C1B6; }
.btn.small { min-height: 36px; padding: 0 11px; font-size: .9rem; border-radius: 9px; }
.btn.block { display: flex; width: 100%; }
.btn.icon-only { padding: 0 9px; }
.btn.disabled, .btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }
.text-btn { display: inline-flex; gap: 4px; }
label.btn { margin: 0; font-size: .9rem; }

/* ---------- chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  background: #ECEAE2; color: var(--text); white-space: nowrap; text-decoration: none; line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip.picked_up { background: var(--blue-bg); color: var(--blue); }
.chip.weighed, .chip.cleaning { background: var(--sun-bg); color: #6E4A00; }
.chip.ready { background: var(--rinse, #DFF0EA); color: var(--primary); }
.chip.out_for_delivery { background: #D3ECE4; color: var(--accent); }
.chip.delivered { background: var(--primary); color: #fff; }
.chip.cancelled, .chip.skipped { background: #EEE; color: #777; }
.chip.missed_pickup, .chip.unpaid { background: var(--warn-bg); color: var(--warn); }
.chip.paid { background: var(--rinse, #DFF0EA); color: var(--primary); }
.chip.zone { background: var(--accent); color: #fff; }
.chip.late { background: var(--warn); color: #fff; }
.chip.bag { background: #fff; border: 1px solid var(--field); font-size: .85rem; }
.prefs { display: flex; flex-wrap: wrap; gap: 6px; }
.pref { background: var(--sun-bg); color: #5C3F00; border-radius: 7px; padding: 3px 8px; font-size: .8rem; font-weight: 600; }
.pref.hypo { background: var(--blue-bg); color: var(--blue); }
.pref.access { background: #EFEDE5; color: var(--text); }
.pref.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- tables */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list a { text-decoration: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
table.report td, table.report th { white-space: nowrap; }
.pay-inline input[type=text] { max-width: 90px; min-height: 36px; }
.pay-inline select { max-width: 120px; min-height: 36px; }

/* ---------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; }
.stat .v { font-family: 'Bricolage', sans-serif; font-size: 1.55rem; font-weight: 700; }
.stat .l { font-size: .8rem; color: var(--muted); font-weight: 600; }

/* ---------- order board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.board .col { background: #EEEBE2; border-radius: var(--radius); padding: 10px; min-height: 220px; scroll-snap-align: start; }
.board .col h3 { display: flex; justify-content: space-between; font-size: .92rem; margin: 2px 2px 10px; }
.board .col form { margin-bottom: 8px; }
.ocard { display: block; background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; text-decoration: none; color: inherit; border: 1px solid var(--line); }
.ocard:hover { border-color: var(--accent); }
.ocard .t { font-weight: 700; }
.ocard .m { font-size: .84rem; color: var(--muted); }

/* ---------- order detail */
.stepper { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0; overflow-x: auto; }
.stepper li { flex: 1; min-width: 92px; text-align: center; font-size: .78rem; font-weight: 600; padding: 7px 4px; border-radius: 8px; background: #ECEAE2; color: var(--muted); white-space: nowrap; }
.stepper li.done { background: var(--rinse, #DFF0EA); color: var(--primary); }
.stepper li.current { background: var(--primary); color: #fff; }
.weigh-row { display: grid; grid-template-columns: 96px 1fr 1fr 90px 44px; gap: 8px; align-items: end; padding: 6px 0; border-bottom: 1px solid var(--line); }
.weigh-row .field { margin: 0; }
.bag-label { font-weight: 700; align-self: center; padding-top: 16px; }
.bag-label a { text-decoration: none; }
.net { min-height: 44px; display: flex; align-items: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.add-bag { margin-top: 10px; }
.total-box { background: var(--rinse, #DFF0EA); border-radius: var(--radius); padding: 14px 16px; margin-top: 4px; }
.total-box .line { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.total-box .total { font-family: 'Bricolage', sans-serif; font-size: 1.45rem; font-weight: 700; border-top: 1px solid rgba(11, 79, 69, .2); margin-top: 6px; padding-top: 8px; }
.locked-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; margin-top: 12px; }
.photo-form { margin-top: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumbs a { display: block; width: 120px; font-size: .74rem; color: var(--muted); text-decoration: none; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: 9px; display: block; background: #EEE; }
.claim { margin: 6px 0; }
@media (max-width: 768px) {
  .weigh-row { grid-template-columns: 1fr 1fr 76px 40px; gap: 6px; }
  .weigh-row .bag-label { grid-column: 1 / -1; padding: 6px 0 0; }
}

/* ---------- today */
.day-nav { display: flex; align-items: center; gap: 10px; }
.day-title { flex: 1; text-align: center; }
.day-title h1 { margin: 0; }
.run-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.run-stats { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-weight: 600; }
.reminders summary { padding: 2px 0; }
.reminders ul { margin-top: 8px; }
.stops { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.stop { padding: 12px 14px; }
.stop > * + * { margin-top: 8px; }
.stop-head { display: flex; gap: 10px; align-items: flex-start; }
.handle { color: var(--muted); cursor: grab; touch-action: none; padding: 2px 0; }
.stop-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.stop-who { flex: 1; min-width: 0; }
.stop-who a { color: var(--text); text-decoration: none; font-size: 1.05rem; }
.stop-tags { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.stop.done { background: #FBFAF6; box-shadow: none; }
.stop.done .stop-num { background: var(--rinse, #DFF0EA); color: var(--primary); }
.stop.done .stop-who a { color: var(--muted); }
.sortable-ghost { opacity: .4; }

/* ---------- menus, login, bag page, scanner */
.menu { padding: 4px 0; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 13px 16px; color: var(--text); text-decoration: none; font-weight: 600; border-top: 1px solid var(--line); }
.menu a:first-child { border-top: 0; }
.menu a svg:last-child { margin-left: auto; color: var(--muted); }
.login { max-width: 380px; margin: 9vh auto 0; }
.login-logo { width: 220px; display: block; margin: 4px auto 20px; }
.password { font: 700 1.5rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .03em; background: var(--rinse, #DFF0EA); padding: 12px; border-radius: 10px; text-align: center; user-select: all; }
.bag-hero { text-align: center; }
.bag-id { font-family: 'Bricolage', sans-serif; font-size: 2.4rem; font-weight: 700; color: var(--primary); letter-spacing: .02em; }
.scanner { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 4; max-height: 62vh; display: grid; place-items: center; }
.scanner video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.scan-frame { position: absolute; width: 62%; aspect-ratio: 1; border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; pointer-events: none; }
.scanner .btn { position: relative; z-index: 2; }
.scanner p { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; color: #fff; margin: 0; z-index: 2; }
.photo-pick { display: block; margin-bottom: 12px; }
.photo-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-pick .preview { width: 100%; border-radius: 10px; margin-top: 10px; }

/* ---------- partner slip */
.slip { max-width: 4.25in; margin: 0 auto; font-size: 12pt; }
.slip-head { display: flex; gap: 12px; align-items: center; border-bottom: 2px solid #000; padding-bottom: 8px; }
.slip-no { font: 700 22pt 'Bricolage', sans-serif; }
.slip-dates { margin-left: auto; text-align: right; font-weight: 600; }
.slip-bags { width: 100%; border-collapse: collapse; margin: 10px 0; }
.slip-bags th, .slip-bags td { border-bottom: 1px solid #999; padding: 4px; text-align: left; }
.slip-bags .sum td { font-weight: 700; border-bottom: 0; }
.slip-prefs { list-style: none; padding: 0; font-size: 14pt; }
.slip-prefs li { padding: 3px 0; }

/* ---------- label sheets: Avery 22806, 2 x 2 in, 3 x 4 per letter page */
.label-controls { max-width: 900px; margin: 0 auto 20px; }
.label-sheet { width: 8.5in; height: 11in; padding: var(--top) var(--side) 0; display: grid; grid-template-columns: repeat(3, 2in);
  grid-auto-rows: 2in; column-gap: var(--gapx); row-gap: var(--gapy); align-content: start; background: #fff; margin: 0 auto 24px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .12); break-after: page; }
.label { width: 2in; height: 2in; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  overflow: hidden; border: 1px dashed #D8D5CB; border-radius: 4px; }
.label-qr { width: 1.32in; height: 1.32in; }
.label-qr svg { width: 100%; height: 100%; display: block; }
.label-id { font: 700 15pt 'Bricolage', sans-serif; color: var(--primary); letter-spacing: .02em; margin-top: 1pt; }
.label-brand { font: 700 6.5pt 'DM Sans', sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }

@media print {
  .sidebar, .tabbar, .topbar, .no-print, .notice { display: none !important; }
  body { background: #fff; }
  .main, .main.bare { padding: 0; max-width: none; }
  .shell { display: block; }
  .card { box-shadow: none; }
  .label-sheet { margin: 0; box-shadow: none; }
  .label { border: 0; }
}
