/* Overview dashboard layout */
.overview-summary-shell {
    overflow: hidden;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.overview-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid #E5E7EB;
}

.overview-kpi-card {
    min-height: 132px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #FFFFFF;
}

.overview-kpi-card + .overview-kpi-card {
    border-left: 1px solid #E5E7EB;
}

.overview-kpi-value {
    margin-top: 4px;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
}

.overview-chart-panel {
    min-height: 430px;
    padding: 28px 28px 24px;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
}

.cashflow-chart-toggle {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    background: #F9FAFB;
}

.cashflow-chart-toggle-btn {
    min-width: 48px;
    border: 0;
    border-radius: 999px;
    padding: 6px 10px;
    background: transparent;
    color: #64748B;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.cashflow-chart-toggle-btn.is-active {
    background: #FFFFFF;
    color: #111827;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.cashflow-chart {
    display: flex;
    min-height: 334px;
    flex: 1;
    flex-direction: column;
}

.cashflow-chart-loading {
    display: flex;
    min-height: 260px;
    align-items: center;
    justify-content: center;
    border: 1px dashed #E5E7EB;
    border-radius: 12px;
    color: #94A3B8;
    font-size: 12px;
    font-weight: 600;
}

.cashflow-chart-stage,
.cashflow-line-stage {
    position: relative;
    min-height: 304px;
    flex: 1;
    border-bottom: 1px solid #F3F4F6;
}

.cashflow-axis {
    position: absolute;
    inset: 0 0 0 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #9CA3AF;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
    font-size: 10px;
    pointer-events: none;
}

.cashflow-axis > div {
    position: relative;
    border-bottom: 1px solid #E5E7EB;
}

.cashflow-axis > div:last-child {
    border-bottom-style: solid;
}

.cashflow-axis span {
    position: absolute;
    top: -8px;
    left: 0;
    padding-right: 8px;
    background: #FFFFFF;
}

.cashflow-scroll {
    position: absolute;
    inset: 0 0 0 92px;
    z-index: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.cashflow-scroll::-webkit-scrollbar {
    display: none;
}

.cashflow-line-track {
    position: relative;
    height: 100%;
    min-width: 100%;
    box-sizing: border-box;
}

.cashflow-bars {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100%;
    min-width: 100%;
    box-sizing: border-box;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 28px 12px 8px 12px;
}

.cashflow-bar-group {
    display: flex;
    width: 100%;
    max-width: 92px;
    min-width: 32px;
    height: 100%;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
}

.cashflow-bar {
    width: 26%;
    min-width: 8px;
    border-radius: 6px 6px 0 0;
    transition: height 180ms ease, opacity 150ms ease;
}

.cashflow-bar-revenue {
    background: #4ADE80;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.16);
}

.cashflow-bar-spend {
    background: #D1D5DB;
}

.cashflow-bar-budget {
    background: transparent;
    border: 2px dashed #F97316;
    border-bottom: 0;
}

.cashflow-bar-budget.is-empty {
    border-color: transparent;
}

.cashflow-line-svg {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 304px;
    overflow: visible;
}

.cashflow-line {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cashflow-line-revenue {
    stroke: #16A34A;
}

.cashflow-line-spend {
    stroke: #64748B;
}

.cashflow-point {
    stroke: #FFFFFF;
    stroke-width: 2;
}

.cashflow-point-revenue {
    fill: #22C55E;
}

.cashflow-point-spend {
    fill: #9CA3AF;
}

.cashflow-line-hover-zones {
    position: absolute;
    inset: 28px 12px 8px 12px;
    z-index: 2;
    overflow: hidden;
    pointer-events: auto;
}

.cashflow-line-hover-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 48px;
    transform: translateX(-50%);
}

.cashflow-labels-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-left: 92px;
    scrollbar-width: thin;
}

.cashflow-labels-scroll::-webkit-scrollbar {
    height: 6px;
}

.cashflow-labels-scroll::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 999px;
}

.cashflow-labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    min-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px 0 12px;
    color: #64748B;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.cashflow-labels span {
    width: 100%;
    max-width: 92px;
    min-width: 32px;
    text-align: center;
}

.overview-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 0.85fr);
    gap: 24px;
    align-items: stretch;
}

.overview-ledger-panel,
.overview-brain-panel {
    min-height: 460px;
}

.overview-brain-panel {
    position: relative;
    border-radius: 12px;
}

.dashboard-period-controls {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    background: #F9FAFB;
}

.dashboard-period-btn {
    border: 0;
    border-radius: 999px;
    padding: 7px 11px;
    background: transparent;
    color: #64748B;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    white-space: nowrap;
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.dashboard-period-btn.is-active {
    background: #0B0F19;
    color: #FFFFFF;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
}

.dashboard-main-topbar {
    min-height: 72px;
    height: auto;
    gap: 16px;
}

.dashboard-topbar-left {
    min-width: 0;
}

.dashboard-topbar-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dashboard-topbar-title {
    color: #111827;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.dashboard-topbar-subtitle {
    margin: 4px 0 0;
    color: #6B7280;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 600;
}

.dashboard-topbar-period {
    flex-shrink: 0;
}

.overview-command-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: -2px;
}

.overview-command-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    padding: 20px;
}

