:root {
    --bg: #0f1419;
    --panel: #141a22;
    --panel-2: #1b232e;
    --border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --muted: #a8b1bd;
    --dim: #657180;
    --green: #00ff00;
    --yellow: #ffff00;
    --red: #ff0000;
    --red-soft: rgba(255, 0, 0, 0.18);
    --yellow-soft: rgba(255, 255, 0, 0.13);
    --green-soft: rgba(0, 255, 0, 0.12);
    --mono: 'IBM Plex Mono', 'Menlo', monospace;
    --sans: 'Inter', system-ui, sans-serif;
}

body {
    display: block;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 80% 0%, rgba(255, 0, 0, 0.11), transparent 32rem),
        linear-gradient(135deg, #07090d 0%, var(--bg) 55%, #080a0d 100%);
    color: var(--text);
    font-family: var(--sans);
}

.hidden {
    display: none !important;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(5, 7, 10, 0.95);
    font-family: var(--mono);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.brand small {
    color: var(--dim);
    font-size: 0.72rem;
}

.brand-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 16px var(--red);
    animation: pulseDot 1.1s ease-in-out infinite;
}

.topbar-meta {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.topbar-meta span {
    padding: 0.28rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
}

.notebook-view,
.tv-view {
    width: 100%;
    padding: 1.25rem;
}

.hero-panel,
.tv-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.3rem;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 0, 0, 0.05));
}

.eyebrow {
    margin-bottom: 0.35rem;
    color: var(--red);
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(2rem, 5vw, 5rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.hero-panel p {
    max-width: 60rem;
    margin-top: 0.6rem;
    color: var(--muted);
    font-size: 1rem;
}

.system-status,
.tv-status {
    flex: 0 0 auto;
    padding: 0.85rem 1rem;
    border: 2px solid var(--red);
    background: var(--red-soft);
    color: var(--red);
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    box-shadow: 0 0 28px rgba(255, 0, 0, 0.22);
}

.status-critical,
.tv-status.is-critical {
    animation: redPulse 0.75s infinite;
}

.employee-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.employee-card,
.tv-card,
.control-card,
.feed-card,
.alert-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(20, 26, 34, 0.9);
}

.employee-card {
    min-height: 25rem;
    padding: 1.1rem;
}

.employee-card.is-red {
    border-color: rgba(255, 0, 0, 0.48);
    background: linear-gradient(180deg, rgba(255, 0, 0, 0.13), rgba(20, 26, 34, 0.88));
}

.employee-card.is-yellow {
    border-color: rgba(255, 255, 0, 0.4);
    background: linear-gradient(180deg, rgba(255, 255, 0, 0.09), rgba(20, 26, 34, 0.88));
}

.employee-card.is-green {
    border-color: rgba(0, 255, 0, 0.35);
}

.is-active-risk {
    animation: redBorderPulse 0.85s infinite;
}

.employee-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.employee-role {
    color: var(--dim);
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
}

.employee-card h2 {
    margin-top: 0.4rem;
    font-size: clamp(1.7rem, 3.2vw, 3.7rem);
    line-height: 1;
}

.status-pill {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    font-family: var(--mono);
    font-weight: 700;
    white-space: nowrap;
}

.countdown {
    margin: 1.15rem 0;
    padding: 0.8rem;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    font-family: var(--mono);
    font-size: clamp(1.25rem, 2vw, 2rem);
    font-weight: 700;
}

.risk-list {
    display: grid;
    gap: 0.75rem;
}

.metric-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.4rem 0.75rem;
    align-items: center;
    font-family: var(--mono);
}

.metric-row span {
    color: var(--muted);
    font-size: clamp(0.95rem, 1.4vw, 1.35rem);
}

.metric-row strong {
    font-size: clamp(1.15rem, 2.2vw, 2.35rem);
}

.meter {
    grid-column: 1 / -1;
    height: 0.65rem;
    background: rgba(255, 255, 255, 0.08);
}

.meter i {
    display: block;
    height: 100%;
}

.meter-red {
    background: var(--red);
    box-shadow: 0 0 14px rgba(255, 0, 0, 0.58);
}

