/* app.css — единый стиль PWA, mobile-first, высокий контраст, кнопки ≥48px. */
:root {
  --bg: #0d1117; --surface: #161b22; --surface2: #1c2330; --line: #30363d;
  --text: #e6edf3; --muted: #9aa7b4; --primary: #1f6feb; --primary-d: #1858c4;
  --danger: #da3633; --ok: #2ea043; --warn: #d29922; --pii: #ffd166;
  --radius: 12px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fa; --surface: #ffffff; --surface2: #f0f3f6; --line: #d0d7de;
    --text: #1f2328; --muted: #57606a; --primary: #1f6feb; --primary-d: #1858c4;
    --danger: #cf222e; --ok: #1a7f37; --warn: #9a6700; --pii: #b58900;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }

.screen { max-width: 640px; margin: 0 auto; padding: 12px 14px 90px; }
.screen.center { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding-top: 40px; text-align: center; }
.brand { font-size: 26px; margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); }

h2, h3 { margin: 14px 0 8px; }
.section { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 18px; }

/* Кнопки */
.btn, .btn-sm, .btn-icon, .tab, .menu-item {
  font: inherit; border: 1px solid var(--line); background: var(--surface2); color: var(--text);
  border-radius: var(--radius); padding: 12px 16px; cursor: pointer; min-height: 48px;
}
.btn-sm { min-height: 40px; padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn.big, .big { min-height: 56px; font-size: 17px; font-weight: 600; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-d); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.disabled, .disabled { opacity: .5; }
.btn-icon { min-width: 44px; padding: 8px 10px; font-size: 20px; background: transparent; border: none; }
.grow { flex: 1; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.sticky-bottom { position: sticky; bottom: 10px; margin-top: 14px; }

/* Топбар */
.topbar { display: flex; align-items: center; gap: 8px; padding: 6px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.topbar-title { font-weight: 600; font-size: 18px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.queue-badge { background: var(--warn); color: #000; border-radius: 20px; padding: 4px 10px; font-size: 13px; font-weight: 600; }

/* Карточки / списки */
.list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card.tappable { cursor: pointer; }
.card.tappable:active { background: var(--surface2); }
.card-title { font-weight: 600; margin-bottom: 4px; }
.card-sub { font-size: 13px; }
.card-status { margin-top: 6px; }
.card.blocked { border-color: var(--warn); }
.card.basis.main { border-color: var(--ok); }
.basis-quote { font-style: italic; margin: 6px 0; color: var(--text); }
.formatted { margin-top: 6px; }

/* Бейджи статусов */
.badge { display: inline-block; padding: 3px 9px; border-radius: 14px; font-size: 13px; background: var(--surface2); border: 1px solid var(--line); }
.badge-matched, .badge-confirmed, .badge-ready { color: var(--ok); border-color: var(--ok); }
.badge-needs_review { color: var(--warn); border-color: var(--warn); }
.badge-error { color: var(--danger); border-color: var(--danger); }
.badge-needs_pii { color: var(--pii); border-color: var(--pii); }

/* Формы */
.input, .textarea, select.input { width: 100%; font: inherit; padding: 12px; min-height: 48px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
.textarea { min-height: 96px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field-label { font-size: 13px; color: var(--muted); }
.form { padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.days { max-width: 120px; }
.days.hidden, .hidden { display: none; }

/* Реквизиты (details) */
.req { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; margin-bottom: 12px; }
.req summary { cursor: pointer; padding: 8px 0; font-weight: 500; }
.req-warn { color: var(--warn); font-size: 13px; }
.req-line { font-size: 18px; font-weight: 600; margin-bottom: 10px; }

/* Гейт ПДн */
.warn-box { background: rgba(210,153,34,.12); border: 1px solid var(--warn); border-radius: 10px; padding: 10px 12px; }
.anon-box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 17px; margin: 10px 0; }
mark.pii { background: var(--pii); color: #000; border-radius: 4px; padding: 0 3px; }

/* Запись */
.timer { font-size: 44px; font-variant-numeric: tabular-nums; font-weight: 700; margin: 10px 0; }
.record-bar { display: flex; gap: 10px; }
.preview-audio { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.player { width: 100%; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--primary); border-radius: 50%; margin: 20px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ok-mark { font-size: 60px; color: var(--ok); }

/* Тосты */
.toast-host { position: fixed; left: 0; right: 0; bottom: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: #000; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; max-width: 90%; opacity: .96; transition: opacity .3s; }
.toast-ok { background: var(--ok); } .toast-err { background: var(--danger); } .toast-info { background: #333; }
.toast-out { opacity: 0; }

/* Баннеры */
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.update-host { position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 60; }

/* Меню */
.menu-sheet { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 70; display: flex; align-items: flex-end; }
.menu-box { background: var(--surface); width: 100%; border-radius: 16px 16px 0 0; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.menu-item { text-align: left; background: transparent; border: none; border-bottom: 1px solid var(--line); }

/* Модальный ввод (замена window.prompt: на телефоне и во встроенных браузерах) */
.modal-sheet { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.modal-box { background: var(--surface); width: 100%; max-width: 640px; border-radius: 16px 16px 0 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.modal-title { margin: 0; font-size: 18px; }
@media (min-width: 700px) { .modal-sheet { align-items: center; } .modal-box { border-radius: 16px; } }

/* Карточка готового акта в списке */
.act-card .card-title.tappable { cursor: pointer; }
.act-card .row { margin-top: 8px; }

/* Руководитель */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.tab { flex: 0 0 auto; background: transparent; border-bottom: 2px solid transparent; border-radius: 0; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.invite-out, .manual, .due-resp { margin-top: 12px; }
.code { word-break: break-all; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-family: monospace; margin-bottom: 8px; }
.selfcheck { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12px; }
/* Самопроверка: список проблем вместо сырого JSON */
.selfcheck-list { margin: 8px 0 12px; padding-left: 22px; }
.selfcheck-list li { margin-bottom: 6px; color: var(--warn); }
.ok-text { color: var(--ok); }
.quote-src { background: var(--surface2); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
