:root {
    --bg: #e8ecf3;
    --surface: #ffffff;
    --text: #1a2332;
    --muted: #5c6b80;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #b91c1c;
    --success: #15803d;
    --log-bg: #0d1117;
    --log-fg: #7ee787;
    --border: #d1d9e6;
    --radius: 10px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

.site-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: #f1f5f9;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}

.site-header h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.site-header__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.25rem;
}

.site-header__main {
    flex: 1 1 200px;
    min-width: 0;
}

.site-header__stop {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    align-self: center;
}

.site-header__stop .btn {
    white-space: nowrap;
}

.site-header p {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    opacity: 0.88;
}

.shell {
    max-width: 920px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2.5rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--text);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

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

.alert--warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert--success {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .form-grid--2 {
        grid-template-columns: 1fr 1fr;
    }
}

.field label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.field .hint {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.8rem;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: #fafbfc;
}

.field input:focus,
.field textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    border-color: var(--accent);
    background: #fff;
}

.field textarea {
    min-height: 6.5rem;
    resize: vertical;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
    font-size: 0.9rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.49rem 0.94rem;
    font: inherit;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

/* Ссылки с классом .btn: глобальные a:hover не должны перебивать цвет текста */
.btn:hover,
.btn:focus {
    background: var(--accent-hover);
    color: #fff;
    text-decoration: none;
}

.btn--sm {
    padding: 0.26rem 0.49rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
}

.btn--secondary {
    background: #fff;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn--secondary:hover,
.btn--secondary:focus {
    background: #eff6ff;
    color: var(--accent);
    text-decoration: none;
}

.btn--danger {
    background: var(--danger);
    color: #fff;
}

.btn--danger:hover,
.btn--danger:focus {
    background: #991b1b;
    color: #fff;
    text-decoration: none;
}

.btn-wrap {
    margin-top: 1.25rem;
}

.btn-row {
    margin-bottom: 0.85rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 0.5rem;
}

.results-table th,
.results-table td {
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.results-table th {
    background: #f1f5f9;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.inline-code {
    background: #f1f5f9;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.88em;
}

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

.jobs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.jobs-table th,
.jobs-table td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.jobs-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
}

.jobs-table tbody tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge--queued {
    background: #e0e7ff;
    color: #3730a3;
}
.badge--running {
    background: #fef3c7;
    color: #92400e;
}
.badge--done {
    background: #dcfce7;
    color: #166534;
}
.badge--failed {
    background: #fee2e2;
    color: #991b1b;
}

.badge--cancelled {
    background: #e2e8f0;
    color: #475569;
}

pre.log {
    background: var(--log-bg);
    color: var(--log-fg);
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.footer-note {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 1.5rem;
}

.footer-note code {
    background: #e2e8f0;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.85em;
}

.nav-back {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Job page: log accordion */
.job-log-card {
    padding: 0;
    overflow: hidden;
}

.job-log-card .accordion__toggle {
    width: 100%;
    margin: 0;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--text);
    background: var(--surface);
    border: none;
    cursor: pointer;
    text-align: left;
}

.job-log-card .accordion__toggle:hover {
    background: #f8fafc;
}

.job-log-card .accordion__chevron {
    flex-shrink: 0;
    opacity: 0.65;
    font-size: 0.85rem;
}

.job-log-card .accordion__panel {
    padding: 0 1.5rem 1.35rem;
    border-top: 1px solid var(--border);
}

.job-log-card .accordion__panel[hidden] {
    display: none !important;
}

.job-log-card .accordion__panel .log {
    margin-top: 1rem;
    max-height: min(70vh, 32rem);
}

.site-header__stop form {
    margin: 0;
}
