/* Планшет согласий BASE — стили.
 * Дизайн: тёмный фон, фирменный оранжевый акцент, крупные элементы (планшет Xiaomi Pad 2).
 * Все кнопки ≥ 80px — комфортно палец, без промахов.
 */

:root {
  --bg: #0b0b0b;
  --surface: #1a1a1a;
  --surface-2: #262626;
  --border: #333;
  --text: #fff;
  --text-dim: #aaa;
  --muted: #666;
  --accent: #ff4d2d;
  --accent-dim: #c23a20;
  --ok: #22c55e;
  --err: #ef4444;
  --radius: 16px;
  --radius-lg: 24px;
  --pad: 24px;
  --h-btn: 88px;
  transition: background-color 600ms ease, color 600ms ease;
}

/* Светлая тема — 09:00–18:00 (или если пользователь/система просит light) */
:root.theme--light {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --surface-2: #e7e5e4;
  --border: #d6d3d1;
  --text: #0a0a0a;
  --text-dim: #57534e;
  --muted: #a8a29e;
  --accent: #ea580c;
  --accent-dim: #c2410c;
}

html, body {
  transition: background-color 600ms ease, color 600ms ease;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro", "Helvetica Neue", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Бренд-шапка ===== */
.brand {
  padding: 20px 24px 8px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.brand__logo {
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 4px;
}
.brand__branch {
  color: var(--text-dim);
  font-size: 16px;
  letter-spacing: 1px;
}
.net {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.2px;
}
.net__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}
.net__dot--offline {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}
.net__queue {
  color: #f59e0b;
}

/* ===== Общий экран ===== */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--pad);
  gap: 24px;
}
.screen__title {
  font-size: 42px;
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
}
.screen__subtitle {
  color: var(--text-dim);
  font-size: 22px;
  margin: 0;
  line-height: 1.4;
}

/* ===== Кнопки ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--h-btn);
  padding: 0 32px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, transform .06s;
  font-family: inherit;
}
.btn:active { transform: scale(.98); background: var(--accent-dim); }
.btn:disabled { opacity: .35; cursor: not-allowed; background: var(--surface-2); color: var(--muted); }
.btn--secondary {
  background: var(--surface-2);
  color: var(--text);
}
.btn--secondary:active { background: var(--border); }
.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn--wide { width: 100%; }

/* ===== SPLASH ===== */
.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.splash__logo {
  font-size: 120px;
  font-weight: 900;
  letter-spacing: 12px;
}
.splash__hint {
  color: var(--text-dim);
  font-size: 22px;
}

/* ===== PHONE KEYPAD (Экран 1) ===== */
.phone-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.phone-display {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 28px 40px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  min-width: 520px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.phone-display--placeholder { color: var(--muted); }
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 140px);
  gap: 14px;
  margin-top: 8px;
}
.keypad__key {
  height: 100px;
  font-size: 40px;
  border-radius: var(--radius);
  background: var(--surface);
  border: none;
  color: var(--text);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .1s, transform .06s;
}
.keypad__key:active { background: var(--surface-2); transform: scale(.97); }
.keypad__key--action {
  background: var(--surface-2);
  font-size: 26px;
}
.keypad__key--action:active { background: var(--border); }
.keypad__row {
  display: contents;
}

/* ===== ПРИВЕТСТВИЕ (Экран 2) ===== */
.greet {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  align-items: center;
  text-align: center;
}
.greet__hello {
  font-size: 36px;
  color: var(--text-dim);
}
.greet__name {
  font-size: 72px;
  font-weight: 800;
  line-height: 1.1;
  max-width: 900px;
}
.greet__not-found {
  font-size: 40px;
  color: var(--accent);
  font-weight: 700;
}
.greet__not-found--alert {
  color: var(--err);
  animation: alertPulse 1.6s ease-in-out infinite;
}
@keyframes alertPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.85; }
}
.fio-hint {
  margin-top: 4px;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  width: fit-content;
}
.fio-hint:active {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}
.greet__hint {
  color: var(--text-dim);
  font-size: 22px;
  max-width: 700px;
  line-height: 1.4;
}

/* ===== ДОЗАПОЛНЕНИЕ ФИО (Экран 2а) ===== */
.fio-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}
.fio-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fio-label {
  color: var(--text-dim);
  font-size: 20px;
}
.fio-input {
  font-size: 32px;
  padding: 20px 24px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  -webkit-user-select: text;
  user-select: text;
}
.fio-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== СОГЛАСИЯ (Экран 3) ===== */
.consent-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s;
  border: 2px solid transparent;
}
.consent-item:active { background: var(--surface-2); }
.consent-item--checked { border-color: var(--accent); }
.consent-item--required::after {
  content: "обязательно";
  color: var(--accent);
  font-size: 14px;
  position: absolute;
}
.consent-check {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 3px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  transition: all .12s;
}
.consent-item--checked .consent-check {
  background: var(--accent);
  border-color: var(--accent);
}
.consent-check__tick {
  display: none;
  width: 24px;
  height: 24px;
  color: #fff;
}
.consent-item--checked .consent-check__tick { display: block; }
.consent-text {
  flex: 1;
  font-size: 22px;
  line-height: 1.45;
}
.consent-text strong {
  color: var(--accent);
  font-weight: 600;
}
.consent-text a {
  color: var(--accent);
  text-decoration: underline;
}
.microdecl {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.5;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 4px;
}

/* ===== МОДАЛКА ПДН ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1100px;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal__head {
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.modal__title {
  font-size: 24px;
  font-weight: 700;
}
.modal__body {
  flex: 1;
  overflow: hidden;
}
.modal__body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* ===== SIGNATURE PAD (Экран 4) ===== */
.sign-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}
.sign-canvas-wrap {
  width: 100%;
  max-width: 960px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 0 0 2px var(--border);
  position: relative;
  overflow: hidden;
}
.sign-canvas {
  display: block;
  width: 100%;
  height: 320px;
  touch-action: none;
  cursor: crosshair;
}
.sign-canvas-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 28px;
  pointer-events: none;
  font-style: italic;
}
.sign-canvas-hint--hidden { display: none; }
.sign-actions {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 960px;
}
.sign-actions .btn { flex: 1; }

/* ===== ГОТОВО (Экран 5) ===== */
.done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}
.done__check {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--ok);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 100px;
  color: #fff;
  animation: pop .4s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.done__title {
  font-size: 48px;
  font-weight: 700;
}
.done__timer {
  color: var(--text-dim);
  font-size: 22px;
}

/* ===== ОШИБКИ ===== */
.error-banner {
  padding: 16px 20px;
  background: rgba(239, 68, 68, 0.15);
  border-left: 4px solid var(--err);
  border-radius: 8px;
  color: var(--text);
  font-size: 20px;
}

/* ===== ФУТЕР С КНОПКАМИ ===== */
.actions {
  display: flex;
  gap: 16px;
  margin-top: auto;
  padding-top: 16px;
}
.actions .btn { flex: 1; }
