/* QM Cloud — один стиль для телефона и компьютера. Цвета как в макетах (docs/mockups/mockup.css).
   Телефон: шрифт от 16–18 px, кнопки от 48 px (v0.6.5). Без внешних шрифтов и скриптов. */
:root {
  --ground: #f6f8f7; --paper: #fff; --ink: #16221f; --ink-soft: #5a6b66; --ink-faint: #8a9995;
  --line: #dfe5e3; --line-soft: #eef2f1; --accent: #0f5c55; --accent-soft: #e7f1ef;
  --warn: #8a5a1a; --warn-soft: #fdf5e7; --warn-line: #efdcb8; --bad: #a12c2c; --bad-soft: #fbeaea; --bad-line: #f0caca;
  --ok: #1d6b3a; --ok-soft: #e8f4ec; --mark: #fff3b0; --radius: 12px;
}
* { box-sizing: border-box; }
/* Атрибут hidden сильнее любых display: иначе окна (.sheet-bg — flex) видны все сразу и «Abbrechen» не закрывает */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 24px; line-height: 1.25; margin: 6px 0 10px; }
h2 { font-size: 19px; margin: 18px 0 8px; }
h3 { font-size: 17px; margin: 14px 0 6px; }
p { margin: 8px 0; }
.muted { color: var(--ink-soft); font-size: 15px; }
.small { font-size: 14px; }
.red { color: var(--bad); }
.warn-t { color: var(--warn); }
mark { background: var(--mark); padding: 0 2px; border-radius: 3px; }

/* Каркас: телефон — одна колонка; компьютер — меню слева/сверху для PDL */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--paper); display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft); font-size: 15px; color: var(--ink-soft); position: sticky; top: 0;
  background: var(--paper); z-index: 5; min-height: 52px; }
.bar a.back { font-weight: 600; font-size: 16px; }
.bar .who { display: flex; align-items: center; gap: 8px; }
.logo { display: inline-flex; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff;
  font-weight: 700; font-size: 13px; align-items: center; justify-content: center; }
main { flex: 1; padding: 16px 16px 32px; }
.foot { position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--line-soft); padding: 12px 16px; }
.nav { display: none; }

