@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/golos-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/golos-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122;
}

:root {
  color-scheme: light;
  --ground: #F3F4F6;
  --surface: #FFFFFF;
  --line: #E8EAEE;
  --field: #CFD4DC;
  --ink: #14171C;
  --muted: #56606C;
  --label: #3C4550;
  --blue: #1D4ED8;
  --blue-press: #173FB0;
  --blue-tint: #E6ECFD;
  --late: #A83A08;
  --late-tint: #FCEDE3;
  --late-line: #F1C4A8;
  --gap-side: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 22px;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
h1, h2, h3, p, dl, dd, fieldset { margin: 0; padding: 0; border: 0; }

.screen {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 24px) var(--gap-side) 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.screen.with-tabs { padding-bottom: 150px; }
.screen.with-tabs.no-new { padding-bottom: 90px; }
.screen.tight { gap: 14px; padding-top: calc(env(safe-area-inset-top) + 12px); }

.title { font-size: 30px; line-height: 36px; font-weight: 700; }
.title-sm { font-size: 26px; line-height: 32px; font-weight: 700; }
.sub { font-size: 15px; line-height: 22px; color: var(--muted); margin-top: 2px; }
.section { display: flex; flex-direction: column; gap: 8px; }
.section-title { font-size: 16px; line-height: 22px; font-weight: 600; }
.section-title.late { color: var(--late); }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 20px; }

.card { background: var(--surface); border-radius: 16px; padding: 14px 16px; }
.card.flush { padding: 2px 14px; }
.card-title { padding: 10px 0 4px; font-size: 15px; line-height: 20px; font-weight: 600; }

/* Кнопки */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; width: 100%; padding: 0 16px;
  border: 0; border-radius: 14px;
  font-size: 17px; font-weight: 600; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-press); }
.btn-primary:disabled { background: #AEB7C6; color: #fff; }
.btn-soft { background: var(--blue-tint); color: var(--blue); }
.btn-plain { background: var(--surface); color: var(--ink); border: 1.5px solid var(--field); }
.btn-danger { background: var(--surface); color: var(--late); border: 1.5px solid var(--late-line); }
.btn-big { min-height: 60px; border-radius: 16px; font-size: 18px; }
.btn-sm { min-height: 44px; width: auto; padding: 0 12px; border-radius: 12px; font-size: 14px; flex: none; }
.btn-sm:disabled { background: var(--ground); color: var(--muted); font-weight: 500; }
.link-btn {
  min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--blue);
  font-size: 15px; font-weight: 600;
}

.back {
  display: flex; align-items: center; gap: 4px; margin-left: -8px;
  min-height: 44px; border: 0; background: none; font-size: 17px; font-weight: 600;
  align-self: flex-start; color: var(--ink); text-decoration: none;
}
.close {
  width: 44px; height: 44px; margin-right: -8px; padding: 0; border: 0; background: none;
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Задачи */
.task-late {
  background: var(--late-tint); border: 1px solid var(--late-line); border-radius: 18px;
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.task-late h3 { font-size: 19px; line-height: 25px; font-weight: 600; }
.task-late .meta { color: var(--late); font-size: 14px; line-height: 20px; font-weight: 500; margin-bottom: 10px; }
.task-open { color: inherit; text-decoration: none; display: block; }
.task-row {
  background: var(--surface); border-radius: 16px; padding: 12px 12px 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.task-row .body { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.task-row h3 { font-size: 17px; line-height: 23px; font-weight: 600; overflow-wrap: anywhere; }
.task-row .meta { font-size: 14px; line-height: 20px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tag-queue { color: var(--blue); font-weight: 500; }
.pill-late {
  display: inline-block; align-self: flex-start; background: var(--late-tint); color: var(--late);
  font-size: 14px; line-height: 20px; font-weight: 600; border-radius: 999px; padding: 6px 12px;
}

.info { background: var(--surface); border-radius: 16px; padding: 4px 16px; }
.info > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.info > div:last-child { border-bottom: 0; }
.info dt { font-size: 15px; line-height: 22px; color: var(--muted); }
.info dd { font-size: 15px; line-height: 22px; font-weight: 500; text-align: right; }

/* Поля */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .legend { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--label); }
.input {
  width: 100%; min-height: 50px; border: 1.5px solid var(--field); border-radius: 14px;
  background: var(--surface); padding: 12px 14px; font-size: 17px; line-height: 24px;
}
textarea.input { resize: none; }
.input:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.code-input { font-size: 30px; line-height: 38px; letter-spacing: 8px; text-align: center; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 14px; border: 1.5px solid var(--field); border-radius: 12px;
  background: var(--surface); font-size: 15px; font-weight: 500;
}
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; font-weight: 500; }
.check input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--blue); }
.rule { background: var(--surface); border-radius: 16px; padding: 12px 14px; font-size: 15px; line-height: 21px; }
.rule b { display: block; font-size: 14px; line-height: 20px; color: var(--label); margin-bottom: 4px; }
.error { color: var(--late); font-size: 15px; line-height: 21px; font-weight: 500; }

/* Контроль */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--surface); border-radius: 14px; padding: 10px 12px; color: inherit; text-decoration: none; }
.tile b { display: block; font-size: 26px; line-height: 30px; font-weight: 700; }
.tile span { display: block; font-size: 14px; line-height: 18px; color: var(--muted); }
.tile.late { background: var(--late-tint); }
.tile.late b, .tile.late span { color: var(--late); font-weight: 500; }
.tile.late b { font-weight: 700; }
.person {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 0;
  border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; width: 100%;
  background: none; border-width: 0 0 1px; text-align: left;
}
.person:last-child { border-bottom: 0; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--blue-tint); color: var(--blue);
  font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.person .name { flex: 1; min-width: 0; font-size: 16px; line-height: 22px; font-weight: 500; overflow-wrap: anywhere; }
