/* DebtPulse - Styles */
:root {
    --bg: #080f2c;
    --surface: #0f1a3a;
    --border: #1a2a52;
    --primary: #667eea;
    --primary-hover: #5a6fd6;
    --text: #e2e8f0;
    --text-dim: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    text-decoration: none;
}

.header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.header-nav {
    display: flex;
    gap: 4px;
}

.header-nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.header-nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.header-nav-link.active { color: var(--text); background: rgba(255,255,255,0.08); }

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.role-tag {
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(102, 126, 234, 0.15);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn:hover { background: rgba(255,255,255,0.05); }
.btn-sm { padding: 6px 10px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-full { width: 100%; }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: var(--success); }
.alert-danger { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--danger); }
.alert-warning { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: var(--warning); }

/* Login */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    color: #fff;
}

.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box .subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }

.login-box input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}

.login-box input:focus { border-color: var(--primary); }

.login-box .btn { margin-top: 8px; }

.login-error {
    display: none;
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: left;
}

.login-error.visible { display: block; }

/* OTP inputs (login) */
.otp-inputs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.otp-digit {
    width: 44px; height: 52px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color 0.15s;
}

.otp-digit:focus { border-color: var(--primary); }

.mfa-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s;
}

.btn-link:hover { color: var(--primary); }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h2 { margin-bottom: 0; }

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

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
}

.card-body {
    padding: 20px;
}

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}

.data-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.actions-cell {
    white-space: nowrap;
    text-align: right;
}

.actions-cell .btn { margin-left: 4px; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-active { background: rgba(16,185,129,0.15); color: var(--success); }
.status-pending { background: rgba(245,158,11,0.15); color: var(--warning); }
.status-disabled { background: rgba(239,68,68,0.15); color: var(--danger); }

/* MFA badges */
.mfa-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.mfa-email { background: rgba(102,126,234,0.15); color: var(--primary); }
.mfa-totp { background: rgba(16,185,129,0.15); color: var(--success); }
.mfa-none { background: rgba(255,255,255,0.06); color: var(--text-dim); }

/* Role tags */
.role-user {
    background: rgba(255,255,255,0.06);
    color: var(--text-dim);
}

/* Danger ghost btn */
.btn-danger-ghost { color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Form elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus { border-color: var(--primary); }

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2000;
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.warning { background: var(--warning); color: #1a1a2e; }

/* Settings cards */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
}

.settings-card-header svg { color: var(--text-dim); }

.settings-card-body { padding: 20px; }

.settings-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Form row */
.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group { flex: 1; }

/* Wizard dots */
.wizard-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.wizard-dots .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.wizard-dots .dot.active { background: var(--primary); width: 24px; border-radius: 4px; }
.wizard-dots .dot.done { background: var(--success); }

/* MFA choice buttons */
.mfa-choice {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    margin-bottom: 10px;
    transition: all 0.15s;
}

.mfa-choice:hover { border-color: var(--primary); background: rgba(102,126,234,0.05); }
.mfa-choice strong { display: block; font-size: 14px; margin-bottom: 2px; }
.mfa-choice span { display: block; font-size: 12px; color: var(--text-dim); }

/* QR container */
.qr-container {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

/* TOTP secret */
.totp-secret {
    text-align: center;
    margin-bottom: 8px;
}

.totp-secret code {
    display: block;
    margin-top: 8px;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    letter-spacing: 2px;
    word-break: break-all;
    color: var(--primary);
}

/* Password strength */
.pw-strength {
    margin-bottom: 12px;
}

.pw-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.pw-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}

/* Recovery codes */
.recovery-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 20px 0;
}

.recovery-code {
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    text-align: center;
    letter-spacing: 1px;
    color: var(--primary);
}

.recovery-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-card.stat-highlight { border-color: var(--primary); }
.stat-card.stat-danger { border-color: var(--danger); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card.stat-highlight .stat-value { color: var(--primary); }
.stat-card.stat-danger .stat-value { color: var(--danger); }

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 500;
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

/* Stage bars (dashboard) */
.stage-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stage-bar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.stage-bar-row:last-child { border-bottom: none; }

.stage-bar-label {
    font-size: 13px;
    color: var(--text-dim);
}

.stage-bar-value {
    font-size: 14px;
    font-weight: 600;
}

.badge-danger-inline { color: var(--danger); }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-dim { background: rgba(255,255,255,0.06); color: var(--text-dim); }

/* Stage select (inline in table) */
.stage-select {
    padding: 4px 28px 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color 0.15s;
}

.stage-select:hover { border-color: var(--text-dim); }
.stage-select:focus { border-color: var(--primary); }
.stage-select.stage-herinnering_1 { border-color: rgba(245,158,11,0.4); color: var(--warning); }
.stage-select.stage-herinnering_2 { border-color: rgba(245,158,11,0.5); color: var(--warning); }
.stage-select.stage-herinnering_3 { border-color: rgba(239,68,68,0.4); color: var(--danger); }
.stage-select.stage-incasso { border-color: rgba(239,68,68,0.5); color: var(--danger); }

/* Notes button */
.btn-notes {
    position: relative;
    padding: 6px 8px;
    border: 1px solid transparent;
}

.btn-notes:hover { border-color: var(--border); }

.notes-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

/* Filters bar */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.filters-bar .form-input {
    max-width: 260px;
}

.filters-bar select.form-input {
    max-width: 180px;
}

/* Table container */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

/* Empty state */
.empty-state {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 16px !important;
}

/* Text helpers */
.text-dim { color: var(--text-dim); }
.text-small { font-size: 11px; }

/* Page header actions */
.page-header-actions {
    display: flex;
    gap: 8px;
}

/* Sync button animation */
.syncing svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Toggle label */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px !important;
    color: var(--text) !important;
}

.toggle-label input[type="checkbox"] {
    width: 38px;
    height: 20px;
    border-radius: 10px;
    appearance: none;
    background: var(--border);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-label input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: all 0.2s;
}

.toggle-label input[type="checkbox"]:checked {
    background: var(--primary);
}

.toggle-label input[type="checkbox"]:checked::after {
    left: 20px;
    background: #fff;
}

/* Input with copy button */
.input-with-copy {
    display: flex;
    gap: 8px;
}

.input-with-copy .form-input {
    flex: 1;
}

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
}

/* Typography */
h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
p { line-height: 1.6; }

/* Responsive */
@media (max-width: 768px) {
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .settings-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .header-nav { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; }
    .filters-bar .form-input,
    .filters-bar select.form-input { max-width: 100%; }
}
