/* ============================================
   CRM - Xipe Technology Inspired Dark Theme
   ============================================ */

:root {
    --blue: #4f6ef7;
    --blue-light: #6b84ff;
    --blue-dim: #3a56e8;
    --blue-glow: rgba(79, 110, 247, 0.35);
    --white: #ffffff;
    --gray: #9ca3af;
    --dark-bg: #0a0c14;
    --dark-surface: #0f1120;
    --dark-card: #141628;
    --dark-card-border: rgba(255, 255, 255, 0.08);
    --dark-hover: rgba(255, 255, 255, 0.04);
    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);
    --input-bg: rgba(255, 255, 255, 0.06);
    --input-border: rgba(255, 255, 255, 0.12);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 260px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

a {
    color: var(--blue-light);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--blue);
}

/* ============ LAYOUT ============ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #080a12 0%, #0a0c14 100%);
    border-right: 1px solid var(--dark-card-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--dark-card-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: #0d1340;
    font-family: 'Space Grotesk', sans-serif;
}

.sidebar-brand h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    margin: 0;
}

.sidebar-brand small {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 16px 12px 8px;
    font-family: 'Inter', sans-serif;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--dark-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(79, 110, 247, 0.12);
    color: var(--blue-light);
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* ============ MAIN CONTENT ============ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-bar {
    height: 64px;
    background: rgba(10, 12, 20, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--dark-card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 {
    font-size: 20px;
    font-weight: 700;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-content {
    padding: 32px;
}

/* ============ CARDS ============ */

.card {
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.card-glow:hover {
    box-shadow: 0 0 24px var(--blue-glow), 0 0 8px rgba(107, 132, 255, 0.15);
    border-color: rgba(79, 110, 247, 0.3);
}

/* ============ KPI CARDS ============ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    opacity: 0;
    transition: opacity 0.3s;
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.12);
}

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

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.kpi-icon.blue { background: rgba(79, 110, 247, 0.15); color: var(--blue-light); }
.kpi-icon.green { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.kpi-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.kpi-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.kpi-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.kpi-sub {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============ GRID LAYOUTS ============ */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

/* ============ DATA TABLE ============ */

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--dark-card-border);
    text-align: left;
    font-family: 'Inter', sans-serif;
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 14px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--dark-hover);
}

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

/* ============ BADGES / PILLS ============ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-blue { background: rgba(79, 110, 247, 0.15); color: var(--blue-light); }
.badge-green { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-orange { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-gray { background: rgba(156, 163, 175, 0.15); color: var(--gray); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

/* ============ BUTTONS ============ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    color: #0d1340;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--blue-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--dark-card-border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--blue);
    color: var(--blue-light);
    background: rgba(79, 110, 247, 0.08);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--dark-card-border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--blue);
    color: var(--blue-light);
    background: rgba(79, 110, 247, 0.08);
}

/* ============ FORMS ============ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

select.form-control option {
    background: var(--dark-card);
    color: var(--text-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

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

/* ============ SEARCHABLE SELECT ============ */

.searchable-select {
    position: relative;
}

.searchable-select .search-bar input {
    padding-right: 36px;
}

.searchable-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    z-index: 2;
}

.searchable-clear:hover {
    color: var(--text-primary);
}

.searchable-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-card-border);
    border-radius: var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.15s ease;
}

