:root {
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --muted: #6c757d;
}

/* Force native checkboxes (Pico CSS v2 override) */
input[type="checkbox"] {
    -webkit-appearance: auto !important;
    appearance: auto !important;
    opacity: 1 !important;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

footer {
    text-align: center;
    padding: 1rem 0;
    color: var(--muted);
}

/* === Tabs === */
.tab-link {
    cursor: pointer;
    text-decoration: none;
    opacity: 0.6;
    font-weight: 500;
}
.tab-link.active {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Status badge === */
#status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
}
.status-idle      { color: var(--muted); }
.status-running   { color: var(--pico-primary-color); font-weight: 600; }
.status-completed { color: var(--success); font-weight: 600; }
.status-error     { color: var(--danger); font-weight: 600; }
.status-stopping  { color: var(--warning); font-weight: 600; }

/* === Current step === */
.current-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f0f6ff;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* === Log container === */
.log-container {
    max-height: 420px;
    overflow-y: auto;
    padding: 1rem;
    background: #1a1a2e;
    border-radius: 8px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.82rem;
    color: #d4d4d4;
}

.log-entry {
    margin: 0.15rem 0;
    line-height: 1.5;
}
.log-entry .ts { color: #606060; margin-right: 0.5rem; }
.log-entry.level-info    { color: #d4d4d4; }
.log-entry.level-success { color: #4ec9b0; }
.log-entry.level-warning { color: #dcdcaa; }
.log-entry.level-error   { color: #f44747; }

.log-placeholder {
    color: #606060;
    font-style: italic;
}

/* === Actions row === */
.actions-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}
.actions-row button { margin-bottom: 0; }

/* === Form group === */
.field-group { margin-bottom: 1rem; }
.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}
.form-row .field-group { margin-bottom: 0; }

/* === Config screen === */
.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.config-header h2 { margin-bottom: 0; }

/* Form cards */
.form-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.15s;
}
.form-card:hover {
    border-color: var(--pico-primary-color);
}
.form-card-info h4 { margin: 0 0 0.25rem 0; }
.form-card-info small { color: var(--muted); }
.form-card-badge {
    background: #e9ecef;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #495057;
    white-space: nowrap;
}

/* Inline add row */
.inline-add {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-top: 0.5rem;
}
.inline-add input { margin-bottom: 0; }
.inline-add button { white-space: nowrap; margin-bottom: 0; }

/* Chip / tag for required columns */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #e9ecef;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
}
.chip button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--danger);
    width: auto;
}

/* Filter card */
.filter-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}
.filter-card .filter-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    margin: 0;
    width: auto;
    line-height: 1;
}
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.filter-grid label { margin-bottom: 0.2rem; font-size: 0.85rem; }
.filter-grid input,
.filter-grid select { margin-bottom: 0; }

/* Action card */
.action-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}
.action-card .action-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    margin: 0;
    width: auto;
    line-height: 1;
}
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}
.action-grid label { margin-bottom: 0.2rem; font-size: 0.85rem; }
.action-grid input,
.action-grid select { margin-bottom: 0; }
.action-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--pico-primary-color, #1095c1);
    color: #fff;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 700;
    margin-right: 0.35rem;
    flex-shrink: 0;
}
.action-card .action-move,
.filter-card .action-move {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    margin: 0;
    width: auto;
    line-height: 1;
    color: var(--muted);
}
.action-card .action-move:hover,
.filter-card .action-move:hover {
    border-color: var(--pico-primary-color, #1095c1);
    color: var(--pico-primary-color, #1095c1);
}
.action-bottom-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.action-bottom-row label {
    font-size: 0.85rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.action-bottom-row input[type="checkbox"] {
    margin-bottom: 0;
    width: auto;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    font-style: italic;
}

/* === Login overlay === */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-overlay[hidden] { display: none; }

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 3rem 2.5rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 90%;
}
.login-box h2 {
    margin-bottom: 0.5rem;
    color: #1a1a2e;
}
.login-box p {
    color: var(--muted);
    margin-bottom: 2rem;
}

.btn-microsoft {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: auto;
}
.btn-microsoft:hover {
    border-color: #0078d4;
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.15);
}
.btn-microsoft:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-error {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* === User info in header === */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.user-info span {
    font-weight: 500;
}
.logout-link {
    font-size: 0.8rem;
    color: var(--muted);
    opacity: 0.8;
}
.logout-link:hover {
    opacity: 1;
}

/* === Role badges (users screen) === */
.role-badge-admin {
    background: #0d6efd !important;
    color: #fff !important;
    font-weight: 600;
}
.role-badge-user {
    background: #e9ecef;
    color: #495057;
}

/* === Profile save status === */
.save-status {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
}
.save-status.level-success {
    background: #d1e7dd;
    color: #0a3622;
}
.save-status.level-error {
    background: #f8d7da;
    color: #58151c;
}

/* === Setup message === */
.setup-message {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: #664d03;
    font-weight: 500;
}
