:root {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --ink: #1f2937;
    --muted: #64748b;
    --border: #dbe3ed;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --good: #15803d;
    --warn: #b45309;
    --bad: #b91c1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
}

.login-shell,
.console-shell {
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: 18px 16px 26px;
}

.brand {
    color: #334155;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.panel-body {
    padding: 14px;
}

.login-panel {
    max-width: 520px;
    margin: 30px auto 0;
    padding: 22px;
}

h1,
h2,
h3 {
    margin: 0;
}

h1 {
    font-size: 30px;
    line-height: 1.12;
}

h2 {
    font-size: 19px;
}

h3 {
    font-size: 14px;
}

p {
    margin: 0;
    color: var(--muted);
    line-height: 1.4;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--ink);
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 14px;
}

textarea {
    resize: vertical;
    min-height: 72px;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: 2px solid rgba(37, 99, 235, 0.3);
    outline-offset: 1px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    background: var(--accent);
    cursor: pointer;
}

.btn:hover:not(:disabled) {
    background: var(--accent-strong);
}

.btn-inline {
    padding: 8px 10px;
    font-size: 12px;
}

.btn-muted {
    background: #64748b;
}

.btn-warning {
    background: #b45309;
}

.btn-danger {
    background: #b91c1c;
}

.alert {
    margin-top: 12px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.field-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.console-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.console-top p {
    margin-top: 5px;
}

.console-version {
    margin-top: 4px;
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.compact-label {
    font-size: 11px;
    color: #475569;
    margin: 0 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.compact-select {
    width: auto;
    min-width: 74px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 7px;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 0 10px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.chip.good {
    color: #166534;
    border-color: #86efac;
    background: #f0fdf4;
}

.chip.warn {
    color: #92400e;
    border-color: #fcd34d;
    background: #fffbeb;
}

.chip.bad {
    color: #991b1b;
    border-color: #fca5a5;
    background: #fef2f2;
}

.signout-form {
    margin: 0;
}

.signout-form .btn {
    padding: 8px 10px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.panel-header p {
    margin-top: 4px;
    font-size: 13px;
}

.form-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.metrics-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.metric {
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel-soft);
    padding: 12px;
}

.metric .label {
    display: block;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric .value {
    display: block;
    margin-top: 7px;
    font-size: 26px;
    line-height: 1;
    font-weight: 700;
    color: #0f172a;
}

.metric .sub {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.queue-meter {
    margin-top: 10px;
    display: flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    height: 10px;
    overflow: hidden;
    background: #f1f5f9;
}

.queue-meter span {
    display: block;
    height: 100%;
    min-width: 0;
    transition: width 0.2s ease;
}

.meter-queued {
    background: #64748b;
}

.meter-processing {
    background: #0369a1;
}

.meter-failed {
    background: #b91c1c;
}

.meter-done {
    background: #16a34a;
}

.activity-panel {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel-soft);
    padding: 10px;
}

.activity-panel h3 {
    margin-bottom: 8px;
    color: #334155;
}

.activity-log {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
}

.activity-log li {
    padding: 7px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #ffffff;
    font-size: 12px;
    color: #334155;
}

.activity-log li.info {
    border-color: #bfdbfe;
}

.activity-log li.success {
    border-color: #86efac;
}

.activity-log li.error {
    border-color: #fecaca;
}

.dashboard-grid {
    margin-top: 12px;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}

.stack {
    display: grid;
    gap: 12px;
}

.action-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-grid-seed {
    margin-bottom: 10px;
}

.workspace-note {
    margin-bottom: 10px;
}

.form-block {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px;
    background: #ffffff;
}

.form-block-wide {
    grid-column: 1 / -1;
}

.form-block h3 {
    margin-bottom: 8px;
}

.form-row {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row.single {
    grid-template-columns: 1fr;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    text-align: left;
    padding: 9px 8px;
    vertical-align: top;
    border-bottom: 1px solid #e2e8f0;
}

th {
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ffffff;
    background: #64748b;
}

.badge.active {
    background: #15803d;
}

.badge.paused {
    background: #b45309;
}

.badge.disabled {
    background: #6b7280;
}

.badge.failed {
    background: #b91c1c;
}

.badge.processing {
    background: #0369a1;
}

.badge.queued {
    background: #475569;
}

.recipe-grid {
    margin-top: 10px;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.recipe-card {
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
    background: #ffffff;
    display: grid;
    grid-template-rows: 120px auto;
}

.recipe-card .thumb {
    background: #e2e8f0;
    background-size: cover;
    background-position: center;
}

.recipe-card .body {
    padding: 9px;
    display: grid;
    gap: 6px;
}

.recipe-card .title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.32;
}

.recipe-card .meta {
    color: #64748b;
    font-size: 11px;
}

.recipe-card .snippet {
    color: #334155;
    font-size: 12px;
    line-height: 1.35;
    min-height: 34px;
}

.recipe-card a {
    color: #1d4ed8;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

.empty {
    padding: 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #64748b;
    background: #f8fafc;
    text-align: center;
    font-size: 13px;
}

.muted {
    color: var(--muted);
}

.queue-summary {
    margin: 10px 0 8px;
}

.queue-url {
    display: inline-block;
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.worker-loop-status {
    margin-top: 8px;
}

.toast-stack {
    position: fixed;
    right: 14px;
    bottom: 14px;
    display: grid;
    gap: 8px;
    z-index: 90;
    max-width: 360px;
}

.toast {
    padding: 10px 12px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

.toast.info {
    background: #0369a1;
}

.toast.success {
    background: #15803d;
}

.toast.error {
    background: #b91c1c;
}

.action-feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 16px;
}

.action-feedback-modal[hidden] {
    display: none;
}

.action-feedback-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.action-feedback-card {
    position: relative;
    width: min(520px, 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.35);
    padding: 18px;
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    align-items: center;
}

.action-feedback-spinner {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 4px solid #dbeafe;
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

.action-feedback-copy h3 {
    margin: 0;
    font-size: 18px;
    color: #0f172a;
}

.action-feedback-copy p {
    margin-top: 6px;
}

.action-feedback-actions {
    margin-top: 10px;
}

.action-feedback-actions .btn {
    min-width: 84px;
}

body.action-modal-open {
    overflow: hidden;
}

.check-row {
    margin-top: 10px;
}

.seed-action-row {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    letter-spacing: normal;
    text-transform: none;
}

.checkbox input {
    width: auto;
    margin: 0;
}

.seed-results {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.seed-results-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.seed-candidate-pick {
    width: auto;
    margin: 0;
}

.seed-summary {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
    padding: 9px 10px;
    color: #334155;
    font-size: 12px;
    line-height: 1.4;
}

@media (max-width: 1160px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .action-grid,
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .console-shell {
        padding: 12px 10px 18px;
    }

    .console-top {
        flex-direction: column;
        align-items: stretch;
    }

    .status-row {
        justify-content: flex-start;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