.overview-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.overview-section-kicker {
    color: #9CA3AF;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.overview-section-heading h3 {
    margin-top: 2px;
    color: #111827;
    font-size: 16px;
    font-weight: 700;
}

.overview-section-link,
.overview-link-row a,
.overview-link-row button {
    color: #EA580C;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.overview-link-row button {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.overview-card-loading,
.overview-empty-copy {
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: center;
    border: 1px dashed #E5E7EB;
    border-radius: 10px;
    color: #94A3B8;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.overview-section-content {
    display: block;
    width: 100%;
    min-width: 0;
}

.overview-metric-grid {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.overview-metric-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-metric-tile {
    min-width: 0;
    border: 1px solid #EEF2F7;
    border-radius: 10px;
    background: #F9FAFB;
    padding: 12px;
}

.overview-metric-tile.is-emphasis {
    background: #FFFFFF;
    border-color: #E5E7EB;
}

.overview-metric-tile span,
.overview-metric-tile small {
    display: block;
    color: #64748B;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.35;
}

.overview-metric-tile strong {
    display: block;
    margin-top: 6px;
    color: #111827;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.overview-inline-note {
    margin-top: 12px;
    border-left: 2px solid #E5E7EB;
    padding-left: 10px;
    color: #64748B;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.55;
}

.overview-risk-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    border-radius: 999px;
    border: 1px solid #E5E7EB;
    padding: 5px 10px;
    color: #64748B;
    background: #F9FAFB;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.overview-risk-pill.is-low {
    border-color: #BBF7D0;
    color: #15803D;
    background: #F0FDF4;
}

.overview-risk-pill.is-watch {
    border-color: #FED7AA;
    color: #C2410C;
    background: #FFFFFF;
}

.overview-risk-pill.is-high {
    border-color: #FECACA;
    color: #B91C1C;
    background: #FEF2F2;
}

.overview-money-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-width: 0;
    padding: 10px 0;
    border-bottom: 1px solid #F3F4F6;
    color: #64748B;
    font-size: 13px;
    font-weight: 600;
}

.overview-money-row strong {
    flex-shrink: 0;
    color: #111827;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
    font-size: 13px;
    text-align: right;
    white-space: nowrap;
}

.overview-money-row.is-total {
    border-bottom: 0;
    color: #111827;
}

.overview-limitation {
    max-width: 58ch;
    margin-top: 12px;
    color: #64748B;
    font-size: 12px;
    line-height: 1.5;
}

.overview-link-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}

.overview-mini-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.overview-mini-metrics > div {
    min-width: 0;
    border: 1px solid #F3F4F6;
    border-radius: 10px;
    padding: 12px;
    background: #F9FAFB;
}

.overview-mini-metrics span,
.overview-mini-metrics small {
    display: block;
    color: #64748B;
    font-size: 11px;
    font-weight: 700;
}

