:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --surface: #ffffff;
    --line: #dce3e7;
    --text: #172026;
    --muted: #60707a;
    --green: #16833f;
    --red: #bf3434;
    --amber: #a56400;
    --blue: #1f66b1;
    --ink: #22313a;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
    min-height: 100vh;
    padding: 22px 18px;
    background: #18252d;
    color: #f8fbfc;
}

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

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #4fb477;
    color: #082018;
    font-weight: 800;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    color: #aebcc3;
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #d6e0e4;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
    background: #273943;
    color: #ffffff;
}

.shell {
    min-width: 0;
    padding: 28px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 22px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 28px;
    line-height: 1.2;
}

h2 {
    font-size: 17px;
}

.toolbar p,
.muted {
    color: var(--muted);
    font-size: 13px;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

input,
select,
textarea {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

input,
select {
    padding: 0 11px;
}

textarea {
    width: 100%;
    min-height: 230px;
    padding: 12px;
    resize: vertical;
    line-height: 1.45;
}

.button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    padding: 0 14px;
    background: var(--blue);
    color: #ffffff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.button.secondary {
    background: #dce8ef;
    color: var(--ink);
}

.view {
    display: grid;
    gap: 18px;
}

.hidden {
    display: none;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: 12px;
}

.metric,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric {
    padding: 16px;
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: 28px;
}

.metric.success strong {
    color: var(--green);
}

.metric.failed strong,
.metric.missed strong {
    color: var(--red);
}

.metric.warning strong,
.metric.unknown strong {
    color: var(--amber);
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(340px, 0.9fr) minmax(360px, 1.1fr);
    gap: 18px;
}

.panel {
    min-width: 0;
    overflow: hidden;
}

.panel-header {
    min-height: 58px;
    padding: 15px 16px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.run-list {
    display: grid;
    gap: 0;
}

.run-card {
    width: 100%;
    padding: 13px 16px;
    display: grid;
    gap: 4px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-decoration: none;
}

.run-card:hover {
    background: #f3f8fa;
}

.run-card strong {
    font-size: 14px;
}

.unknown-report-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.run-card-main {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.status {
    display: inline-flex;
    width: max-content;
    min-height: 24px;
    align-items: center;
    border-radius: 999px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 750;
}

.status.success {
    color: #0d5f2a;
    background: #dff4e6;
}

.status.failed,
.status.missed {
    color: #8e1e1e;
    background: #f9dddd;
}

.status.warning,
.status.unknown {
    color: #774800;
    background: #ffedcf;
}

.details-box {
    min-height: 288px;
    max-height: 520px;
    margin: 0;
    padding: 16px;
    overflow: auto;
    background: #fbfcfd;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border-bottom: 1px solid var(--line);
}

.meta-item {
    min-width: 0;
    padding: 12px 16px;
    background: #ffffff;
}

.meta-item span,
.meta-item strong {
    display: block;
}

.meta-item span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
}

.meta-item strong {
    overflow-wrap: anywhere;
    font-size: 13px;
}

.assign-box {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(140px, auto);
    gap: 10px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #f8fbfc;
}

.assign-box.hidden {
    display: none;
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
    font-size: 14px;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.import-panel {
    max-width: 980px;
}

.import-panel label {
    display: block;
    margin: 16px 16px 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.import-panel select,
.import-panel input,
.import-panel textarea {
    width: calc(100% - 32px);
    margin: 0 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 16px;
}

.unknown-customer-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px) auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.unknown-customer-info {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.unknown-customer-info strong,
.unknown-customer-info span {
    overflow-wrap: anywhere;
}

.customer-name-input {
    width: 100%;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgb(23 32 38 / 62%);
}

.modal-backdrop.hidden {
    display: none;
}

.modal-window {
    width: min(1120px, 100%);
    max-height: min(860px, calc(100vh - 56px));
    display: grid;
    grid-template-rows: auto auto auto minmax(260px, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgb(23 32 38 / 28%);
}

.run-modal-window {
    grid-template-rows: auto auto minmax(300px, 1fr);
}

.modal-window .panel-header {
    border-bottom: 1px solid var(--line);
}

.modal-details {
    max-height: none;
    min-height: 260px;
}

.modal-content {
    min-height: 300px;
    overflow: auto;
    padding: 16px;
    background: #fbfcfd;
}

.detail-section {
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.detail-section h3 {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
}

.detail-row {
    min-width: 0;
    padding: 11px 14px;
    background: #ffffff;
}

.detail-row span,
.detail-row strong {
    display: block;
}

.detail-row span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
}

.detail-row strong {
    overflow-wrap: anywhere;
    font-size: 13px;
}

@media (max-width: 960px) {
    body {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
    }

    .toolbar,
    .content-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

    .unknown-report-card {
        grid-template-columns: 1fr;
    }

    .assign-box {
        grid-template-columns: 1fr;
    }

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

    .modal-backdrop {
        padding: 14px;
    }

    .modal-window {
        max-height: calc(100vh - 28px);
    }
}

@media (max-width: 560px) {
    .shell {
        padding: 18px;
    }

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

    .toolbar-actions,
    .toolbar-actions input,
    .toolbar-actions button {
        width: 100%;
    }
}
