:root {
    --bg: #f2f3ef;
    --panel: #ffffff;
    --ink: #1c2330;
    --muted: #697084;
    --line: #dfe2dc;
    --line-soft: #ecefe9;
    --accent: #0b7a63;
    --accent-dark: #075c4b;
    --accent-soft: #e2f3ee;
    --danger: #c0392b;
    --danger-soft: #fdecea;
    --warn: #b76a00;
    --warn-soft: #fff4dd;
    --side: #172030;
    --side-ink: #b9c1d0;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(23, 32, 48, .06), 0 2px 8px rgba(23, 32, 48, .04);
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 18px 0 8px; font-weight: 650; }
h3:first-child { margin-top: 0; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- Каркас ---------- */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px 24px; scrollbar-width: thin; scrollbar-color: #33405a transparent; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: 16px; padding: 4px 8px 14px; }
.brand:hover { text-decoration: none; }
.brand.dark { color: var(--ink); padding: 0 0 6px; }
.brand-mark { width: 30px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 15px; }
.nav a, .nav-title { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 6px 10px; border-radius: 6px; color: var(--side-ink); font: inherit; text-align: left; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 #3ad1ab; }
.nav-group { margin-top: 10px; }
.nav-title { background: none; border: 0; cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #7c879b; padding-bottom: 4px; }
.nav-title::after { content: "–"; opacity: .6; }
.nav-group.closed .nav-title::after { content: "+"; }
.nav-group.closed .nav-items { display: none; }
.nav > a { margin-top: 2px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.burger { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }
.search { flex: 1; max-width: 560px; }
.search input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 8px 16px; font: inherit; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: #fff; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; padding: 6px 8px; border-radius: 6px; font-size: 16px; }
.icon-btn:hover { background: var(--bg); text-decoration: none; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; padding: 3px 6px; border-radius: 999px; }
.user-chip:hover { background: var(--bg); }
.user-chip::-webkit-details-marker, .menu > summary::-webkit-details-marker { display: none; }
.content { padding: 20px 24px 60px; max-width: 1640px; width: 100%; }

.avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.badge { background: #e03131; color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; line-height: 18px; font-weight: 600; }
.icon-btn .badge { position: absolute; top: -2px; right: -4px; }

/* ---------- Кнопки, поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 7px 13px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; list-style: none; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: #f0c4be; }
.btn.danger:hover { background: var(--danger-soft); }
.danger-text { color: var(--danger) !important; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.block { width: 100%; padding: 10px; }
.btn:focus-visible, .input:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font: inherit; color: inherit; background: #fff; min-height: 34px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.input.big { font-size: 16px; font-weight: 600; padding: 9px 12px; }
.input.narrow { width: 70px; flex: none; }
.input.num { text-align: right; }
.input:disabled { background: var(--bg); color: var(--muted); }
textarea.input { resize: vertical; min-height: 64px; }
select.input { padding-right: 24px; }
.input-row { display: flex; gap: 6px; }
.check { display: flex; align-items: center; gap: 7px; font-weight: 400 !important; cursor: pointer; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; max-height: 160px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.req { color: var(--danger); margin-left: 2px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
.field-err { color: var(--danger); font-size: 12px; margin-top: 3px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 550; }
.form-group-title { margin: 20px 0 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.inline-form .input { width: auto; flex: 1; min-width: 180px; }
.narrow-form { max-width: 820px; }

/* ---------- Блоки ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px 20px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions form { margin: 0; }
.crumb { color: var(--muted); font-size: 13px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--accent-soft); border-color: #b5e0d4; color: var(--accent-dark); }
.flash.err { background: var(--danger-soft); border-color: #f0c4be; color: #8f2318; }
.empty { text-align: center; padding: 56px 20px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.tag { display: inline-block; background: var(--line-soft); border-radius: 4px; padding: 1px 7px; font-size: 12px; white-space: nowrap; }
.tag.ok { background: var(--accent-soft); color: var(--accent-dark); }
.tag.bad { background: var(--danger-soft); color: #8f2318; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.stage-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, #999); }

.menu { position: relative; }
.menu > summary { cursor: pointer; list-style: none; }
.menu-list { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(23, 32, 48, .16); padding: 5px; }
.menu-list.right { left: auto; right: 0; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 5px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--bg); text-decoration: none; }
.menu-list form { margin: 0; }

.seg { display: inline-flex; background: var(--line-soft); border-radius: 7px; padding: 3px; gap: 2px; }
.seg a, .seg label span { display: block; padding: 4px 12px; border-radius: 5px; color: var(--muted); font-weight: 550; cursor: pointer; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.on, .seg label input:checked + span { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label input:focus-visible + span { outline: 2px solid var(--accent); }
.seg.small a, .seg.small label span { padding: 3px 9px; font-size: 13px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--accent-dark); border-bottom-color: var(--accent); }
.count { color: var(--muted); font-weight: 400; font-size: 12px; }

.dialog { border: 0; border-radius: 10px; padding: 22px 24px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog::backdrop { background: rgba(23, 32, 48, .45); }
.dialog.wide { width: min(760px, calc(100vw - 32px)); }

/* ---------- Таблицы и фильтры ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters .input { width: auto; }
.filters .grow { flex: 1 1 240px; }
.date-range { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbf9; }
.table th a { color: inherit; }
.table th.num { text-align: right; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td, .table.compact tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbf9; }
.table .chk { width: 34px; }
.table.compact td { padding: 7px 8px; }
.table.rows td { padding: 5px 4px; vertical-align: middle; }
.table.rows th { background: none; padding: 6px 4px; }
.table.rows .input.num { width: 100px; }
.table.rows tfoot td { border-bottom: 0; padding-top: 12px; }
.row-name { position: relative; min-width: 240px; }
.list-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 12px; flex-wrap: wrap; }
.pager { display: flex; gap: 8px; align-items: center; }
.bulk-bar { position: sticky; bottom: 14px; margin-top: 14px; background: var(--ink); color: #fff; border-radius: 10px; padding: 9px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.bulk-bar .input { width: auto; }

/* ---------- Канбан ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; min-height: 60vh; }
.kb-col { flex: 0 0 276px; background: #e9ebe6; border-radius: var(--radius); padding: 8px; border-top: 3px solid var(--c); display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.kb-col.over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }
.kb-head { padding: 4px 6px 8px; }
.kb-title { display: flex; justify-content: space-between; gap: 8px; font-weight: 650; }
.kb-title b { color: var(--muted); font-weight: 500; }
.kb-sum { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.kb-quick { margin-bottom: 8px; }
.kb-quick summary { cursor: pointer; color: var(--muted); padding: 5px 6px; border-radius: 6px; list-style: none; font-size: 13px; }
.kb-quick summary::-webkit-details-marker { display: none; }
.kb-quick summary:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.kb-quick form { display: grid; gap: 6px; background: #fff; padding: 8px; border-radius: 6px; margin-top: 4px; }
.kb-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; flex: 1; padding: 1px; scrollbar-width: thin; }
.kb-card { background: var(--panel); border-radius: 6px; padding: 10px 12px; box-shadow: var(--shadow); cursor: grab; border-left: 3px solid var(--c); }
.kb-card.dragging { opacity: .4; }
.kb-card-title { font-weight: 600; color: var(--ink); display: block; overflow-wrap: anywhere; }
.kb-amount { font-variant-numeric: tabular-nums; margin-top: 2px; }
.kb-field { font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.kb-field > span:first-child { color: var(--muted); }
.kb-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; }
.kb-todo { font-size: 12px; color: var(--warn); }
.kb-todo.late { color: var(--danger); font-weight: 600; }
.kb-todo.none { color: #a4aab8; }
.kb-more { display: block; text-align: center; padding: 6px; font-size: 13px; }

/* ---------- Карточка записи ---------- */
.stagebar { display: flex; gap: 3px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.stagebar form { flex: 1 1 0; min-width: 96px; margin: 0; }
.stage { width: 100%; border: 0; padding: 8px 10px; font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; background: #e3e6e0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); padding-left: 18px; }
.stagebar form:first-child .stage { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); border-radius: 6px 0 0 6px; padding-left: 12px; }
.stage:hover { filter: brightness(.95); color: var(--ink); }
.stage.reached, .stage.current { background: var(--c); color: #fff; }
.stage.current { font-weight: 700; }
.stage.final-fail:not(.current), .stage.final-success:not(.current) { background: #eef0ec; }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 16px; align-items: start; }
.composer { display: grid; gap: 8px; }
.composer .btn { justify-self: start; }
.composer-plan { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.timeline { margin-top: 14px; display: grid; gap: 8px; }
.tl { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; border-left: 3px solid #c8ccd4; }
.tl header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 12px; }
.tl header b { font-size: 13px; }
.tl-body { margin-top: 4px; overflow-wrap: anywhere; }
.tl footer { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; font-size: 12px; }
.tl footer form { margin: 0; }
.tl-system { background: transparent; border-color: transparent; border-left-color: transparent; padding: 2px 12px; color: var(--muted); }
.tl-system header b { display: none; }
.tl-system .tl-body { margin: 0; font-size: 13px; }
.tl-comment { border-left-color: var(--accent); }
.tl-email { border-left-color: #845ef7; }
.tl.planned { border-left-color: #f59f00; background: #fffaf0; }
.tl.late { border-left-color: var(--danger); background: #fff5f4; }
.tl.late .tl-due { color: var(--danger); font-weight: 600; }
.tl.done { opacity: .7; }
.tl-due { color: var(--warn); }

/* ---------- Поле-связь ---------- */
.picker { position: relative; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.picker-chips:not(:empty) { margin-bottom: 5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 5px; padding: 3px 4px 3px 9px; max-width: 100%; }
.chip small { color: var(--muted); }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 4px; }
.chip button:hover { color: var(--danger); }
.picker[data-multiple="0"] .picker-chips:not(:empty) + .picker-search { display: none; }
.picker-results { position: absolute; z-index: 25; left: 0; right: 0; top: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(23, 32, 48, .16); max-height: 260px; overflow: auto; margin-top: 2px; }
.picker-results button { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 7px 10px; background: none; border: 0; font: inherit; cursor: pointer; }
.picker-results button:hover, .picker-results button.active { background: var(--accent-soft); }
.picker-results button span { color: var(--muted); font-size: 12px; }
.picker-results .create { color: var(--accent-dark); font-weight: 600; border-top: 1px solid var(--line-soft); }

/* ---------- Главная ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile-label { font-size: 13px; font-weight: 600; }
.tile-value { font-size: 30px; font-weight: 650; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-variant-numeric: tabular-nums; }
.todo { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.todo:last-child { border-bottom: 0; }
.todo form { margin: 0; }
.todo-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #b4bac6; background: #fff; cursor: pointer; margin-top: 1px; }
.todo-check:hover { border-color: var(--accent); background: var(--accent-soft); }
.todo-body { min-width: 0; overflow-wrap: anywhere; }
.todo.late .todo-due { color: var(--danger); font-weight: 600; }
.recent { padding: 7px 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 1px; overflow-wrap: anywhere; }
.recent:last-child { border-bottom: 0; }
.recent .muted { font-size: 12px; }
.recent.unread { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }

/* ---------- Календарь ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head h2 { margin: 0 8px; min-width: 160px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden; margin-bottom: 10px; }
.cal-wd { padding: 7px 8px; font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbf9; border-bottom: 1px solid var(--line); }
.cal-day { min-height: 104px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 4px 5px 6px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: #f7f8f5; }
.cal-day.other .cal-num { color: #b0b6c2; }
.cal-day.weekend .cal-num { color: #b0563f; }
.cal-num { font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; margin-bottom: 3px; }
.cal-day.today .cal-num { color: var(--accent-dark); }
.cal-day.today { box-shadow: inset 0 2px 0 var(--accent); background: #f4fbf8; }
.cal-add { opacity: 0; color: var(--muted); padding: 0 5px; border-radius: 4px; }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; }
.cal-add:hover { background: var(--accent-soft); text-decoration: none; }
.cal-ev { display: block; font-size: 12px; padding: 2px 6px; border-radius: 4px; margin-bottom: 2px; color: var(--ink); background: color-mix(in srgb, var(--c) 16%, white); border-left: 3px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.done { opacity: .55; text-decoration: line-through; }
.cal-ev:hover { text-decoration: none; filter: brightness(.96); }
.cal-more summary { font-size: 12px; color: var(--muted); cursor: pointer; }

/* ---------- Вход ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: min(380px, 100%); display: grid; gap: 14px; box-shadow: 0 10px 40px rgba(23, 32, 48, .08); }
.login label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 550; }

/* ---------- Чат, лента, диск, прочее ---------- */
.chat { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: calc(100vh - 150px); min-height: 420px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; }
.chat-list a { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--line-soft); }
.chat-list a:hover { background: var(--bg); text-decoration: none; }
.chat-list a.on { background: var(--accent-soft); }
.chat-list .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-room { display: flex; flex-direction: column; min-width: 0; }
.chat-title { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 650; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: #f7f8f5; }
.msg { max-width: min(560px, 80%); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; align-self: flex-start; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: var(--accent-soft); border-color: #b5e0d4; }
.msg-meta { font-size: 11px; color: var(--muted); }
.chat-form { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.online { width: 9px; height: 9px; border-radius: 50%; background: #2fb344; display: inline-block; }
.post { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.post:last-child { border-bottom: 0; }
.post-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.post-comments { margin: 10px 0 0 40px; display: grid; gap: 6px; }
.post-comment { background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person { display: flex; gap: 12px; align-items: flex-start; }
.dept-tree ul { list-style: none; margin: 0; padding-left: 18px; border-left: 1px solid var(--line); }
.dept-tree > ul { padding-left: 0; border-left: 0; }
.dept-tree li { padding: 4px 0; }
.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 220px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--line-soft); border-radius: 4px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--c, var(--accent)); border-radius: 4px; min-width: 2px; }
.bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }
.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--line-soft); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
pre.code { padding: 10px 12px; white-space: pre-wrap; }
.doc-sheet { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 48px 56px; max-width: 820px; line-height: 1.6; font-size: 15px; overflow-wrap: anywhere; }
.doc-table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.doc-table td, .doc-table th { border: 1px solid #999; padding: 5px 8px; text-align: left; }

@media (max-width: 1100px) {
    .detail, .cols, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side { position: fixed; z-index: 50; left: 0; width: 250px; transform: translateX(-100%); transition: transform .18s; }
    .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
    .burger { display: block; }
    .top { padding: 8px 12px; }
    .content { padding: 14px 12px 60px; }
    .user-name { display: none; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .chat { grid-template-columns: minmax(0, 1fr); height: auto; }
    .chat-list { max-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
    .chat-msgs { min-height: 300px; }
    .cal-day { min-height: 70px; }
    .doc-sheet { padding: 20px; }
}
@media print {
    .side, .top, .page-head .head-actions, .flash, .no-print { display: none !important; }
    .shell { display: block; }
    .content { padding: 0; }
    .doc-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
    body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Публичные страницы: формы, сайт, магазин, запись, подписание ---------- */
.pub { background: #f6f7f4; }
.pub-top { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 0; font-weight: 650; font-size: 16px; }
.pub-wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
main.pub-wrap { padding-top: 24px; padding-bottom: 60px; }
.pub.embed { background: transparent; }
.pub.embed main.pub-wrap { padding: 0; }
.pub-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 24px; max-width: 480px; margin: 0 auto; box-shadow: var(--shadow); }
.pub-card h1 { margin-bottom: 14px; }
.pub-form { display: grid; gap: 12px; position: relative; }
.pub-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 550; }
.pub-form label.check { display: flex; color: var(--ink); }
.pub-check { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-size: 28px; margin: 0 auto 12px; }
.pub-hero { text-align: center; padding: 48px 0 40px; }
.pub-hero h1 { font-size: 36px; margin-bottom: 12px; }
.pub-hero p { font-size: 17px; color: var(--muted); max-width: 640px; margin: 0 auto 20px; }
.pub-hero .btn { padding: 11px 22px; font-size: 15px; }
.pub-section { padding: 24px 0; font-size: 15px; line-height: 1.6; }
.pub-section h2 { font-size: 22px; }
.pub-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pub-product { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 6px; align-content: start; }
.pub-price { font-size: 18px; font-weight: 650; }
.pub-slots { display: flex; flex-wrap: wrap; gap: 6px; }
.pub-slots label { display: block; cursor: pointer; }
.pub-slots input { position: absolute; opacity: 0; }
.pub-slots span { display: block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-weight: 550; }
.pub-slots input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pub-slots input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.tabs { overflow-y: hidden; }
