/* Admin dashboard (desktop). Builds on styles.css. */
body.admin { font-size: 15px; }
.admin .bar { gap: 20px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { background: transparent; color: #dfe9e2; border: 0; font: inherit; font-weight: 700; padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: rgba(255,255,255,.16); color: #fff; }
a.chip { text-decoration: none; display: inline-flex; align-items: center; }

.wide { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.toolbar label { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.toolbar input, .toolbar select { padding: 8px 10px; font-size: 15px; border-radius: 8px; }
.toolbar .grow, .dlg-actions .grow { flex: 1; min-width: 200px; }
.dlg-actions .grow { min-width: 0; }
select { width: 100%; font: inherit; font-size: 16px; padding: 11px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.btn.small { padding: 9px 14px; font-size: 15px; }
.btn.danger { border-color: var(--red); color: var(--red); }

.totals { display: flex; gap: 22px; flex-wrap: wrap; margin: 4px 2px 10px; color: var(--muted); font-size: 14px; }
.totals b { color: var(--ink); font-size: 18px; }

.tablewrap { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.06); overflow: auto; max-height: calc(100vh - 210px); }
table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
.grid th { position: sticky; top: 0; background: #ece9df; text-align: left; padding: 9px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; cursor: default; z-index: 1; }
.grid th[data-sort] { cursor: pointer; }
.grid th.sorted::after { content: ' ▾'; }
.grid th.sorted.asc::after { content: ' ▴'; }
.grid td { padding: 8px 10px; border-top: 1px solid #eeebe2; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.grid tr:hover td { background: #f7f5ef; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .warn { color: var(--red); font-weight: 700; }
.grid a { color: var(--green-2); }
.linkbtn { background: none; border: 0; color: var(--green-2); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.task { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.06); display: flex; flex-direction: column; gap: 8px; }
.task h3 { margin: 0; font-size: 17px; }
.task .sub { color: var(--muted); font-size: 14px; }
.task .who { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: #eef4ef; color: var(--green); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; }
.progress { height: 10px; background: #ece9df; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green-2); }
.task .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task .row .grow { flex: 1; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(820px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20,30,24,.45); }
dialog form { padding: 20px 22px; }
dialog h2 { margin: 0 0 14px; font-size: 20px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; padding: 7px 12px; border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none; }
.checks label:has(input:checked) { background: #e3efe6; border-color: var(--green-2); color: var(--green); }
.checks input[type=checkbox] { -webkit-appearance: checkbox; appearance: auto; width: 18px; height: 18px; padding: 0; margin: 0; accent-color: var(--green-2); cursor: pointer; }
.checks.bad { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 8px; }
.dlg-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.meta { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.hint.left { text-align: left; margin: 4px 0 8px; }
.grid td.muted { color: var(--muted); }

/* Places */
.places-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; height: calc(100vh - 100px); }
.places-side { overflow: auto; padding-right: 4px; }
.places-side h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 2px 8px; }
.places-side .count { background: #ece9df; border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }
.hint.small { font-size: 13px; margin: -4px 2px 8px; }
.place-form { margin-top: 12px; padding: 14px; }
.place-form h3 { margin: 0 0 10px; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 16px; }
.plist { display: flex; flex-direction: column; gap: 6px; }
.pitem { background: var(--card); border-radius: 10px; padding: 9px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); font-size: 14px; }
.pitem.click { cursor: pointer; }
.pitem.click:hover, .pitem.sel { outline: 2px solid var(--green-2); }
.pitem .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.pitem .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pitem .acts { display: flex; gap: 6px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.pitem .acts select { width: auto; flex: 1; min-width: 120px; padding: 6px 8px; font-size: 13px; }
.pitem .acts .btn { padding: 6px 10px; font-size: 13px; }
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.map { width: 100%; height: 100%; min-height: 420px; background: #dfe3d8; }
.map-hint { position: absolute; z-index: 500; top: 10px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.pin-label { background: var(--green); color: #fff; border: 2px solid #fff; border-radius: 999px; padding: 2px 9px; font-weight: 700; font-size: 12px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.35); transform: translate(-50%, -50%); display: inline-block; }
.pin-label.sel { background: var(--wheat); color: #3a2c00; }
.task .route { font-size: 14px; font-weight: 700; color: var(--green-2); text-decoration: none; }

/* Today dashboard */
.day-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.day-bar input[type=date] { width: auto; padding: 8px 10px; font-size: 15px; }
.day-bar h1 { margin: 0 0 0 10px; font-size: 22px; }
.day-bar .grow { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.kpi b { display: block; font-size: 28px; line-height: 1.1; color: var(--green); }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi.warn b { color: var(--red); }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.dash h2 { margin: 6px 2px 10px; }
.dash-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.dcard { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.dcard.overdue { border-left: 5px solid var(--red); border-radius: 0 var(--radius) var(--radius) 0; }
.dcard .head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dcard .head h3 { margin: 0; font-size: 17px; }
.dcard .head .grow { flex: 1; }
.dcard .stat { font-weight: 700; color: var(--green); white-space: nowrap; }
.dcard .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.dcard .progress { margin: 10px 0 4px; }
.flag { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.flag.red { background: #fbeaea; color: var(--red); }
.flag.amber { background: #fff1c7; color: #7a5a00; }
.flag.green { background: #e3f1e5; color: var(--ok); }
.flag.gray { background: #ece9df; color: var(--muted); }
table.mini { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.mini th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid #eeebe2; }
.mini td { padding: 6px; border-bottom: 1px solid #f2f0e9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.mini tr.click { cursor: pointer; }
.mini tr.click:hover td { background: #f7f5ef; }
.mini .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini .warn { color: var(--red); font-weight: 700; }
.mini .muted { color: var(--muted); }
.panel { background: var(--card); border-radius: var(--radius); padding: 10px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 18px; }
.panel .empty { color: var(--muted); font-size: 14px; padding: 4px 0; }
.idle { color: var(--muted); font-size: 14px; margin: -8px 2px 18px; }
@media (max-width: 1000px) { .dash { grid-template-columns: 1fr; } }

/* Setup menu + Drivers */
.setup { position: relative; }
#setupBtn.on { background: #fff; color: var(--green); }
.setup-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 6px; min-width: 260px; z-index: 1000; }
.setup-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; }
.setup-menu button:hover, .setup-menu button.on { background: #eef4ef; }
.setup-menu button span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.setup-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.setup-title h1 { margin: 0; font-size: 22px; }
.setup-title .crumb { color: var(--muted); font-weight: 600; }
.setup-title .grow { flex: 1; }
label.inline { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
label.inline input { width: auto; -webkit-appearance: checkbox; appearance: auto; accent-color: var(--green-2); }
.places-grid { height: calc(100vh - 140px); }
.pinrow { display: flex; gap: 6px; }
.pinrow input { flex: 1; }
.grid tr.inactive td { color: var(--muted); }
.pin-mask { font-family: ui-monospace, Menlo, monospace; letter-spacing: .08em; }
.grid td .linkbtn + .linkbtn { margin-left: 16px; }
.pin-mask + .linkbtn { margin-left: 8px; }

/* Diesel price */
.diesel-today { display: flex; gap: 12px; margin: 10px 0 14px; flex-wrap: wrap; }
.diesel-today .kpi { min-width: 180px; }
.diesel-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.diesel-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.diesel-form label.grow { flex: 1; min-width: 200px; }
