:root {
    --font-ui: "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
    --font-title: var(--font-ui);
    --blue: #175a8a;
    --blue-dark: #102b4a;
    --blue-hover: #2179b5;
    --blue-soft: #e8f2f9;
    --red: #b32632;
    --red-soft: #fae8ea;
    --green: #24734b;
    --green-soft: #dff1e7;
    --yellow: #f4c95d;
    --orange: #d97825;
    --orange-soft: #fff0c7;
    --yellow-strong: #7a5a00;
    --yellow-soft: #fdf6d8;
    --alert: #c2410c;
    --alert-soft: #ffe8dc;
    --gray-950: #1c252e;
    --gray-800: #34434f;
    --gray-600: #687681;
    --gray-400: #98a3ab;
    --gray-300: #cbd3d9;
    --gray-200: #e5e9ec;
    --gray-100: #edf1f4;
    --gray-50: #f4f6f7;
    --white: #ffffff;
    --ui-bg: var(--gray-50);
    --ui-bg-end: color-mix(in srgb, var(--ui-bg) 76%, var(--blue-soft));
    --ui-text: var(--gray-950);
    --ui-muted: var(--gray-600);
    --ui-panel: var(--white);
    --ui-panel-alt: var(--gray-100);
    --ui-line: var(--gray-300);
    --ui-line-soft: var(--gray-200);
    --ui-field-bg: var(--white);
    --ui-field-line: var(--gray-300);
    --ui-btn-bg: var(--white);
    --ui-btn-text: var(--gray-800);
    --ui-topbar-bg: #102640;
    --ui-topbar-text: var(--white);
    --ui-topbar-subtext: #b9d5e8;
    --ui-sidebar-bg: var(--ui-panel);
    --ui-sidebar-text: var(--ui-text);
    --ui-sidebar-hover-bg: var(--blue-soft);
    --ui-sidebar-hover-line: var(--ui-line);
    --ui-status-loading-bg: var(--blue-soft);
    --ui-status-loading-line: var(--blue);
    --ui-status-error-bg: var(--red-soft);
    --ui-status-error-line: var(--red);
    --ui-table-head-bg: var(--ui-panel-alt);
    --ui-json-bg: var(--white);
    --ui-json-text: var(--gray-800);
    --ui-focus: rgb(33 121 181 / 28%);
    --ui-shadow: 0 8px 24px rgb(25 32 38 / 16%);
    --ui-panel-shadow: inset 0 1px 0 rgb(255 255 255 / 82%), 0 1px 3px rgb(25 32 38 / 10%);
    --ui-control-shadow: inset 0 1px 0 rgb(255 255 255 / 88%), 0 1px 2px rgb(25 32 38 / 14%);
    --ui-control-hover-shadow: inset 0 1px 0 rgb(255 255 255 / 94%), 0 2px 4px rgb(25 32 38 / 18%);
    --ui-control-pressed-shadow: inset 0 2px 3px rgb(25 32 38 / 24%), 0 1px 0 rgb(255 255 255 / 56%);
    --ui-field-shadow: inset 0 1px 2px rgb(25 32 38 / 12%), 0 1px 0 rgb(255 255 255 / 76%);
    --ui-chrome-shadow: 0 2px 6px rgb(16 38 64 / 20%);
    --ui-header-shadow: inset 0 1px 0 rgb(255 255 255 / 64%), inset 0 -1px 0 rgb(25 32 38 / 8%);
    --ui-toolbar-shadow: inset 0 1px 0 rgb(255 255 255 / 68%), 0 1px 2px rgb(25 32 38 / 10%);
    --ui-floating-shadow: 0 8px 20px rgb(25 32 38 / 20%), inset 0 1px 0 rgb(255 255 255 / 72%);
    --ui-primary-gradient: linear-gradient(180deg, #216797 0%, #154f7c 100%);
    --ui-danger-gradient: linear-gradient(180deg, #c33a45 0%, #9f202b 100%);
    --ui-success-gradient: linear-gradient(180deg, #2f8258 0%, #1f6842 100%);
    --ui-semantic-control-shadow: inset 0 1px 0 rgb(255 255 255 / 20%), 0 1px 2px rgb(25 32 38 / 20%);
    --ui-dialog-surface: #ffffff;
    --ui-dialog-border: #b8c4cc;
    --ui-dialog-shadow: 0 16px 42px rgb(25 32 38 / 24%);
    --ui-backdrop: rgb(16 38 64 / 56%);
}

body[data-theme="dark"] {
    --blue: #5794c7;
    --blue-dark: #8fc2e0;
    --blue-hover: #73b0dc;
    --blue-soft: #152a38;
    --red: #e05a5a;
    --red-soft: #30191b;
    --green: #7bb893;
    --green-soft: #162d20;
    --yellow: #cbb563;
    --orange: #d9955f;
    --orange-soft: #352818;
    --yellow-strong: #e2cb72;
    --yellow-soft: #2d2914;
    --alert: #f07a4a;
    --alert-soft: #3b1d12;
    --ui-bg: #080a0d;
    --ui-bg-end: #0d1116;
    --ui-text: #f1f3f5;
    --ui-muted: #aab1b8;
    --ui-panel: #111418;
    --ui-panel-alt: #191d22;
    --ui-line: #373d44;
    --ui-line-soft: #262b31;
    --ui-field-bg: #111418;
    --ui-field-line: #373d44;
    --ui-btn-bg: #111418;
    --ui-btn-text: #f1f3f5;
    --ui-topbar-bg: #0b0e12;
    --ui-topbar-text: #f1f3f5;
    --ui-topbar-subtext: #aab1b8;
    --ui-sidebar-bg: #111418;
    --ui-sidebar-text: #f1f3f5;
    --ui-sidebar-hover-bg: #152a38;
    --ui-sidebar-hover-line: #373d44;
    --ui-status-loading-bg: #152a38;
    --ui-status-loading-line: #5794c7;
    --ui-status-error-bg: #30191b;
    --ui-status-error-line: #e05a5a;
    --ui-table-head-bg: #191d22;
    --ui-json-bg: #0d1116;
    --ui-json-text: #f1f3f5;
    --ui-focus: rgb(87 148 199 / 42%);
    --ui-shadow: 0 12px 32px rgb(0 0 0 / 46%);
    --ui-panel-shadow: inset 0 1px 0 rgb(255 255 255 / 4.5%), 0 2px 5px rgb(0 0 0 / 32%);
    --ui-control-shadow: inset 0 1px 0 rgb(255 255 255 / 7.5%), 0 1px 2px rgb(0 0 0 / 42%);
    --ui-control-hover-shadow: inset 0 1px 0 rgb(255 255 255 / 11%), 0 2px 5px rgb(0 0 0 / 52%);
    --ui-control-pressed-shadow: inset 0 2px 4px rgb(0 0 0 / 66%), 0 1px 0 rgb(255 255 255 / 3.5%);
    --ui-field-shadow: inset 0 1px 3px rgb(0 0 0 / 52%), 0 1px 0 rgb(255 255 255 / 3.5%);
    --ui-chrome-shadow: 0 3px 8px rgb(0 0 0 / 54%);
    --ui-header-shadow: inset 0 1px 0 rgb(255 255 255 / 4.5%), inset 0 -1px 0 rgb(0 0 0 / 34%);
    --ui-toolbar-shadow: inset 0 1px 0 rgb(255 255 255 / 4.5%), 0 2px 4px rgb(0 0 0 / 28%);
    --ui-floating-shadow: 0 10px 26px rgb(0 0 0 / 62%), inset 0 1px 0 rgb(255 255 255 / 7%);
    --ui-primary-gradient: linear-gradient(180deg, #69a5d1 0%, #4d86b7 100%);
    --ui-danger-gradient: linear-gradient(180deg, #eb6c6c 0%, #c94b4b 100%);
    --ui-success-gradient: linear-gradient(180deg, #8bc9a4 0%, #65a17e 100%);
    --ui-semantic-control-shadow: inset 0 1px 0 rgb(255 255 255 / 12%), 0 2px 4px rgb(0 0 0 / 46%);
    --ui-dialog-surface: #1b2026;
    --ui-dialog-border: #59636d;
    --ui-dialog-shadow: 0 20px 52px rgb(0 0 0 / 64%);
    --ui-backdrop: rgb(0 0 0 / 68%);
}

.webui-update-banner {
    position: fixed;
    z-index: 10000;
    right: 18px;
    bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 36px);
    padding: 10px 12px 10px 16px;
    border-radius: 6px;
    background: #1f3b57;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgb(0 0 0 / 35%);
}
.webui-update-banner button {
    min-height: 30px;
    padding: 4px 12px;
    border: 1px solid #fff;
    border-radius: 4px;
    background: #fff;
    color: #1f3b57;
    font-weight: 800;
    cursor: pointer;
}
.webui-update-banner .webui-update-later {
    background: transparent;
    color: #fff;
}

.user-menu {
    position: relative;
    color: var(--ui-topbar-text);
}
.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 3px 8px 3px 4px;
    border: 1px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.user-menu-toggle::-webkit-details-marker { display: none; }
.user-menu-toggle:hover,
.user-menu[open] > .user-menu-toggle {
    border-color: var(--ui-sidebar-hover-line);
    background: rgb(255 255 255 / 8%);
}
.user-menu-toggle:focus-visible {
    outline: 3px solid var(--ui-focus);
    outline-offset: 2px;
}
.user-menu-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    background: #2f6b98;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
}
.user-menu-name {
    max-width: 200px;
    overflow: hidden;
    color: var(--ui-topbar-subtext);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-caret {
    width: 7px;
    height: 7px;
    margin: -3px 2px 0 0;
    border-right: 2px solid var(--ui-topbar-subtext);
    border-bottom: 2px solid var(--ui-topbar-subtext);
    transform: rotate(45deg);
    transition: transform .15s ease;
}
.user-menu[open] .user-menu-caret {
    margin-top: 3px;
    transform: rotate(-135deg);
}
.user-menu-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    right: 0;
    width: max-content;
    min-width: 220px;
    max-width: min(320px, calc(100vw - 20px));
    padding: 6px 0;
    border: 1px solid var(--ui-dialog-border);
    border-radius: 6px;
    color: var(--ui-text);
    background: var(--ui-dialog-surface);
    box-shadow: var(--ui-floating-shadow);
}
.user-menu-head {
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
    padding: 6px 14px 10px;
    border-bottom: 1px solid var(--ui-line);
}
.user-menu-head strong,
.user-menu-head span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-head span {
    color: var(--ui-muted);
    font-size: 12px;
}
.user-menu-panel form { margin: 0; }
.user-menu .user-menu-item {
    display: block;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 8px 14px;
    border: 0;
    border-radius: 0;
    color: var(--ui-text);
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: 13px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.user-menu .user-menu-item:hover,
.user-menu .user-menu-item:focus-visible {
    outline: none;
    background: var(--ui-sidebar-hover-bg);
}
.user-menu .user-menu-item:active { transform: none; }
.user-menu .user-menu-logout {
    margin-top: 6px;
    border-top: 1px solid var(--ui-line);
    color: var(--red);
    font-weight: 700;
}

@media (max-width: 760px) {
    .user-menu-name { display: none; }
}

/* Shared confirm / prompt / alert (AdmimaxGlobal.dialog). */
.ag-dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--ui-dialog-border);
    border-radius: 8px;
    color: var(--ui-text);
    background: var(--ui-dialog-surface);
    box-shadow: var(--ui-dialog-shadow);
}
.ag-dialog::backdrop { background: rgb(16 26 38 / 42%); }
.ag-dialog-form {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 20px 22px 18px;
    border-top: 4px solid var(--blue);
    border-radius: 8px;
}
.ag-dialog-danger .ag-dialog-form { border-top-color: var(--red); }
.ag-dialog-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}
.ag-dialog-body { display: grid; gap: 8px; }
.ag-dialog-body p {
    margin: 0;
    line-height: 1.45;
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.ag-dialog-field { display: grid; gap: 6px; }
.ag-dialog-field span { color: var(--ui-muted); font-size: 13px; }
.ag-dialog-field :is(input, textarea) {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--ui-field-line);
    border-radius: 4px;
    color: var(--ui-text);
    background: var(--ui-field-bg);
    font: inherit;
}
.ag-dialog-field textarea { min-height: 90px; resize: vertical; }
.ag-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

/* Status badges (štítky): one class + optional tone, see docs/ui-catalog.html#stavy. */
.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 23px;
    box-sizing: border-box;
    padding: 2px 7px;
    border: 1px solid var(--ui-line);
    border-radius: 3px;
    color: var(--ui-muted);
    background: var(--ui-panel-alt);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 18%);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    vertical-align: middle;
}
.badge.info { border-color: var(--blue); color: var(--blue-dark); background: var(--blue-soft); }
.badge.success { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.badge.caution { border-color: var(--yellow); color: var(--yellow-strong); background: var(--yellow-soft); }
.badge.warning { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }
.badge.alert { border-color: var(--alert); color: var(--alert); background: var(--alert-soft); }
.badge.danger { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 4px 8px;
    border: 1px solid var(--ui-line);
    border-radius: 4px;
    color: var(--blue-dark);
    background: var(--blue-soft);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
}
:is(.badge, .chip, .count-badge)[hidden] { display: none; }
.chip button { min-height: 20px; padding: 0 3px; border: 0; color: var(--red); background: transparent; box-shadow: none; cursor: pointer; }

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    box-sizing: border-box;
    padding: 0 5px;
    border-radius: 9px;
    color: var(--ui-muted);
    background: var(--ui-panel-alt);
    font-size: 11px;
    font-weight: 400;
    line-height: 1;
    vertical-align: middle;
}
.nav-item .count-badge { margin-left: 6px; }
.count-badge:is(.info, .success, .caution, .warning, .alert, .danger) { color: var(--ui-panel); }
.count-badge.info { background: var(--blue); }
.count-badge.success { background: var(--green); }
.count-badge.caution { color: #1c252e; background: var(--yellow); }
.count-badge.warning { background: var(--orange); }
.count-badge.alert { background: var(--alert); }
.count-badge.danger { background: var(--red); }

.notice { padding: 10px 12px; border-left: 4px solid var(--blue); color: var(--ui-text); background: var(--blue-soft); }
.notice.success { border-color: var(--green); background: var(--green-soft); }
.notice.warning { border-color: var(--orange); background: var(--orange-soft); }
.notice.danger { border-color: var(--red); background: var(--red-soft); }

.progress { display: grid; gap: 6px; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; color: var(--ui-muted); font-size: 12px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 4px; background: var(--ui-line); }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--blue), color-mix(in srgb, var(--blue) 76%, var(--red) 24%)); transition: width .4s ease; }

