/* DSN — vizuālais stils */

/* 1. Dizaina mainīgie */

:root {
    color-scheme: light;

    --zila-950: #0b2734;
    --zila-900: #12384a;
    --zila-800: #1b4d63;
    --zila-700: #24657f;
    --zila-600: #2f7f9d;
    --zila-500: #4b9fbd;
    --zila-400: #68afca;
    --zila-300: #86c2dc;
    --zila-200: #b8dbea;
    --zila-100: #e5f3f8;
    --zila-050: #f3f9fb;

    --ink: #17252d;
    --ink-soft: #52646d;
    --ink-faint: #566870;
    --line: #cbd7dc;
    --line-soft: #dde6e9;
    --control-border: #6f838c; /* ievades lauku robeža ≥ 3:1 (WCAG 1.4.11) */
    --bg: #eef3f5;
    --surface: #ffffff;
    --surface-2: #f8fafb;
    --surface-3: #f1f5f7;

    --ok: #26734d;
    --ok-bg: #e8f5ee;
    --warn: #8a5b00;
    --warn-bg: #fff4d6;
    --err: #a32929;
    --err-bg: #fdecec;
    --info: #245f88;
    --info-bg: #e8f3fb;
    --neutral: #52646d;
    --neutral-bg: #edf1f3;

    /* Savietojamības aizstājvārdi ar iepriekšējiem mainīgajiem */
    --forest: var(--zila-700);
    --forest-dk: var(--zila-900);
    --gold: #b8860b;
    --gold-soft: #d4a72c;
    --maxw: 1560px;

    /* Source Sans 3 — no paša servera (fonts/fonts.css, latin + latin-ext); pārējie — rezerve, ja fonta fails nav ielādējies. */
    --font-head: "Source Sans 3", "Segoe UI", "Noto Sans", Arial, sans-serif;
    --font-base: "Source Sans 3", "Segoe UI", "Noto Sans", Arial, sans-serif;

    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;

    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgb(18 56 74 / 6%);
    --shadow-md: 0 8px 24px rgb(18 56 74 / 12%);
    --shadow-lg: 0 18px 46px rgb(18 56 74 / 18%);

    --header-h: 64px;
    --rail-w: 268px;
    --anim-fast: 120ms ease;
    --anim: 200ms ease;
}

/* 2. Pamata atiestatīšana */

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; font-size: 16px; scroll-behavior: smooth; }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-base);
    font-size: 0.875rem;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }

a { color: var(--zila-700); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--zila-900); }

hr { margin: var(--sp-6) 0; border: 0; border-top: 1px solid var(--line-soft); }

:focus-visible { outline: 3px solid var(--zila-700); outline-offset: 2px; }

[hidden] { display: none !important; }

/* 3. Tipogrāfija */

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { color: var(--zila-950); line-height: 1.25; font-family: var(--font-head); }

h1 { margin-bottom: var(--sp-3); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { margin-bottom: var(--sp-4); font-size: 1.375rem; font-weight: 700; }
h3 { margin-bottom: var(--sp-3); font-size: 1.125rem; font-weight: 650; }
h4 { margin-bottom: var(--sp-2); font-size: 1rem; font-weight: 650; }
p { margin-bottom: var(--sp-4); }

.muted { color: var(--ink-soft); }
.small { font-size: 0.8125rem; }
.text-center { text-align: center; }

/* 4. Izkārtojums */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
#app { width: 100%; max-width: var(--maxw); margin: 0 auto; }
#app > h1:first-child, .card-head:first-child { margin-top: 0; }

.hidden { display: none !important; }

.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.spacer { flex: 1 1 auto; }

.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 5. Sanjosla, galvene un navigacija */

.shell {
    display: grid;
    grid-template-columns: var(--rail-w) 1fr;
    min-height: 100vh;
}

.shell:has(#topbar.hidden) {
    grid-template-columns: 1fr;
}
.shell:has(#topbar.hidden) .sidebar,
.shell:has(#topbar.hidden) .sidebar-backdrop {
    display: none;
}

.main-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 110;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(180deg, var(--zila-950), var(--zila-900) 60%, var(--zila-900));
    color: var(--zila-100);
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--sp-4) var(--sp-3) var(--sp-6);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0 var(--sp-3);
    border-radius: var(--radius);
    color: var(--zila-200);
    font-weight: 550;
    text-decoration: none;
    transition: background var(--anim-fast), color var(--anim-fast);
}

.sidebar-link svg { flex: none; width: 18px; height: 18px; opacity: .9; }

.sidebar-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-link.active { background: var(--zila-700); color: #fff; }

.sidebar-group { display: flex; flex-direction: column; }

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 42px;
    padding: 0 var(--sp-3);
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--zila-200);
    font: inherit;
    font-weight: 550;
    text-align: left;
    transition: background var(--anim-fast), color var(--anim-fast);
}

.sidebar-group-toggle svg.ico { flex: none; width: 18px; height: 18px; opacity: .9; }
.sidebar-group-toggle .chev { margin-left: auto; width: 14px; height: 14px; opacity: .7; transition: transform var(--anim-fast); }
.sidebar-group.open .sidebar-group-toggle .chev { transform: rotate(90deg); }

.sidebar-group-toggle:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-group.has-active .sidebar-group-toggle { color: #fff; }

.sidebar-group-body {
    display: none;
    flex-direction: column;
    padding: 2px 0 6px 20px;
}
.sidebar-group.open .sidebar-group-body { display: flex; }

.sidebar-group-body a {
    display: block;
    padding: 8px var(--sp-3);
    border-radius: var(--radius-sm);
    color: var(--zila-300);
    font-size: 0.85rem;
    text-decoration: none;
}
.sidebar-group-body a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-group-body a.active { background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 650; }

.sidebar-sub-header {
    margin-top: 8px;
    padding: 6px var(--sp-3) 2px;
    color: var(--zila-400);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.sidebar-sub-header:first-child { margin-top: 0; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 105;
    background: rgba(11, 39, 52, 0.45);
}

.topbar {
    position: sticky;
    z-index: 100;
    top: 0;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: var(--header-h);
    padding: 0 var(--sp-6);
    border-bottom: 1px solid var(--line-soft);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    display: none;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-soft);
}
.sidebar-toggle svg { width: 19px; height: 19px; }
.sidebar-toggle:hover { background: var(--surface-3); }

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-left: auto;
}

.menu-pop { position: relative; }

.menu-pop-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 4px 10px 4px 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--ink);
    font: inherit;
}
.menu-pop-toggle:hover, .menu-pop-toggle.active { background: var(--surface-3); border-color: var(--line-soft); }

.menu-pop-toggle .chev { width: 13px; height: 13px; color: var(--ink-faint); }

.menu-avatar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--zila-700);
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
}

.menu-pop-who { line-height: 1.15; text-align: left; }
.menu-pop-who b { display: block; font-size: 0.82rem; color: var(--ink); }
.menu-pop-who small { display: block; color: var(--ink-faint); font-size: 0.72rem; font-weight: 500; }

.menu-pop-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 200;
    display: none;
    flex-direction: column;
    min-width: 240px;
    padding: var(--sp-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}
.menu-pop.open .menu-pop-panel { display: flex; }

