/* KlikNet app shell (Components/Shell/KlikShell.razor): sidebar + header, layout A of C:\works\docs\plan\kliknet-ui.md.
   Classes start with ks-; colours come from the KlikUI tokens (klikui.css) so dark mode (phase 4) only redefines tokens. */

/* MainLayout's .main-container clips overflow, which would stop the sticky header and sidebar. */
.main-container:has(.ks-shell) { overflow: visible; }

.ks-shell {
    --ks-side-w: 264px;
    --ks-mini-w: 68px;
    --ks-top-h: 56px;
    --ks-brand-bg: linear-gradient(120deg, #1e3a8a 0%, var(--kui-accent) 58%, #3b82f6 100%);
    --ks-brand-ink: #1e3a8a;
    --ks-brand-shadow: 0 4px 14px rgba(30, 58, 138, .22);
    display: flex;
    min-height: 100vh;
    background: var(--kui-page);
    color: var(--kui-text);
}

/* Aliases of the KlikUI tokens, declared again on the parts that can switch to dark mode (klikui.css): a var() is
   resolved where it is declared, so a value from .ks-shell would stay light inside a dark sidebar. */
/* The shell root is .kui (KlikUI font). DevExpress pages in .ks-content keep the system font their layouts were made
   with; KlikUI pages set the KlikUI font again on their .kui / .kui-page root. */
.ks-content { font-family: var(--kui-font-system); word-spacing: normal; }
.ks-shell, .ks-side, .ks-top, .ks-themed {
    --ks-hover: var(--kui-surface-2);
    --ks-soft: var(--kui-accent-soft);
    --ks-ink: var(--kui-accent-ink);
    --ks-line: var(--kui-border-soft);
    --ks-shadow-float: var(--kui-shadow-win);
    --ks-radius: 10px;                   /* header controls, menu areas, user card (mockup A) */
    color: var(--kui-text);
}
/* blue header in dark mode: a deeper gradient, the shadow on a dark page */
:root[data-klik-theme="dark"] .ks-top {
    --ks-brand-bg: linear-gradient(120deg, #172554 0%, #1d4ed8 58%, var(--kui-accent) 100%);
    --ks-brand-ink: #172554;
    --ks-brand-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
.ks-shell.is-right { flex-direction: row-reverse; }

/* ---------- sidebar ---------- */
.ks-side { position: sticky; top: 0; z-index: 1020; flex: 0 0 var(--ks-side-w); width: var(--ks-side-w); height: 100vh; }
/* Brand and user card stay in place, only the menu (.ks-nav) scrolls. The side padding lives on the three parts so the
   focus outline of a menu row is not clipped by the scrolling nav. */
.ks-side-inner {
    position: absolute; top: 0; bottom: 0; left: 0; width: var(--ks-side-w);
    display: flex; flex-direction: column; padding: 12px 0;
    background: var(--kui-surface); border-right: 1px solid var(--ks-line);
    overflow: hidden;
    transition: width .16s ease, box-shadow .16s ease;
}
.ks-shell.is-right .ks-side-inner { left: auto; right: 0; border-right: 0; border-left: 1px solid var(--ks-line); }

.ks-brand { flex: none; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px; margin: 0 10px 6px; color: inherit; text-decoration: none; white-space: nowrap; }
.ks-brand:hover { color: inherit; }
.ks-logo { flex: none; width: 36px; height: 36px; border-radius: var(--ks-radius); background: var(--kui-accent); color: var(--kui-on-accent);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; letter-spacing: -.5px; }
.ks-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ks-brand-text strong { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.ks-brand-text small { font-size: 11.5px; color: var(--kui-muted); overflow: hidden; text-overflow: ellipsis; }

.ks-nav {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 1px; padding: 3px 10px;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    border-block: 1px solid transparent;
}
/* klikui.shell.side: a line under the brand / above the user card only while menu rows are hidden behind it */
.ks-nav.is-cut-top { border-top-color: var(--kui-border); }
.ks-nav.is-cut-bottom { border-bottom-color: var(--kui-border); }
.ks-section { padding: 14px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--kui-muted); white-space: nowrap; }
.ks-area {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px;
    border: 0; border-radius: var(--ks-radius); background: transparent; color: var(--kui-text);
    font: inherit; font-size: 14px; font-weight: 600; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.ks-area:hover { background: var(--ks-hover); color: var(--kui-text); }
.ks-area.is-active { background: var(--ks-soft); color: var(--ks-ink); }
.ks-area.is-current, .ks-area.is-current:hover { background: var(--kui-accent); color: var(--kui-on-accent); }
.ks-area-icon { flex: none; width: 20px; font-size: 18px; text-align: center; }
.ks-area .ks-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ks-chev { flex: none; font-size: 12px; opacity: .6; transition: transform .15s ease; }
.ks-chev.is-open { transform: rotate(90deg); }

.ks-items { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 22px; padding-left: 8px; border-left: 1px solid var(--ks-line); }
/* Sub groups of an area (MenuItemDef.Heading): a bit stronger than the items' grey and followed by a thin line, so a
   group starts visibly, still quieter than the items themselves (Nik 2026-11-03) */
.ks-heading { display: flex; align-items: center; gap: 8px; padding: 12px 10px 3px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
    color: var(--kui-text-2); white-space: nowrap; }
.ks-heading::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--ks-line); }
.ks-items > .ks-heading:first-child { padding-top: 6px; }
.ks-item {
    display: block; padding: 7px 10px; border: 0; border-radius: var(--kui-radius-m); background: transparent; color: var(--kui-text-2);
    font: inherit; font-size: 13.5px; text-align: left; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.ks-item:hover { background: var(--ks-hover); color: var(--kui-text); }
.ks-item.is-current, .ks-item.is-current:hover { background: var(--ks-soft); color: var(--ks-ink); font-weight: 600; }
.ks-empty { padding: 12px; color: var(--kui-muted); font-size: 13px; white-space: normal; }

/* personal shortcuts on top of the menu + the star next to every item */
.ks-section--fav { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; }
.ks-section-btn { width: 26px; height: 26px; border: 0; border-radius: var(--kui-radius); background: transparent; color: var(--kui-muted);
    display: inline-flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; }
.ks-section-btn:hover { background: var(--ks-hover); color: var(--ks-ink); }
.ks-fav { font-weight: 500; min-height: 36px; }
.ks-fav .ks-area-icon { font-size: 16px; color: var(--ks-ink); }
.ks-fav.is-active { background: var(--ks-soft); color: var(--ks-ink); font-weight: 600; }
.ks-fav--add { color: var(--kui-muted); }
.ks-item-row { display: flex; align-items: center; border-radius: var(--kui-radius-m); }
.ks-item-row:hover { background: var(--ks-hover); }
.ks-item-row .ks-item { flex: 1 1 auto; min-width: 0; }
.ks-item-row .ks-item:hover { background: transparent; }
.ks-item-row .ks-item.is-current { background: var(--ks-soft); }
.ks-star { flex: none; width: 28px; height: 28px; border: 0; border-radius: var(--kui-radius); background: transparent; color: var(--kui-muted);
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; opacity: 0; }
.ks-item-row:hover .ks-star, .ks-star:focus-visible, .ks-star.is-on { opacity: 1; }
.ks-star.is-on { color: var(--kui-star); }
.ks-star:hover { color: var(--kui-star); }

.ks-side-foot { flex: none; margin: 0 10px; padding-top: 12px; }
.ks-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--ks-radius);
    background: var(--kui-surface-2); color: inherit; font: inherit; text-align: left; white-space: nowrap; cursor: pointer; }
.ks-user:hover { background: var(--ks-soft); }
.ks-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ks-user-text strong, .ks-user-text small { overflow: hidden; text-overflow: ellipsis; }
.ks-user-text small { font-size: 12px; color: var(--kui-muted); }
.ks-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--ks-soft); color: var(--ks-ink);
    display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; text-transform: uppercase; }