/* Overdue reminder (b222): closed only with "Beriem na vedomie". */
.overdue-reminder {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(80, 0, 0, 0.72);
}
.overdue-reminder-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(1100px, 100%);
    max-height: calc(100vh - 48px);
    padding: 28px 32px;
    border: 6px solid #fff;
    border-radius: 10px;
    background: #c40000;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.overdue-reminder-box h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 46px);
    font-weight: 900;
    line-height: 1.1;
    text-transform: uppercase;
}
.overdue-reminder-box p {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}
.overdue-reminder-list {
    overflow: auto;
    border-radius: 6px;
    background: #fff;
    color: #1c1c1c;
}
.overdue-reminder-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.overdue-reminder-list th,
.overdue-reminder-list td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0d0d0;
    text-align: left;
    vertical-align: top;
}
.overdue-reminder-list th {
    position: sticky;
    top: 0;
    background: #ffe5e5;
    color: #8a0000;
}
.overdue-reminder-box button {
    align-self: center;
    min-width: 320px;
    min-height: 60px;
    padding: 12px 32px;
    border: 3px solid #fff;
    border-radius: 8px;
    background: #fff;
    color: #c40000;
    font-size: 24px;
    font-weight: 900;
    cursor: pointer;
}
.overdue-reminder-box button:hover,
.overdue-reminder-box button:focus-visible {
    background: #ffe5e5;
    outline: 3px solid #ffd400;
}