.menu-pop-header {
    padding: var(--sp-2) var(--sp-3) 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.menu-pop-panel button.role-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: var(--sp-2) var(--sp-3);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    width: 100%;
}
.menu-pop-panel button.role-option:hover { background: var(--zila-050); }
.menu-pop-panel button.role-option.active { background: var(--zila-100); color: var(--zila-900); font-weight: 650; }
.menu-pop-panel button.role-option .check { color: var(--zila-700); }

.menu-pop-divider { margin: 4px 6px; border-top: 1px solid var(--line-soft); }

.menu-pop-panel a.menu-pop-item {
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    color: var(--ink);
    text-decoration: none;
}
.menu-pop-panel a.menu-pop-item:hover { background: var(--zila-050); color: var(--zila-900); }

/* 6. Kartītes */

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-5);
    border-bottom: 1px solid var(--line-soft);
}

.card-head h3 { margin: 0; font-size: 1.125rem; }

.card-pad { padding: var(--sp-5); }

.stat {
    padding: var(--sp-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-accent { border-top: 3px solid var(--zila-600); }

.stat-num {
    margin: var(--sp-2) 0;
    color: var(--zila-900);
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 750;
    line-height: 1.1;
}

.stat-label { color: var(--ink-soft); font-weight: 600; }

/* 7. Pogas */

.btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0 var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--anim-fast), border-color var(--anim-fast), color var(--anim-fast), transform var(--anim-fast);
}

.btn:hover { border-color: var(--zila-500); background: var(--zila-050); color: var(--zila-900); }
.btn:active { transform: translateY(1px); }