.meter-yellow {
    background: var(--yellow);
}

.meter-green {
    background: var(--green);
}

.employee-foot {
    margin-top: 1rem;
    color: var(--dim);
    font-family: var(--mono);
    font-size: 0.88rem;
}

.control-grid,
.lower-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.control-card,
.feed-card,
.alert-panel {
    padding: 1rem;
}

.card-title {
    margin-bottom: 0.75rem;
    color: var(--text);
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 0.1em;
}

.interaction-copy {
    margin-bottom: 0.85rem;
    color: var(--muted);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

button,
.neutral-link {
    min-height: 3.2rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-decoration: none;
    cursor: pointer;
}

.danger-btn {
    border-color: rgba(255, 0, 0, 0.8);
    background: rgba(255, 0, 0, 0.24);
}

.warn-btn {
    border-color: rgba(255, 255, 0, 0.7);
    background: rgba(255, 255, 0, 0.16);
}

.neutral-btn,
.neutral-link {
    background: rgba(255, 255, 255, 0.06);
}

.alert-panel {
    min-height: 14rem;
}

.alert-panel.critical {
    border-color: rgba(255, 0, 0, 0.7);
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.19), rgba(20, 26, 34, 0.92));
}

.alert-panel.warning {
    border-color: rgba(255, 255, 0, 0.5);
    background: linear-gradient(135deg, rgba(255, 255, 0, 0.14), rgba(20, 26, 34, 0.92));
}

.alert-kicker {
    color: var(--red);
    font-family: var(--mono);
    font-size: 1.1rem;
    font-weight: 700;
}

.alert-title {
    margin: 0.8rem 0;
    color: var(--text);
    font-size: clamp(2rem, 4vw, 4.5rem);
    font-weight: 900;
    line-height: 0.9;
}

.alert-steps {
    color: var(--red);
    font-family: var(--mono);
    font-size: clamp(1.4rem, 3vw, 3.4rem);
    font-weight: 700;
}

.alert-action,
.alert-reco {
    margin-top: 0.35rem;
    color: var(--text);
    font-family: var(--mono);
    font-weight: 700;
}

.event-feed {
    display: grid;
    gap: 0.45rem;
    max-height: 13rem;
    overflow: auto;
}

.feed-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.7rem;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.82rem;
}

.feed-row span {
    color: var(--red);
}

.feed-row.muted {
    opacity: 0.6;
}

.tv-view {
    min-height: calc(100vh - 3.2rem);
    padding: 1.5rem;
}

.tv-header {
    align-items: center;
    min-height: 11rem;
}

.tv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.tv-card {
    min-height: 30rem;
    padding: 1.4rem;
}

.tv-card h2 {
    margin-bottom: 1.5rem;
    font-size: clamp(2.2rem, 4.5vw, 5.8rem);
    line-height: 0.95;
}

.tv-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--mono);
    font-size: clamp(1.1rem, 2vw, 2rem);
}

.tv-row span {
    color: var(--muted);
}

.tv-risk {
    margin-top: 1.2rem;
    color: var(--red);
    font-family: var(--mono);
    font-size: clamp(2.2rem, 5vw, 6rem);
    font-weight: 700;
}

.tv-card.is-yellow .tv-risk {
    color: var(--yellow);
}

.tv-footer {
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.tv-feed {
    color: var(--red);
    font-family: var(--mono);
    font-size: clamp(1rem, 1.6vw, 1.6rem);
    white-space: nowrap;
}

.critical-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.82);
}

.critical-card {
    width: min(90vw, 64rem);
    padding: 2rem;
    border: 3px solid var(--red);
    background: #120000;
    text-align: center;
    box-shadow: 0 0 55px rgba(255, 0, 0, 0.45);
    animation: redPulse 0.6s infinite;
}

