* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6f8;
    color: #1f2937;
    line-height: 1.5;
}

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 380px;
}

.brand-large {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.login-card label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #374151;
}

.login-card input {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}

.login-card input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

/* ---------- Topbar ---------- */
.topbar {
    background: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.brand {
    font-weight: 700;
    font-size: 1.125rem;
}

.userinfo {
    color: #6b7280;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

form.inline { display: inline; }

.link-btn {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.link-btn:hover { text-decoration: underline; }

/* ---------- Dashboard layout ---------- */
.dashboard {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #374151;
}

.muted { color: #6b7280; font-size: 0.875rem; }

/* ---------- Status / progress ---------- */
.status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.status-label {
    color: #6b7280;
    font-size: 0.875rem;
}

.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge.idle      { background: #e5e7eb; color: #4b5563; }
.badge.running   { background: #dbeafe; color: #1e40af; }
.badge.completed { background: #d1fae5; color: #065f46; }
.badge.failed    { background: #fee2e2; color: #991b1b; }

.elapsed {
    margin-left: auto;
    color: #6b7280;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.progress-bar {
    flex: 1;
    background: #e5e7eb;
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.options-row {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 0.2rem;
    cursor: pointer;
    width: 1rem;
    height: 1rem;
}

.checkbox-label input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.checkbox-label small {
    display: block;
    color: #6b7280;
    margin-top: 0.125rem;
    font-size: 0.8125rem;
}

.actions {
    display: flex;
    gap: 0.75rem;
}

/* ---------- Buttons ---------- */
button.primary, button.danger {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

button.block { width: 100%; }

button.primary { background: #2563eb; color: white; }
button.primary:hover:not(:disabled) { background: #1d4ed8; }
button.primary:disabled { background: #9ca3af; cursor: not-allowed; }

button.danger { background: #ef4444; color: white; }
button.danger:hover:not(:disabled) { background: #dc2626; }
button.danger:disabled { background: #fca5a5; cursor: not-allowed; }

/* ---------- Pre-flight ---------- */
.issues-list {
    list-style: none;
    margin-top: 0.75rem;
}

.issues-list li {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.375rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #78350f;
}

/* ---------- Candidate table ---------- */
table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
}

table th {
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

tr.empty td {
    text-align: center;
    color: #9ca3af;
    padding: 2rem;
}

tr.active-row { background: #eff6ff; }

.row-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.row-status.waiting    { background: #f3f4f6; color: #6b7280; }
.row-status.todo       { background: #ede9fe; color: #5b21b6; }
.row-status.processing { background: #dbeafe; color: #1e40af; }
.row-status.completed  { background: #d1fae5; color: #065f46; }
.row-status.fail       { background: #fee2e2; color: #991b1b; }
.row-status.no-doc     { background: #fed7aa; color: #9a3412; }
.row-status.on-hold    { background: #fef3c7; color: #92400e; }
.row-status.max-limit  { background: #fef3c7; color: #92400e; }

/* ---------- VNC iframe (production deploy only) ---------- */
.vnc-card { padding: 0; }
.vnc-card h2 { padding: 1.5rem 1.5rem 0.75rem; }

.vnc-wrap {
    width: 100%;
    height: 75vh;
    min-height: 480px;
    background: #1f2937;
    overflow: hidden;
}

.vnc-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.vnc-hint {
    padding: 0.75rem 1.5rem 1.25rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ---------- Logs ---------- */
.logs {
    background: #1f2937;
    color: #d1d5db;
    padding: 1rem;
    border-radius: 6px;
    height: 320px;
    overflow-y: auto;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 0.8125rem;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* ---------- Utility ---------- */
.hidden { display: none; }