.searchable-option {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.searchable-option:last-child {
    border-bottom: none;
}

.searchable-option:hover {
    background: rgba(79, 110, 247, 0.1);
    color: var(--text-primary);
}

/* ============ MODAL ============ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--dark-surface);
    border: 1px solid var(--dark-card-border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 0;
}

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

.modal-body {
    padding: 24px 28px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 28px 24px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ PIPELINE ============ */

.pipeline {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.pipeline-column {
    min-width: 280px;
    flex: 1;
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.pipeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--dark-card-border);
}

.pipeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.pipeline-count {
    font-size: 12px;
    font-weight: 600;
    background: rgba(79, 110, 247, 0.15);
    color: var(--blue-light);
    padding: 2px 10px;
    border-radius: 100px;
}

.pipeline-card {
    background: var(--dark-surface);
    border: 1px solid var(--dark-card-border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.pipeline-card:hover {
    border-color: rgba(79, 110, 247, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pipeline-card[draggable="true"] {
    cursor: grab;
}

.pipeline-card[draggable="true"]:active {
    cursor: grabbing;
}

.pipeline-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

.pipeline-column.drop-target {
    background: rgba(79, 110, 247, 0.08);
    border: 1px dashed var(--blue);
    box-shadow: inset 0 0 20px rgba(79, 110, 247, 0.05);
}

.pipeline-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.pipeline-card-company {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.pipeline-card-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--blue-light);
}

.pipeline-total {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid var(--dark-card-border);
    margin-top: 8px;
    text-align: right;
}

/* ============ ACTIVITY LIST ============ */

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-icon.call { background: rgba(79, 110, 247, 0.15); color: var(--blue-light); }
.activity-icon.email { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.activity-icon.meeting { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.activity-icon.task { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.activity-icon.note { background: rgba(156, 163, 175, 0.15); color: var(--gray); }

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-subject {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.activity-subject.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.activity-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============ CHART BAR (CSS-only) ============ */

.chart-bar-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-bar-label {
    width: 100px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.chart-bar-track {
    flex: 1;
    height: 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    min-width: fit-content;
    transition: width 0.6s ease;
}

.chart-bar-value {
    font-size: 12px;
    font-weight: 600;
    color: #0d1340;
    white-space: nowrap;
}

/* ============ SEARCH BAR ============ */

.search-bar {
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.search-bar input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.15);
}

/* ============ EMPTY STATE ============ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

/* ============ LOADING ============ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--dark-card-border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============ AVATAR ============ */

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #0d1340;
    flex-shrink: 0;
    font-family: 'Space Grotesk', sans-serif;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 900px) {
    .sidebar {
        width: 64px;
        overflow: hidden;
    }

    .sidebar-brand h2,
    .sidebar-brand small,
    .nav-section-title,
    .nav-item span {
        display: none;
    }

    .sidebar-brand {
        justify-content: center;
        padding: 16px 8px;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .main-content {
        margin-left: 64px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .pipeline {
        flex-direction: column;
    }

    .pipeline-column {
        min-width: auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 20px;
    }
}

/* ============ SCROLLBAR ============ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============ UTILITY ============ */

.text-blue { color: var(--blue-light); }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-orange { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }

/* Form validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success);
}

.invalid {
    outline: 1px solid var(--danger);
}

.validation-message {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: white;
    border-radius: var(--radius-sm);
    margin: 16px;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ============ AUTH LAYOUT ============ */

.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg);
    position: relative;
    overflow: hidden;
}

.auth-layout:has(.proposal-viewer) {
    display: block;
    overflow: visible;
}

.auth-layout::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(79, 110, 247, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.auth-layout::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(107, 132, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.auth-card {
    background: var(--dark-surface);
    border: 1px solid var(--dark-card-border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.4s ease;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

.auth-brand .brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: #0d1340;
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: 12px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-layout .search-bar input {
    background: var(--input-bg);
}

/* ============ USER MENU ============ */

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--dark-hover);
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-email {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============ PROPOSAL VIEWER (public) ============ */

.proposal-viewer {
    width: 100%;
    padding: 0;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.proposal-code-form {
    max-width: 420px;
    margin: 60px auto 0;
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 0 80px rgba(79, 110, 247, 0.06);
}

.proposal-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.secure-badge {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(79, 110, 247, 0.15), rgba(107, 132, 255, 0.08));
    border: 1px solid rgba(79, 110, 247, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--blue-light);
}

.secure-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--dark-bg);
    border: 1px solid var(--dark-card-border);
    border-radius: 10px;
    padding: 4px 14px;
    transition: border-color 0.2s;
}

.secure-input-wrap:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.secure-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--blue-light);
    font-family: 'Space Grotesk', monospace;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-align: center;
    padding: 10px 0;
}

.secure-input::placeholder {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 2px;
    font-weight: 400;
}

.secure-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--danger);
    font-size: 13px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 8px;
}

/* Security verification animation */
.secure-verify {
    max-width: 400px;
    margin: 80px auto 0;
    text-align: center;
}

.secure-shield {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 32px;
}

.shield-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--blue-light);
    z-index: 2;
}

.shield-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
}

.shield-ring.ring-1 {
    border-top-color: var(--blue);
    animation: secureRotate 1.2s linear infinite;
}

.shield-ring.ring-2 {
    inset: 8px;
    border-right-color: rgba(107, 132, 255, 0.5);
    animation: secureRotate 1.8s linear infinite reverse;
}

.shield-ring.ring-3 {
    inset: 16px;
    border-bottom-color: rgba(79, 110, 247, 0.3);
    animation: secureRotate 2.4s linear infinite;
}

@keyframes secureRotate {
    to { transform: rotate(360deg); }
}

.secure-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
    text-align: left;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.secure-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.3s;
}

.secure-step.done {
    color: var(--blue-light);
}

.secure-step.done i {
    color: var(--success);
}

.secure-bar-track {
    height: 3px;
    background: var(--dark-card-border);
    border-radius: 3px;
    overflow: hidden;
    max-width: 280px;
    margin: 0 auto;
}

.secure-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.proposal-container {
    animation: fadeIn 0.3s ease;
    padding: 20px 32px;
}

.proposal-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: 12px;
}