.ks-avatar--lg { width: 44px; height: 44px; font-size: 15px; }

/* mini: icons only; opens over the page on mouse-over (or while a keyboard user is inside).
   Keyboard = :focus-within, except focus from a mouse click (:focus that is not :focus-visible), so the menu closes
   when the mouse leaves. Not :has(:focus-visible): it is false for a moment while Tab moves focus, the menu closed and
   the next row (display: none) lost the focus to the page. */
.ks-shell.is-mini > .ks-side { flex-basis: var(--ks-mini-w); width: var(--ks-mini-w); }
.ks-shell.is-mini > .ks-side .ks-side-inner { width: var(--ks-mini-w); }
.ks-shell.is-mini > .ks-side:hover .ks-side-inner,
.ks-shell.is-mini > .ks-side:focus-within:not(:has(:focus:not(:focus-visible))) .ks-side-inner { width: var(--ks-side-w); box-shadow: var(--ks-shadow-float); transition-delay: .08s; }
.ks-shell.is-mini:not(.is-side-open) > .ks-side:not(:hover):not(:focus-within:not(:has(:focus:not(:focus-visible)))) :is(.ks-label, .ks-chev, .ks-items) { display: none; }
.ks-shell.is-mini:not(.is-side-open) > .ks-side:not(:hover):not(:focus-within:not(:has(:focus:not(:focus-visible)))) .ks-section { display: block; padding: 8px 10px; font-size: 0; }
.ks-shell.is-mini:not(.is-side-open) > .ks-side:not(:hover):not(:focus-within:not(:has(:focus:not(:focus-visible)))) .ks-section::before { content: ""; display: block; height: 1px; background: var(--ks-line); }
.ks-shell.is-mini:not(.is-side-open) > .ks-side:not(:hover):not(:focus-within:not(:has(:focus:not(:focus-visible)))) :is(.ks-area, .ks-brand, .ks-user) { justify-content: center; padding-left: 0; padding-right: 0; }
/* the closed mini menu still scrolls (wheel), but a scrollbar would take a third of its width */
.ks-shell.is-mini:not(.is-side-open) > .ks-side:not(:hover):not(:focus-within:not(:has(:focus:not(:focus-visible)))) .ks-nav { scrollbar-width: none; }
.ks-shell.is-mini:not(.is-side-open) > .ks-side:not(:hover):not(:focus-within:not(:has(:focus:not(:focus-visible)))) .ks-nav::-webkit-scrollbar { display: none; }