.person .state { font-size: 14px; line-height: 20px; color: var(--muted); text-align: right; }
.person .state.late { color: var(--late); font-weight: 600; }
.ctl-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ctl-row:last-child { border-bottom: 0; }
.ctl-row .body { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.ctl-row h3 { font-size: 16px; line-height: 21px; font-weight: 600; overflow-wrap: anywhere; }
.ctl-row p { font-size: 14px; line-height: 20px; color: var(--muted); margin-top: 1px; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 18px; line-height: 24px; font-weight: 600; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* Фото */
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--line); display: block; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button {
  position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(20, 23, 28, .72); color: #fff; display: flex; align-items: center; justify-content: center;
}
.report-photo { width: 100%; border-radius: 14px; display: block; background: var(--line); }
.thumb-row { display: flex; gap: 6px; margin-top: 6px; }
.thumb-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }

/* Сообщения */
.banner {
  background: var(--late-tint); border: 1px solid var(--late-line); border-radius: 14px;
  padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-size: 15px; line-height: 21px;
}
.banner.info-b { background: var(--blue-tint); border-color: #C9D6FA; }
.banner span { flex: 1; min-width: 0; }
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 30;
  max-width: 536px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 8px 8px 8px 16px;
  display: flex; align-items: center; gap: 10px; min-height: 56px; font-size: 15px; line-height: 21px;
}
.toast span { flex: 1; min-width: 0; }
.toast button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: #2A3039; color: #fff; font-weight: 600; }
.toast.with-tabs { bottom: calc(env(safe-area-inset-bottom) + 148px); }
details.done-list summary {
  list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; font-weight: 600;
}
details.done-list summary::-webkit-details-marker { display: none; }
details.done-list svg { transition: transform .15s; }
details.done-list[open] svg { transform: rotate(180deg); }
.done-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.done-item .body { flex: 1; min-width: 0; font-size: 15px; line-height: 21px; color: inherit; text-decoration: none; }
.steps { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps .n {
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--blue-tint); color: var(--blue);
  font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.code-box { text-align: center; font-size: 40px; line-height: 48px; letter-spacing: 6px; font-weight: 700; padding: 8px 0; }

/* Закреплённое снизу */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid #E2E5EA;
  padding-bottom: env(safe-area-inset-bottom);
}
.dock-new { background: var(--ground); max-width: 560px; margin: 0 auto; padding: 10px var(--gap-side); }
.dock-wrap { position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 61px); z-index: 19; background: var(--ground); }
.tabs { max-width: 560px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tabs a {
  min-height: 60px; display: flex; align-items: center; justify-content: center; text-decoration: none;
  font-size: 15px; font-weight: 500; color: var(--muted);
}
.tabs a[aria-current="page"] { color: var(--blue); font-weight: 600; }
.action-bar {
  position: sticky; bottom: 0; margin: auto calc(-1 * var(--gap-side)) -24px;
  padding: 12px var(--gap-side) calc(env(safe-area-inset-bottom) + 16px);
  background: var(--ground); display: flex; flex-direction: column; gap: 8px;
}
.loading { min-height: 100dvh; display: flex; align-items: center; justify-content: center; color: var(--muted); }