.btn-primary { border-color: var(--zila-700); background: var(--zila-700); color: #fff; }
.btn-primary:hover { border-color: var(--zila-900); background: var(--zila-800); color: #fff; }

.btn-gold { border-color: var(--gold); background: var(--gold); color: #fff; }
.btn-gold:hover { border-color: #8a6608; background: #a5790b; color: #fff; }

.btn-danger { border-color: var(--err); background: var(--surface); color: var(--err); }
.btn-danger:hover { background: var(--err-bg); color: #791c1c; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--zila-700); }
.btn-ghost:hover { background: var(--zila-050); border-color: transparent; }

.btn-sm { min-height: 32px; padding: 0 var(--sp-3); font-size: 0.8125rem; }

.btn:disabled { border-color: var(--line-soft); background: var(--surface-3); color: var(--ink-faint); opacity: .8; pointer-events: none; }

/* 8. Formas */

.field { margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }

.field label {
    display: inline-block;
    margin-bottom: var(--sp-2);
    color: var(--ink);
    font-weight: 600;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.field-hint { margin-top: var(--sp-2); color: var(--ink-soft); font-size: 0.8125rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="time"], input:not([type]),
select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 0 var(--sp-3);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    outline: 0;
    background: var(--surface);
    color: var(--ink);
    transition: border-color var(--anim-fast), box-shadow var(--anim-fast), background var(--anim-fast);
}

textarea { min-height: 96px; padding-top: var(--sp-3); padding-bottom: var(--sp-3); resize: vertical; }

input:hover, select:hover, textarea:hover { border-color: var(--zila-700); }
input:focus, select:focus, textarea:focus {
    border-color: var(--zila-700);
    box-shadow: 0 0 0 3px rgb(36 101 127 / 18%);
}

input::placeholder, textarea::placeholder { color: var(--ink-faint); }

input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--ink-soft); }

input[type="checkbox"], input[type="radio"] {
    width: 24px;  /* WCAG 2.5.8 — mērķis vismaz 24×24 px */
    height: 24px;
    margin: 0;
    accent-color: var(--zila-700);
    flex-shrink: 0;
}

/* 9. Tabulas */

.table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }

.table th, .table td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

.table th {
    background: var(--surface-3);
    color: var(--zila-950);
    font-size: 0.8125rem;
    font-weight: 700;
}

.table tbody tr:hover { background: var(--zila-050); }
.table tr:last-child td { border-bottom: 0; }

/* 10. Statusa nozīmītes (badge) */

.badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.badge-planning { border-color: #c4cfd4; background: var(--neutral-bg); color: var(--neutral); }
.badge-self { border-color: #b6d5e7; background: var(--info-bg); color: var(--info); }
.badge-manager { border-color: #b6d5e7; background: var(--info-bg); color: var(--info); }
.badge-interview { border-color: #e4c56c; background: var(--warn-bg); color: var(--warn); }
.badge-approval { border-color: #e4c56c; background: var(--warn-bg); color: var(--warn); }
.badge-approved { border-color: #acd2bc; background: var(--ok-bg); color: var(--ok); }
.badge-contested { border-color: #e3b1b1; background: var(--err-bg); color: var(--err); }
.badge-360_collecting { border-color: #b6d5e7; background: var(--info-bg); color: var(--info); }
.badge-360_ready { border-color: #e4c56c; background: var(--warn-bg); color: var(--warn); }
/* Parakstīšanas statuss (apstiprinātām anketām) */
.badge-sign-awaiting { border-color: #e4c56c; background: var(--warn-bg); color: var(--warn); }
.badge-sign-partial { border-color: #b6d5e7; background: var(--info-bg); color: var(--info); }
.badge-sign-signed { border-color: #acd2bc; background: var(--ok-bg); color: var(--ok); }
.sign-party { display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid var(--line-soft); }
.sign-party:last-child { border-bottom:none; }
.sign-mark { width:22px; height:22px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:.8rem; font-weight:700; border:1px solid var(--line); color:var(--ink-soft); flex:none; }
.sign-mark.ok { background: var(--ok-bg); border-color:#acd2bc; color: var(--ok); }
.doc-hash { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size:.72rem; color: var(--ink-soft); word-break: break-all; }

.grade-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    color: #fff;
}
.grade-A { background: var(--ok); }
.grade-B { background: #4ca677; }
.grade-C { background: #c8992e; }
.grade-D { background: #d6883a; }
.grade-E { background: var(--err); }

.total-A { background: linear-gradient(135deg, #14603d, #1c7d54) !important; }
.total-B { background: linear-gradient(135deg, #2d7a4f, #4ca677) !important; }
.total-C { background: linear-gradient(135deg, #a8842a, #c8992e) !important; }
.total-D { background: linear-gradient(135deg, #b5702a, #d6883a) !important; }
.total-E { background: linear-gradient(135deg, #9a3f30, #c0523f) !important; }

/* 11. Paziņojumi (alert) */

.alert {
    display: block;
    margin-bottom: var(--sp-4);
    padding: var(--sp-4);
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: var(--surface);
    line-height: 1.6;
}

.alert-ok { border-color: #acd2bc; border-left-color: var(--ok); background: var(--ok-bg); }
.alert-warn { border-color: #e4c56c; border-left-color: var(--warn); background: var(--warn-bg); }
.alert-err { border-color: #e3b1b1; border-left-color: var(--err); background: var(--err-bg); }
.alert-info { border-color: #b6d5e7; border-left-color: var(--info); background: var(--info-bg); }

/* 12. Toast */

.toast-stack {
    position: fixed;
    z-index: 1000;
    /* zem augšējās joslas — lai paziņojums nenosedz lomu pārslēgu, zvaniņu un lietotāja izvēlni */
    top: 76px;
    right: var(--sp-5, 20px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--sp-2, 8px);
    max-width: min(480px, calc(100vw - 40px));
    pointer-events: none;
}

.toast {
    margin: 0;
    padding: var(--sp-3) var(--sp-4);
    width: fit-content;
    max-width: 100%;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in var(--anim);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Rindas izcelšana pēc labošanas (piem., Lietotāji) */
.table tr.row-flash > td { animation: row-flash 1.8s ease-out; }
@keyframes row-flash {
    from { background: rgba(212, 167, 44, .28); }
    to { background: transparent; }
}

/* 13. Struktūras koks */

.tree { margin: 0; padding: 0; list-style: none; }
.tree ul { margin: 0; padding: 0 0 0 24px; list-style: none; }

.tree-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 48px;
    margin: 3px 0;
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color var(--anim-fast), background var(--anim-fast);
}

.tree-node:hover { border-color: var(--zila-200); background: var(--zila-050); }

.unit-header { cursor: pointer; }
.expand-icon { color: var(--zila-700); }

/* 14. Vērtēšanas skala */

.scale { display: flex; gap: var(--sp-2); }

.scale button {
    display: grid;
    min-width: 46px;
    min-height: 46px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-weight: 650;
    cursor: pointer;
    transition: border-color var(--anim-fast), background var(--anim-fast), color var(--anim-fast);
}

.scale button:hover { border-color: var(--zila-400); }
.scale button.on {
    border-color: var(--zila-700);
    background: var(--zila-100);
    color: var(--zila-900);
    box-shadow: 0 0 0 2px rgb(36 101 127 / 14%);
}

/* 15. Kājene */

.app-footer {
    text-align: center;
    padding: 20px 24px 28px;
    color: var(--ink-soft);
    font-size: .82rem;
    border-top: 1px solid var(--line);
    margin-top: 20px;
}
.app-footer strong { color: var(--forest); font-weight: 600; }

/* 16. Drukas skats */

@media print {
    .sidebar, .topbar, .app-footer, .btn, .menu-pop, #app { display: none !important; }
    body { background: #fff; font-size: 11pt; }
}

/* 17. Responsīvais dizains */

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar-toggle { display: flex; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(var(--rail-w), 84vw);
        transform: translateX(-100%);
        transition: transform var(--anim);
        box-shadow: var(--shadow-lg);
    }
    /* Aizvērta izvēlne ārpus ekrāna nedrīkst saņemt tastatūras fokusu (WCAG 2.4.3, 2.4.11). */
    .sidebar:not(.open) { visibility: hidden; transition: transform var(--anim), visibility 0s linear var(--anim); }
    .sidebar.open { transform: translateX(0); visibility: visible; transition: transform var(--anim), visibility 0s; }
    .sidebar.open ~ .sidebar-backdrop { display: block; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
    /* Platas tabulas šaurā ekrānā ritinās pašas, nevis visa lapa. */
    table.table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Virsraksta pogu rindas un struktūras koka pogas pārnesas jaunā rindā. */
    .card-head { flex-wrap: wrap; gap: var(--sp-2); }
    .row { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .btn { width: 100%; }
    .card-pad { padding: var(--sp-4); }
}

/* 18. Samazināta kustība */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* 19. Definīciju bloks (kompetenču/kritēriju definīcijas) */

.definicija-bloks {
    margin: var(--sp-3) 0 var(--sp-4);
    padding: var(--sp-3);
    border-left: 4px solid var(--zila-500);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--zila-050);
    color: var(--ink);
    font-size: 0.875rem;
}
.definicija-bloks strong { color: var(--zila-900); }

/* 20. Sakumlapa (hero, atro darbibu kartites, cikla laika skala) */

.hero {
    position: relative;
    overflow: hidden;
    margin-bottom: var(--sp-6);
    padding: var(--sp-6) var(--sp-8);
    border-radius: var(--radius-lg);
    background: linear-gradient(120deg, var(--zila-900) 0%, var(--zila-700) 62%, var(--zila-600) 100%);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.hero::before, .hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
}
.hero::before { width: 320px; height: 320px; right: -100px; top: -150px; }
.hero::after { width: 190px; height: 190px; right: 70px; bottom: -110px; background: rgba(255, 255, 255, 0.05); }

.hero-inner {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-6);
    flex-wrap: wrap;
}
.hero-eyebrow {
    margin-bottom: var(--sp-2);
    color: var(--zila-100);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.85;
}
.hero h1 { margin-bottom: 0; color: #fff; font-size: 1.6rem; }
.hero p.lead { margin: var(--sp-2) 0 0; color: var(--zila-100); font-size: 0.9rem; opacity: 0.92; }
.hero p.lead.nowrap { white-space: nowrap; }

.hero-stat {
    min-width: 168px;
    padding: var(--sp-3) var(--sp-5);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.12);
}
.hero-stat .num { font-family: var(--font-head); font-size: 1.8rem; font-weight: 750; line-height: 1; }
.hero-stat .lbl { margin-top: 4px; color: var(--zila-100); font-size: 0.78rem; opacity: 0.85; }

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}
.quick-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--anim-fast), transform var(--anim-fast);
}
.quick-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.quick-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
}
.quick-ico svg { width: 17px; height: 17px; }
.quick-card h3 { margin: 0; color: var(--ink); font-size: 0.9rem; }
.quick-card p { margin: 0; color: var(--ink-soft); font-size: 0.8rem; }

.cycle-card {
    margin-bottom: var(--sp-6);
    padding: var(--sp-5) var(--sp-6) var(--sp-5);
}
.cycle-top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: var(--sp-5);
}
.cycle-top h2 { margin: 0; font-size: 1.05rem; }
.cycle-top .period { color: var(--ink-faint); font-size: 0.8rem; }

.stepper { display: flex; align-items: flex-start; }
.step {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.step .line { position: absolute; top: 18px; left: -50%; z-index: 0; width: 100%; height: 2px; background: var(--line); }
.step:first-child .line { display: none; }
.step.done .line { background: var(--zila-500); }
.step .bead {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--ink-faint);
    font-size: 0.82rem;
    font-weight: 700;
    transition: transform .15s ease, box-shadow .15s ease;
}
.step.done { cursor: pointer; }
.step.done:hover .bead { transform: scale(1.12); box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.step.done:hover .lbl { color: var(--zila-700, var(--ink)); }
.step .bead.state-circle-planning { background: var(--neutral); color: #fff; }
.step .bead.state-circle-self,
.step .bead.state-circle-manager { background: var(--info); color: #fff; }
.step .bead.state-circle-interview,
.step .bead.state-circle-approval { background: var(--warn); color: #fff; }
.step .bead.state-circle-approved { background: var(--ok); color: #fff; }
.step .bead.state-circle-contested { background: var(--err); color: #fff; }
.step .bead.state-circle-360_collecting { background: var(--info); color: #fff; }
.step .bead.state-circle-360_ready { background: var(--warn); color: #fff; }
.step .lbl { max-width: 120px; margin-top: 9px; color: var(--ink); font-size: 0.85rem; font-weight: 650; transition: color .15s ease; }
.step .sub { margin-top: 2px; color: var(--ink-faint); font-size: 0.75rem; }

@media (max-width: 860px) {
    .stepper { flex-wrap: wrap; row-gap: var(--sp-5); }
    .step { flex-basis: 33%; }
}

/* Stāvokļu apļu rinda — koplietota Atskaišu sadaļās "Sadalījums pa stāvokļiem (kopā)" / "Sadalījums pa novērtēšanas kārtām" (sk. frontend/js/app.js stateCircleRow()). */
.state-circles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--sp-6) var(--sp-4); justify-items: center; }
.state-circle-item { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--sp-3) var(--sp-2); border-radius: var(--radius-lg, 14px); transition: background .15s ease; }
.state-circle-item.clickable { cursor: pointer; }
.state-circle-item.clickable:hover { background: var(--surface-2); }
.state-circle-item.clickable:hover .state-circle { transform: scale(1.08); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.state-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    transition: transform .15s ease, box-shadow .15s ease;
}
.state-circle.empty { background: var(--surface-3); color: var(--ink-faint); box-shadow: none; }
.state-circle-planning { background: var(--neutral); }
.state-circle-self, .state-circle-manager { background: var(--info); }
.state-circle-interview, .state-circle-approval { background: var(--warn); }
.state-circle-approved { background: var(--ok); }
.state-circle-contested { background: var(--err); }
.state-circle-360_collecting { background: var(--info); }
.state-circle-360_ready { background: var(--warn); }
.state-circle-item .lbl { max-width: 120px; margin-top: 9px; color: var(--ink); font-size: 0.82rem; font-weight: 650; }
.state-circle-item .sub { margin-top: 2px; color: var(--ink-faint); font-size: 0.72rem; }

@media (max-width: 860px) {
    .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .hero { padding: var(--sp-5); }
    .hero h1 { font-size: 1.3rem; }
    .hero p.lead.nowrap { white-space: normal; }
    .quick-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
}

/* 20. Kustība un interaktīvie grafiki (Sākums, Atskaites, Vadības dati) */

@keyframes mo-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes mo-pop { from { opacity: 0; transform: scale(0.4); } }
@keyframes mo-fade { from { opacity: 0; transform: scale(0.92); } }
@keyframes mo-grow-x { from { transform: scaleX(0); } }
@keyframes mo-arc { from { stroke-dasharray: 0 var(--C); } }
@keyframes mo-draw { from { stroke-dashoffset: 1; } }
@keyframes mo-area-in { from { opacity: 0; } }
@keyframes mo-drift { to { transform: translate(-26px, 18px) scale(1.08); } }
@keyframes mo-pulse { 0% { box-shadow: 0 0 0 0 rgba(75, 159, 189, 0.55); } 70%, 100% { box-shadow: 0 0 0 12px rgba(75, 159, 189, 0); } }

/* Lapas bloki parādās secīgi */
.mo-on > * { animation: mo-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--mo-i, 0) * 70ms); }
.mo-on > .quick-grid { animation: none; }
.mo-on .quick-card { animation: mo-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: calc(0.12s + var(--mo-i, 0) * 70ms); }

/* Hero fona apļi lēni dreifē */
.mo-on .hero::before { animation: mo-drift 16s ease-in-out infinite alternate; }
.mo-on .hero::after { animation: mo-drift 20s ease-in-out infinite alternate-reverse; }

/* Cikla soļi: līnija aug, apļi "uzlec" pa vienam; pašreizējais posms pulsē */
.mo-on .step.done .line { transform-origin: left center; animation: mo-grow-x 0.45s ease-out backwards; animation-delay: calc(var(--mo-s, 0) * 130ms + 250ms); }
.mo-on .step .bead { animation: mo-pop 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) backwards; animation-delay: calc(var(--mo-s, 0) * 130ms + 350ms); }
.mo-on .step.mo-current .bead { animation: mo-pop 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) backwards, mo-pulse 2.2s ease-out 1.4s infinite; animation-delay: calc(var(--mo-s, 0) * 130ms + 350ms), 1.4s; }

/* Atskaites: stāvokļu apļi */
.mo-on .state-circle { animation: mo-pop 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) backwards; animation-delay: calc(var(--mo-s, 0) * 70ms + 200ms); }

/* Līmeņu sadalījuma joslas aug no kreisās puses */
.mo-on .mo-seg { transform-origin: left center; animation: mo-grow-x 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--mo-i, 0) * 40ms + 300ms); }

/* Kompetenču karte: šūnas parādās pa diagonāli, rinda/kolonna izceļas pie peles */
.mo-on .an-cell { animation: mo-fade 0.4s ease backwards; animation-delay: calc(var(--mo-i, 0) * 14ms + 150ms); }
.an-map td, .an-map th { transition: box-shadow 0.12s ease, color 0.12s ease; }
.an-map td.mo-hl { box-shadow: inset 0 0 0 100px rgba(47, 127, 157, 0.1); }
.an-map th.mo-hl { color: var(--zila-700); box-shadow: inset 0 -3px 0 var(--zila-500); }

/* Mijiedarbība, kas strādā vienmēr */
.quick-ico { transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1); }
.quick-card:hover .quick-ico { transform: rotate(-7deg) scale(1.12); }
.stat { transition: transform var(--anim-fast), box-shadow var(--anim-fast); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Riņķa diagramma */
.mo-split { display: grid; grid-template-columns: minmax(260px, 400px) minmax(0, 1fr); gap: var(--sp-6); align-items: center; }
.mo-donut { display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); }
.mo-donut-svg { position: relative; width: 210px; max-width: 100%; }
.mo-donut-svg svg { display: block; width: 100%; height: auto; overflow: visible; }
.mo-donut-track { stroke: var(--surface-3); }
.mo-arc { cursor: pointer; outline: none; transition: opacity 0.15s ease, stroke-width 0.15s ease; }
.mo-arc:hover, .mo-arc:focus-visible { stroke-width: 31; }
.mo-arc:focus-visible { filter: drop-shadow(0 0 3px var(--ink)); }
.mo-arc.mo-dim { opacity: 0.28; }
.mo-on .mo-arc { animation: mo-arc 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--mo-i, 0) * 90ms + 200ms); }
.mo-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 38px;
    text-align: center;
    pointer-events: none;
}
.mo-donut-center b { font-family: var(--font-head); font-size: 1.9rem; font-weight: 750; line-height: 1.05; color: var(--zila-900); font-variant-numeric: tabular-nums; }
.mo-donut-center span { margin-top: 2px; color: var(--ink); font-size: 0.78rem; font-weight: 650; line-height: 1.2; }
.mo-donut-center i { margin-top: 2px; color: var(--ink-faint); font-size: 0.7rem; font-style: normal; }
.mo-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 2px var(--sp-3); width: 100%; margin: 0; padding: 0; list-style: none; transition: opacity 0.15s ease; }
.mo-legend li { transition: opacity 0.15s ease; }
.mo-legend li.mo-dim { opacity: 0.4; }
.mo-legend-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; font-size: 0.82rem; text-align: left; cursor: pointer; }
.mo-legend-btn:hover { background: var(--surface-2); }
.mo-legend-btn:focus-visible { outline: 2px solid var(--zila-600); outline-offset: 1px; }
.mo-legend-lab { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-legend-btn b { font-variant-numeric: tabular-nums; }
.mo-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.mo-on .mo-legend li { animation: mo-rise 0.4s ease backwards; animation-delay: 0.5s; }

/* Līniju diagramma */
.mo-chart { position: relative; width: 100%; }
.mo-chart svg { display: block; max-width: 100%; touch-action: pan-y; }
.mo-grid { stroke: var(--line-soft); stroke-width: 1; }
.mo-axis { fill: var(--ink-faint); font-family: var(--font-base); font-size: 11px; }
.mo-guide { stroke: var(--zila-300); stroke-width: 1; stroke-dasharray: 3 3; }
.mo-line { fill: none; stroke: var(--zila-600); stroke-width: 2.75; stroke-linecap: round; stroke-linejoin: round; }
.mo-area { fill: var(--zila-500); opacity: 0.12; stroke: none; }
.mo-dot-pt { fill: var(--surface); stroke: var(--zila-600); stroke-width: 2.5; cursor: pointer; outline: none; transition: r 0.12s ease, fill 0.12s ease; }
.mo-dot-pt.mo-on-pt, .mo-dot-pt:focus-visible { r: 7; fill: var(--zila-600); }
.mo-on .mo-chart:not(.mo-static) .mo-line { stroke-dasharray: 1; animation: mo-draw 1.2s cubic-bezier(0.3, 0.6, 0.2, 1) 0.25s backwards; }
.mo-on .mo-chart:not(.mo-static) .mo-area { animation: mo-area-in 0.8s ease 0.9s backwards; }
.mo-on .mo-chart:not(.mo-static) .mo-dot-pt { transform-box: fill-box; transform-origin: center; animation: mo-pop 0.4s cubic-bezier(0.3, 1.5, 0.5, 1) backwards; animation-delay: calc(var(--mo-i, 0) * 180ms + 0.5s); }
.mo-tip {
    position: absolute;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 260px;
    padding: 7px 11px;
    border-radius: 8px;
    background: var(--zila-950);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.3;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}
.mo-tip[hidden] { display: none; }
.mo-tip i { color: var(--zila-200); font-size: 0.74rem; font-style: normal; }

@media (max-width: 860px) {
    .mo-split { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .mo-on *, .mo-on *::before, .mo-on *::after { animation: none !important; }
    .stat:hover, .quick-card:hover .quick-ico { transform: none; }
}

/* 21. Palīgs — personāla speciālista rokasgrāmata (js/paligs.js) */

.pg { --pg-top: calc(var(--header-h) + 8px); }

/* Meklēšanas josla (lipīga zem galvenes) */
.pg-bar {
    position: sticky; top: var(--header-h); z-index: 60;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 0; margin-bottom: 8px;
    background: var(--bg);
}
.pg-search { position: relative; flex: 1 1 320px; min-width: 0; }
.pg-search input[type="search"] {
    width: 100%; height: 46px; box-sizing: border-box;
    padding: 0 84px 0 44px;
    font: inherit; font-size: 1rem; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    appearance: none; -webkit-appearance: none;
}
.pg-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.pg-search input[type="search"]:focus { outline: 3px solid var(--zila-300); outline-offset: 0; border-color: var(--zila-600); }
.pg-search-ico { position: absolute; left: 14px; top: 13px; width: 20px; height: 20px; color: var(--ink-soft); pointer-events: none; }
.pg-kbd {
    position: absolute; right: 12px; top: 11px; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box;
    display: grid; place-items: center; font: 600 .78rem/1 var(--font-base); color: var(--ink-soft);
    background: var(--surface-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
    pointer-events: none;
}
.pg-x {
    position: absolute; right: 40px; top: 9px; width: 28px; height: 28px; padding: 0;
    border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft);
    font-size: 1.35rem; line-height: 1; cursor: pointer;
}
.pg-x:hover { background: var(--surface-3); color: var(--ink); }
.pg-find { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--ink-soft); white-space: nowrap; }
.pg-find .btn { min-width: 34px; justify-content: center; font-size: 1.15rem; line-height: 1; padding: 4px 8px; }
.pg-print { margin-left: auto; }
.pg-toc-btn { display: none; }
.pg .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.pg-results {
    position: absolute; z-index: 70; left: 0; right: 0; top: calc(100% + 6px);
    max-height: min(62vh, 560px); overflow: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.pg-res {
    display: block; width: 100%; box-sizing: border-box; text-align: left;
    padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line-soft);
    background: transparent; color: var(--ink); font: inherit; cursor: pointer;
}
.pg-res:last-of-type { border-bottom: 0; }
.pg-res:hover, .pg-res.is-sel { background: var(--zila-050); }
.pg-res.is-sel { box-shadow: inset 3px 0 0 var(--zila-600); }
.pg-res-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pg-res-n {
    display: inline-block; min-width: 2.1em; padding: 0 6px; text-align: center;
    font-size: .8rem; font-weight: 700; color: var(--zila-800); background: var(--zila-100); border-radius: 5px;
}
.pg-res-t { font-weight: 650; color: var(--zila-950); }
.pg-res-c { font-size: .8rem; color: var(--ink-faint); }
.pg-res-s { display: block; margin-top: 3px; font-size: .88rem; line-height: 1.45; color: var(--ink-soft); }
.pg-res-empty, .pg-res-note { padding: 14px 16px; font-size: .9rem; color: var(--ink-soft); }
.pg-res-note { background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.pg-res-note:last-child { border-bottom: 0; border-top: 1px solid var(--line-soft); }
.pg mark, mark.pg-hit { background: #ffe9a3; color: inherit; border-radius: 3px; padding: 0 1px; }
mark.pg-hit.is-cur { background: #ffc233; box-shadow: 0 0 0 2px #ffc233; }

/* Izkārtojums: satura rādītājs + saturs */
.pg-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 32px; align-items: start; }
.pg-toc {
    position: sticky; top: calc(var(--header-h) + 76px);
    background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.pg-toc > summary { list-style: none; }
.pg-toc nav { max-height: calc(100vh - var(--header-h) - 110px); overflow: auto; padding: 10px 6px 12px; }
.pg-toc-list, .pg-toc-list ul { list-style: none; margin: 0; padding: 0; }
.pg-toc-list a {
    display: flex; gap: 8px; align-items: baseline; padding: 5px 10px; border-radius: 6px;
    font-size: .9rem; line-height: 1.35; color: var(--ink-soft); text-decoration: none;
}
.pg-toc-list a:hover { background: var(--zila-050); color: var(--zila-900); }
.pg-toc-list a.is-active { background: var(--zila-100); color: var(--zila-900); font-weight: 650; }
.pg-toc-list a.is-active-chap { color: var(--zila-900); font-weight: 650; }
.pg-toc-top a { font-weight: 650; color: var(--zila-800); }
.pg-toc-chap { margin-top: 2px; }
.pg-toc-chap > a { color: var(--ink); font-weight: 600; }
.pg-toc-chap > ul { display: none; margin: 0 0 6px 18px; border-left: 1px solid var(--line-soft); }
.pg-toc-chap.is-open > ul { display: block; }
.pg-toc-chap > ul a { padding: 3px 10px; font-size: .86rem; }
.pg-toc-n { flex: 0 0 auto; min-width: 2.1em; font-variant-numeric: tabular-nums; color: var(--zila-700); font-weight: 700; }

/* Saturs */
.pg-main { min-width: 0; max-width: 880px; padding-bottom: 60px; }
.pg-doc [id] { scroll-margin-top: calc(var(--header-h) + 84px); }
.pg-doc p, .pg-doc li { line-height: 1.65; }
.pg-doc p, .pg-doc ul, .pg-doc ol { max-width: 76ch; }
.pg-doc ul, .pg-doc ol { padding-left: 1.3em; }
.pg-doc li { margin: .3em 0; }
.pg-doc h2 {
    display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px;
    font-size: 1.65rem; line-height: 1.2; text-wrap: balance;
}
.pg-doc h3 {
    display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px;
    font-size: 1.2rem; line-height: 1.3; text-wrap: balance;
}
.pg-ttl { min-width: 0; }
.pg-num {
    flex: 0 0 auto; display: inline-block; min-width: 2.1em; padding: 1px 9px; text-align: center;
    font-size: .8em; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em;
    color: #fff; background: var(--zila-800); border-radius: 7px; transform: translateY(-1px);
}
.pg-num--sub { font-size: .72em; color: var(--zila-800); background: var(--zila-100); }
.pg-chap { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.pg-start + .pg-news + .pg-chap { border-top: 0; margin-top: 40px; padding-top: 0; }
.pg-sub { margin-top: 34px; }
.pg-doc strong { color: var(--zila-950); }
.pg-doc em { color: var(--ink); }

.pg-start, .pg-news { margin-top: 8px; }
.pg-start h2, .pg-news h2 { font-size: 1.3rem; }
.pg-tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.pg-task {
    display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
    background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
    color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm);
    transition: border-color var(--anim-fast), box-shadow var(--anim-fast), transform var(--anim-fast);
}
.pg-task:hover { border-color: var(--zila-500); box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--ink); }
.pg-task-t { font-weight: 650; color: var(--zila-950); }
.pg-task-n { font-size: .8rem; color: var(--ink-faint); }
.pg-news { margin-top: 36px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.pg-news h3 { margin: 18px 0 6px; font-size: 1rem; color: var(--ink-soft); }
.pg-news-list { list-style: none; margin: 0; padding: 0; max-width: none; }
.pg-news-list li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 1px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); margin: 0; }
.pg-news-list li:last-child { border-bottom: 0; }
.pg-new-badge {
    grid-row: 1 / span 2; align-self: start; margin-top: 3px; padding: 1px 8px;
    font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: #fff; background: var(--zila-700); border-radius: 999px;
}
.pg-news-link { font-weight: 650; }
.pg-news-d { grid-column: 2; font-size: .9rem; color: var(--ink-soft); line-height: 1.5; }
.pg-news-n { color: var(--ink-faint); white-space: nowrap; }
.pg-news-prev { display: flex; flex-wrap: wrap; gap: 6px; max-width: none; margin: 0; }
.pg-news-prev a {
    padding: 3px 11px; font-size: .86rem; text-decoration: none;
    color: var(--zila-800); background: var(--zila-050); border: 1px solid var(--zila-200); border-radius: 999px;
}
.pg-news-prev a:hover { background: var(--zila-100); }

/* Pakāpieni */
.pg-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; margin: 12px 0; max-width: 80ch; }
.pg-step-n {
    width: 28px; height: 28px; display: grid; place-items: center; margin-top: 1px;
    font-size: .88rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: #fff; background: var(--zila-700); border-radius: 50%;
}
.pg-step-body p { margin: 0; }

/* Ekrānuzņēmumi */
.pg-fig { margin: 16px 0 26px; }
.pg-fig img {
    display: block; width: min(100%, var(--w, 640px)); height: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); cursor: zoom-in;
}
.pg-fig figcaption { margin-top: 7px; font-size: .85rem; line-height: 1.4; color: var(--ink-soft); max-width: 70ch; }
.pg-fig figcaption b { color: var(--zila-800); }
.pg-zoom {
    position: fixed; inset: 0; z-index: 400; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 24px; background: rgb(11 39 52 / 90%); cursor: zoom-out;
}
.pg-zoom img { max-width: min(96vw, 1500px); max-height: 84vh; object-fit: contain; background: #fff; border-radius: 8px; box-shadow: var(--shadow-lg); }
.pg-zoom-c { max-width: 90vw; color: #e5f3f8; font-size: .9rem; text-align: center; }
.pg-zoom-x {
    position: absolute; top: 14px; right: 18px; width: 40px; height: 40px; border: 0; border-radius: 50%;
    background: rgb(255 255 255 / 14%); color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer;
}
.pg-zoom-x:hover { background: rgb(255 255 255 / 26%); }

/* Atgādnes */
.pg-note {
    display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; margin: 16px 0; max-width: 80ch;
    padding: 13px 16px; border: 1px solid; border-radius: var(--radius-lg);
}
.pg-note-ico svg { display: block; width: 22px; height: 22px; margin-top: 1px; }
.pg-note-body p { margin: 0 0 .5em; }
.pg-note-body p:last-child { margin-bottom: 0; }
.pg-note--info { background: var(--info-bg); border-color: rgb(36 95 136 / 28%); }
.pg-note--info .pg-note-ico { color: var(--info); }
.pg-note--warn { background: var(--warn-bg); border-color: rgb(138 91 0 / 32%); }
.pg-note--warn .pg-note-ico { color: var(--warn); }
.pg-note--tip { background: var(--ok-bg); border-color: rgb(38 115 77 / 28%); }
.pg-note--tip .pg-note-ico { color: var(--ok); }

/* Tabulas */
.pg-table { overflow-x: auto; margin: 14px 0 20px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--surface); }
.pg-table table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.pg-table th, .pg-table td { padding: 9px 13px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); line-height: 1.5; }
.pg-table tr:last-child td { border-bottom: 0; }
.pg-table th { background: var(--zila-050); color: var(--zila-900); font-weight: 650; white-space: nowrap; }
.pg-table td:first-child { font-weight: 600; color: var(--zila-950); }

/* BUJ */
.pg-faq { margin: 8px 0; max-width: 80ch; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.pg-faq > summary {
    position: relative; padding: 13px 44px 13px 16px; font-weight: 650; color: var(--zila-950); cursor: pointer; list-style: none;
}
.pg-faq > summary::-webkit-details-marker { display: none; }
.pg-faq > summary::after {
    content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
    border: solid var(--ink-soft); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform var(--anim-fast);
}
.pg-faq[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.pg-faq[open] > summary { border-bottom: 1px solid var(--line-soft); }
.pg-faq > summary:hover { background: var(--zila-050); border-radius: var(--radius-lg); }
.pg-faq-a { padding: 4px 16px 12px; }

/* Kontrolsaraksts */
.pg-check { display: flex; align-items: flex-start; gap: 11px; max-width: 80ch; padding: 6px 2px; line-height: 1.5; cursor: pointer; }
.pg-check input { flex: 0 0 auto; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--zila-700); }
.pg-check input:checked + span { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--line); }
.pg-check-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 0; }

.pg-flash { animation: pg-flash 1.8s ease-out; border-radius: 6px; }
@keyframes pg-flash { 0% { background: #ffe9a3; box-shadow: 0 0 0 6px #ffe9a3; } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) {
    .pg-flash { animation: none; }
    .pg-task, .pg-faq > summary::after { transition: none; }
    .pg-task:hover { transform: none; }
}

/* Šaurāki ekrāni: saturs kļūst par atveramu bloku virs teksta */
@media (max-width: 960px) {
    .pg-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .pg-toc { position: fixed; z-index: 75; left: 16px; right: 16px; top: calc(var(--header-h) + 112px); box-shadow: var(--shadow-lg); }
    .pg-toc:not([open]) { display: none; }
    .pg-toc nav { max-height: min(62vh, 520px); }
    .pg-toc-btn { display: inline-flex; }
    .pg-print { margin-left: 0; }
    .pg-bar { gap: 8px; padding: 8px 0; }
    .pg-search { flex: 1 1 100%; }
    .pg-toc-btn, .pg-print { flex: 1 1 0; justify-content: center; }
    .pg-doc [id] { scroll-margin-top: calc(var(--header-h) + 120px); }
    .pg-chap { margin-top: 44px; padding-top: 24px; }
}
@media (max-width: 560px) {
    .pg-kbd { display: none; }
    .pg-search input[type="search"] { padding-right: 44px; font-size: .95rem; }
    .pg-x { right: 8px; }
    .pg-doc h2 { font-size: 1.4rem; }
    .pg-step { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
    .pg-note { grid-template-columns: 22px minmax(0, 1fr); padding: 12px; }
    .pg-news { padding: 14px; }
}

/* Drukāšana (poga "Drukāt" — tikai Palīgs) */
@media print {
    body.pg-printing .sidebar, body.pg-printing .topbar, body.pg-printing .app-footer,
    body.pg-printing .pg-bar, body.pg-printing .pg-toc, body.pg-printing .pg-hero,
    body.pg-printing .pg-start, body.pg-printing .pg-check-bar, body.pg-printing .pg-zoom { display: none !important; }
    body.pg-printing #app { display: block !important; max-width: none; padding: 0 !important; }
    body.pg-printing .shell { display: block; }
    body.pg-printing .pg-layout { display: block; }
    body.pg-printing .pg-main { max-width: none; padding: 0; }
    body.pg-printing { background: #fff; font-size: 10.5pt; }
    body.pg-printing .pg-chap { page-break-before: always; margin-top: 0; padding-top: 0; border-top: 0; }
    body.pg-printing .pg-news { page-break-after: always; box-shadow: none; }
    body.pg-printing .pg-fig, body.pg-printing .pg-note, body.pg-printing .pg-step, body.pg-printing .pg-faq { page-break-inside: avoid; }
    body.pg-printing .pg-fig img { box-shadow: none; max-height: 220mm; width: auto; max-width: 100%; }
    body.pg-printing mark { background: none; }
    body.pg-printing .pg-doc h2, body.pg-printing .pg-doc h3 { page-break-after: avoid; }
}

/* Mērķu kaskāde, organigramma, pārrunu sagatavošana */

.kk-tree { display: flex; flex-direction: column; gap: 14px; }
.kk-node { position: relative; }
.kk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kk-l0 > .kk-card { border-left: 4px solid var(--zila-700); }
.kk-l1 > .kk-card { border-left: 4px solid var(--zila-400); }
.kk-l2 > .kk-card { border-left: 4px solid var(--zila-200); }
.kk-kids { margin: 10px 0 0 18px; padding-left: 16px; border-left: 2px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.kk-kids:empty { display: none; }
.kk-archived > .kk-card { opacity: .65; }
.kk-lvl { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.kk-title { font-weight: 600; font-size: 1.02rem; }
.kk-emp { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line); font-size: .88rem; display: flex; flex-direction: column; gap: 4px; }
.kk-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line); background: var(--surface-3); vertical-align: middle; }
.kk-chip-institution { background: var(--zila-100); border-color: var(--zila-300); color: var(--zila-900); }
.kk-chip-unit { background: var(--info-bg); border-color: #b6d5e7; color: var(--info); }
.kk-arrow { margin: 0 6px; color: var(--ink-faint); }
.kk-up { color: var(--ok); font-weight: 600; }
.kk-down { color: var(--err); font-weight: 600; }
.btn.kk-on { background: var(--zila-100); border-color: var(--zila-400); }

/* Organigramma */
.oc-scroll { overflow-x: auto; padding-bottom: 8px; }
.oc-tree { display: inline-block; min-width: 100%; text-align: center; }
.oc-tree ul { padding-top: 22px; position: relative; display: flex; justify-content: center; margin: 0; padding-left: 0; list-style: none; }
.oc-tree li { position: relative; padding: 22px 8px 0; list-style: none; display: flex; flex-direction: column; align-items: center; }
.oc-tree li::before, .oc-tree li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid var(--line); }
.oc-tree li::after { right: auto; left: 50%; border-left: 2px solid var(--line); }
.oc-tree li:only-child::before, .oc-tree li:only-child::after { display: none; }
.oc-tree li:only-child { padding-top: 0; }
.oc-tree li:first-child::before, .oc-tree li:last-child::after { border: 0 none; }
.oc-tree li:last-child::before { border-right: 2px solid var(--line); border-radius: 0 6px 0 0; }
.oc-tree li:first-child::after { border-radius: 6px 0 0 0; }
.oc-tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid var(--line); height: 22px; }
.oc-tree > ul { padding-top: 0; }
.oc-box { display: inline-block; min-width: 150px; max-width: 220px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--zila-600); border-radius: 8px; text-align: center; }
.oc-name { font-weight: 600; font-size: .9rem; line-height: 1.25; }
.oc-meta { font-size: .74rem; color: var(--ink-faint); margin-top: 2px; }
.oc-head { font-size: .8rem; margin-top: 3px; color: var(--ink-soft); }
.oc-inactive { opacity: .6; border-top-color: var(--neutral); border-style: dashed; }
.oc-list ul { list-style: none; margin: 0; padding-left: 22px; border-left: 2px solid var(--line-soft); }
.oc-list > ul { padding-left: 0; border-left: 0; }
.oc-list li { margin: 8px 0; text-align: left; }
.oc-list .oc-box { text-align: left; max-width: none; min-width: 0; }

@media (max-width: 700px) {
    .kk-kids { margin-left: 6px; padding-left: 10px; }
}

@media print {
    body.kk-printing .sidebar, body.kk-printing .topbar, body.kk-printing .app-footer, body.kk-printing .kk-noprint,
    body.kk-printing .btn { display: none !important; }
    body.kk-printing #app { display: block !important; max-width: none; padding: 0 !important; }
    body.kk-printing .shell { display: block; }
    body.kk-printing { background: #fff; font-size: 10.5pt; }
    body.kk-printing .card, body.kk-printing .kk-card { box-shadow: none; break-inside: avoid; }
    body.kk-printing .oc-scroll { overflow: visible; }
    body.kk-printing .oc-tree { zoom: .75; }
}

/* Pieejamība (WCAG 2.2 AA) */

.sr-only {
    position: absolute !important; left: 0; top: 0; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Izlaišanas saite: redzama tikai fokusā */
.skip-link {
    position: absolute; left: 8px; top: -60px; z-index: 1000;
    padding: 10px 16px; border-radius: var(--radius);
    background: var(--zila-900); color: #fff; font-weight: 700; text-decoration: none;
    box-shadow: var(--shadow-md);
}
.skip-link:focus { top: 8px; outline: 3px solid #fff; outline-offset: 0; box-shadow: 0 0 0 6px var(--zila-900); }

/* Fokusa gredzens: pietiekams kontrasts arī uz tumša fona (sānjosla) un ievades laukos; fiksētā galvene nedrīkst aizsegt fokusēto elementu (WCAG 2.4.11). */
:focus-visible { outline: 3px solid var(--zila-700); outline-offset: 2px; }
.sidebar :focus-visible { outline-color: #fff; outline-offset: -3px; }
html { scroll-padding-top: calc(var(--header-h) + 16px); scroll-padding-bottom: 16px; }
[tabindex="-1"]:focus { outline: none; }

/* Pārejas un animācijas — respektē lietotāja iestatījumu */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Pieskārienu/klikšķu mērķi — vismaz 24×24 px (WCAG 2.5.8) */
.btn-sm, .notif-act, .menu-pop-item, .role-option, .sidebar-group-toggle, .sidebar-group-body a { min-height: 24px; }
button, [role="button"], summary { min-height: 24px; }


/* Zvaniņš (paziņojumu centrs) */
.notif { position: relative; }
.notif-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--ink); cursor: pointer;
}
.notif-btn:hover { background: var(--surface-3); }
.notif-badge {
    position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-pill); background: var(--err); color: #fff;
    font-size: .72rem; font-weight: 700; line-height: 1; border: 2px solid var(--surface);
}
.notif-badge[hidden] { display: none; }
.notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 210;
    width: min(420px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto;
    padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--surface); box-shadow: var(--shadow-lg);
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.notif-h { margin: 0; font-size: 1.05rem; }
.notif-filter { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: .85rem; }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.notif-item { display: flex; align-items: stretch; gap: 4px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); }
.notif-item.unread { background: var(--zila-050); border-color: var(--zila-300); }
.notif-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; color: var(--ink); text-decoration: none; border-radius: var(--radius); }
a.notif-link:hover { background: var(--zila-100); color: var(--ink); }
.notif-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .75rem; color: var(--ink-soft); }
.notif-cat { font-weight: 600; }
.notif-new { padding: 0 6px; border-radius: var(--radius-pill); background: var(--zila-700); color: #fff; font-weight: 700; font-size: .7rem; }
.notif-title { font-size: .9rem; overflow-wrap: anywhere; }
.notif-body { font-size: .82rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.notif-actions { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 4px; }
.notif-act {
    width: 28px; height: 28px; border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 1rem; line-height: 1;
}
.notif-act:hover { background: var(--surface-3); border-color: var(--line); color: var(--ink); }
.notif-empty { margin: 12px 4px; }
.notif-err { padding: 10px; color: var(--err); }
.notif-more { margin-top: 8px; width: 100%; }
@media (max-width: 520px) {
    .notif-panel { position: fixed; top: calc(var(--header-h) + 4px); left: 8px; right: 8px; width: auto; }
}
@media (forced-colors: active) {
    .notif-badge, .notif-new { border: 1px solid CanvasText; }
    .notif-item.unread { border-width: 2px; }
}

/* Reflow (WCAG 1.4.10): garas rindas/koda fragmenti lauž rindu, nevis paplašina lapu */
code, kbd, .alert, .field-hint { overflow-wrap: anywhere; }
.stack > *, .card-pad > * { min-width: 0; }
input[type="file"] { min-height: 32px; }
a.pg-news-link { display: inline-block; min-height: 24px; }

/* 360° vērtētāja pievienošanas rinda: veids + e-pasts + poga VIENĀ rindā (šaurā ekrānā ≤ 560 px pārnesas, lai nebūtu horizontāla ritināšana — WCAG 1.4.10) */
.rater-add { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 8px; }
.rater-add-type { flex: 0 0 11rem; width: 11rem; margin: 0; }
.rater-add-email { flex: 1 1 0; min-width: 0; display: flex; }
.rater-add-btn { flex: none; white-space: nowrap; width: auto; }
@media (max-width: 560px) {
    .rater-add { flex-wrap: wrap; }
    .rater-add-type, .rater-add-email, .rater-add-btn { flex: 1 1 100%; width: 100%; }
}

/* Sānjosla: ikonas pie visiem punktiem + režīms "tikai ikonas" (Slēpt / Rādīt) */
.sidebar-link .ico, .sidebar-group-toggle .ico, .sidebar-group-body a .ico {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
}
.sidebar-link .ico svg, .sidebar-group-toggle .ico svg, .sidebar-group-body a .ico svg { width: 18px; height: 18px; opacity: .9; }
.sidebar-group-body a { display: flex; align-items: center; gap: 10px; }
.sidebar-group-body { padding-left: 8px; }

.sidebar-collapse {
    display: none; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    color: var(--ink-soft); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.sidebar-collapse svg { width: 18px; height: 18px; flex: none; }
.sidebar-collapse:hover { background: var(--surface-3); }

@media (min-width: 901px) {
    .sidebar-collapse { display: inline-flex; }
    :root { --rail-w-min: 68px; }
    .shell { transition: grid-template-columns var(--anim); }
    .shell.sb-collapsed { grid-template-columns: var(--rail-w-min) 1fr; }
    .shell.sb-collapsed:has(#topbar.hidden) { grid-template-columns: 1fr; }
    .sb-collapsed .sidebar { overflow-x: hidden; }
    .sb-collapsed .sidebar-nav { padding-left: 8px; padding-right: 8px; }
    /* Teksti paliek pieejami ekrānlasītājam, bet vizuāli paslēpti */
    .sb-collapsed .sidebar .lbl, .sb-collapsed .sidebar-group-toggle .chev,
    .sb-collapsed .sidebar-group-toggle > span:not(.ico) {
        position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
        clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
    }
    .sb-collapsed .sidebar-link, .sb-collapsed .sidebar-group-toggle,
    .sb-collapsed .sidebar-group-body a { position: relative; justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
    .sb-collapsed .sidebar-group-body { padding: 2px 0 6px; border-radius: var(--radius); background: rgba(255, 255, 255, .05); }
    .sb-collapsed .sidebar-group-body a { min-height: 38px; }
    .sb-collapsed .sidebar-sub-header {
        height: 0; margin: 6px 12px; padding: 0; overflow: hidden; font-size: 0;
        border-top: 1px solid rgba(255, 255, 255, .18);
    }
    .sb-collapsed .sidebar-sub-header:first-child { display: none; }
}
@media (max-width: 900px) { .sidebar-collapse { display: none !important; } }

/* DEMO režīms (js/demo.js): josla un ūdenszīme izdrukās */

#demo-bar {
    position: fixed; right: 14px; bottom: 14px; z-index: 9000;
    display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100vw - 28px));
    padding: 8px 14px; border-radius: 999px; font-size: .8125rem; line-height: 1.3;
    background: #7a1010; color: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
    pointer-events: none;
}
#demo-bar strong { letter-spacing: .08em; padding: 2px 8px; border-radius: 999px; background: #fff; color: #7a1010; }
#demo-watermark { display: none; }

@media print {
    #demo-bar { display: none !important; }
    /* ūdenszīme — fiksēts elements atkārtojas katrā drukātajā lapā; pārklāj saturu, bet nav pilnībā necaurspīdīga */
    body.demo-mode #demo-watermark {
        display: flex !important; position: fixed; inset: 0; z-index: 2147483647;
        align-items: center; justify-content: center; pointer-events: none;
        font: 700 11vw/1 Arial, "Liberation Sans", sans-serif; letter-spacing: .04em; white-space: nowrap;
        color: rgba(192, 0, 0, .16); transform: rotate(-35deg);
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
}
