:root {
    --sidebar-width: 50vw;
    --bg-surface: #f5f7fb;
    --bg-panel: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-table: rgba(255, 255, 255, 0.92);
    --accent: #0ea5e9;
    --accent-strong: #0284c7;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --danger: #dc2626;
    --success: #16a34a;
    --border-soft: rgba(148, 163, 184, 0.35);
    --font-sans: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

body {
    display: flex;
}

body.is-resizing {
    cursor: ew-resize;
    user-select: none;
}




.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    width: 100%;
    min-height: 100vh;
    transition: none;
    position: relative;
}

.sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%);
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    overflow-x: visible;
    width: var(--sidebar-width);
    min-width: 320px;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
    container-type: inline-size;
}

.sidebar-handle {
    position: fixed;
    top: 50vh;
    left: var(--sidebar-width);
    transform: translateY(-50%);
    width: 18px;
    height: 58px;
    border-radius: 0 9px 9px 0;
    border: none;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease;
    z-index: 4;
}

.sidebar-handle:focus-visible {
    outline: none;
    
}

.sidebar-handle .handle-grip {
    width: 4px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.6) 0%, rgba(148, 163, 184, 0.3) 100%);
}


body.sidebar-collapsed .sidebar-handle {
    left: 0px;
    cursor: pointer;
}

.sidebar-handle.is-dragging,
.sidebar-handle:active {
    background: rgba(14, 165, 233, 0.35);
}

@media (max-width: 1024px) {
    .sidebar-handle {
        left: calc(min(var(--sidebar-width), 92vw) + 16px);
    }

    body.sidebar-collapsed .sidebar-handle {
        left: 4px;
    }
}

.brand {
    display: flex;
align-items: start;
gap: 0;
flex-direction: column;

}

.brand-logo {
    width: 180px
}

.brand-title {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}


.brand-subtitle {
  margin: 4px 0 0;
color: #000000;
font-size: 0.8rem;
width: 100%;
font-weight: 600;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    margin-top: auto;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.logout-btn:hover {
    background: #f8fafc;
    color: #475569;
    border-color: rgba(15, 23, 42, 0.08);
}

.logout-btn i {
    font-size: 1rem;
}

.tooltip-icon {
  display: block;
margin-left: 6px;
color: #94a3b8;
cursor: inherit;
font-size: 0.85rem;
transition: color 0.2s ease;
position: relative;
/* float: right; */
width: 100%;
text-align: right;
margin-top: -18px;
}

.tooltip-icon:hover {
    color: #faa619;
}

.tooltip-icon i {
    vertical-align: middle;
}

/* Tooltip content on hover - positioned relative to parent label */
.input-grid label {
    position: relative;
}

.tooltip-icon::after {
    content: attr(data-tooltip);
position: absolute;
right: 0;
top: 100%;
margin-top: 6px;
padding: 10px 12px;
background: #1e293b;
color: #fff;
font-size: 13px;
line-height: 1.5;
border-radius: 6px;
white-space: normal;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease;
z-index: 99999;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
width: calc(100% - 18px);
text-align: left;
}

/* Show tooltip on hover */
.tooltip-icon:hover::after {
    opacity: 1;
}

/* Ensure label displays inline with tooltip */
.input-grid label {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
}

.input-grid label input {
    width: 100%;
    margin-top: 6px;
}

.warning-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    margin-bottom: 24px;
    color: #92400e;
}

.warning-banner i {
    font-size: 20px;
    margin-top: 2px;
    color: #f59e0b;
    flex-shrink: 0;
}

.warning-content {
    flex: 1;
}

.warning-content strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
    color: #78350f;
}

.warning-content p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.warning-content p strong {
    display: inline;
    font-size: inherit;
    color: #dc2626;
}

