/* Professional CSS Variables for Theming */
:root {
    --bg-primary: 17 24 39; /* #111827 */
    --bg-secondary: 31 41 55; /* #1f2937 */
    --bg-tertiary: 55 65 81; /* #374151 */
    --bg-accent: 48 55 66; /* #303742 */
    --bg-tooltip: 55 65 81; /* #374151 */
    --chart-bg-color: rgba(55, 65, 81, 0.3);

    --text-primary: 255 255 255; /* #ffffff */
    --text-secondary: 229 231 235; /* #e5e7eb */
    --text-muted: 209 213 219; /* #d1d5db */
    --text-accent: 96 165 250; /* #60a5fa */
    --text-tooltip: 255 255 255; /* #ffffff */

    --border-primary: 55 65 81; /* #374151 */
    --border-secondary: 75 85 99; /* #4b5563 */
    --border-accent: 68 76 90; /* #444c5a */
    --border-tooltip: 75 85 99; /* #4b5563 */

    --input-bg: 55 65 81; /* #374151 */
    --input-bg-readonly: 75 85 99; /* #4b5563 */
    --input-border: 75 85 99; /* #4b5563 */
    --input-border-readonly: 107 114 128; /* #6b7280 */
    --input-text: 255 255 255; /* #ffffff */
    --input-placeholder: 156 163 175; /* #9ca3af */
    --input-focus-ring: 59 130 246; /* #3b82f6 */
    --input-icon-text: 209 213 219; /* #d1d5db */
    --input-currency-padding: 2rem; /* Left padding for currency inputs to prevent $ symbol overlap */

    --radio-bg: 55 65 81; /* #374151 */
    --radio-border: 107 114 128; /* #6b7280 */
    --radio-checked-accent: 59 130 246; /* #3b82f6 */
    --radio-focus-ring: 96 165 250; /* #60a5fa */

    --slider-track-bg: 75 85 99; /* #4b5563 */
    --slider-thumb-bg: 59 130 246; /* #3b82f6 */
    --slider-thumb-ring: 37 99 235; /* #2563eb */
    
    --button-hover-bg: 55 65 81; /* #374151 */

    --section-title-border: 55 65 81; /* #374151 */
    --section-title-text: 255 255 255; /* #ffffff */

    --result-item-bg: 55 65 81; /* #374151 */
    --result-item-border: 75 85 99; /* #4b5563 */
    --result-label-text: 229 231 235; /* #e5e7eb */
    --result-value-text: 96 165 250; /* #60a5fa */

    --table-header-bg: 48 55 66; /* #303742 */
    --table-header-text: 255 255 255; /* #ffffff */
    --table-body-bg: 31 41 55; /* #1f2937 */
    --table-divide-y: 55 65 81; /* #374151 */
    --table-cell-label-text: 229 231 235; /* #e5e7eb */
    --table-cell-value-text: 255 255 255; /* #ffffff */

    --graph-container-bg: 55 65 81; /* #374151 */
    --graph-container-border: 75 85 99; /* #4b5563 */
    --graph-label-text: 229 231 235; /* #e5e7eb */
    --graph-bar-bg-color: 75 85 99; /* #4b5563 */

    --faq-question-bg-hover: 48 55 66; /* #303742 */
    --faq-answer-bg: 31 41 55; /* #1f2937 */

    --chart-axis-stroke: 156 163 175; /* #9ca3af */
    --chart-tick-stroke: 156 163 175; /* #9ca3af */
    --chart-label-fill: 243 244 246; /* #f3f4f6 */
    --chart-line-cashflow: 59 130 246; /* #3b82f6 */
    --chart-line-cumulative-cf: 16 185 129; /* #10b981 */
    --chart-line-equity: 168 85 247; /* #a855f7 */
    --chart-bar-fixed-fill: 59 130 246; /* #3b82f6 */
    --chart-bar-adjustable-fill: 16 185 129; /* #10b981 */
    --chart-bar-value-fill: 255 255 255; /* #ffffff */

    --btn-primary-start: #3b82f6;
    --btn-primary-end: #2563eb;
    --btn-danger: #dc2626;
    --btn-danger-dark: #b91c1c;
    --btn-warning-start: #f59e0b;
    --btn-warning-end: #d97706;
    
    /* Risk Score Thresholds - used in reports.html template for conditional coloring */
    --risk-score-low-threshold: 35; /* Scores <= 35 are low risk (green) */
    --risk-score-medium-threshold: 65; /* Scores <= 65 are medium risk (yellow), >65 are high risk (red) */
}

