:root {
    --primary: #0ea5e9;
    --primary-glow: rgba(14, 165, 233, 0.2);
    --secondary: #6366f1;
    --accent: #f43f5e;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(51, 65, 85, 0.8);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & layout same as before */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: rgba(15, 23, 42, 0.9);
    border-right: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
}

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

.nav-link.active {
    background: var(--primary-glow);
    color: var(--primary);
}

.main-wrapper {
    margin-left: 260px;
    padding: 2rem 3rem;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header-title h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.header-title p {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
}

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

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    padding: 1.5rem;
    border-radius: 16px;
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--bg-card-hover);
}

.kpi-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    padding: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding-bottom: 0.75rem;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.tab.active {
    color: var(--primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.pipeline-board {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 1.5rem;
}

.kanban-column {
    background: rgba(15, 23, 42, 0.4);
    min-width: 300px;
    max-width: 300px;
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.opportunity-card {
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: grab;
    transition: var(--transition);
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.75rem;
}

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

.modal-content {
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 95%;
    max-width: 900px;
    height: 90vh;
    padding: 2.5rem;
    overflow-y: auto;
}

.drawer {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    height: 100vh;
    background: #1e293b;
    border-left: 1px solid var(--border);
    padding: 2.5rem;
    z-index: 901;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.drawer.open {
    right: 0;
}

.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
}

.accounts-table {
    width: 100%;
    border-collapse: collapse;
}

.accounts-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.accounts-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* AI Scanning & Personal Lines */
.scan-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.3);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.scan-drop-zone:hover,
.scan-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(14, 165, 233, 0.05);
}

.scan-drop-zone .scanning-bar {
    position: absolute;
    top: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary);
    display: none;
}

@keyframes scan-animation {
    0% {
        top: 0;
    }

    100% {
        top: 100%;
    }
}

.scan-drop-zone.is-scanning .scanning-bar {
    display: block;
    animation: scan-animation 2s linear infinite;
}

.scan-drop-zone.is-scanning::after {
    content: "AI ANALYZING POLICY...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.2rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Auth Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    background-image:
        radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.1) 0px, transparent 50%);
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-toggle {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    justify-content: center;
    color: var(--text-muted);
}

.auth-toggle span {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
}

/* Settings View */
.settings-view {
    padding: 2rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.logout-container {
    padding: 1.5rem;
}

.line-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.line-personal {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.line-commercial {
    background: rgba(14, 165, 233, 0.15);
    color: #38bdf8;
}

.aggr-premium-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.aggr-premium-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.aggr-premium-row:last-child {
    margin-bottom: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
}

/* Quote & Compliance UI */
.quote-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.quote-card.is-final {
    border-color: var(--primary);
    background: rgba(14, 165, 233, 0.05);
}

.final-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-bottom-left-radius: 8px;
    text-transform: uppercase;
}

.compliance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

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

.doc-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.renewal-row-urgent {
    border-bottom: 1px solid var(--accent) !important;
}

.status-renewal {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.policy-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.search-bar-container {
    margin-bottom: 2rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 1.25rem;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.search-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    border-radius: 12px;
    padding: 1rem 1rem 1rem 3.5rem;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}