@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --bg-body: #0b1120;
    --bg-panel: #111a2e;
    --bg-surface: #15213a;
    --bg-surface-alt: #1b2945;
    --border-color: rgba(148, 163, 184, 0.12);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #6366f1;
    --accent-hover: #7c81ff;
    --danger: #f87171;
    --success: #34d399;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-glow: 0 24px 48px rgba(15, 23, 42, 0.35);
}

.directory-nav {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    padding: 10px 0;
    overflow-x: auto;
    background: var(--bg-body);
}

.directory-nav a {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.directory-nav a:hover,
.directory-nav a:focus-visible {
    border-color: var(--accent);
    color: var(--text-primary);
}

.directory-section,
.directory-anchor-card {
    scroll-margin-top: 72px;
}

.directory-details > summary {
    cursor: pointer;
    list-style: none;
}

.directory-details > summary::-webkit-details-marker {
    display: none;
}

.directory-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.directory-summary h2 {
    margin: 0;
}

.directory-summary-state,
.directory-details .event-aliases-state {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

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

.directory-add-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 8px 12px;
    align-items: end;
    margin-bottom: 18px;
}

.directory-add-form label {
    grid-column: 1 / -1;
}

.directory-list {
    border-top: 1px solid var(--border-color);
}

.directory-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.directory-list-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 820px) {
    .directory-grid {
        grid-template-columns: 1fr;
    }

    .directory-add-form {
        grid-template-columns: 1fr;
    }

    .directory-add-form label {
        grid-column: auto;
    }
}

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

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.25), transparent 45%),
                radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.2), transparent 40%),
                var(--bg-body);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(18px);
    border-right: 1px solid var(--border-color);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 18px;
    letter-spacing: 0.04em;
}

.logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
}

.logo-text {
    opacity: 0.92;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
    color: var(--text-secondary);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link .nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.18);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(59, 130, 246, 0.35));
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-link.active .nav-icon {
    background: rgba(226, 232, 240, 0.16);
    color: var(--text-primary);
}

.nav-link.muted {
    opacity: 0.8;
}

.sidebar-divider {
    border-bottom: 1px solid var(--border-color);
    margin: 18px 0 12px;
}

.sidebar-label {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.main-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.contract-tag-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color, #dfe5ec);
    border-bottom: 1px solid var(--border-color, #dfe5ec);
    background: var(--bg-surface-alt);
}

.contract-tag-toolbar select,
.contract-tag-toolbar input[type="text"] {
    min-width: 210px;
}

.contract-effective-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
}

.contract-effective-date input[type="date"] {
    min-width: 145px;
}

.contract-tag {
    background: #e8f0ff;
    border-color: #b8cdf9;
    color: #174a9c;
}

.contract-history {
    width: 100%;
}

.contract-history-summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
}

.contract-history-summary::-webkit-details-marker {
    display: none;
}

.notifications-layout {
    display: grid;
    gap: 24px;
}

.notifications-connect {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 18px;
    align-items: start;
}

.notifications-connect code {
    display: inline-flex;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.65);
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0;
}

.notifications-status {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.status-ok {
    border-color: rgba(52, 211, 153, 0.28);
    background: rgba(52, 211, 153, 0.1);
    color: #6ee7b7;
}

.status-warn {
    border-color: rgba(250, 204, 21, 0.28);
    background: rgba(250, 204, 21, 0.1);
    color: #fde68a;
}

.notifications-groups {
    display: grid;
    gap: 14px;
}

.notification-group-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.28);
}

.notification-group-head {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}

.notification-group-head strong,
.notification-group-head span {
    display: block;
}

.notification-group-head strong {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.notification-group-head span {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.notification-display-name {
    display: grid;
    gap: 6px;
    max-width: 520px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.notification-display-name small {
    color: var(--text-muted);
}

.notification-display-name input[type="text"],
.notification-camera-toolbar input.notification-camera-search {
    margin-bottom: 0;
}

.switch-row {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 0;
    white-space: nowrap;
}

.switch-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.notifications-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 4px 8px;
    max-height: 320px;
    overflow: auto;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.notification-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.notification-section-title {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.notification-all-cameras {
    align-self: flex-start;
}

.notification-camera-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.notification-camera-toolbar input.notification-camera-search {
    width: min(220px, 100%);
}

.notification-city-filter {
    width: min(360px, 100%);
}

.notification-camera-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.notification-camera-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 420px;
    min-height: 34px;
    margin: 0;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.28);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}

.notification-camera-item:hover {
    border-color: rgba(99, 102, 241, 0.34);
    color: var(--text-primary);
}

.notification-camera-item input {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    accent-color: var(--accent);
}

.notification-camera-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .notifications-connect,
    .notification-group-head {
        grid-template-columns: 1fr;
        display: grid;
    }

    .notifications-status {
        justify-content: flex-start;
    }
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 36px 16px;
    flex-wrap: wrap;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1 1 auto;
    min-width: 0;
}

.context-control {
    margin-top: 0;
    flex: 0 0 auto;
}

.context-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.context-switcher select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-primary);
}

.context-display {
    display: flex;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.context-name {
    color: var(--text-primary);
    font-weight: 500;
}

.menu-toggle {
    display: none;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-sm);
    padding: 8px;
    width: 42px;
    height: 38px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    margin-right: 16px;
}

.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.sidebar-overlay {
    display: none;
}

.top-bar .page-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.user-meta {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 500;
}

.user-role {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.page-content {
    padding: 0 36px 48px;
    flex: 1;
    margin: 0;
}

.page-content > *:first-child {
    margin-top: 0;
}

.guest-content {
    max-width: 420px;
    margin: 120px auto 40px;
    padding: 0 24px;
}

.card {
    background: rgba(21, 33, 58, 0.9);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: var(--shadow-glow);
    backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.camera-details-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.camera-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-primary);
    font-size: 22px;
    text-decoration: none;
}

.camera-back-button:hover {
    background: rgba(148, 163, 184, 0.22);
}