/* ---------- main column + header ---------- */
.ks-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ks-top {
    position: sticky; top: 0; z-index: 1010; display: flex; align-items: center; gap: 8px;
    height: var(--ks-top-h); padding: 0 16px; background: var(--kui-surface); border-bottom: 1px solid var(--ks-line);
}
/* The content box is the page's scroller, as high as the screen under the header. Blazor.Bootstrap gives every <main>
   height: 100vh, so it was a whole screen high UNDER the 56 px header and the document scrolled by the header's height
   (Nik 2026-11-03: "vse strani"). --kui-page-h = the room inside it (minus its padding) for fill pages (klikui.css). */
.ks-main { height: 100vh; height: 100dvh; }
.ks-content { flex: 1 1 0; min-width: 0; min-height: 0; height: auto; overflow-y: auto; padding: 8px 12px 12px; }
:root:has(.ks-shell) { --kui-page-h: calc(100dvh - var(--ks-top-h, 56px) - 20px); }
.ks-top-spacer { flex: 1 1 0; }

.ks-icon-btn { flex: none; width: 40px; height: 40px; border: 0; border-radius: var(--ks-radius); background: transparent; color: inherit;
    display: inline-flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; }
.ks-icon-btn:hover { background: var(--ks-hover); }

.ks-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 420px; overflow: hidden; font-size: 13px; color: var(--kui-muted); white-space: nowrap; }
.ks-crumbs i { font-size: 10px; }
.ks-crumbs strong { color: var(--kui-text); overflow: hidden; text-overflow: ellipsis; }
/* menu crumbs of the route, or the page's own steps (KlikPageCrumbs) which hide them; the same for the phone title */
.ks-menu-crumbs, .ks-page-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ks-crumbs:has(.ks-page-crumbs) .ks-menu-crumbs, .ks-phone-title:has(.ks-page-phone-title) .ks-menu-title { display: none; }
.ks-page-crumbs a { color: inherit; text-decoration: none; white-space: nowrap; }
.ks-page-crumbs a:hover { text-decoration: underline; }

.ks-search { position: relative; flex: 0 1 420px; min-width: 180px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px;
    border: 1px solid var(--ks-line); border-radius: var(--ks-radius); background: var(--kui-surface-2); color: var(--kui-muted); }
.ks-search:focus-within { border-color: var(--kui-focus); background: var(--kui-surface); box-shadow: 0 0 0 3px var(--kui-focus-ring); }
.ks-search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--kui-text); font: inherit; font-size: 14px; }
.ks-kbd { font: inherit; font-size: 11px; font-weight: 600; padding: 2px 6px; border: 1px solid var(--ks-line); border-radius: var(--kui-radius); background: var(--kui-surface); color: var(--kui-muted); }
.ks-search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 320px; max-height: 420px; overflow: auto; z-index: 1060;
    padding: 6px; background: var(--kui-surface); color: var(--kui-text); border: 1px solid var(--ks-line); border-radius: var(--kui-radius-float); box-shadow: var(--ks-shadow-float); }