.overview-mini-metrics strong {
    display: block;
    margin: 4px 0;
    color: #111827;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
    font-size: 14px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.overview-attention-list,
.overview-upcoming-list {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 10px;
}

.overview-attention-item,
.overview-upcoming-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-width: 0;
    border: 1px solid #EEF2F7;
    border-radius: 9px;
    padding: 12px 14px;
    background: #FFFFFF;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.overview-attention-item:hover,
.overview-upcoming-item:hover {
    border-color: #E5E7EB;
    background: #F9FAFB;
}

.overview-attention-item strong,
.overview-upcoming-item strong {
    display: block;
    color: #111827;
    font-size: 13px;
    font-weight: 800;
}

.overview-row-main,
.overview-attention-item > div,
.overview-upcoming-item > div {
    min-width: 0;
}

.overview-row-main p,
.overview-row-main small {
    max-width: 78ch;
}

.overview-attention-item p,
.overview-upcoming-item small {
    display: block;
    margin-top: 3px;
    color: #64748B;
    font-size: 12px;
    line-height: 1.45;
}

.overview-attention-item span,
.overview-upcoming-item span {
    flex-shrink: 0;
    color: #EA580C;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.overview-row-side {
    flex-shrink: 0;
    min-width: 132px;
    text-align: right;
}

.overview-row-side strong {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
}

.overview-row-side small {
    display: block;
}

.overview-ai-note {
    width: 100%;
    border: 1px solid #E5E7EB;
    border-left: 3px solid #EA580C;
    border-radius: 10px;
    padding: 14px;
    background: #FFFFFF;
}

.overview-ai-note p {
    color: #111827;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.55;
}

.overview-ai-fact {
    width: 100%;
    border: 1px solid #F3F4F6;
    border-radius: 10px;
    padding: 12px;
    background: #F9FAFB;
}

.overview-ai-fact span {
    display: block;
    color: #9CA3AF;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.overview-ai-fact strong {
    display: block;
    margin-top: 4px;
    color: #111827;
    font-size: 12px;
    line-height: 1.5;
}

.overview-ai-cta {
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 11px 12px;
    background: #EA580C;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 800;
    transition: background-color 150ms ease, transform 150ms ease;
}

.overview-ai-cta:hover {
    background: #D94E0B;
}

.overview-ai-cta:active {
    transform: scale(0.98);
}

@media (max-width: 1180px) {
    .overview-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-kpi-card:nth-child(odd) {
        border-left: 0;
    }

    .overview-kpi-card:nth-child(n + 3) {
        border-top: 1px solid #E5E7EB;
    }

    .overview-lower-grid {
        grid-template-columns: 1fr;
    }

    .overview-command-grid {
        grid-template-columns: 1fr;
    }

    .overview-ledger-panel,
    .overview-brain-panel {
        min-height: 0;
    }
}

@media (max-width: 640px) {
    .dashboard-page #sidebar {
        display: none !important;
    }

    .overview-summary-shell {
        border-radius: 12px;
    }

    .overview-kpi-grid {
        display: block;
    }

    .overview-kpi-card {
        min-height: 112px;
        padding: 18px 20px;
        border-left: 0 !important;
    }

    .overview-kpi-card + .overview-kpi-card {
        border-top: 1px solid #E5E7EB;
    }

    .overview-kpi-value {
        font-size: 22px;
    }

    .overview-chart-panel {
        min-height: 340px;
        padding: 20px;
    }

    .cashflow-scroll {
        inset: 0 0 0 76px;
    }

    .cashflow-labels-scroll {
        padding-left: 76px;
    }

    .cashflow-bars,
    .cashflow-labels {
        gap: 8px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .cashflow-bar-group,
    .cashflow-labels span {
        min-width: 28px;
    }

    .cashflow-bar {
        min-width: 6px;
    }

    .cashflow-line-hover-zones {
        inset: 28px 4px 8px 4px;
    }

    .overview-command-card {
        padding: 18px;
    }

    .overview-section-heading,
    .overview-attention-item,
    .overview-upcoming-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .overview-metric-grid-three,
    .overview-mini-metrics {
        grid-template-columns: 1fr;
    }

    .overview-row-side {
        min-width: 0;
        text-align: left;
    }
}

/* Subtle AI Gradient Animation */
.ai-gradient-border {
    position: relative;
    background: clip-padding-box white;
    border: 1px solid transparent;
    border-radius: 0.75rem;
}
.ai-gradient-border::before {
    content: '';
    position: absolute;
    top: -1px; right: -1px; bottom: -1px; left: -1px;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(45deg, #EA580C, #F97316, #3B82F6, #EA580C);
    background-size: 300% 300%;
    animation: gradientMove 4s ease infinite;
    opacity: 0.5;
}
@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============================================================
   Workbench redesign - Overview page
   ============================================================ */

/* In-content topbar (greeting + period control) */
.overview-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.overview-topbar-intro {
    min-width: 0;
}

.overview-eyebrow {
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 11px;
    font-weight: 800;
    margin: 0 0 6px;
}

.overview-greeting {
    margin: 0;
    color: #111827;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.overview-subtitle {
    margin: 8px 0 0;
    color: #6B7280;
    font-size: 14px;
    font-weight: 500;
}

.overview-period-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Two-column layout */
.overview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 320px);
    gap: clamp(16px, 1.4vw, 20px);
    align-items: start;
}

.overview-main-column,
.overview-right-column {
    min-width: 0;
}

.overview-main-column > * + * {
    margin-top: 22px;
}

/* Summary board */
.summary-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 10px 22px rgba(15,23,42,0.04);
    overflow: hidden;
}

.metric-cell {
    min-height: 118px;
    padding: 20px;
    border-right: 1px solid #E5E7EB;
    border-bottom: 1px solid #E5E7EB;
    position: relative;
    background: #FFFFFF;
    overflow: hidden;
}

.metric-cell:nth-child(3n) { border-right: 0; }
.metric-cell:nth-child(n+4) { border-bottom: 0; }

.metric-cell-trend {
    min-height: 264px;
    padding: 24px;
    padding-bottom: 68px;
}

.metric-cell-trend > .metric-label,
.metric-cell-trend > .metric-value-row,
.metric-cell-trend > .metric-sub,
.metric-cell-trend > .metric-revenue-secondary,
.metric-cell-trend > .metric-comparison-row {
    position: relative;
    z-index: 1;
}

.metric-cell.metric-cell-bank-trend {
    padding-bottom: 68px;
}

.metric-cell-bank-trend > .metric-label,
.metric-cell-bank-trend > .metric-value-row,
.metric-cell-bank-trend > .metric-sub,
.metric-cell-bank-trend > .metric-mini-grid,
.metric-cell-bank-trend > .metric-cta {
    position: relative;
    z-index: 1;
}

.metric-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 3;
    color: #9CA3AF;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid #CBD5E1;
    border-radius: 999px;
    background: #FFFFFF;
    color: #64748B;
    font-family: Inter, sans-serif;
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    cursor: default;
    transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.metric-info:hover,
.metric-info:focus,
.metric-info:focus-visible {
    border-color: #94A3B8;
    background: #F8FAFC;
    color: #111827;
    outline: none;
}

.metric-tooltip {
    position: fixed;
    z-index: 80;
    width: 240px;
    max-width: calc(100vw - 32px);
    padding: 10px 11px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #FFFFFF;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
    color: #334155;
    font-size: 12px;
    line-height: 1.38;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.metric-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.metric-value-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-height: 32px;
    padding-right: 22px;
}