.camera-inventory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.camera-inventory-count {
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.event-aliases-details {
    display: block;
}

.event-aliases-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    list-style: none;
}

.event-aliases-summary::-webkit-details-marker {
    display: none;
}

.event-aliases-summary::marker {
    content: '';
}

.event-aliases-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.event-aliases-state {
    color: var(--text-muted);
    font-size: 13px;
}

.event-aliases-details[open] .event-aliases-state {
    color: var(--text-secondary);
}

.event-aliases-details[open] .event-aliases-state::before {
    content: 'Свернуть';
}

.event-aliases-details[open] .event-aliases-state {
    font-size: 0;
}

.event-aliases-details[open] .event-aliases-state::before {
    font-size: 13px;
}

.map-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.map-period-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
}

.map-period-form select,
.map-period-form input[type="number"],
.map-period-form input[type="text"],
.map-period-form input[type="date"] {
    width: auto;
    min-width: 120px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.65);
    color: var(--text-primary);
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.map-period-form input[type="date"] {
    width: 138px;
    min-width: 138px;
    color-scheme: dark;
}

.map-period-form input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.map-period-form input[type="number"],
.map-period-form input[name="camera_id"] {
    max-width: 130px;
}

.map-period-form input[type="number"]::placeholder,
.map-period-form input[type="text"]::placeholder {
    color: var(--text-muted);
}

.map-period-form input[type="number"]:focus,
.map-period-form input[type="text"]:focus {
    border-color: rgba(99, 102, 241, 0.6);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.map-period-form input[type="date"]:focus {
    border-color: rgba(99, 102, 241, 0.6);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.events-new-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 4px;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.map-period-form .button-small {
    margin: 0;
}

.map-period-form.is-loading {
    opacity: 0.72;
    pointer-events: none;
}

.card-body {
    padding: 20px 24px 24px;
    color: var(--text-secondary);
}

.card-body--table {
    padding: 0;
}

.polygon-settings .card-subtitle {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 14px;
}

.polygon-rows {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.polygon-row {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) 130px 160px 120px;
    gap: 16px;
    align-items: end;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.35);
}

.polygon-row label {
    font-size: 13px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.polygon-row input[type="text"],
.polygon-row input[type="number"] {
    width: 100%;
}

.polygon-required {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    font-size: 13px;
    color: var(--text-muted);
}

.toggle {
    position: relative;
    width: 46px;
    height: 24px;
    display: inline-flex;
    align-items: center;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle span {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    transition: background 0.2s ease;
}

.toggle span::after {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.toggle input:checked + span {
    background: linear-gradient(135deg, #6366f1, #22d3ee);
}

.toggle input:checked + span::after {
    transform: translateX(22px);
}

.polygon-row-actions {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.polygon-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.polygon-actions-spacer {
    flex: 1 1 auto;
}

.polygon-footer {
    margin-top: 18px;
}

.polygon-editor-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.polygon-canvas-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.polygon-image-wrapper {
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(15, 23, 42, 0.75);
}

.polygon-image-wrapper img {
    width: 100%;
    display: block;
}

.polygon-image-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: auto;
    width: 100%;
    height: 100%;
}

.polygon-image-wrapper.is-loading img,
.polygon-image-wrapper.is-loading canvas {
    opacity: 0.15;
    filter: grayscale(1);
}

.polygon-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.65));
    color: var(--text-primary);
    font-weight: 600;
}

.polygon-loader[hidden] {
    display: none !important;
}

.loader-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(226, 232, 240, 0.25);
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

.polygon-placeholder {
    padding: 24px;
    border-radius: var(--radius-md);
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-muted);
    text-align: center;
}

.polygon-rules-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.polygon-rule {
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-md);
    padding: 14px;
    background: rgba(15, 23, 42, 0.4);
}

.polygon-rule-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.polygon-rule .rule-name {
    font-weight: 600;
}

.polygon-rule .rule-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.rule-count {
    font-weight: 600;
    color: var(--primary);
}