.proposal-content-frame {
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: 12px;
    overflow: hidden;
    padding: 24px;
}

.proposal-markdown {
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 14px;
}

.proposal-markdown h1,
.proposal-markdown h2,
.proposal-markdown h3,
.proposal-markdown h4 {
    color: var(--text-primary);
    font-weight: 700;
    margin: 24px 0 12px;
}

.proposal-markdown h2 {
    font-size: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--dark-card-border);
}

.proposal-markdown h3 {
    font-size: 16px;
}

.proposal-markdown p {
    margin: 0 0 12px;
}

.proposal-markdown ul,
.proposal-markdown ol {
    margin: 0 0 12px;
    padding-left: 24px;
}

.proposal-markdown li {
    margin-bottom: 4px;
}

.proposal-markdown strong {
    color: var(--text-primary);
    font-weight: 600;
}

.proposal-markdown em {
    color: var(--text-secondary);
}

.proposal-markdown code {
    background: var(--dark-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    color: var(--blue-light);
}

.proposal-markdown pre {
    background: var(--dark-bg);
    border: 1px solid var(--dark-card-border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 0 0 16px;
}

.proposal-markdown pre code {
    background: none;
    padding: 0;
}

.proposal-markdown blockquote {
    border-left: 3px solid var(--blue);
    margin: 0 0 12px;
    padding: 8px 16px;
    color: var(--text-secondary);
    background: rgba(79, 110, 247, 0.04);
    border-radius: 0 6px 6px 0;
}

.proposal-markdown hr {
    border: none;
    border-top: 1px solid var(--dark-card-border);
    margin: 20px 0;
}

.proposal-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}

.proposal-markdown thead {
    background: var(--dark-bg);
}

.proposal-markdown th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--dark-card-border);
    white-space: nowrap;
}

.proposal-markdown td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--dark-card-border);
    color: var(--text-secondary);
}

.proposal-markdown tbody tr:hover {
    background: rgba(79, 110, 247, 0.04);
}

.proposal-markdown img {
    max-width: 100%;
    border-radius: 8px;
}

.proposal-markdown a {
    color: var(--blue-light);
    text-decoration: none;
}

.proposal-markdown a:hover {
    text-decoration: underline;
}

.proposal-markdown input[type="checkbox"] {
    margin-right: 6px;
}

.proposal-md-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: start;
}

.proposal-toc {
    position: sticky;
    top: 76px;
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: 12px;
    padding: 16px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
}

.proposal-toc-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--dark-card-border);
}

.proposal-toc-link {
    display: block;
    padding: 6px 10px;
    margin: 2px 0;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}

.proposal-toc-link:hover {
    background: rgba(79, 110, 247, 0.08);
    color: var(--text-primary);
}