@media (min-width: 900px) {
  body.wide .app { max-width: none; flex-direction: row; background: var(--ground); }
  body.wide .nav { display: flex; flex-direction: column; width: 230px; flex: 0 0 230px; background: var(--paper);
    border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
  body.wide .nav .brand { display: flex; gap: 10px; align-items: center; font-weight: 700; margin: 0 6px 18px; }
  body.wide .nav a { padding: 10px 12px; border-radius: 8px; color: var(--ink); font-size: 16px; }
  body.wide .nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  body.wide .nav .grow { flex: 1; }
  body.wide .content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  body.wide .bar { background: var(--ground); border-bottom: 0; padding: 18px 32px 0; }
  body.wide main { padding: 8px 32px 40px; max-width: 1100px; width: 100%; }
  /* Кнопки действий на компьютере — наверху, справа под шапкой: список может быть длинным (Ганна, 20.11) */
  body.wide .bar { order: -2; }
  body.wide .foot { order: -1; position: static; background: none; border: 0; padding: 10px 32px 0; max-width: 1100px;
    width: 100%; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
  body.wide .foot .btns-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin: 0; }
  body.wide .foot > *, body.wide .foot .btns-row > * { flex: 0 0 auto; margin: 0 !important; }
  body.wide .foot .btn { width: auto !important; padding: 11px 22px; min-height: 46px; }
  body.wide .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  body.wide .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
  body.wide .only-phone { display: none; }
}
@media (max-width: 899px) { .only-web { display: none !important; } }

/* Кнопки */
.btn { display: block; width: 100%; text-align: center; padding: 13px 14px; min-height: 50px; border-radius: var(--radius);
  border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: 600; font-size: 17px;
  cursor: pointer; font-family: inherit; }
.btn.ghost { background: var(--paper); color: var(--accent); }
.btn.danger { background: var(--paper); color: var(--bad); border-color: var(--bad-line); }
.btn.off, .btn:disabled { background: var(--line-soft); border-color: var(--line); color: var(--ink-faint); cursor: default; }
.btn + .btn, .btn + form, form + .btn, form + form { margin-top: 10px; }
.btns-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btns-row .btn { width: auto; flex: 1 1 160px; margin: 0; }
.link { font-weight: 600; display: inline-block; padding: 6px 0; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 0; }

/* Блоки */
.label { font-size: 13px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; margin: 20px 0 8px; }
.card { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0;
  background: var(--paper); color: var(--ink); }
a.card:active { background: var(--line-soft); }
.card b { display: block; font-size: 17px; }
.card .sub { color: var(--ink-soft); font-size: 15px; }
.card.warn { background: var(--warn-soft); border-color: var(--warn-line); border-left: 4px solid #c98a2b; }
.card.bad { background: var(--bad-soft); border-color: var(--bad-line); border-left: 4px solid var(--bad); }
.card.ok { background: var(--ok-soft); border-color: #cfe5d6; }
.card .due { font-size: 14px; font-weight: 600; }
.card.warn .due { color: var(--warn); } .card.bad .due { color: var(--bad); }
.notice { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.notice.info { background: var(--accent-soft); border-color: #cde3df; }
.notice.bad { background: var(--bad-soft); border-color: var(--bad-line); }
.notice.ok { background: var(--ok-soft); border-color: #cfe5d6; }

/* Списки: одна строка на документ, статус словом справа (v0.45) */
.list { border-top: 1px solid var(--line-soft); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 2px;
  border-bottom: 1px solid var(--line-soft); color: var(--ink); min-height: 52px; }
.row .t { flex: 1; min-width: 0; }
.row .t small { display: block; color: var(--ink-soft); font-size: 14px; }
.row .chev { color: var(--ink-faint); }
.st { font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.st-entwurf { background: #eef0fb; color: #3b4aa0; }
.st-neu, .st-update { background: var(--warn-soft); color: var(--warn); }
.st-abgelaufen { background: var(--bad-soft); color: var(--bad); }
.st-gueltig { background: var(--ok-soft); color: var(--ok); }
.st-unterweisung { background: var(--accent-soft); color: var(--accent); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); margin-right: 8px; }

/* Прогресс Unterweisung */
.prog { height: 6px; border-radius: 3px; background: var(--line-soft); display: flex; overflow: hidden; margin-top: 6px; }
.prog i { display: block; background: var(--accent); } .prog i.o { background: var(--bad); }

/* Поиск */
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 6px 4px 12px; background: var(--paper); }
.search input { border: 0; flex: 1; font: inherit; padding: 9px 0; outline: none; background: none; min-width: 0; }
.search button { border: 0; background: none; font-size: 20px; padding: 6px; cursor: pointer; color: var(--ink-soft); }
.search button[data-mic] { min-width: 44px; min-height: 44px; border-radius: 50%; }
/* Микрофон слушает: красный круг пульсирует, поле подсвечено — видно, что можно говорить */
.search button[data-mic].listening { background: var(--bad); color: #fff; animation: qm-pulse 1.2s ease-in-out infinite; }
.search:has(.listening) { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
@keyframes qm-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(161,44,44,.45); } 50% { box-shadow: 0 0 0 8px rgba(161,44,44,0); } }
.hint { font-size: 13px; color: var(--ink-faint); margin: 6px 2px; }

/* Документ */
.doc h1 { margin-bottom: 4px; }
.doc .meta { color: var(--ink-soft); font-size: 15px; margin-bottom: 12px; }
.wichtig { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.wichtig ol { margin: 6px 0; padding-left: 22px; } .wichtig li { margin: 4px 0; }
details.sec { border-bottom: 1px solid var(--line-soft); }
details.sec > summary { list-style: none; padding: 13px 2px; font-weight: 600; cursor: pointer; display: flex;
  justify-content: space-between; gap: 8px; align-items: center; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "›"; color: var(--ink-faint); transform: rotate(0); transition: .15s; font-size: 20px; }
details.sec[open] > summary::after { transform: rotate(90deg); }
details.sec.neu > summary { color: var(--accent); }
.sec-body { padding: 0 2px 14px; font-size: 16px; }
.sec-body table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0; display: block; overflow-x: auto; }
.sec-body th, .sec-body td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.sec-body th { background: var(--line-soft); }
.sec-body li { margin: 4px 0; }
.neu-pill { font-size: 12px; font-weight: 700; color: var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 1px 8px; }
.video { height: 180px; border-radius: var(--radius); background: var(--ink); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 15px; margin: 8px 0 12px; }
.lang { display: flex; gap: 6px; } .lang a, .lang span { font-size: 13px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); }
.lang .on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Вопросы */
.opt { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin: 10px 0; cursor: pointer; background: var(--paper); font-size: 17px; }
.opt input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 22px; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.dim { color: var(--ink-faint); }

/* PIN */
.pin { font-size: 28px; letter-spacing: 12px; text-align: center; width: 100%; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); font-family: ui-monospace, Menlo, monospace; }
.field { display: block; margin: 12px 0; } .field span { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); }
.qr img, .qr svg { width: 220px; height: 220px; display: block; margin: 8px auto; }

/* Таблицы PDL */
table.t { border-collapse: collapse; width: 100%; font-size: 15px; background: var(--paper); }
table.t th, table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
table.t th { font-size: 13px; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.scroll-x { overflow-x: auto; }
.matrix td.c { text-align: center; color: var(--accent); font-weight: 700; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 6px 0 14px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-soft); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.month { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--paper); min-height: 96px; }
.month.now { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.month small { color: var(--ink-soft); font-weight: 700; text-transform: uppercase; font-size: 12px; }

/* Редактор (веб): разделы, ✎ правка прямо в тексте */
.ed-sec { border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; background: var(--paper); }
.ed-sec > h3 { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 16px; display: flex; justify-content: space-between; }
.ed-body { padding: 10px 14px; min-height: 60px; outline: none; font-size: 16px; }
.ed-body:focus { box-shadow: 0 0 0 2px var(--accent) inset; border-radius: 0 0 var(--radius) var(--radius); }
.ed-tools { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; top: 0; background: var(--ground); padding: 8px 0; z-index: 4; }
.ed-tools button { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 15px; cursor: pointer; }

/* Окно (диалог) */
.sheet-bg { position: fixed; inset: 0; background: rgba(22,34,31,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 20px 18px 24px; max-height: 90vh; overflow: auto; }
@media (min-width: 900px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }

.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi { flex: 1 1 140px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--paper); }
.kpi b { font-size: 24px; display: block; }
.steps { padding-left: 22px; } .steps li { margin: 6px 0; }
.center { text-align: center; }
.big-ok { font-size: 56px; text-align: center; color: var(--ok); margin: 10px 0 0; }
.msg { margin: 0 0 12px; }
@media print { .bar, .nav, .foot, .no-print { display: none !important; } .app { max-width: none; } }
