/* Шрифты и токены — как у harnessly (web/kit/tokens.css) и админки buffet. */
@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 400 700;
  src: url(/fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 400 700;
  src: url(/fonts/onest-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 400 600;
  src: url(/fonts/jetbrainsmono-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 400 600;
  src: url(/fonts/jetbrainsmono-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  --bg: oklch(0.965 0.004 255);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.98 0 0);
  --sunken: oklch(0.965 0.004 255);
  --input: oklch(0.98 0 0);
  --input-hover: oklch(0.96 0 0);
  --border: oklch(0.145 0 0 / 0.08);
  --border-2: oklch(0.145 0 0 / 0.14);
  --border-3: oklch(0.145 0 0 / 0.22);
  --text: oklch(0.26 0.02 255);
  --text-1: oklch(0.145 0 0);
  --text-2: oklch(0.48 0.015 255);
  --text-3: oklch(0.62 0.014 255);
  --accent: oklch(0.55 0.24 285);
  --accent-soft: oklch(0.49 0.19 285);
  --accent-bg: oklch(0.55 0.24 285 / 10%);
  --green: oklch(0.72 0.19 155);
  --green-soft: oklch(0.48 0.13 155);
  --green-bg: oklch(0.72 0.19 155 / 11%);
  --amber: oklch(0.8 0.16 80);
  --amber-soft: oklch(0.56 0.13 80);
  --amber-bg: oklch(0.8 0.16 80 / 14%);
  --danger: oklch(0.62 0.22 22);
  --danger-bg: oklch(0.62 0.22 22 / 0.1);
  --hover: oklch(0.145 0 0 / 0.05);
  --pressed: oklch(0.145 0 0 / 0.1);
  --hover-inv: oklch(1 0 0 / 0.14);
  --ring: oklch(0.26 0.02 255 / 0.16);
  --fill: oklch(0.26 0.02 255 / 0.07);
  --focus: oklch(0.68 0.24 295 / 0.65);
  --shadow-popup: 0 0.375rem 2rem oklch(0 0 0 / 0.12), 0 0 0 1px oklch(0 0 0 / 0.08);
  --shadow-dialog: 0 1.125rem 3rem oklch(0 0 0 / 22%), 0 0 0 1px var(--border-2);
  --scrim: oklch(0.2 0.01 265 / 0.38);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.3, 0, 0.3, 1);
  --ease-out: cubic-bezier(0.1, 0.7, 0.3, 1);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: oklch(0.13 0 0); --surface: oklch(0.17 0 0); --surface-2: oklch(0.2 0 0); --sunken: oklch(0.15 0 0);
    --input: oklch(0.19 0 0); --input-hover: oklch(0.24 0 0);
    --border: oklch(1 0 0 / 0.08); --border-2: oklch(1 0 0 / 0.14); --border-3: oklch(1 0 0 / 0.22);
    --text: oklch(0.96 0 0); --text-1: oklch(1 0 0); --text-2: oklch(0.62 0 0); --text-3: oklch(0.47 0 0);
    --accent-soft: oklch(0.72 0.17 285); --accent-bg: oklch(0.55 0.24 285 / 16%);
    --green-soft: oklch(0.8 0.17 155); --green-bg: oklch(0.72 0.19 155 / 13%);
    --amber-soft: oklch(0.85 0.14 85); --amber-bg: oklch(0.8 0.16 80 / 13%);
    --danger: oklch(0.72 0.19 22); --danger-bg: oklch(0.72 0.19 22 / 0.13);
    --hover: oklch(1 0 0 / 0.07); --pressed: oklch(1 0 0 / 0.12); --hover-inv: oklch(0 0 0 / 0.1);
    --ring: oklch(1 0 0 / 0.16); --fill: oklch(1 0 0 / 0.09);
    --shadow-popup: 0 0.375rem 2rem oklch(0 0 0 / 0.48), 0 0 0 1px oklch(1 0 0 / 0.1);
    --shadow-dialog: 0 1.125rem 3rem oklch(0 0 0 / 48%), 0 0 0 1px var(--border-2);
    --scrim: oklch(0.08 0.01 265 / 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.13 0 0); --surface: oklch(0.17 0 0); --surface-2: oklch(0.2 0 0); --sunken: oklch(0.15 0 0);
  --input: oklch(0.19 0 0); --input-hover: oklch(0.24 0 0);
  --border: oklch(1 0 0 / 0.08); --border-2: oklch(1 0 0 / 0.14); --border-3: oklch(1 0 0 / 0.22);
  --text: oklch(0.96 0 0); --text-1: oklch(1 0 0); --text-2: oklch(0.62 0 0); --text-3: oklch(0.47 0 0);
  --accent-soft: oklch(0.72 0.17 285); --accent-bg: oklch(0.55 0.24 285 / 16%);
  --green-soft: oklch(0.8 0.17 155); --green-bg: oklch(0.72 0.19 155 / 13%);
  --amber-soft: oklch(0.85 0.14 85); --amber-bg: oklch(0.8 0.16 80 / 13%);
  --danger: oklch(0.72 0.19 22); --danger-bg: oklch(0.72 0.19 22 / 0.13);
  --hover: oklch(1 0 0 / 0.07); --pressed: oklch(1 0 0 / 0.12); --hover-inv: oklch(0 0 0 / 0.1);
  --ring: oklch(1 0 0 / 0.16); --fill: oklch(1 0 0 / 0.09);
  --shadow-popup: 0 0.375rem 2rem oklch(0 0 0 / 0.48), 0 0 0 1px oklch(1 0 0 / 0.1);
  --shadow-dialog: 0 1.125rem 3rem oklch(0 0 0 / 48%), 0 0 0 1px var(--border-2);
  --scrim: oklch(0.08 0.01 265 / 0.6);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
::selection { background: var(--accent-bg); }
* { scrollbar-width: thin; scrollbar-color: var(--border-3) transparent; }
h1, h2, h3, p { margin: 0; }
p { color: var(--text-2); }
a { color: inherit; }
[hidden] { display: none !important; }
.sprite { display: none; }
svg.i { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.muted { color: var(--text-2); font-size: 13px; }
.faint { color: var(--text-3); font-weight: 400; }
.spacer { flex: 1; }

/* ── Оболочка: боковая панель и окно ── */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 14px 10px 12px; gap: 2px; }
.side-nav { display: contents; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; font-weight: 600; font-size: 16px; color: var(--text-1); text-decoration: none; }
.mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--text-1); color: var(--bg); font-weight: 700; font-size: 13px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; width: 100%; font-size: 14px; }
.nav-item:hover { background: var(--hover); }
.nav-item svg.i { color: var(--text-2); }
.nav-item[aria-current="page"] { background: var(--fill); color: var(--text-1); font-weight: 500; }
.nav-item[aria-current="page"] svg.i { color: var(--text-1); }
.nav-count { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 400; }
.grow { flex: 1; }
.side-foot { display: flex; align-items: center; gap: 4px; padding: 8px 4px 0; border-top: 1px solid var(--border); margin-top: 8px; }
.host { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 0 6px; font-size: 12.5px; color: var(--text-2); }
.host span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; box-shadow: 0 0 0 3px var(--green-bg); }

