/*
 * Bills – spoločný vzhľad. Bez externých fontov a skriptov.
 * Mobile-first: základ je pre telefón, širšie obrazovky dopĺňajú @media.
 */

:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #dde3ea;
  --border-strong: #c3ccd7;
  /* Vnorené bloky zoznamov: jemne modrastá výplň a výraznejší obrys. */
  --box-bg: #f1f5fa;
  --box-border: #c5cfdb;
  --text: #17202b;
  --text-strong: #0a1018;
  --text-muted: #5b6776;
  --accent: #1f5fbf;
  --accent-hover: #184d9c;
  --accent-soft: #e8f0fc;
  --accent-text: #ffffff;
  --success: #17794a;
  --success-soft: #e5f5ec;
  --warning: #8a5a00;
  --orange: #d97706;
  /* Guličky rizikového profilu: čistá červená a jantárová oranžová, aby sa odlíšili aj v malej veľkosti. */
  --dot-red: #e00000;
  --dot-orange: #f59e0b;
  /* Ponuka profilu: tónovaný podklad odlišný od kariet aj pozadia stránky. */
  --menu-bg: #e6edf6;
  --menu-border: #b9c6d6;
  --menu-hover: #ffffff;
  --warning-soft: #fdf3dc;
  --danger: #b42318;
  --danger-hover: #93190f;
  --danger-soft: #fdecea;
  --focus: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

