﻿@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/inter/inter-cyrillic-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/inter/inter-cyrillic-wght-normal.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/inter/inter-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("fonts/jetbrains-mono/jetbrains-mono-cyrillic-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("fonts/jetbrains-mono/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("fonts/jetbrains-mono/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* color-scheme hands the system parts CSS can't paint (scrollbars, caret, autofill) to the theme;
   without it the scrollbars stay white in the dark theme. */
:root {
    color-scheme: light;
    --bg: #F3F4F7; --card: #FFFFFF; --chip: #EBEDF2; --line: #E4E7EE;
    --ink: #12141C; --ink2: #565D6E; --ink3: #697083;
    --accent: #2E5BFF; --accent-soft: #E9EEFF;
    --pos: #0F9D6B; --warn: #E08A00; --danger: #C63B3B;
    --navy1: #0B2545; --navy2: #12335C;
    --grad-a: #0A6CFF; --grad-b: #00D9F5;
    /* Fills under text (buttons, checkboxes). The light theme has a deeper gradient with white text:
       bright cyan can't carry white, so the second stop is darker. */
    --grad-fill-a: #0A5BD8; --grad-fill-b: #0078BE; --grad-fill-ink: #FFFFFF;
    --fill-shadow: 0 4px 14px rgba(10,108,255,.25);
    --shadow: 0 1px 2px rgba(18,20,28,.04);
    --shadow-md: 0 12px 34px rgba(18,20,28,.12);
    --header-bg: rgba(243,244,247,.72);
    --sb-bg: var(--card); --sb-ink: var(--ink2); --sb-hover: var(--chip);
    --sb-active-bg: var(--accent-soft); --sb-active-ink: var(--accent); --sb-active-bar: none;
    --on-navy: #EAF1FF; --on-navy2: #9DB4D8;
    --on-navy-line: rgba(255,255,255,.10); --on-navy-card: rgba(255,255,255,.05);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1B1C1F; --card: #232428; --chip: #2E3035; --line: #36383E;
    --ink: #E9EAEC; --ink2: #BCBFC6; --ink3: #959AA3;
    --accent: #6CB4F0; --accent-soft: #2B3B4C;
    --grad-a: #2F8CFF; --grad-b: #22C7EC;
    --grad-fill-a: #0B72D9; --grad-fill-b: #0B72D9; --grad-fill-ink: #FFFFFF;
    --fill-shadow: none;
    --pos: #4CC79A; --warn: #F0AA45; --danger: #F28080;
    --shadow: 0 1px 2px rgba(0,0,0,.25);
    --shadow-md: 0 12px 34px rgba(0,0,0,.45);
    --header-bg: rgba(30,31,34,.85);
    --sb-bg: #202124; --sb-ink: rgba(255,255,255,.80); --sb-hover: rgba(255,255,255,.05);
    --sb-active-bg: rgba(230,230,255,.07); --sb-active-ink: #FFFFFF; --sb-active-bar: inset 2px 0 0 #2FB4FF;
}

* { box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--ink3) transparent;
}
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    transition: background .3s ease, color .3s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
h1:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
button { font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }

@keyframes co-pulse { 0%,100% { opacity:1 } 50% { opacity:.45 } }
@keyframes co-spin  { to { transform: rotate(360deg) } }
@keyframes co-float { 0%,100% { transform:translateY(0) } 50% { transform:translateY(-7px) } }
@keyframes co-fade  { from { opacity:0 } to { opacity:1 } }
@keyframes co-pop   { from { opacity:0; transform:scale(.97) } to { opacity:1; transform:scale(1) } }
@keyframes co-blur  { from { backdrop-filter:none; -webkit-backdrop-filter:none } }
@keyframes co-toast { from { opacity:0; transform:translate(-50%,10px) } to { opacity:1; transform:translate(-50%,0) } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: var(--shadow);
}
.eyebrow {
    font-family: var(--mono); font-weight: 600; font-size: 12.5px;
    letter-spacing: .15em; color: var(--accent); text-transform: uppercase;
}
.kpi-label { font-size: 13px; font-weight: 600; color: var(--ink3); }
.th-cell { font-size: 13px; font-weight: 600; color: var(--ink3); }
.badge {
    display: inline-flex; padding: 4px 10px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700;
}
.badge-pos    { color: var(--pos);    background: color-mix(in srgb, var(--pos) 12%, transparent); }
.badge-warn   { color: var(--warn);   background: color-mix(in srgb, var(--warn) 15%, transparent); }
.badge-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.badge-muted  { color: var(--ink3);   background: var(--chip); }
.chip-tag {
    font-family: var(--mono); font-size: 12px; font-weight: 600;
    padding: 3px 8px; border-radius: 6px; background: var(--chip); color: var(--ink2);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    border: none; border-radius: 10px; cursor: pointer;
    font-family: var(--font); font-weight: 700; letter-spacing: -0.01em;
    transition: filter .15s, background .15s, transform .15s;
}
.btn-grad {
    background: linear-gradient(135deg, var(--grad-fill-a), var(--grad-fill-b)); color: var(--grad-fill-ink);
    box-shadow: var(--fill-shadow);
}
.btn-grad:hover { filter: brightness(1.06); }
.btn-outline {
    background: transparent; border: 1px solid var(--line); color: var(--ink);
}
.btn-outline:hover { background: var(--chip); }
.btn-accent-ghost {
    background: transparent; border: 1px solid var(--line); color: var(--accent);
}
.btn-accent-ghost:hover { background: var(--accent-soft); }
.btn-icon {
    background: transparent; border: 1px solid var(--line); color: var(--ink3);
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; cursor: pointer; transition: background .15s; flex: none;
}
.btn-icon:hover { background: var(--chip); }
.btn-danger-ghost {
    background: transparent; border: 1px solid var(--line); color: var(--danger);
}
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* Links styled as buttons: the global a:hover must not recolor or underline them. */
a.btn:hover { text-decoration: none; }
a.btn-grad:hover { color: var(--grad-fill-ink); }
a.btn-outline:hover { color: var(--ink); }
a.btn-accent-ghost:hover { color: var(--accent); }
a.btn-danger-ghost:hover { color: var(--danger); }

.hv-chip:hover { background: var(--chip); }
.hv-accent-soft:hover { background: var(--accent-soft); }
.hv-bright:hover { filter: brightness(1.06); }
.hv-dim:hover { opacity: .75; }
.hv-row:hover { background: var(--chip); }
.hv-accent-text:hover { color: var(--accent) !important; }

.inp {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px;
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.inp-card { background: var(--card); }
.inp-mono { font-family: var(--mono); }
select.inp { cursor: pointer; }

.toggle {
    position: relative; width: 34px; height: 19px; flex: none; border-radius: 10px;
    background: var(--chip); transition: background .18s; display: inline-block;
}
.toggle .knob {
    position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .18s;
}
.toggle.on { background: var(--accent); }
.toggle.on .knob { left: 17px; }

.co-fade { animation: co-fade .2s ease; }

.sk { border-radius: 7px; background: var(--chip); }
.ring {
    width: 17px; height: 17px; flex: none; border-radius: 50%;
    border: 2px solid var(--chip); border-top-color: var(--accent);
    animation: co-spin .7s linear infinite;
}

.seatbar { height: 5px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.seatbar > div { height: 100%; background: var(--accent); }

.modal-overlay {
    position: fixed; inset: 0; z-index: 100; background: rgba(8,12,22,.55);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    animation: co-fade .3s ease, co-blur .2s ease .1s backwards;
}
.modal-panel {
    max-height: 90vh; overflow: auto; background: var(--card); border: 1px solid var(--line);
    border-radius: 18px; box-shadow: var(--shadow-md); padding: 26px; animation: co-pop .3s ease;
}
.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200;
    background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 12px;
    font-size: 14px; font-weight: 600; box-shadow: var(--shadow-md);
    animation: co-toast .22s ease; white-space: nowrap;
}

.tab-btn {
    padding: 8px 13px; border: none; border-radius: 9px; background: transparent;
    color: var(--ink2); font-family: var(--font); font-size: 13.5px; font-weight: 700;
    cursor: pointer; white-space: nowrap; transition: background .15s, color .15s;
}
.tab-btn:hover { background: var(--chip); }
.tab-btn.active { background: var(--accent-soft); color: var(--accent); }

.pcard {
    border: 1px solid var(--line); border-radius: 11px; background: var(--bg);
    cursor: pointer; text-align: left; font-family: var(--font);
    transition: border-color .15s, background .15s;
}
.pcard.active { border-color: var(--accent); background: var(--accent-soft); }
.pcard.off { opacity: .55; }

.chip-filter {
    padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
    color: var(--ink2); font-family: var(--font); font-size: 12.5px; font-weight: 700;
    cursor: pointer; transition: background .15s;
}
.chip-filter:hover { background: var(--chip); }
.chip-filter.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.log-console {
    flex: 1; min-height: 240px; max-height: 62vh; overflow: auto;
    padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px;
    background: #0B0E15; color: #C9D3E3;
    font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.log-console > div:hover { background: rgba(255,255,255,.05); }

.nav-item {
    display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 11px;
    border: none; background: transparent; border-radius: 10px; color: var(--sb-ink);
    font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer;
    text-align: left; transition: background .15s, color .15s; text-decoration: none;
    /* Tall enough for the tallest content (a 20px badge plus padding); otherwise a counter appearing
       makes the row a pixel taller and pushes the rest of the menu down. */
    min-height: 40px;
}
.nav-item:hover { background: var(--sb-hover); color: var(--sb-ink); text-decoration: none; }
.nav-item.active { background: var(--sb-active-bg); color: var(--sb-active-ink); box-shadow: var(--sb-active-bar); }

:root[data-theme="dark"] .only-light { display: none !important; }
:root:not([data-theme="dark"]) .only-dark { display: none !important; }

@media (max-width: 900px) {
    .grid-1-mobile { grid-template-columns: 1fr !important; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .hide-mobile { display: none !important; }
}
@media (max-width: 1080px) {
    .adm-sidebar { width: 64px !important; padding: 16px 10px !important; }
    .adm-sidebar .nav-label, .adm-sidebar .sb-cap, .adm-sidebar .sb-profile, .adm-sidebar .nav-badge,
    .adm-sidebar .sb-logo { display: none !important; }
    .adm-sidebar .sb-icon { display: block !important; }
}

.validation-message { color: var(--danger); font-size: 12.5px; margin-top: 5px; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #12141C;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: white;
    border-radius: 10px;
}
.blazor-error-boundary::after { content: "Сталася помилка."; }

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    flex: none;
    margin: 0;
    border: 1.5px solid var(--line);
    border-radius: 5px;
    background: var(--card);
    cursor: pointer;
    display: inline-grid;
    place-content: center;
    vertical-align: middle;
    transition: background .15s, border-color .15s;
}

input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: transform .12s ease;
    clip-path: polygon(14% 44%, 0 62%, 42% 100%, 100% 18%, 84% 4%, 40% 71%);
    background: var(--grad-fill-ink);
}

input[type="checkbox"]:hover {
    border-color: var(--accent);
}

input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--grad-fill-a), var(--grad-fill-b));
    border-color: transparent;
}

input[type="checkbox"]:checked::before {
    transform: scale(1);
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
