/* ShipMet web app. Builds on /site.css (colors, buttons, cards, tables). */
[hidden] { display: none !important; }
body.app { background: var(--soft); min-height: 100vh; }
.app-bar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.app-bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.app-bar .brand img { width: 40px; height: 36px; }
.app-nav { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: .95rem; align-items: center; }
.app-nav a, .app-nav button.linkish { color: var(--ink); text-decoration: none; padding: 6px 0; }
.app-nav a.active { color: var(--blue); font-weight: 700; }
.app-nav a.nav-cta { background: var(--blue); color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 700; }

.app-main { max-width: 860px; margin: 0 auto; padding: 28px 20px 80px; outline: none; }
.app-main.narrow { max-width: 460px; }
.app-main h1 { font-size: 1.8rem; margin-bottom: .4em; }
.app-main h2 { font-size: 1.25rem; margin: 0 0 .6em; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.panel h2 .step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; font-size: .9rem; margin-right: 8px; vertical-align: 2px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .9rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* Forms */
label { display: block; font-weight: 700; font-size: .92rem; margin: 12px 0 5px; }
label .opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=datetime-local], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink);
  border: 1px solid #c5d0da; border-radius: 10px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
textarea { min-height: 70px; resize: vertical; }
.grid-fields { display: grid; gap: 0 14px; grid-template-columns: repeat(2, 1fr); }
.grid-fields.three { grid-template-columns: repeat(3, 1fr); }
.grid-fields.four { grid-template-columns: repeat(4, 1fr); }
.grid-fields .full { grid-column: 1 / -1; }
.grid-fields > div { min-width: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 12px 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-weight: 400; cursor: pointer; }
.choice input { margin-top: 4px; }
.choice:has(input:checked) { border-color: var(--teal); background: #eef9f9; }
.field-error { color: #b42318; font-size: .88rem; margin-top: 4px; }
.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.alert.err { background: #fef3f2; color: #912018; border: 1px solid #fecdca; }
.alert.ok { background: #ecfdf3; color: #05603a; border: 1px solid #abefc6; }
.alert.info { background: #eef6fb; color: #1d4f7a; border: 1px solid #cfe3f3; }
.alert.warn { background: #fffaeb; color: #93370d; border: 1px solid #fedf89; }

button { font: inherit; }
.btn { cursor: pointer; font-size: 1rem; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-outline { background: #fff; color: var(--blue); border-color: var(--blue); }
.btn-outline:hover { background: #eef6fb; }
.btn-danger { background: #fff; color: #b42318; border-color: #f3b4ae; }
.btn-danger:hover { background: #fef3f2; }
.btn-small { padding: 7px 14px; font-size: .9rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; }

/* Address finder */
.addr-found { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; background: #eef9f9; border: 1px solid #bfe7e6; border-radius: 10px; padding: 12px 14px; }
.addr-found b { display: block; }
.matches { margin-top: 8px; }

/* Boxes */
.box-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fbfdfe; }
.box-item .row.between h3 { margin: 0; font-size: 1.05rem; }

/* Quote */
.quote { border: 1px solid #bfe7e6; background: #f2fbfb; border-radius: 12px; padding: 16px; }
.quote .total { font-size: 1.6rem; font-weight: 800; color: var(--blue); }
.quote table { background: transparent; border: 0; }
.quote td { border: 0; padding: 4px 0; }

/* Lists and detail */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.tabs button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.list { list-style: none; padding: 0; margin: 0; }
.list li a { display: flex; gap: 14px; align-items: center; justify-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; color: var(--ink); text-decoration: none; }
.list li a:hover { border-color: var(--teal); }
.list .meta { color: var(--muted); font-size: .9rem; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; background: #eef2f6; color: #3d4b5a; }
.chip.draft, .chip.packed { background: #fffaeb; color: #93370d; }
.chip.published { background: #eef6fb; color: #1d4f7a; }
.chip.in_progress, .chip.accepted, .chip.picked_up { background: #e9f6f6; color: #1f6f6e; }
.chip.completed, .chip.delivered { background: #ecfdf3; color: #05603a; }
.chip.cancelled, .chip.expired, .chip.returned, .chip.recipient_unavailable { background: #f2f4f7; color: #475467; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tracking { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.timeline { list-style: none; padding: 0; margin: 8px 0 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 10px 16px; font-size: .92rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.timeline time { color: var(--muted); margin-left: 6px; }
#payment-element { margin: 14px 0; min-height: 120px; }

.toast { pointer-events: none; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #17293b; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 20; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }

@media (max-width: 640px) {
  .grid-fields, .grid-fields.three { grid-template-columns: 1fr; }
  .grid-fields.four { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: 8px; }
  .app-main { padding: 20px 16px 72px; }
  .panel { padding: 16px; }
  .list li a { flex-wrap: wrap; }
}

/* Drivers */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.seg .choice { margin: 0; }
canvas.sig { width: 100%; height: 160px; border: 1px dashed #9fb1c2; border-radius: 10px; background: #fff; touch-action: none; display: block; }
.scanner { position: fixed; inset: 0; background: rgba(10, 20, 30, .92); z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; padding: 16px; }
.scanner p { text-align: center; max-width: 420px; margin: 0; }
.scanner .btn-ghost { border-color: rgba(255,255,255,.7); color: #fff; }
.scanner video { width: min(100%, 520px); border-radius: 12px; background: #000; }
@media print { .app-bar, .toast, #print, #yr, .small a { display: none !important; } body.app { background: #fff; } }
@media (max-width: 420px) { .seg { grid-template-columns: 1fr; } }

.photo-preview { display: flex; gap: 12px; align-items: center; margin: 8px 0 4px; padding: 8px; border: 1px solid #bfe7e6; background: #eef9f9; border-radius: 10px; }
.photo-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }

/* Driver documents */
.doc-steps { list-style: none; padding: 0; margin: 8px 0 0; }
.doc-steps > li { padding: 12px 0; border-top: 1px solid var(--line); }
.doc-steps > li:first-child { border-top: 0; }
.doc-form { margin-top: 6px; }
fieldset.choices { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
fieldset.choices legend { font-weight: 600; padding: 0; margin-bottom: 2px; }
.panel.founding { border-color: var(--teal); }
.tracking.big { font-size: 1.6rem; font-weight: 700; margin: 4px 0 12px; }
.return-row .actions { margin-top: 8px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.field-label { font-weight: 700; margin: 14px 0 4px; }
.addr-label { font-weight: 700; margin: 12px 0 4px; }

/* ---------- window shops ---------- */
.shop-head .actions, .order-card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.item-add { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; }
@media (max-width: 560px) { .item-add { grid-template-columns: 1fr; } }
.photo-pick { display: grid; place-items: center; width: 120px; height: 120px; border: 2px dashed var(--line); border-radius: 12px; background: var(--soft); color: var(--blue); font-weight: 700; cursor: pointer; overflow: hidden; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.shop-items .panel { padding: 14px; margin-bottom: 10px; }
.shop-item-main { display: flex; gap: 14px; align-items: flex-start; }
.shop-item-main .grow { flex: 1; min-width: 0; }
.shop-item.is-hidden { border-color: #fedf89; background: #fffaeb; }
.thumb { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 10px; background: #eef6fb; overflow: hidden; display: grid; place-items: center; font-size: .7rem; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.seg-stock { display: flex; width: 100%; max-width: 360px; margin-top: 10px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg-stock button { flex: 1; white-space: nowrap; border: 0; background: #fff; padding: 8px 14px; min-height: 40px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink); }
.seg-stock button + button { border-left: 1px solid var(--line); }
.seg-stock button.on.in { background: #ecfdf3; color: #05603a; font-weight: 700; }
.seg-stock button.on.low { background: #fffaeb; color: #93370d; font-weight: 700; }
.seg-stock button.on.out { background: #fef3f2; color: #b42318; font-weight: 700; }
.item-edit { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.item-edit .actions { display: flex; gap: 8px; margin-top: 10px; }
.slug-field { display: flex; align-items: center; gap: 4px; }
.slug-field span { color: var(--muted); white-space: nowrap; }

.shopfront { max-width: 980px; padding-bottom: 96px; }
.shop-hero { margin-bottom: 18px; }
.shop-hero h1 { margin-bottom: 4px; }
.promise { display: inline-block; margin-top: 6px; padding: 10px 14px; border: 1px solid #bfe7e6; background: #fff; border-radius: 12px; font-weight: 700; color: var(--blue-dark); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.shop-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.shop-photo { aspect-ratio: 1 / 1; background: #eef6fb; }
.shop-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.shop-card-body .btn, .shop-card-body .qty { margin-top: auto; }
.stock { font-size: .8rem; font-weight: 700; color: #05603a; }
.stock.low { color: #93370d; }
.stock.out { color: #b42318; }
.qty { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--blue); border-radius: 10px; }
.qty button { border: 0; background: none; font-size: 1.3rem; width: 44px; height: 40px; color: var(--blue); cursor: pointer; }
.cart-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); z-index: 6; }
.cart-bar .btn { max-width: 640px; margin: 0 auto; display: block; }
#checkout .plain-list li { padding: 4px 0; }

.sticker { background: #fff; border: 8px solid var(--blue); border-radius: 24px; padding: 28px; text-align: center; max-width: 420px; margin: 0 auto; }
.sticker h1 { font-size: 1.9rem; line-height: 1.15; margin: 8px 0; }
.sticker-brand { font-family: Nunito, sans-serif; font-size: 1.2rem; color: var(--blue-dark); display: inline-flex; gap: 6px; align-items: center; }
.sticker-qr { display: block; margin: 12px auto; width: 220px; height: 220px; }
.sticker-url { font-weight: 700; color: var(--blue-dark); }
@media print {
  .app-bar, .no-print, .toast { display: none !important; }
  body.app { background: #fff; }
  .sticker { break-inside: avoid; }
}
.sticker-opts .actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.shop-item.flash { box-shadow: 0 0 0 3px var(--teal); transition: box-shadow .3s; }
#itemForm .row h3 { margin: 0; }
.row.between .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs a { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; }
.tabs a.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.biz-tabs { margin: -4px 0 18px; flex-wrap: wrap; }

/* Find it local (#/local) */
.search-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.search-row input { flex: 1; min-width: 0; margin: 0; padding: 0 14px; font-size: 1rem; border-radius: 12px; }
a.shop-card { color: inherit; text-decoration: none; }
a.shop-card:hover { border-color: var(--blue, #1d6fe0); }
.shop-card.hl { outline: 3px solid var(--blue, #1d6fe0); outline-offset: 2px; }
.shop-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.shop-list a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; color: inherit; text-decoration: none; }
