:root {
  --bg: #f4f6f5; --card: #fff; --text: #1d2523; --muted: #6b7774; --line: #e3e8e6;
  --brand: #1f6f5c; --brand-2: #e7f2ef; --red: #c4453a; --red-2: #fbeceb; --amber: #b7791f; --amber-2: #fdf3e2;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.splash { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* layout */
.top { position: sticky; top: 0; z-index: 500; background: var(--card); border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; display: flex; align-items: center; gap: 12px; }
.top h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who { color: var(--muted); font-size: 14px; }
main { max-width: 960px; margin: 0 auto; padding: 16px 16px calc(90px + var(--safe-b)); }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 600; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b); }
.tabs button { flex: 1; border: 0; background: none; padding: 9px 2px 8px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.tabs button .ic { font-size: 20px; line-height: 1; }
.tabs button.on { color: var(--brand); font-weight: 600; }
@media (min-width: 900px) {
  .tabs { position: sticky; top: 57px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); justify-content: center; }
  .tabs button { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 12px 18px; font-size: 15px; }
  .tabs button .ic { font-size: 16px; }
  main { padding-bottom: 32px; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 16px; margin: 0 0 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; }

/* controls */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small { padding: 5px 10px; font-size: 14px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
textarea.input { resize: vertical; min-height: 44px; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }

/* login */
.login { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.login .logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 14px; }
.login h1 { text-align: center; font-size: 22px; margin: 0 0 20px; }
.err { color: var(--red); min-height: 22px; font-size: 14px; }

/* the shift button */
.clock { text-align: center; padding: 22px 16px 18px; }
.clock .state { font-size: 15px; color: var(--muted); }
.clock .timer { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0 2px; letter-spacing: 1px; }
.big { width: 210px; height: 210px; border-radius: 50%; border: 0; margin: 18px auto 14px; display: grid; place-items: center;
  font-size: 21px; font-weight: 700; color: #fff; cursor: pointer; background: var(--brand);
  box-shadow: 0 10px 30px rgba(31, 111, 92, .35); transition: transform .1s; -webkit-tap-highlight-color: transparent; }
.big:active { transform: scale(.97); }
.big.stop { background: var(--red); box-shadow: 0 10px 30px rgba(196, 69, 58, .35); }
.big:disabled { opacity: .7; }
.big small { display: block; font-size: 14px; font-weight: 500; opacity: .9; margin-top: 4px; }
.where { font-size: 14px; margin-top: 6px; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--brand-2); color: var(--brand); }
.b-far { background: var(--red-2); color: var(--red); }
.b-nogps, .b-noplace, .b-manual { background: var(--amber-2); color: var(--amber); }
.b-live { background: var(--brand); color: #fff; }
.b-phone { background: var(--red-2); color: var(--red); white-space: normal; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 11px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list li:first-child { border-top: 0; }
.list .main { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.list .num { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.list li.click { cursor: pointer; }
.total { display: flex; justify-content: space-between; font-weight: 700; padding-top: 10px; border-top: 2px solid var(--line); margin-top: 4px; }

/* tables (desktop) */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fafcfb; }

/* map */
.map { height: 340px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.map.tall { height: 420px; }
.leaflet-container { font: inherit; }
.pin { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.pin.far { background: var(--red); }
.pin.nogps { background: var(--amber); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b)); }
@media (min-width: 600px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.modal .actions .left { margin-right: auto; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); z-index: 2000;
  background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); }

.hint { background: var(--amber-2); color: #6d4a12; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; text-align: left; }
.install { background: var(--brand-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }
.install .grow { line-height: 1.35; }