.polygon-shape-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.polygon-shape-card {
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.polygon-shape-card .shape-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.polygon-draw-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.polygon-draw-status {
    font-size: 13px;
    color: var(--text-muted);
}

.polygon-error {
    color: var(--danger);
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.status-ok {
    background: #34d399;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15);
}

.status-down {
    background: #f87171;
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dashboard-grid--single {
    display: block;
    grid-template-columns: 1fr;
    width: 100%;
}

.dashboard-grid--single > .events-card {
    width: 100%;
    grid-column: 1 / -1;
}

.dashboard-grid > * {
    min-width: 0;
}

.site-load {
    margin-bottom: 20px;
}

.site-load > summary {
    padding: 16px 20px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 650;
}

.site-load-body {
    padding: 0 20px 20px;
}

.site-load-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 12px;
}

.site-load-card {
    min-width: 0;
    padding: 0;
    text-align: left;
    font: inherit;
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.64);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
}

.site-load-card:hover {
    border-color: var(--accent);
}

.site-load-preview {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    background: #111827;
}

.site-load-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-load-preview .site-load-pill {
    position: absolute;
    top: 8px;
    left: 8px;
}

.site-load-card-description {
    display: grid;
    gap: 4px;
    padding: 10px 12px 12px;
}

.site-load-card-description span,
.site-load-message {
    color: var(--text-secondary);
    font-size: 13px;
}

.site-load-pill,
.site-load-time {
    background: var(--site-load-bg, #334155);
    color: var(--site-load-color, #e2e8f0);
    border-radius: 6px;
}

.site-load-pill {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 650;
}

.site-load-urgent { --site-load-bg: #7f1d1d; --site-load-color: #fee2e2; }
.site-load-soon { --site-load-bg: #713f12; --site-load-color: #fef3c7; }
.site-load-ok { --site-load-bg: #14532d; --site-load-color: #dcfce7; }

.site-load-dialog {
    width: min(960px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: clamp(12px, 3vw, 20px);
    color: var(--text-primary);
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-lg);
    overflow: auto;
    color-scheme: dark;
}

.site-load-dialog::backdrop {
    background: rgba(2, 6, 23, 0.84);
}

.site-load-dialog-header,
.site-load-measurement-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.site-load-dialog-header h2 {
    flex: 1;
    margin: 0;
    font-size: 18px;
}

.site-load-dialog-header button {
    flex: none;
}

.events-new-count {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.site-load-frame {
    display: grid;
    place-items: center;
    height: min(50dvh, 510px);
    margin-top: 10px;
    overflow: hidden;
    background: #060b16;
    border-radius: var(--radius-md);
}

.site-load-frame img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
}

.site-load-timeline {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.site-load-timeline label {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.site-load-times {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 3px;
}

.site-load-time {
    flex: none;
    padding: 6px 9px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.site-load-time[aria-pressed="true"] {
    border-color: currentColor;
    box-shadow: inset 0 0 0 1px currentColor;
}

.site-load-measurement-header {
    justify-content: flex-start;
    font-size: 13px;
    color: var(--text-secondary);
}

.site-load-containers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
    gap: 6px;
    padding: 0;
    list-style: none;
}

.site-load-containers li {
    display: grid;
    gap: 2px;
    padding: 6px 8px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 6px;
}

.site-load-containers span,
.site-load-recommendations {
    font-size: 13px;
}

.map-panel {
    margin-bottom: 20px;
}

.map-container {
    width: 100%;
    max-width: 100%;
    height: 420px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

.map-panel .map-container {
    border-radius: var(--radius-md);
}

.camera-balloon {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    max-width: 240px;
}

.camera-balloon strong {
    font-size: 14px;
}

.balloon-address {
    color: var(--text-muted);
}

.balloon-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.balloon-placeholder {
    padding: 12px;
    background: rgba(15, 23, 42, 0.05);
    border-radius: var(--radius-sm);
    text-align: center;
}

.balloon-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.balloon-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}

.balloon-link:hover {
    text-decoration: underline;
}

.events-card .card-body {
    padding: 20px 24px 24px;
}

.events-loading {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.events-loading .loader-spinner {
    width: 28px;
    height: 28px;
}

.events-load-more {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.events-load-more .loader-spinner {
    width: 26px;
    height: 26px;
}

.map-toggle-button[aria-expanded="true"] {
    background: rgba(99, 102, 241, 0.24);
    color: var(--text-primary);
    border-color: rgba(129, 140, 248, 0.42);
}

.events-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 280px));
    justify-content: start;
    align-items: start;
    gap: 16px;
}

.event-review-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.events-gallery--info {
    margin-top: 4px;
}

.event-lightbox-open {
    overflow: hidden;
}

.event-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(2, 6, 23, 0.92);
    display: grid;
    place-items: center;
    padding: 24px;
}

.event-lightbox-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 72px 76px 92px;
}

.event-lightbox-topbar {
    position: absolute;
    top: 18px;
    left: 18px;
    right: 18px;
    z-index: 6;
    display: grid;
    grid-template-columns: 38px 38px;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
}

.event-lightbox-content {
    order: 2;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    max-width: calc(100vw - 152px);
}

.event-lightbox-media {
    position: relative;
    display: inline-flex;
    max-width: 100%;
    max-height: calc(100vh - 188px);
}

.event-lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 188px);
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.event-lightbox-video {
    width: min(1100px, calc(100vw - 32px));
    aspect-ratio: 16 / 9;
    background: #000;
}

.event-lightbox-close,
.event-lightbox-info {
    z-index: 4;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(226, 232, 240, 0.2);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.76);
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.event-lightbox-arrow {
    position: absolute;
    top: 50%;
    z-index: 4;
    width: 44px;
    height: 72px;
    border: 1px solid rgba(226, 232, 240, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.68);
    color: var(--text-primary);
    font-size: 42px;
    cursor: pointer;
    transform: translateY(-50%);
    backdrop-filter: blur(8px);
}

.event-lightbox-arrow--prev {
    left: 12px;
}

.event-lightbox-arrow--next {
    right: 12px;
}

.event-lightbox-details {
    order: 1;
    z-index: 5;
    width: min(1100px, calc(100vw - 152px));
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-md);
    background: rgba(8, 15, 31, 0.88);
    color: var(--text-secondary);
    backdrop-filter: blur(12px);
}

.event-lightbox-stage.is-showing-details .event-lightbox-media {
    max-height: calc(100vh - 350px);
}

.event-lightbox-stage.is-showing-details .event-lightbox-image {
    max-height: calc(100vh - 350px);
}

.event-lightbox-info {
    font-family: Georgia, serif;
    font-style: italic;
}

.event-lightbox-detail-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
}

.event-lightbox-detail-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px 14px;
    min-width: 0;
}

.event-lightbox-detail-row + .event-lightbox-detail-row {
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.event-lightbox-details .event-card-title {
    flex: 1 1 220px;
    min-width: 160px;
    font-size: 14px;
    line-height: 1.25;
}

.event-lightbox-details .event-card-meta {
    display: inline-flex;
    justify-content: flex-start;
    gap: 6px;
    flex: 0 1 auto;
    min-width: 120px;
    font-size: 12px;
}

.event-lightbox-details .event-card-meta span:last-child,
.event-lightbox-details .event-card-link {
    text-align: left;
}

.event-lightbox-details .event-card-meta--wide {
    flex: 1 1 auto;
    min-width: 280px;
}

.event-lightbox-review {
    display: flex;
    gap: 10px;
}

.event-lightbox-empty {
    min-width: min(420px, calc(100vw - 152px));
    padding: 72px 32px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.76);
    color: var(--text-secondary);
    text-align: center;
}

.review-button {
    min-width: 92px;
}

.review-button--true.is-active {
    background: rgba(52, 211, 153, 0.22);
    color: var(--text-primary);
    border-color: rgba(52, 211, 153, 0.55);
}

.review-button--false.is-active {
    background: rgba(248, 113, 113, 0.22);
    color: var(--text-primary);
    border-color: rgba(248, 113, 113, 0.55);
}

.events-gallery--fixed {
    grid-auto-rows: 220px;
}

.events-gallery--fixed .event-card-item {
    min-height: 0;
    height: 100%;
}

.events-gallery--fixed .event-card-visual,
.events-gallery--fixed .event-card-photo,
.events-gallery--fixed .event-card-details {
    min-height: 0;
    height: 100%;
}

.event-card-item {
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.42);
    overflow: hidden;
    min-height: 220px;
}

