/* MoneyBot Chat — Vanilla CSS */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6fa;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 28px;
}

/* Disclaimer footer — persistent on every page */
.demo-disclaimer-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 28px;
    z-index: 900;
    background: #f5f0e6;
    color: #6b5c3e;
    font-size: 11px;
    text-align: center;
    line-height: 28px;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.2px;
}

#app {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto repeat(3, 1fr) auto;
    height: 100vh;
    width: 100%;
    background: #f5f6fa;
    gap: 1px;
    overflow: hidden;
}

/* View switcher bar — spans full width */
#view-bar {
    grid-column: 1 / -1;
    grid-row: 1;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 2px;
    height: 36px;
    z-index: 10;
}

/* View bar branding */
.view-bar-brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-right: 16px;
    flex-shrink: 0;
}
.view-bar-brand .brand-name {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1.5px;
}
.view-bar-brand .brand-version {
    font-size: 9px;
    font-weight: 500;
    color: rgba(255,255,255,0.35);
    margin-right: 8px;
}
.view-bar-brand .brand-powered {
    font-family: 'Georgia', serif;
    font-size: 10px;
    font-style: italic;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.3px;
}

#view-bar .view-btn {
    padding: 5px 14px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 4px 4px 0 0;
    background: transparent;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

#view-bar .view-btn:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.06);
}

#view-bar .view-btn.active {
    background: #f5f6fa;
    color: #1a1a2e;
}

#view-bar .view-profile-name {
    margin-left: auto;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}

#view-bar #back-btn {
    margin-left: 8px;
}

/* ================================================================
   Grid Card System
   ================================================================ */
.grid-card {
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.grid-card.hidden {
    display: none;
}

/* Card header */
.card-header {
    display: flex;
    align-items: center;
    padding: 4px 10px 3px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-weight: 600;
    background: #fafbfc;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    min-height: 0;
}

.card-header .card-title {
    flex: 1;
}

.card-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 10px;
    font-size: 12px;
}

/* Minimized bar */
#minimized-bar {
    grid-column: 1 / -1;
    grid-row: 5;
    display: flex;
    gap: 6px;
    padding: 4px 12px;
    background: #e8e8ec;
    min-height: 0;
    align-items: center;
    flex-wrap: wrap;
}
#minimized-bar:empty { display: none; }

.minimized-chip {
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 11px;
    cursor: grab;
    user-select: none;
    white-space: nowrap;
}
.minimized-chip:hover { background: #f0f4ff; border-color: #6c63ff; }

/* Card header with drag handle */
.card-header { cursor: grab; }
.drag-handle {
    width: 14px;
    color: #bbb;
    margin-right: 6px;
    font-size: 14px;
}
.drag-handle::before { content: '\2261'; }

/* Card size dropdown in header */
.card-size-select {
    font-size: 9px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: auto;
    background: #fff;
    color: #666;
    cursor: pointer;
}

/* Drop indicator overlay */
#drop-indicator {
    position: absolute;
    background: rgba(108, 99, 255, 0.15);
    border: 2px dashed #6c63ff;
    border-radius: 4px;
    pointer-events: none;
    z-index: 100;
    display: none;
}

/* Dragging state */
.grid-card.dragging { opacity: 0.4; }

/* View bar: add button, close button, goal dropdown */
.view-add-btn {
    color: rgba(255,255,255,0.5);
    background: none;
    border: 1px dashed rgba(255,255,255,0.3);
    border-radius: 4px;
    font-size: 14px;
    padding: 2px 8px;
    cursor: pointer;
    margin-left: 2px;
}
.view-add-btn:hover { color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.5); }

.view-tab-close {
    font-size: 10px;
    margin-left: 4px;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}
.view-tab-close:hover { color: rgba(255,255,255,0.8); }

#goal-context-select {
    margin-left: 12px;
    font-size: 13px;
    min-width: 180px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: #fff;
    position: relative;
    z-index: 100;
}
#goal-context-select option { color: #333; background: #fff; font-size: 13px; }

/* Profile sidebar (now a grid card) */
#profile-sidebar {
    overflow-y: auto;
    background: #fafbfc;
    padding: 12px;
}

#profile-sidebar:empty {
    display: none;
}

.sidebar-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 1px;
}

.sidebar-archetype {
    font-size: 11px;
    color: #6c63ff;
    font-weight: 500;
    margin-bottom: 8px;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    font-size: 11px;
    color: #444;
}

