:root {
  --bg: #eef3fb; --card: #fff; --text: #0f1d3a; --muted: #50607a; --line: #dde5f2;
  --brand: #2554c7; --brand-2: #e3ebfa; --stop: #c2410c; --red: #b42318; --red-2: #fde7e2; --amber: #7a4300; --amber-2: #fff0d9;
  --ok: #1d5b33; --ok-2: #e1f1e6; --violet: #4a36b8; --violet-2: #ece9fb;
  --radius: 18px;
  --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 Commissioner, -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(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 19px; font-weight: 600; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who { color: var(--muted); font-size: 14px; display: none; }
.ava { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--brand-2); color: #1c4aa8; }
.gear { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--card); color: #344563; display: grid; place-items: center; cursor: pointer; }
main { max-width: 960px; margin: 0 auto; padding: 8px 16px calc(96px + 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: 0 6px var(--safe-b); }
.tabs button { flex: 1; border: 0; background: none; padding: 9px 2px 8px; font-size: 11.5px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.tabs button.on { color: var(--brand); font-weight: 600; }
@media (min-width: 600px) { .top .who { display: inline; } }
@media (min-width: 900px) {
  .tabs { position: sticky; top: 58px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); justify-content: center; }
  .tabs button { flex: 0 0 auto; flex-direction: row; gap: 7px; padding: 12px 18px; font-size: 15px; }
  .tabs button svg { width: 18px; height: 18px; }
  main { padding: 16px 16px 32px; }
}

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(15, 29, 58, .04); }
.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: 12px; 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: 12px; 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 page: design 4 «Удерживайте» */
.c4 { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4px 0 2px; }
.c4-date { color: var(--muted); font-size: 15px; }
.c4-state { font-size: 24px; font-weight: 600; margin-top: 2px; }
.c4 > .badge { margin-top: 8px; font-size: 13.5px; padding: 4px 11px; }
.ringw { position: relative; width: 248px; height: 248px; margin: 22px 0 18px; }
.ringw > svg, .sring > svg { position: absolute; inset: 0; }
.ring-track { stroke: var(--line); }
.ring-day, .ring-hold { stroke: var(--brand); }
.stop-ring .ring-hold { stroke: var(--stop); }
.ring-dot { fill: var(--brand); }
.hold { position: absolute; left: 24px; top: 24px; width: 200px; height: 200px; border-radius: 50%; border: 0; background: var(--brand); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  box-shadow: 0 14px 34px rgba(37, 84, 199, .30); transition: transform .15s;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.hold.stop { background: var(--stop); box-shadow: 0 14px 34px rgba(194, 65, 12, .28); }
.hold.holding { transform: scale(.96); }
.hold:disabled { opacity: .8; cursor: default; }
.hold b { font-size: 21px; font-weight: 600; }
.hold b.busy { font-size: 17px; }
.hold span { font-size: 13.5px; opacity: .92; max-width: 150px; line-height: 1.3; }
.hold .tm { font-size: 36px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; opacity: 1; max-width: none; }
.c4-line { font-size: 14px; color: var(--muted); }
.c4-hint { width: 100%; }
.wk4 { margin-top: 16px; }
.wk4 .ink { color: var(--text); font-variant-numeric: tabular-nums; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.dd { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.pillv { width: 100%; height: 34px; border-radius: 10px; background: var(--brand-2); display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.pillv.done { background: var(--brand); color: #fff; }
.pillv.now { background: var(--card); box-shadow: inset 0 0 0 2px var(--brand); color: var(--brand); }
.pillv.off { background: transparent; color: #64748b; box-shadow: inset 0 0 0 1px var(--line); }
main > .input { margin-top: 2px; border: 0; padding: 13px 14px; }
/* admin: own shift + everybody's today */
.own4 { padding: 14px; }
.own-row { display: flex; align-items: center; gap: 14px; }
.own-m { min-width: 0; }
.own-m .badge { margin-top: 4px; }
.own-tm { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sring { position: relative; width: 92px; height: 92px; flex: none; }
.sbtn { position: absolute; left: 12px; top: 12px; width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--brand); color: #fff;
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: transform .15s;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.sbtn.stop { background: var(--stop); }
.sbtn.holding { transform: scale(.94); }
.own4 .input { margin-top: 10px; }
.seg { display: flex; gap: 6px; margin: 4px 0 10px; }
.seg button { flex: 1; height: 40px; border-radius: 12px; border: 0; background: var(--card); font-size: 14px; font-weight: 500; color: #344563; cursor: pointer; }
.seg button.sel { background: var(--text); color: #fff; }
.ls4 { padding: 4px 14px; }
.li4 { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #edf1f8; }
.li4:first-child { border-top: 0; }
.li4.click { cursor: pointer; }
.li4 .m { flex: 1; min-width: 0; }
.li4 .n { font-weight: 600; font-size: 15px; }
.li4 .s { font-size: 13px; color: var(--muted); }
.tg { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
.t-red { background: var(--red-2); color: #9a2a0a; }
.t-amb { background: var(--amber-2); color: var(--amber); }
.t-ok { background: var(--ok-2); color: var(--ok); }
.t-vio { background: var(--violet-2); color: var(--violet); }
.t-mute { background: #eef1f5; color: #475569; }
.btn.dark { background: var(--text); border-color: var(--text); color: #fff; }
.foot4 { font-size: 13px; color: var(--muted); margin: 2px 4px 12px; line-height: 1.45; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-2); color: var(--ok); }
.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; }
.join { text-align: center; margin-bottom: 14px; line-height: 1.4; }
.join p { margin: 0 0 10px; }
.linkish { display: block; margin: 16px auto 0; padding: 6px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.sendme { white-space: pre-wrap; word-break: break-word; user-select: all; font: inherit; font-size: 14px; }
.code-now { font-size: 20px; letter-spacing: 2px; color: var(--brand); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.meter { height: 8px; border-radius: 99px; background: var(--line); margin-top: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.month { text-transform: capitalize; }
.list li.today { background: var(--brand-2); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.week-row { display: grid; grid-template-columns: 58px 1fr 1fr; gap: 6px; align-items: center; margin-bottom: 8px; }
.week-row label { flex-wrap: nowrap; gap: 6px; }
.week-row .input { padding-left: 6px; padding-right: 4px; min-width: 0; }
.week-row .input:disabled { opacity: .4; }
.phone-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }

/* 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; }
