.monitoring-shell {
    display: grid;
    gap: 18px;
    padding: 20px;
}

.monitoring-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    background:
        linear-gradient(120deg, rgba(191, 215, 50, 0.08), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
        var(--panel-bg-soft);
    border-color: rgba(191, 215, 50, 0.22);
}

.header-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.header-side {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.header-language {
    display: grid;
    gap: 6px;
}

.header-language label {
    color: #cfd9e4;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.language-select {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(8, 11, 15, 0.62);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    padding: 11px 14px;
}

.language-select:focus {
    outline: none;
    border-color: rgba(191, 215, 50, 0.7);
    box-shadow: 0 0 0 3px rgba(191, 215, 50, 0.12);
}

.eyebrow {
    color: #d5e58d;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.monitoring-header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    max-width: 760px;
    line-height: 1.45;
}

.header-health {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}

.health-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    font-size: 0.94rem;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.health-item span:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.health-item .badge {
    flex: 0 0 auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-gray {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.badge-green {
    background: rgba(71, 211, 127, 0.16);
    color: var(--good);
}

.badge-red {
    background: rgba(255, 102, 116, 0.18);
    color: var(--bad);
}

.monitoring-input-bar .section-head,
.journal-panel .section-head,
.kpi-panel .section-head,
.monitor-column .section-head {
    margin-bottom: 14px;
}

.rtsp-form label {
    display: block;
    margin-bottom: 8px;
    color: #cdd5dc;
    font-size: 0.83rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 600;
}

.rtsp-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(2, auto);
    gap: 12px;
    align-items: center;
}

.rtsp-row .url-input {
    min-width: 0;
}

.rtsp-row .btn {
    width: auto;
    min-width: 0;
}

.url-input,
.prompt-textarea,
.journal-textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(8, 11, 15, 0.62);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.url-input {
    padding: 12px 14px;
}

.prompt-textarea,
.journal-textarea {
    resize: vertical;
    padding: 12px 14px;
    line-height: 1.45;
}

.prompt-textarea:focus,
.url-input:focus {
    outline: none;
    border-color: rgba(191, 215, 50, 0.7);
    box-shadow: 0 0 0 3px rgba(191, 215, 50, 0.12);
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    white-space: normal;
    text-align: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 10px 24px rgba(191, 215, 50, 0.22);
}

.btn-success {
    background: linear-gradient(135deg, #bcd82f, #89d85b);
    color: #0d1400;
    box-shadow: 0 10px 24px rgba(137, 216, 91, 0.22);
}

.btn-secondary {
    background: rgba(40, 52, 70, 0.92);
    color: #e5edf7;
    border: 1px solid rgba(153, 176, 199, 0.28);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-compact {
    padding: 11px 14px;
    font-size: 0.84rem;
    white-space: nowrap;
}

.status-stack {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}

.status-message {
    min-height: 20px;
    font-size: 0.88rem;
}

.status-success {
    color: var(--good);
}

.status-error {
    color: var(--bad);
}

.status-loading {
    color: var(--warn);
}

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

.monitor-column {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.monitor-column-output {
    align-content: start;
}

.video-stage {
    min-height: 340px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
        rgba(4, 8, 12, 0.88);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-stage video {
    width: 100%;
    height: 100%;
    max-height: 420px;
    object-fit: contain;
    background: #020406;
}

.video-placeholder {
    padding: 28px;
    text-align: center;
}

.video-placeholder p:first-child {
    font-family: var(--font-display);
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.prompt-stack {
    display: grid;
    gap: 14px;
}

.prompt-card {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.prompt-head,
.output-meta-stack {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.toggle-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.55);
    color: #dbe4f3;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: normal;
}

.toggle-chip input {
    accent-color: #4af2bf;
}

.prompt-card h3,
.kpi-panel h3 {
    font-family: var(--font-display);
    font-size: 1rem;
}

.prompt-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.prompt-actions .btn {
    width: 100%;
}

.playback-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: normal;
    text-align: center;
}

.playback-badge-neutral {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.playback-badge-accent {
    background: rgba(191, 215, 50, 0.16);
    color: #e3f28f;
    border-color: rgba(191, 215, 50, 0.22);
}

.kpi-panel {
    display: grid;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

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

.kpi-card {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
}

.kpi-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.kpi-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.kpi-note {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 6px;
}

.journal-textarea {
    min-height: 260px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.84rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.journal-panel-inline {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.audit-trail-panel {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.audit-trail-list {
    display: grid;
    gap: 10px;
    max-height: calc(3 * 78px + 20px);
    overflow-y: auto;
    padding-right: 6px;
}

.audit-trail-list::-webkit-scrollbar {
    width: 8px;
}

.audit-trail-list::-webkit-scrollbar-thumb {
    background: rgba(191, 215, 50, 0.24);
    border-radius: 999px;
}

.audit-trail-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}

.monitor-feed-placeholder {
    padding: 14px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.audit-trail-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
        rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.audit-trail-row:hover {
    transform: translateY(-1px);
    border-color: rgba(191, 215, 50, 0.28);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.audit-trail-row:focus-visible {
    outline: none;
    border-color: rgba(191, 215, 50, 0.42);
    box-shadow: 0 0 0 3px rgba(191, 215, 50, 0.12);
}

.audit-trail-row.state-warning {
    border-color: rgba(255, 216, 132, 0.28);
}

.audit-trail-row.state-critical {
    border-color: rgba(255, 102, 116, 0.34);
}

.audit-row-main,
.audit-row-aside {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.audit-row-kicker {
    color: rgba(191, 215, 50, 0.92);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.audit-row-title {
    font-family: var(--font-display);
    font-size: 1rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.audit-row-subtitle,
.audit-row-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.audit-row-aside {
    justify-items: end;
    text-align: right;
    gap: 8px;
}

.audit-row-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(74, 242, 191, 0.1);
    border: 1px solid rgba(74, 242, 191, 0.18);
    color: #b9fff0;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.audit-row-chevron {
    color: rgba(191, 215, 50, 0.74);
    font-size: 1.3rem;
    line-height: 1;
}

body.modal-open {
    overflow: hidden;
}

.audit-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.audit-modal[hidden] {
    display: none;
}

.audit-modal-scrim {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 12, 0.72);
    backdrop-filter: blur(14px);
}

.audit-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    max-height: min(84vh, 760px);
    padding: 0;
    overflow: hidden;
    border-radius: 22px;
    background:
        radial-gradient(560px 280px at 0% 0%, rgba(191, 215, 50, 0.08), transparent 58%),
        linear-gradient(165deg, rgba(17, 23, 30, 0.98), rgba(10, 13, 18, 0.99));
}

.audit-modal-dialog:hover {
    transform: none;
    box-shadow: var(--shadow-xl);
}

.audit-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.audit-modal-heading {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.audit-modal-eyebrow {
    margin-bottom: 0;
}

.audit-modal-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px 24px 24px;
    overflow-y: auto;
    max-height: calc(88vh - 96px);
}

.audit-modal-panel {
    display: grid;
    align-content: start;
    gap: 14px;
    min-width: 0;
}

.audit-modal-section-head {
    margin-bottom: 0;
}

.audit-modal-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
}

.audit-summary-card,
.audit-note-card {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.audit-note-card.is-error {
    border-color: rgba(255, 102, 116, 0.28);
    background: rgba(255, 102, 116, 0.06);
}

.audit-note-card.is-loading {
    border-style: dashed;
}

.audit-summary-label,
.audit-note-label {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.audit-summary-value {
    font-family: var(--font-display);
    font-size: 1rem;
    line-height: 1.2;
}

.audit-modal-notes {
    display: grid;
    gap: 10px;
}

.audit-modal-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.audit-modal-filter {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.audit-modal-filter:hover {
    transform: translateY(-1px);
    border-color: rgba(191, 215, 50, 0.26);
}

.audit-modal-filter.is-active {
    border-color: rgba(191, 215, 50, 0.28);
    background: rgba(191, 215, 50, 0.12);
    color: #eef7bb;
}

.audit-modal-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(8, 12, 16, 0.58);
    color: var(--text-muted);
    font-size: 0.74rem;
}

.audit-modal-artifacts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.audit-modal-artifact-tile {
    flex: 1 1 220px;
    min-width: 0;
}

.audit-modal-artifact-open {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 84px;
    padding: 14px 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
        rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.audit-modal-artifact-open:hover {
    transform: translateY(-2px);
    border-color: rgba(191, 215, 50, 0.26);
    box-shadow: 0 18px 28px rgba(0, 0, 0, 0.18);
}

.audit-modal-artifact-open:focus-visible {
    outline: none;
    border-color: rgba(191, 215, 50, 0.4);
    box-shadow: 0 0 0 3px rgba(191, 215, 50, 0.12);
}

.audit-modal-artifact-tile.kind-video .audit-modal-artifact-open,
.audit-modal-artifact-tile.kind-image .audit-modal-artifact-open,
.audit-modal-artifact-tile.kind-json .audit-modal-artifact-open {
    border-color: rgba(74, 242, 191, 0.18);
}

.audit-modal-artifact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background:
        radial-gradient(circle at 30% 30%, rgba(191, 215, 50, 0.22), transparent 70%),
        rgba(12, 17, 24, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #ecf7aa;
}

.audit-modal-artifact-tile.kind-image .audit-modal-artifact-icon {
    color: #bff8ea;
    background:
        radial-gradient(circle at 30% 30%, rgba(80, 238, 199, 0.24), transparent 70%),
        rgba(12, 17, 24, 0.94);
}

.audit-modal-artifact-tile.kind-json .audit-modal-artifact-icon {
    color: #ffd77a;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 215, 122, 0.24), transparent 70%),
        rgba(12, 17, 24, 0.94);
}

.audit-modal-artifact-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.audit-modal-artifact-title {
    width: 100%;
    font-family: var(--font-display);
    font-size: 0.9rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.audit-modal-artifact-kind,
.audit-modal-artifact-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.2;
}

.audit-modal-hint {
    padding-top: 4px;
}

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

@media (max-width: 1240px) {
    .monitoring-header {
        flex-direction: column;
    }

    .header-side {
        width: 100%;
    }

    .header-health {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .header-health {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .audit-trail-list {
        max-height: calc(3 * 104px + 20px);
    }

    .audit-trail-row,
    .audit-modal-body {
        grid-template-columns: 1fr;
    }

    .audit-row-aside {
        justify-items: start;
        text-align: left;
    }

    .audit-modal-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    body {
        padding: 14px 10px;
    }

    .monitoring-shell {
        padding: 14px;
    }

    .rtsp-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .header-health {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .output-meta-stack,
    .prompt-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .journal-textarea {
        min-height: 220px;
    }
}