.scenario-panel label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input-control {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #ffffff;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

.checkbox-control {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.checkbox-control:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.scenario-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    color: var(--text-primary);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-accent {
    background: linear-gradient(120deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #ffffff;
    font-weight: 600;
}

.btn-secondary {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.35);
}

.btn-tertiary {
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.btn-icon {
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-icon:hover {
    background: rgba(14, 165, 233, 0.25);
}

.text-danger {
    color: var(--danger);
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.scenario-list {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

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

.scenario-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scenario-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.18);
}

.scenario-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

.inputs-scroll {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: visible;
}

.input-section {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.06);
    overflow: visible;
}

.input-section h2 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

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

.input-grid {
    display: grid;
   grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 8px 12px;
    overflow: visible;
}

.input-grid label {
 display: flex;
/* flex-direction: column; */
/* gap: 3px; */
font-size: 0.85rem;
color: var(--text-secondary);
position: relative;
overflow: visible;
}



.staff-list-wrap {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: #fff;
    overflow: auto;
    display: grid;
}

.staff-list-header {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.03);
    font-size: 0.88rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.staff-list {
    display: flex;
    flex-direction: column;
}

.staff-row {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.staff-row:last-child {
    border-bottom: none;
}

.staff-col {
    display: flex;
    align-items: center;
}

.staff-col-role {
    flex: 2;
    min-width: 100px;
}

.staff-col-salary {
    flex: 1.5;
    min-width:80px;
}

.staff-col-month {
    flex: 1;
    min-width: 60px;
}

.staff-col-fte {
    flex: 1;
    min-width: 64px;
}

.staff-col-actions {
    flex: 0 0 40px;
    justify-content: center;
}

.staff-col input {
    width: 100%;
}

.staff-col .input-control {
    padding: 6px 10px;
    font-size: 0.85rem;
}

/* Enterprise Licenses Table */
.enterprise-list-wrap {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: #fff;
    overflow: auto;
    display: grid;
}

.enterprise-list-header {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.03);
    font-size: 0.88rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.enterprise-list {
    display: flex;
    flex-direction: column;
}

.enterprise-row {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.enterprise-row:last-child {
    border-bottom: none;
}

.enterprise-col {
    display: flex;
    align-items: center;
}

.enterprise-col-fee {
    flex: 2;
    min-width: 100px;
}

.enterprise-col-month {
    flex: 1;
    min-width: 80px;
}

.enterprise-col-year {
    flex: 1;
    min-width: 60px;
}

.enterprise-col-repeat {
    flex: 0 0 62px;
    justify-content: center;
}

.enterprise-col-actions {
    flex: 0 0 40px;
    justify-content: center;
}

.enterprise-col input {
    width: 100%;
}

.enterprise-col .input-control {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.enterprise-col-repeat .checkbox-control {
    width: auto;
    margin: 0 auto;
}

/* Sunk Costs Section */
.sunk-costs-list-wrap {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.sunk-costs-list-header {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(248, 250, 252, 0.5);
    font-weight: 600;
    font-size: 0.85rem;
}

.sunk-costs-list {
    display: flex;
    flex-direction: column;
}

.sunk-cost-row {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.sunk-cost-row:last-child {
    border-bottom: none;
}

.sunk-cost-col {
    display: flex;
    align-items: center;
}

.sunk-cost-col-amount {
    flex: 2;
    min-width: 100px;
}

.sunk-cost-col-month {
    flex: 1;
    min-width: 80px;
}

.sunk-cost-col-year {
    flex: 1;
    min-width: 60px;
}

.sunk-cost-col-repeat {
    flex: 0 0 62px;
    justify-content: center;
}

.sunk-cost-col-actions {
    flex: 0 0 40px;
    justify-content: center;
}

.sunk-cost-col input {
    width: 100%;
}

.sunk-cost-col .input-control {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.sunk-cost-col-repeat .checkbox-control {
    width: auto;
    margin: 0 auto;
}

/* Investments Section */
.investments-list-wrap {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.investments-list-header {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(248, 250, 252, 0.5);
    font-weight: 600;
    font-size: 0.85rem;
}

.investments-list {
    display: flex;
    flex-direction: column;
}

.investment-row {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.investment-row:last-child {
    border-bottom: none;
}

.investment-col {
    display: flex;
    align-items: center;
}

.investment-col-amount {
    flex: 2;
    min-width: 100px;
}

.investment-col-month {
    flex: 1;
    min-width: 80px;
}

.investment-col-year {
    flex: 1;
    min-width: 60px;
}

.investment-col-repeat {
    flex: 0 0 62px;
    justify-content: center;
}

.investment-col-actions {
    flex: 0 0 40px;
    justify-content: center;
}

.investment-col input {
    width: 100%;
}

.investment-col .input-control {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.investment-col-repeat .checkbox-control {
    width: auto;
    margin: 0 auto;
}

.main-content {
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: relative;
    z-index: 1;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 24px 32px;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.toolbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toolbar h2 {
    margin: 0;
    font-size: 1.4rem;
}

.toolbar p {
    margin: 6px 0 0;
    color: var(--text-secondary);
}

.metrics {
    display: grid;
      grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
    gap: 18px;
}


.metric-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 20px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.07);
}

.metric-card h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-card p {
    margin: 12px 0 0;
    font-size: 1.4rem;
    font-weight: 600;
}


.metric-card p.negative {
    color: var(--danger);
}

.metric-card p.positive {
    color: var(--success);
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 18px 22px 26px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
    height: 100%;
}

.chart-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.chart-container {
    width: 100%;
    height: 280px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.dark-theme .chart-container {
    background: var(--bg-card);
    border-color: rgba(148, 163, 184, 0.15);
}

.chart-type-toggle {
    display: flex;
    gap: 0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 12px;
    background: #f1f5f9;
}

.dark-theme .chart-type-toggle {
    border-color: #475569;
    background: #1e293b;
}

.chart-type-toggle .toggle-btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    color: #64748b;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    border-right: 1px solid #cbd5e1;
}

.chart-type-toggle .toggle-btn:last-child {
    border-right: none;
}

.dark-theme .chart-type-toggle .toggle-btn {
    color: #94a3b8;
    border-right-color: #475569;
}

.chart-type-toggle .toggle-btn:hover {
    background: #e2e8f0;
}

.dark-theme .chart-type-toggle .toggle-btn:hover {
    background: #334155;
}

.chart-type-toggle .toggle-btn.active {
    background: #3b82f6;
    color: #ffffff;
    font-weight: 600;
}

.dark-theme .chart-type-toggle .toggle-btn.active {
    background: #3b82f6;
}

.charts-and-summary {
   display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, auto);
gap: 18px;
    align-items: start;
}

.summary-card {
    background: var(--bg-card);
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 18px 22px 24px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
    height: 100%;
}

.summary-card header {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.summary-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.summary-card th,
.summary-card td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    text-align: right;
}

.summary-card th:first-child,
.summary-card td:first-child {
    text-align: left;
}

.summary-card tbody tr:last-child td {
    border-bottom: none;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: 0 1fr;
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    pointer-events: none;
}

#toggle-sidebar span[data-label="show"] {
    display: none;
}

body.sidebar-collapsed #toggle-sidebar span[data-label="hide"] {
    display: none;
}

body.sidebar-collapsed #toggle-sidebar span[data-label="show"] {
    display: inline;
}

.table-card {
    background: var(--bg-table);
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 18px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.table-card header {
    font-size: 1rem;
    font-weight: 600;
}

.table-card .table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    color: var(--text-primary);
    min-width: 480px;
}

.table-card th,
.table-card td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    text-align: right;
}

.table-card th:first-child,
.table-card td:first-child {
    text-align: left;
}

.table-card tbody tr:last-child td {
    border-bottom: none;
}

.table-card .negative {
    color: var(--danger);
}

.table-card .positive {
    color: var(--success);
}

.table-card--compact {
    grid-column: span 1;
}

.table-card--compact .table-scroll {
    overflow-x: visible;
}

.table-card--compact table {
    min-width: auto;
}

.table-card--wide {
    grid-column: 1 / -1;
}

.table-card--wide table {
    min-width: 920px;
}

@media (max-width: 1180px) {
    body:not(.sidebar-collapsed) .app-shell {
        grid-template-columns: minmax(280px, var(--sidebar-width)) 1fr;
    }
}

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        border-right: 1px solid rgba(148, 163, 184, 0.18);
        border-bottom: none;
        max-height: none;
        resize: none;
        transform: translateX(0);
        box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
        z-index: 10;
        width: min(var(--sidebar-width), 92vw);
    }

    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    .sidebar-handle {
        position: fixed;
        left: calc(min(var(--sidebar-width), 92vw) - 12px);
        top: 50%;
    }

    body.sidebar-collapsed .sidebar-handle {
        left: 12px;
    }

    .main-content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .input-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}
@container (max-width: 430px) {
  .input-grid{ grid-template-columns: repeat(1, minmax(0, 1fr)); }
  
}
#toggle-sidebar span[data-label="hide"] {
    display: inline;
}

/* AI Chat Widget */
.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 420px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    z-index: 1000;
}

.chat-widget-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-title i {
    font-size: 20px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-close-btn,
.chat-clear-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    opacity: 0.8;
    transition: opacity 0.2s;
    border-radius: 4px;
}

.chat-close-btn:hover,
.chat-clear-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    animation: messageSlideIn 0.3s ease;
}

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

.chat-message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message-user .chat-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-message-assistant .chat-message-content {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.chat-message-content p {
    margin: 0 0 8px 0;
}

.chat-message-content p:last-child {
    margin-bottom: 0;
}

.chat-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-message-content li {
    margin: 4px 0;
}

.chat-loading-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.chat-loading-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: dotPulse 1.4s infinite ease-in-out;
}

.chat-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

.chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

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

@media (max-width: 768px) {
    .chat-widget {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 16px;
        right: 16px;
    }

    .chat-toggle-btn {
        bottom: 16px;
        right: 16px;
    }
}


/* Year Selector Styles */
.year-selector {
    display: flex;
    gap: 4px;
    align-items: center;
}

.year-btn {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.year-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.year-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-color: #667eea;
}

.summary-card header, .table-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-card header span, .table-card header span {
    font-weight: 600;
}

/* Master Year Selector */
.master-year-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.master-year-selector-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: #000;
}

