:root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow: 0 10px 35px rgba(15, 23, 42, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

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

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

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

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.form-card {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

h1, h2, h3 {
    margin-top: 0;
}

.muted {
    color: var(--muted);
    font-size: 0.92rem;
}

.stack {
    display: grid;
    gap: 16px;
}

.grid-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 13px;
    font: inherit;
    outline: none;
    background: #fff;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button:hover {
    background: #f9fafb;
}

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

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

.button-small {
    padding: 7px 10px;
    font-size: 0.9rem;
}

.alert {
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

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

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th, td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 0.92rem;
}

th {
    color: #374151;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f9fafb;
}

.center {
    text-align: center;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.8rem;
    font-weight: 800;
}

.badge-queued {
    background: #f3f4f6;
    color: #374151;
}

.badge-running {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-failed {
    background: #fee2e2;
    color: #b91c1c;
}

.ns-list {
    display: grid;
    gap: 3px;
}

.actions {
    display: flex;
    gap: 8px;
}

.toast-container {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 10px;
    z-index: 50;
}

.toast {
    min-width: 280px;
    max-width: 440px;
    background: #111827;
    color: #fff;
    padding: 13px 15px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: slide-in 0.2s ease-out;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.modal-card {
    position: relative;
    width: min(900px, calc(100% - 32px));
    max-height: calc(100vh - 64px);
    overflow: auto;
    margin: 32px auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

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

pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #0f172a;
    color: #e5e7eb;
    padding: 14px;
    border-radius: 12px;
    overflow-x: auto;
}

.detail-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 14px;
    margin-bottom: 16px;
}

.detail-grid strong {
    color: #374151;
}

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

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

    .section-header {
        flex-direction: column;
    }
}