.event-card-visual {
    position: relative;
    min-height: 220px;
    height: 100%;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
}

.event-card-photo {
    position: relative;
    display: block;
    width: 100%;
    min-height: 220px;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
}

.event-card-photo-backdrop {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(34, 211, 238, 0.14)),
        linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
}

.event-card-photo-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transform: translateX(-100%);
    animation: event-card-shimmer 1.8s infinite;
}

.event-card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.event-card-item.is-image-loaded .event-card-image {
    opacity: 1;
}

.event-card-item.is-image-loaded .event-card-photo-backdrop::after {
    display: none;
}

.event-card-photo:hover .event-card-image,
.event-card-item.is-open .event-card-image {
    transform: scale(1.02);
}

.event-card-photo-hint {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font-size: 12px;
    letter-spacing: 0.03em;
    backdrop-filter: blur(8px);
}

.event-card-expand-button {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.78);
    border-color: rgba(226, 232, 240, 0.18);
    backdrop-filter: blur(8px);
}

.event-card-details {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(8, 15, 31, 0.78), rgba(8, 15, 31, 0.96));
    backdrop-filter: blur(10px);
}

.event-card-details-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.event-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.event-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.event-card-meta-label {
    color: var(--text-muted);
    flex: 0 0 auto;
}

.event-card-meta span:last-child,
.event-card-link {
    text-align: right;
    word-break: break-word;
}

.event-card-link {
    color: var(--text-primary);
    text-decoration: none;
}

.event-card-link:hover {
    text-decoration: underline;
}

.event-card-item.no-media .event-card-visual,
.event-card-item.is-fallback .event-card-visual {
    display: flex;
    flex-direction: column;
    min-height: 220px;
}

.event-card-item.no-media .event-card-details,
.event-card-item.is-fallback .event-card-details {
    position: relative;
    inset: auto;
    background: transparent;
    backdrop-filter: none;
    display: flex;
    flex: 1 1 auto;
}

.event-card-item.no-media .event-card-details-inner,
.event-card-item.is-fallback .event-card-details-inner {
    padding-top: 16px;
}

@keyframes event-card-shimmer {
    100% {
        transform: translateX(100%);
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: rgba(15, 23, 42, 0.65);
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
}

.data-table input[type="text"] {
    margin-bottom: 0;
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.12);
}

.alert {
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.alert-success {
    background: rgba(52, 211, 153, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button-primary {
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    color: #0b1120;
    box-shadow: 0 14px 30px rgba(99, 102, 241, 0.25);
}

.button-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(99, 102, 241, 0.35);
}

.button-ghost {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.button-ghost:hover {
    background: rgba(148, 163, 184, 0.18);
}

.link-underline {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.link-underline:hover {
    text-decoration: underline;
}

.button-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.button-danger {
    background: rgba(248, 113, 113, 0.14);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.button-danger:hover {
    background: rgba(248, 113, 113, 0.22);
}

.camera-delete-form {
    margin-left: auto;
}

.account-password-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(100px, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 360px;
}

.account-password-form input[type="password"] {
    min-width: 0;
    margin: 0;
    padding: 7px 9px;
    font-size: 12px;
}

.inline-delete-form {
    display: inline-block;
    margin: 0 0 0 8px;
    white-space: nowrap;
}

.user-edit-form {
    max-width: 980px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.65);
    color: var(--text-primary);
    margin-bottom: 16px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(99, 102, 241, 0.6);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

textarea {
    resize: vertical;
}

.stacked-form {
    display: flex;
    flex-direction: column;
}

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

.flex-row {
    display: flex;
    gap: 24px;
}

.flex-grow {
    flex: 1;
}

.card-fixed {
    width: 360px;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -8px;
    margin-bottom: 16px;
}

.camera-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 0;
    margin-bottom: 28px;
}

.camera-meta dl {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 2fr;
    gap: 10px 18px;
    margin: 0;
    color: var(--text-secondary);
}

.camera-meta dt {
    color: var(--text-muted);
    font-weight: 500;
}

.camera-meta dd {
    margin: 0;
}

.stream-player {
    width: 100%;
    border-radius: var(--radius-md);
    background: #000;
    min-height: 240px;
}

.stream-player--mediamtx {
    display: block;
    min-height: clamp(320px, 56vw, 720px);
    border: 0;
    aspect-ratio: 16 / 9;
    object-fit: contain;
}

.camera-events-card input[type="date"] {
    color-scheme: dark;
}

.camera-events-card input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.camera-map {
    height: 240px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 16px;
}

.card-body--filters {
    padding: 20px 24px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 18px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
    align-self: stretch;
}

.filter-field > label {
    display: block;
    height: 16px;
    font-size: 13px;
    line-height: 16px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.filter-field input,
.filter-field select {
    width: 100%;
    height: 42px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
}

.report-card #report-month {
    color-scheme: dark;
}

.report-card #report-month::-webkit-calendar-picker-indicator {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.filter-field--contract .report-contract-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.filter-field--contract .report-contract-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    width: auto;
    height: auto;
    min-height: 42px;
    margin: 0;
    line-height: 18px;
    white-space: nowrap;
    cursor: pointer;
}

.filter-field--contract .report-contract-toggle input[type="checkbox"] {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--accent);
}

.filter-field--contract .report-contract-toggle span {
    min-width: 0;
}

.filter-field--contract select {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.checkbox-dropdown {
    position: relative;
    width: 100%;
    margin: 0;
}

.checkbox-dropdown summary {
    width: 100%;
    height: 42px;
    min-height: 42px;
    padding: 10px 34px 10px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkbox-dropdown summary::-webkit-details-marker {
    display: none;
}

.checkbox-dropdown summary::after {
    content: '+';
    position: absolute;
    right: 12px;
    top: 10px;
    color: var(--text-muted);
    font-weight: 700;
}

.checkbox-dropdown[open] summary::after {
    content: '-';
}

.checkbox-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 70;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 18px 36px rgba(2, 6, 23, 0.38);
}

.checkbox-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    margin: 0;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.checkbox-dropdown-item:hover {
    background: rgba(99, 102, 241, 0.18);
    color: var(--text-primary);
}

.checkbox-dropdown-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.checkbox-dropdown-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.checkbox-dropdown-apply {
    width: 100%;
    margin-top: 8px;
}

.map-period-form .checkbox-dropdown--compact {
    width: 180px;
}

.screenshots-layout {
    display: grid;
    gap: 24px;
}

.screenshots-settings-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    align-items: end;
}

.screenshots-settings-summary {
    padding: 18px 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    list-style: none;
}

.screenshots-settings-summary::-webkit-details-marker {
    display: none;
}

.screenshots-settings-summary::after {
    content: '+';
    float: right;
    color: var(--text-muted);
}

.screenshots-settings-card[open] .screenshots-settings-summary::after {
    content: '-';
}

.screenshots-violation-dictionary {
    display: grid;
    gap: 12px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.screenshots-violation-dictionary h3 {
    margin: 0;
    font-size: 15px;
}

.screenshots-violation-add {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.screenshots-violation-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.screenshots-violation-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.28);
}

.screenshots-violation-row span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-secondary);
    font-size: 13px;
}