.main { padding: 10px 10px 10px 0; min-width: 0; }
.window { min-height: calc(100vh - 20px); min-height: calc(100dvh - 20px); background: var(--surface); border-radius: 16px; box-shadow: 0 0 0 1px var(--border); }
.page { max-width: 1280px; margin: 0 auto; padding: 36px 40px 64px; animation: rise 360ms var(--ease-out) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.page-heading h1 { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; color: var(--text-1); }
.source { margin-top: 6px; font: 12.5px var(--mono); color: var(--text-3); }

/* ── Кнопки ── */
.button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--text-1); font-size: 13px; font-weight: 600; white-space: nowrap; isolation: isolate; transition: opacity 120ms var(--ease); }
.button::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; transition: background-color 120ms var(--ease); }
.button:not(:disabled):hover::after { background: var(--hover); }
.button:not(:disabled):active::after { background: var(--pressed); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.primary { background: var(--text); color: var(--bg); }
.button.primary:not(:disabled):hover::after { background: var(--hover-inv); }
.button.outline { box-shadow: inset 0 0 0 1px var(--ring); }
.button.secondary { background: var(--fill); }
.button.ghost { color: var(--text-2); }
.button.ghost:hover { color: var(--text-1); }
.button.small { height: 26px; padding: 0 9px; border-radius: 7px; font-size: 12px; }
.button.icon { width: 32px; padding: 0; }
.button.icon.small { width: 26px; }
.text-button { background: none; border: 0; padding: 2px 4px; color: var(--accent-soft); font-size: 13px; font-weight: 500; }
.text-button:hover { text-decoration: underline; }
.danger { color: var(--danger) !important; }

/* ── Поля ── */
input, select, textarea { height: 32px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 10px; background-color: var(--input); font-size: 13px; outline: none; max-width: 100%; transition: border-color 120ms, box-shadow 120ms, background-color 120ms; }
textarea { height: auto; padding: 6px 10px; }
input:hover, select:hover, textarea:hover { background-color: var(--input-hover); }
input:focus, select:focus, textarea:focus { border-color: var(--border-3); box-shadow: 0 0 0 3px var(--accent-bg); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
select { padding-right: 28px; appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; cursor: pointer; }
input[type=checkbox] { height: 15px; width: 15px; padding: 0; accent-color: var(--accent); cursor: pointer; box-shadow: none; }
input[type=range] { height: auto; padding: 0; border: 0; background: none; accent-color: var(--accent); box-shadow: none; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-1); min-width: 0; }
label > input, label > select { width: 100%; font-weight: 400; }

/* ── Плитки показателей ── */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-grid:empty { display: none; }
.metric-card { padding: 16px 18px; border: 1px solid var(--border-2); border-radius: 14px; background: var(--surface); min-width: 0; }
.metric-label { display: block; font-size: 12.5px; color: var(--text-2); }
.metric-value { margin-top: 8px; font-size: 26px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; color: var(--text-1); }
.metric-note { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.metric-note:empty { display: none; }
.day-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: -12px 0 24px; padding: 14px 18px; border: 1px solid var(--border-2); border-radius: 14px; background: var(--surface); }
.day-row .metric-value.good { color: var(--green-soft); }
.day-target { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.day-target input { width: 96px; }

/* ── Группы и таблицы ── */
.sec { margin: 28px 0 8px; font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sec .faint { font-size: 12.5px; }
.panel { border: 1px solid var(--border-2); border-radius: 14px; background: var(--surface); overflow: hidden; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px 12px; }
.panel-heading h2 { font-size: 15px; font-weight: 600; color: var(--text-1); }
.panel-heading p { font-size: 12.5px; margin-top: 2px; }
.count { color: var(--text-3); font-weight: 500; margin-left: 2px; }
.filter-row { display: flex; align-items: center; gap: 8px; padding: 0 16px 12px; }
.search { position: relative; flex: 1; display: block; }
.search svg.i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { width: 100%; min-width: 160px; padding-left: 32px; font-weight: 400; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 0; margin-bottom: 16px; }
.toolbar label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--text-2); }
.toolbar label > select { width: auto; min-width: 220px; color: var(--text); }
.selection-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.filter-panel { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; }
.filter-panel label { flex: 1; min-width: 140px; max-width: 260px; }
.filter-panel label.narrow { flex: 0 0 110px; min-width: 110px; }

.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; text-align: left; }
th { font-weight: 500; color: var(--text-3); font-size: 12px; padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--border); background: var(--surface); }
td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
tbody tr:first-child td { border-top: 0; }
tbody tr > td { transition: background-color 120ms; }
tbody tr:hover > td { background: var(--hover); }
th.r, td.r { text-align: right; }
.person-name { font-weight: 500; color: var(--text-1); }
.subline { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.subline.mono { font-size: 11.5px; color: var(--text-3); }
.wrap { white-space: normal; min-width: 200px; max-width: 380px; color: var(--text-2); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--fill); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--green-bg); color: var(--green-soft); }
.badge.error { background: var(--danger-bg); color: var(--danger); }