.master-year-indicator {
    display: none;
    color: #faa619;
    font-size: 1rem;
}

.master-year-indicator.visible {
    display: inline-flex;
}

.master-year-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Metric Card Year Selectors */
.metric-card .metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 12px;
}

.metric-card .metric-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex: 1;
}

.metric-card .metric-year-label {
    font-weight: 600;
    color: var(--accent);
    text-transform: none;
}

.metric-card .year-buttons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.metric-card .year-btn {
    padding: 3px 8px;
    font-size: 11px;
    min-width: unset;
}

.metric-card:has(.metric-header) p {
    margin-top: 8px;
    font-size: 1.8rem;
}

/* Maintain existing metric card p styling for cards without headers */
.metric-card:not(:has(.metric-header)) p {
    font-size: 2rem;
}

/* User Growth Calculator Modal */
.calculator-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.calculator-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.calculator-modal {
    background: var(--bg-panel);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.calculator-modal-overlay.active .calculator-modal {
    transform: scale(1);
}

.calculator-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.calculator-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

.calculator-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

.calculator-modal-close:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.calculator-modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

.calculator-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.calculator-input-group {
    background: rgba(14, 165, 233, 0.04);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(14, 165, 233, 0.15);
}

.calculator-input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.calculator-input-group input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #ffffff;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.calculator-input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.calculator-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.calculator-summary-card {
    background: rgba(14, 165, 233, 0.04);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(14, 165, 233, 0.15);
}

.calculator-summary-card h4 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calculator-summary-card p {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
}

.calculator-chart-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.calculator-chart-title {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.calculator-chart {
    width: 100%;
    height: 400px;
}

.calculator-table-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    overflow-x: auto;
}

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

.calculator-table thead {
    background: rgba(14, 165, 233, 0.08);
}

.calculator-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(14, 165, 233, 0.2);
}

.calculator-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.calculator-table tbody tr:hover {
    background: rgba(14, 165, 233, 0.03);
}

.calculator-table .year-row {
    background: rgba(14, 165, 233, 0.06);
    font-weight: 600;
}

.calculator-table .year-row td {
    border-bottom: 2px solid rgba(14, 165, 233, 0.25);
}
