:root {
    /* Color Palette */
    --bg-main: #121110;
    --bg-panel: #1a1916;
    --bg-glass: rgba(26, 25, 22, 0.86);
    --border-light: rgba(236, 232, 220, 0.1);

    --text-main: #e8e1d4;
    --text-muted: #a39b90;
    --text-strong: #f4efe6;

    --accent-primary: #718264;
    --accent-hover: #636c5f;
    --accent-secondary: #ece8dc;
    --accent-soft: rgba(113, 130, 100, 0.16);
    --accent-soft-strong: rgba(113, 130, 100, 0.24);

    --status-green: #718264;
    --status-red: #d17c3f;
    --status-yellow: #877124;

    /* Typography */
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Cormorant Garamond', serif;

    /* Layout */
    --sidebar-width: 260px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    /* Shadows */
    --shadow-card: 0 22px 48px -24px rgba(0, 0, 0, 0.6);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    background-image:
        radial-gradient(circle at 12% 18%, rgba(113, 130, 100, 0.12), transparent 24%),
        radial-gradient(circle at 88% 18%, rgba(236, 232, 220, 0.08), transparent 22%),
        linear-gradient(180deg, #151412 0%, #111110 100%);
    min-height: 100vh;
    overflow: hidden;
}

/* ===================== LAYOUT ===================== */
.app-container { display: flex; height: 100vh; }

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: var(--sidebar-width);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
        var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 10;
}

.logo {
    margin-bottom: 32px;
    padding: 0 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}
.logo img {
    display: block;
    width: 100%;
    max-width: 168px;
}

.nav-links { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    border: 1px solid transparent;
}
.nav-item i { font-size: 17px; width: 20px; text-align: center; color: var(--accent-primary); }
.nav-item:hover { color: var(--text-strong); background: rgba(255,255,255,0.05); }
.nav-item.active {
    color: var(--text-strong);
    background: linear-gradient(90deg, rgba(113,130,100,0.18), transparent);
    border-left: 3px solid var(--accent-primary);
    border-color: rgba(236, 232, 220, 0.06);
}

.sidebar-footer {
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
    margin-top: 24px;
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
    position: relative;
}
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.view-section { display: none; animation: fadeIn 0.35s ease forwards; }
.view-section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.section-header { margin-bottom: 32px; }
.section-header h1 {
    font-family: var(--font-display);
    font-size: 40px;
    line-height: 0.95;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--accent-secondary);
    margin-bottom: 8px;
}
.section-header p  { color: var(--text-muted); font-size: 14px; }

/* ===================== BUTTONS ===================== */
button { font-family: inherit; cursor: pointer; border: none; outline: none; }

.btn-primary {
    background: rgba(113, 130, 100, 0.14);
    color: var(--accent-secondary);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    border: 1px solid rgba(113, 130, 100, 0.48);
    width: 100%;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(0,0,0,0.25);
    background: rgba(113, 130, 100, 0.22);
    border-color: rgba(236, 232, 220, 0.14);
}