.empty { padding: 40px 20px; text-align: center; color: var(--text-2); white-space: normal; }
.empty strong { display: block; color: var(--text-1); font-size: 15px; margin-bottom: 4px; font-weight: 600; }
tbody tr:hover > td.empty { background: none; }

/* Таблица персон: ячейки — поля без рамок, пока на них не навели. */
.persona-scroll { max-height: 640px; min-height: 260px; border-top: 1px solid var(--border); }
#personas-table { min-width: 2600px; }
#personas-table th { position: sticky; top: 0; z-index: 2; }
#personas-table th:first-child, #personas-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); width: 44px; min-width: 44px; padding-left: 16px; padding-right: 8px; }
#personas-table th:nth-child(2), #personas-table td:nth-child(2) { position: sticky; left: 44px; z-index: 1; background: var(--surface); box-shadow: inset -1px 0 var(--border); }
#personas-table th:first-child, #personas-table th:nth-child(2) { z-index: 3; }
#personas-table tbody tr:hover > td:first-child, #personas-table tbody tr:hover > td:nth-child(2) { background: var(--surface-2); }
#personas-table td { padding: 4px 6px; }
#personas-table input:not([type=checkbox]), #personas-table select, #personas-table textarea { width: 124px; background-color: transparent; border-color: transparent; border-radius: 8px; padding: 0 8px; height: 30px; }
#personas-table select { padding-right: 26px; background-image: none; }
#personas-table select:hover, #personas-table select:focus { background-image: var(--chevron); }
#personas-table input:hover, #personas-table textarea:hover, #personas-table select:hover { border-color: var(--border-2); background-color: var(--input); }
#personas-table input:focus, #personas-table textarea:focus, #personas-table select:focus { border-color: var(--border-3); background-color: var(--surface); }
#personas-table input.numeric { width: 80px; text-align: right; }
#personas-table input.id-field { width: 164px; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
#personas-table input.wide { width: 156px; }
#personas-table textarea { display: block; min-width: 260px; height: 30px; padding: 5px 8px; line-height: 1.4; resize: vertical; overflow: hidden; }
#personas-table textarea:focus { height: 90px; overflow: auto; }
#personas-table tr.dirty > td { background: var(--amber-bg); }
#personas-table tr.dirty > td:first-child { box-shadow: inset 3px 0 var(--amber); }