.screenshots-violation-color {
    width: 34px;
    height: 34px;
    margin: 0;
}

.screenshots-violation-color input {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
}

.screenshots-filter-grid {
    align-items: end;
}

.screenshots-filter-grid .filter-field {
    min-height: 64px;
}

.screenshots-filter-grid .checkbox-dropdown summary {
    height: 42px;
}

.screenshots-main-card input[type="date"] {
    color-scheme: dark;
}

.screenshots-main-card input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.screenshots-check {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 16px;
    color: var(--text-secondary);
}

.screenshots-check--inline {
    min-height: 38px;
    margin: 0;
}

.screenshots-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.screenshots-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.screenshots-actions .button {
    width: 100%;
}

.screenshot-clear-regions-action {
    grid-column: 1;
    grid-row: 1;
}

.screenshot-online-action {
    grid-column: 2;
    grid-row: 1;
}

.screenshots-actions [data-screenshot-action="reviewed"] {
    grid-column: 1;
    grid-row: 2;
}

.screenshots-actions [data-screenshot-action="violation"] {
    grid-column: 2;
    grid-row: 2;
}

.screenshot-online-modal {
    position: fixed;
    inset: 0;
    z-index: 1700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.screenshot-online-modal[hidden] {
    display: none !important;
}

.screenshot-online-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(7px);
}

.screenshot-online-dialog {
    position: relative;
    width: min(960px, calc(100vw - 36px));
    padding: 18px;
    border: 1px solid rgba(99, 102, 241, 0.32);
    border-radius: var(--radius-md);
    background: #0f172a;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.6);
}

.screenshot-online-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.screenshot-online-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
}

.screenshot-online-header .screenshot-online-close {
    position: static;
    top: auto;
    right: auto;
    flex: 0 0 auto;
}

.screenshot-online-player {
    display: block;
    width: 100%;
    max-height: calc(100vh - 170px);
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-sm);
    background: #020617;
    object-fit: contain;
}

.screenshot-online-message {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.screenshot-online-message.is-error {
    color: var(--danger);
}

.screenshots-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.screenshot-tile {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.screenshot-tile-photo {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: #020617;
    cursor: pointer;
}

.screenshot-tile-photo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.screenshot-tile-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
}

.screenshot-tile-photo:hover img {
    transform: scale(1.03);
}

.screenshot-tile-status {
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
}

.screenshot-tile-meta {
    display: grid;
    gap: 3px;
    font-size: 12px;
    color: var(--text-muted);
}

.screenshot-tile-meta strong,
.screenshot-tile-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screenshot-tile-meta strong {
    color: var(--text-primary);
    font-size: 13px;
}

.screenshot-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screenshot-lightbox[hidden] {
    display: none !important;
}

.screenshot-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(6px);
}

.screenshot-lightbox-dialog {
    position: relative;
    width: min(1480px, calc(100vw - 24px));
    max-height: calc(100vh - 32px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 102, 241, 0.25);
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.screenshot-lightbox-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    height: min(820px, calc(100vh - 32px));
    min-height: 520px;
}

.screenshot-lightbox-photo {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    background: #020617;
    touch-action: none;
}

.screenshot-lightbox-photo.is-region-mode {
    cursor: crosshair;
}

.screenshot-lightbox-photo img {
    max-width: 100%;
    max-height: calc(100vh - 142px);
    display: block;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.screenshot-ai-events-note {
    position: relative;
    z-index: 2;
    width: min(100%, 820px);
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
}

.screenshot-ai-events-note a {
    color: #67e8f9;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.screenshot-region-box {
    position: absolute;
    border: 2px solid #facc15;
    background: rgba(250, 204, 21, 0.14);
    box-shadow: 0 0 0 1px rgba(2, 6, 23, 0.65);
    pointer-events: none;
}

.screenshot-region-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.screenshot-lightbox-panel {
    min-height: 0;
    overflow-y: auto;
    padding: 22px 20px;
    border-left: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.72);
}

.screenshot-lightbox-panel h3 {
    margin: 8px 0 14px;
    font-size: 15px;
    line-height: 1.25;
}