.critical-kicker,
.critical-bottom {
    color: var(--red);
    font-family: var(--mono);
    font-size: clamp(1rem, 2vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.12em;
}

.critical-title {
    margin: 1rem 0;
    font-size: clamp(4rem, 12vw, 11rem);
    font-weight: 900;
    line-height: 0.85;
}

.critical-steps {
    margin-bottom: 1rem;
    color: var(--red);
    font-family: var(--mono);
    font-size: clamp(1.8rem, 5vw, 5rem);
    font-weight: 700;
}

.scanlines {
    position: fixed;
    inset: 0;
    z-index: 120;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.018) 50%, transparent 50%);
    background-size: 100% 3px;
    opacity: 0.45;
}

/* ════════════════════════════════════
   ADMIN PANEL (spodní lišta, jen ?admin)
════════════════════════════════════ */
.admin-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.7rem 0.9rem;
    border-top: 1px solid var(--border);
    background: rgba(4, 5, 9, 0.97);
    backdrop-filter: blur(14px);
}

.admin-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.adm-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--dim);
    white-space: nowrap;
}

.ctrl-btn {
    min-height: auto;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.1s;
}

.ctrl-btn:active {
    transform: scale(0.97);
}

.ctrl-danger {
    border-color: rgba(255, 0, 0, 0.8);
    background: rgba(255, 0, 0, 0.24);
    color: #fff;
}

.ctrl-warning {
    border-color: rgba(255, 255, 0, 0.7);
    background: rgba(255, 255, 0, 0.16);
    color: #fff;
}

