:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #647084;
    --line: #dfe5ee;
    --primary: #2457d6;
    --primary-dark: #183e9f;
    --success: #167c4a;
    --warning: #a15c00;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 800;
    font-size: 20px;
}

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

.nav a {
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 600;
}

.nav a:hover {
    background: #edf2ff;
    color: var(--primary);
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 28px auto;
}

.page-auth {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 76px);
    margin-top: 0;
}

.auth-card,
.card,
.table-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(23, 32, 51, 0.06);
}

.auth-card {
    width: min(420px, 100%);
    padding: 28px;
}

.auth-title,
.section-title,
.page-title {
    margin: 0;
    letter-spacing: 0;
}

.auth-title {
    font-size: 26px;
}

.auth-subtitle,
.muted {
    color: var(--muted);
}

.auth-subtitle {
    margin: 8px 0 24px;
}

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

.page-title {
    font-size: 28px;
}

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

.card {
    padding: 18px;
}

.metric-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-value {
    margin-top: 8px;
    font-size: 30px;
    font-weight: 800;
}

.form {
    display: grid;
    gap: 14px;
}

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

.field label {
    color: var(--muted);
    font-weight: 700;
}

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

.input:focus {
    outline: 3px solid rgba(36, 87, 214, 0.15);
    border-color: var(--primary);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

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

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

.button-secondary:hover {
    background: #dde5f1;
}

.table-card {
    overflow: hidden;
}

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

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

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

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef2f8;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.badge-queued {
    background: #fff7df;
    color: var(--warning);
}

.badge-processing {
    background: #e8f0ff;
    color: var(--primary);
}

.badge-completed {
    background: #e8f8ef;
    color: var(--success);
}

.badge-active {
    background: #e8f8ef;
    color: var(--success);
}

.badge-pending {
    background: #fff7df;
    color: var(--warning);
}

.badge-failed,
.badge-cancelled,
.badge-suspended {
    background: #fff0ed;
    color: var(--danger);
}

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.alert-success {
    border-color: #bfe8d0;
    background: #eefaf3;
    color: var(--success);
}

.alert-error {
    border-color: #ffd2cb;
    background: #fff4f2;
    color: var(--danger);
}

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

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 18px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.section-title {
    font-size: 18px;
}

.text-link {
    color: var(--primary);
    font-weight: 800;
}

.form-card {
    padding: 20px;
}

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

.metric-text {
    font-size: 18px;
    overflow-wrap: anywhere;
}

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

.tool-card {
    display: grid;
    gap: 8px;
    min-height: 130px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(23, 32, 51, 0.06);
}

.tool-card:hover {
    border-color: rgba(36, 87, 214, 0.45);
}

.tool-title {
    font-size: 17px;
    font-weight: 800;
}

.tool-copy {
    color: var(--muted);
    line-height: 1.45;
}

.empty-state {
    padding: 22px;
}

.secret-card {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
    padding: 18px;
    border-color: #bfe8d0;
}

.code-block {
    max-width: 100%;
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    border-radius: 8px;
    background: #111827;
    color: #e5e7eb;
    font-size: 13px;
    line-height: 1.6;
}

.footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 20px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 860px) {
    .topbar,
    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .split-layout,
    .tool-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

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

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

    .nav {
        width: 100%;
        justify-content: space-between;
    }
}