.btn-secondary {
    background: var(--bg-panel);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-secondary:hover { background: rgba(255,255,255,0.06); border-color: rgba(113, 130, 100, 0.35); }

.btn-danger {
    background: rgba(239,68,68,0.1);
    color: var(--status-red);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid rgba(239,68,68,0.2);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-danger:hover { background: var(--status-red); color: var(--accent-secondary); }

/* ===================== DASHBOARD ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.stat-card:hover { transform: translateY(-4px); border-color: rgba(113,130,100,0.28); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}

.stat-info h3 {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.stat-info .stat-value {
    font-family: var(--font-display);
    font-size: 40px;
    line-height: 0.95;
    font-weight: 600;
    color: var(--accent-primary);
}

.dashboard-widgets { margin-top: 8px; }

.widget {
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
}
.widget h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-secondary);
    margin-bottom: 20px;
}

.activity-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }

.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s ease;
}
.activity-item:hover { background: rgba(255,255,255,0.04); }

.activity-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.activity-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.activity-info strong { font-size: 14px; color: var(--text-strong); }
.activity-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.activity-multiple { font-size: 14px; font-weight: 600; color: var(--accent-primary); }
.activity-date { font-size: 11px; color: var(--text-muted); }

.empty-state {
    color: var(--text-muted);
    font-size: 14px;
    padding: 24px;
    text-align: center;
    line-height: 1.6;
}

/* ===================== KANBAN PIPELINE ===================== */
.kanban-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: calc(100vh - 175px);
}
.kanban-board::-webkit-scrollbar { height: 8px; }
.kanban-board::-webkit-scrollbar-track { background: var(--bg-main); }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

.kanban-column {
    background: rgba(26,29,45,0.45);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    min-width: 290px;
    width: 290px;
    display: flex;
    flex-direction: column;
}

.column-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.column-header h3 {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.stage-label { display: flex; align-items: center; gap: 7px; }
.column-header .count {
    background: rgba(255,255,255,0.12);
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.stage-desc {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.4;
}

/* Stage accent colors */
.stage-researching { border-top: 3px solid var(--accent-secondary); }
.stage-talks       { border-top: 3px solid var(--status-yellow); }
.stage-review      { border-top: 3px solid var(--accent-primary); }
.stage-closed      { border-top: 3px solid #8f887c; }

.kanban-cards {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 60px;
}

.empty-column {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 24px 12px;
    border: 1px dashed rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
}

.deal-card {
    background: var(--bg-panel);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}
.deal-card:active { cursor: grabbing; }
.deal-card:hover { border-color: var(--accent-primary); transform: translateY(-2px); }

.deal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.deal-card-title { font-weight: 600; color: var(--text-strong); font-size: 14px; line-height: 1.4; }

.deal-card-actions { display: flex; gap: 8px; flex-shrink: 0; }
.deal-card-actions i { color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 4px; transition: color 0.2s; }
.deal-card-actions i.edit-btn:hover  { color: var(--accent-primary); }
.deal-card-actions i.delete-btn:hover { color: var(--status-red); }

.deal-card-metric {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.deal-card-metric span:last-child { color: var(--text-strong); font-weight: 500; }

.deal-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent-primary);
    margin-top: 10px;
}

.kanban-column.drag-over {
    background: rgba(113,130,100,0.08);
    border-style: dashed;
    border-color: var(--accent-primary);
}

/* ===================== FORMS ===================== */
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-group { margin-bottom: 18px; }

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 7px;
    font-weight: 500;
}

.required { color: var(--status-red); }

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: rgba(113,130,100,0.18);
    color: var(--accent-secondary);
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    flex-shrink: 0;
}

.field-help {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.4;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(0,0,0,0.22);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 11px 15px;
    color: var(--text-strong);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(113,130,100,0.08);
}
.form-group select option { background: #1a1916; color: var(--text-strong); }

/* ===================== MODAL ===================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
    background: var(--bg-panel);
    width: 100%;
    max-width: 620px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 {
    font-size: 28px;
    line-height: 1;
    color: var(--accent-secondary);
    font-family: var(--font-display);
    font-weight: 600;
}

.close-modal { background: transparent; color: var(--text-muted); font-size: 20px; }
.close-modal:hover { color: var(--accent-secondary); }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.modal-footer button { width: auto; padding: 10px 24px; }

/* ===================== 3-WAY EVALUATOR ===================== */
.compare-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.compare-input-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.biz-card-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.biz-1 { background: linear-gradient(135deg, rgba(236,232,220,0.18), rgba(236,232,220,0.03)); border-bottom: 1px solid rgba(236,232,220,0.12); }
.biz-2 { background: linear-gradient(135deg, rgba(113,130,100,0.24), rgba(113,130,100,0.06)); border-bottom: 1px solid rgba(113,130,100,0.18); }
.biz-3 { background: linear-gradient(135deg, rgba(135,113,36,0.24), rgba(135,113,36,0.05)); border-bottom: 1px solid rgba(135,113,36,0.18); }

.biz-name-input {
    background: transparent !important;
    border: none !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--text-strong) !important;
    padding: 0 !important;
    flex: 1;
}
.biz-name-input:focus { outline: none !important; background: rgba(255,255,255,0.05) !important; }

.compare-input-card .form-group { padding: 0 20px; }
.compare-input-card .form-group:last-child { padding-bottom: 18px; }
.compare-source-group { margin-bottom: 14px; }
.compare-source-group label {
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-size: 11px;
}

/* Results Table */
.compare-results-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-top: 4px;
}
.compare-results-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-secondary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.compare-table-wrap { overflow-x: auto; }

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.compare-table th {
    padding: 14px 20px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-strong);
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid var(--border-light);
}
.compare-table th.metric-label-col {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
}

