:root {
  --brand: #e3001f; /* красный логотипа ЕМ САМ */
  --bg: #f4f4f1; --card: #fff; --text: #1d1d1b; --muted: #6b6b66; --line: #ddd;
  --primary: #1d1d1b; --danger: #b3001a; --ok: #1e7a3c;
  --raw: #e3eefc; --raw-b: #2f6fd0; --pf: #fde9d9; --pf-b: #d06a1c; --bar: #e2f3e6; --bar-b: #2e8a4a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* иначе .card { display: block } его перебивает */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 12px 14px 80px; }
a { color: var(--primary); }
h1 { font-size: 1.4em; margin: .4em 0; } h2 { font-size: 1.1em; margin: 1.2em 0 .4em; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 5; }
.top a, .top .link { color: #fff; }
.top nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: .9em; }
.top form { margin: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700;
  text-decoration: none; font-size: 1.1em; }
.brand img { width: 36px; height: 36px; border-radius: 8px; border: 2px solid #fff; }
.login-logo { display: block; width: 96px; height: 96px; margin: 0 auto 8px; border-radius: 18px; }
.who { opacity: .75; }
@media (max-width: 480px) { .who { display: none; } .top nav { gap: 10px; font-size: .85em; } }
.card { display: block; background: var(--card); border-radius: 12px; padding: 12px 14px;
  margin: 10px 0; box-shadow: 0 1px 2px rgba(0,0,0,.08); color: inherit; }
.card.narrow { max-width: 360px; margin: 40px auto; }
.row-link { text-decoration: none; }
.row-link span, .card > span { display: block; }
.muted { color: var(--muted); font-size: .9em; }
.error { color: var(--danger); } .ok { color: var(--ok); }
label { display: block; margin: 10px 0; }
input, select { font: inherit; width: 100%; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; margin-top: 4px; }
button, .button, .primary, .danger { font: inherit; border: 0; border-radius: 10px;
  padding: 12px 16px; background: #e6e6e1; color: var(--text); cursor: pointer;
  text-decoration: none; display: inline-block; text-align: center; }
.primary { background: var(--primary); color: #fff; }
.danger { background: #fff; color: var(--danger); border: 2px solid var(--danger); }
.big { font-size: 1.1em; padding: 16px; }
.block { display: block; width: 100%; margin: 12px 0; }
.link { background: none; padding: 4px; color: var(--primary); text-decoration: underline; }
button:disabled { opacity: .5; }
.status-bar { display: flex; gap: 10px; align-items: baseline; margin: 4px 0 8px; flex-wrap: wrap; }
.progress { font-weight: 600; }
@keyframes pulse { from { box-shadow: 0 0 0 0 rgba(227,0,31,.5); } to { box-shadow: 0 0 0 12px rgba(227,0,31,0); } }
.text-form { display: flex; gap: 8px; margin: 10px 0; }
.text-form input { margin: 0; }
.q { border: 2px solid #e0b400; }
.top nav .link, .top nav a { color: #fff; }
.q .opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.q .opts button { flex: 1 1 45%; }
.q .list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.q .list button { display: block; width: 100%; text-align: left; border-radius: 0;
  border-bottom: 1px solid var(--line); background: #fff; }
.q .row { display: flex; gap: 8px; margin-top: 8px; } .q .row input { margin: 0; }
.filters { display: flex; gap: 8px; } .filters input { flex: 2; } .filters select { flex: 1; }
.items { width: 100%; border-collapse: collapse; margin-top: 8px; }
.items td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items .unit { color: var(--muted); font-size: .8em; white-space: nowrap; }
.items tr { cursor: pointer; }
.items tr.t-raw td:first-child { border-left: 4px solid var(--raw-b); }
.items tr.t-pf td:first-child { border-left: 4px solid var(--pf-b); }
.items tr.t-bar td:first-child { border-left: 4px solid var(--bar-b); }
.items .val { text-align: right; white-space: nowrap; font-weight: 600; }
.items .val small { display: block; font-weight: 400; color: var(--muted); }
.warnings li, .warn { color: #8a5a00; }
.people { padding-left: 18px; } .people li { margin: 6px 0; }
dialog { border: 0; border-radius: 14px; width: min(94vw, 520px); padding: 16px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
table.plain { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; }
table.plain td, table.plain th { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
.journal pre { white-space: pre-wrap; font-size: .75em; }
.journal audio { width: 100%; margin-top: 6px; }
.j-rejected { border-left: 4px solid var(--danger); }

/* --- Экран работы (раздел 8): закреплённый блок сверху, плавающие кнопки снизу --- */
body.work .top { position: static; }  /* шапка уезжает, экран — таблице */
body.work main {
  /* место под плавающую кнопку, чтобы она не закрывала последние строки */
  padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
}
.small { font-size: .82em; }
.pinned { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 4;
  background: var(--bg); margin: 0 -14px; padding: 6px 14px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.pinned .status-bar { margin: 0 0 4px; font-size: .92em; }
.busy { color: var(--primary); font-weight: 600; animation: blink 1s ease-in-out infinite alternate; }
@keyframes blink { from { opacity: 1; } to { opacity: .45; } }
.questions { background: #fff8db; border: 2px solid #e0b400; border-radius: 12px;
  padding: 6px 10px; margin-bottom: 6px; }
.q-head { font-weight: 700; font-size: .9em; color: #7a5a00; }
.q-head:empty { display: none; }
.q .list { max-height: 17vh; }
.q .opts.rest { flex-wrap: nowrap; margin-top: 6px; }
.q .opts.rest button { flex: 1; padding: 8px 10px; font-size: .9em; }
.q-others .q { max-height: 30vh; overflow-y: auto; }
.pinned.asking .recent li:not(:first-child) { display: none; }
.q .list button { padding: 9px 12px; font-size: .95em; }
.q input { padding: 9px 10px; }
.q { padding: 6px 0; border-top: 1px solid #f0dc8c; }
.q:first-child { border-top: 0; }
.q-text { font-weight: 600; }
.q .opts button { padding: 10px 12px; }
.q-others summary { font-size: .88em; color: #7a5a00; padding: 4px 0; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 6px; font-size: .88em; padding: 3px 8px;
  margin: 2px 0; background: var(--card); border-radius: 8px; border-left: 4px solid #bbb; }
.recent li.t-raw { border-left-color: var(--raw-b); } .recent li.t-pf { border-left-color: var(--pf-b); }
.recent li.t-bar { border-left-color: var(--bar-b); } .recent li.k-rejected { border-left-color: var(--danger); }
.recent .line { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.recent .said { color: var(--muted); }
.recent .link { flex: none; padding: 2px 4px; }

.items tr.flash td { animation: flash 2.5s ease-out; }
@keyframes flash { 0%, 30% { background: #ffe680; } 100% { background: transparent; } }

.fab { position: fixed; left: 50%; transform: translateX(-50%); z-index: 6;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.fab-talk { width: 96px; height: 96px; border-radius: 50%; padding: 0;
  background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.fab-talk svg { width: 40px; height: 40px; fill: currentColor; }
.fab-talk span { font-size: .72em; }
.fab-talk.rec { background: var(--brand); animation: pulse 1s ease-in-out infinite alternate; }
.fab-talk:disabled { opacity: .55; }
.fab-small { position: absolute; left: calc(100% + 18px); bottom: 18px; width: 56px; height: 56px;
  border-radius: 50%; padding: 0; background: #fff; color: var(--text); font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.rec-hint { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; background: var(--brand); color: #fff; padding: 6px 12px; border-radius: 16px;
  font-size: .9em; }
.text-sheet { position: fixed; left: 0; right: 0; z-index: 6; display: flex; gap: 8px;
  bottom: calc(124px + env(safe-area-inset-bottom, 0px)); padding: 10px 14px; margin: 0 10px;
  background: var(--card); border-radius: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.text-sheet input { margin: 0; }
.journal-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.journal-filters select, .journal-filters input { flex: 1 1 140px; margin: 0; }
.journal .t-raw { border-left: 4px solid var(--raw-b); } .journal .t-pf { border-left: 4px solid var(--pf-b); }
.journal .t-bar { border-left: 4px solid var(--bar-b); }
.journal .said { color: var(--muted); }
