/* TrackMyOutflow – blue theme on top of Bootstrap 5.3 */
:root {
    --tmo-navy: #1e3a8a;
    --tmo-blue: #1d4ed8;
    --tmo-blue-hover: #1e40af;
    --tmo-sky: #e0ecff;
    --tmo-business: #0e7490;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;
    --bs-link-color: #1d4ed8;
    --bs-link-color-rgb: 29, 78, 216;
    --bs-link-hover-color: #1e40af;
    --bs-link-hover-color-rgb: 30, 64, 175;
    --bs-body-bg: #f5f8fd;
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { background: var(--bs-body-bg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

.btn-primary {
    --bs-btn-bg: var(--tmo-blue);
    --bs-btn-border-color: var(--tmo-blue);
    --bs-btn-hover-bg: var(--tmo-blue-hover);
    --bs-btn-hover-border-color: var(--tmo-blue-hover);
    --bs-btn-active-bg: var(--tmo-navy);
    --bs-btn-active-border-color: var(--tmo-navy);
    --bs-btn-disabled-bg: var(--tmo-blue);
    --bs-btn-disabled-border-color: var(--tmo-blue);
}
.btn-outline-primary {
    --bs-btn-color: var(--tmo-blue);
    --bs-btn-border-color: var(--tmo-blue);
    --bs-btn-hover-bg: var(--tmo-blue);
    --bs-btn-hover-border-color: var(--tmo-blue);
    --bs-btn-active-bg: var(--tmo-navy);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #93b4f5;
    box-shadow: 0 0 0 .2rem rgba(29, 78, 216, .2);
}
.form-check-input:checked { background-color: var(--tmo-blue); border-color: var(--tmo-blue); }

.tmo-navbar { background: linear-gradient(90deg, var(--tmo-navy), var(--tmo-blue)); }
.tmo-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.6rem; height: 1.6rem; border-radius: .4rem;
    background: rgba(255,255,255,.18); margin-right: .25rem;
}
.tmo-ws-banner { padding: .3rem 0; border-bottom: 1px solid rgba(0,0,0,.06); }
.tmo-ws-personal { background: var(--tmo-sky); color: var(--tmo-navy); }
.tmo-ws-business { background: #dff4f8; color: #0b4f61; }

.progress-bar { background-color: var(--tmo-blue); }
.card { border: 1px solid #dbe4f3; box-shadow: 0 1px 2px rgba(30,58,138,.05); }
.card-header { background: #fff; font-weight: 600; }

.tmo-stat .tmo-stat-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.tmo-stat .tmo-stat-value { font-size: 1.6rem; font-weight: 600; color: var(--tmo-navy); font-variant-numeric: tabular-nums; }

.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: #475569; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a.sort { color: inherit; text-decoration: none; }
.table a.sort:hover { color: var(--tmo-blue); }

.tmo-login { max-width: 420px; margin: 3rem auto; }
.tmo-login .btn { display: flex; align-items: center; justify-content: center; gap: .5rem; }

.page-header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-header h1 { font-size: 1.6rem; margin: 0; color: var(--tmo-navy); }

/* Phone: tables become stacked cards */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack tr { display: block; border: 1px solid #dbe4f3; border-radius: .5rem; margin-bottom: .75rem; background: #fff; padding: .5rem .25rem; }
    /* Label on the left, every line of the cell's content stacked on the right. */
    .table-stack td { display: grid; grid-template-columns: minmax(6rem, 40%) 1fr; column-gap: 1rem; border: 0; padding: .25rem .75rem; text-align: right; justify-items: end; }
    .table-stack td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 9; font-weight: 600; color: #475569; text-align: left; justify-self: start; }
    .table-stack td > * { grid-column: 2; }
    /* Wide content (e.g. budget bars) gets its own full-width line under the label. */
    .table-stack td.tmo-full { grid-template-columns: 1fr; justify-items: stretch; text-align: left; }
    .table-stack td.tmo-full::before { grid-row: auto; margin-bottom: .25rem; }
    .table-stack td.tmo-full > * { grid-column: 1; }
    .table-stack td.num { text-align: right; }
    .table-stack td[data-label=""]::before { content: none; }
}

/* ---------- Charts (see wwwroot/js/charts.js) ---------- */
:root {
    --series-1: #257de0;   /* categorical slot 1 – blue */
    --series-2: #f47230;   /* categorical slot 2 – orange */
    --chart-grid: #e7e7e7;
    --chart-axis: #c2c2c2;
    --chart-ink-2: #666666;
    --status-good: #0aac23;
    --status-good-text: #006c10;
    --status-warning: #fbb315;
    --status-critical: #dc3c3d;
}
.tmo-chart { width: 100%; min-height: 240px; }
.tmo-chart svg { display: block; overflow: visible; }
.tmo-grid { stroke: var(--chart-grid); stroke-width: 1; }
.tmo-axis { stroke: var(--chart-axis); stroke-width: 1; }
.tmo-tick { fill: var(--chart-ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.tmo-tick.is-current { fill: #191919; font-weight: 600; }
.tmo-value { fill: #191919; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tmo-hit { fill: transparent; }
.tmo-col { outline: none; cursor: default; }
.tmo-col .tmo-bar { transition: opacity .12s; }
.tmo-col.is-dim .tmo-bar { opacity: .45; }
.tmo-col:focus-visible .tmo-hit { fill: rgba(29, 78, 216, .08); }
.tmo-tip {
    position: absolute; z-index: 5; pointer-events: none; min-width: 150px;
    background: #fff; border: 1px solid rgba(11,11,11,.12); border-radius: .5rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .12); padding: .45rem .6rem; font-size: .8rem;
}
.tmo-tip-head { color: var(--chart-ink-2); margin-bottom: .2rem; }
.tmo-tip-row { display: grid; grid-template-columns: 12px auto 1fr; gap: .4rem; align-items: center; font-variant-numeric: tabular-nums; }
.tmo-tip-key { width: 12px; height: 2px; border-radius: 1px; }
.tmo-tip-name { color: var(--chart-ink-2); }
.tmo-tip-total { border-top: 1px solid var(--chart-grid); margin-top: .2rem; padding-top: .2rem; }
.tmo-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .8rem; color: var(--chart-ink-2); margin-bottom: .25rem; }
.tmo-legend-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.tmo-table-toggle summary { font-size: .8rem; color: var(--tmo-blue); cursor: pointer; margin-top: .5rem; }

/* ---------- Budget status (always icon + label, never color alone) ---------- */
.tmo-budget-bar { position: relative; height: 8px; border-radius: 4px; background: #e9eef7; overflow: visible; }
.tmo-budget-fill { height: 100%; border-radius: 4px; }
.tmo-budget-pace { position: absolute; top: -3px; width: 2px; height: 14px; background: #475569; border-radius: 1px; }
.tmo-status-ontrack .tmo-budget-fill { background: var(--status-good); }
.tmo-status-close .tmo-budget-fill { background: var(--status-warning); }
.tmo-status-over .tmo-budget-fill { background: var(--status-critical); }
.tmo-status-label { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tmo-status-ontrack .tmo-status-label { color: var(--status-good-text); }
.tmo-status-close .tmo-status-label { color: #8a5a00; }
.tmo-status-over .tmo-status-label { color: #b42324; }
.tmo-status-nobudget .tmo-status-label { color: var(--chart-ink-2); font-weight: 400; }

@media (max-width: 575.98px) {
    .tmo-stat .tmo-stat-value { font-size: 1.25rem; }
    .tmo-stat .tmo-stat-label { font-size: .7rem; }
    .tmo-compact-table { font-size: .8rem; }
}

/* ---------- Bills ---------- */
.tmo-bill-status { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tmo-bill-paid { color: var(--status-good-text); }
.tmo-bill-due { color: #8a5a00; }
.tmo-bill-overdue { color: #b42324; }
.tmo-bill-upcoming { color: #475569; }
.tmo-bill-skipped { color: #64748b; text-decoration: line-through; }
.tmo-price-change { color: #8a5a00; }
.tmo-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.tmo-cal-head { padding: .4rem .5rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #475569; border-bottom: 1px solid #dbe4f3; }
.tmo-cal-day { min-height: 6.5rem; padding: .3rem .35rem; border-right: 1px solid #edf1f8; border-bottom: 1px solid #edf1f8; }
.tmo-cal-day:nth-child(7n) { border-right: 0; }
.tmo-cal-day.is-other { background: #f8fafc; }
.tmo-cal-day.is-other .tmo-cal-date { color: #b6c0cf; }
.tmo-cal-day.is-today { background: #eef4ff; }
.tmo-cal-day.is-today .tmo-cal-date { background: var(--tmo-blue); color: #fff; }
.tmo-cal-date { display: inline-block; min-width: 1.5rem; padding: 0 .3rem; border-radius: .75rem; font-size: .8rem; font-weight: 600; color: #334155; text-align: center; margin-bottom: .2rem; }
.tmo-cal-bill {
    display: flex; gap: .25rem; align-items: baseline; font-size: .75rem; line-height: 1.25; text-decoration: none;
    padding: .15rem .3rem; border-radius: .3rem; margin-bottom: .2rem; background: #fff; border: 1px solid #dbe4f3;
}
.tmo-cal-bill:hover { border-color: var(--tmo-blue); }
.tmo-cal-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1e293b; }
.tmo-cal-amt { color: #475569; font-variant-numeric: tabular-nums; }
.tmo-cal-bill.tmo-bill-overdue { border-color: #f3b5b5; background: #fff5f5; }
.tmo-cal-bill.tmo-bill-due { border-color: #f6d58e; background: #fffaf0; }
.tmo-cal-bill.tmo-bill-paid { background: #f3fbf4; border-color: #bfe5c5; }
.tmo-cal-bill.tmo-bill-skipped .tmo-cal-name { text-decoration: line-through; color: #64748b; }

/* ---------- Notifications ---------- */
.tmo-bell { display: inline-flex; align-items: center; }
.tmo-bell-count {
    position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
    background: #dc3c3d; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.tmo-notif.is-unread { background: #eef4ff; }
.tmo-notif.is-unread .fw-semibold::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tmo-blue); margin-right: .4rem; vertical-align: 1px; }
.tmo-notif-icon { flex: 0 0 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #e9eef7; font-size: .9rem; }
.tmo-notif-overdue { background: #fde8e8; color: #b42324; }
.tmo-notif-overbudget, .tmo-notif-pricechange { background: #fff4dc; color: #8a5a00; }
@media (min-width: 1200px) {
    .tmo-user-btn { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.tmo-bell { align-self: flex-start; }
@media (min-width: 1200px) { .tmo-bell { align-self: auto; } }