.ks-search-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: var(--kui-radius-m);
    background: transparent; color: var(--kui-text); font: inherit; text-align: left; cursor: pointer; }
.ks-search-row.is-sel { background: var(--ks-soft); }
.ks-search-row i { color: var(--ks-ink); }
.ks-search-text { flex: 1; font-weight: 600; }
.ks-search-where { font-size: 12px; color: var(--kui-muted); }
.ks-search-empty { padding: 10px; color: var(--kui-muted); }
.ks-search-head { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--kui-muted); }

/* shortcut editor (KlikShortcutEditor in a KlikWindow) */
.ks-sc { display: flex; flex-wrap: wrap; gap: 16px; }
.ks-sc-all { flex: 1 1 380px; min-width: 0; }
.ks-sc-mine { flex: 1 1 300px; min-width: 0; padding: 12px; border-radius: var(--kui-radius-m); background: var(--kui-surface-2); align-self: flex-start; }
.ks-sc-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; margin-bottom: 8px;
    border: 1px solid var(--kui-border); border-radius: var(--kui-radius); background: var(--kui-surface); color: var(--kui-muted); }
.ks-sc-search:focus-within { border-color: var(--kui-focus); }
.ks-sc-list { height: 420px; overflow: auto; padding-right: 4px; }
.ks-sc-area { padding: 10px 4px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--kui-muted); }
.ks-sc-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 8px; border: 0; border-radius: var(--kui-radius);
    background: transparent; color: var(--kui-text); font: inherit; text-align: left; cursor: pointer; }
.ks-sc-row:hover { background: var(--kui-surface-2); }
.ks-sc-row:disabled { opacity: .55; cursor: default; }
.ks-sc-row i, .ks-sc-chosen i:first-child { color: var(--kui-accent); width: 18px; text-align: center; }
.ks-sc-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks-sc-title { margin-bottom: 8px; font-weight: 600; }
.ks-sc-chosen { display: flex; align-items: center; gap: 6px; padding: 2px 2px 2px 10px; margin-bottom: 6px;
    border: 1px solid var(--kui-border-soft); border-radius: var(--kui-radius); background: var(--kui-surface); font-weight: 600; }
.ks-sc-empty { margin: 8px 0; color: var(--kui-muted); }

.ks-top-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--ks-line); border-radius: var(--ks-radius);
    background: var(--kui-surface); color: inherit; font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.ks-top-btn:hover { background: var(--ks-hover); }
.ks-company-chip span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

