:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #d8dee8;
    --text: #1d2733;
    --muted: #5f6c7b;
    --accent: #146c63;
    --accent-hover: #0d4f49;
    --danger: #b42318;
    --success: #1f8a5b;
    --warning: #b76e00;
    --shadow: 0 10px 28px rgba(29, 39, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: min(1180px, 100%);
    margin: 0 auto 18px;
}

.eyebrow {
    margin: 0 0 2px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 28px;
    line-height: 1.15;
}

h2 {
    margin-bottom: 2px;
    font-size: 18px;
}

.topbar__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--muted);
}

.status-dot--busy {
    background: var(--warning);
}

.status-dot--ok {
    background: var(--success);
}

.status-dot--error {
    background: var(--danger);
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    width: min(1180px, 100%);
    margin: 0 auto;
}

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

.panel {
    padding: 18px;
}

.panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.panel__header p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.check-form {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(230px, 300px) minmax(190px, auto);
    gap: 16px;
    align-items: start;
}

.field {
    display: grid;
    gap: 6px;
}

label,
.field-label {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    line-height: 18px;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 9px 11px;
    outline: none;
}

input:focus,
select:focus,
button:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(20, 108, 99, 0.16);
}

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

.scope-field {
    min-width: 0;
}

.scope-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.segmented input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.segmented {
    position: relative;
    display: block;
}

.segmented span {
    display: grid;
    place-items: center;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--muted);
    cursor: pointer;
    padding: 0 12px;
}

.segmented input:checked + span {
    border-color: var(--accent);
    background: #e8f3f1;
    color: var(--accent-hover);
    font-weight: 700;
}

.form-actions,
.toolbar,
.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-actions {
    justify-content: flex-end;
    min-width: 0;
    padding-top: 24px;
}

.button,
.icon-button {
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    min-height: 42px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    white-space: nowrap;
    min-width: 88px;
}

.button:hover,
.icon-button:hover {
    border-color: #b9c3d0;
    background: #f8fafb;
}

.button--primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.button--primary:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.icon {
    font-size: 18px;
    line-height: 1;
}

.icon-button {
    width: 42px;
    padding: 0;
}

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

.metric {
    padding: 14px;
    box-shadow: none;
}

.metric span,
.context-item span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    margin-top: 2px;
    font-size: 26px;
}

.alerts {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.scan-progress {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.scan-progress[hidden] {
    display: none;
}

.scan-progress__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.scan-progress__meta strong {
    color: var(--text);
    white-space: nowrap;
}

.progress-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6ebf1;
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 160ms ease;
}

.alert {
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 14px;
}

.alert--error {
    background: #fff1f0;
    color: var(--danger);
    border: 1px solid #f2b8b5;
}

.alert--warning {
    background: #fff8e8;
    color: #7a4b00;
    border: 1px solid #f0d49a;
}

.alert--success {
    background: #ecf8f2;
    color: #155c3d;
    border: 1px solid #b8dfcc;
}

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

.context-item {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 10px;
}

.context-item strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.filter-row {
    flex-wrap: wrap;
}

.filter-row label {
    color: var(--muted);
    font-weight: 600;
}

.filter-row select,
.filter-row input {
    width: auto;
    min-width: 160px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    position: sticky;
    top: 0;
    background: #f8fafb;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 12px;
    font-weight: 700;
}

.badge--listed {
    background: #fff1f0;
    color: var(--danger);
}

.badge--clear {
    background: #ecf8f2;
    color: var(--success);
}

.badge--skipped {
    background: #f2f4f7;
    color: var(--muted);
}

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

@media (max-width: 1080px) {
    .workspace,
    .panel--search,
    .summary-grid,
    .details-panel,
    .table-panel {
        display: block;
    }

    .panel,
    .summary-grid {
        margin-bottom: 16px;
    }

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

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

    .scope-field {
        width: 100%;
    }

    .form-actions {
        justify-content: stretch;
        padding-top: 0;
    }

    .form-actions .button {
        flex: 1 1 0;
    }
}

@media (max-width: 760px) {
    .app-shell {
        width: 100%;
        padding-right: 10px;
        padding-left: 10px;
        padding-top: 14px;
    }

    .topbar,
    .panel__header,
    .form-actions,
    .filter-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .summary-grid,
    .context-grid {
        grid-template-columns: 1fr;
    }

    .toolbar,
    .form-actions {
        justify-content: start;
    }

    h1 {
        font-size: 24px;
    }
}

@media print {
    .panel--search,
    .toolbar,
    .filter-row {
        display: none;
    }

    body {
        background: #fff;
    }

    .app-shell {
        width: 100%;
    }
}