.sidebar-grid .label {
    color: #888;
}

.sidebar-grid .value {
    font-weight: 500;
    text-align: right;
}

.sidebar-notes {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    font-size: 11px;
    color: #666;
    line-height: 1.5;
    font-style: italic;
}

/* Sidebar transaction history (collapsible) */
.sidebar-transactions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.sidebar-transactions summary {
    cursor: pointer;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-weight: 600;
    padding: 4px 0;
    user-select: none;
}

.sidebar-transactions summary:hover {
    color: #555;
}

.txn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 6px;
}

.txn-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #888;
    font-weight: 600;
    text-align: left;
    padding: 4px 4px;
    border-bottom: 1px solid #e0e0e0;
}

.txn-table th:last-child {
    text-align: right;
}

.txn-table td {
    padding: 3px 4px;
    color: #444;
    border-bottom: 1px solid #f0f0f0;
}

.txn-table td:last-child {
    text-align: right;
    font-weight: 500;
}

.txn-table tr:nth-child(even) {
    background: #f8f9fa;
}

.txn-table tr.txn-rebalance {
    background: #fff8e1;
    font-style: italic;
}

.txn-table tr.txn-rebalance td {
    color: #8d6e00;
    font-size: 10px;
}

.txn-month-header td {
    font-weight: 600;
    color: #1a1a2e;
    padding-top: 8px;
    border-bottom: 1px solid #ddd;
    font-size: 11px;
}

/* Chat column (now a grid card) */
#chat-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

/* Header — hidden in grid mode, replaced by view bar */
header {
    display: none;
}

#session-status {
    font-size: 12px;
    color: #888;
}

#session-status.connected {
    color: #4caf50;
}

/* Chat container */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Messages */
.message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    line-height: 1.4;
    font-size: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user {
    align-self: flex-end;
    background: #1a1a2e;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: #f0f0f5;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
}

.message.system {
    align-self: center;
    background: #fff8e1;
    color: #666;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
}

/* Visualization containers inside messages */
.viz-container {
    margin: 12px 0 4px 0;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.viz-container canvas {
    max-width: 100%;
    max-height: 250px;
}

/* Metric card */
.metric-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 4px;
    min-width: 120px;
}

.metric-card .metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

.metric-card .metric-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    margin-top: 4px;
}

.metric-card .metric-delta {
    font-size: 12px;
    margin-top: 2px;
}

.metric-card .metric-delta.positive { color: #4caf50; }
.metric-card .metric-delta.negative { color: #f44336; }

/* Probability gauge (SVG) */
.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
}

.gauge-container svg {
    max-width: 160px;
}

.gauge-label {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* Typing indicator */
#typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: #888;
    font-size: 13px;
}

#typing-indicator.hidden {
    display: none;
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Tool call progress */
.tool-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 6px;
    font-size: 12px;
    align-self: flex-start;
}

.tool-progress .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #81c784;
    border-top-color: #2e7d32;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Input bar */
#input-bar {
    display: flex;
    padding: 6px 10px;
    gap: 6px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

#message-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}

#message-input:focus {
    border-color: #1a1a2e;
}

#send-btn {
    padding: 6px 14px;
    background: var(--palette-darkest, #0d47a1);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

#send-btn:hover {
    background: var(--palette-darkest, #0d47a1);
    filter: brightness(1.3);
}

#send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Hidden utility */
.hidden { display: none !important; }

/* Profile Selector */
#profile-selector {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
    text-align: center;
}

#profile-selector h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.selector-subtitle {
    color: #888;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Mode Toggle */
#mode-toggle {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
    color: #555;
}

.mode-option:has(input:checked) {
    border-color: #1a1a2e;
    background: #f0f0f5;
    color: #1a1a2e;
    font-weight: 600;
}

.mode-option input[type="radio"] {
    accent-color: #1a1a2e;
}

#profile-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    text-align: left;
}

.profile-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-card:hover {
    border-color: #1a1a2e;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.profile-name {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

.profile-archetype {
    font-size: 13px;
    color: #6c63ff;
    margin: 2px 0 12px 0;
    font-weight: 500;
}

.profile-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    font-size: 12px;
    color: #555;
}

.profile-notes {
    margin-top: 12px;
    font-size: 11px;
    color: #888;
    line-height: 1.4;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

/* Back button */
#back-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 12px;
}