/* ------------------------------------------------------------------ */
/* Core Tailwind Utility Bridge                                       */
/* Provides the minimal subset of Tailwind semantics we rely on for   */
/* the Flask-rendered templates without pulling in the entire library */
/* This stays specificity-friendly (no !important) so helpers like     */
/* .hidden can cooperate with conditional class toggles in the UI.     */
/* ------------------------------------------------------------------ */
/* Core Layout Utilities */
.hidden { display: none; }
.flex { display: flex; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.gap-2 { gap: 0.5rem; }
/* Positioning */
.fixed { position: fixed; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.inset-y-0 { top: 0; bottom: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.top-0 { top: 0; }
.bottom-0 { bottom: 0; }
/* Sizing */
.w-64 { width: 16rem; }
.w-full { width: 100%; }
.h-screen { height: 100vh; }
.h-full { height: 100%; }
.max-w-7xl { max-width: 80rem; }
/* Spacing */
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
/* Borders */
.border { border-width: 1px; }
.border-r { border-right-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }
/* Z-index */
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
/* Text */
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; }
.break-all { word-break: break-all; }
/* Responsive utilities */
@media (min-width: 640px) {
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 1024px) {
    .lg\:flex { display: flex; }
    .lg\:hidden { display: none; }
    .lg\:relative { position: relative; }
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* Base Styles */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: rgb(var(--bg-primary));
    color: rgb(var(--text-primary));
    font-family: system-ui, -apple-system, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Utility Classes */
.bg-primary { background-color: rgb(var(--bg-primary)); }
.bg-secondary { background-color: rgb(var(--bg-secondary)); }
.bg-tertiary { background-color: rgb(var(--bg-tertiary)); }
.bg-accent { background-color: rgb(var(--bg-accent)); }

.text-primary { color: rgb(var(--text-primary)); }
.text-secondary { color: rgb(var(--text-secondary)); }
.text-muted { color: rgb(var(--text-muted)); }
.text-accent { color: rgb(var(--text-accent)); }

.border-primary { border-color: rgb(var(--border-primary)); }
.border-secondary { border-color: rgb(var(--border-secondary)); }

.width-zero { width: 0%; }

.icon-button {
    color: rgb(var(--text-secondary));
    transition: all 0.2s ease;
}
.icon-button:hover {
    background-color: rgb(var(--button-hover-bg));
    color: rgb(var(--text-primary));
}

/* ------------------------------------------------------------------ */
/* Layout & Spacing Utility Support                                   */
/* Only includes the utility tokens currently used by templates so    */
/* we can mirror Tailwind semantics without shipping unused classes.  */
/* ------------------------------------------------------------------ */
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-7xl { max-width: 80rem; }

.min-h-screen { min-height: 100vh; }
.min-h-96 { min-height: 24rem; }
.min-w-80 { min-width: 20rem; }
.min-w-full { min-width: 100%; }
.min-w-max { min-width: max-content; }

.w-full { width: 100%; }
.w-1\/3 { width: 33.333%; }
.w-1\/4 { width: 25%; }
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-12 { width: 3rem; }
.w-16 { width: 4rem; }
.w-32 { width: 8rem; }
.w-48 { width: 12rem; }

.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.h-64 { height: 16rem; }
.h-80 { height: 20rem; }

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-4 { padding-bottom: 1rem; }
.pl-6 { padding-left: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-6 > * + * { margin-left: 1.5rem; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.flex-1 { flex: 1 1 0%; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

.grid { display: grid; gap: 1rem; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }

@media (max-width: 768px) {
    .grid:not([class*="grid-cols-"]) {
        grid-template-columns: 1fr;
    }
}
.col-span-full { grid-column: 1 / -1; }

.block { display: block; }
.inline-block { display: inline-block; }

.absolute { position: absolute; }
.relative { position: relative; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.top-0 { top: 0; }
.top-4 { top: 1rem; }
.right-0 { right: 0; }
.right-4 { right: 1rem; }
.right-6 { right: 1.5rem; }
.bottom-6 { bottom: 1.5rem; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

.cursor-pointer { cursor: pointer; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.whitespace-nowrap { white-space: nowrap; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.max-h-\[90vh\] { max-height: 90vh; }

.table-auto { table-layout: auto; }
.table-fixed { table-layout: fixed; }
.border-collapse { border-collapse: collapse; }
.divide-y > * + * { border-top: 1px solid rgb(var(--border-primary)); }
.divide-gray-700 > * + * { border-color: #374151; }

.shadow-sm { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); }
.shadow-lg { box-shadow: 0 20px 35px rgba(0, 0, 0, 0.35); }
.shadow-xl { box-shadow: 0 25px 45px rgba(0, 0, 0, 0.45); }

.rounded { border-radius: 0.25rem; }
.rounded-sm { border-radius: 0.125rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 999px; }
.rounded-t-lg { border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; }
.rounded-b-lg { border-bottom-left-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }

.border { border: 1px solid rgb(var(--border-primary)); }
.border-0 { border-width: 0; }
.border-2 { border-width: 2px; }
.border-t { border-top: 1px solid rgb(var(--border-primary)); }
.border-b { border-bottom: 1px solid rgb(var(--border-primary)); }
.border-b-2 { border-bottom-width: 2px; }
.border-x { border-left: 1px solid rgb(var(--border-primary)); border-right: 1px solid rgb(var(--border-primary)); }
.border-transparent { border-color: transparent; }
.border-primary { border-color: rgb(var(--border-primary)); }
.border-accent { border-color: rgb(var(--text-accent)); }
.border-gray-600 { border-color: #4b5563; }
.border-gray-700 { border-color: #374151; }
.border-blue-500 { border-color: #3b82f6; }
.border-blue-700 { border-color: #1d4ed8; }
.border-green-700 { border-color: #15803d; }
.border-indigo-700 { border-color: #4338ca; }
.border-purple-700 { border-color: #6d28d9; }
.border-red-500 { border-color: #ef4444; }
.border-red-700 { border-color: #b91c1c; }
.border-orange-700 { border-color: #c2410c; }
.border-yellow-700 { border-color: #a16207; }
.border-emerald-500 { border-color: #10b981; }
.border-collapse { border-collapse: collapse; }

.bg-gray-700 { background-color: #374151; }
.bg-gray-800 { background-color: #1f2937; }
.bg-gray-800\/50 { background-color: rgba(31, 41, 55, 0.5); }
.bg-gray-800\/70 { background-color: rgba(31, 41, 55, 0.7); }
.bg-gray-900 { background-color: #111827; }
.bg-gray-900\/40 { background-color: rgba(17, 24, 39, 0.4); }
.bg-blue-900\/20 { background-color: rgba(30, 58, 138, 0.2); }
.bg-blue-900\/30 { background-color: rgba(30, 58, 138, 0.3); }
.bg-blue-950\/40 { background-color: rgba(8, 16, 45, 0.4); }
.bg-emerald-950\/40 { background-color: rgba(2, 44, 34, 0.4); }
.bg-green-500 { background-color: #22c55e; }
.bg-green-900\/30 { background-color: rgba(20, 83, 45, 0.3); }
.bg-indigo-500 { background-color: #6366f1; }
.bg-indigo-900\/30 { background-color: rgba(49, 46, 129, 0.3); }
.bg-orange-500 { background-color: #f97316; }
.bg-orange-900\/30 { background-color: rgba(124, 45, 18, 0.3); }
.bg-purple-500 { background-color: #a855f7; }
.bg-purple-900\/30 { background-color: rgba(88, 28, 135, 0.3); }
.bg-red-500 { background-color: #ef4444; }
.bg-red-900\/30 { background-color: rgba(127, 29, 29, 0.3); }
.bg-red-950\/40 { background-color: rgba(69, 10, 10, 0.4); }
.bg-yellow-500 { background-color: #eab308; }
.bg-yellow-900 { background-color: #713f12; }
.bg-yellow-900\/30 { background-color: rgba(113, 63, 18, 0.3); }
.bg-transparent { background-color: transparent; }
.bg-black { background-color: #000; }
.bg-black.bg-opacity-60 { background-color: rgba(0, 0, 0, 0.6); }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-gray-100 { color: #f3f4f6; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-blue-200 { color: #bfdbfe; }
.text-blue-300 { color: #93c5fd; }
.text-blue-400 { color: #60a5fa; }
.text-blue-500 { color: #3b82f6; }
.text-blue-600 { color: #2563eb; }
.text-green-200 { color: #bbf7d0; }
.text-green-300 { color: #86efac; }
.text-green-500 { color: #22c55e; }
.text-green-600 { color: #16a34a; }
.text-emerald-200 { color: #a7f3d0; }
.text-indigo-200 { color: #c7d2fe; }
.text-indigo-300 { color: #a5b4fc; }
.text-indigo-500 { color: #6366f1; }
.text-orange-200 { color: #fed7aa; }
.text-orange-300 { color: #fdba74; }
.text-orange-500 { color: #f97316; }
.text-orange-600 { color: #ea580c; }
.text-purple-200 { color: #e9d5ff; }
.text-purple-300 { color: #d8b4fe; }
.text-purple-500 { color: #a855f7; }
.text-purple-600 { color: #9333ea; }
.text-red-200 { color: #fecaca; }
.text-red-300 { color: #fca5a5; }
.text-red-400 { color: #f87171; }
.text-red-500 { color: #ef4444; }
.text-yellow-200 { color: #fef08a; }
.text-yellow-300 { color: #fde047; }
.text-yellow-400 { color: #facc15; }
.text-yellow-500 { color: #eab308; }

.transition-all { transition-property: all; transition-duration: 150ms; transition-timing-function: ease-in-out; }
.transition-colors { transition-property: color, background-color, border-color, fill, stroke; transition-duration: 150ms; transition-timing-function: ease-in-out; }
.duration-300 { transition-duration: 300ms; }

.hover\:bg-gray-700\/50:hover { background-color: rgba(55, 65, 81, 0.5); }
.hover\:bg-gray-800:hover { background-color: #1f2937; }
.hover\:bg-red-900\/20:hover { background-color: rgba(124, 10, 45, 0.2); }
.hover\:ring-2:hover { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25); }
.hover\:ring-accent:hover { box-shadow: 0 0 0 2px rgba(var(--text-accent), 0.25); }
.hover\:text-blue-300:hover { color: #93c5fd; }
.hover\:text-gray-200:hover { color: #e5e7eb; }
.hover\:text-primary:hover { color: rgb(var(--text-primary)); }
.hover\:text-red-700:hover { color: #b91c1c; }
.hover\:underline:hover { text-decoration: underline; }

@keyframes util-spin {
    to { transform: rotate(360deg); }
}
.animate-spin { animation: util-spin 1s linear infinite; }

/* Responsive breakpoints: sm 640px, md 768px, lg 1024px */
@media (min-width: 640px) {
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .sm\:flex-row { flex-direction: row; }
    .sm\:items-center { align-items: center; }
}

@media (min-width: 768px) {
    .md\:flex { display: flex; }
    .md\:flex-row { flex-direction: row; }
    .md\:flex-none { flex: none; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .md\:items-center { align-items: center; }
    .md\:justify-between { justify-content: space-between; }
    .md\:hidden { display: none !important; }
    .md\:overflow-visible { overflow: visible; }
    .md\:p-6 { padding: 1.5rem; }
}

@media (min-width: 1024px) {
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .lg\:flex-row { flex-direction: row; }
    .lg\:items-center { align-items: center; }
}
/* Navigation */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    color: rgb(var(--text-secondary));
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}
.nav-link:hover {
    background-color: rgb(var(--button-hover-bg));
    color: rgb(var(--text-primary));
}
.nav-link.active {
    background-color: rgb(var(--text-accent) / 0.1);
    color: rgb(var(--text-accent));
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: rgb(var(--text-secondary));
    text-decoration: none;
    transition: all 0.2s ease;
}
.mobile-nav-link:hover {
    background-color: rgb(var(--button-hover-bg));
    color: rgb(var(--text-primary));
}

/* Application shell ensures sidebar + header behave well on all screens. */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 18rem;
    background-color: rgb(var(--bg-secondary));
    border-right: 1px solid rgb(var(--border-primary));
    overflow-y: auto;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    transform: translateX(0);
}

@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

@media (min-width: 768px) {
    .main-content {
        margin-left: 18rem;
    }
}

.page-scroll {
    flex: 1;
    overflow-y: auto;
}

.page-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

@media (max-width: 768px) {
    .page-content {
        padding: 1.25rem;
    }
}

.sidebar-account {
    padding: 1.5rem 1rem;
    border-top: 1px solid rgb(var(--border-primary));
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-account-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-account-email {
    font-size: 0.875rem;
    color: rgb(var(--text-primary));
    font-weight: 500;
    word-break: break-all;
}

.sidebar-account-tier {
    font-size: 0.75rem;
    color: rgb(var(--text-muted));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-account-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.app-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background-color: rgb(var(--bg-primary));
    border-bottom: 1px solid rgb(var(--border-primary));
    z-index: 30;
    gap: 1rem;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-left {
    gap: 1rem;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: rgb(var(--text-primary));
    margin: 0;
}

.card-icon {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 30;
}

/* Card & Section Styles */
.section-card { 
    background-color: rgb(var(--bg-secondary));
    border: 1px solid rgb(var(--border-primary));
    transition: background-color 0.3s ease, border-color 0.3s ease;
    max-width: 100%;
    margin-bottom: 1.5rem;
}

.auth-page {
    max-width: 28rem;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

@media (min-width: 768px) {
    .auth-page {
        padding: 4rem 2rem 5rem;
    }
}

.auth-card {
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-header {
    text-align: center;
}

.auth-header h2,
.auth-header h1 {
    font-size: 1.75rem;
    color: rgb(var(--text-primary));
    margin-bottom: 0.25rem;
}

.auth-header p {
    color: rgb(var(--text-secondary));
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-links {
    text-align: center;
    color: rgb(var(--text-secondary));
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-links a,
.auth-resend button,
.auth-resend a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover,
.auth-resend button:hover,
.auth-resend a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.auth-resend {
    text-align: center;
    font-size: 0.9rem;
}

.auth-error {
    text-align: center;
}

.form-hint {
    color: rgb(var(--text-secondary));
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

.section-title { 
    color: rgb(var(--section-title-text));
    border-bottom: 1px solid rgb(var(--section-title-border));
    transition: color 0.3s ease, border-color 0.3s ease;
}

.subsection-card { 
    background-color: rgb(var(--bg-accent));
    border: 1px solid rgb(var(--border-accent));
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Shared light/dark surface card for modal/detail panels */
.surface-card {
    border-radius: 0.5rem;
    border: 1px solid rgb(var(--border-primary));
    background-color: rgb(var(--bg-secondary));
    color: rgb(var(--text-primary));
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.subsection-title { 
    color: rgb(var(--text-primary));
    transition: color 0.3s ease;
}
.subsection-title-sm { 
    color: rgb(var(--text-secondary));
    transition: color 0.3s ease;
}

/* Form Styles */
.input-label, .radio-label { 
    display: block;
    color: rgb(var(--text-secondary));
    transition: color 0.3s ease;
    font-weight: 500;
}

.input-icon-text { 
    color: rgb(var(--input-icon-text));
    transition: color 0.3s ease;
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none; /* Prevent interference with input clicks */
}

.form-input { 
    width: 100%;
    padding: 0.625rem 0.75rem;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: all 0.15s ease-in-out;
    font-size: 0.875rem;
    background-color: rgb(var(--input-bg));
    border: 1px solid rgb(var(--input-border));
    color: rgb(var(--input-text));
}
.form-input::placeholder {
    color: rgb(var(--input-placeholder));
    transition: color 0.3s ease;
}
.form-input:focus { 
    box-shadow: 0 0 0 2px rgb(var(--input-focus-ring)); 
    border-color: rgb(var(--input-focus-ring));
}

.form-input-readonly,
.form-input[readonly] { 
    background-color: rgb(var(--input-bg-readonly));
    border-color: rgb(var(--input-border-readonly));
    color: rgb(var(--text-secondary));
    cursor: not-allowed;
}

.form-radio { 
    background-color: rgb(var(--radio-bg));
    border-color: rgb(var(--radio-border));
    color: rgb(var(--radio-checked-accent)); 
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.15s ease-in-out;
}
.form-radio:focus { 
    box-shadow: 0 0 0 2px rgb(var(--radio-focus-ring));
}

.input-group { 
    position: relative;
}

/* Prevent currency symbol overlap with input text - only applies to inputs with currency symbols */
.input-group .input-icon-text + .form-input {
    padding-left: var(--input-currency-padding);
}

/* ===== BUTTON SYSTEM ===== */
/* Shared button primitives keep CTAs consistent across the dashboard. */
.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger,
.btn-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--btn-primary-start) 0%, var(--btn-primary-end) 100%);
    color: #fff;
    border-color: var(--btn-primary-start);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--btn-primary-end) 0%, #1d4ed8 100%);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.25);
    transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
    background-color: rgb(var(--bg-secondary));
    color: rgb(var(--text-primary));
    border-color: rgb(var(--border-primary));
}
.btn-secondary:hover:not(:disabled) {
    background-color: rgb(var(--bg-tertiary));
    border-color: rgb(var(--text-muted));
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    color: rgb(var(--text-primary));
    border-color: rgb(var(--border-primary));
}
.btn-outline:hover:not(:disabled) {
    background-color: rgba(var(--bg-tertiary), 0.5);
    border-color: rgb(var(--text-muted));
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--btn-danger);
    color: #fff;
    border-color: var(--btn-danger);
}
.btn-danger:hover:not(:disabled) {
    background-color: var(--btn-danger-dark);
    transform: translateY(-1px);
}

.btn-warning {
    background-color: var(--btn-warning-start);
    color: #0f172a;
    border-color: var(--btn-warning-start);
}
.btn-warning:hover:not(:disabled) {
    background-color: var(--btn-warning-end);
    color: #0f172a;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: 0.5rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: 0.875rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
}

.btn i[data-lucide] {
    flex-shrink: 0;
}

a, button, input, select, textarea {
    transition: all 0.2s ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Action Button */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    background-color: transparent;
    color: rgb(var(--text-secondary));
    border: none;
    transition: all 0.2s ease;
    cursor: pointer;
}
.action-btn:hover {
    background-color: rgb(var(--button-hover-bg));
    color: rgb(var(--text-primary));
}

/* Slider Styles */
.form-slider {
    width: 100%;
    height: 0.5rem;
    border-radius: 0.5rem;
    appearance: none;
    cursor: pointer;
    background-color: rgb(var(--slider-track-bg));
    transition: background-color 0.3s ease;
}

.form-slider::-webkit-slider-thumb {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    appearance: none;
    margin-top: -0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    background-color: rgb(var(--slider-thumb-bg));
    border: 2px solid rgb(var(--slider-thumb-ring));
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.form-slider::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: none;
    appearance: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    background-color: rgb(var(--slider-thumb-bg));
    border: 2px solid rgb(var(--slider-thumb-ring));
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Results Display Styles */
.results-grid { 
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 2rem 1rem;
}
@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.result-item { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.375rem;
    background-color: rgb(var(--result-item-bg));
    border: 1px solid rgb(var(--result-item-border));
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.result-label { 
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--result-label-text));
    transition: color 0.3s ease;
}

.result-value { 
    font-size: 1.125rem;
    font-weight: 600;
    color: rgb(var(--result-value-text));
    transition: color 0.3s ease;
}

/* Bar Graph Styles */
.graph-container { 
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    background-color: rgb(var(--graph-container-bg));
    border: 1px solid rgb(var(--graph-container-border));
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.graph-label { 
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: rgb(var(--graph-label-text));
    transition: color 0.3s ease;
}
.graph-label span { 
    color: rgb(var(--text-primary)); 
    transition: color 0.3s ease;
}

.graph-bar-bg { 
    width: 100%;
    height: 1.25rem;
    border-radius: 0.375rem;
    overflow: hidden;
    background-color: rgb(var(--graph-bar-bg-color));
    transition: background-color 0.3s ease;
}

.graph-bar { 
    height: 100%;
    border-radius: 0.375rem;
    transition: all 0.3s ease-out;
}

/* Table Styles */
.comparison-table {
    border-collapse: collapse;
}

.table-header-bg {
    background-color: rgb(var(--table-header-bg));
}

.table-header-text {
    color: rgb(var(--table-header-text));
    font-weight: 600;
    text-align: left;
}

.table-body-bg {
    background-color: rgb(var(--table-body-bg));
}

.table-divide-y {
    border-color: rgb(var(--table-divide-y));
}

.table-cell-label-text {
    color: rgb(var(--table-cell-label-text));
}

.table-cell-value-text {
    color: rgb(var(--table-cell-value-text));
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-overlay:not(.hidden) {
    display: flex;
}

.modal-content {
    background-color: rgb(var(--bg-secondary));
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgb(var(--border-primary));
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgb(var(--border-primary));
}

/* Custom Tooltips - fast appearing, styled tooltips */
.custom-tooltip {
    position: relative;
    cursor: help;
}

.custom-tooltip::before,
.custom-tooltip::after {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 1000;
    pointer-events: none;
}

/* Tooltip arrow - default shows BELOW the element */
.custom-tooltip::before {
    content: '';
    border: 6px solid transparent;
    border-bottom-color: rgb(var(--bg-tooltip));
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: -6px;
}

/* Tooltip content - default shows BELOW the element */
.custom-tooltip::after {
    content: attr(data-tooltip);
    background-color: rgb(var(--bg-tooltip));
    color: rgb(var(--text-tooltip));
    border: 1px solid rgb(var(--border-tooltip));
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.4;
    max-width: 280px;
    width: max-content;
    text-align: left;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Tooltip above variant */
.custom-tooltip.tooltip-top::before {
    border-bottom-color: transparent;
    border-top-color: rgb(var(--bg-tooltip));
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: -6px;
}

.custom-tooltip.tooltip-top::after {
    top: auto;
    bottom: calc(100% + 6px);
}

/* Show tooltip on hover - no delay */
.custom-tooltip:hover::before,
.custom-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Position variants */
.custom-tooltip.tooltip-right::before {
    border-bottom-color: transparent;
    border-right-color: rgb(var(--bg-tooltip));
    bottom: auto;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-bottom: 0;
    margin-left: -6px;
}

.custom-tooltip.tooltip-right::after {
    bottom: auto;
    left: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
}

.custom-tooltip.tooltip-left::before {
    border-bottom-color: transparent;
    border-left-color: rgb(var(--bg-tooltip));
    bottom: auto;
    left: auto;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-bottom: 0;
    margin-right: -6px;
}

.custom-tooltip.tooltip-left::after {
    bottom: auto;
    left: auto;
    right: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
}

/* AI Chat Widget */
.ai-chat-button {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background-color: rgb(var(--text-accent));
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}
.ai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.ai-chat-panel {
    position: absolute;
    bottom: 4.5rem;
    right: 0;
    width: 20rem;
    height: 28rem;
    background-color: rgb(var(--bg-secondary));
    border: 1px solid rgb(var(--border-primary));
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    flex-direction: column;
}

.ai-chat-panel:not(.hidden) {
    display: flex;
}

.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgb(var(--border-primary));
}

.ai-chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.ai-message.user {
    align-items: flex-end;
}

.ai-message-content {
    max-width: 80%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.ai-message:not(.user) .ai-message-content {
    background-color: rgb(var(--bg-accent));
    color: rgb(var(--text-primary));
}

.ai-message.user .ai-message-content {
    background-color: rgb(var(--text-accent));
    color: white;
}

.ai-chat-input {
    display: flex;
    padding: 1rem;
    border-top: 1px solid rgb(var(--border-primary));
    gap: 0.5rem;
}

.ai-chat-input input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: rgb(var(--text-primary));
}

.ai-chat-send-button {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    background-color: rgb(var(--text-accent));
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ai-chat-send-button:hover {
    background-color: rgb(37 99 235);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 60;
    align-items: center;
    justify-content: center;
}

.loading-overlay:not(.hidden) {
    display: flex;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background-color: rgb(var(--bg-secondary));
    border-radius: 0.75rem;
    border: 1px solid rgb(var(--border-primary));
}

/* Flash Messages */
.flash-message {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid;
    margin-bottom: 0.5rem;
    transition: opacity 0.3s ease;
}

.flash-success {
    background-color: rgb(220 252 231);
    border-color: rgb(34 197 94);
    color: rgb(21 128 61);
}

.flash-error {
    background-color: rgb(254 226 226);
    border-color: rgb(239 68 68);
    color: rgb(185 28 28);
}

.flash-warning {
    background-color: rgb(255 251 235);
    border-color: rgb(245 158 11);
    color: rgb(146 64 14);
}

.flash-info {
    background-color: rgb(219 234 254);
    border-color: rgb(59 130 246);
    color: rgb(30 64 175);
}

.flash-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
}

/* Dark mode flash messages */
html.dark .flash-success {
    background-color: rgb(20 83 45);
    border-color: rgb(34 197 94);
    color: rgb(187 247 208);
}

html.dark .flash-error {
    background-color: rgb(127 29 29);
    border-color: rgb(239 68 68);
    color: rgb(252 165 165);
}

html.dark .flash-warning {
    background-color: rgb(120 53 15);
    border-color: rgb(245 158 11);
    color: rgb(253 230 138);
}

html.dark .flash-info {
    background-color: rgb(30 58 138);
    border-color: rgb(59 130 246);
    color: rgb(191 219 254);
}

/* Stage and Risk Badges */
.stage-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stage-lead {
    background-color: rgb(255 251 235);
    color: rgb(146 64 14);
}

.stage-analysis {
    background-color: rgb(237 233 254);
    color: rgb(109 40 217);
}

.stage-offers {
    background-color: rgb(255 237 213);
    color: rgb(154 52 18);
}

.stage-due_diligence {
    background-color: rgb(254 226 226);
    color: rgb(185 28 28);
}

.stage-closing {
    background-color: rgb(224 231 255);
    color: rgb(67 56 202);
}

.stage-closed {
    background-color: rgb(220 252 231);
    color: rgb(21 128 61);
}

.risk-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.risk-low {
    background-color: rgb(220 252 231);
    color: rgb(21 128 61);
}

.risk-medium {
    background-color: rgb(255 251 235);
    color: rgb(146 64 14);
}

.risk-high {
    background-color: rgb(254 226 226);
    color: rgb(185 28 28);
}

/* Dark mode badges */
html.dark .stage-lead {
    background-color: rgb(120 53 15);
    color: rgb(253 230 138);
}

html.dark .stage-analysis {
    background-color: rgb(76 29 149);
    color: rgb(221 214 254);
}

html.dark .stage-offers {
    background-color: rgb(124 45 18);
    color: rgb(253 186 116);
}

html.dark .stage-due_diligence {
    background-color: rgb(127 29 29);
    color: rgb(252 165 165);
}

html.dark .stage-closing {
    background-color: rgb(55 48 163);
    color: rgb(199 210 254);
}

html.dark .stage-closed {
    background-color: rgb(20 83 45);
    color: rgb(187 247 208);
}

html.dark .risk-low {
    background-color: rgb(20 83 45);
    color: rgb(187 247 208);
}

html.dark .risk-medium {
    background-color: rgb(120 53 15);
    color: rgb(253 230 138);
}

html.dark .risk-high {
    background-color: rgb(127 29 29);
    color: rgb(252 165 165);
}

/* Kanban Board Styles */
.kanban-board {
    padding-bottom: 1rem;
}

.kanban-column {
    min-width: 20rem;
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-body {
    min-height: 24rem;
    transition: background-color 0.2s ease;
}

.kanban-body.drag-over {
    background-color: rgb(var(--text-accent) / 0.1);
}

.kanban-column {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    flex-shrink: 0;
}

.deal-card {
    cursor: grab;
    transition: all 0.2s ease;
    width: 100%;
}

.deal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.deal-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    cursor: grabbing;
}

/* Summary Cards */
.summary-card {
    background-color: rgb(var(--bg-secondary));
    border: 1px solid rgb(var(--border-primary));
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.summary-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Template Cards */
.template-card {
    transition: all 0.2s ease;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.template-icon {
    margin: 0 auto 1rem;
}

/* Format Badges */
.format-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.format-pdf {
    background-color: rgb(220 38 38 / 0.1);
    color: rgb(220 38 38);
}

.format-excel {
    background-color: rgb(34 197 94 / 0.1);
    color: rgb(34 197 94);
}

/* Progress Bar */
.progress-bar {
    overflow: hidden;
}

.progress-fill {
    transition: width 0.3s ease;
}

/* Dropdown Styles */
.dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background: none;
    border: none;
    color: rgb(var(--text-secondary));
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background-color: rgb(var(--button-hover-bg));
    color: rgb(var(--text-primary));
}

/* Rule Status */
.rule-status {
    font-weight: 600;
    font-size: 0.875rem;
}

.rule-status.pass {
    color: rgb(34 197 94);
}

.rule-status.fail {
    color: rgb(239 68 68);
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    .ai-chat-panel {
        width: calc(100vw - 2rem);
        right: 1rem;
    }
    
    .kanban-column {
        min-width: 16rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgb(var(--bg-tertiary));
}

::-webkit-scrollbar-thumb {
    background: rgb(var(--border-secondary));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgb(var(--text-accent));
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-primary: 0 0 0;
        --border-secondary: 100 100 100;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
.notification-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1050;
}

.notification {
    min-width: 240px;
    max-width: 360px;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: #111827;
    background-color: #e5e7eb;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: opacity 150ms ease, transform 150ms ease;
}

.notification.info {
    background-color: #dbeafe;
    color: #1e3a8a;
}

.notification.success {
    background-color: #d1fae5;
    color: #065f46;
}

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

.notification-hide {
    opacity: 0;
    transform: translateY(-6px);
}

.notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    word-break: break-word;
}

.notification > span {
    flex: 1 1 auto;
}

.notification-dismiss {
    background: transparent;
    border: 0;
    font-size: 1.25rem;
    color: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.notification-dismiss:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

html.dark .notification {
    background-color: #374151;
    color: #f9fafb;
}

html.dark .notification.info {
    background-color: #1e3a8a;
    color: #dbeafe;
}

html.dark .notification.success {
    background-color: #065f46;
    color: #d1fae5;
}

html.dark .notification.error {
    background-color: #991b1b;
    color: #fee2e2;
}

@media (prefers-reduced-motion: reduce) {
    .notification {
        transition: none;
    }
}
