/* Стиль доски InstaMax: тёплые белые карточки, оранжево-красные акценты, зелёное кольцо. */
:root {
  --bg: #F6F5F3; --surface: #FFFFFF; --chip: #F1EFEC; --line: #ECE8E3; --track: #EDEAE6;
  --ink: #1C1B1A; --ink-2: #57534F; --ink-3: #8A8580;
  --orange: #F57A1F; --orange-2: #FFA04D; --red: #E2382B; --red-2: #F4644F;
  --green: #2E9E4E; --green-2: #74CC84;
  --green-soft: #E6F4E9; --red-soft: #FDEAE6; --yellow-soft: #FFF1D9; --yellow-ink: #BF6A00;
  --glow: rgba(255, 140, 64, .32);
  --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 8px 22px rgba(60, 40, 20, .07);
  --on-accent: #FFFFFF; --scrim: rgba(24, 16, 8, .45);
  --av1: #FFE3CC; --av2: #DDF1E1; --av3: #FCE0DC; --av4: #E5E4FA; --av5: #FFF0C7; --av-ink: #3A2A1C;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #131210; --surface: #1F1D1A; --chip: #2A2724; --line: #33302C; --track: #34302B;
  --ink: #F3F0EC; --ink-2: #BDB6AE; --ink-3: #8D867E;
  --orange: #FF8A3D; --orange-2: #FFAD66; --red: #FF5B4D; --red-2: #FF7A66; --green: #4CC26A; --green-2: #2F8F4A;
  --green-soft: #183323; --red-soft: #3B1D19; --yellow-soft: #3A2C13; --yellow-ink: #F5B84E;
  --glow: rgba(255, 128, 48, .20); --shadow: 0 1px 2px rgba(0, 0, 0, .4); --scrim: rgba(0, 0, 0, .62);
  --av1: #4A2F1A; --av2: #1D3A26; --av3: #45231F; --av4: #2C2B4A; --av5: #463A16; --av-ink: #F3F0EC;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
#app { min-height: 100vh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: 12px max(16px, env(safe-area-inset-left)) 96px max(16px, env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 14px; max-width: 720px; width: 100%; margin: 0 auto; }
.screen.glow { background: radial-gradient(120% 40% at 100% 0%, var(--glow), transparent 62%); }
.loading { color: var(--ink-3); text-align: center; padding: 40px 0; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around; gap: 4px; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.tabbar button { flex: 1; max-width: 140px; display: grid; justify-items: center; gap: 2px; padding: 7px 4px; border-radius: 16px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.tabbar svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { background: linear-gradient(135deg, var(--orange-2), var(--orange)); color: var(--on-accent); box-shadow: 0 6px 16px var(--glow); }

.h-title { display: grid; gap: 2px; padding-top: 4px; }
.h-title h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.h-title span { color: var(--ink-2); font-size: 14px; }
.back { align-self: flex-start; color: var(--orange); font-weight: 600; font-size: 15px; padding: 4px 0; }

.card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; min-width: 0; }
.card h3 { font-size: 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h3 small { font-weight: 600; color: var(--ink-3); font-size: 13px; }
.sub { font-size: 13px; color: var(--ink-2); }
.muted { color: var(--ink-3); }

.summary { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: center; }
.ring-wrap { position: relative; width: 120px; height: 120px; }
.ring { width: 100%; height: 100%; display: block; transform: rotate(-90deg); }
.ring-arc { transition: stroke-dashoffset .9s cubic-bezier(.2, .8, .2, 1); }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-text small { font-size: 11px; font-weight: 600; color: var(--ink-2); }
.ring-text b { font-size: 28px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring-text em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--green); }
.tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.tile { border-radius: 14px; padding: 8px 12px; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l n" "s n"; column-gap: 8px; align-items: center; width: 100%; }
.tile span { grid-area: l; font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.2; }
.tile b { grid-area: n; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.tile small { grid-area: s; font-size: 11.5px; font-weight: 600; line-height: 1.2; }
.tile.g { background: var(--green-soft); } .tile.g b { color: var(--green); }
.tile.r { background: var(--red-soft); } .tile.r b, .tile.r small { color: var(--red); }
.tile.y { background: var(--yellow-soft); } .tile.y b, .tile.y small { color: var(--yellow-ink); }
.tiles.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.row3 .tile { grid-template-columns: 1fr; grid-template-areas: "l" "n" "s"; text-align: center; }

.progress { height: 10px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--green-2) 55%, var(--orange-2)); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.row b { font-variant-numeric: tabular-nums; }
.hint { font-size: 13px; color: var(--ink-2); background: var(--chip); border-radius: 12px; padding: 8px 10px; }
.hint.warn { background: var(--yellow-soft); color: var(--yellow-ink); }
.hint.bad { background: var(--red-soft); color: var(--red); }
.hint.ok { background: var(--green-soft); color: var(--green); }

.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; align-items: end; height: 132px; }
.bars .b { display: grid; grid-template-rows: auto 1fr auto; gap: 3px; height: 100%; text-align: center; }
.bars .b em { font-style: normal; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bars .b .col { align-self: end; border-radius: 8px 8px 6px 6px; background: linear-gradient(180deg, var(--green-2), var(--green)); min-height: 4px; height: 0; transition: height .7s cubic-bezier(.2, .8, .2, 1); }
.bars .b.down .col { background: linear-gradient(180deg, var(--orange-2), var(--red-2)); }
.bars .b span { font-size: 10px; color: var(--ink-3); line-height: 1.1; }
.bars .b.today span { color: var(--ink); font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--green); }
.legend i.o { background: var(--red-2); }

.list { display: grid; gap: 10px; }
.it { display: grid; gap: 5px; }
.it .row span { font-weight: 600; }
.flag { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.pill.g { background: var(--green-soft); color: var(--green); }
.pill.y { background: var(--yellow-soft); color: var(--yellow-ink); }
.pill.r { background: var(--red-soft); color: var(--red); }
.pill.n { background: var(--chip); color: var(--ink-2); }

.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--av-ink); flex: none; font-size: 15px; }
.av.a1 { background: var(--av1); } .av.a2 { background: var(--av2); } .av.a3 { background: var(--av3); } .av.a4 { background: var(--av4); } .av.a5 { background: var(--av5); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 7px 11px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chips button b { margin-left: 4px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.chips button[aria-pressed="true"] b { color: var(--surface); opacity: .7; }

.client { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; width: 100%; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 11px 12px; }
.client .nm { display: grid; gap: 1px; min-width: 0; }
.client .nm b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client .nm span { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client .st { display: grid; justify-items: end; gap: 3px; }
.client .st small { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.client .st small.late { color: var(--red); font-weight: 700; }
.fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 4; padding: 12px 18px; border-radius: 999px; background: linear-gradient(135deg, var(--orange-2), var(--red)); color: var(--on-accent); font-weight: 700; box-shadow: 0 10px 22px var(--glow); }
.search { width: 100%; border: 0; border-radius: 14px; box-shadow: var(--shadow); padding: 11px 12px; background: var(--surface); font-size: 15px; }

.cl-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.cl-head .av { width: 52px; height: 52px; font-size: 19px; }
.cl-head h2 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.kv { display: grid; gap: 0; }
.kv div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv div:first-child { border-top: 0; padding-top: 0; }
.kv span { color: var(--ink-2); }
.kv b { text-align: right; font-weight: 600; }
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.stepper div { display: grid; gap: 5px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-align: center; line-height: 1.15; }
.stepper div::before { content: ""; height: 6px; border-radius: 999px; background: var(--track); }
.stepper .done::before { background: var(--green); } .stepper .done { color: var(--ink-2); }
.stepper .now::before { background: var(--orange); } .stepper .now { color: var(--orange); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; border-radius: 16px; font-weight: 700; font-size: 15.5px; padding: 0 12px; text-align: center; }
.btn.main { background: linear-gradient(135deg, var(--orange-2), var(--orange) 55%, var(--red-2)); color: var(--on-accent); box-shadow: 0 10px 22px var(--glow); }
.btn.green { background: linear-gradient(135deg, var(--green-2), var(--green)); color: var(--on-accent); }
.btn.soft { background: var(--chip); color: var(--ink); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.small { min-height: 38px; font-size: 14px; border-radius: 12px; width: auto; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: grid; gap: 8px; }
.btns.two { grid-template-columns: 1fr 1fr; }
.history { display: grid; gap: 8px; }
.history div { display: grid; grid-template-columns: 64px 1fr; gap: 8px; font-size: 13px; }
.history time { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.form { display: grid; gap: 12px; }
.lab { font-weight: 700; font-size: 15px; }
.field { display: grid; gap: 6px; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 11px 12px; background: var(--surface); }
textarea.input { min-height: 76px; resize: vertical; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick button { padding: 9px 12px; border-radius: 14px; background: var(--chip); font-weight: 600; font-size: 14px; border: 1.5px solid transparent; }
.pick button[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.inline2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.prow:first-of-type { border-top: 0; }
.prow .input { padding: 9px 10px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }

.member { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
.member .info { display: grid; gap: 6px; min-width: 0; }
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stats3 div { background: var(--chip); border-radius: 12px; padding: 7px 6px; text-align: center; display: grid; }
.stats3 b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stats3 span { font-size: 11px; color: var(--ink-2); font-weight: 600; line-height: 1.2; }

.tblwrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 560px; }
.tbl th { text-align: right; font-weight: 600; color: var(--ink-3); padding: 0 6px 6px; font-size: 11px; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { text-align: right; padding: 7px 6px; border-top: 1px solid var(--line); white-space: nowrap; }
.tbl td.y { color: var(--yellow-ink); font-weight: 700; } .tbl td.r { color: var(--red); font-weight: 700; } .tbl td.g { color: var(--green); font-weight: 700; }
.copybox { background: var(--chip); border-radius: 12px; padding: 10px; font-size: 13.5px; word-break: break-all; }

.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: var(--scrim); }
.sheet-body { position: relative; width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px max(16px, env(safe-area-inset-left)) calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.sheet-body h3 { font-size: 18px; font-weight: 800; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 30; max-width: 560px; margin: 0 auto; background: var(--ink); color: var(--surface); border-radius: 14px; padding: 11px 14px; font-size: 14px; font-weight: 600; box-shadow: 0 12px 26px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; pointer-events: none; }
.toast.on { opacity: 1; transform: none; }
.empty { text-align: center; color: var(--ink-3); padding: 18px 0; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .ring-arc, .progress i, .bars .b .col, .toast { transition: none; } }