#back-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Dashboard panels in sidebar */
.sidebar-dashboard {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.dash-section {
    margin-bottom: 8px;
}

.dash-gauge {
    display: flex;
    justify-content: center;
    margin: 6px 0 4px 0;
}

.dash-gauge svg {
    max-width: 90px;
}

.dash-gauge-label {
    text-align: center;
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

.dash-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 8px;
    font-size: 11px;
    color: #444;
    margin-top: 6px;
}

.dash-stats .label { color: #888; }
.dash-stats .value { font-weight: 500; text-align: right; }

/* Projection stats 4-column table */
.proj-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 6px;
}
.proj-stats-table td, .proj-stats-table th { padding: 2px 4px; }
.proj-stats-table th { font-size: 9px; text-transform: uppercase; border-bottom: 1px solid #eee; }
.ps-label { color: #888; white-space: nowrap; }
.ps-value { font-weight: 600; color: #333; text-align: right; }
.ps-note { font-size: 9px; color: #aaa; text-align: center; margin-top: 2px; }

.dash-no-target {
    text-align: center;
    font-size: 11px;
    color: #999;
    font-style: italic;
    padding: 8px 0;
}

.dash-donut-wrap {
    display: flex;
    justify-content: center;
}

.dash-donut-wrap canvas {
    max-height: 120px;
}

/* Projection:Total — per-goal grid with donuts */
.total-projection-grid {
    display: grid;
    gap: 6px;
    max-height: 100%;
    overflow-y: auto;
    padding: 2px;
}
.tp-cols-1 { grid-template-columns: 1fr; }
.tp-cols-2 { grid-template-columns: 1fr 1fr; }
.tp-cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.tp-goal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    padding: 6px 4px;
    min-width: 0;
}
.tp-goal-name {
    font-weight: 700;
    font-size: 11px;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.tp-donut-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    min-height: 80px;
}
.tp-donut-wrap canvas {
    max-width: 100%;
    min-height: 80px;
}
/* 1 or 2 goals: big donuts */
.tp-cols-1 .tp-donut-wrap canvas,
.tp-cols-2 .tp-donut-wrap canvas {
    max-height: 180px;
}
/* 4 goals: compact donuts */
.tp-cols-4 .tp-donut-wrap canvas {
    max-height: 100px;
}
.tp-prob {
    font-size: 18px;
    font-weight: 800;
    margin: 2px 0;
}
.tp-cols-4 .tp-prob {
    font-size: 14px;
}
.tp-stats {
    font-size: 10px;
    color: #6c757d;
    line-height: 1.4;
}

/* Single-goal projection donut (Retirement/Goal on its own) */
.tp-donut-single {
    max-width: 220px;
    margin: 0 auto;
    min-height: 160px;
}
.tp-donut-single canvas {
    max-height: 200px;
    min-height: 160px;
}

/* Mobile: stack goals vertically */
@media (max-width: 600px) {
    .total-projection-grid {
        grid-template-columns: 1fr !important;
    }
    .tp-donut-wrap canvas {
        max-height: 160px !important;
    }
}

.dash-account-row {
    display: flex;
    gap: 4px;
    justify-content: space-between;
}

.dash-account {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.dash-account-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #888;
    font-weight: 600;
    margin-bottom: 2px;
}

.dash-account canvas {
    max-height: 80px;
}

.dash-hill-wrap {
    margin-top: 4px;
    flex: 1;
    height: 100%;
}

.dash-hill-wrap canvas {
    max-height: none;
    width: 100%;
    height: 68%;
}

.dash-hill-legend {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 9px;
    margin-top: 4px;
    color: #888;
}

.dash-hill-legend span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.dash-hill-legend .swatch {
    display: inline-block;
    width: 12px;
    height: 3px;
    border-radius: 1px;
}
.dash-hill-legend .swatch-dotted {
    background: transparent;
    height: 0;
    border-top: 2px dotted;
}

/* Changeable Factors */
.cf-section {
    margin-bottom: 8px;
    padding-top: 4px;
    border-top: 1px solid #e0e0e0;
}

.cf-row {
    margin-bottom: 4px;
}

.cf-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.cf-label {
    font-size: 11px;
    color: #888;
    font-weight: 500;
}

.cf-value {
    font-size: 11px;
    font-weight: 600;
    color: #1a1a2e;
}

.cf-slider {
    width: 100%;
    margin: 2px 0;
    -webkit-appearance: none;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
}

.cf-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1a1a2e;
    cursor: pointer;
}

.cf-input {
    width: 90px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    text-align: right;
}

.cf-input:focus {
    border-color: #1a1a2e;
    outline: none;
}

/* 2-column slider grid */
.cf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 12px;
}

.cf-risk-detail {
    font-size: 9px;
    color: #888;
    padding: 2px 6px;
    background: #f8f9fa;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bottom row: risk info + nav + update button */
.cf-bottom-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #eee;
}

.cf-nav {
    display: flex;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
}

.cf-nav button {
    padding: 3px 8px;
    font-size: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}
/* Arrow buttons (undo/redo) get white bg — Reset and Rebalance override below */
.cf-nav button#cf-back-btn,
.cf-nav button#cf-forward-btn {
    background: #fff;
    color: #555;
}

.cf-nav button:hover:not(:disabled) {
    border-color: #1a1a2e;
    color: #1a1a2e;
}

.cf-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cf-nav .cf-reset-text {
    background: var(--palette-darkest, #1a1a2e);
    border: none;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 600;
}
.cf-reset-text:hover {
    filter: brightness(1.2);
}
.cf-reset-text:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cf-nav .rebalance-btn {
    padding: 3px 10px;
    background: var(--palette-lightest, #80deea);
    color: #000;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.rebalance-btn:hover {
    filter: brightness(0.9);
}

.rebalance-btn:disabled {
    background: #ccc;
    color: #999;
    cursor: not-allowed;
}

.cf-updating {
    text-align: center;
    font-size: 10px;
    color: #6c63ff;
    padding: 4px 0;
    font-style: italic;
}

.cf-pension-equiv {
    font-size: 0.85em;
    color: #666;
    text-align: center;
    margin-top: 1px;
}

.cf-savings-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 2px 0;
}
.cf-savings-input-wrap .cf-input {
    width: 80px;
}
.cf-savings-unit {
    font-size: 10px;
    color: #666;
    white-space: nowrap;
}
.cf-savings-split {
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
    line-height: 1.4;
}

.cf-isa-first-label {
    font-size: 10px;
    color: #888;
    font-weight: 400;
    cursor: pointer;
    margin-left: 6px;
}

.cf-isa-first-label input {
    vertical-align: middle;
    margin-right: 2px;
}

/* Question suggestion buttons — above input bar */
#question-bar {
    padding: 0 12px;
}

.question-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 6px 0 4px;
    max-height: 100px;
    overflow: hidden;
}

