:root {
  --bg: #F3F4F6; --panel: #FFFFFF; --line: #E3E5EA; --line-soft: #EEF0F3;
  --text: #15171C; --muted: #4A505C; --muted2: #5B616E;
  --accent: #2B50D6; --accent-dark: #1E3BA8; --accent-soft: #E8EDFC; --accent-bg: #F5F7FE;
  --green: #23753A; --green-text: #1E6B34; --green-soft: #E6F4EA; --green-card: #EAF6EC; --green-border: #BFE3C8;
  --yellow: #F2C94C; --yellow-text: #7A5300; --yellow-soft: #FFF3CD; --yellow-card: #FFF6DB; --yellow-border: #EED78E;
  --red: #C92A2A; --red-text: #A61B1B; --red-soft: #FCE4E4; --red-card: #FDEAEA; --red-border: #F0BBBB;
  --orange-soft: #FDEBDC; --orange-text: #8A3B00;
  --side: #15171C; --side-text: #C9CDD6; --side-active: #2A2E37;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
a { color: var(--accent); } a:hover { color: var(--accent-dark); }
h1 { margin: 0; font-size: 26px; font-weight: 600; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.muted { color: var(--muted); } .small { font-size: 13px; } .xs { font-size: 12px; }

.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 220px; max-width: 260px; background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.brand b { color: #fff; display: block; font-size: 15px; } .brand span { font-size: 12px; color: #8D93A0; }
.side a.nav { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; }
.side a.nav.active, .side a.nav:hover { background: var(--side-active); color: #fff; }
.side .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.side .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6B7280; padding: 14px 12px 4px; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--side-active); font-size: 13px; }
.side-foot b { color: #fff; font-weight: 500; display: block; } .side-foot span { color: #8D93A0; font-size: 12px; }
.side-foot a { color: #8D93A0; font-size: 12px; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 760px) { .side { max-width: none; } .main { padding: 18px 16px 40px; } }

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.grow { flex: 999 1 520px; min-width: 0; } .aside { flex: 1 1 320px; min-width: 0; }
.sticky { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.wrap-any { overflow-wrap: anywhere; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.panel.tight { padding: 0; overflow: hidden; }
.panel h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted2); text-transform: uppercase; letter-spacing: .04em; }
.kv { display: flex; justify-content: space-between; gap: 12px; } .kv > span:first-child { color: var(--muted2); }

.flash { padding: 12px 14px; border-radius: 10px; background: var(--green-soft); color: var(--green-text); }
.flash.error { background: var(--red-soft); color: var(--red-text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.ghost { background: #fff; color: var(--text); border-color: #D5D8DE; } .btn.ghost:hover { background: var(--bg); color: var(--text); }
.btn.green { background: var(--green); border-color: var(--green); } .btn.green:hover { background: #1B5E2E; }
.btn.outline-green { background: #fff; color: var(--green); border-color: var(--green); }
.btn.danger { background: #fff; color: var(--red-text); border-color: #D5D8DE; }
.linkbtn { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

input[type=text], input[type=search], input[type=number], input[type=date], select, textarea { font: inherit; height: 40px; border: 1px solid #D5D8DE; border-radius: 8px; padding: 0 12px; background: #fff; color: var(--text); width: 100%; }
textarea { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted2); }
label.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; color: var(--text); cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.option input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.option b { display: block; font-size: 14px; } .option span { font-size: 13px; color: var(--muted); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 12px; max-height: 300px; overflow-y: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.filters > label.field { flex: 1 1 150px; } .filters > label.field.wide { flex: 2 1 220px; }

.tabs { display: flex; background: #E6E8EC; border-radius: 9px; padding: 3px; }
.tabs a { padding: 7px 16px; border-radius: 7px; color: var(--muted); text-decoration: none; }
.tabs a.on { background: #fff; color: var(--text); font-weight: 500; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.switch i { position: relative; width: 36px; height: 20px; border-radius: 10px; background: #D3D7DE; flex: none; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.period-range input[type=date] { width: auto; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 13px; color: var(--text); background: var(--panel); }
.period-range.on input[type=date] { border-color: var(--accent); }
.switch.on { color: var(--text); } .switch.on i { background: var(--accent); } .switch.on i::after { left: 18px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills a { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid #D5D8DE; background: #fff; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; }
.pills a.on { background: var(--text); color: #fff; border-color: var(--text); }

.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; white-space: nowrap; }
.tag.am { background: var(--orange-soft); color: var(--orange-text); }
.tag.gray { background: #EEF0F4; color: #2C313A; }
.pill { display: inline-flex; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 10px; background: #EEF0F4; color: #2C313A; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green-text); } .pill.yellow { background: var(--yellow-soft); color: var(--yellow-text); }
.pill.red { background: var(--red-soft); color: var(--red-text); } .pill.blue { background: var(--accent-soft); color: var(--accent-dark); }
.pill.dark { background: var(--text); color: #fff; } .pill.orange { background: var(--orange-soft); color: var(--orange-text); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted2); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr.sel td { background: var(--accent-bg); } tr.off td { opacity: .6; }
.scroll { overflow-x: auto; }
.num { text-align: right; } .nowrap { white-space: nowrap; }

/* Доска */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); align-items: center; }
.sq { width: 12px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: 6px; }
.board { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.column { flex: 1 1 300px; min-width: 0; background: #E9EBEF; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.count { font-size: 13px; color: var(--muted); background: #fff; border-radius: 10px; padding: 2px 9px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.age-green { background: var(--green-card); border-color: var(--green-border); }
.card.age-yellow { background: var(--yellow-card); border-color: var(--yellow-border); }
.card.age-red { background: var(--red-card); border-color: var(--red-border); }
.card .age { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 10px; }
.card.age-green .age { background: var(--green); color: #fff; }
.card.age-yellow .age { background: var(--yellow); color: #3D2A00; }
.card.age-red .age { background: var(--red); color: #fff; }
.card a.title { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.card a.title b { font-size: 15px; } .card a.title span { font-size: 13px; color: var(--muted); }
.card .meta { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.card .foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 10px; gap: 8px; }
.empty { font-size: 13px; color: var(--muted2); padding: 8px 6px; }

/* Карточка */
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; text-decoration: none; color: var(--text); }
.prose { font-size: 15px; line-height: 1.55; white-space: pre-wrap; margin: 0; }
.log-item { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.log-item time { flex: 0 0 100px; font-size: 13px; color: var(--muted2); }
.diff-old { color: var(--red-text); text-decoration: line-through; font-size: 13px; white-space: pre-wrap; }
.diff-new { color: var(--green-text); font-size: 13px; white-space: pre-wrap; }
.diff { font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.diff del { background: var(--red-soft); color: var(--red-text); text-decoration: line-through; border-radius: 3px; padding: 0 2px; }
.diff ins { background: var(--green-soft); color: var(--green-text); text-decoration: none; border-radius: 3px; padding: 0 2px; }
.diff .diff-gap { color: var(--muted2); padding: 0 4px; }
.diff-full { font-size: 12px; }
.diff-full summary { cursor: pointer; color: var(--muted2); }
.diff-full .diff-old, .diff-full .diff-new { display: block; margin-top: 4px; }
.close-panel { border: 2px solid var(--accent); }
.stat { flex: 1 1 0; background: var(--bg); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 18px; }

/* Дашборд */
.big { font-size: 46px; font-weight: 600; line-height: 1; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: #EEF0F4; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .panel { max-width: 420px; width: 100%; padding: 32px; gap: 16px; text-align: center; align-items: center; }
details > summary { cursor: pointer; color: var(--accent); }
.hidden { display: none !important; }
