/* Палитра. Тема ставится атрибутом data-theme на <html> (light | dark). */
:root, html[data-theme="light"] {
  --bg: #FFFFFF;
  --surface: #F2F3F5;
  --text: #111214;
  --muted: #5F636A;
  --line: #E3E4E7;
  --disabled: #73777E;
  --field: #8A8E95;
  --ok: #1F7A4D;
  --link: #1E5FD8;
  --fill: #1E5FD8;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #121315;
  --surface: #1E1F22;
  --text: #F2F2F3;
  --muted: #9DA1A8;
  --line: #2B2D31;
  --disabled: #8A8E95;
  --field: #5A5E65;
  --ok: #4CC27E;
  --link: #5B93F0;
  --fill: #1E5FD8;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* Экран: шапка, содержимое, кнопка внизу */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.grow { flex-grow: 1; }
.center-msg { padding: 80px 20px; text-align: center; color: var(--muted); }

.head { padding: 40px 20px 28px; display: flex; flex-direction: column; gap: 6px; }
.head.compact { padding-top: 8px; }
.eyebrow { margin: 0; font-size: 15px; color: var(--muted); }
h1 { margin: 0; font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -0.4px; }

.topnav { padding: 12px 8px 0; }
.link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 12px;
  border: 0; background: none; font-size: 16px; color: var(--link); cursor: pointer; }

/* Списки точек и чек-листов */
.rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 68px; padding: 10px 20px; border: 0; border-bottom: 1px solid var(--line);
  background: none; text-align: left; cursor: pointer; }
.row:active { background: var(--surface); }
.row-title { display: block; font-size: 19px; font-weight: 600; }
.row-sub { display: block; margin-top: 3px; font-size: 14px; color: var(--muted); }
.chev { flex: none; color: var(--muted); }

.theme-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0 20px 24px;
  padding: 0; border: 0; background: none; font-size: 15px; color: var(--muted); cursor: pointer; }

/* Пункт чек-листа */
.stepbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 0 8px; }
.counter { font-size: 15px; font-weight: 600; color: var(--muted); }
.progress { height: 3px; margin: 8px 20px 0; background: var(--line); border-radius: 2px; }
.progress > i { display: block; height: 3px; background: var(--link); border-radius: 2px; transition: width .3s; }

.task { padding: 28px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.task .eyebrow { font-size: 14px; }
.task h1 { font-size: 26px; line-height: 32px; letter-spacing: -0.3px; }
.task .hint { margin: 0; font-size: 16px; line-height: 23px; color: var(--muted); }

.shoot-big { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  width: calc(100% - 40px); height: 220px; margin: 24px 20px 0; border: 0; border-radius: 16px;
  background: var(--surface); cursor: pointer; }
.shoot-big .t { font-size: 18px; font-weight: 600; }
.shoot-big .s { font-size: 14px; color: var(--muted); }

.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 24px 20px 0; }
.ph, .add-ph { position: relative; height: 140px; border-radius: 12px; overflow: hidden; }
.ph { background: var(--surface); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .del { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.add-ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; }

.field { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 15px; font-weight: 600; }
textarea { width: 100%; min-height: 90px; padding: 12px 14px; border: 1px solid var(--field); border-radius: 12px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px; line-height: 22px; resize: none; }
textarea:focus { outline: 2px solid var(--link); outline-offset: -1px; border-color: transparent; }

/* Нижняя кнопка */
.bottom { position: sticky; bottom: 0; padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.reason { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.reason:empty { display: none; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 56px;
  border: 0; border-radius: 14px; background: var(--fill); color: #fff; font-size: 17px; font-weight: 600; cursor: pointer; }
.btn:disabled { background: var(--surface); color: var(--disabled); cursor: default; }
.btn-plain { height: 52px; background: none; color: var(--link); }

/* Итог */
.done-list { margin: 0; padding: 0 20px; list-style: none; border-top: 1px solid var(--line); }
.done-list li { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 0;
  border-bottom: 1px solid var(--line); font-size: 15px; }
.done-list svg { flex: none; color: var(--ok); }

.sent { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 0 20px; }
.sent svg { color: var(--ok); }
.sent h1 { margin-top: 8px; }
.sent p { margin: 0; font-size: 17px; line-height: 24px; color: var(--muted); }

/* Камера */
.camera { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #000; color: #fff; }
.camera-top { display: flex; align-items: center; gap: 8px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px 8px; }
.cam-close { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  border: 0; background: none; color: #fff; cursor: pointer; }
.cam-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera video { flex: 1; min-height: 0; width: 100%; object-fit: cover; background: #2A2C2F; }
.camera-bottom { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center;
  padding: 24px 20px calc(36px + env(safe-area-inset-bottom)); }
.cam-count { font-size: 15px; color: #C9CCD1; }
.shutter-wrap { display: flex; justify-content: center; }
.shutter { width: 76px; height: 76px; padding: 4px; border: 4px solid #fff; border-radius: 50%; background: none; cursor: pointer; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; }
.shutter:active span { transform: scale(.9); }
.cam-done { justify-self: end; min-height: 44px; padding: 0 4px; border: 0; background: none; color: #fff;
  font-size: 17px; font-weight: 600; cursor: pointer; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
.flash.on { opacity: .8; transition: none; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 200;
  padding: 12px 16px; border-radius: 12px; background: rgba(20,20,20,.92); color: #fff; font-size: 15px; text-align: center; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