.metric-value {
    font-family: Inter, sans-serif;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    color: #111827;
    font-size: clamp(18px, 1.2vw, 22px);
    line-height: 1.25;
    letter-spacing: 0;
    font-weight: 800;
    white-space: nowrap;
}

.metric-arrow {
    position: absolute;
    top: 46px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    color: #111827;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    transform: translateY(-2px);
}

.metric-arrow.is-good {
    color: #15803D;
    background: #DCFCE7;
}

.metric-arrow.is-bad {
    color: #DC2626;
    background: #FEE2E2;
}

.metric-sub {
    margin: 6px 0 0;
    color: #9CA3AF;
    font-size: 11px;
    line-height: 1.4;
    font-weight: 600;
    max-width: 240px;
}

.metric-sub.is-good { color: #047857; }
.metric-sub.is-bad { color: #DC2626; }
.metric-sub.is-neutral { color: #6B7280; }

.metric-comparison-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    min-height: 18px;
}

.metric-revenue-secondary {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid #F1F5F9;
    border-radius: 10px;
    background: #F9FAFB;
}

.metric-revenue-secondary span {
    color: #94A3B8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-revenue-secondary strong {
    color: #111827;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.metric-revenue-scope {
    font-size: 12px;
}

.metric-comparison-row .metric-sub {
    margin: 0;
}

.metric-cell-trend .metric-comparison-row .metric-arrow {
    position: static;
    flex: 0 0 auto;
    transform: none;
}

.metric-cell-trend .metric-comparison-row .metric-arrow:empty {
    display: none;
}

.metric-progress {
    margin-top: 10px;
    height: 4px;
    border-radius: 999px;
    background: #E5E7EB;
    overflow: hidden;
    max-width: 280px;
}

.metric-progress-fill {
    height: 100%;
    background: #3B82F6;
    border-radius: 999px;
    transition: width 200ms ease;
}

.metric-sparkline {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 12px;
    width: auto;
    height: 48px;
    opacity: 0.82;
    pointer-events: none;
}

.metric-cell-pressure { padding-bottom: 76px; }

/* Chart cards (shared shell) */
.chart-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 10px 22px rgba(15,23,42,0.04);
    padding: 24px;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.chart-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #111827;
}

.chart-subtitle {
    margin: 4px 0 0;
    color: #6B7280;
    font-size: 13px;
    font-weight: 500;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #6B7280;
    font-size: 12px;
    font-weight: 700;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 14px;
    height: 8px;
    border-radius: 999px;
    background: #94A3B8;
}

.legend-dot-revenue { background: #22C55E; }
.legend-dot-opex { background: #9CA3AF; }
.legend-dot-cash-in { background: #16A34A; }
.legend-dot-cash-out { background: #EF4444; }
.legend-dot-cash-net { background: #111827; }

.chart-footnote {
    margin: 14px 0 0;
    color: #6B7280;
    font-size: 12px;
    font-weight: 500;
    font-style: italic;
}

/* Cash flow chart */
.cash-flow-chart {
    position: relative;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #F1F5F9;
    padding-top: 18px;
}

.cash-flow-stage {
    position: relative;
    flex: 1;
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 10px;
    min-height: 240px;
}

.cash-flow-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #94A3B8;
    font-family: Inter, sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    font-weight: 700;
    text-align: right;
    padding-right: 8px;
}

.cash-flow-plot {
    position: relative;
    border-left: 1px solid #E5E7EB;
    background:
        linear-gradient(to bottom, transparent calc(25% - 1px), #F1F5F9 25%, transparent calc(25% + 1px)),
        linear-gradient(to bottom, transparent calc(75% - 1px), #F1F5F9 75%, transparent calc(75% + 1px));
}

.cash-flow-zero-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #CBD5E1;
    z-index: 1;
}

.cash-flow-scroll {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.cash-flow-scroll::-webkit-scrollbar {
    display: none;
}

.cash-flow-bars {
    height: 100%;
    min-width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 16px;
    padding: 0 10px;
}

.cash-flow-month {
    position: relative;
    height: 100%;
    cursor: pointer;
    min-width: 28px;
}

.cash-flow-labels-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-left: 70px;
    scrollbar-width: thin;
}

.cash-flow-labels-scroll::-webkit-scrollbar {
    height: 6px;
}

.cash-flow-labels-scroll::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 999px;
}

.cash-bar {
    position: absolute;
    width: clamp(8px, 22%, 20px);
    transform: translateX(-50%);
    border-radius: 999px 999px 4px 4px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.36);
    transition: filter 120ms ease, transform 120ms ease;
}

.cash-bar-in {
    left: 30%;
    bottom: 50%;
    background: linear-gradient(180deg, #22C55E 0%, #15803D 100%);
}

.cash-bar-out {
    left: 50%;
    top: 50%;
    background: linear-gradient(180deg, #FCA5A5 0%, #EF4444 100%);
    border-radius: 4px 4px 999px 999px;
}

.cash-bar-net {
    left: 70%;
    width: clamp(5px, 14%, 12px);
    background: #111827;
    z-index: 2;
    opacity: 0.9;
}

.cash-bar-net-pos {
    bottom: 50%;
    border-radius: 999px 999px 4px 4px;
}
.cash-bar-net-neg {
    top: 50%;
    border-radius: 4px 4px 999px 999px;
}

.cash-flow-month:hover .cash-bar {
    filter: brightness(1.04);
    transform: translateX(-50%) scaleY(1.02);
}

.cash-flow-labels {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 14px;
    min-width: 100%;
    box-sizing: border-box;
    padding: 12px 8px 0 8px;
    color: #6B7280;
    font-size: 11px;
    font-weight: 700;
}

.cash-flow-labels span {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Attention tabs + queue */
.attention-tabs {
    display: flex;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid #E5E7EB;
    padding: 0;
    margin-top: 22px;
}

.attention-tab {
    background: transparent;
    border: 0;
    padding: 0 0 12px;
    color: #6B7280;
    font-family: Inter, sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    position: relative;
}

.attention-tab.is-active {
    color: #111827;
}

.attention-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: #111827;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #E5E7EB;
    color: #111827;
    font-size: 11px;
    font-weight: 800;
    margin-left: 4px;
}

.attention-section {
    margin-top: 16px;
}

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

.queue-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.02em;
}

.queue-list {
    display: grid;
    gap: 10px;
}

.queue-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.queue-row:hover {
    border-color: #CBD5E1;
    box-shadow: 0 4px 10px rgba(15,23,42,0.06);
}

.queue-icon {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #F1F5F9;
    border: 1px solid #E5E7EB;
    color: #334155;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 800;
}

.queue-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.queue-icon-warning {
    background: #FFF7ED;
    color: #C2410C;
    border-color: #FED7AA;
}

.queue-icon-danger {
    background: #FEF2F2;
    color: #DC2626;
    border-color: #FECACA;
}

.queue-row-body {
    min-width: 0;
}

.queue-row-title {
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.queue-row-meta {
    color: #6B7280;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 500;
}

.queue-row-arrow {
    color: #94A3B8;
    font-size: 18px;
    text-align: right;
}

/* Right rail - unified workbench */
.right-workbench {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 18px rgba(15,23,42,0.035);
    overflow: hidden;
}

.brain-panel {
    position: relative;
    overflow: hidden;
    padding: 16px;
    background:
        radial-gradient(circle at 100% 0%, rgba(99,102,241,0.16), transparent 34%),
        linear-gradient(135deg, #FFF1F2 0%, #F8FAFC 42%, #EEF2FF 100%);
    isolation: isolate;
    transition: filter 180ms ease;
}

.brain-panel::before {
    content: '';
    position: absolute;
    inset: -45%;
    z-index: 0;
    background-image:
        radial-gradient(circle at 22% 28%, rgba(244,114,182,0.22), transparent 24%),
        radial-gradient(circle at 76% 30%, rgba(99,102,241,0.22), transparent 26%),
        radial-gradient(circle at 48% 78%, rgba(20,184,166,0.16), transparent 25%),
        linear-gradient(135deg, rgba(255,255,255,0.86), rgba(238,242,255,0.54));
    background-size: 120% 120%;
    animation: brainColorDrift 12s ease-in-out infinite alternate;
    transform: rotate(0deg);
}

.brain-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.42), rgba(255,255,255,0.12));
    pointer-events: none;
}

.brain-panel > * {
    position: relative;
    z-index: 1;
}

.right-workbench:hover .brain-panel {
    filter: saturate(1.04);
}

@keyframes brainColorDrift {
    0% {
        background-position: 0% 42%;
        transform: rotate(0deg) scale(1);
    }
    50% {
        background-position: 80% 58%;
        transform: rotate(3deg) scale(1.04);
    }
    100% {
        background-position: 100% 34%;
        transform: rotate(-2deg) scale(1.02);
    }
}

.brain-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.brain-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #EA580C;
    flex-shrink: 0;
}

.brain-logo > svg {
    width: 100%;
    height: 100%;
    display: block;
}

.brain-title {
    margin: 0;
    color: #111827;
    font-size: 14px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brain-period {
    margin: 2px 0 0;
    color: #6B7280;
    font-size: 11px;
    font-weight: 600;
}

.brain-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.brain-loading {
    min-height: 138px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(229,231,235,0.9);
    border-radius: 12px;
    background:
        radial-gradient(circle at 50% 48%, rgba(234,88,12,0.10), transparent 36%),
        rgba(255,255,255,0.78);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.brain-loading-icon {
    position: relative;
    width: 78px;
    height: 78px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

.brain-loading-core {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: #111827;
    border: 1px solid rgba(234,88,12,0.72);
    box-shadow:
        0 0 0 8px rgba(234,88,12,0.10),
        0 18px 34px rgba(234,88,12,0.24);
    animation: brainCorePulse 1.7s ease-in-out infinite;
}

.brain-loading-core::before,
.brain-loading-core::after {
    content: '';
    position: absolute;
    background: #FFFFFF;
    border-radius: 1px;
}

.brain-loading-core::before {
    left: 8px;
    top: 7px;
    width: 13px;
    height: 4px;
}

.brain-loading-core::after {
    left: 8px;
    top: 7px;
    width: 4px;
    height: 15px;
}

.brain-loading-ring {
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(234,88,12,0.32);
    border-top-color: rgba(99,102,241,0.55);
    border-radius: 999px;
    animation: brainRingSpin 2.4s linear infinite;
}

.brain-loading-ring-alt {
    inset: 0;
    border-color: rgba(99,102,241,0.22);
    border-right-color: rgba(20,184,166,0.52);
    animation-duration: 3.6s;
    animation-direction: reverse;
}

.brain-loading-node {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #FFFFFF;
    border: 2px solid #EA580C;
    box-shadow: 0 0 18px rgba(234,88,12,0.26);
    animation: brainNodeBlink 1.8s ease-in-out infinite;
}

.brain-loading-node-one {
    top: 5px;
    left: 36px;
}

.brain-loading-node-two {
    right: 8px;
    bottom: 18px;
    border-color: #6366F1;
    animation-delay: 0.28s;
}

.brain-loading-node-three {
    left: 8px;
    bottom: 18px;
    border-color: #14B8A6;
    animation-delay: 0.56s;
}

.brain-loading-scan {
    position: absolute;
    inset: 14px;
    border-radius: 999px;
    background: linear-gradient(115deg, transparent 22%, rgba(255,255,255,0.78) 50%, transparent 78%);
    transform: translateX(-34px) rotate(18deg);
    animation: brainScan 2.1s ease-in-out infinite;
    mix-blend-mode: screen;
}

@keyframes brainCorePulse {
    0%, 100% {
        transform: scale(0.94);
        box-shadow:
            0 0 0 7px rgba(234,88,12,0.08),
            0 18px 34px rgba(234,88,12,0.20);
    }
    50% {
        transform: scale(1.04);
        box-shadow:
            0 0 0 11px rgba(234,88,12,0.14),
            0 20px 42px rgba(234,88,12,0.30);
    }
}

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

@keyframes brainNodeBlink {
    0%, 100% {
        opacity: 0.52;
        transform: scale(0.88);
    }
    45% {
        opacity: 1;
        transform: scale(1.16);
    }
}

@keyframes brainScan {
    0%, 18% {
        opacity: 0;
        transform: translateX(-34px) rotate(18deg);
    }
    45%, 66% {
        opacity: 0.7;
    }
    100% {
        opacity: 0;
        transform: translateX(34px) rotate(18deg);
    }
}

.brain-idle {
    width: 100%;
    min-height: 138px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px dashed rgba(234,88,12,0.45);
    border-radius: 12px;
    background:
        radial-gradient(circle at 50% 40%, rgba(234,88,12,0.08), transparent 42%),
        rgba(255,255,255,0.78);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
    cursor: pointer;
    font-family: Inter, sans-serif;
    text-align: center;
    transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}

.brain-idle:hover {
    border-color: rgba(234,88,12,0.78);
    background:
        radial-gradient(circle at 50% 40%, rgba(234,88,12,0.14), transparent 42%),
        rgba(255,255,255,0.92);
}

.brain-idle:active { transform: scale(0.99); }

.brain-loading-icon-idle .brain-loading-core,
.brain-loading-icon-idle .brain-loading-ring,
.brain-loading-icon-idle .brain-loading-node {
    animation-play-state: paused;
}

.brain-idle:hover .brain-loading-icon-idle .brain-loading-core,
.brain-idle:hover .brain-loading-icon-idle .brain-loading-ring,
.brain-idle:hover .brain-loading-icon-idle .brain-loading-node {
    animation-play-state: running;
}

.brain-idle-label {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.005em;
}

.brain-idle-hint {
    font-size: 12px;
    font-weight: 500;
    color: #94A3B8;
}

.brain-message {
    border: 1px solid #E5E7EB;
    border-left: 4px solid #EA580C;
    border-radius: 12px;
    background: #FFFFFF;
    padding: 12px 14px;
    color: #111827;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 700;
    letter-spacing: -0.005em;
}

.brain-block {
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    background: #FFFFFF;
    padding: 11px 13px;
}

.brain-block-label {
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 9px;
    font-weight: 800;
    margin-bottom: 6px;
}

.brain-block-copy {
    color: #111827;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 700;
}

.brain-cta {
    width: 100%;
    height: 40px;
    border: 1px solid #EA580C;
    border-radius: 12px;
    background: #EA580C;
    color: #FFFFFF;
    font-family: Inter, sans-serif;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 12px;
    transition: background 120ms ease, border-color 120ms ease;
}

.brain-cta:hover {
    background: #C2410C;
    border-color: #C2410C;
}
.brain-cta:active { transform: scale(0.99); }

.rail-section {
    padding: 14px 16px;
    border-top: 1px solid #E5E7EB;
}

.rail-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    color: #94A3B8;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 800;
    margin-bottom: 10px;
}

.rail-divider::before,
.rail-divider::after {
    content: "";
    height: 1px;
    background: #E5E7EB;
}

.rail-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.rail-title {
    color: #111827;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.005em;
}

.rail-list {
    display: grid;
    gap: 10px;
}

.rail-item { display: grid; gap: 6px; }

.rail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
}

.rail-name {
    color: #111827;
    font-size: 12px;
    font-weight: 700;
}

.rail-amount {
    color: #6B7280;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rail-bar {
    height: 5px;
    border-radius: 999px;
    background: #E2E8F0;
    overflow: hidden;
}

.rail-bar > span {
    display: block;
    height: 100%;
    background: #94A3B8;
    border-radius: inherit;
}

.rail-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
}

.rail-footer-total {
    color: #6B7280;
    font-size: 11px;
    font-weight: 700;
}

.rail-footer-link {
    color: #EA580C;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
}

.rail-footer-link:hover { text-decoration: underline; }

.rail-mini-list {
    display: grid;
    gap: 8px;
}

.rail-mini-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 120ms ease, border-color 120ms ease;
}

.rail-mini-card:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
}

.rail-mini-body { min-width: 0; }

.rail-mini-title {
    color: #111827;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 2px;
}

.rail-mini-sub {
    color: #6B7280;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rail-mini-arrow {
    color: #94A3B8;
    font-size: 18px;
    font-weight: 700;
}

.readiness-rows {
    display: grid;
    gap: 8px;
}

.readiness-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #6B7280;
    font-size: 11px;
    font-weight: 600;
}