.ks-profile-anchor { position: relative; display: flex; align-items: center; gap: 8px; }
.ks-avatar-btn { padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.ks-avatar-btn .ks-avatar { width: 36px; height: 36px; box-shadow: 0 0 0 2px var(--kui-surface), 0 0 0 4px color-mix(in srgb, var(--kui-accent) 35%, transparent); }

/* ---------- notification centre ---------- */
.ks-bell { position: relative; }
.ks-badge { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--kui-count-bg); color: var(--kui-on-accent); font-size: 11px; font-weight: 700; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--kui-surface); }
.ks-notices { width: 360px; }
.ks-notices-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 8px 10px; border-bottom: 1px solid var(--kui-line); }
.ks-notices-empty { margin: 0; padding: 16px 10px; color: var(--kui-muted); }
.ks-notice { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: var(--ks-radius);
    background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ks-notice:hover { background: var(--ks-hover); }
.ks-notice-icon { flex: none; width: 34px; height: 34px; border-radius: var(--ks-radius); display: inline-flex; align-items: center; justify-content: center;
    background: var(--ks-soft); color: var(--ks-ink); font-size: 16px; }
.ks-notice--danger .ks-notice-icon { background: var(--kui-badge-red-bg); color: var(--kui-badge-red-fg); }
.ks-notice--warning .ks-notice-icon { background: var(--kui-badge-orange-bg); color: var(--kui-badge-orange-fg); }
.ks-notice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ks-notice-text strong { font-size: 13.5px; }
.ks-notice-text small { font-size: 12.5px; color: var(--kui-muted); }
.ks-shell.is-brand .ks-bell .ks-badge { box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.ks-shell.is-brand .ks-notices { color: var(--kui-text); }

/* ---------- KlikAI drawer ---------- */
.ks-ai-btn i { color: var(--ks-ink); }
.ks-ai-btn.is-on { background: var(--ks-soft); border-color: var(--kui-accent); color: var(--ks-ink); }
.ks-shell.is-brand .ks-ai-btn i { color: inherit; }
.ks-ai { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1040; width: 420px; max-width: 100vw; display: flex; flex-direction: column;
    background: var(--kui-surface); color: var(--kui-text); border-left: 1px solid var(--ks-line); box-shadow: var(--ks-shadow-float);
    font-family: var(--kui-font); font-size: 14px; }
.ks-ai-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--ks-line); }
.ks-ai-logo { flex: none; width: 34px; height: 34px; border-radius: var(--ks-radius); background: var(--kui-accent); color: var(--kui-on-accent); display: inline-flex; align-items: center; justify-content: center; }
.ks-ai-title { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.ks-ai-title small { font-size: 12px; color: var(--kui-muted); }
.ks-ai-body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ks-ai-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--ks-line); border-radius: var(--kui-radius-l); background: var(--kui-surface-2); }
.ks-ai-card p { margin: 0; }
.ks-ai-terms { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--kui-text-2); }
.ks-ai-agree { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.ks-ai-agree input { margin-top: 2px; }
.ks-ai-note { margin: 0; color: var(--kui-muted); font-size: 13px; }
.ks-ai-error { margin: 0; padding: 10px 12px; border-radius: var(--ks-radius); background: var(--kui-danger-soft); color: var(--kui-danger); font-size: 13px; }
.ks-ai-suggest { display: flex; flex-direction: column; gap: 6px; }
.ks-ai-chip { padding: 9px 12px; border: 1px solid var(--ks-line); border-radius: var(--ks-radius); background: transparent; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ks-ai-chip:hover { background: var(--ks-hover); border-color: var(--kui-accent); }
.ks-ai-msg { display: flex; flex-direction: column; gap: 6px; max-width: 92%; }
.ks-ai-msg--user { align-self: flex-end; }
.ks-ai-msg--user .ks-ai-text { background: var(--kui-accent); color: var(--kui-on-accent); border-radius: 14px 14px 4px 14px; }
.ks-ai-msg--ai { align-self: flex-start; }
.ks-ai-msg--ai .ks-ai-text { background: var(--kui-surface-2); border: 1px solid var(--ks-line); border-radius: 14px 14px 14px 4px; }
.ks-ai-text { padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.ks-ai-tools { font-size: 11.5px; color: var(--kui-muted); }
.ks-ai-links { display: flex; flex-wrap: wrap; gap: 6px; }
.ks-ai-proposal { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--ks-line); border-radius: var(--ks-radius); background: var(--kui-surface); font-size: 13px; }
.ks-ai-ok { margin: 0; padding: 6px 10px; border-radius: var(--ks-radius); background: var(--kui-success-soft); color: var(--kui-success); font-size: 13px; }
.ks-ai-foot { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 4px; border-top: 1px solid var(--ks-line); }
.ks-ai-input { flex: 1; height: auto; min-height: 40px; max-height: 160px; padding: 8px 10px; resize: vertical; font: inherit; }
.ks-ai-foot .kui-btn { height: 40px; }
.ks-ai-disclaimer { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--kui-muted); }

/* ---------- personal menu ---------- */
.ks-pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 1060; width: 330px; max-height: calc(100vh - 80px); overflow: auto;
    padding: 6px; background: var(--kui-surface); color: var(--kui-text); border: 1px solid var(--ks-line); border-radius: var(--kui-radius-float); box-shadow: var(--ks-shadow-float); }