.proposal-toc-link.active {
    background: rgba(79, 110, 247, 0.12);
    color: var(--blue-light);
    font-weight: 600;
}

.proposal-md-content {
    min-width: 0;
}

.proposal-action-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(17, 19, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--dark-card-border);
    padding: 0 24px;
}

.proposal-action-bar-inner {
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 56px;
}

/* Thanks screen */
.proposal-thanks {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    animation: fadeIn 0.5s ease;
}

.thanks-card {
    max-width: 480px;
    width: 100%;
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: 20px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 0 100px rgba(79, 110, 247, 0.06);
}

.thanks-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}

.thanks-icon.thanks-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 2px solid rgba(34, 197, 94, 0.2);
}

.thanks-icon.thanks-info {
    background: rgba(79, 110, 247, 0.1);
    color: var(--blue-light);
    border: 2px solid rgba(79, 110, 247, 0.2);
}

.thanks-card h2 {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 12px;
}

.thanks-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.thanks-divider {
    height: 1px;
    background: var(--dark-card-border);
    margin: 28px 0;
}

.thanks-footer {
    color: var(--text-muted);
    font-size: 12px;
}

.project-card {
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--blue) !important;
}

.recurrence-toggle {
    display: flex;
    gap: 8px;
}

/* Cash Flow */
.flow-summary-card {
    padding: 20px !important;
    border-left: 3px solid var(--dark-card-border);
}

.flow-summary-card.flow-income { border-left-color: var(--success); }
.flow-summary-card.flow-outcome { border-left-color: var(--danger); }
.flow-summary-card.flow-positive { border-left-color: var(--blue); }
.flow-summary-card.flow-negative { border-left-color: var(--danger); }
.flow-summary-card.flow-neutral { border-left-color: var(--text-muted); }

.flow-card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.flow-card-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: 8px;
}

.flow-card-detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.flow-chart-wrap {
    position: relative;
    overflow-x: auto;
}

.flow-cumulative-svg {
    position: absolute;
    top: 0;
    left: 0;
    height: 180px;
    pointer-events: none;
    z-index: 2;
}

.flow-chart {
    display: flex;
    align-items: flex-end;
    gap: 0;
    height: 260px;
    padding: 0;
    position: relative;
    z-index: 1;
}

.flow-chart-month {
    width: 60px;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flow-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 180px;
    margin-bottom: 8px;
}

.flow-bar {
    width: 18px;
    border-radius: 4px 4px 0 0;
    transition: opacity 0.2s;
    min-height: 2px;
}

.flow-bar:hover {
    opacity: 0.8;
}

.flow-bar-income {
    background: linear-gradient(180deg, var(--success), rgba(34, 197, 94, 0.6));
}

.flow-bar-outcome {
    background: linear-gradient(180deg, var(--danger), rgba(239, 68, 68, 0.6));
}

.flow-chart-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.flow-chart-margin {
    font-size: 11px;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
}

.flow-chart-margin.positive { color: var(--success); }
.flow-chart-margin.negative { color: var(--danger); }

.flow-chart-cumulative {
    font-size: 10px;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    margin-top: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(79, 110, 247, 0.1);
}

.flow-chart-cumulative.positive { color: var(--blue-light); }
.flow-chart-cumulative.negative { color: var(--danger); background: rgba(239, 68, 68, 0.08); }

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-line {
    width: 14px;
    height: 2.5px;
    border-radius: 2px;
}

.active-filter {
    background: rgba(79, 110, 247, 0.12) !important;
    color: var(--blue-light) !important;
    border-color: var(--blue) !important;
}

.row-skipped {
    opacity: 0.45;
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}

.row-skipped td {
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}

.row-skipped .btn-icon {
    text-decoration: none;
    opacity: 1;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--dark-bg);
    border: 1px solid var(--dark-card-border);
    border-radius: 10px;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.attachment-card:hover {
    border-color: var(--blue);
    background: rgba(79, 110, 247, 0.06);
}

.attachment-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(79, 110, 247, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--blue-light);
    flex-shrink: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