.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 8px 16px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; }
.table-footer > div { display: flex; align-items: center; gap: 6px; }
.table-footer label { flex-direction: row; align-items: center; gap: 8px; margin-right: 8px; font-weight: 400; color: var(--text-2); font-size: 12.5px; }
.table-footer select { height: 26px; border-radius: 7px; font-size: 12px; }

.footnote { margin: 10px 4px 0; font-size: 12.5px; color: var(--text-2); line-height: 1.55; max-width: 900px; }
dialog .footnote { margin: 0; }

/* ── Видео ── */
.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.video-card { border: 1px solid var(--border-2); border-radius: 14px; background: var(--surface); overflow: hidden; transition: border-color 120ms; }
.video-card:hover { border-color: var(--border-3); }
.video-card video { display: block; width: 100%; aspect-ratio: 393 / 851; max-height: 440px; background: oklch(0.17 0 0); }
.video-info { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.video-info > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.video-info strong { font-weight: 600; color: var(--text-1); }
.video-info .mono { overflow-wrap: anywhere; font-size: 11.5px; color: var(--text-3); }
.videos-grid > .empty { grid-column: 1 / -1; border: 1px dashed var(--border-2); border-radius: 14px; }

/* ── Доля привязки ── */
.binding-panel { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: start; padding: 18px; }
.binding-panel h2 { font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: 4px; }
.binding-panel p { font-size: 13px; margin-top: 2px; }
.binding-panel form { padding-left: 24px; border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.binding-panel form > label { flex-direction: row; }
.rate-controls { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--text-2); }
.rate-controls input[type=range] { flex: 1; }
.rate-controls input[type=number] { width: 88px; text-align: right; }
#binding-preview { font-size: 12.5px; color: var(--text-2); }

/* ── Диалоги ── */
dialog { padding: 22px; border: 0; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-dialog); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: var(--scrim); }
dialog[open] { animation: pop 220ms var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
dialog form { display: flex; flex-direction: column; gap: 16px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { font-size: 17px; font-weight: 600; color: var(--text-1); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input { width: 100%; }
#bulk-description { font-size: 13px; }
#bulk-value:empty { display: none; }
#bulk-value input:not([type=checkbox]), #bulk-value textarea, #bulk-value select { width: 100%; }

/* ── Часы активности ── */
.hours-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; margin: 10px 0 8px; }
.hours-grid label { align-items: center; gap: 4px; font: 11px var(--mono); color: var(--text-3); }
.hours-grid input { width: 100% !important; min-width: 0; height: 28px !important; padding: 0 2px !important; text-align: center !important; border: 1px solid var(--border-2) !important; background-color: var(--input) !important; border-radius: 7px !important; font-size: 12px; }
.hours-row > td { background: var(--sunken) !important; padding: 14px 20px !important; white-space: normal; }
#personas-table .hours-row td:first-child { position: static; box-shadow: none; }
.hours-editor { width: 780px; max-width: 100%; }
.hours-editor h3 { font-size: 13px; font-weight: 600; color: var(--text-1); }
.hours-editor p { font-size: 12.5px; }

/* ── Уведомления ── */
#notice { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 12px; background: var(--text-1); color: var(--bg); font-size: 13px; box-shadow: var(--shadow-popup); }
#notice.error { background: var(--danger); color: #fff; }
.fatal { margin: 20px 40px 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-size: 13px; overflow-wrap: anywhere; }
dialog .fatal { margin: 0; }
.loading { opacity: .55; pointer-events: none; }
.busy { opacity: .7; }

@media (max-width: 1100px) {
  .page { padding: 28px 24px 48px; }
  .filter-row { flex-wrap: wrap; }
  .metric-value { font-size: 22px; }
  .hours-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

/* ── Телефон: панель сверху, разделы лентой ── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 2px; padding: 8px 10px; overflow-x: auto; background: var(--bg); scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .brand { padding: 0 8px 0 2px; }
  .brand .word, .grow, .host, .nav-count { display: none; }
  .nav-item { width: auto; flex-shrink: 0; }
  .nav-item .label { display: none; }
  .nav-item[aria-current="page"] .label { display: inline; }
  .side-foot { border: 0; margin: 0 0 0 auto; padding: 0; }
  .main { padding: 0 6px 6px; }
  .window { min-height: calc(100dvh - 56px); }
  .page { padding: 24px 16px 48px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-heading { flex-wrap: wrap; align-items: flex-start; }
  .filter-row { padding: 0 12px 12px; }
  .selection-row { flex-wrap: wrap; padding: 8px 12px; }
  .filter-panel label { max-width: none; }
  .binding-panel { display: block; }
  .binding-panel form { border-left: 0; border-top: 1px solid var(--border); padding: 16px 0 0; margin-top: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .hours-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .videos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar label > select { min-width: 0; }
  .table-footer { flex-wrap: wrap; }
  .fatal { margin: 16px 16px 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.relationship{display:flex;align-items:center;gap:24px;margin:20px 0 26px;padding:22px;border:1px solid var(--border);border-radius:14px;background:var(--surface)}
.relationship>div{flex:1}.relationship p{margin:8px 0 0;color:var(--text-2);font-size:13px}.step-number{display:inline-grid;place-items:center;width:25px;height:25px;border-radius:50%;background:var(--accent-bg);margin-right:9px}.relation-arrow{color:var(--text-2);font-size:24px}.launch-panel{margin-bottom:24px}.launch-panel .footnote{padding:0 22px 16px;margin:0}.selection-row label{display:flex;align-items:center;gap:8px}.selection-row input[type=number]{width:65px}.control-table td{vertical-align:top;max-width:310px}.control-table .subline{white-space:normal;overflow-wrap:anywhere}.control-table input[type=checkbox]{width:18px;height:18px}.control-table tr:has(input:checked){background:var(--accent-bg)}#binding-email-fields{margin-top:14px}#binding-dialog label,#farm-route-dialog label{display:flex;flex-direction:column;gap:8px}#binding-dialog label+label{margin-top:16px}
@media(max-width:860px){.relationship{gap:12px;padding:14px}.relationship p{font-size:11px}.relation-arrow{display:none}.selection-row{flex-wrap:wrap}.control-table{min-width:900px}}

#binding-email-fields[hidden],#control-rounds-label[hidden]{display:none}

.draft-nav{margin-top:16px;border-top:1px solid var(--border);padding-top:14px}.draft-nav summary{cursor:pointer;font-size:12px;color:var(--text-2);padding:10px}.cohort-note{padding:14px 18px;background:var(--amber-bg);border-radius:12px;color:var(--text-2);font-size:13px;line-height:1.6}.cohort-note.good{background:var(--green-bg)}.cohort-note:empty{display:none}.control-table{font-size:12px;min-width:1060px}.control-table td{min-width:100px}.control-table td:nth-child(3){min-width:220px;max-width:300px}.control-table td:nth-child(5){min-width:240px}.control-context{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.5;color:var(--text-2);margin:6px 0}.cohort-filter{flex-wrap:wrap}.calendar-field[hidden]{display:none}.wide-dialog{width:min(800px,94vw);max-width:94vw}.wide-dialog .form-grid label{display:flex;flex-direction:column;gap:6px}.wide-dialog textarea{min-height:88px}.wide-dialog .full-width{grid-column:1/-1}.readiness-list{color:var(--danger);font-size:11px;line-height:1.5;margin-top:6px}.ready-label{color:var(--green-soft)}#launch-plan{max-height:65vh;overflow:auto}#launch-plan .metric-grid{grid-template-columns:repeat(3,1fr)}#launch-plan ul{padding-left:20px}.launch-timeline{font-size:12px;line-height:1.8}.calendar-field input[type=date]{width:145px}.side-nav{overflow-y:auto}.relationship{margin:18px 0}.relationship p{font-size:12px}.launch-panel .selection-row{flex-wrap:wrap;gap:12px}

.profile-hours{display:grid;grid-template-columns:repeat(12,1fr);gap:6px}.profile-hours label{font-size:11px}.profile-hours input{width:100%;padding:8px 4px}.control-table td:last-child{min-width:100px}.control-table td:last-child button{display:block;margin-bottom:8px}#cohort-dialog label,#frequency-dialog label{display:flex;flex-direction:column;gap:8px;margin-top:12px}.filter-row:has(#control-search){flex-wrap:wrap}.filter-row #control-search{min-width:200px}.calendar-field input{min-width:0}
@media(max-width:860px){.profile-hours{grid-template-columns:repeat(6,1fr)}#cohort-metrics{grid-template-columns:repeat(2,1fr)}.relationship{flex-wrap:wrap}.relationship>div{min-width:150px}.relationship .relation-arrow{display:none}}

.relationship-help{margin:14px 0 20px;color:var(--text-2);font-size:13px}.relationship-help summary{cursor:pointer;padding:8px 0}.relationship-help .relationship{margin-bottom:8px}.selected-only{display:flex;align-items:center;gap:6px;font-size:12px;white-space:nowrap}#cohort-metrics{margin-bottom:16px}.control-table .badge{white-space:normal}.control-table .subline.mono{font-size:10px}

@media(max-width:1200px){
.control-table{display:block;min-width:0}.control-table thead{display:none}.control-table tbody{display:block}.control-table tr{display:grid;grid-template-columns:32px minmax(0,1fr);border-bottom:1px solid var(--border);padding:12px 6px}.control-table td{display:block;min-width:0!important;max-width:none!important;border:0;padding:5px 10px;overflow-wrap:anywhere}.control-table td:first-child{grid-column:1;grid-row:1/6;padding:5px}.control-table td:nth-child(2){grid-column:2;grid-row:1}.control-table td:nth-child(3){grid-column:2;grid-row:2}.control-table td:nth-child(4){grid-column:2;grid-row:3}.control-table td:nth-child(5){grid-column:2;grid-row:4}.control-table td:nth-child(6){grid-column:2;grid-row:5;display:flex;gap:16px;align-items:center}.control-table td:nth-child(4)::before{content:'E-mail аккаунта';display:block;color:var(--text-2);font-size:11px;margin-bottom:4px}.control-table td:nth-child(5)::before{content:'Выход в сеть';display:block;color:var(--text-2);font-size:11px;margin-bottom:4px}.control-table td:last-child button{margin:0}
}
#tab-farm-control .filter-row{flex-wrap:wrap;row-gap:10px;padding-top:12px}
#tab-farm-control .filter-row .search{flex:1 1 260px;min-width:220px}
#control-city,#control-readiness{flex:0 0 185px;min-width:185px}
#tab-farm-control .selected-only{flex-direction:row;flex:0 0 auto;align-items:center}
#control-only-selected{width:16px;flex:0 0 16px}
#tab-farm-control .selection-row{flex-wrap:wrap;row-gap:10px}
#network-progress{flex:1 1 220px;overflow-wrap:anywhere}
.control-table td{white-space:normal;overflow-wrap:anywhere}
.control-table td:first-child{width:36px;min-width:36px;max-width:36px}
.control-table td:nth-child(2){min-width:150px}
.control-table td:nth-child(4){min-width:185px}

.profile-section{border-top:1px solid var(--border);margin-top:24px;padding-top:12px}.device-fields{border:0;margin:0;padding:0}.utm-field{display:grid;grid-template-columns:120px minmax(160px,1fr) minmax(180px,1.2fr);gap:12px;align-items:center;margin:12px 0}.utm-field label{margin:0!important;overflow-wrap:anywhere}.url-preview{display:block;white-space:pre-wrap;overflow-wrap:anywhere;font:12px/1.6 monospace;background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:12px;max-width:100%}#person-device-fields input,#person-device-fields select{min-width:0;width:100%}#person-device-fields textarea{width:100%;resize:vertical}@media(max-width:700px){.utm-field{grid-template-columns:1fr}.utm-field input,.utm-field select{width:100%;min-width:0}}