.ks-profile-head { display: flex; align-items: center; gap: 12px; padding: 10px; }
.ks-profile-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.ks-profile-who small { font-size: 12.5px; color: var(--kui-muted); }
.ks-profile-who .ks-profile-group { color: var(--ks-ink); font-weight: 600; }
/* phone only (.ks-phone-only): company / business unit top right of the card; a long name ends with "…" */
.ks-profile-company { align-self: flex-start; align-items: center; gap: 5px; flex: 0 1 auto; min-width: 0; max-width: 48%; margin-left: auto;
    padding: 3px 9px; border-radius: 999px; background: var(--ks-soft); color: var(--ks-ink); font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.ks-profile-company > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks-profile-company > i { flex: none; }
.ks-profile-block { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-top: 1px solid var(--kui-line); }
/* "Pogled kot" (task pogled-kot): the hint in the personal menu and the bar above the page while a 1Klik member views as another group */
.ks-viewas-hint, .ks-profile-hint { color: var(--kui-muted); font-size: var(--kui-fs-xs); }
.ks-viewas { display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: var(--kui-warning-soft); color: var(--kui-warning); border-bottom: 1px solid var(--kui-warning-fill); font-size: var(--kui-fs-s); font-weight: 600; }
.ks-viewas > span { flex: 1; min-width: 0; }
.ks-viewas b { font-weight: 800; }
.ks-viewas-back { border: 1px solid var(--kui-warning-fill); background: var(--kui-surface); color: var(--kui-text); border-radius: var(--kui-radius); padding: 3px 10px; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ks-viewas-back:hover { background: var(--kui-row-hover); }
@media (max-width: 750px) { .ks-viewas { padding: 6px 10px; } .ks-viewas-more { display: none; } }
.ks-field-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--kui-muted); }
.ks-select { width: 100%; height: 34px; }
.ks-profile-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.ks-profile-line small { color: var(--kui-muted); }
.ks-check { cursor: pointer; }
.ks-check input { margin: 0; }
.ks-seg { display: inline-flex; padding: 2px; border: 1px solid var(--ks-line); border-radius: var(--kui-radius-m); background: var(--kui-surface-2); }
.ks-seg button { height: 28px; padding: 0 10px; border: 0; border-radius: var(--kui-radius); background: transparent; color: inherit; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ks-seg button.is-on { background: var(--kui-surface); color: var(--ks-ink); box-shadow: var(--kui-shadow-1); }
/* "Vse nastavitve ›" next to the first settings heading (task profil-nastavitve): Moj profil › Nastavitve */
.ks-link-btn { display: inline-flex; align-items: center; gap: 2px; border: 0; padding: 2px 4px; margin: -2px -4px; border-radius: var(--kui-radius);
    background: transparent; color: var(--kui-accent-ink); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ks-link-btn i { font-size: 11px; }
.ks-link-btn:hover { text-decoration: underline; }
.ks-row-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 8px; border: 0; border-radius: var(--kui-radius-m);
    background: transparent; color: inherit; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.ks-row-btn:hover { background: var(--ks-hover); }
.ks-row-end { margin-left: auto; }
.ks-danger { color: var(--kui-danger); font-weight: 600; }
.ks-wide { width: 100%; }
.ks-workday { padding: 0 4px 6px; }

/* ---------- brand (blue) header: the page stands apart from the header ---------- */
.ks-shell.is-brand .ks-top { background: var(--ks-brand-bg); color: #fff; border-bottom-color: transparent; box-shadow: var(--ks-brand-shadow); }
.ks-shell.is-brand .ks-icon-btn:hover { background: rgba(255, 255, 255, .16); }
.ks-shell.is-brand .ks-crumbs { color: rgba(255, 255, 255, .82); }
.ks-shell.is-brand .ks-crumbs strong { color: #fff; }
.ks-shell.is-brand .ks-search { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); color: #fff; }
.ks-shell.is-brand .ks-search-input { color: #fff; }
.ks-shell.is-brand .ks-search-input::placeholder { color: rgba(255, 255, 255, .85); }
.ks-shell.is-brand .ks-search:focus-within { background: var(--kui-surface); border-color: #fff; color: var(--kui-muted); box-shadow: none; }
.ks-shell.is-brand .ks-search:focus-within .ks-search-input { color: var(--kui-text); }
.ks-shell.is-brand .ks-kbd { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.ks-shell.is-brand .ks-search:focus-within .ks-kbd { border-color: var(--ks-line); color: var(--kui-muted); }
.ks-shell.is-brand .ks-top-btn { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); color: #fff; }
.ks-shell.is-brand .ks-top-btn:hover { background: rgba(255, 255, 255, .26); }
.ks-shell.is-brand .ks-avatar-btn .ks-avatar { background: #fff; color: var(--ks-brand-ink); box-shadow: 0 0 0 2px rgba(255, 255, 255, .45); }

.ks-shell :is(.ks-area, .ks-item, .ks-icon-btn, .ks-top-btn, .ks-row-btn, .ks-user, .ks-avatar-btn, .ks-search-row, .ks-seg button, .ks-link-btn):focus-visible {
    outline: 2px solid var(--kui-focus); outline-offset: 1px;
}
.ks-shell.is-brand .ks-top :is(.ks-icon-btn, .ks-top-btn, .ks-avatar-btn):focus-visible { outline-color: #fff; }

@media (max-width: 1100px) {
    .ks-crumbs { display: none; }
}
@media (max-width: 900px) {
    .ks-company-chip span, .ks-kbd { display: none; }
}

/* ---------- error of a page (Layout/AppErrorBoundary): KlikUI, so the shell's dark mode reaches it ---------- */
.ks-error { margin: 12px; padding: 16px 18px; border: 1px solid var(--kui-danger); border-left-width: 4px; border-radius: var(--kui-radius-l);
    background: var(--kui-danger-soft); color: var(--kui-text); }
.ks-error-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--kui-danger); }
.ks-error-msg { margin: 0 0 10px; overflow-wrap: anywhere; }
.ks-error-details { margin-bottom: 12px; font-size: 13px; }
.ks-error-details summary { cursor: pointer; color: var(--kui-text-2); }
.ks-error-details pre { max-height: 40dvh; margin: 8px 0 0; padding: 10px; overflow: auto; white-space: pre-wrap; font-size: 12px;
    border: 1px solid var(--kui-border-soft); border-radius: var(--kui-radius-m); background: var(--kui-surface); color: var(--kui-text); }
.ks-error-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- tablet (KlikShell ForceMini, 751-1024 px): the header button opens the mini menu over the page ---------- */
.ks-shell.is-mini.is-side-open > .ks-side .ks-side-inner { width: var(--ks-side-w); box-shadow: var(--ks-shadow-float); }
.ks-side-shade { position: fixed; inset: 0; z-index: 1015; padding: 0; border: 0; background: transparent; }
/* touch screens have no hover (a tap leaves a sticky :hover): the mini menu stays closed until the header button or a tap
   on an area opens it (is-side-open) */
@media (hover: none) {
    .ks-shell.is-mini:not(.is-side-open) > .ks-side .ks-side-inner { width: var(--ks-mini-w); box-shadow: none; }
    .ks-shell.is-mini:not(.is-side-open) > .ks-side :is(.ks-label, .ks-chev, .ks-items) { display: none; }
    .ks-shell.is-mini:not(.is-side-open) > .ks-side .ks-section { display: block; padding: 8px 10px; font-size: 0; }
    .ks-shell.is-mini:not(.is-side-open) > .ks-side .ks-section::before { content: ""; display: block; height: 1px; background: var(--ks-line); }
    .ks-shell.is-mini:not(.is-side-open) > .ks-side :is(.ks-area, .ks-brand, .ks-user) { justify-content: center; padding-left: 0; padding-right: 0; }
}

/* ---------- phone (<= 750 px): compact header, bottom bar, the menu in the "Več" sheet ---------- */
/* Room the phone parts take; klikui.css lifts sheets, drawers and windows over the bottom bar with --ks-tab-room. */
:root {
    --ks-tab-room: calc(64px + env(safe-area-inset-bottom, 0px));
    --ks-top-room: calc(56px + env(safe-area-inset-top, 0px));
}
.ks-phone-title, .ks-search-open, .ks-search-back, .ks-tabbar, .ks-phone-only { display: none; }

.ks-tabbar {
    position: fixed; z-index: 1035; left: 0; right: 0; bottom: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
    padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
    background: var(--kui-surface); border-top: 1px solid var(--ks-line); box-shadow: var(--kui-shadow-pop); font-family: var(--kui-font);
}
.ks-tab {
    min-width: 0; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0 2px;
    border: 0; background: transparent; color: var(--kui-muted); font: inherit; font-size: 11px; line-height: 1.15; text-decoration: none;
    cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.ks-tab:hover { color: var(--kui-text); }
.ks-tab i { font-size: 21px; line-height: 1; padding: 3px 14px; border-radius: 999px; transition: background-color .15s ease; }
.ks-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks-tab.is-current { color: var(--ks-ink); font-weight: 600; }
.ks-tab.is-current i { background: var(--ks-soft); }
.ks-tab-home {
    justify-self: center; width: 54px; height: 54px; margin-top: -26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-size: 24px; text-decoration: none;
    background: var(--kui-accent); color: var(--kui-on-accent); box-shadow: var(--kui-shadow-pop); touch-action: manipulation;
}
.ks-tab-home:hover { color: var(--kui-on-accent); }
.ks-tab-home.is-current { box-shadow: 0 0 0 4px var(--kui-focus-ring), var(--kui-shadow-pop); }
.ks-tabbar :is(.ks-tab, .ks-tab-home):focus-visible { outline: 2px solid var(--kui-focus); outline-offset: 1px; }

/* "Več": search button, shortcuts as tiles, the menu (rows high enough for a finger), user + Odjava in the footer */
.ks-more-search { display: flex; align-items: center; gap: 8px; width: 100%; height: 44px; margin-bottom: 6px; padding: 0 12px; border: 1px solid var(--ks-line);
    border-radius: var(--ks-radius); background: var(--kui-surface-2); color: var(--kui-muted); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.ks-more .ks-section { padding-left: 4px; padding-right: 4px; }
.ks-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 4px 0 6px; }
.ks-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; padding: 8px 4px;
    border: 1px solid var(--ks-line); border-radius: var(--ks-radius); background: var(--kui-surface-2); color: var(--kui-text);
    font: inherit; font-size: 12px; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; touch-action: manipulation;
}
.ks-tile:hover { color: var(--kui-text); background: var(--ks-hover); }
.ks-tile i { font-size: 20px; color: var(--ks-ink); }
.ks-tile span { overflow-wrap: anywhere; }
.ks-tile.is-current { background: var(--ks-soft); border-color: var(--kui-accent); }
.ks-tile--add { border-style: dashed; background: transparent; color: var(--kui-muted); }
.ks-more-nav { flex: none; overflow: visible; padding: 0; }
.ks-more :is(.ks-area, .ks-item-row) { min-height: 44px; }
.ks-more .ks-item { padding-top: 10px; padding-bottom: 10px; }
.ks-more .ks-star { width: 40px; height: 40px; opacity: .6; }
.ks-more .ks-star.is-on { opacity: 1; }
.ks-more :is(.ks-tile, .ks-more-search):focus-visible { outline: 2px solid var(--kui-focus); outline-offset: 1px; }

@media (max-width: 1100px) {
    .ks-crumbs { display: none; }
}
@media (max-width: 900px) {
    .ks-company-chip span, .ks-kbd { display: none; }
}
@media (max-width: 750px) {
    .ks-side, .ks-side-shade, .ks-crumbs, .ks-menu-btn, .ks-desk-only, .ks-company-chip, .ks-top-spacer, .ks-search { display: none; }
    .ks-phone-only { display: flex; }
    .ks-tabbar { display: grid; }
    .ks-search-open { display: inline-flex; }
    .ks-phone-title { display: block; flex: 1 1 auto; min-width: 0; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 700; }

    .ks-top {
        gap: 2px; height: var(--ks-top-room);
        padding: env(safe-area-inset-top, 0px) max(6px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
    }
    .ks-shell .ks-top .ks-ai-btn { width: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
    .ks-shell .ks-top .ks-ai-btn span { display: none; }
    .ks-shell .ks-top .ks-ai-btn.is-on { background: var(--ks-soft); }
    /* --ks-content-pad-top: pinned phone list heads (Pogodbe, Stranke, Dokumenti, Terjatve) stick at top: -this, over the padding */
    .ks-content { --ks-content-pad-top: 6px; padding: var(--ks-content-pad-top) 8px calc(var(--ks-tab-room) + 12px); }
    :root:has(.ks-shell) { --kui-page-h: calc(100dvh - var(--ks-top-room) - var(--ks-tab-room) - 18px); }

    /* search mode: the field over the whole header, the results under it */
    .ks-shell.is-searching .ks-top > :not(.ks-search, .ks-search-back) { display: none; }
    .ks-shell.is-searching .ks-search-back { display: inline-flex; }
    .ks-shell.is-searching .ks-search { display: flex; flex: 1 1 auto; min-width: 0; }
    .ks-search-pop { position: fixed; top: calc(var(--ks-top-room) + 4px); left: 8px; right: 8px; min-width: 0;
        max-height: calc(100dvh - var(--ks-top-room) - var(--ks-tab-room) - 16px); }
    .ks-search-row { min-height: 44px; }

    /* personal menu and notifications: full width under the header */
    .ks-pop { position: fixed; top: calc(var(--ks-top-room) + 6px); left: 8px; right: 8px; width: auto;
        max-height: calc(100dvh - var(--ks-top-room) - var(--ks-tab-room) - 16px); }
    .ks-row-btn { min-height: 44px; }

    /* KlikUI toasts (bottom right, 40 px) above the bottom bar, not over its buttons (task novice-opozorilo) */
    :root:has(.ks-tabbar) .kui-toasts { bottom: calc(var(--ks-tab-room) + 8px); left: 8px; right: 8px; align-items: flex-end; }

    /* KlikAI and Novosti: the whole screen above the bottom bar */
    .ks-ai { top: env(safe-area-inset-top, 0px); bottom: var(--ks-tab-room); width: 100vw; border-left: 0; }
}