.screenshot-lightbox-status {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.12);
    color: #67e8f9;
    font-size: 12px;
    font-weight: 700;
}

.screenshot-lightbox-panel dl {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px 12px;
    margin: 0;
    font-size: 13px;
}

.screenshots-tags-form {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.camera-tag-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    max-height: 82px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.35);
}

.camera-tag-checks > .text-muted {
    grid-column: 1 / -1;
}

.camera-tag-check {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.25;
    min-width: 0;
}

.camera-tag-check input {
    width: 16px;
    height: 16px;
    margin: 1px 0 0;
    accent-color: var(--accent);
}

.camera-tag-check span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.screenshots-tags-form label,
.screenshots-violation-type label {
    color: var(--text-muted);
    font-size: 13px;
}

.screenshots-tags-form select,
.screenshots-tags-form input,
.screenshots-violation-type select {
    width: 100%;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
}

.screenshots-violation-type {
    margin-top: 18px;
}

.screenshots-violation-type select[data-screenshot-violation-type] {
    display: none;
}

.screenshots-violation-picks {
    display: grid;
    gap: 6px;
    max-height: 190px;
    overflow-y: auto;
}

.screenshots-violation-pick {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.34);
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    box-shadow: inset 3px 0 0 var(--violation-color, transparent);
}

.screenshots-violation-pick strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 500;
}

.screenshots-violation-pick span {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--violation-color-bg, rgba(250, 204, 21, 0.18));
    color: var(--violation-color, #fde68a);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.screenshots-violation-pick.is-active {
    border-color: rgba(34, 211, 238, 0.45);
    box-shadow:
        inset 3px 0 0 var(--violation-color, transparent),
        inset 0 0 0 1px rgba(34, 211, 238, 0.12);
}

.screenshots-violation-pick.is-marked {
    border-color: var(--violation-color, rgba(250, 204, 21, 0.44));
    background: var(--violation-color-bg, rgba(113, 63, 18, 0.42));
    color: #fef3c7;
}

.screenshots-violation-pick.is-marked strong {
    color: var(--violation-color, #fff7d6);
    font-weight: 800;
}

.screenshots-region-hint {
    margin: 8px 0 0;
    font-size: 12px;
}

.screenshot-lightbox-panel dt {
    color: var(--text-muted);
}

.screenshot-lightbox-panel dd {
    min-width: 0;
    margin: 0;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.screenshot-lightbox-error {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
    font-size: 13px;
}

.screenshots-loader {
    margin-top: 18px;
    color: var(--text-muted);
    text-align: center;
    font-size: 13px;
}

.statistics-card input[type="date"] {
    color-scheme: dark;
}

.statistics-card input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.schedule-config {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

[data-schedule-form].is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.schedule-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.schedule-row input[type="time"] {
    flex: 1;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
}

.schedule-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.schedule-feedback {
    min-height: 18px;
    font-size: 13px;
    color: var(--text-secondary);
}

.schedule-feedback[data-status="success"] {
    color: var(--success);
}

.schedule-feedback[data-status="error"] {
    color: var(--danger);
}

.readonly-field {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.3);
    color: var(--text-secondary);
    min-height: 42px;
    display: flex;
    align-items: center;
}

.model-stats-card {
    margin-top: 24px;
}

.model-stats-body {
    display: flex;
    gap: 32px;
    align-items: center;
    flex-wrap: wrap;
}

.model-chart {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.4);
    position: relative;
}

.model-chart-inner {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
}

.model-chart-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.model-chart-label {
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.model-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 24px;
    flex: 1;
}

.model-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.model-metric:last-child {
    border-bottom: none;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: #f59e0b;
}

.model-metric:has(.text-warning) .metric-label:first-child {
    display: none;
}

.telemetry-stats-card {
    margin-top: 24px;
}

.telemetry-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.report-section-title {
    margin: 18px 0 12px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
}

.report-section-title:first-of-type {
    margin-top: 0;
}

.report-details-section {
    margin-top: 18px;
}

.report-details-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    list-style: none;
}

.report-details-summary::-webkit-details-marker {
    display: none;
}

.report-details-summary::after {
    content: "\041E\0442\043A\0440\044B\0442\044C";
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.report-details-section[open] .report-details-summary::after {
    content: "\0421\043A\0440\044B\0442\044C";
}

.telemetry-summary-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.telemetry-summary-item .metric-label {
    font-size: 11px;
    line-height: 1.35;
}

.metric-lines {
    display: grid;
    gap: 4px;
}

.metric-lines > span {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.metric-lines span span {
    color: var(--text-secondary);
    font-size: 12px;
}

.metric-lines strong {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.telemetry-summary-item:has([data-analytics-cycles]) .metric-label:not(.metric-label--cycles) {
    display: none;
}

.telemetry-summary-item:has([data-daily-cameras]) .metric-label:not(.metric-label--daily-cameras),
.telemetry-summary-item:has([data-planned-volume]) .metric-label:not(.metric-label--planned-volume) {
    display: none;
}

.telemetry-table-wrap {
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.telemetry-table th,
.telemetry-table td {
    white-space: nowrap;
}

.telemetry-model-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.telemetry-model-id,
.telemetry-rate {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.report-card,
.statistics-card {
    margin-top: 0;
}

.statistics-card {
    min-width: 0;
    max-width: 100%;
}

.statistics-events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.statistics-event {
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.3);
}

.statistics-event-line {
    display: grid;
    gap: 0;
}

.statistics-event-line + .statistics-event-line {
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.statistics-event-line--main {
    grid-template-columns: 158px 104px 148px minmax(220px, 1.35fr) minmax(150px, 0.8fr);
}

.statistics-event-line--camera {
    grid-template-columns: 158px minmax(220px, 1fr);
}

.statistics-event-line--details {
    grid-template-columns: minmax(170px, 1fr) minmax(210px, 1.3fr) minmax(180px, 1.2fr) minmax(140px, 0.8fr);
}

.statistics-cell {
    min-width: 0;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.statistics-cell + .statistics-cell {
    border-left: 1px solid rgba(148, 163, 184, 0.08);
}

.statistics-cell-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.statistics-id {
    color: var(--text-muted);
    font-size: 12px;
}

.statistics-time,
.statistics-neural,
.statistics-neural .telemetry-model-name {
    font-size: 12px;
}

.statistics-time {
    color: var(--text-secondary);
}

.statistics-problem {
    line-height: 1.45;
}

.statistics-run-id {
    overflow-wrap: anywhere;
    color: var(--text-secondary);
    font-size: 12px;
}

.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px 18px;
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-secondary);
    font-size: 13px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.pagination-link:hover {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--text-primary);
}

.pagination-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(59, 130, 246, 0.45));
    border-color: transparent;
    color: var(--text-primary);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.25);
}

.pagination-link.disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
}