.ctrl-muted {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

.phase-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.phase-btn {
    min-height: auto;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.phase-btn.is-active {
    border-color: var(--red);
    background: var(--red-soft);
    color: #fff;
}

.action-divider {
    width: 1px;
    height: 26px;
    background: var(--border);
}

/* ════════════════════════════════════
   GEAR + QUICK MENU
════════════════════════════════════ */
.controls-toggle {
    position: fixed;
    bottom: 0.7rem;
    right: 0.7rem;
    width: 48px;
    height: 48px;
    min-height: auto;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(12, 16, 24, 0.96);
    color: var(--muted);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 130;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.controls-toggle:hover {
    color: var(--red);
    border-color: var(--red);
}

.quick-menu {
    position: fixed;
    right: 0.8rem;
    bottom: 4.2rem;
    width: min(300px, calc(100vw - 1.6rem));
    padding: 0.95rem;
    border: 1px solid var(--border);
    background: rgba(10, 12, 18, 0.97);
    z-index: 135;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

.quick-menu-title {
    font-size: 1rem;
    font-weight: 900;
    color: var(--text);
}

.quick-menu-mode {
    margin-top: 0.2rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.quick-menu-section {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.quick-menu-subtitle {
    margin-bottom: 0.55rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.quick-menu-link {
    width: 100%;
    display: block;
    min-height: auto;
    margin-top: 0.4rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.quick-menu-link:first-child {
    margin-top: 0;
}

.quick-menu-link:hover {
    background: rgba(255, 255, 255, 0.09);
}

.quick-shortcut {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
    font-size: 0.85rem;
    color: var(--text);
}

.quick-shortcut span:first-child {
    display: inline-flex;
    min-width: 2.2rem;
    height: 1.8rem;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    color: var(--red);
    font-family: var(--mono);
    font-weight: 800;
}

body.is-admin .notebook-view {
    padding-bottom: 9rem;
}

/* ════════════════════════════════════
   STABILNÍ STAV
════════════════════════════════════ */
.system-status.status-stable {
    border-color: rgba(0, 255, 0, 0.6);
    background: var(--green-soft);
    color: var(--green);
    box-shadow: 0 0 22px rgba(0, 255, 0, 0.18);
    animation: none;
}

.alert-panel.stable {
    border-color: rgba(0, 255, 0, 0.4);
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.1), rgba(20, 26, 34, 0.92));
}

.alert-panel.stable .alert-kicker {
    color: var(--green);
}

.alert-panel.stable .alert-title {
    color: var(--green);
}

/* ════════════════════════════════════
   BOOT SEKVENCE
════════════════════════════════════ */
.boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    background: #050608;
    transition: opacity 0.6s ease;
}

.boot-overlay.boot-done {
    opacity: 0;
    pointer-events: none;
}

.boot-box {
    width: min(90vw, 52rem);
    padding: 2rem;
    border: 1px solid var(--border);
    background: rgba(12, 16, 24, 0.6);
}

.boot-title {
    margin-bottom: 1.2rem;
    color: var(--red);
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 0.14em;
    font-size: clamp(1rem, 2.5vw, 1.6rem);
}

.boot-lines {
    display: grid;
    gap: 0.45rem;
}

.boot-line {
    color: var(--green);
    font-family: var(--mono);
    font-size: clamp(0.85rem, 1.6vw, 1.1rem);
    animation: bootIn 0.25s ease;
}

@keyframes bootIn {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ════════════════════════════════════
   IZOLAČNÍ ZÓNA OVERLAY
════════════════════════════════════ */
.isolation-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.85);
}

.isolation-card {
    width: min(92vw, 70rem);
    padding: 2.5rem;
    border: 3px solid var(--yellow);
    background: #14130a;
    text-align: center;
    box-shadow: 0 0 55px rgba(255, 255, 0, 0.3);
    animation: yellowPulse 0.8s infinite;
}

.isolation-kicker {
    color: var(--yellow);
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 0.12em;
    font-size: clamp(1rem, 2vw, 2rem);
}

.isolation-title {
    margin: 1rem 0;
    font-size: clamp(3rem, 9vw, 8rem);
    font-weight: 900;
    line-height: 0.9;
}

.isolation-sub {
    color: var(--muted);
    font-family: var(--mono);
    font-weight: 700;
    font-size: clamp(0.9rem, 2vw, 1.6rem);
}

@keyframes yellowPulse {

    0%,
    100% {
        box-shadow: 0 0 24px rgba(255, 255, 0, 0.25);
    }

    50% {
        box-shadow: 0 0 55px rgba(255, 255, 0, 0.6);
    }
}

/* ════════════════════════════════════
   TV KALENDÁŘ
════════════════════════════════════ */
.tv-calendar-wrap {
    margin-top: 1.25rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border);
    background: rgba(20, 26, 34, 0.7);
}

.cal-legend {
    display: flex;
    gap: 1.2rem;
    margin: 0.5rem 0 1rem;
    color: var(--muted);
    font-family: var(--mono);
    font-size: clamp(0.8rem, 1.3vw, 1.1rem);
}

.cal-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.cal-dot {
    width: 0.85rem;
    height: 0.85rem;
    display: inline-block;
}

.cal-dot.cal-green {
    background: var(--green);
}

.cal-dot.cal-yellow {
    background: var(--yellow);
}

.cal-dot.cal-red {
    background: var(--red);
}

.tv-calendar {
    display: grid;
    gap: 0.7rem;
}

.cal-row {
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: 0.8rem;
    align-items: center;
}

.cal-name {
    font-weight: 900;
    font-size: clamp(1.1rem, 2vw, 1.8rem);
}

.cal-track {
    display: grid;
    grid-template-columns: repeat(28, 1fr);
    gap: 0.25rem;
}

.cal-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: clamp(0.55rem, 1vw, 0.95rem);
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
}

.cal-cell.cal-green {
    background: rgba(0, 255, 0, 0.55);
    color: #04200a;
}

.cal-cell.cal-yellow {
    background: rgba(255, 255, 0, 0.55);
    color: #211f00;
}

.cal-cell.cal-red {
    background: rgba(255, 0, 0, 0.6);
    color: #fff;
}

.cal-cell.is-today {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
    font-weight: 800;
}

@keyframes pulseDot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

@keyframes redPulse {

    0%,
    100% {
        box-shadow: 0 0 24px rgba(255, 0, 0, 0.35);
    }

    50% {
        box-shadow: 0 0 55px rgba(255, 0, 0, 0.78);
    }
}

@keyframes redBorderPulse {

    0%,
    100% {
        border-color: rgba(255, 0, 0, 0.55);
    }

    50% {
        border-color: rgba(255, 0, 0, 1);
    }
}

@media (max-width: 900px) {

    .employee-grid,
    .control-grid,
    .lower-grid,
    .tv-grid {
        grid-template-columns: 1fr;
    }

    .hero-panel,
    .tv-header,
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}