:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #1e242b;
    --muted: #66717f;
    --line: #d9dee6;
    --accent: #126b62;
    --accent-strong: #0a5049;
    --danger: #b42318;
    --warn: #b55f00;
    --ok: #257a3e;
    --code-bg: #111827;
    --code-text: #eef2ff;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

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

button,
.button-link {
    min-height: 38px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: white;
    border-radius: 6px;
    padding: 0 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button.secondary {
    background: white;
    color: var(--accent-strong);
}

button.danger {
    border-color: var(--danger);
    background: var(--danger);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

input,
select {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 10px;
    font: inherit;
    width: 100%;
}

label {
    color: var(--muted);
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.eyebrow {
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

.error {
    min-height: 20px;
    color: var(--danger);
    font-size: 13px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    display: grid;
    gap: 18px;
    box-shadow: 0 12px 40px rgba(20, 32, 48, 0.08);
}

.app-shell {
    min-height: 100vh;
    padding: 18px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
}

.topbar,
.table-pane,
.detail-pane {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(520px, 0.9fr) minmax(420px, 1.1fr);
    gap: 14px;
    min-height: 0;
    align-items: start;
}

.table-pane,
.detail-pane {
    min-height: 580px;
    overflow: hidden;
}

.table-pane {
    height: calc(100vh - 132px);
    min-height: 680px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.detail-pane {
    height: calc(100vh - 132px);
    min-height: 680px;
}

#logDetail {
    height: 100%;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
}

.section-header,
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.log-filters {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.log-filters label {
    font-size: 12px;
}

.log-filters select {
    min-height: 32px;
    font-size: 13px;
}

.log-filters button {
    min-height: 32px;
    padding: 0 10px;
}

.log-filters .muted {
    grid-column: 1 / -1;
    font-size: 12px;
}

.log-filters .muted:empty {
    display: none;
}

.badge {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 560px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 6px 10px;
    text-align: left;
    vertical-align: middle;
    line-height: 1.25;
}

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

tr.selected {
    background: #eaf5f3;
}

.action-column {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 66px;
    min-width: 66px;
    background: var(--panel);
}

tr.selected .action-column {
    background: #eaf5f3;
}

th.action-column {
    z-index: 2;
}

.table-action {
    min-height: 28px;
    padding: 0 9px;
    font-size: 12px;
}

.empty-state {
    height: 100%;
    min-height: 580px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(16, 46px);
    gap: 4px;
    justify-content: start;
    overflow-x: auto;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}

.slot-button {
    min-width: 0;
    width: 46px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border-color: var(--line);
    background: #eef1f5;
    color: var(--text);
    font-size: 10px;
    line-height: 1;
}

.slot-button.valid {
    border-color: var(--ok);
    background: #e8f5ec;
}

.slot-button.first {
    border-color: var(--warn);
    background: #fff2df;
}

.slot-button.invalid {
    border-color: var(--danger);
    background: #fff0ee;
}

.slot-button.active {
    outline: 3px solid rgba(18, 107, 98, 0.25);
}

.log-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}

.log-output {
    margin: 0 14px 14px;
    min-height: 0;
    height: 100%;
    max-height: none;
    overflow: auto;
    border-radius: 8px;
    background: var(--code-bg);
    color: var(--code-text);
    padding: 14px;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}

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

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .slot-grid {
        grid-template-columns: repeat(8, 46px);
    }

    .table-pane,
    .detail-pane {
        height: auto;
        min-height: 520px;
    }
}