.neural-card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.neural-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tab-button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.tab-button:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.tab-button.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(59, 130, 246, 0.42));
    color: var(--text-primary);
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.18);
}

.neural-card-body {
    padding-top: 16px;
}

.neural-card .tab-content {
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.neural-card .tab-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.neural-card .tab-content[hidden] {
    display: none !important;
}

.tab-description {
    margin-bottom: 18px;
}

.neural-section + .neural-section {
    margin-top: 28px;
}

.neural-section h3 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.table-scroll {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.table-scroll table {
    min-width: 100%;
}

.table-scroll::-webkit-scrollbar {
    height: 8px;
}

.table-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
}

.table-scroll::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.45);
    border-radius: 999px;
}

.pollution-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.pollution-item {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.pollution-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.pollution-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.pollution-description {
    font-size: 13px;
    color: var(--text-secondary);
}

.level-tag {
    background: rgba(99, 102, 241, 0.2);
}

.pollution-item.level-critical {
    border-color: rgba(248, 113, 113, 0.45);
}

.pollution-item.level-critical .level-tag {
    background: rgba(248, 113, 113, 0.2);
    color: #fca5a5;
}

.pollution-item.level-medium .level-tag {
    background: rgba(234, 179, 8, 0.2);
    color: #fde68a;
}

.pollution-item.level-low .level-tag {
    background: rgba(34, 211, 238, 0.2);
    color: #67e8f9;
}

.pollution-item.level-none .level-tag {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
}

.media-preview {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.media-preview:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.media-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1400;
}

.media-modal.active {
    display: flex;
}

.media-modal[hidden] {
    display: none !important;
}

.media-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(6px);
}

.media-modal-dialog {
    position: relative;
    background: rgba(15, 23, 42, 0.95);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 16px 18px 18px;
    max-width: min(90vw, 900px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.6);
    z-index: 1;
}

.media-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-primary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s ease, transform 0.2s ease;
}

.media-modal-nav:hover {
    background: rgba(99, 102, 241, 0.35);
    transform: translateY(-50%) scale(1.04);
}

.media-modal-nav-prev {
    left: 14px;
}

.media-modal-nav-next {
    right: 14px;
}

.media-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.media-modal-close:hover {
    background: rgba(99, 102, 241, 0.35);
    transform: rotate(90deg);
}

.media-modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.media-modal-status {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.media-player {
    max-width: 80vw;
    max-height: 70vh;
    width: auto;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.5);
    display: block;
    object-fit: contain;
    background: #000;
}

.checkbox-group {
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    background: rgba(15, 23, 42, 0.55);
}

.checkbox-group legend {
    padding: 0 4px;
    color: var(--text-secondary);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.checkbox-item input {
    flex: 0 0 auto;
    accent-color: #6366f1;
    width: 16px;
    height: 16px;
}

.checkbox-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.checkbox-item-strong {
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    color: var(--text-primary);
    font-weight: 600;
}

.camera-checkbox-scroll {
    max-height: 360px;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) rgba(15, 23, 42, 0.35);
}

[data-camera-filter-item][hidden] {
    display: none !important;
}

.camera-checkbox-scroll::-webkit-scrollbar {
    width: 8px;
}

.camera-checkbox-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.35);
    border-radius: 999px;
}

.camera-checkbox-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 999px;
}

.event-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.event-list li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.text-muted {
    color: var(--text-muted);
}

.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 36px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.app-footer.guest {
    justify-content: center;
    padding: 32px 0 48px;
    border-top: none;
}

.auth-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: var(--radius-lg);
    padding: 38px;
    box-shadow: var(--shadow-glow);
}

.auth-card h1 {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 600;
}

.widget-title {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.16);
    color: var(--text-primary);
    font-size: 12px;
}

.map-widget {
    height: 220px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 16px;
}

.tag-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-primary);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.tag-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tag-link:hover {
    background: rgba(99, 102, 241, 0.35);
}

.neural-assignment-form {
    position: relative;
}

.neural-toolbar {
    position: sticky;
    top: 20px;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin: 0 0 16px;
    background: rgba(17, 26, 46, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(12px);
}

.neural-toolbar.active {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 16px 32px rgba(99, 102, 241, 0.25);
}

.assign-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.assign-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
}

.neural-controls {
    display: none;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.neural-toolbar.active .neural-controls {
    display: flex;
}

.camera-editor-control-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.camera-table {
    width: 100%;
}

.camera-table thead {
    background: rgba(15, 23, 42, 0.65);
}

.camera-table th,
.camera-table td {
    padding: 14px 16px;
}

.camera-id-cell {
    min-width: 76px;
    text-align: center;
}

.camera-id-cell > span:last-child {
    display: block;
}

.camera-events-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    margin: 0 auto 6px;
    padding: 0 7px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.neural-view {
    display: block;
}

.neural-edit {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.neural-assignment-form.editing .neural-view {
    display: none;
}

.neural-assignment-form.editing .neural-edit {
    display: flex;
}

.neural-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: var(--text-secondary);
}

.neural-checkbox input {
    margin: 0;
    accent-color: #6366f1;
}

.status-view {
    color: var(--text-secondary);
}

.status-edit {
    display: none;
    align-items: center;
    gap: 10px;
}

.status-edit-label {
    min-width: 82px;
    color: var(--text-secondary);
    font-size: 12px;
}

.neural-assignment-form.editing .status-view {
    display: none;
}

.neural-assignment-form.editing .status-edit {
    display: inline-flex;
}

.status-switch {
    position: relative;
    display: inline-flex;
    width: 46px;
    height: 24px;
    cursor: pointer;
}

.status-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.status-slider {
    position: absolute;
    inset: 0;
    background: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    transition: background 0.2s ease;
}

.status-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s ease;
}

