:root {
    --bg: #f3f5f7;
    --card: #ffffff;
    --primary: #1f3b57;
    --border: #d9dde3;
    --text: #222;
    --muted: #666;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

header {
    background: var(--primary);
    color: white;
    padding: 18px 30px;
}

header h1 {
    font-size: 26px;
}

.container {
    width: min(1400px, 96%);
    margin: 25px auto;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.card h3 {
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 10px;
}

.card .value {
    font-size: 34px;
    font-weight: bold;
}

.card .subvalue {
    color: var(--muted);
    margin-top: 8px;
    font-size: 14px;
}

.section {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 25px;
    overflow: hidden;
}

.section h2 {
    background: #eef3f8;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 18px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

th {
    background: #fafafa;
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.badge-discovered {
    background: #e7eef8;
    color: #244f86;
}

.badge-ready {
    background: #e6f4ea;
    color: #1e7e34;
}

.badge-archiving {
    background: #fff4d6;
    color: #8a6500;
}

.badge-archived {
    background: #e8f0fe;
    color: #1a5fb4;
}

.badge-local-deleted {
    background: #f0f0f0;
    color: #555;
}

.badge-deleted {
    background: #ececec;
    color: #333;
}

.badge-error {
    background: #fdecea;
    color: #b00020;
}

.badge-default {
    background: #eee;
    color: #444;
}

header nav {
    margin-top: 10px;
}

header nav a {
    color: white;
    text-decoration: none;
    margin-right: 18px;
    font-weight: bold;
}

header nav a:hover {
    text-decoration: underline;
}

.section-subtitle {
    color: var(--muted);
    font-size: 14px;
    font-weight: normal;
    margin-left: 10px;
}

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

.pagination {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 30px;
}

.button {
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 9px 14px;
    border-radius: 6px;
    font-weight: bold;
}

.button.disabled {
    background: #ccc;
    color: #777;
}

.sort-link {
    color: var(--text);
    text-decoration: none;
}

.sort-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.button-small {
    display: inline-block;
    padding: 5px 9px;
    font-size: 12px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
    gap: 16px;
    align-items: end;
    padding: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    color: var(--muted);
    font-size: 14px;
    font-weight: bold;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text);
    font-size: 15px;
}

.form-actions {
    display: flex;
    align-items: end;
}

button.button {
    border: none;
    cursor: pointer;
    font-size: 15px;
}

.warning {
    margin: 16px 18px;
    padding: 12px;
    border: 1px solid #e2b93b;
    border-radius: 6px;
    background: #fff8dc;
    color: #705700;
}

.empty-message {
    padding: 25px 18px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .search-form {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .search-form {
        grid-template-columns: 1fr;
    }
}

.search-form {
    grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
}

@media (max-width: 1100px) {
    .search-form {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.video-container {
    padding: 20px;
    background: #111;
}

.video-container video {
    display: block;
    width: 100%;
    max-height: 75vh;
    background: black;
}

.badge-camera-online {
    background: #e6f4ea;
    color: #1e7e34;
}

.badge-camera-stale {
    background: #fff4d6;
    color: #8a6500;
}

.badge-camera-never-seen {
    background: #fdecea;
    color: #b00020;
}

.status-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 26px;
    margin-bottom: 22px;
    border-radius: 12px;
    color: white;
}

.status-banner-ok {
    background: linear-gradient(135deg, #176b3a, #229553);
}

.status-banner-attention {
    background: linear-gradient(135deg, #9b5b00, #d18400);
}

.status-eyebrow,
.panel-kicker {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
}

.status-banner h2 {
    margin: 0 0 6px;
    font-size: 26px;
}

.status-banner p {
    margin: 0;
    opacity: 0.9;
}

.status-indicator {
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    font-weight: bold;
}

.operational-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.metric-card strong {
    font-size: 32px;
}

.metric-card > span:last-child {
    color: var(--muted);
    font-size: 13px;
}

.metric-label {
    color: var(--muted);
    font-size: 14px;
    font-weight: bold;
}

.metric-success {
    border-top: 4px solid #229553;
}

.metric-warning {
    border-top: 4px solid #d18400;
}

.dashboard-panel {
    margin-bottom: 22px;
    padding: 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 20px;
}

.panel-kicker {
    color: var(--muted);
}

.panel-alert {
    padding: 6px 10px;
    border-radius: 999px;
    background: #fdecea;
    color: #b00020;
    font-size: 13px;
    font-weight: bold;
}

.camera-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.camera-tile {
    padding: 16px;
    border: 1px solid var(--border);
    border-left-width: 5px;
    border-radius: 8px;
}

.camera-tile-online {
    border-left-color: #229553;
}

.camera-tile-stale {
    border-left-color: #d18400;
}

.camera-tile-never_seen {
    border-left-color: #b00020;
}

.camera-tile-heading {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 10px;
}

.camera-tile h3 {
    margin: 0;
    font-size: 17px;
}

.camera-activity {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 5px;
    color: var(--muted);
    font-size: 13px;
}

.camera-activity strong {
    color: var(--text);
}

.camera-tile small {
    color: var(--muted);
}

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

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
    font-size: 13px;
}

.bar-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf0f3;
}

.bar-fill {
    min-width: 3px;
    height: 100%;
    border-radius: inherit;
}

.bar-state {
    background: #315f87;
}

.bar-camera {
    background: #3986a8;
}

.storage-chart {
    display: flex;
    width: 100%;
    min-height: 42px;
    overflow: hidden;
    border-radius: 8px;
    background: #edf0f3;
}

.storage-segment {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    color: white;
    font-size: 13px;
    font-weight: bold;
}

.storage-local {
    background: #315f87;
}

.storage-nas {
    background: #38a3a5;
}

.storage-legend {
    display: flex;
    gap: 24px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 5px;
    border-radius: 50%;
}

.legend-local {
    background: #315f87;
}

.legend-nas {
    background: #38a3a5;
}

.event-list {
    display: flex;
    flex-direction: column;
}

.event-item {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.event-item:last-child {
    border-bottom: none;
}

.event-camera {
    font-weight: bold;
}

.event-transition {
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-arrow {
    color: var(--muted);
}

.event-item time {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 900px) {
    .operational-cards,
    .dashboard-columns {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .status-banner,
    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .operational-cards,
    .dashboard-columns {
        grid-template-columns: 1fr;
    }

    .event-item {
        grid-template-columns: 1fr;
        gap: 7px;
    }
}


.notification-warning {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 18px;
    padding: 14px 16px;
    border: 1px solid #e2b93b;
    border-radius: 8px;
    background: #fff8dc;
    color: #705700;
}

.notification-warning strong {
    font-size: 15px;
}

.notification-warning span {
    font-size: 14px;
}

.storage-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    padding: 20px;
}

.storage-health-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.storage-health-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.storage-health-heading h3 {
    margin: 0 0 4px;
    font-size: 20px;
}

.storage-health-heading span {
    color: var(--muted);
    font-size: 13px;
}

.storage-health-heading > strong {
    align-self: start;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e6f4ea;
    color: #1e7e34;
    font-size: 12px;
}

.storage-health-warning .storage-health-heading > strong {
    background: #fff4d6;
    color: #8a6500;
}

.storage-health-critical .storage-health-heading > strong {
    background: #fdecea;
    color: #b00020;
}

.storage-health-values {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.storage-health-values span {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: var(--muted);
    font-size: 12px;
}

.storage-health-values strong {
    color: var(--text);
    font-size: 14px;
}

.storage-health-track {
    height: 13px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf2;
}

.storage-health-fill {
    height: 100%;
    border-radius: inherit;
    background: #2f855a;
}

.storage-health-warning .storage-health-fill {
    background: #d69e2e;
}

.storage-health-critical .storage-health-fill {
    background: #c53030;
}

.storage-health-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 9px;
    color: var(--muted);
    font-size: 12px;
}

.storage-health-footer > strong {
    color: var(--text);
    font-size: 14px;
}

@media (max-width: 600px) {
    .storage-health-values {
        grid-template-columns: 1fr;
    }
}

.worker-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(220px, 1fr)
    );
    gap: 16px;
    padding: 20px;
}

.worker-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--border);
    border-left: 5px solid #4f8a5b;
    border-radius: 8px;
    background: white;
}

.worker-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.worker-heading h3 {
    font-size: 18px;
}

.worker-heading strong {
    font-size: 12px;
}

.worker-running {
    border-left-color: #3478c5;
}

.worker-stale,
.worker-never_run {
    border-left-color: #d29a18;
}

.worker-error {
    border-left-color: #c0392b;
}

.worker-last-run {
    font-size: 20px;
}

.worker-card > span,
.worker-card > small {
    color: var(--muted);
}

.worker-error p,
p.worker-error {
    margin-top: 5px;
    padding: 9px;
    border-radius: 5px;
    background: #fdecea;
    color: #a32020;
    font-size: 13px;
}

.camera-tile-offline {
    border-color: #dc3545;
}

.camera-tile-checking {
    border-color: #e0a800;
}

.badge-camera-offline {
    background: #fdecea;
    color: #b00020;
}

.badge-camera-checking {
    background: #fff4d6;
    color: #765800;
}

.camera-activity-status {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.camera-activity-active {
    background: #e6f4ea;
    color: #1e7e34;
}

.camera-activity-idle {
    background: #f1f3f5;
    color: #5f6368;
}

.camera-activity-never_seen,
.camera-activity-unknown {
    background: #fff4d6;
    color: #765800;
}

header nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-user {
    margin-left: auto;
    color: #dce7f2;
    font-size: 14px;
}

.logout-form {
    display: inline;
}

.logout-button {
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 6px;
    padding: 7px 11px;
    background: transparent;
    color: white;
    cursor: pointer;
}

.logout-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(
            135deg,
            #18334e 0%,
            #28577e 55%,
            #edf2f6 55%
        );
}

.login-card {
    width: min(430px, 100%);
    padding: 36px;
    border-radius: 14px;
    background: white;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.login-heading span {
    color: #52708c;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-heading h1 {
    margin-top: 7px;
    color: #1f3b57;
}

.login-heading p {
    margin-top: 8px;
    color: #667481;
}

.login-form {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.login-form label {
    margin-top: 8px;
    color: #394b5c;
    font-size: 14px;
    font-weight: bold;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd4dc;
    border-radius: 7px;
    font-size: 16px;
}

.login-form input:focus {
    border-color: #28577e;
    outline: 3px solid rgba(40, 87, 126, 0.15);
}

.login-button {
    margin-top: 16px;
    padding: 12px 18px;
    font-size: 16px;
}

.login-error {
    margin-top: 20px;
    padding: 11px 13px;
    border: 1px solid #e2a6ad;
    border-radius: 7px;
    background: #fdecee;
    color: #a51d2d;
}
