:root {
    color-scheme: light;
    --ff-ink: #16324f;
    --ff-ink-soft: #4d6278;
    --ff-line: #d7e0ea;
    --ff-line-soft: #e8eef4;
    --ff-paper: #ffffff;
    --ff-canvas: #eef3f7;
    --ff-canvas-2: #e3ebf2;
    --ff-accent: #1c6b8a;
    --ff-income: #1f7a4c;
    --ff-expense: #9b2c2c;
    --ff-radius: 0.65rem;
    --ff-shadow: 0 10px 30px rgba(22, 50, 79, 0.06);
    --ff-font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

html,
body {
    margin: 0;
    min-height: 100%;
    color: var(--ff-ink);
    font-family: var(--ff-font);
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(28, 107, 138, 0.12), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(22, 50, 79, 0.08), transparent 50%),
        linear-gradient(180deg, var(--ff-canvas) 0%, var(--ff-canvas-2) 100%);
    background-attachment: fixed;
}

.home {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
}

.home h1 {
    margin: 0;
    width: min(40rem, 100%);
    font-size: inherit;
    font-weight: inherit;
    line-height: 1;
}

.home h1:focus {
    outline: none;
}

.home img {
    display: block;
    width: 100%;
    height: auto;
}

.panel {
    width: min(52rem, 100%);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2.5rem;
    box-sizing: border-box;
}

.panel.wide {
    width: min(72rem, 100%);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.panel h1,
.panel h2,
.chart-card h2,
.table-card h2 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.panel h1 {
    font-size: 1.55rem;
    letter-spacing: -0.02em;
}

.panel h2,
.chart-card h2,
.table-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.85rem;
}

.icon {
    width: 1.15em;
    height: 1.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
    vertical-align: -0.15em;
}

.button {
    margin-top: 1rem;
    background: var(--ff-ink);
    color: #fff;
    border: 0;
    border-radius: 0.45rem;
    padding: 0.55rem 0.95rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font: inherit;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
    background: #0f2438;
}

.button.secondary {
    background: var(--ff-paper);
    color: var(--ff-ink);
    border: 1px solid var(--ff-line);
}

.button.secondary:hover {
    background: #f7fafc;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1.35rem;
}

.quick-links .button {
    margin-top: 0;
}

.income {
    color: var(--ff-income);
}

.expense {
    color: var(--ff-expense);
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
    gap: 0.9rem;
    margin: 1rem 0 1.35rem;
}

.stat-row > div,
.stat-card {
    background: var(--ff-paper);
    border: 1px solid var(--ff-line-soft);
    border-radius: var(--ff-radius);
    padding: 0.95rem 1rem;
    box-shadow: var(--ff-shadow);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.stat-row .label {
    display: block;
    color: var(--ff-ink-soft);
    font-size: 0.88rem;
    margin-bottom: 0.3rem;
}

.stat-row strong {
    font-size: 1.3rem;
    letter-spacing: -0.02em;
}

.stat-icon {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.stat-icon .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.tone-balance { background: #e7f1f6; color: var(--ff-accent); }
.tone-members { background: #e8eef5; color: var(--ff-ink); }
.tone-moves { background: #f3efe6; color: #8a6a2f; }
.tone-trend { background: #e8f5ee; color: var(--ff-income); }
.tone-income { background: #e8f5ee; color: var(--ff-income); }
.tone-expense { background: #f8eaea; color: var(--ff-expense); }

.hero-band {
    margin-bottom: 0.35rem;
    padding: 0.25rem 0 0.35rem;
}

.home-dash .panel-head h1 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.7rem;
}

.home-mark {
    width: 2.1rem;
    height: 2.1rem;
}

.lede {
    margin: 0.35rem 0 0;
    color: var(--ff-ink-soft);
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 1rem;
    margin: 0 0 1.35rem;
}

.chart-card,
.table-card,
.filters.cardish {
    background: var(--ff-paper);
    border: 1px solid var(--ff-line-soft);
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow);
    padding: 1rem 1.1rem 1.15rem;
}

.table-card table {
    margin-bottom: 0;
}

.chart-empty,
.empty-state {
    color: var(--ff-ink-soft);
    margin: 0.5rem 0;
}

.donut-chart {
    display: grid;
    grid-template-columns: minmax(8rem, 11rem) 1fr;
    gap: 1rem;
    align-items: center;
}

.donut-svg {
    width: 100%;
    height: auto;
}

.donut-track {
    fill: none;
    stroke: var(--ff-line-soft);
    stroke-width: 3.2;
}

.donut-segment {
    fill: none;
    stroke-width: 3.2;
    stroke-linecap: butt;
}

.donut-hole {
    fill: var(--ff-paper);
}

.donut-center-label {
    font-size: 0.28rem;
    fill: var(--ff-ink-soft);
}

.donut-center-value {
    font-size: 0.38rem;
    font-weight: 700;
    fill: var(--ff-ink);
}

.chart-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.chart-legend.compact {
    flex-direction: row;
    gap: 1rem;
    margin-top: 0.55rem;
}

.chart-legend li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.45rem;
    align-items: center;
    font-size: 0.92rem;
}

.chart-legend.compact li {
    display: inline-flex;
}

.swatch {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 0.2rem;
    display: inline-block;
}

.swatch.income { background: var(--ff-income); }
.swatch.expense { background: var(--ff-expense); }

.bar-chart-rows {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(5rem, 7.5rem) 1fr auto;
    gap: 0.55rem;
    align-items: center;
}

.bar-label {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    height: 0.7rem;
    background: var(--ff-line-soft);
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--ff-accent);
    transition: width 0.35s ease;
}

.bar-fill.tone-income { background: var(--ff-income); }
.bar-fill.tone-expense { background: var(--ff-expense); }
.bar-fill.tone-primary { background: var(--ff-accent); }

.bar-value {
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    min-width: 4.5rem;
    text-align: right;
}

.trend-chart {
    width: 100%;
}

.trend-svg {
    width: 100%;
    height: auto;
    display: block;
}

.trend-grid {
    stroke: var(--ff-line-soft);
    stroke-width: 1;
}

.trend-line {
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.trend-line.income { stroke: var(--ff-income); }
.trend-line.expense { stroke: var(--ff-expense); }

.trend-area {
    stroke: none;
}

.trend-labels {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0.25rem;
    margin-top: 0.35rem;
    color: var(--ff-ink-soft);
    font-size: 0.8rem;
    text-align: center;
    text-transform: capitalize;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--ff-paper);
    margin: 0.5rem 0 1.5rem;
}

th,
td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--ff-line-soft);
    vertical-align: top;
}

th {
    color: var(--ff-ink-soft);
    font-weight: 600;
    font-size: 0.86rem;
}

a {
    color: var(--ff-ink);
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
}

.pill-income {
    background: #e8f5ee;
    color: var(--ff-income);
}

.pill-expense {
    background: #f8eaea;
    color: var(--ff-expense);
}

.message {
    box-sizing: border-box;
    padding: 2rem 1.5rem;
}

.message h1,
.message p {
    margin-top: 0;
}

@media (max-width: 720px) {
    .panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .donut-chart {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .bar-value {
        text-align: left;
    }
}