.status-switch input:checked + .status-slider {
    background: rgba(99, 102, 241, 0.9);
}

.status-switch input:checked + .status-slider::before {
    transform: translateX(22px);
}

.status-switch input:focus-visible + .status-slider {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

.devices-grid {
    display: grid;
    gap: 24px;
}

.device-create-summary {
    padding: 18px 24px;
    cursor: pointer;
    list-style: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
}

.device-create-summary::-webkit-details-marker {
    display: none;
}

.device-create-summary::marker {
    content: "";
}

.device-create-summary::after {
    content: "+";
    float: right;
    color: var(--text-muted);
}

.device-create-card[open] .device-create-summary::after {
    content: "−";
}

.device-create-card .stacked-form {
    max-width: 760px;
}

.device-data-row td {
    border-bottom: none;
}

.device-actions-row td {
    padding-top: 0;
}

.device-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.device-actions form {
    margin: 0;
}

.device-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.device-meta {
    display: grid;
    gap: 10px;
}

.device-meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px 16px;
    background: rgba(17, 26, 46, 0.9);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.08);
}

select[multiple] {
    height: 150px;
    background: rgba(15, 23, 42, 0.75);
}

@media (max-width: 1200px) {
    .app-shell {
        grid-template-columns: 220px 1fr;
    }

    .dashboard-grid,
    .camera-layout,
    .devices-grid,
    .screenshot-lightbox-body {
        grid-template-columns: 1fr;
    }

    .screenshot-lightbox-dialog {
        overflow-y: auto;
    }

    .screenshot-lightbox-body {
        height: auto;
    }

    .screenshot-lightbox-panel {
        border-left: none;
        border-top: 1px solid rgba(148, 163, 184, 0.12);
    }

    .card-fixed {
        width: 100%;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 220px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: inline-flex;
    }

    .side-stack {
        width: 100%;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.72);
        backdrop-filter: blur(6px);
        z-index: 90;
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .main-panel {
        margin-left: 0;
    }

    .top-bar {
        gap: 16px;
    }

    .top-bar-left {
        width: 100%;
    }

    .context-control {
        width: 100%;
    }

    .top-bar-user {
        width: 100%;
        justify-content: space-between;
    }

    .polygon-row {
        grid-template-columns: 1fr;
    }

    .polygon-row-actions {
        justify-content: flex-start;
    }

    .polygon-editor-layout {
        grid-template-columns: 1fr;
    }

    .screenshots-violation-add {
        grid-template-columns: 1fr;
    }

    .screenshots-violation-list {
        grid-template-columns: 1fr;
    }

    .screenshots-violation-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .statistics-event-line--main,
    .statistics-event-line--details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .statistics-event-line--main .statistics-problem {
        grid-column: 1 / -1;
    }

}

@media (max-width: 640px) {
    .guest-content {
        margin-top: 60px;
    }

    .card {
        border-radius: var(--radius-md);
    }

    .statistics-event-line--main,
    .statistics-event-line--camera,
    .statistics-event-line--details {
        grid-template-columns: 1fr;
    }

    .statistics-cell + .statistics-cell {
        border-top: 1px solid rgba(148, 163, 184, 0.08);
        border-left: none;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    .card-fixed {
        width: 100%;
    }

    .neural-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .neural-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .neural-checkbox {
        width: 100%;
        justify-content: space-between;
    }

    .map-period-form {
        width: 100%;
    }

    .map-period-form select,
    .map-period-form input[type="number"],
    .map-period-form input[type="text"],
    .map-period-form input[type="date"],
    .map-period-form .checkbox-dropdown--compact {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .events-new-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 0;
    }

    .events-gallery {
        grid-template-columns: 1fr;
    }

    .account-password-form {
        grid-template-columns: 1fr;
        min-width: 220px;
    }

    .event-lightbox {
        padding: 12px;
    }

    .event-lightbox-stage {
        padding: 60px 48px 86px;
    }

    .event-lightbox-topbar {
        left: 12px;
        right: 12px;
        grid-template-columns: 34px 34px;
        gap: 8px;
    }

    .event-lightbox-details {
        width: 100%;
        max-height: 116px;
        overflow-y: auto;
    }

    .event-lightbox-detail-row {
        flex-wrap: wrap;
    }

    .event-lightbox-details .event-card-title,
    .event-lightbox-details .event-card-meta,
    .event-lightbox-details .event-card-meta--wide {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    .event-lightbox-content {
        max-width: calc(100vw - 96px);
    }

    .event-lightbox-media {
        max-width: 100%;
        max-height: calc(100vh - 158px);
    }

    .event-lightbox-image {
        max-width: 100%;
        max-height: calc(100vh - 158px);
    }

    .event-lightbox-stage.is-showing-details .event-lightbox-media,
    .event-lightbox-stage.is-showing-details .event-lightbox-image {
        max-height: calc(100vh - 292px);
    }

    .event-lightbox-arrow {
        width: 34px;
        height: 56px;
        font-size: 34px;
    }

    .event-lightbox-arrow--prev {
        left: 6px;
    }

    .event-lightbox-arrow--next {
        right: 6px;
    }

    .event-lightbox-review {
        justify-content: flex-end;
    }
}
