/* Таймер ГРП — мобильный интерфейс мастера */
:root {
  --primary: #1B2A4A;
  --primary-soft: #EAEEF5;
  --accent: #0E7D46;
  --accent-press: #0A6237;
  --danger: #C0392B;
  --warn-bg: #FEF3E2;
  --text: #26292E;
  --muted: #7A7E87;
  --line: #E3E5EA;
  --bg: #F2F4F8;
  --card: #FFFFFF;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
.screen { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }
.screen.centered { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

/* ── вход ── */
.auth-card { background: var(--card); border-radius: 18px; padding: 26px 22px; width: 100%; box-shadow: 0 8px 30px rgba(27,42,74,.10); }
.logo { display: flex; justify-content: center; margin-bottom: 8px; }
.logo-img { width: 92px; height: auto; max-height: 110px; object-fit: contain; }
.brand-logo { height: 26px; width: auto; margin-right: 9px; vertical-align: -7px; }
.logo-mark {
  width: 64px; height: 64px; border-radius: 16px; background: var(--primary);
  color: #fff; font-weight: 800; font-size: 20px; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center;
}
.auth-title { text-align: center; margin: 0 0 14px; font-size: 22px; color: var(--primary); }
.auth-tabs {
  display: flex; background: var(--bg); border-radius: 11px; padding: 4px;
  margin-bottom: 14px; gap: 4px;
}
.auth-tab {
  flex: 1; border: none; background: transparent; border-radius: 8px;
  padding: 10px; font-size: 15px; font-weight: 600; cursor: pointer;
  color: var(--muted); font-family: inherit;
}
.auth-tab.active { background: var(--primary); color: #fff; }
.hint { color: var(--muted); margin: 6px 0 12px; font-size: 14px; }
.net-note { color: var(--muted); font-size: 12.5px; margin-top: 14px; text-align: center; }
input, textarea {
  width: 100%; padding: 14px; font-size: 17px; border: 1.5px solid var(--line);
  border-radius: 12px; margin-bottom: 12px; background: #fff; color: var(--text);
  font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); }
.code-input { text-align: center; font-size: 26px; letter-spacing: 12px; font-weight: 700; }
.error { background: #FDEDEC; color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 8px; }

/* ── кнопки ── */
.btn {
  display: block; width: 100%; border: none; border-radius: 12px;
  font-size: 17px; font-weight: 600; padding: 14px; cursor: pointer; font-family: inherit;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: #14203a; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.accent:active { background: var(--accent-press); }
.btn.accent.huge { font-size: 21px; padding: 22px; border-radius: 16px; letter-spacing: .5px; box-shadow: 0 6px 18px rgba(14,125,70,.35); }
.btn.finish { background: transparent; color: #5A5E66; font-size: 14px; padding: 10px; margin-top: 8px; border: 1.5px solid var(--line); }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--line); }
.btn.small { display: inline-block; width: auto; font-size: 13px; padding: 7px 12px; border-radius: 9px; }
.btn.big { font-size: 18px; padding: 16px; }

/* ── шапка ── */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.who b { font-size: 15px; display: block; }
.who-fleet { color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 8px; }
.badge {
  background: var(--danger); color: #fff; border-radius: 9px; font-size: 11px;
  padding: 1px 6px; margin-left: 4px; vertical-align: top;
}
.net-status { font-size: 12.5px; margin: 0 0 10px; color: var(--muted); }
.net-status.off { color: var(--danger); font-weight: 600; }

/* ── карточки ── */
.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card-title { margin: 0 0 10px; font-size: 16px; color: var(--primary); }
.lbl { display: block; font-size: 13px; color: var(--muted); margin: 4px 2px 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.wrap { margin-bottom: 12px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 20px;
  padding: 7px 14px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── список операций ── */
.op-group { margin-bottom: 12px; }
.op-group-title {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin: 12px 4px 6px; font-weight: 700;
}
.op-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-radius: 12px; padding: 15px 14px;
  margin-bottom: 7px; cursor: pointer; font-size: 16.5px;
}
.op-row:active { background: var(--primary-soft); }
.op-row .stage-badge {
  background: var(--primary-soft); color: var(--primary); font-weight: 700;
  border-radius: 8px; padding: 3px 9px; font-size: 13px; white-space: nowrap; margin-left: 10px;
}
.op-row .play { color: var(--accent); font-size: 20px; margin-left: 10px; }

/* ── таймер ── */
#s-timer { min-height: 100vh; display: flex; flex-direction: column; }
.timer-head { text-align: center; margin: 8px 0 4px; }
.timer-op { font-size: 21px; font-weight: 700; color: var(--primary); }
.timer-meta { color: var(--muted); font-size: 15px; margin-top: 3px; }
.timer-started { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.elapsed-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 0; }
.elapsed { font-size: 76px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; letter-spacing: 2px; }
.elapsed.over { color: var(--danger); }
.elapsed-sub { color: var(--muted); font-size: 15px; }
.timer-actions { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

/* ── причина ── */
.reason-head { text-align: center; margin: 20px 0 16px; }
.reason-head h2 { color: var(--danger); font-size: 20px; margin: 10px 0 4px; }
.warn-ico {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 50%;
  background: var(--warn-bg); color: var(--danger); font-size: 30px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
textarea { resize: vertical; }

/* ── шиты и модалки ── */
.sheet-wrap {
  position: fixed; inset: 0; background: rgba(20,25,35,.55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet {
  background: #fff; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}
.sheet h3 { margin: 0 0 6px; font-size: 18px; color: var(--primary); }
.check { display: flex; gap: 10px; align-items: center; font-size: 15.5px; margin: 14px 0; }
.check input { width: 22px; height: 22px; margin: 0; }

/* ── журнал ── */
.j-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.j-row:last-child { border-bottom: none; }
.j-ico { font-size: 16px; width: 24px; text-align: center; }
.j-main { flex: 1; min-width: 0; }
.j-op { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.j-sub { color: var(--muted); font-size: 12.5px; }
.j-sync { font-size: 12px; color: var(--muted); }
.j-sync.done { color: var(--accent); }
.st-ok { color: var(--accent); }
.st-over { color: var(--danger); }
.st-non { color: var(--muted); }
.foot-note { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 18px; }

/* ── тост ── */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px;
  background: var(--primary); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 15px; z-index: 90; max-width: 88vw; text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
#toast.warn { background: var(--danger); }