/* Tmavý režim: podľa systému, ak si používateľ nezvolil svetlý; alebo vždy pri voľbe tmavý. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f141a;
    --surface: #171e26;
    --surface-2: #1d2630;
    --border: #2a3542;
    --border-strong: #3a4757;
    --box-bg: #1c2631;
    --box-border: #3d4b5c;
    --text: #e7edf3;
    --text-strong: #f7fafc;
    --text-muted: #9aa7b6;
    --accent: #5b9bf0;
    --accent-hover: #7cb0f5;
    --accent-soft: #1b2b42;
    --accent-text: #0b1420;
    --success: #4cc38a;
    --success-soft: #15291f;
    --warning: #e3b341;
    --orange: #f59e0b;
    --dot-red: #ff3b3b;
    --dot-orange: #fbbf24;
    --menu-bg: #253142;
    --menu-border: #45566b;
    --menu-hover: #314056;
    --warning-soft: #2d2412;
    --danger: #f2766b;
    --danger-hover: #f6958c;
    --danger-soft: #34191a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141a;
  --surface: #171e26;
  --surface-2: #1d2630;
  --border: #2a3542;
  --border-strong: #3a4757;
  --box-bg: #1c2631;
  --box-border: #3d4b5c;
  --text: #e7edf3;
  --text-strong: #f7fafc;
  --text-muted: #9aa7b6;
  --accent: #5b9bf0;
  --accent-hover: #7cb0f5;
  --accent-soft: #1b2b42;
  --accent-text: #0b1420;
  --success: #4cc38a;
  --success-soft: #15291f;
  --warning: #e3b341;
  --orange: #f59e0b;
  --dot-red: #ff3b3b;
  --dot-orange: #fbbf24;
  --menu-bg: #253142;
  --menu-border: #45566b;
  --menu-hover: #314056;
  --warning-soft: #2d2412;
  --danger: #f2766b;
  --danger-hover: #f6958c;
  --danger-soft: #34191a;
  --shadow: none;
}
:root[data-theme="light"] { color-scheme: light; }

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
small, .muted { color: var(--text-muted); }
code, pre, .mono { font-family: var(--mono); font-size: .925em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Hlavička a navigácia -------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  position: relative;
  max-width: 1040px; margin: 0 auto; padding: .625rem 1rem;
  display: flex; align-items: center; gap: .75rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 750; font-size: 1.125rem; color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text);
  font-size: .95rem; font-weight: 800;
}
/* Značka testovacieho prostredia (config bills.beta), viditeľná aj na úzkom telefóne. */
.brand-beta {
  padding: .125rem .5rem; border-radius: 6px;
  background: #c2410c; color: #fff;
  font-size: .75rem; font-weight: 800; letter-spacing: .08em; line-height: 1.4;
}
@media print { .brand-beta { background: none; color: #000; border: 1px solid #000; } }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: .375rem; min-width: 0; }

.icon {
  width: 18px; height: 18px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Rozbaľovacia ponuka (details/summary) */
.dropdown { position: relative; min-width: 0; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + .5rem); z-index: 20;
  width: min(300px, calc(100vw - 2rem)); max-height: min(70vh, 480px); overflow-y: auto;
  padding: .375rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(16 24 40 / 14%), 0 2px 6px rgb(16 24 40 / 8%);
}
.dropdown-panel form { margin: 0; }
.dropdown-label {
  padding: .375rem .625rem .25rem;
  color: var(--text-muted); font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em;
}
.dropdown-item {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; min-height: 44px; padding: .5rem .625rem;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  font: inherit; font-size: .95rem; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--surface-2); color: var(--text); }
.dropdown-item.is-current { color: var(--accent); font-weight: 650; cursor: default; }
.dropdown-item.is-current:hover { background: transparent; }
.dropdown-item-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-sep { height: 1px; margin: .375rem 0; background: var(--border); }
.dropdown-empty { padding: .5rem .625rem; color: var(--text-muted); font-size: .9rem; }

/* Tlačidlo výberu firmy */
.company-trigger {
  display: flex; align-items: center; gap: .375rem;
  min-height: 40px; max-width: 42vw; padding: .375rem .625rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: .9rem; font-weight: 600;
  transition: border-color .15s, background-color .15s;
}
.company-trigger:hover { border-color: var(--accent); background: var(--surface-2); }
.company-trigger > .icon:first-child { color: var(--text-muted); }
.company-trigger.is-empty { border-color: var(--warning); background: var(--warning-soft); color: var(--warning); }
.company-trigger.is-empty > .icon:first-child { color: currentColor; }
.company-trigger-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-trigger .chevron { width: 16px; height: 16px; color: var(--text-muted); transition: transform .15s; }
.dropdown[open] > .company-trigger { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dropdown[open] > .company-trigger .chevron { transform: rotate(180deg); }

/* Ikona profilu */
.avatar {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: .85rem; font-weight: 750; letter-spacing: .02em; text-decoration: none;
  border: 2px solid transparent;
}
.avatar:hover { color: var(--accent); border-color: var(--accent); }
.avatar.is-current { background: var(--accent); color: var(--accent-text); }
.avatar-lg { width: 64px; height: 64px; font-size: 1.35rem; }

.nav {
  max-width: 1040px; margin: 0 auto; padding: 0 .5rem;
  display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: 0 0 auto; padding: .625rem .75rem;
  color: var(--text-muted); text-decoration: none; font-weight: 550; font-size: .95rem;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* --- Obsah --------------------------------------------------------- */

.page { max-width: 1040px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { margin-bottom: 1rem; }
.page-head p { color: var(--text-muted); }

.stack > * + * { margin-top: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 1rem; }

/* --- Formuláre ----------------------------------------------------- */

.field { display: block; margin-bottom: 1rem; }
.field-label { display: block; font-weight: 600; font-size: .925rem; margin-bottom: .375rem; }
.field-hint { display: block; color: var(--text-muted); font-size: .85rem; margin-top: .375rem; }

.input, .select {
  display: block; width: 100%;
  min-height: 46px; padding: .625rem .75rem;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-code { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .25em; text-align: center; }
.select { appearance: none; padding-right: 2.25rem; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.check { display: flex; gap: .625rem; align-items: flex-start; margin-bottom: 1rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: .15rem 0 0; accent-color: var(--accent); flex: 0 0 auto; }

.form-row { display: grid; gap: 0 1rem; }
.form-row[hidden] { display: none; }

/* --- Tlačidlá ------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .5rem 1rem;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-text); }
.btn-block { width: 100%; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
/* Čaká na akciu (napr. interná kontrola AML): oranžový rámik a podklad. */
.btn-attention { background: var(--warning-soft); color: var(--warning); border-color: var(--dot-orange); }
.btn-attention:hover { background: var(--dot-orange); color: #1a1205; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger-hover); border-color: var(--danger); }
/* Hlavné „+“ (pridanie): okrúhle, väčšie a s tieňom, aby sa odlíšilo od ostatných tlačidiel. */
.btn-add {
  width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-add .icon { width: 24px; height: 24px; stroke-width: 2.6; }
.btn-add:hover { transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 55%, transparent); }
@media print { .btn-add { display: none; } }
.btn-sm { min-height: 36px; padding: .375rem .75rem; font-size: .875rem; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline { display: inline; margin: 0; }

/* --- Hlásenia a štítky -------------------------------------------- */

.alert .registry-retry { margin-left: .25rem; vertical-align: middle; }
.alert {
  display: flex; gap: .625rem; align-items: flex-start;
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; margin-bottom: 1rem; font-weight: 500;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-info { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 20%, transparent); }

.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .125rem .5rem; border-radius: 999px;
  font-size: .78rem; font-weight: 650; line-height: 1.5; white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* --- Zoznamy (namiesto tabuliek, dobre čitateľné aj na mobile) ---- */

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; flex-direction: column; gap: .75rem;
  padding: 1rem 0; border-top: 1px solid var(--border);
}
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item:last-child { padding-bottom: 0; }
.list-main { min-width: 0; }
.list-title { font-weight: 600; overflow-wrap: anywhere; }
.list-meta { color: var(--text-muted); font-size: .875rem; overflow-wrap: anywhere; }
.list-item.is-active { background: var(--accent-soft); margin: 0 -1.25rem; padding-left: 1.25rem; padding-right: 1.25rem; }
.list-item.is-active:first-child { padding-top: 1rem; }
/* Aktívna prvá položka siaha po horný okraj karty iba vtedy, keď je zoznam na začiatku karty
   (aj v obale). Pod nadpisom, tlačidlom alebo filtrom nevyčnieva a nič neprekrýva. */
.card > .list:first-child > .list-item.is-active:first-child,
.card > :first-child:not(.card-head, .filters) > .list:first-child > .list-item.is-active:first-child { margin-top: -1.25rem; border-radius: var(--radius) var(--radius) 0 0; }

.empty { color: var(--text-muted); text-align: center; padding: 1.5rem 0; }

/* --- Prihlásenie --------------------------------------------------- */

.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.auth-box { width: 100%; max-width: 420px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.auth-brand .brand { font-size: 1.5rem; }
.auth-brand .brand-mark { width: 40px; height: 40px; font-size: 1.2rem; border-radius: 10px; }
.auth .card { padding: 1.5rem; }
.auth h1 { font-size: 1.35rem; }
.auth-lead { color: var(--text-muted); margin-bottom: 1.25rem; }
.auth-foot { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--text-muted); }
.auth-foot a { color: var(--text-muted); }
.auth-foot a[aria-current="true"] { color: var(--text); font-weight: 600; text-decoration: none; }

/* --- Zabezpečenie --------------------------------------------------- */

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 1rem; }
.app-links { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin-top: .4rem; font-size: .9rem; }
.app-links-name { color: var(--text-muted); }
.app-link { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.app-link .icon { width: 1rem; height: 1rem; }
.steps li { counter-increment: step; position: relative; padding-left: 2.25rem; margin-bottom: .75rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.secret {
  display: block; padding: .75rem 1rem; margin: .5rem 0;
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 1.05rem; letter-spacing: .08em; word-spacing: .3em;
  overflow-wrap: anywhere; user-select: all;
}
.codes {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem;
  list-style: none; padding: 0; margin: .75rem 0 0;
}
.codes li {
  padding: .5rem; text-align: center; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: .95rem; user-select: all;
}
details.disclosure > summary { cursor: pointer; color: var(--text-muted); font-size: .9rem; }
details.disclosure[open] > summary { margin-bottom: .5rem; }

/* --- Väčšie obrazovky --------------------------------------------- */

@media (min-width: 640px) {
  .company-trigger { max-width: 280px; }
  h1 { font-size: 1.75rem; }
  .page { padding: 2rem 1.5rem 4rem; }
  .card { padding: 1.5rem; }
  .list-item { flex-direction: row; align-items: center; justify-content: space-between; }
  .list-item.is-active { margin: 0 -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; }
  .card > .list:first-child > .list-item.is-active:first-child,
  .card > :first-child:not(.card-head, .filters) > .list:first-child > .list-item.is-active:first-child { margin-top: -1.5rem; }
  .list-main { flex: 1 1 auto; }
  .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row .span-2 { grid-column: span 2; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .codes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .company-chip { max-width: 280px; }
  .auth .card { padding: 2rem; }
}

@media (min-width: 900px) {
  .topbar-inner { padding: .75rem 1.5rem; }
  .nav { padding: 0 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Celá karta ako odkaz (rozcestník). */
.card-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.card-link:hover { color: inherit; border-color: var(--accent); }

.select-sm { width: auto; min-height: 36px; padding: .25rem 2.25rem .25rem .75rem; font-size: .9rem; }
.mt { margin-top: 1rem; }

/* Veľmi úzke telefóny: v hlavičke ostane iba logo, firma, zvonček a ikona profilu. */
/* Úzke telefóny: logo bez textu, viac miesta pre firmu. */
@media (max-width: 520px) {
  .topbar-inner { gap: .5rem; }
  .topbar .brand-text { display: none; }
  .company-trigger { max-width: none; }
  .company-menu { flex: 1 1 auto; }
  .topbar-end { flex: 1 1 auto; justify-content: flex-end; }
}

/* --- Profil -------------------------------------------------------- */

.profile-head { display: flex; align-items: center; gap: 1rem; }
.profile-head > div { min-width: 0; }
.profile-head h1 { overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .5rem; }

/* --- Nastavenia ---------------------------------------------------- */

.subnav {
  display: flex; gap: .25rem; margin: 0 0 1rem; padding: .25rem;
  overflow-x: auto; scrollbar-width: none;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex: 0 0 auto; padding: .5rem .875rem; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600; font-size: .925rem; text-decoration: none;
}
.subnav a:hover { color: var(--text); background: var(--surface); }
.subnav a[aria-current="page"] { color: var(--accent); background: var(--surface); box-shadow: var(--shadow); }
.fieldset { border: 0; padding: 0; margin: .5rem 0 1rem; min-width: 0; }
.fieldset legend { font-weight: 700; margin-bottom: .75rem; padding: 0; }
.check .field-hint { margin-top: .25rem; }

/* --- Apps, Personal, Administration -------------------------------- */

.app-card { display: flex; align-items: center; gap: 1rem; }
.app-card h2 { margin: 0; }
/* Dlaždica aplikácie: odkaz cez celú plochu, ponuka správy nad ním v pravom hornom rohu. */
.app-tile { position: relative; }
.app-tile .app-open { color: inherit; text-decoration: none; }
.app-tile .app-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.app-tile .app-open:focus-visible { outline: none; }
.app-tile:has(.app-open:focus-visible) { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
/* Roh dlaždice (prepínač, ponuka ⋯) je nad odkazom cez celú plochu. */
.app-tile { padding-right: 3rem; }
.app-corner { position: absolute; bottom: .5rem; right: .5rem; z-index: 1; display: flex; align-items: center; gap: .25rem; }
.app-manage { position: relative; }
.app-switch-form { margin: 0; }
/* Vypínač Zapnuté/Vypnuté: okrúhla ikona so symbolom napájania, iba ikona bez animácie.
   Vypnuté = sivý kruh, páčka dolu; zapnuté = zelený kruh, páčka hore. */
.switch { display: inline-grid; place-items: center; cursor: pointer; width: 36px; height: 36px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-icon { width: 24px; height: 24px; display: block; border-radius: 50%; }
.switch-disc { fill: var(--text-muted); }
.switch-symbol { stroke: #fff; transform: rotate(180deg); transform-origin: 24px 24px; }
.switch input:checked + .switch-icon .switch-disc { fill: var(--success); }
.switch input:checked + .switch-icon .switch-symbol { transform: none; }
.switch:hover .switch-icon { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch input:focus-visible + .switch-icon { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-icon { opacity: .6; }
@media print { .app-corner { display: none; } }
.app-manage > summary { min-width: 36px; min-height: 36px; padding: .25rem; justify-content: center; }
.app-icon {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 1.25rem; font-weight: 800;
}
.tabs { display: flex; gap: .25rem; margin: 0 0 1rem; border-bottom: 1px solid var(--border); }
.tabs a {
  padding: .5rem .875rem; margin-bottom: -1px;
  color: var(--text-muted); font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.choice-list { display: grid; gap: .625rem; }
.choice {
  display: flex; align-items: center; gap: .75rem; min-height: 52px; padding: .75rem 1rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface);
}
.choice:hover { border-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.choice-body { min-width: 0; }
.theme-swatch { flex: 0 0 auto; width: 40px; height: 28px; border-radius: 6px; border: 1px solid var(--border-strong); }
.theme-swatch-light { background: linear-gradient(135deg, #ffffff 50%, #e8f0fc 50%); }
.theme-swatch-dark { background: linear-gradient(135deg, #171e26 50%, #1b2b42 50%); }
.theme-swatch-system { background: linear-gradient(135deg, #ffffff 50%, #171e26 50%); }
.facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: .125rem .75rem; margin: 0; }
.facts dt { color: var(--text-muted); font-size: .875rem; margin-top: .5rem; }
.facts dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.stat {
  display: flex; flex-direction: column; gap: .125rem; padding: 1rem 1.25rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-label { color: var(--text-muted); font-size: .9rem; }
@media (min-width: 640px) {
  .facts { grid-template-columns: minmax(10rem, 1fr) 2fr; }
  .facts dt { margin-top: 0; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice-grid .choice { flex-direction: column; align-items: flex-start; }
}
@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 640px) and (max-width: 899px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Telefóny: ponuka firiem sa ukotví na celú šírku hlavičky, nie na tlačidlo,
   aby nevyšla mimo obrazovky (tlačidlo nie je pri pravom okraji). */
@media (max-width: 640px) {
  .company-menu { position: static; }
  .company-menu > .dropdown-panel {
    left: .75rem; right: .75rem; top: calc(100% - .125rem);
    width: auto; max-height: calc(100dvh - 5rem);
  }
}


/* --- Pozvánky ----------------------------------------------------- */

.list-check { margin: 0; flex: 1 1 auto; min-width: 0; }
.list-check .list-main { display: flex; flex-direction: column; gap: .125rem; }
.compact-list .list-item { padding-top: .625rem; padding-bottom: .625rem; }
.notice-link { display: block; margin-bottom: 1rem; text-decoration: none; font-weight: 600; }
.notice-link:hover { text-decoration: underline; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin: .25rem 0 1rem; }
.filters .field { margin: 0; min-width: 12rem; flex: 1 1 12rem; }
@media (min-width: 640px) { .filters .field { flex: 0 1 16rem; } }

/* --- Rozloženie „side“: menu v bočnom stĺpci, na mobile vysúvacie ---- */

.layout-side .topbar-inner { max-width: 1296px; }
.layout-side .subnav { display: none; }
.sidebar { display: none; }
.menu-button {
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: -.375rem;
  border-radius: var(--radius-sm); color: var(--text); cursor: pointer; list-style: none;
}
.menu-button::-webkit-details-marker { display: none; }
.menu-button:hover { background: var(--surface-2); }
.menu-button .icon { width: 22px; height: 22px; }
.drawer-panel {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  width: min(300px, 86vw); overflow-y: auto; padding: .75rem .75rem 2rem;
  background: var(--surface); border-right: 1px solid var(--border);
  box-shadow: 8px 0 30px rgb(16 24 40 / 18%);
  animation: drawer-in .18s ease-out;
}
.drawer-backdrop { position: fixed; inset: 0; z-index: 49; background: rgb(10 15 20 / 45%); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: .125rem .25rem .75rem; }
.drawer-close { min-width: 40px; padding-inline: .5rem; }
body:has(.drawer[open]) { overflow: hidden; }
@keyframes drawer-in { from { transform: translateX(-100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .drawer-panel { animation: none; } }

.sidenav { display: flex; flex-direction: column; gap: 1.25rem; }
/* Prvá úroveň menu: výrazný nadpis sekcie s tenkou linkou pod ním. */
.sidenav-head {
  display: flex; align-items: center; gap: .5rem; padding: .25rem .625rem .5rem; margin-bottom: .375rem;
  border-bottom: 1px solid var(--border);
  color: var(--text); font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
}
.sidenav-head::before { content: ""; width: 4px; height: 1em; border-radius: 2px; background: var(--border-strong); }
.sidenav-section.is-active .sidenav-head { color: var(--accent); }
.sidenav-section.is-active .sidenav-head::before { background: var(--accent); }
.sidenav-head:hover { color: var(--accent); }
.sidenav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .125rem; }
.sidenav li a {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  min-height: 40px; padding: .5rem .75rem; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 550; font-size: .95rem; text-decoration: none;
}
.sidenav li a:hover { background: var(--surface-2); color: var(--text); }
.sidenav li a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.sidenav .count {
  min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px; text-align: center;
  background: var(--accent); color: var(--accent-text); font-size: .75rem; font-weight: 700; line-height: 1.5rem;
}

@media (min-width: 900px) {
  .layout-side .drawer { display: none; }
  /* Obsah má rovnakú šírku (1040 px) ako pri menu hore; menu je stĺpec vedľa neho. */
  .layout-side .shell { display: grid; grid-template-columns: 256px minmax(0, 1040px); align-items: start; max-width: 1296px; margin: 0 auto; }
  .layout-side .sidebar {
    display: block; position: sticky; top: var(--topbar-h, 61px);
    max-height: calc(100dvh - var(--topbar-h, 61px)); overflow-y: auto;
    padding: 1.25rem .75rem 2rem; border-right: 1px solid var(--border); min-height: calc(100dvh - var(--topbar-h, 61px));
  }
  .layout-side .page { width: 100%; max-width: 1040px; margin: 0; }
}

/* Náhľady rozloženia v nastavení vzhľadu */
.layout-swatch {
  position: relative; flex: 0 0 auto; width: 44px; height: 32px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); overflow: hidden;
}
.layout-swatch i, .layout-swatch b { position: absolute; background: var(--accent); opacity: .55; }
.layout-swatch-top i { left: 0; right: 0; top: 0; height: 7px; }
.layout-swatch-top b { left: 6px; right: 6px; top: 12px; height: 3px; opacity: .25; }
.layout-swatch-side i { left: 0; top: 0; bottom: 0; width: 11px; }
.layout-swatch-side b { left: 16px; right: 5px; top: 6px; height: 3px; opacity: .25; }
.filter-chips { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: .5rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.filter-chips legend { padding: 0; margin-bottom: .375rem; }
.chip {
  display: inline-flex; align-items: center; gap: .375rem; min-height: 36px; padding: .25rem .75rem;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  font-size: .875rem; font-weight: 550; color: var(--text); cursor: pointer; text-decoration: none; user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip-count { color: var(--text-muted); font-weight: 600; }
.chip:has(input:checked) .chip-count { color: inherit; }
.chip-clear { border-style: dashed; color: var(--text-muted); }
[aria-busy="true"] { opacity: .55; transition: opacity .15s; }
.chip[hidden] { display: none; }
.chip-sm { padding: .25rem .625rem; font-size: .85rem; min-height: 34px; }
/* Právo čaká na prijatie pozvánky (napr. administrátor firmy): oranžové, nemenné. */
.chip.is-pending, .chip.is-pending:has(input:checked) { background: var(--warning-soft); border-color: var(--dot-orange); color: var(--warning); cursor: help; }
.chip.is-pending input { accent-color: var(--dot-orange); }
/* Overenie práva v obchodnom registri (rozhodnutie 0029) */
.rv-list { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; gap: .25rem; font-size: .85rem; }
.rv { display: flex; gap: .4rem; align-items: baseline; }
.rv-icon { flex: 0 0 1.2rem; height: 1.2rem; display: inline-grid; place-items: center; border-radius: 50%; font-size: .75rem; font-weight: 800;
  background: var(--surface-2); color: var(--text-muted); }
.rv-match .rv-icon { background: var(--success-soft); color: var(--success); }
.rv-partial .rv-icon { background: var(--warning-soft); color: var(--warning); }
.rv-none .rv-icon { background: var(--danger-soft, var(--warning-soft)); color: var(--danger, var(--warning)); }
/* Dátum DD.MM.RRRR s tlačidlom kalendára (core.partials.date-input) */
.date-control { display: flex; align-items: center; gap: 8px; }
.date-control > .input { min-width: 0; flex: 1 1 auto; }
.date-control { position: relative; }
.date-picker-button { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; font: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.date-picker-button:hover, .date-picker-button[aria-expanded="true"] { border-color: var(--accent); }
/* Vlastný kalendár: mesiac a rok zo zoznamu, dni v mriežke (týždeň od pondelka). */
.calendar { position: absolute; z-index: 30; top: calc(100% + .375rem); right: 0; width: min(300px, calc(100vw - 2rem)); padding: .625rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgb(16 24 40 / 14%), 0 2px 6px rgb(16 24 40 / 8%); }
.calendar-head { display: flex; align-items: center; gap: .375rem; margin-bottom: .5rem; }
.calendar-head .select { flex: 1 1 auto; min-width: 0; padding-right: 1.75rem; }
.calendar-nav { flex: 0 0 34px; height: 34px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 1.1rem; cursor: pointer; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.calendar-dow { font-size: .72rem; font-weight: 650; color: var(--text-muted); text-transform: uppercase; padding: .25rem 0; }
.calendar-day { height: 36px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.calendar-day:hover { background: var(--surface-2); }
.calendar-day.is-today { box-shadow: inset 0 0 0 1px var(--accent); }
.calendar-day.is-picked { background: var(--accent); color: var(--accent-text); }
.calendar-day:disabled { color: var(--text-muted); opacity: .45; cursor: default; background: transparent; }
@media print { .date-picker-button, .calendar { display: none; } }
.rights-picker { display: flex; flex-wrap: wrap; gap: .375rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.badge-group { background: var(--surface-2); }
.filter-group { max-width: 18rem; margin-top: .5rem; }
.rights-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.check-inline { margin: 0; align-items: center; font-size: .875rem; white-space: nowrap; }
.check-inline input { margin: 0; }
.field-inline { display: flex; align-items: center; gap: .5rem; margin: 0; }
.field-inline .field-label { margin: 0; white-space: nowrap; }

/* --- Zvonček upozornení ------------------------------------------- */

.icon-button {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; color: var(--text-muted); cursor: pointer;
}
.icon-button:hover, .dropdown[open] > .icon-button { background: var(--surface-2); color: var(--text); }
.icon-button .icon { width: 20px; height: 20px; }
.bell-badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #d92d20; color: #fff; border: 2px solid var(--surface);
  font-size: .68rem; font-weight: 800; line-height: 14px; text-align: center; box-sizing: border-box;
}
.bell-panel { width: min(360px, calc(100vw - 1.5rem)); }
.bell-item { display: flex; flex-direction: column; gap: .5rem; padding: .625rem; border-radius: var(--radius-sm); }
.bell-item + .bell-item { border-top: 1px solid var(--border); border-radius: 0; }
.bell-text { display: flex; flex-direction: column; gap: .125rem; font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }
.bell-text .muted { font-size: .8rem; }
.bell-actions { display: flex; gap: .5rem; margin: 0; }
@media (max-width: 640px) {
  .bell-menu { position: static; }
  .bell-menu > .dropdown-panel { left: .75rem; right: .75rem; top: calc(100% - .125rem); width: auto; max-height: calc(100dvh - 5rem); }
}

/* --- Automatické ukladanie a vzor Upraviť ------------------------- */

.toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 60; transform: translate(-50%, 1rem);
  max-width: calc(100vw - 2rem); padding: .625rem 1rem; border-radius: var(--radius-sm);
  background: var(--text); color: var(--surface); font-weight: 600; font-size: .925rem;
  box-shadow: 0 8px 24px rgb(16 24 40 / 25%); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); color: #fff; }
.edit-btn {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 32px; padding: .25rem .6rem;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--text-muted); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.edit-btn:hover { color: var(--accent); background: var(--accent-soft); }
.edit-btn .icon { width: 15px; height: 15px; }
html:not(.js) .edit-btn { display: none; }
.js .editable:not(.is-editing) .edit-form { display: none; }
.editable.is-editing .edit-view, .editable.is-editing .edit-btn { display: none; }
.edit-form .actions { margin-top: .5rem; }
.view-value { font-weight: 550; overflow-wrap: anywhere; }
.view-empty { color: var(--text-muted); font-style: italic; }

/* --- Zastúpenie ---------------------------------------------------- */

.impersonation-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1rem;
  padding: .5rem 1rem; background: #b54708; color: #fff; font-weight: 650; font-size: .9rem; text-align: center;
}
.impersonation-bar .btn { background: #fff; color: #b54708; border-color: #fff; min-height: 32px; }
.impersonation-bar .btn:hover { background: #fef0c7; color: #93370d; }
.avatar-menu > summary { list-style: none; cursor: pointer; }
.avatar-menu > summary::-webkit-details-marker { display: none; }
.avatar-menu > .dropdown-panel { width: min(280px, calc(100vw - 1.5rem)); background: var(--menu-bg); border-color: var(--menu-border); }
.avatar-menu .dropdown-item:hover, .avatar-menu .dropdown-item:focus-visible { background: var(--menu-hover); }
.avatar-menu .dropdown-sep { background: var(--menu-border); }
.avatar-head { display: flex; flex-direction: column; padding: .5rem .625rem .25rem; overflow-wrap: anywhere; }
.avatar-head .muted { font-size: .85rem; }
@media (max-width: 640px) {
  .avatar-menu { position: static; }
  .avatar-menu > .dropdown-panel { left: .75rem; right: .75rem; top: calc(100% - .125rem); width: auto; }
}
.layout-side:has(.impersonation-bar) { --topbar-h: 110px; }
.bell-warning { position: absolute; top: 0; left: -2px; width: 18px; height: 18px; filter: drop-shadow(0 0 1px var(--surface)); }
.bell-warning svg { width: 18px; height: 18px; fill: #f5b301; }
.bell-impersonation { display: block; background: #fef7e0; border: 1px solid #f5d77a; border-radius: var(--radius-sm); text-decoration: none; color: #5c3b00; margin-bottom: .375rem; }
.bell-impersonation:hover { background: #fdf0c2; color: #5c3b00; }
.bell-impersonation .muted { color: #7a5a12; }
:root[data-theme="dark"] .bell-impersonation { background: #2d2412; border-color: #6b5316; color: #f3d98b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bell-impersonation { background: #2d2412; border-color: #6b5316; color: #f3d98b; } }
.auth-link { text-align: center; margin: 1rem 0 0; font-size: .925rem; }
.recovery-form .list-main .input { max-width: 26rem; }

/* --- Režim správcu ------------------------------------------------- */

/* Zapnutý režim správcu: červený obrys ikony profilu, stav a vypnutie v jej ponuke. */
.avatar.is-admin-mode { border-color: #d92d20; box-shadow: 0 0 0 2px rgba(217, 45, 32, .22); }
.avatar.is-admin-mode:hover { border-color: #b42318; }
.admin-mode-state { padding: .375rem .625rem; font-size: .8rem; font-weight: 700; color: #b42318; }
.admin-mode-stop { color: #b42318; }
:root[data-theme="dark"] .admin-mode-state, :root[data-theme="dark"] .admin-mode-stop { color: #f97066; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .admin-mode-state, :root:not([data-theme="light"]) .admin-mode-stop { color: #f97066; } }
/* PIN nie je pole typu heslo (prehliadač ani správca hesiel ho neponúkne uložiť); znaky skryje CSS. */
.passkey-quick { margin-bottom: .5rem; }
.input-with-action > .input { flex: 1 1 auto; min-width: 0; }
.registry-results { margin: .5rem 0 1rem; }
.registry-pick { display: flex; flex-direction: column; align-items: flex-start; gap: .125rem; width: 100%; padding: .5rem .625rem; border: 0; border-radius: var(--radius-sm); background: transparent; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.registry-pick:hover, .registry-pick:focus-visible { background: var(--surface-2); }
.registry-search { margin-bottom: .5rem; }
.registry-notice { margin: .5rem 0; }
.registry-pick.is-picked { background: var(--accent-soft); }
.input-with-action { display: flex; align-items: center; gap: .5rem; }
.passkey-icon { flex: 0 0 auto; display: inline-grid; place-items: center; width: 48px; min-height: 48px; padding: 0; }
.passkey-icon .icon { width: 26px; height: 26px; }
.passkey-or { text-align: center; margin: .25rem 0 .75rem; font-size: .85rem; }
.input-pin { -webkit-text-security: disc; text-security: disc; }
.input-pin { letter-spacing: .5em; font-size: 1.4rem; text-align: center; max-width: 12rem; }
.range-field { max-width: 36rem; }
.range { width: 100%; accent-color: var(--accent); height: 28px; }
.range-scale { display: flex; justify-content: space-between; color: var(--text-muted); font-size: .8rem; }

/* --- Päta stránky (verzia) ----------------------------------------- */
.site-footer { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1rem 2rem; text-align: center; color: var(--text-muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.layout-side .site-footer { max-width: 1296px; }
@media (min-width: 900px) { .layout-side .site-footer { padding-left: calc(256px + 1rem); } }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.changelog-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.changelog-entry h3 { font-size: 1rem; margin: .75rem 0 .25rem; }
.changelog-list { margin: 0; padding-left: 1.25rem; }
.changelog-list li + li { margin-top: .25rem; }

/* --- Tlač: vždy svetlé pozadie a tmavý text, aj v tmavom režime. ----- */
@media print {
  :root, :root[data-theme], :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #ffffff; --surface: #ffffff; --surface-2: #f7f9fb; --border: #dde3ea; --border-strong: #c3ccd7;
    --text: #17202b; --text-muted: #5b6776; --accent: #1f5fbf; --accent-soft: #e8f0fc; --accent-text: #ffffff;
    --success: #17794a; --success-soft: #e5f5ec; --warning: #8a5a00; --warning-soft: #fdf3dc; --danger: #b42318; --danger-soft: #fdecea;
  }
  html, body { background: #ffffff !important; color: #17202b !important; }
  .card { box-shadow: none; }
}

/* Výpis z obchodného registra pri firme (rozhodnutie 0031). */
.register-activities { margin: .5rem 0 0; padding-left: 1.2rem; display: grid; gap: .2rem; font-size: .9rem; }
.register-person { margin-top: .5rem; }
.rv-list form .btn { padding-inline: .5rem; }

/* Zvonček: malé OK pri oznámení (označí ako prečítané). Zoznam: neprečítané hrubšie, prečítané tenké. */
.btn-xs { min-height: 26px; padding: .125rem .5rem; font-size: .75rem; font-weight: 650; }
.bell-notice { flex-direction: row; align-items: flex-start; gap: .625rem; }
.bell-notice .bell-text { flex: 1 1 auto; }
.bell-ok { margin: 0; flex: 0 0 auto; }
.notice-unread .list-title { font-weight: 700; }
.notice-read .list-title { font-weight: 400; }

/* Firma alebo člen s právami (Roly vo firmách, Členovia firmy): názov na celú šírku,
   pod ním práva a overenie v obchodnom registri; odobratie vpravo hore. */
/* Zoznam záznamov v orámovaných blokoch (firmy, používatelia, skupiny, pozvánky…):
   každý záznam má vlastný rámik vnútri karty, hlavička karty ostáva. */
.list-boxed { display: grid; gap: .625rem; }
.list-boxed > .list-item, .list-boxed > .list-item:first-child, .list-boxed > .list-item:last-child {
  border: 1px solid var(--box-border); border-radius: var(--radius-sm); padding: .75rem 1rem; background: var(--box-bg); }
.list-boxed > .list-item.is-active { margin: 0 !important; border-radius: var(--radius-sm) !important; padding: .75rem 1rem; border-color: var(--accent); background: var(--accent-soft); }
.list-boxed > .empty { padding: .5rem 0; }
.list-boxed > .list-item.membership { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; align-items: start; padding: .875rem 1rem; }
.membership-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.membership-head .list-main { flex: 1 1 auto; }
.membership-head .list-title { font-size: 1rem; }
.membership-head form { flex: 0 0 auto; margin: 0; }
.membership .rights-form { gap: .375rem; }
.membership .rv-list { margin: 0; color: var(--text-muted); }
.membership .rv-list strong { color: var(--text); font-weight: 600; }

/* Vzhľad vo vrstve nad stránkou: panel sprava (na mobile aj na počítači). */
.drawer.sheet, .layout-side .drawer.sheet { display: block; }
.drawer.sheet > summary { display: none; }
.drawer.sheet:not([open]) > :not(summary) { display: none; }
.sheet .drawer-panel {
  left: auto; right: 0; width: min(420px, 92vw); padding: .75rem 1rem 2rem;
  border-right: 0; border-left: 1px solid var(--border); box-shadow: -8px 0 30px rgb(16 24 40 / 18%);
  animation: sheet-in .18s ease-out;
}
.sheet .drawer-head h2 { margin: 0; font-size: 1.1rem; }
.sheet .choice-grid { grid-template-columns: minmax(0, 1fr); }
@keyframes sheet-in { from { transform: translateX(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet .drawer-panel { animation: none; } }
.sheet .choice-grid .choice { flex-direction: row; align-items: center; }

/* Klikateľná dlaždica (napr. firma → firemný profil): odkaz v názve pokryje celý blok,
   tlačidlá a formuláre vpravo ostávajú nad ním. */
.list-item.is-link { position: relative; }
.list-item.is-link .stretched-link { color: inherit; text-decoration: none; }
.list-item.is-link .stretched-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.list-item.is-link .actions, .list-item.is-link .tags { position: relative; z-index: 1; }
.list-item.is-link:hover { border-color: var(--accent); }
.list-item.is-link:hover .stretched-link { color: var(--accent); }
.list-item.is-link .stretched-link:focus-visible { outline: none; }
.list-item.is-link:has(.stretched-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Firma pri používateľovi: zvýraznený názov (odkaz na firemný profil) a práva. */
.badge-company { display: inline-flex; align-items: baseline; gap: .375rem; }
.badge-company a, .badge-company a:hover { color: var(--text-strong); font-weight: 700; text-decoration: none; }
.badge-company-roles { color: var(--text-muted); }
/* Názov firmy ako odkaz na firemný profil (stránka používateľa). */
.company-link, .company-link:hover { color: var(--text-strong); font-weight: 700; text-decoration: none; }
/* Firmy používateľa v zozname Používatelia: každá na samostatnom riadku. */
.company-lines { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; }
.company-lines .badge-company { max-width: 100%; white-space: normal; }
/* Upraviť ako odkaz na inú stránku (napr. Ľudia a práva → členovia firmy): funguje aj bez JS. */
a.edit-btn { text-decoration: none; }
html:not(.js) a.edit-btn { display: inline-flex; }
/* Pripravovaná aplikácia: dlaždica bez odkazu, šedý vypínač sa nedá zapnúť. */
.switch.switch-disabled { cursor: not-allowed; }
.switch.switch-disabled:hover .switch-icon { box-shadow: none; }
.switch.switch-disabled .switch-disc { fill: var(--border-strong); }
.app-soon .app-icon { opacity: .6; }
/* Podnadpisy v karte (napr. celý profil používateľa v administrácii). */
.facts-head { margin: 1rem 0 .375rem; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.edit-view > .facts-head:first-child, .edit-form > .facts-head:first-of-type { margin-top: 0; }

/* Návrat na predchádzajúcu stránku: výraznejšie tlačidlo so šípkou (rámik a jemná výplň). */
.back { margin: 0 0 .75rem; }
.back-link {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 34px; padding: .3rem .85rem .3rem .55rem;
  border: 1px solid var(--box-border); border-radius: 999px; background: var(--box-bg);
  color: var(--text); font-size: .9rem; font-weight: 600; text-decoration: none;
  transition: color .15s, border-color .15s, background-color .15s;
}
.back-link .icon { width: 17px; height: 17px; transition: transform .15s; }
.back-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.back-link:hover .icon { transform: translateX(-2px); }
.back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .back-link, .back-link .icon { transition: none; } }
/* Breadcrumbs: tlačidlá návratu v rade podľa hĺbky stromu (od koreňa po priameho rodiča). */
.crumbs-list { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .5rem; margin: 0; padding: 0; list-style: none; }
.crumbs-list li { display: inline-flex; align-items: center; gap: .25rem; min-width: 0; }
.crumbs-list .back-link { max-width: 22rem; }
.crumbs-list .back-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pozvánka: osoba z registra už má účet v Bills. */
.register-account { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .5rem; margin-top: .375rem;
  padding: .5rem .625rem; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--text); font-size: .85rem; }
.register-account[hidden] { display: none; }
/* Stotožnenie s verejným registrom (dátum narodenia v profile). */
.identity-ok { display: inline-flex; align-items: center; gap: .3rem; margin-left: .375rem; color: var(--success); font-size: .85rem; font-weight: 600; }
.identity-check { display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: .75rem; font-weight: 800; }
.identity-none { margin-left: .375rem; font-size: .85rem; }
/* Na počítači sa panely Vzhľad a Jazyk vysúvajú zľava (na mobile sprava). */
@media (min-width: 900px) {
  .sheet .drawer-panel {
    left: 0; right: auto; border-left: 0; border-right: 1px solid var(--border);
    box-shadow: 8px 0 30px rgb(16 24 40 / 18%); animation-name: drawer-in;
  }
}
/* Predmet podnikania so značkami aplikácií (napr. AML) pred názvom činnosti. */
.register-activities.has-badges { list-style: none; padding-left: 0; }
.register-activities.has-badges li { display: flex; align-items: flex-start; gap: .5rem; }
/* Aplikácia v predbežnej verzii: oranžový vypínač s páčkou dole, nedá sa prepnúť. */
.switch.switch-prerelease .switch-disc { fill: #e8890c; }
.switch.switch-prerelease input:disabled + .switch-icon { opacity: 1; }
/* Značky aplikácií za názvom firmy (napr. AML): nad odkazom dlaždice, aby fungovala bublina. */
.app-badges { position: relative; z-index: 1; display: inline-flex; gap: .25rem; vertical-align: middle; margin-left: .375rem; }
/* QR kód pri zapínaní 2FA: vždy čierna na bielej (aj v tmavom režime), aby ho aplikácia prečítala. */
.mfa-qr { width: min(220px, 70vw); margin: .5rem 0; padding: .5rem; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--box-border); }
.mfa-qr svg { display: block; width: 100%; height: auto; }
/* Filtre zoznamu firiem v jednom zalamovanom riadku. */
/* Pole s návrhmi (napr. Činnosť vo filtri firiem): zoznam zhôd pod poľom. */
.suggest { position: relative; display: block; }
.suggest-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + .25rem); max-height: 18rem; overflow-y: auto;
  margin: 0; padding: .25rem; list-style: none; background: var(--menu-bg); border: 1px solid var(--menu-border); border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgb(16 24 40 / 14%); min-width: min(22rem, 90vw); }
.suggest-list[hidden] { display: none; }
.suggest-list [role=option] { padding: .45rem .6rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.suggest-list [role=option]:hover, .suggest-list [role=option][aria-selected=true] { background: var(--menu-hover); }
.suggest-empty { padding: .45rem .6rem; color: var(--text-muted); font-size: .9rem; }
.company-filters .suggest-field { flex: 2 1 16rem; max-width: 26rem; }
.company-filters { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; margin-bottom: .75rem; }
.company-filters .field { margin: 0; flex: 1 1 11rem; min-width: 0; max-width: 16rem; }

/* Tagy aplikácií na dlaždici a filter stránky Aplikácie (rozhodnutie 0039). */
.app-tile-tags { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .375rem; }
.app-tag { text-decoration: none; color: var(--text-muted); }
.app-tag:hover { color: var(--text); border-color: var(--border-strong); }
.app-tag-more { cursor: help; }
.app-filter { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; margin-bottom: 1rem; }
.app-filter-search { flex: 1 1 16rem; margin: 0; }
.app-filter-tags { flex: 2 1 20rem; }
.app-filter-active { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; margin: 0 0 1rem; }

/* Matica oprávnení (rozhodnutie 0040): úrovne 0 prázdny, R modrá, O zelená, T oranžová, F fialová; písmeno pre čitateľnosť. */
.perm-tools { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: flex-end; margin-bottom: .75rem; }
.perm-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .75rem; font-size: .85rem; color: var(--text-muted); }
.perm-legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.perm-scroll { max-height: 72vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.perm-matrix { border-collapse: separate; border-spacing: 0; width: 100%; }
.perm-matrix th, .perm-matrix td { padding: .4rem .55rem; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; font-size: .88rem; background: var(--surface); }
.perm-matrix thead th { position: sticky; top: 0; z-index: 3; white-space: nowrap; box-shadow: 0 1px 0 var(--border); }
.perm-matrix .perm-obj { position: sticky; left: 0; z-index: 2; text-align: left; min-width: 15rem; max-width: 22rem; box-shadow: 1px 0 0 var(--border); }
.perm-matrix thead .perm-obj { z-index: 4; }
.perm-module th { background: var(--box-bg); font-weight: 700; text-align: left; }
.perm-cell { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 5px; border: 1px solid var(--border-strong);
  background: transparent; color: #fff; font: inherit; font-size: .8rem; font-weight: 800; cursor: pointer; padding: 0; }
.perm-cell.lvl-0 { background: transparent; }
.perm-cell.lvl-1 { background: #2563eb; border-color: #2563eb; }
.perm-cell.lvl-2 { background: #16a34a; border-color: #16a34a; }
.perm-cell.lvl-3 { background: #ea7a0c; border-color: #ea7a0c; }
.perm-cell.lvl-4 { background: #7c3aed; border-color: #7c3aed; }
.perm-cell.is-locked { cursor: not-allowed; opacity: .55; }
button.perm-cell:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
button.perm-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.perm-cell[aria-busy="true"] { opacity: .5; }
@media print { .perm-cell { color: #000; background: none !important; border-color: #000; } .perm-scroll { max-height: none; overflow: visible; } }
/* Pozvánka: pri firme iba políčko a názov; roly a osoba z registra sa rozbalia po zaškrtnutí (bez JS rozbalené). */
.invite-row .list-check .list-title { font-weight: 650; }
.invite-details { display: grid; gap: .5rem; padding-left: 1.75rem; }
html.js .invite-row:not(.is-open) .invite-details { display: none; }
/* Stav vypínača z aplikácie (rozhodnutie 0046): oranžový = treba zapnúť; zamknutý = ukazuje stav, dôvod v popise. */
.switch.switch-orange .switch-disc, .switch.switch-orange input:not(:checked) + .switch-icon .switch-disc { fill: #e8890c; }
.switch.switch-locked { cursor: not-allowed; position: relative; z-index: 1; }
.switch.switch-locked:hover .switch-icon { box-shadow: none; }
.switch.switch-locked input:disabled + .switch-icon { opacity: 1; }

/* Tabuľky a triediteľné záhlavie (rovnako ako v aplikáciách; skript /js/sort.js). */
.table-wrap { overflow: auto; } .table { border-collapse: collapse; width: 100%; }
.table td, .table th { padding: .45rem .7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th.sortable { padding: 0; }
.table th.sortable button { display: flex; gap: .3rem; align-items: center; width: 100%; padding: .45rem .7rem; background: none; border: 0;
  font: inherit; font-weight: inherit; color: inherit; text-align: left; cursor: pointer; }
.table th.sortable button:hover, .table th.is-sorted button { color: var(--accent); }
.sort-arrow { font-size: .7em; min-width: .8em; }
.table .num { text-align: right; white-space: nowrap; }

/* Pedigree (rozhodnutie 0060): odsadený strom s čiarou vetvy, na mobile rovnako (iba menšie odsadenie). */
.tree { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 1px solid var(--border); }
.tree-root { padding-left: 0; border-left: 0; margin-top: .75rem; }
.tree-node { margin: .25rem 0; }
.tree-node > details > summary { cursor: pointer; list-style-position: outside; }
.tree-node > details > summary::marker { color: var(--muted); }
.tree-node > .tree-label { display: block; padding-left: 1rem; }
.tree-label { display: inline; line-height: 1.6; }
.tree-label .badge { margin-left: .25rem; }
.tree-label .list-meta { margin-left: .35rem; display: inline; }
.tree-meta { display: block; font-size: .85rem; color: var(--muted); }
.tree-meta > span { display: block; }
.tree-members { list-style: none; margin: .25rem 0 .25rem 1rem; padding: 0 0 0 .75rem; border-left: 1px dashed var(--border); font-size: .9rem; }
@media (min-width: 720px) { .tree { padding-left: 1.5rem; } }

/* Filtre zoznamu pod tlačidlom Filter (komponent x-filter-fold): zatvorené šetria miesto nad zoznamom,
   hlavne na mobile. Počet použitých filtrov je na tlačidle. */
.filter-fold { margin: 0 0 .75rem; }
.filter-fold > summary { list-style: none; width: max-content; }
.filter-fold > summary::-webkit-details-marker { display: none; }
.filter-toggle { display: inline-flex; align-items: center; gap: .4rem; }
.filter-toggle .icon { width: 18px; height: 18px; }
.filter-fold[open] > .filter-toggle { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.filter-count { min-width: 1.4rem; justify-content: center; }
.filter-count[hidden] { display: none; }
/* Nastaviť notifikácie: vždy iba jedno tlačidlo (Zapnúť alebo Vypnúť podľa stavu), tlačidlo .btn by inak prebilo hidden. */
.push-box [hidden] { display: none; }
.topic-table td, .topic-table th { vertical-align: top; }
.topic-table td:first-child { white-space: normal; }
.topic-table .topic-channel { text-align: center; width: 7rem; }
.check-only { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; cursor: pointer; }
.filter-fold-body { margin-top: .75rem; }
.filter-fold-body > form { margin-bottom: 0; }
.filter-fold-body > .card > form { margin: 0; }
/* Pridávací formulár zbalený pod tlačidlom (napr. Pridať pozvánku). */
.add-fold > summary { list-style: none; width: max-content; display: inline-flex; align-items: center; gap: .4rem; }
.add-fold > summary::-webkit-details-marker { display: none; }
.add-fold > summary .icon { width: 18px; height: 18px; }
.add-fold[open] > summary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.add-fold-body { margin-top: 1rem; }

/* Rizikový profil (rozhodnutie 0064): gulička pred výsledkom – zelená bez nálezu, oranžová na posúdenie, červená nález, sivá nedostupné. */
.risk-dot { display: inline-block; width: .625rem; height: .625rem; border-radius: 50%; margin-right: .375rem; vertical-align: .05em; background: var(--text-muted); flex: none; }
.risk-dot.is-green { background: var(--success); }
.risk-dot.is-orange { background: var(--dot-orange); }
.risk-dot.is-red { background: var(--dot-red); }
/* Index daňovej spoľahlivosti „bez hodnotenia“ (rozhodnutie 0079): prázdny krúžok v tlmenej farbe textu (svetlý aj tmavý režim). */
.risk-dot.is-none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-muted); }
.risk-dot.is-none[class*="ring-"] { box-shadow: inset 0 0 0 1.5px var(--text-muted), 0 0 0 2px var(--surface), 0 0 0 4px var(--ring); }
/* Minulé zistenie za 2 roky (rozhodnutie 0070): okraj vo farbe minulosti, medzera v farbe podkladu. */
.risk-dot[class*="ring-"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ring); margin-left: .2rem; margin-right: .55rem; }
.risk-dot.ring-red { --ring: var(--dot-red); }
.risk-dot.ring-orange { --ring: var(--dot-orange); }
.risk-history { margin-top: .25rem; font-size: .875rem; }
.risk-history > summary { cursor: pointer; color: var(--text-muted); width: max-content; max-width: 100%; }
.risk-history > summary:hover { color: var(--accent); }
.risk-history p { margin: .25rem 0; font-size: .8rem; }
.risk-history ul { list-style: none; margin: .25rem 0 0; padding: 0; }
.risk-history li { padding: .125rem 0; }

/* Finančné ukazovatele (rozhodnutie 0065): pruh obratu v bunke, záporný výsledok. */
.fin-bar-cell { position: relative; isolation: isolate; min-width: 9rem; }
.fin-bar { position: absolute; top: .3rem; bottom: .3rem; right: .4rem; width: 0; background: var(--accent-soft); border-radius: .25rem; z-index: -1; }
.fin-table .is-negative { color: var(--danger); }
.fin-table td .risk-dot { margin-right: .3rem; }
.fin-w5 { width: calc((100% - .8rem) * 0.05); }
.fin-w10 { width: calc((100% - .8rem) * 0.1); }
.fin-w15 { width: calc((100% - .8rem) * 0.15); }
.fin-w20 { width: calc((100% - .8rem) * 0.2); }
.fin-w25 { width: calc((100% - .8rem) * 0.25); }
.fin-w30 { width: calc((100% - .8rem) * 0.3); }
.fin-w35 { width: calc((100% - .8rem) * 0.35); }
.fin-w40 { width: calc((100% - .8rem) * 0.4); }
.fin-w45 { width: calc((100% - .8rem) * 0.45); }
.fin-w50 { width: calc((100% - .8rem) * 0.5); }
.fin-w55 { width: calc((100% - .8rem) * 0.55); }
.fin-w60 { width: calc((100% - .8rem) * 0.6); }
.fin-w65 { width: calc((100% - .8rem) * 0.65); }
.fin-w70 { width: calc((100% - .8rem) * 0.7); }
.fin-w75 { width: calc((100% - .8rem) * 0.75); }
.fin-w80 { width: calc((100% - .8rem) * 0.8); }
.fin-w85 { width: calc((100% - .8rem) * 0.85); }
.fin-w90 { width: calc((100% - .8rem) * 0.9); }
.fin-w95 { width: calc((100% - .8rem) * 0.95); }
.fin-w100 { width: calc((100% - .8rem) * 1); }

/* Kalkulačka štandardného objemu transakcie v AML (rozhodnutie 0065). */
.tx-calc { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; }
.tx-calc .field { flex: 1 1 12rem; max-width: 18rem; margin: 0; }

/* Kotvy na karty (#financne-ukazovatele, #vypis-z-registra, #kontroly): začiatok karty tesne pod pevnou hlavičkou. */
#financne-ukazovatele, #vypis-z-registra, #kontroly { scroll-margin-top: calc(var(--topbar-h, 61px) + 1rem); }

/* Odhad úverového rámca (rozhodnutie 0066). */
.credit-facts .credit-total { font-size: 1.25rem; font-weight: 700; }
