:root {
    --bg: #f4f7f9;
    --surface: #ffffff;
    --surface-soft: #eef4f3;
    --text: #15212b;
    --muted: #5f6e79;
    --line: #d8e2e5;
    --primary: #146c63;
    --primary-strong: #0b4f48;
    --secondary: #315b8a;
    --danger: #b42318;
    --warning: #926b00;
    --ok: #1b7f43;
    --radius: 8px;
    --shadow: 0 8px 24px rgba(20, 35, 45, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: var(--secondary);
}

input,
button {
    font: inherit;
}

input {
    min-height: 44px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}

input:focus,
button:focus,
a:focus {
    outline: 3px solid rgba(49, 91, 138, 0.28);
    outline-offset: 2px;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin: 0;
}

legend {
    font-weight: 700;
    padding: 0 8px;
}

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

label input {
    font-weight: 400;
}

.setup-page,
.login-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.setup-shell {
    width: min(920px, 100%);
}

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

.setup-panel,
.login-panel {
    padding: 28px;
}

.login-panel {
    width: min(440px, 100%);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.brand-row.compact {
    margin-bottom: 0;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.brand-row h1,
.brand-row strong {
    display: block;
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
}

.brand-row p,
.brand-row span {
    display: block;
    margin: 3px 0 0;
    color: var(--muted);
}

.stacked-form {
    display: grid;
    gap: 18px;
}

.stacked-form fieldset {
    display: grid;
    gap: 14px;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

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

.button.primary:hover {
    background: var(--primary-strong);
}

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

.button.ghost {
    background: #fff;
    color: var(--secondary);
    border-color: var(--line);
}

.button.danger-outline {
    background: #fff;
    color: var(--danger);
    border-color: #efc0bd;
}

.notice {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--surface-soft);
}

.notice.success {
    color: var(--ok);
    border-color: #b8dfc7;
    background: #edf8f1;
}

.notice.danger {
    color: var(--danger);
    border-color: #efc0bd;
    background: #fff0ef;
}

.secret-list,
.detail-list {
    display: grid;
    gap: 10px;
    margin: 0 0 20px;
}

.secret-list div,
.detail-list div {
    display: grid;
    gap: 4px;
}

dt {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.secret-value {
    padding: 10px;
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-family: Consolas, Monaco, monospace;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-inner nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dashboard {
    width: min(1320px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

.metric span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 24px;
}

.status-running strong {
    color: var(--warning);
}

.status-finished strong {
    color: var(--ok);
}

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

.split-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.panel {
    padding: 18px;
}

.side-panel h2,
.table-panel h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.side-panel h2 + .entity-list {
    margin-top: 12px;
}

.entity-list {
    display: grid;
    gap: 6px;
}

.entity-list a {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
}

.entity-list a:hover,
.entity-list a.active {
    background: var(--surface-soft);
}

.entity-list small {
    color: var(--muted);
}

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

.panel-toolbar p {
    margin: -8px 0 0;
    color: var(--muted);
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 320px) auto;
    gap: 8px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

table {
    width: 100%;
    min-width: 840px;
    border-collapse: collapse;
    background: #fff;
}

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

th {
    background: #f7fafb;
    color: var(--muted);
    font-size: 13px;
}

td small {
    display: block;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e7f1f0;
    color: var(--primary-strong);
    font-size: 13px;
    font-weight: 700;
}

.empty-cell {
    color: var(--muted);
    text-align: center;
    padding: 34px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 940px) {
    .metric-grid,
    .split-layout {
        grid-template-columns: 1fr;
    }

    .header-inner,
    .panel-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .filter-form {
        width: 100%;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .dashboard,
    .header-inner {
        width: min(100% - 20px, 1320px);
    }

    .setup-page,
    .login-shell {
        padding: 10px;
    }

    .setup-panel,
    .login-panel,
    .panel,
    .metric {
        padding: 14px;
    }

    .header-inner nav {
        width: 100%;
    }

    .header-inner nav .button {
        flex: 1;
    }
}