.compare-table td {
    padding: 14px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-weight: 500;
    color: var(--text-strong);
    transition: background 0.2s ease;
}
.compare-table td.metric-label {
    text-align: left;
    color: var(--text-muted);
    font-weight: 400;
    font-size: 13px;
}
.metric-hint {
    display: block;
    font-size: 11px;
    color: rgba(163,155,144,0.75);
    margin-top: 2px;
    font-style: italic;
}

.compare-table tr:last-child td { border-bottom: none; }

.highlight-row td { background: rgba(113,130,100,0.05); }
.verdict-row td   { background: rgba(255,255,255,0.02); font-weight: 700; }

/* Best / worst cell highlights */
.cell-best  { color: var(--accent-primary) !important; background: rgba(113,130,100,0.12) !important; }
.cell-worst { color: var(--status-red) !important; background: rgba(209,124,63,0.1) !important; }

/* Winner column highlight */
.winner-col { background: rgba(113,130,100,0.08) !important; }
.compare-table th.winner-col { background: rgba(113,130,100,0.18) !important; color: var(--accent-secondary); }

/* Verdict cells */
.verdict-good    { color: var(--accent-primary); }
.verdict-warn    { color: var(--status-yellow); }
.verdict-bad     { color: var(--status-red); }
.verdict-neutral { color: var(--text-muted); }

/* Winner Banner */
.winner-banner {
    margin-top: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(113,130,100,0.16), rgba(236,232,220,0.06));
    border: 1px solid rgba(113,130,100,0.26);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1.5;
}
.winner-banner i { font-size: 22px; color: var(--status-yellow); flex-shrink: 0; }

/* Next Steps Guidance */
.next-steps-card {
    margin-top: 20px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(113,130,100,0.1), rgba(236,232,220,0.03));
    border: 1px solid rgba(113,130,100,0.2);
    border-radius: var(--radius-lg);
}
.next-steps-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.next-steps-summary {
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 14px;
}
.next-steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}
.next-steps-list li {
    position: relative;
    padding-left: 18px;
    color: var(--text-main);
    font-size: 13px;
    line-height: 1.5;
}
.next-steps-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-primary);
}
.next-steps-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    font-size: 12px;
}
.next-steps-footer strong {
    color: var(--accent-secondary);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

/* ===================== DATA MANAGEMENT ===================== */
.data-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.data-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
}

.data-card-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.data-card h3 {
    color: var(--accent-secondary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.data-card p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.data-card.danger-zone { border-color: rgba(209,124,63,0.3); }

.stat-icon-accent,
.data-card-icon-accent {
    color: var(--accent-primary);
    background: var(--accent-soft);
}

.data-card-icon-soft {
    color: var(--accent-secondary);
    background: rgba(236, 232, 220, 0.1);
}

.data-card-icon-danger {
    color: var(--status-red);
    background: rgba(209,124,63,0.12);
}

/* ===================== SCROLLBAR ===================== */
.kanban-cards::-webkit-scrollbar { width: 4px; }
.kanban-cards::-webkit-scrollbar-track { background: transparent; }
.kanban-cards::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
