/* Judge Batteries — app.css
   Shared by the admin console, the worker app, the tracking page and the price form.
   Loads after site.css (fonts, tokens, buttons). Mobile first. */

.app { min-height: 100dvh; display: flex; flex-direction: column; background: var(--paper); font-size: 15px; line-height: 1.5; }
.app-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--ink); color: var(--paper); min-height: 56px; }
.app-top img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.app-top b { font: 700 16px/1.1 var(--display); letter-spacing: -.01em; }
.app-top small { display: block; color: var(--muted-d); font-size: 11.5px; font-weight: 500; }
.app-top .sp { flex: 1; }
.app-top select, .app-top .tbtn { min-height: 38px; border-radius: 10px; border: 1px solid var(--line-d); background: transparent; color: var(--paper); padding: 0 10px; font: 600 13.5px var(--body); }
.app-top select option { color: var(--ink); }
.app-top .tbtn { white-space: nowrap; }
@media (max-width: 520px) {
  .app-top { gap: 8px; padding: 8px 10px; }
  .app-top small { display: none; }
  .app-top select { max-width: 104px; padding: 0 6px; }
  .app-top .tbtn { padding: 0 9px; font-size: 13px; }
}
.app-main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; align-content: start; }
.app-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 8px 12px; background: var(--ink-2); position: sticky; top: 56px; z-index: 29; }
.app-nav::-webkit-scrollbar { display: none; }
.app-nav button { flex: none; min-height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted-d); font: 600 14px var(--body); display: inline-flex; align-items: center; gap: 6px; }
.app-nav button[aria-current="true"] { background: var(--paper); color: var(--ink); }
.app-nav .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font: 700 11.5px/20px var(--body); text-align: center; }
.app-nav .n:empty, .app-nav .n[data-zero] { display: none; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; box-shadow: var(--shadow-sm); }
.card h2, .card h3 { margin: 0 0 10px; font: 700 17px/1.25 var(--display); letter-spacing: -.01em; }
.card h3 { font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 860px) {
  .grid2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .grid3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; text-align: left; font: inherit; color: inherit; }
