/* Шрифтове – локално, без интернет (лиценз SIL OFL). */
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-sans-cyrillic-400-normal.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-400-normal.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: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-sans-cyrillic-500-normal.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-500-normal.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: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/ibm-plex-sans-cyrillic-600-normal.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-600-normal.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: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-mono-cyrillic-400-normal.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-400-normal.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: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-mono-cyrillic-500-normal.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-500-normal.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: 'PT Serif'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/pt-serif-cyrillic-700-normal.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'PT Serif'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/pt-serif-latin-700-normal.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: 'PT Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/pt-serif-cyrillic-400-italic.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'PT Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/pt-serif-latin-400-italic.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; }

/* Цветове и шрифтове. Тъмната тема се включва според настройката на Windows. */
:root {
  --bg: #eef1f0; --surface: #ffffff; --ink: #17211f; --muted: #5e6a67; --line: #d6dcda;
  --accent: #1f5c55; --accent-ink: #ffffff; --accent-soft: #e0edea;
  --rail: #173f3a; --rail-ink: #d9e8e5; --rail-hi: #24594f;
  --L0: #5e6a67; --L1: #4a5a8a; --L2: #9a6a00; --L3: #b23a2a; --L4: #7a1530;
  --ok: #2f7a3e; --warn: #a36a00; --bad: #b23a2a; --chip: #edf0ef;
  --shadow: 0 10px 40px -12px rgba(10,30,25,.35);
  --f-brand: "PT Serif", Georgia, serif;
  --f-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1514; --surface: #182120; --ink: #e3eae8; --muted: #93a19d; --line: #2b3735;
    --accent: #6fbfb4; --accent-ink: #0d1b19; --accent-soft: #1d3330; --rail: #0b1110; --rail-ink: #c4d6d2; --rail-hi: #1d3330;
    --L0: #93a19d; --L1: #9fb0e6; --L2: #e2b450; --L3: #f2806d; --L4: #f28eaa; --ok: #70c883; --warn: #e2b450; --bad: #f2806d;
    --chip: #22302d; --shadow: 0 10px 40px -12px rgba(0,0,0,.7); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shell { display: grid; grid-template-columns: 236px 1fr; height: 100%; }
.shell > * { min-width: 0; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border: 1.5px solid currentColor; border-radius: 3px; display: grid; place-items: center; font-family: var(--f-brand); font-weight: 700; font-size: 15px; }
.brand b { font-family: var(--f-brand); font-size: 16px; display: block; line-height: 1.1; }
.brand small { opacity: .65; font-size: 11px; }
.rail .grp { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .55; padding: 14px 18px 4px; }
.rail a.nav { display: flex; justify-content: space-between; margin: 1px 8px; padding: 7px 10px; border-radius: 5px; color: inherit; text-decoration: none; }
.rail a.nav:hover { background: var(--rail-hi); }
.rail a.nav.on { background: var(--rail-hi); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.rail-foot { margin-top: auto; padding: 14px 18px; font-size: 11.5px; opacity: .7; border-top: 1px solid rgba(255,255,255,.08); }
.rail-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #5fd17a; margin-right: 6px; }

.work { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.crumbs { font-size: 13px; color: var(--muted); flex: 1; min-width: 160px; }
.crumbs b { color: var(--ink); font-weight: 600; }
.user { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.banner { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); padding: 6px 20px; font-size: 13px; border-bottom: 1px solid var(--line); }
.content { flex: 1; overflow-y: auto; padding: 20px 20px 40px; }
h1.page { font-size: 21px; font-weight: 600; margin: 0 0 4px; text-wrap: balance; }
.sub { color: var(--muted); margin: 0 0 16px; max-width: 90ch; }
h2.sec { font-size: 15px; margin: 22px 0 8px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.bar .grow, .grow { flex: 1; }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 6px 12px; cursor: pointer; font-size: 13px; white-space: nowrap; color: var(--ink); text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.inp { border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 6px 10px; font-size: 13px; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.card-h { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.card-b { padding: 14px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid > * { min-width: 0; }
.kpi { padding: 14px; }
.kpi .n { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .t { color: var(--muted); font-size: 12.5px; }

.tw { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--bg); white-space: nowrap; }
th a { color: inherit; text-decoration: none; }
th a.on { color: var(--accent); }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.nw { white-space: nowrap; }
.late { color: var(--bad); font-weight: 600; }
.empty { text-align: center; padding: 24px; color: var(--muted); }

.stamp { display: inline-block; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; padding: 1px 6px; border: 1.5px solid currentColor; border-radius: 2px; white-space: nowrap; font-weight: 500; }
.L0 { color: var(--L0); } .L1 { color: var(--L1); } .L2 { color: var(--L2); } .L3 { color: var(--L3); } .L4 { color: var(--L4); }
.pill { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: var(--chip); white-space: nowrap; margin: 1px; }
.p-ok { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--ok); }
.p-bad { background: color-mix(in srgb, var(--bad) 13%, var(--surface)); color: var(--bad); }
.p-warn { background: color-mix(in srgb, var(--warn) 17%, var(--surface)); color: var(--warn); }
.p-acc { background: var(--accent-soft); color: var(--accent); }

.note { font-size: 12.5px; background: var(--accent-soft); color: var(--accent); padding: 9px 11px; border-radius: 5px; }
.note.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--warn); }
.note.err { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad); }
.flash { margin-bottom: 14px; }

/* Страници за въвеждане */
.formpage { max-width: 860px; }
.fsec { display: grid; grid-template-columns: 220px 1fr; gap: 16px; padding: 18px; border-bottom: 1px solid var(--line); }
.fsec > * { min-width: 0; }
.fsec-h b { display: block; font-size: 14px; }
.fsec-h span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.fsec-b { display: grid; gap: 12px; }
.factions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; background: var(--bg); border-radius: 0 0 7px 7px; }
.fl { display: grid; gap: 4px; }
.fl > span { font-size: 12px; color: var(--muted); }
.fl .inp { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.field-err { color: var(--bad); font-size: 12px; }
.accrow b { white-space: nowrap; }
.accrow { display: grid; grid-template-columns: 1fr auto 220px; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; }

/* Настройки */
.set-layout { display: grid; grid-template-columns: 210px 1fr; gap: 16px; }
.set-layout > * { min-width: 0; }
.set-nav { display: grid; gap: 2px; align-content: start; padding: 6px; }
.set-nav a { padding: 7px 10px; border-radius: 5px; color: var(--ink); text-decoration: none; }
.set-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.set { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.set:last-child { border-bottom: 0; }
.set .t { font-weight: 600; }
.set .d { color: var(--muted); font-size: 12.5px; max-width: 70ch; }
.set .c { grid-row: 1 / span 2; grid-column: 2; align-self: center; }

/* Вход и избор на регистратура */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--rail); }
.login.chooser { place-items: start center; }
.login .box { background: var(--surface); border-radius: 9px; width: min(420px, 100%); padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.choosebox { width: min(920px, 100%); padding-block: 40px; display: grid; gap: 14px; color: var(--rail-ink); }
.choosebox h1 { font-size: 24px; margin: 10px 0 0; color: #fff; }
.choosesub { margin: 0; opacity: .8; max-width: 70ch; }
.reggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 6px; }
.regcard { display: grid; gap: 8px; align-content: start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 18px; min-height: 150px; text-decoration: none; }
a.regcard:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.regcard.off { opacity: .62; }
.regcard.add { background: transparent; color: var(--rail-ink); border: 1.5px dashed rgba(255,255,255,.35); place-content: center; text-align: center; }
.regcard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.regname { font-family: var(--f-brand); font-size: 22px; font-weight: 700; }
.regmeta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; font-size: 12.5px; }
.choosefoot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; margin-top: 10px; }
.choosefoot .btn { color: var(--ink); }
.userpick { display: grid; gap: 6px; }
.userpick button { text-align: left; display: flex; justify-content: space-between; gap: 8px; }

.help { max-width: 75ch; }
.help h2 { font-size: 16px; margin: 22px 0 6px; }
.help li + li { margin-top: 4px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .rail .grp, .rail-foot, .brand small, .brand b { display: none; }
  .rail a.nav { margin: 6px 2px; white-space: nowrap; }
  .set-layout, .row2, .fsec { grid-template-columns: 1fr; }
  .set { grid-template-columns: 1fr; } .set .c { grid-row: auto; grid-column: 1; }
  .accrow { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* Етап 3: раздели, камбанка */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.bell { position: relative; text-decoration: none; font-size: 17px; padding: 4px 6px; border-radius: 6px; filter: grayscale(1); opacity: .7; }
.bell.on { filter: none; opacity: 1; }
.bell .badge { position: absolute; top: -4px; right: -6px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 600; border-radius: 9px; padding: 0 5px; line-height: 16px; font-family: inherit; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.card-h .grow { flex: 1; }
table.dense th, table.dense td { padding: 7px 9px; }
table.dense td { font-size: 13px; }
