/* Цвета из брендбука КРИСТ (стр. 15–16). Шрифт Golos лежит рядом, без Google */
@font-face { font-family: "Golos Text"; src: url(fonts/golos-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url(fonts/golos-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url(fonts/golos-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url(fonts/golos-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --blue: #0047BB;
  --blue-light: #A6C6FA;
  --ice: #E9EFF6;
  --navy: #070E2A;
  --grey: #D7DEE6;
  --white: #FFFFFF;
  --muted: #535D78;
  --warn: #B4361F;
  --warn-bg: #FBE7E3;
  --ok: #1E7A50;
  --ok-bg: #E2F3EA;
  --radius: 16px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--navy); background: var(--ice); font-size: 15px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
small { font-size: 12px; }
.hint { color: var(--muted); }
.nowrap { white-space: nowrap; }

.app { display: flex; min-height: 100vh; }

/* ---------- Меню ---------- */
.side {
  width: 228px; flex-shrink: 0; background: var(--blue); color: var(--white);
  padding: 26px 16px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.logo { width: 136px; }
.side-sub { font-size: 13px; opacity: .8; margin: 4px 0 18px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav button {
  background: none; border: 0; color: var(--white); text-align: left; display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 12px; font-weight: 500; opacity: .9;
}
#nav button:hover { background: rgba(255,255,255,.12); opacity: 1; }
#nav button.active { background: var(--white); color: var(--blue); opacity: 1; }
#nav button:focus-visible { outline-color: var(--white); }
.nav-title { flex: 1; min-width: 0; }
.nav-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--white); color: var(--blue); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-count.warn { background: #FFD7CF; color: var(--warn); }
#nav button.active .nav-count { background: var(--blue); color: var(--white); }
#nav button.active .nav-count.warn { background: var(--warn); color: var(--white); }
.nav-online { display: inline-flex; }
.nav-online .ava { margin-left: -6px; box-shadow: 0 0 0 2px var(--blue); }
#nav button.active .nav-online .ava { box-shadow: 0 0 0 2px var(--white); }
.nav-group { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; opacity: .7; padding: 14px 12px 4px; }
.side-me { margin-top: auto; padding-top: 16px; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.me-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-out { color: var(--white); opacity: .8; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.me-out:hover { opacity: 1; }

/* ---------- Аватарки ---------- */
.ava { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; overflow: hidden;
  background: var(--who, var(--muted)); color: var(--white); font-size: 12px; font-weight: 600; box-shadow: 0 0 0 2px var(--white); }
.ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ava.xxs { width: 16px; height: 16px; font-size: 9px; box-shadow: 0 0 0 1px var(--white); }
.ava.xs { width: 20px; height: 20px; font-size: 10px; box-shadow: 0 0 0 1.5px var(--who, var(--white)); }
.ava.md { width: 32px; height: 32px; font-size: 13px; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.ava.lg { width: 44px; height: 44px; font-size: 17px; box-shadow: 0 0 0 2px var(--who, var(--grey)); }
.ava-upload { position: relative; cursor: pointer; display: inline-flex; }
.ava-edit { position: absolute; inset: 0; border-radius: 50%; background: rgba(7,14,42,.55); color: var(--white); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.ava-upload:hover .ava-edit, .ava-upload:focus-within .ava-edit { opacity: 1; }
.person-inline { display: inline-flex; align-items: center; gap: 5px; }
.who { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px 2px 2px; border-radius: 999px; background: color-mix(in srgb, var(--who) 15%, white); white-space: nowrap; }

/* ---------- Каркас страницы ---------- */
main { flex: 1; min-width: 0; padding: 24px 28px 64px; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 14px; }
.top h1 { margin: 0; font-size: 26px; font-weight: 600; margin-right: auto; }
.actions { display: flex; gap: 8px; }
.search { position: relative; width: min(320px, 100%); }
.search input { width: 100%; border: 1px solid var(--grey); background: var(--white); border-radius: 999px; padding: 9px 16px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; background: var(--white); border-radius: 14px; box-shadow: 0 12px 40px rgba(7,14,42,.18); padding: 6px; display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; min-width: 300px; }
.search-row { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 10px; display: flex; flex-direction: column; gap: 2px; }
.search-row small { color: var(--muted); }
.search-row:hover, .search-row.active { background: var(--ice); }
.search-empty { padding: 12px; color: var(--muted); font-size: 14px; }
.subtabs { display: flex; gap: 4px; border-bottom: 2px solid var(--grey); margin-bottom: 14px; overflow-x: auto; }
.subtabs:empty { display: none; }
.subtabs button { background: none; border: 0; padding: 10px 14px; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.subtabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 16px; }
.toolbar select { max-width: 220px; background: var(--white); border: 1px solid var(--grey); border-radius: 999px; padding: 7px 12px; font-size: 14px; }
.seg { display: inline-flex; background: var(--white); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.seg button.active { background: var(--blue); color: var(--white); }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; }

.btn { background: var(--blue); color: var(--white); border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.ghost { background: var(--white); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.btn.danger { background: var(--white); color: var(--warn); box-shadow: inset 0 0 0 1.5px #E4B3A8; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.link-btn { background: none; border: 0; color: var(--blue); padding: 4px 0; font-weight: 500; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
.panel { background: var(--white); border-radius: var(--radius); padding: 20px; }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.note-bar { background: #FFF6DC; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.gate { margin: auto; max-width: 420px; display: grid; gap: 16px; justify-items: center; }
.gate img { height: 36px; }

/* ---------- Значки ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--ice); white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--blue)); }
.pct { flex-shrink: 0; font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--white); color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue-light); }
.pct.full { background: var(--ok); color: var(--white); box-shadow: none; }
.od { flex-shrink: 0; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); white-space: nowrap; }
.cm { flex-shrink: 0; font-size: 12px; font-weight: 600; padding: 0 5px; border-radius: 6px; background: var(--white); color: var(--muted); box-shadow: inset 0 0 0 1px var(--grey); white-space: nowrap; }
.cm.new { background: #E2700F; color: var(--white); box-shadow: none; }
.nt { flex-shrink: 0; font-size: 12px; line-height: 1; padding: 2px 3px; border-radius: 6px; background: #FFF4D6; cursor: help; }
.net { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 6px; color: var(--white); background: var(--net); }
.net-dot { margin-right: 2px; font-style: normal; font-size: 12px; font-weight: 700; color: var(--net); letter-spacing: .02em; }
.line-dot { font-style: normal; font-size: 12px; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--white); background: var(--ln); flex-shrink: 0; }
.progress { height: 6px; background: var(--ice); border-radius: 3px; overflow: hidden; }
.progress div { height: 100%; background: var(--blue); }
.ready-bar { display: flex; align-items: center; gap: 8px; }
.ready-bar .progress { flex: 1; min-width: 50px; }
.mention { color: var(--blue); font-weight: 600; }

/* ---------- Календарь ---------- */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 12px; }
.cal-head h2 { margin: 0; font-size: 20px; font-weight: 600; min-width: 170px; text-align: center; }
.cal-nav { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--white); font-size: 18px; }
.cal-hint { font-size: 13px; color: var(--muted); margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: 12px; color: var(--muted); text-transform: uppercase; padding: 0 6px; }
.cal-day { background: var(--white); border-radius: 12px; min-height: 116px; padding: 6px; display: flex; flex-direction: column; gap: 4px; border: 2px solid transparent; min-width: 0; }
.cal-day.other { background: rgba(255,255,255,.55); }
.cal-day.other .cal-num { opacity: .6; }
.cal-day.today { border-color: var(--blue); }
.cal-day.drop { border-color: var(--blue); background: var(--ice); }
.cal-num { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 2px; min-height: 22px; }
.cal-day.today .cal-num { color: var(--blue); }
.day-add { border: 0; background: var(--ice); color: var(--blue); width: 22px; height: 22px; border-radius: 50%; font-size: 16px; line-height: 1; opacity: 0; transition: opacity .1s; }
.cal-day:hover .day-add, .day-add:focus-visible { opacity: 1; }
.chip {
  display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; min-width: 0;
  font-size: 12px; line-height: 1.3; padding: 4px 6px; border-radius: 7px; border: 0;
  border-left: 3px solid var(--st, var(--blue)); background: var(--ice); color: var(--navy);
}
.chip:hover { background: #DCE5F1; }
.chip[draggable="true"] { cursor: grab; }
.chip.late { box-shadow: inset 0 0 0 1.5px #E9A493; }
.chip.pub { opacity: .75; }
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.chip-time { color: var(--muted); font-weight: 600; }
.chip .br { font-size: 12px; letter-spacing: .03em; }
.chip-meta { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: nowrap; overflow: hidden; }
.chip-meta .line-dot { width: 15px; height: 15px; font-size: 9px; }
.chip-st { color: var(--muted); font-size: 12px; white-space: nowrap; }
.chip-who { margin-left: auto; display: inline-flex; }
.chip.shoot { background: var(--navy); color: var(--white); border-left-color: var(--blue-light); }
.chip.shoot:hover { background: #1A2348; }
.chip.release { background: #FCE8F1; border-left-color: #D6408B; }
.day-dots { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.day-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--st); }
.day-dots small { font-size: 11px; color: var(--muted); }

/* ---------- Доска ---------- */
.kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: stretch; }
.col { background: rgba(255,255,255,.55); border-radius: var(--radius); padding: 10px; min-height: 260px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 210px; min-width: 190px; }
.col.empty { flex: 0 0 132px; min-width: 132px; }
.col.empty .col-head { flex-direction: column; align-items: flex-start; gap: 4px; }
.col.drop { background: var(--blue-light); }
.col-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; padding: 2px 2px 4px; }
.col-head span:last-child { color: var(--muted); }
.card { background: var(--white); border-radius: 12px; padding: 11px; display: flex; flex-direction: column; gap: 6px; border: 0; text-align: left; box-shadow: 0 1px 2px rgba(7,14,42,.06); width: 100%; }
.card:hover { box-shadow: 0 0 0 2px var(--blue-light); }
.card > span { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.card-title { font-weight: 600; font-size: 14px; }
.card-meta { font-size: 12px; color: var(--muted); }
.card-foot { font-size: 12px; }
.card.by { box-shadow: inset 4px 0 0 var(--who), 0 1px 2px rgba(7,14,42,.06); }
.card.by:hover { box-shadow: inset 4px 0 0 var(--who), 0 0 0 2px var(--blue-light); }

/* ---------- Таблицы и повестка ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; }
td { padding: 10px; border-top: 1px solid var(--ice); vertical-align: top; }
tbody tr[data-open] { cursor: pointer; }
tbody tr[data-open]:hover td { background: var(--ice); }
.table-wrap { overflow-x: auto; }
.row-meta { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--muted); }
td .od, td .badge { margin-top: 4px; }
.dl { white-space: nowrap; }
.dl small { display: block; font-size: 12px; }
.dl.past { color: var(--muted); }
.dl.soon { color: #A35A0C; font-weight: 600; }
.dl.late { color: var(--warn); font-weight: 600; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.quick input { border: 1px solid var(--grey); background: var(--white); border-radius: 999px; padding: 8px 14px; }
.quick input[name=title] { flex: 1 1 260px; }
.agenda { display: flex; flex-direction: column; gap: 14px; }
.agenda-day h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.agenda-day.today h3 { color: var(--blue); }
.row-card { width: 100%; display: flex; flex-direction: column; gap: 6px; text-align: left; border: 0; background: var(--white); border-radius: 12px; padding: 12px 14px; border-left: 4px solid var(--st, var(--blue)); margin-bottom: 6px; min-height: 48px; }
.row-title { font-weight: 600; }
.row-card .row-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sheet { display: flex; flex-direction: column; margin-top: 8px; max-height: 55vh; overflow-y: auto; }
.sheet .row-card { background: var(--ice); }

/* ---------- Моё ---------- */
.my-hello { margin-bottom: 14px; }
.my-hello h2 { margin: 0; font-size: 22px; }
.my-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; align-items: start; }
.my-sec h2 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.my-sec .count { font-size: 12px; background: var(--ice); color: var(--muted); border-radius: 999px; padding: 1px 8px; }
.my-sec.accent { box-shadow: inset 4px 0 0 var(--blue); }
.my-sec.warn { box-shadow: inset 4px 0 0 var(--warn); }
.my-sec > p { margin: 0 0 8px; font-size: 13px; }
.my-list { display: flex; flex-direction: column; }
.my-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; border: 0; background: none; text-align: left; padding: 9px 8px; border-radius: 10px; border-top: 1px solid var(--ice); }
.my-row:first-child { border-top: 0; }
.my-row:hover { background: var(--ice); }
.my-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.my-main.with-ava { flex-direction: row; align-items: center; gap: 10px; }
.my-main.with-ava > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.my-main b { font-weight: 600; }
.my-main small { color: var(--muted); }
.my-side { display: flex; gap: 6px; align-items: center; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.tg-connect { display: flex; align-items: center; gap: 16px; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.tg-connect p { margin: 4px 0 0; color: var(--muted); font-size: 14px; max-width: 60ch; }

/* ---------- Плитки ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tile { background: var(--white); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; border: 0; text-align: left; }
button.tile:hover { box-shadow: 0 0 0 2px var(--blue-light); }
.tile > span { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tile-date { font-size: 13px; color: var(--blue); font-weight: 600; }
.tile-title { font-weight: 600; font-size: 17px; }
.tile-text { font-size: 14px; color: var(--muted); line-height: 1.45; }
.add-tile { border: 2px dashed var(--blue-light); background: none; color: var(--blue); font-weight: 600; justify-content: center; align-items: center; min-height: 120px; }
.past { margin-top: 18px; }
.past summary { cursor: pointer; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.supp-list { display: flex; flex-direction: column; gap: 2px; }
.supp-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--ice); border: 0; text-align: left; }
.supp-row:hover { background: var(--grey); }
.supp-row i { width: 9px; height: 9px; border-radius: 50%; background: var(--st); flex-shrink: 0; }
.supp-row span { flex: 1; font-size: 14px; }
.supp-row small { color: var(--muted); white-space: nowrap; }
.posts-count.has { color: var(--blue); font-weight: 600; }
.long-ago { color: #A35A0C !important; font-weight: 600; }
.archive-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.archive-search { flex: 1 1 260px; max-width: 420px; background: var(--white); border: 1px solid var(--grey); border-radius: 999px; padding: 9px 16px; }
.archive-bar .btn { margin-left: auto; }
.archive-table td { font-size: 14px; max-width: 260px; }
.archive-table tr.is-archived td { color: var(--muted); }
.archived-note { background: var(--ice); border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--muted); }

/* ---------- Задачи раздела ---------- */
.tasks-panel { max-width: 920px; display: flex; flex-direction: column; gap: 14px; }
.tasks-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; }
.task-new, .task { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task { padding: 6px 10px; border-radius: 12px; background: var(--ice); }
.task input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--ok); flex-shrink: 0; }
.task-text { flex: 1 1 240px; min-width: 0; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px 8px; font-size: 15px; }
.task-text:hover, .task-text:focus { background: var(--white); border-color: var(--grey); }
.task-new .task-text, .task-new select { background: var(--white); border: 1px solid var(--grey); border-radius: 8px; padding: 6px 8px; }
.task-date, .task-who-sel { border: 1px solid var(--grey); border-radius: 8px; padding: 5px 8px; background: var(--white); font-size: 13px; }
.task-who { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); min-width: 80px; }
.task.done .task-text { text-decoration: line-through; color: var(--muted); }
.task.done { background: var(--ok-bg); }

/* ---------- Итоги ---------- */
.report-hint { margin: -4px 0 14px; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat h3 { margin: 0 0 10px; font-size: 16px; }
.stat-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; flex-wrap: wrap; }
.stat-row b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-row small { color: var(--muted); }
.stat-row.warn b { color: var(--warn); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.report-grid h3 { margin: 0 0 10px; font-size: 16px; }
.bars td { font-variant-numeric: tabular-nums; }
.bar { display: inline-block; width: 90px; height: 8px; background: var(--ice); border-radius: 4px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); }
.top-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.top-list small { color: var(--muted); }

/* ---------- Карточка ---------- */
dialog { border: 0; border-radius: 20px; padding: 0; color: var(--navy); }
dialog::backdrop { background: rgba(7,14,42,.5); }
#modal { width: min(780px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: hidden; display: none; }
#modal[open] { display: flex; }
#modal-form { display: flex; flex-direction: column; width: 100%; max-height: calc(100vh - 32px); }
.m-head { display: flex; align-items: center; gap: 10px; padding: 20px 24px 12px; flex-wrap: wrap; }
.m-head h2 { margin: 0; font-size: 20px; flex: 1; min-width: 200px; }
.m-close { border: 0; background: var(--ice); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; flex-shrink: 0; }
.m-body { overflow-y: auto; padding: 4px 24px 20px; display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }
.m-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--ice); padding: 14px 24px; background: var(--white); }
.m-foot-gap { flex: 1; }
.flow { margin: 0 24px 8px; padding: 12px 14px; background: var(--ice); border-radius: 14px; display: flex; flex-direction: column; gap: 10px; }
.flow-note { font-size: 14px; }
.flow-note.warn { color: var(--warn); }
.flow-note.ok { color: var(--ok); }
.flow-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.live-note { margin: 0 24px 8px; padding: 10px 14px; border-radius: 12px; background: #FFF6DC; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 13px; color: var(--muted); font-weight: 500; padding: 0; margin-bottom: 5px; }
.field input, .field select, .field textarea, .cell-input { background: var(--white); border: 1px solid var(--grey); border-radius: 10px; padding: 8px 10px; width: 100%; min-width: 0; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field textarea.small { min-height: 70px; }
.field input.title-input { font-size: 18px; font-weight: 600; }
.field input:disabled, .field select:disabled, .field textarea:disabled, .cell-input:disabled { background: var(--ice); color: var(--navy); opacity: 1; border-color: transparent; }
.section-title { font-weight: 600; font-size: 15px; display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.section-title .pct { font-size: 12px; padding: 2px 8px; }
legend.section-title { width: 100%; color: var(--navy); font-size: 15px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { cursor: pointer; position: relative; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-block; padding: 7px 14px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1.5px var(--grey); font-size: 14px; font-weight: 500; }
.pill input:checked + span { background: var(--blue); color: var(--white); box-shadow: none; }
.pill input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.pill input:disabled + span { opacity: .7; }
.pill.fixed span { background: var(--ice); box-shadow: none; color: var(--muted); cursor: default; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check-row { display: flex; gap: 8px; align-items: center; }
.checks .check-row { padding: 8px 12px; background: var(--ice); border-radius: 10px; cursor: pointer; font-size: 14px; }
.checks .check-row.auto { cursor: default; }
.checks input { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; }
.check-row .cell-input { flex: 1; }
.shot.done .cell-input { text-decoration: line-through; color: var(--muted); }
.url-row { display: flex; gap: 8px; align-items: center; }
.url-row input { flex: 1; }
textarea.scenario { min-height: 200px; }
.script-table td, .script-table th { padding: 4px; border: 0; }
.script-table .num { width: 24px; color: var(--muted); }
.script-table .dur { width: 80px; }
.cell-input { padding: 6px 8px; font-size: 14px; resize: vertical; }
.row-del, .row-move { border: 0; background: none; color: var(--muted); font-size: 18px; width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.row-del:hover, .row-move:hover:not(:disabled) { background: var(--ice); color: var(--navy); }
.row-move:disabled { opacity: .3; cursor: default; }
.linked { display: flex; flex-direction: column; gap: 6px; }
.linked .card { box-shadow: inset 0 0 0 1px var(--grey); }
.more { border-radius: 12px; background: var(--ice); padding: 10px 14px; }
.more summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.more-body { display: flex; flex-direction: column; gap: 14px; padding-top: 12px; }
.nettexts { display: flex; flex-direction: column; gap: 10px; }
.nettexts:empty { display: none; }
.comments { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; background: var(--ice); border-radius: 4px 14px 14px 14px; padding: 8px 12px; }
.comment.mine .comment-body { background: #DCE8FB; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-head small { color: var(--muted); }
.comment-head .row-del { margin-left: auto; font-size: 16px; width: 24px; height: 24px; }
.comment-text { font-size: 14px; line-height: 1.45; margin-top: 2px; overflow-wrap: anywhere; }
.comment-new { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.comment-new textarea { flex: 1 1 260px; border: 1px solid var(--grey); border-radius: 12px; padding: 8px 12px; resize: vertical; min-height: 60px; }
.comment-actions { display: flex; flex-direction: column; gap: 6px; }
.comment-actions select { border: 1px solid var(--grey); border-radius: 999px; padding: 5px 10px; font-size: 13px; background: var(--white); }
.files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.file { display: flex; align-items: center; gap: 10px; background: var(--ice); border-radius: 10px; padding: 6px 8px; }
.thumb { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--white); display: grid; place-items: center; font-size: 22px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-info a { color: var(--navy); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info small { color: var(--muted); }
.drop-zone { display: block; border: 2px dashed var(--blue-light); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; }
.drop-zone.over { background: var(--ice); border-color: var(--blue); }
.drop-zone u { color: var(--blue); }
.history summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.history-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.history-list small { color: var(--muted); margin-right: 4px; }

/* Окно-вопрос вместо системного */
.ask-dialog { width: min(460px, calc(100vw - 24px)); }
.ask { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.ask h3 { margin: 0; font-size: 18px; }
.ask p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.ask input, .ask textarea { border: 1px solid var(--grey); border-radius: 10px; padding: 10px 12px; width: 100%; }
.ask-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.invite-url { display: block; margin-top: 10px; padding: 10px; background: var(--ice); border-radius: 8px; font-size: 13px; word-break: break-all; user-select: all; color: var(--navy); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 100; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); }
.toast-undo { border: 0; background: none; color: var(--blue-light); font-weight: 600; padding: 0; }
.fab { display: none; }

/* ---------- Настройки ---------- */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.settings h3 { margin: 0 0 4px; font-size: 16px; }
.settings p { margin: 0 0 10px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.settings .wide { grid-column: 1 / -1; }
.team { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.person { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--ice); }
.person-main { display: grid; grid-template-columns: 44px 40px minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 8px; align-items: center; }
.person-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.person-access { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acc-label { font-size: 13px; color: var(--muted); }
.person .pill span { padding: 6px 12px; font-size: 13px; }
.acc-select { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 3px 4px 3px 12px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1.5px var(--grey); }
.acc-select.on { box-shadow: inset 0 0 0 1.5px var(--blue); color: var(--blue); }
.acc-select select { border: 0; background: var(--ice); border-radius: 999px; padding: 4px 8px; font-size: 13px; color: var(--navy); }
.color-input { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--grey); border-radius: 10px; background: var(--white); cursor: pointer; }
.list-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.list-row { display: flex; gap: 4px; align-items: center; }
.row-lock { font-size: 12px; color: var(--muted); width: 30px; text-align: center; }
.rubrics { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.rubric { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--ice); padding: 8px; border-radius: 12px; }
.rubric.off { opacity: .75; }
.rubric > .cell-input:first-child { flex: 1 1 240px; }
.rubric select, .rubric input[type=time] { border: 1px solid var(--grey); border-radius: 8px; padding: 6px 8px; background: var(--white); font-size: 13px; width: auto; }

/* ---------- Праздник ---------- */
.celebrate { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(7,14,42,.18); animation: fade-in .2s ease; }
.celebrate-card { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: min(420px, calc(100vw - 40px));
  background: var(--white); border-radius: 24px; padding: 28px 30px; box-shadow: 0 20px 60px rgba(7,14,42,.25); animation: pop .45s cubic-bezier(.2,1.4,.4,1); }
.celebrate-card .ava.lg { width: 64px; height: 64px; font-size: 24px; }
.celebrate-card b { font-size: 20px; line-height: 1.3; }
.celebrate-card small { color: var(--ok); font-weight: 600; font-size: 14px; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105%; transform: rotate(720deg) translateX(40px); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } .celebrate-card { animation: none; } }

.filters-more summary { cursor: pointer; list-style: none; background: var(--white); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 500; }
.filters-more summary::-webkit-details-marker { display: none; }
.filters-more[open] summary { background: var(--blue); color: var(--white); }
.filters-more { width: auto; }
.filters-more[open] { width: 100%; }
.filters-body { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- Телефон и узкий экран ---------- */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: sticky; top: 0; z-index: 10; padding: 10px 12px 8px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; overflow: visible; }
  .logo { width: 92px; }
  .side-sub { display: none; }
  #nav { flex-direction: row; overflow-x: auto; width: 100%; order: 3; gap: 4px; scrollbar-width: none; }
  #nav::-webkit-scrollbar { display: none; }
  #nav button { white-space: nowrap; padding: 7px 11px; }
  .nav-group { display: none; }
  .nav-online { display: none; }
  .side-me { margin: 0 0 0 auto; padding: 0; gap: 8px; }
  .side-me .ava { display: none; }
  .me-text small { display: none; }
  main { padding: 14px 16px 96px; }
  .top { gap: 10px; margin-bottom: 10px; }
  .top h1 { font-size: 22px; }
  .top .actions { display: none; }
  .search { width: 100%; order: 3; }
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .toolbar select { max-width: 100%; }
  .quick input[name=title] { flex-basis: 100%; }
  .quick input[type=date] { flex: 1; }
  .seg button { padding: 6px 10px; font-size: 13px; }
  .cal-head { gap: 8px; }
  .cal-head h2 { font-size: 17px; min-width: 0; flex: 1; }
  .cal-grid { gap: 3px; }
  .cal-day { min-height: 54px; padding: 4px; border-radius: 8px; cursor: pointer; }
  .cal-dow { font-size: 11px; padding: 0 2px; }
  .col { flex: 0 0 78vw; }
  .col.empty { flex: 0 0 132px; }
  .my-grid { grid-template-columns: 1fr; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--blue); color: var(--white); font-size: 30px; line-height: 1; box-shadow: 0 8px 24px rgba(0,71,187,.35); }
  .fab[hidden] { display: none; }
  #modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  #modal-form { max-height: 100dvh; height: 100dvh; }
  .m-head { padding: 14px 16px 10px; flex-wrap: nowrap; }
  .m-head h2 { min-width: 0; font-size: 18px; }
  .m-body { padding: 4px 16px 16px; }
  .m-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .m-foot .btn { padding: 10px 14px; }
  .flow, .live-note { margin: 0 16px 8px; }
  .person-main { grid-template-columns: 44px 40px minmax(0, 1fr) 30px; }
  .person-main input[data-k=position] { grid-column: 3 / 4; grid-row: 2; }
  .settings { grid-template-columns: 1fr; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