button.kpi { cursor: pointer; }
.kpi b { display: block; font: 700 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.alert { border-color: var(--red); background: #fdf0ed; }
.kpi.alert b { color: var(--red); }

.rows { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--white); text-align: left; font: inherit; color: inherit; width: 100%; }
button.row { cursor: pointer; }
button.row:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.row .t { font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.row .s { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }
.row .r { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-sm); }

.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 8px; border-radius: 99px; font: 650 11.5px/1 var(--body); letter-spacing: .02em; background: var(--paper-2); color: var(--ink); white-space: nowrap; }
.badge.ok { background: #e3f4e7; color: #1d6b31; }
.badge.warn { background: var(--amber-soft); color: var(--amber-ink); }
.badge.bad { background: #fbe3de; color: #8e2414; }
.badge.info { background: #e4edf9; color: #1d4a80; }
.badge.dark { background: var(--ink); color: var(--paper); }
.dotlive { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(63, 174, 90, .5); animation: live 1.6s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgba(63, 174, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 174, 90, 0); } }

.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font: 600 13px var(--body); color: var(--muted); }
.field input, .field select, .field textarea, .inp { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--white); font: 16px/1.3 var(--body); color: var(--ink); }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { outline: 2px solid var(--amber); outline-offset: 0; border-color: var(--amber); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.form { display: grid; gap: 12px; }
.form-2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { flex: 1 1 auto; }
.btn-red { --bg: var(--red); --fg: #fff; --bd: var(--red); }
.btn-green { --bg: var(--green); --fg: #fff; --bd: var(--green); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.kv { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 550; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.on::before { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.timeline small { display: block; color: var(--muted); font-size: 12px; }

.map { height: 280px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); }
@media (min-width: 860px) { .map.tall { height: 420px; } }
.chatlog { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 4px; }
.bub { max-width: 86%; padding: 9px 12px; border-radius: 14px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bub.user { align-self: flex-start; background: var(--white); border: 1px solid var(--line); }
.bub.assistant { align-self: flex-end; background: var(--ink); color: var(--paper); }
.bub.staff { align-self: flex-end; background: var(--wa); color: #fff; }
.bub.tool, .bub.system, .bub.staff_note { align-self: center; max-width: 100%; background: var(--paper-2); color: var(--muted); font: 12px/1.4 var(--mono); }
.bub small { display: block; opacity: .7; font-size: 11px; margin-top: 2px; }

dialog.sheet { width: min(640px, calc(100vw - 16px)); max-height: calc(100dvh - 24px); border: 0; border-radius: var(--r-lg); padding: 0; background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(10, 10, 8, .55); }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 2; }
.sheet-head b { font: 700 17px/1.2 var(--display); min-width: 0; overflow-wrap: anywhere; }
.sheet-body { padding: 16px; display: grid; gap: 14px; }
.xbtn { width: 40px; height: 40px; flex: none; border-radius: 10px; border: 1px solid var(--line-2); background: var(--white); font-size: 20px; line-height: 1; }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 100; max-width: calc(100vw - 24px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); font-weight: 600; box-shadow: var(--shadow-lg); }
.toast.bad { background: var(--red); }
.login { max-width: 420px; width: 100%; margin: 8vh auto 0; padding: 0 16px; }
.login .card { padding: 22px; }
.login h1 { font: 800 26px/1.15 var(--display); margin: 0 0 6px; letter-spacing: -.02em; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 12px; background: var(--paper-2); }
.seg button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font: 600 13.5px var(--body); }
.seg button[aria-pressed="true"] { background: var(--white); box-shadow: var(--shadow-sm); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font: 650 12px var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tbl input, .tbl select { width: 100%; min-width: 70px; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: 8px; font: 14px var(--body); background: var(--white); }
.notice { padding: 12px 14px; border-radius: var(--r-sm); background: var(--amber-soft); color: var(--amber-ink); font-size: 14px; }
.notice.bad { background: #fbe3de; color: #8e2414; }
.notice.ok { background: #e3f4e7; color: #1d6b31; }
.rec { display: inline-flex; align-items: center; gap: 8px; }
.rec.on .btn { --bg: var(--red); --fg: #fff; --bd: var(--red); animation: micpulse 1.4s infinite; }

/* Worker app: big touch targets, readable in sunlight */
.w-status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.w-status button { min-height: 52px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--white); font: 700 15px var(--body); }
.w-status button[aria-pressed="true"][data-s="AVAILABLE"] { background: var(--green); border-color: var(--green); color: #fff; }
.w-status button[aria-pressed="true"][data-s="BREAK"] { background: var(--amber); border-color: var(--amber); }
.w-status button[aria-pressed="true"][data-s="OFFLINE"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.offer { border: 2px solid var(--amber); background: var(--amber-soft); }
.offer .big { font: 800 30px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.countdown { font: 700 15px var(--mono); color: var(--red); }
.step-btn { min-height: 64px; font-size: 18px; }
.gps { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.gps i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; }
.gps.on i { background: var(--green); }

/* Worker app tabs, map and wallet */
.w-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px; border-radius: 14px; background: var(--paper-2); }
.w-tabs button { min-height: 46px; border: 0; border-radius: 10px; background: transparent; font: 700 15px var(--body); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.w-tabs button[aria-pressed="true"] { background: var(--white); box-shadow: var(--shadow-sm); }
.w-tabs .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font: 700 11.5px/20px var(--body); }
.w-tabs .n:empty, .w-tabs .n[data-zero] { display: none; }
.w-tabs .wbal { font: 600 12px var(--mono); color: var(--muted); }
.w-map { height: 62vh; min-height: 320px; }
.wallet-card { background: var(--ink); color: var(--paper); }
.wallet-card small { color: var(--muted-d); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 12px; }
.wallet-amt { font: 800 clamp(34px, 10vw, 48px)/1.1 var(--display); color: var(--amber); font-variant-numeric: tabular-nums; margin: 4px 0; }
.wallet-card .kpi { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: var(--paper); }
.wallet-card .kpi span { color: var(--muted-d); }
.wallet-card .field > span { color: var(--muted-d); }
.wallet-card .muted { color: var(--muted-d); }
.leaflet-popup-content .btn { margin-top: 6px; color: var(--fg); }

/* Tracking page */
.track-hero { background: var(--ink); color: var(--paper); border-radius: var(--r-lg); padding: 20px; }
.track-hero h1 { margin: 4px 0 6px; font: 800 clamp(24px, 6vw, 34px)/1.1 var(--display); letter-spacing: -.02em; }
.track-hero .eta { font: 800 clamp(34px, 9vw, 54px)/1 var(--display); color: var(--amber); font-variant-numeric: tabular-nums; }
.pay-box { display: grid; gap: 10px; }
.pay-box .amt { font: 800 28px/1.1 var(--display); }
.copy { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--paper-2); font-family: var(--mono); overflow-wrap: anywhere; }
.copy button { margin-left: auto; flex: none; min-height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--white); font: 600 13px var(--body); }
.stars { display: flex; gap: 6px; }
.stars button { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--white); font-size: 22px; }
.stars button[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); }
.call-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 90; display: grid; gap: 8px; padding: 10px; background: rgba(21, 20, 15, .55); backdrop-filter: blur(4px); }
.call-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; max-width: 760px; width: 100%; margin: 0 auto; padding: 14px 16px; border-radius: 16px; background: var(--white); border: 2px solid var(--green); box-shadow: var(--shadow-lg); animation: callin .4s var(--ease); }
.call-who { display: grid; gap: 2px; min-width: 0; }
.call-who b { font: 800 20px/1.2 var(--display); overflow-wrap: anywhere; }
.call-who small { color: var(--muted); }
.call-btns { display: flex; gap: 8px; flex: 1 1 260px; }
.call-btns .btn { flex: 1; min-height: 56px; font-size: 16px; }
@keyframes callin { from { transform: translateY(-20px); opacity: 0; } }
[hidden] { display: none !important; }