.readiness-row strong {
    color: #111827;
    font-weight: 800;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    background: #F1F5F9;
    color: #475569;
    text-transform: none;
}

.status-badge.is-ready { background: #DCFCE7; color: #166534; }
.status-badge.is-warning { background: #FEF3C7; color: #92400E; }
.status-badge.is-danger { background: #FEE2E2; color: #B91C1C; }

/* Workbench responsive — keep the sidebar + 3-col KPI layout down to laptop
   widths (MacBook Air ~1470/1304); only collapse below 1200px (tablets). */
@media (max-width: 1200px) {
    .overview-layout {
        grid-template-columns: 1fr;
    }

    .summary-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-cell:nth-child(3n) { border-right: 1px solid #E5E7EB; }
    .metric-cell:nth-child(2n) { border-right: 0; }
    .metric-cell:nth-child(n+4) { border-bottom: 1px solid #E5E7EB; }
    .metric-cell:nth-child(n+5) { border-bottom: 0; }
}

@media (max-width: 760px) {
    .dashboard-main-topbar {
        align-items: flex-start;
        min-height: 116px;
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .dashboard-topbar-period {
        width: 100%;
        justify-content: flex-start;
    }

    .dashboard-topbar-title { font-size: 17px; }
    .overview-period-strip { justify-content: flex-start; width: 100%; }
    .dashboard-period-controls { width: 100%; overflow-x: auto; }
    .dashboard-period-btn { white-space: nowrap; }

    .summary-board { grid-template-columns: 1fr; }
    .metric-cell { min-height: 112px; border-right: 0 !important; border-bottom: 1px solid #E5E7EB !important; }
    .metric-cell-trend {
        min-height: 256px;
        padding: 20px;
        padding-bottom: 64px;
    }
    .metric-cell:last-child { border-bottom: 0 !important; }
    .metric-sparkline { left: 20px; right: 20px; width: auto; height: 44px; opacity: 0.72; }

    .chart-card { padding: 18px; }
    .chart-card-header { flex-direction: column; align-items: flex-start; }
    .chart-legend { gap: 10px; }

    .cash-flow-chart { min-height: 260px; }
    .cash-flow-stage { grid-template-columns: 48px 1fr; min-height: 200px; }
    .cash-flow-labels-scroll { padding-left: 58px; }
    .cash-flow-labels { gap: 8px; padding-left: 8px; }
    .cash-flow-bars { gap: 10px; padding: 0 6px; }
    .cash-flow-month { min-width: 22px; }

    .attention-tabs { gap: 18px; overflow-x: auto; }
    .attention-tab { white-space: nowrap; }

    .queue-row { grid-template-columns: 40px minmax(0, 1fr) 18px; padding: 12px 14px; }

    .right-workbench { border-radius: 14px; }
    .brain-panel { padding: 16px; }
    .brain-title { font-size: 16px; }
    .brain-message { font-size: 13px; }
}

/* ============================================================
   KPI logic enhancement — mini-tile cells + pressure meter + budget series
   ============================================================ */

.metric-cell-mini {
    min-height: 224px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.metric-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.metric-cell-mini > .metric-sub {
    margin-top: 16px;
    padding-top: 0;
    max-width: none;
}

.metric-cell-bank-trend > .metric-bank-status {
    margin-top: 8px;
}

.metric-cell-bank-trend > .metric-mini-grid {
    margin-top: 14px;
}

.metric-mini-tile {
    border: 1px solid #F1F5F9;
    background: #F9FAFB;
    border-radius: 10px;
    padding: 10px 12px;
}

.metric-mini-tile span {
    display: block;
    color: #94A3B8;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.metric-mini-tile strong {
    display: block;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    overflow-wrap: anywhere;
}

.metric-sub.is-warn { color: #C2410C; }

.metric-progress-budget {
    margin-top: 12px;
    height: 4px;
    background: #E5E7EB;
    border-radius: 999px;
    overflow: hidden;
    max-width: none;
}

.metric-progress-fill.is-good { background: #16A34A; }
.metric-progress-fill.is-warn { background: #F97316; }
.metric-progress-fill.is-bad { background: #DC2626; }

.metric-pressure-bar {
    position: relative;
    margin-top: 14px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #DCFCE7 0%, #FEF3C7 55%, #FEE2E2 100%);
    overflow: hidden;
}

.metric-pressure-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.18);
    transition: width 220ms ease, background 200ms ease;
}

.metric-pressure-fill.is-good { background: rgba(22, 163, 74, 0.55); }
.metric-pressure-fill.is-warn { background: rgba(249, 115, 22, 0.65); }
.metric-pressure-fill.is-bad { background: rgba(220, 38, 38, 0.7); }

.metric-pressure-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: #94A3B8;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cashflow-line-budget {
    fill: none;
    stroke: #F97316;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 8 6;
}

.legend-dot-budget {
    background: transparent;
    border: 2px dashed #F97316;
    height: 2px;
    width: 18px;
    border-radius: 0;
}

.legend-caption {
    color: #94A3B8;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
    font-style: italic;
}

@media (max-width: 1200px) {
    .metric-cell-mini { min-height: 208px; }
}

@media (max-width: 760px) {
    .metric-cell-mini {
        min-height: 0;
        padding: 20px;
    }
    .metric-mini-grid { margin-top: 12px; }
}

/* --- Finance setup CTAs on KPI cards --- */
.metric-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 12px;
    background: #FFF7ED;
    color: #C2410C;
    border: 1px solid #FED7AA;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    align-self: flex-start;
}
.metric-cta:hover {
    background: #FFEDD5;
    border-color: #FDBA74;
    color: #9A3412;
}
.metric-cta:focus-visible {
    outline: 2px solid #FB923C;
    outline-offset: 2px;
}
.metric-cta::after {
    content: "→";
    font-size: 12px;
    margin-left: 2px;
}

/* --- Finance setup drawer (Bank & Budget) --- */
.finance-setup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}
.finance-setup-title {
    font-size: 16px;
    font-weight: 700;
    color: #0F172A;
    margin: 0;
}
.finance-setup-subtitle {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: #64748B;
}
.finance-setup-close {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: transparent;
    color: #94A3B8;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.finance-setup-close:hover { background: #F1F5F9; color: #0F172A; }
.finance-setup-close svg { width: 16px; height: 16px; }

.finance-setup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 24px;
}

.finance-method-list { display: flex; flex-direction: column; gap: 10px; }
.finance-method-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.finance-method-card:hover:not(.is-disabled) {
    border-color: #FB923C;
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.08);
}
.finance-method-card.is-disabled {
    background: #F8FAFC;
    cursor: not-allowed;
    opacity: 0.75;
}
.finance-method-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #FFF7ED;
    color: #C2410C;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.finance-method-icon svg { width: 18px; height: 18px; }
.finance-method-card.is-disabled .finance-method-icon { background: #F1F5F9; color: #94A3B8; }
.finance-method-copy { flex: 1; }
.finance-method-title {
    font-size: 13px;
    font-weight: 600;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 8px;
}
.finance-method-desc { font-size: 12px; color: #64748B; margin-top: 2px; line-height: 1.45; }
.finance-method-pill {
    font-size: 10px;
    font-weight: 600;
    color: #475569;
    background: #E2E8F0;
    padding: 2px 6px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.finance-method-arrow { color: #CBD5F5; font-size: 18px; font-weight: 600; }

.finance-setup-form { display: flex; flex-direction: column; gap: 14px; }
.finance-field { display: flex; flex-direction: column; gap: 6px; }
.finance-field-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}
.finance-field-optional { color: #94A3B8; font-weight: 500; }
.finance-field input,
.finance-field select,
.finance-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: #FFFFFF;
    font-size: 13px;
    color: #0F172A;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.finance-field input:focus,
.finance-field select:focus,
.finance-field textarea:focus {
    outline: none;
    border-color: #FB923C;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.2);
}
.finance-amount-row {
    display: flex;
    align-items: stretch;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    overflow: hidden;
    background: #FFFFFF;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.finance-amount-row:focus-within {
    border-color: #FB923C;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.2);
}
.finance-amount-prefix {
    padding: 10px 12px;
    background: #F8FAFC;
    color: #64748B;
    font-size: 13px;
    font-weight: 600;
    border-right: 1px solid #E2E8F0;
}
.finance-amount-row input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    font-size: 13px;
    color: #0F172A;
    font-variant-numeric: tabular-nums;
}
.finance-amount-row input:focus { box-shadow: none; outline: none; }

.finance-setup-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #F1F5F9;
}
.finance-btn {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.finance-btn:disabled { opacity: 0.7; cursor: progress; }
.finance-btn-primary {
    background: #0F172A;
    color: #FFFFFF;
}
.finance-btn-primary:hover:not(:disabled) { background: #1E293B; }
.finance-btn-ghost {
    background: #F1F5F9;
    color: #334155;
}
.finance-btn-ghost:hover { background: #E2E8F0; }

.bank-review-card {
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 16px;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bank-review-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}
.bank-review-line span { color: #64748B; }
.bank-review-line strong { color: #0F172A; font-weight: 600; text-align: right; }
.bank-review-note {
    margin-top: 14px;
    font-size: 12px;
    color: #64748B;
    line-height: 1.5;
}