.question-btn {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 11px;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.question-btn:hover {
    background: #f5f5f5;
    border-color: #999;
    color: #222;
}

.question-btn:active {
    transform: scale(0.97);
}

/* Responsive */
@media (max-width: 900px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .grid-card {
        grid-column: 1 !important;
        grid-row: auto !important;
    }

    #minimized-bar { grid-row: auto; }

    .message {
        max-width: 92%;
    }
}

/* ================================================================
   Portfolio Holdings
   ================================================================ */

.portfolio-section {
    padding: 0;
}

.portfolio-account {
    margin-bottom: 4px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.portfolio-account summary {
    font-size: 11px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    padding: 6px 8px;
    user-select: none;
    background: #fafbfc;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.portfolio-account summary .acct-value {
    font-weight: 700;
    color: #1a1a2e;
    font-size: 11px;
}

.portfolio-account[open] summary {
    border-radius: 4px 4px 0 0;
    border-bottom: 1px solid #eee;
}

.portfolio-table {
    width: 100%;
    font-size: 10px;
    border-collapse: collapse;
    margin: 0;
    table-layout: fixed;
}

.portfolio-table thead th {
    text-align: left;
    font-weight: 600;
    color: #999;
    padding: 3px 6px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.portfolio-table tbody td {
    padding: 2px 6px;
    border-bottom: 1px solid #f8f8f8;
    vertical-align: middle;
    font-size: 10px;
    line-height: 1.3;
}

.portfolio-table tbody tr:hover {
    background: #f8f9ff;
}

.ptf-ticker {
    font-weight: 600;
    color: #333;
    font-family: "SF Mono", "Monaco", "Consolas", monospace;
    font-size: 9px;
    letter-spacing: 0.3px;
}

.ptf-name {
    color: #666;
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ptf-class {
    font-size: 8px;
    color: #999;
    background: #f0f0f0;
    padding: 1px 3px;
    border-radius: 2px;
    display: inline-block;
}

.ptf-pct {
    text-align: right;
    color: #666;
    font-size: 10px;
    font-weight: 500;
}

.ptf-val {
    text-align: right;
    font-weight: 600;
    color: #333;
    font-size: 10px;
}

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

.btn-buy, .btn-sell {
    font-size: 9px;
    padding: 2px 6px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 2px;
    font-weight: 600;
}

.btn-buy {
    background: #e8f5e9;
    color: #2e7d32;
}

.btn-buy:hover {
    background: #c8e6c9;
}

.btn-sell {
    background: #fce4ec;
    color: #c62828;
}

.btn-sell:hover {
    background: #f8bbd0;
}

.portfolio-cash {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 4px;
    font-size: 12px;
}

.portfolio-cash .label {
    font-weight: 600;
    color: #444;
}

.portfolio-cash .value {
    font-weight: 700;
    color: #2e7d32;
}

/* Instrument search */
.instrument-search-wrap {
    position: relative;
    margin-top: 8px;
}

#instrument-search {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

#instrument-search:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124,58,237,0.1);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-dropdown:empty {
    display: none;
}

.search-result {
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 11px;
    align-items: center;
    border-bottom: 1px solid #f5f5f5;
}

.search-result:hover {
    background: #f0f0ff;
}

.sr-symbol {
    font-weight: 700;
    font-family: monospace;
    color: #333;
    min-width: 60px;
}

.sr-name {
    flex: 1;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-class {
    font-size: 9px;
    color: #999;
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 2px;
    white-space: nowrap;
}

.search-result-enhanced {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    font-size: 11px;
    border-bottom: 1px solid #f5f5f5;
}
.search-result-enhanced:hover {
    background: #f0f0ff;
}
.search-result-enhanced .sr-info {
    display: flex;
    gap: 6px;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.search-result-enhanced .sr-held {
    font-size: 9px;
    color: #1a1a2e;
    background: #e8eaf6;
    padding: 1px 4px;
    border-radius: 2px;
    white-space: nowrap;
}
.sr-buttons {
    display: flex;
    gap: 3px;
    margin-left: 6px;
}
.sr-buy, .sr-sell {
    padding: 2px 6px;
    font-size: 9px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    background: #fff;
}
.sr-buy:hover { background: #e8f5e9; border-color: #28a745; }
.sr-sell:hover { background: #ffebee; border-color: #f44336; }

.search-no-results {
    padding: 8px;
    color: #999;
    font-size: 11px;
    text-align: center;
}

/* Trade dialog overlay */
.trade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.trade-dialog {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    width: 320px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.trade-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.trade-name {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
}

.trade-dialog label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    margin: 8px 0 3px;
}

.trade-dialog select,
.trade-dialog input[type="number"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.trade-buttons {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.trade-buttons .btn-confirm {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    background: #7c3aed;
    color: #fff;
}

.trade-buttons .btn-confirm:hover {
    background: #6d28d9;
}

.trade-buttons .btn-confirm:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.trade-buttons .btn-cancel {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    background: #fff;
    color: #666;
}

.trade-buttons .btn-cancel:hover {
    background: #f5f5f5;
}

.trade-holdings {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 10px;
}
.trade-holdings-title {
    font-size: 10px;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.trade-holdings-table {
    width: 100%;
    font-size: 12px;
}
.trade-holdings-table td:first-child {
    color: #6c757d;
    width: 50%;
}
.trade-holdings-table td:last-child {
    font-weight: 600;
    text-align: right;
}
.trade-holdings-table .ret-pos { color: #28a745; }
.trade-holdings-table .ret-neg { color: #dc3545; }
.trade-buy-btn {
    background: #28a745 !important;
}
.trade-buy-btn:hover {
    background: #218838 !important;
}
.trade-sell-btn {
    background: #dc3545 !important;
}
.trade-sell-btn:hover {
    background: #c82333 !important;
}
.sr-not-held {
    font-size: 9px;
    color: #adb5bd;
    margin-left: 6px;
}

/* Total Factors — Monthly Saving Card */
.tf-goal-group {
    padding: 8px 10px;
    margin-bottom: 2px;
    border-left: 3px solid #1a1a2e;
    background: #fafbfc;
    border-radius: 0 4px 4px 0;
}
.tf-goal-group.tf-emergency {
    border-left-color: #9e9e9e;
    background: #f5f5f5;
}
.tf-goal-name {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 2px;
}
.tf-goal-detail {
    font-size: 11px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}
.tf-saving-input {
    width: 72px;
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 11px;
    text-align: right;
    background: #fff;
}
.tf-saving-input:focus {
    border-color: #1a1a2e;
    outline: none;
    box-shadow: 0 0 0 2px rgba(26,26,46,0.08);
}
.tf-total {
    font-size: 12px;
    color: #495057;
    padding: 8px 10px 4px;
    margin-top: 4px;
    border-top: 1px solid #dee2e6;
}
.tf-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding: 0 10px;
    justify-content: flex-end;
}

/* Goal Allocation Card (Total mode — legacy) */
.goal-alloc-cta {
    padding: 12px;
    text-align: center;
}
.goal-alloc-section {
    padding: 4px 0;
}
.goal-alloc-header {
    font-size: 12px;
    color: #495057;
    margin-bottom: 8px;
    padding: 0 2px;
}
.goal-alloc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.goal-alloc-table th {
    text-align: left;
    font-weight: 600;
    color: #6c757d;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 3px 4px;
    border-bottom: 1px solid #dee2e6;
}
.goal-alloc-table td {
    padding: 5px 4px;
    border-bottom: 1px solid #f0f0f0;
}
.goal-alloc-total td {
    border-top: 2px solid #dee2e6;
    border-bottom: none;
    padding-top: 6px;
}
.ga-slider {
    width: 100%;
    height: 4px;
    cursor: pointer;
    accent-color: #1a1a2e;
}
.goal-alloc-buttons {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.ga-btn-alloc {
    flex: 1;
    padding: 6px 8px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    min-width: 140px;
}
.ga-btn-alloc:hover { background: #1557b0; }
.ga-btn-rebal {
    flex: 1;
    padding: 6px 8px;
    background: #ff6d00;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    min-width: 140px;
}
.ga-btn-rebal:hover { background: #e65100; }
.ga-btn-cancel {
    padding: 6px 8px;
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}
.ga-btn-cancel:hover { background: #f5f5f5; }

.trade-error {
    color: #c62828;
    font-size: 11px;
    margin-top: 8px;
    min-height: 14px;
}

/* Profile 4-column table */
.profile-4col {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 4px;
}
.profile-4col td { padding: 2px 6px; }
.p4-label { color: #888; white-space: nowrap; }
.p4-value { font-weight: 500; color: #333; text-align: right; }
.p4-total td { border-top: 1px solid #e0e0e0; padding-top: 4px; }

/* ================================================================
   Goal Detail Styles (used by projection & allocation cards)
   ================================================================ */
.goal-detail-title {
    font-size: 13px; font-weight: 600; color: #1a1a2e;
    margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid #eee;
}

.goal-alloc-summary {
    font-size: 11px; color: #555;
}
.goal-alloc-row {
    display: flex; justify-content: space-between;
    padding: 4px 0; border-bottom: 1px solid #f5f5f5;
}
.goal-alloc-row .label { color: #888; }
.goal-alloc-row .value { font-weight: 500; }

/* ================================================================
   Dashboard card adjustments (when in grid cards)
   ================================================================ */
.card-body .sidebar-dashboard {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.card-body .cf-section {
    margin-bottom: 8px;
    padding-top: 0;
    border-top: none;
}

.card-body .cf-section:first-child {
    border-top: none;
}

/* Compact factor styles for card */
.card-body .sidebar-section {
    margin-bottom: 8px;
}

.card-body .sidebar-transactions {
    margin-top: 8px;
    padding-top: 8px;
}

/* Goal overview in projection card */
.goal-overview-section { margin-top: 12px; }
.goal-overview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}
.goal-overview-row:last-child { border-bottom: none; }
.goal-overview-gauge { width: 40px; height: 40px; flex-shrink: 0; }
.goal-overview-gauge svg { width: 40px; height: 40px; }
.goal-overview-info { flex: 1; min-width: 0; }
.goal-overview-name { font-size: 12px; font-weight: 600; color: #333; }
.goal-overview-target { font-size: 10px; color: #888; }
.goal-overview-pct { font-size: 16px; font-weight: 700; flex-shrink: 0; }

/* Goal-scoped portfolio subtitle */
.goal-portfolio-subtitle {
    font-size: 11px;
    color: #888;
    padding: 2px 0 8px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
}

/* Goal summary table in factors card */
.goal-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 8px;
}
.goal-summary-table th {
    text-align: left;
    font-size: 9px;
    text-transform: uppercase;
    color: #888;
    padding: 4px 6px;
    border-bottom: 1px solid #eee;
}
.goal-summary-table td {
    padding: 6px;
    border-bottom: 1px solid #f5f5f5;
}
.goal-summary-name { font-weight: 600; color: #333; }
.goal-warning { cursor: pointer; font-size: 12px; }
.goal-warning:hover { filter: brightness(1.2); }
.goal-summary-type { font-size: 9px; text-transform: uppercase; color: #999; }

/* Allocation attention banner */
.alloc-attention-banner {
    background: var(--palette-lightest, #80deea);
    color: #000;
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 6px;
    text-align: center;
    font-weight: 600;
}
.alloc-attention-banner .attn-icon {
    font-size: 14px;
    filter: brightness(1.1) saturate(2);
}

/* Goal journey charts */
.goal-journeys-section { margin-top: 8px; }
.goal-journey-mini { margin: 8px 0; }
.goal-journey-label { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 4px; }
.goal-journey-wrap { height: 100%; min-height: 200px; }
.goal-journey-mini canvas { height: 120px !important; }

/* ================================================================
   Goal Modal
   ================================================================ */

.goal-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.goal-modal-card {
    background: #fff;
    border-radius: 8px;
    width: 560px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.goal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.goal-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.goal-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.goal-modal-close:hover { color: #333; }

.goal-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.goal-modal-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.goal-modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.goal-modal-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-weight: 600;
    margin-bottom: 10px;
}

.goal-modal-field {
    margin-bottom: 10px;
}
.goal-modal-field:last-child { margin-bottom: 0; }

.goal-modal-field label {
    display: block;
    font-size: 11px;
    color: #555;
    font-weight: 500;
    margin-bottom: 4px;
}

.gm-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    background: #fff;
    transition: border-color 0.15s;
}
.gm-input:focus {
    border-color: #1a1a2e;
    outline: none;
}

select.gm-input {
    cursor: pointer;
}

/* Prefix/suffix wrappers for currency and percentage */
.gm-input-prefix,
.gm-input-suffix {
    display: flex;
    align-items: center;
    position: relative;
}

.gm-prefix {
    position: absolute;
    left: 10px;
    font-size: 12px;
    color: #888;
    pointer-events: none;
    z-index: 1;
}

.gm-input-with-prefix {
    padding-left: 22px;
}

.gm-suffix {
    position: absolute;
    right: 10px;
    font-size: 12px;
    color: #888;
    pointer-events: none;
    z-index: 1;
}

.gm-input-with-suffix {
    padding-right: 26px;
}

/* Risk slider */
.gm-risk-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gm-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
}

.gm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1a1a2e;
    cursor: pointer;
}

.gm-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1a1a2e;
    cursor: pointer;
    border: none;
}

.gm-risk-label {
    font-size: 11px;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
    min-width: 160px;
}

/* Account funding rows */
.gm-funding-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gm-funding-row {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 8px 10px;
}

.gm-funding-row-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.gm-funding-row-header input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

.gm-funding-row-label {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.gm-funding-row-value {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

.gm-funding-row-inputs {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.gm-funding-row.active .gm-funding-row-inputs {
    display: grid;
}

.gm-funding-input-group label {
    display: block;
    font-size: 10px;
    color: #888;
    margin-bottom: 3px;
}

.gm-funding-input-group .gm-input-suffix {
    display: flex;
    align-items: center;
    position: relative;
}

.gm-funding-input-group input {
    width: 100%;
    padding: 5px 26px 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    color: #333;
}
.gm-funding-input-group input:focus {
    border-color: #1a1a2e;
    outline: none;
}

/* Modal footer */
.goal-modal-footer {
    display: flex;
    gap: 8px;
    padding: 12px 20px 14px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    justify-content: flex-start;
}

.btn-goal-primary {
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    background: #28a745;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-goal-primary:hover { background: #218838; }

.btn-goal-secondary {
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f5f5f5;
    color: #555;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-goal-secondary:hover { background: #e8e8e8; }

/* Goal row action buttons */
.goal-row-actions {
    display: flex;
    gap: 6px;
}

.goal-row-edit {
    font-size: 10px;
    color: #1a73e8;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
}
.goal-row-edit:hover { text-decoration: underline; }

.goal-row-delete {
    font-size: 10px;
    color: #f44336;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
}
.goal-row-delete:hover { text-decoration: underline; }

/* Add Goal button in funding card */
.btn-add-goal {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    background: #28a745;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-add-goal:hover { background: #218838; }

/* Validation error */
.gm-error {
    color: #f44336;
    font-size: 11px;
    margin-top: 4px;
}

.gm-field-error .gm-input,
.gm-field-error input {
    border-color: #f44336;
}

/* Responsive for smaller screens */
@media (max-width: 640px) {
    .goal-modal-card {
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .gm-funding-row-inputs {
        grid-template-columns: 1fr;
    }
    .gm-risk-display {
        flex-direction: column;
        align-items: flex-start;
    }
    .gm-risk-label {
        min-width: auto;
    }
}

/* ---------------------------------------------------------------------------
   Escalation card (guidance mode)
   --------------------------------------------------------------------------- */

.escalation-card {
    margin: 8px 0;
    padding: 12px 14px;
    border: 1.5px solid #e6a817;
    border-radius: 8px;
    background: #fef9e7;
    max-width: 90%;
}

.escalation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #7d6608;
    margin-bottom: 8px;
}

.escalation-header svg {
    flex-shrink: 0;
    color: #b7950b;
}

.escalation-body {
    font-size: 12px;
    color: #333;
    line-height: 1.5;
    margin-bottom: 10px;
}

.escalation-brief-btn {
    font-size: 12px;
    padding: 5px 14px;
    border: 1px solid #b7950b;
    border-radius: 4px;
    background: #fff;
    color: #7d6608;
    cursor: pointer;
    font-weight: 500;
}

.escalation-brief-btn:hover {
    background: #fdf2c5;
}

/* Advisor brief modal */

.advisor-brief-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.advisor-brief-modal {
    background: #fff;
    border-radius: 10px;
    padding: 24px 28px;
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.advisor-brief-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 22px;
    cursor: pointer;
    color: #888;
    line-height: 1;
}

.advisor-brief-close:hover {
    color: #333;
}

.advisor-brief-modal h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #333;
}

.advisor-brief-section {
    margin-bottom: 14px;
}

.advisor-brief-section h4 {
    margin: 0 0 6px;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.advisor-brief-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}

.advisor-brief-table td {
    padding: 3px 8px;
    border-bottom: 1px solid #eee;
}

.advisor-brief-table td:first-child {
    color: #666;
    width: 40%;
}

.advisor-brief-section ul {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
}

.advisor-brief-section p {
    margin: 0;
    font-size: 12px;
    color: #333;
    line-height: 1.5;
}

.advisor-brief-messages {
    font-size: 12px;
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 6px 8px;
}

.advisor-brief-msg {
    margin-bottom: 6px;
    line-height: 1.4;
}

.advisor-brief-msg:last-child {
    margin-bottom: 0;
}

/* What-if indicator — reuses alloc-attention-banner styling via shared class */

/* ── Segment Card ─────────────────────────────────────────── */

.segment-card-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.segment-panel {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 10px;
    background: #fafafa;
}

.segment-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.segment-panel-header strong {
    font-size: 12px;
}

.seg-count {
    font-size: 11px;
    color: #666;
    background: #eee;
    padding: 1px 6px;
    border-radius: 8px;
}

.seg-chars {
    margin: 4px 0;
    padding-left: 16px;
    font-size: 11px;
    color: #555;
}

.seg-chars li {
    margin-bottom: 1px;
}

.seg-suggestion {
    font-size: 11px;
    color: #444;
    margin: 6px 0;
    padding: 4px 8px;
    background: #f0f4ff;
    border-left: 3px solid #4a7adb;
    border-radius: 2px;
}

.seg-suggestion-label {
    font-weight: 600;
    color: #333;
}

.segment-panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.seg-status {
    font-size: 10px;
}

.seg-status-pending {
    color: #999;
}

.seg-status-done {
    color: #2d7d46;
    font-weight: 600;
}

.btn-review-segment {
    padding: 3px 10px;
    font-size: 11px;
    background: #4a7adb;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-review-segment:hover {
    background: #3a6acb;
}

.segment-send-action {
    text-align: right;
    padding: 4px 0;
}

.btn-send-segment {
    padding: 4px 12px;
    font-size: 11px;
    background: #2d7d46;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-send-segment:hover {
    background: #236b38;
}

.segment-toast {
    position: fixed;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #2d7d46;
    color: #fff;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 950;
    pointer-events: none;
}

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