:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --line: #d9e1ec;
    --text: #111827;
    --muted: #64748b;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --ink: #0f172a;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    border-right: 1px solid var(--line);
    background: #ffffff;
    padding: 24px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 28px;
}

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

.brand small,
.eyebrow,
.help-text,
.actions span,
.empty {
    color: var(--muted);
}

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

.nav a {
    padding: 11px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #334155;
    font-weight: 650;
}

.nav a.active,
.nav a:hover {
    background: #e8f4f2;
    color: var(--brand-dark);
}

.content {
    padding: 28px;
}

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

.topbar h1 {
    margin: 0;
    font-size: 34px;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-pill,
.job-state {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 13px;
    font-weight: 800;
}

.status-pill.connected {
    background: #dcfce7;
    color: #166534;
}

.notice {
    border: 1px solid #99f6e4;
    background: #f0fdfa;
    color: #115e59;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.stats-grid,
.module-grid,
.form-grid,
.admin-grid,
.job-detail {
    display: grid;
    gap: 14px;
}

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

.stat,
.panel,
.module-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat {
    padding: 16px;
}

.stat span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat strong {
    font-size: 28px;
}

.module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.module-card {
    min-height: 150px;
    padding: 18px;
    text-decoration: none;
    display: grid;
    align-content: start;
    gap: 8px;
}

.module-card span {
    color: var(--brand-dark);
    font-weight: 800;
}

.module-card strong {
    font-size: 20px;
}

.module-card.primary {
    border-color: #5eead4;
}

.module-card.muted {
    color: #475569;
}

.panel {
    padding: 18px;
    margin-bottom: 14px;
}

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

.panel-header h2 {
    margin: 0;
}

.job-form label {
    display: grid;
    gap: 7px;
    font-weight: 750;
}

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

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

input,
select,
button {
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 11px;
    font: inherit;
}

.check-row {
    grid-template-columns: 20px 1fr;
    align-items: center;
    margin-top: 12px;
    font-weight: 650;
}

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

button {
    background: var(--brand);
    color: #ffffff;
    border-color: var(--brand);
    cursor: pointer;
    font-weight: 800;
    padding-inline: 16px;
}

.table-wrap {
    overflow: auto;
}

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

th,
td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

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

.progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
    margin-bottom: 16px;
}

.progress span {
    display: block;
    height: 100%;
    background: var(--brand);
}

.details {
    display: grid;
    gap: 10px;
    margin: 0;
}

.details div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
}

.details dt {
    color: var(--muted);
    font-weight: 750;
}

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

.logs {
    margin: 0;
    padding-left: 20px;
    color: #334155;
}

.error {
    color: #b91c1c;
}

.pagination {
    margin-top: 14px;
}

@media (max-width: 920px) {
    .app-shell,
    .stats-grid,
    .module-grid,
    .form-grid,
    .form-grid.three,
    .admin-grid,
    .job-detail {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

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