@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;550;600;650;700&family=Manrope:wght@400;500;600;650;700;750;800&display=swap');

:root {
    --green: #176e56;
    --ink: #243c34;
    --muted: #7c8983;
    --line: #e7ebe7;
    --bg: #f7f9f6;
    --soft: #eaf3ed
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px 'DM Sans', system-ui, sans-serif
}

a {
    color: var(--green);
    text-decoration: none
}

a:hover {
    text-decoration: underline
}

button, input, select {
    font: inherit
}

button, a, input, select, summary {
    -webkit-tap-highlight-color: transparent
}

button {
    cursor: pointer
}

button:disabled {
    opacity: .55;
    cursor: wait
}

:focus-visible {
    outline: 3px solid #81b8a3;
    outline-offset: 3px
}

h1, h2, h3, .brand, strong {
    font-family: Manrope, system-ui, sans-serif
}

h1 {
    font-size: 34px;
    letter-spacing: -1.3px;
    margin: 8px 0 10px;
    font-weight: 750
}

h2 {
    font-size: 17px;
    letter-spacing: -.4px;
    margin: 0 0 7px
}

h3 {
    font-size: 18px;
    letter-spacing: -.4px
}

p {
    line-height: 1.7;
    margin: 6px 0 14px
}

.muted {
    color: var(--muted)
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 242px;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 34px 20px;
    display: flex;
    flex-direction: column;
    z-index: 10
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.8px
}

.brand:hover {
    text-decoration: none
}

.brand-mark {
    background: var(--green);
    color: #fff;
    font-size: 28px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    width: 40px;
    height: 42px
}

.brand-light {
    font-weight: 450
}

.brand small {
    display: block;
    font: 8px 'DM Sans', sans-serif;
    letter-spacing: 1.3px;
    margin-top: 5px
}

.workspace-label {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7f9f6;
    border: 1px solid var(--line);
    padding: 15px 10px;
    border-radius: 10px;
    margin: 38px 0 30px
}

.workspace-label b {
    font-size: 12px
}

.workspace-label small {
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-top: 5px
}

.house {
    font-size: 27px;
    color: var(--green)
}

.workspace-spark {
    margin-left: auto;
    color: var(--muted)
}

.nav-label {
    font-size: 10px;
    letter-spacing: 1.6px;
    color: #98a29b;
    margin: 0 14px 12px
}

nav {
    display: grid;
    gap: 7px
}

nav a {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    border-radius: 8px;
    color: #6e7b75;
    font-weight: 500
}

nav a:hover {
    background: var(--bg);
    text-decoration: none
}

nav a.active {
    background: var(--soft);
    color: var(--green);
    font-weight: 700
}

nav a span {
    font-size: 19px;
    width: 22px
}

.sidebar-bottom {
    margin-top: auto
}

.sidebar-note {
    padding: 19px 15px;
    background: #f5f8f1;
    border-radius: 12px;
    margin-bottom: 26px
}

.sidebar-note > span {
    display: block;
    font-size: 28px;
    color: #73886a;
    margin-bottom: 9px
}

.sidebar-note b {
    font-size: 12px
}

.sidebar-note p {
    font-size: 11px;
    color: #82907b;
    line-height: 1.9;
    margin: 9px 0 0
}

.local-note {
    border-top: 1px solid var(--line);
    padding-top: 22px;
    margin-top: 20px;
    font-size: 10px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px
}

.local-note i, .workspace-pill i {
    height: 6px;
    width: 6px;
    border-radius: 100%;
    background: #6aa47e
}

main {
    margin-left: 242px
}

.topbar {
    height: 80px;
    padding: 0 42px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted)
}

.breadcrumb span {
    padding: 0 12px;
    color: #bdc5bf
}

.breadcrumb b {
    color: #52645b;
    font-weight: 500
}

.workspace-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 11px
}

.avatar {
    display: grid;
    place-items: center;
    background: #eee9df;
    color: #887a61;
    border: 3px solid #fff;
    outline: 1px solid #ece9e1;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 11px;
    margin-left: 12px
}

.content {
    max-width: 1600px;
    margin: auto;
    padding: 37px 42px 0
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 27px
}

.eyebrow {
    font-size: 9px;
    letter-spacing: 1.9px;
    color: #8b968b;
    font-weight: 600;
    margin: 0
}

.page-heading .muted {
    font-size: 13px;
    margin-bottom: 0
}

.actions {
    display: flex;
    gap: 10px
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green);
    color: #fff;
    border: 1px solid var(--green);
    padding: 12px 17px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    gap: 6px;
    min-height: 40px
}

.button:hover {
    background: #115a46;
    text-decoration: none
}

.button.secondary {
    background: #fff;
    border-color: #dce4dd;
    color: #53685a
}

.button.secondary:hover {
    background: #eef4ef
}

.button.small {
    padding: 8px 13px;
    min-height: 34px;
    font-size: 11px
}

.month-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 12px
}

.month-picker input {
    width: 155px;
    background: #fff;
    padding: 8px 10px
}

.month-picker > .muted {
    margin-left: auto;
    font-size: 11px
}

.stats {
    display: grid;
    grid-template-columns:repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px
}

.stat {
    padding: 22px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px
}

.stat-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #76857b;
    font-size: 12px
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    border-radius: 8px;
    background: #edf5ed;
    color: #58836a;
    font-size: 18px
}

.peach {
    background: #fcf0e8;
    color: #ba8a6a
}

.lilac {
    background: #f0eef8;
    color: #8c7bb5
}

.stat strong {
    display: block;
    font-size: 30px;
    letter-spacing: -1.2px;
    margin: 13px 0
}

.stat small {
    font-size: 10px;
    color: #94a095
}

.stat.featured {
    background: #eaf2e7;
    border-color: #dce8d5
}

.featured .stat-icon {
    background: #dbe8d4;
    color: #638258
}

.featured .stat-label {
    color: #607a5e
}

.featured strong {
    color: #3c603b
}

.dashboard-grid {
    display: grid;
    grid-template-columns:1.45fr 1fr;
    gap: 23px
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 25px;
    margin-bottom: 24px;
    min-width: 0
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 22px
}

.panel-heading p {
    font-size: 11px;
    margin: 0
}

.panel-heading > a {
    font-size: 11px
}

.legend {
    display: flex;
    gap: 14px;
    font-size: 10px;
    color: var(--muted)
}

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

.legend i {
    width: 7px;
    height: 7px;
    border-radius: 50%
}

.income-dot {
    background: #74a68c
}

.expense-dot {
    background: #d7e4cf
}

.bar-chart {
    height: 243px;
    display: flex;
    gap: 12px;
    padding: 15px 0 0;
    background: repeating-linear-gradient(to top, transparent, transparent 49px, #f2f4f1 50px)
}

.bar-column {
    flex: 1;
    display: flex;
    align-items: center;
    flex-direction: column;
    min-width: 0
}

.bar-pair {
    height: 166px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    width: 65%;
    justify-content: center
}

.bar {
    width: 24px;
    max-width: 45%;
    border-radius: 5px 5px 0 0;
    min-height: 2px
}

.income-bar {
    background: #74a68c
}

.expense-bar {
    background: #d7e4cf
}

.bar-column > span {
    font-size: 10px;
    margin: 12px 0 6px;
    color: #829085
}

.bar-column small {
    font-size: 9px;
    line-height: 1.7
}

.category-row {
    margin-top: 19px
}

.category-row > div {
    display: flex;
    justify-content: space-between;
    font-size: 12px
}

.category-row b {
    font-size: 12px;
    font-weight: 550
}

.category-row small {
    font-size: 9px
}

progress {
    appearance: none;
    width: 100%;
    height: 7px;
    border: 0;
    border-radius: 20px;
    background: #f0f3ee;
    margin: 10px 0 3px;
    overflow: hidden
}

progress::-webkit-progress-bar {
    background: #f0f3ee;
    border-radius: 20px
}

progress::-webkit-progress-value {
    background: #78a68d;
    border-radius: 20px
}

progress::-moz-progress-bar {
    background: #78a68d
}

.category-row:nth-of-type(3n) progress::-webkit-progress-value {
    background: #bca485
}

.category-row:nth-of-type(3n + 1) progress::-webkit-progress-value {
    background: #a8a4c0
}

.insight {
    display: flex;
    align-items: center;
    gap: 17px;
    background: #f0f3e9;
    border: 1px solid #e2e8d9;
    border-radius: 9px;
    padding: 19px 23px;
    margin-bottom: 25px
}

.insight > span {
    font-size: 28px;
    color: #81916a
}

.insight b {
    font-size: 12px
}

.insight p {
    font-size: 11px;
    color: #8b947e;
    margin: 3px 0 0
}

.insight > a {
    margin-left: auto;
    font-size: 11px;
    white-space: nowrap
}

.tag {
    display: inline-block;
    background: #f4f6f1;
    border: 1px solid #e9ede5;
    color: #7b8b75;
    font-size: 10px;
    padding: 5px 9px;
    border-radius: 5px
}

.tag.over {
    background: #fff0e9;
    color: #b66c55
}

.table-wrap {
    overflow-x: auto
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    white-space: nowrap
}

th {
    text-align: left;
    font-size: 10px;
    font-weight: 500;
    color: #92a091;
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
    background: #fafbf8
}

td {
    padding: 17px 8px;
    border-bottom: 1px solid #f0f2ed
}

tbody tr:last-child td {
    border: 0
}

td b {
    font-weight: 500
}

.number {
    text-align: right
}

.money {
    font-family: Manrope, system-ui;
    font-size: 12px;
    font-weight: 650
}

.positive {
    color: var(--green)
}

.transaction-icon {
    display: inline-grid;
    place-items: center;
    width: 31px;
    height: 31px;
    background: #f3f5ef;
    border-radius: 9px;
    margin-right: 10px;
    font-size: 17px;
    color: #81916e
}

.block {
    display: block;
    margin-top: 4px;
    font-size: 10px
}

.row-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 10px
}

.text-button {
    background: none;
    border: 0;
    padding: 8px 0;
    color: var(--green);
    font-size: 12px
}

.danger {
    color: #b35e4b
}

.row-actions .text-button {
    font-size: 10px;
    padding: 0
}

.empty {
    text-align: center;
    padding: 44px 20px
}

.empty-symbol {
    display: block;
    font-size: 39px;
    color: #95ad95;
    margin-bottom: 12px
}

.empty h3 {
    font-size: 16px;
    margin: 8px
}

.empty p {
    font-size: 12px;
    color: var(--muted);
    max-width: 360px;
    margin: 8px auto 19px
}

.empty.compact {
    padding: 25px 10px
}

.empty.compact p {
    max-width: 220px
}

.empty.compact .empty-symbol {
    font-size: 62px
}

.split-grid {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 24px
}

.card-grid {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 24px
}

.card-grid .panel {
    height: fit-content
}

.card-grid h3 {
    font-size: 20px
}

.card-grid p {
    font-size: 12px
}

.soft {
    background: #edf3e8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 35px
}

.soft p {
    color: #819176;
    max-width: 380px
}

.goal-symbol {
    font-size: 32px;
    color: #86a07a
}

.stack {
    display: grid;
    gap: 17px;
    margin-top: 20px
}

.stack > .button {
    justify-self: start
}

.stack label {
    display: grid;
    gap: 8px;
    font-size: 12px;
    font-weight: 500
}

input, select {
    border: 1px solid #dfe5dc;
    background: #fcfdfb;
    color: var(--ink);
    border-radius: 6px;
    padding: 11px 12px;
    width: 100%;
    min-width: 0
}

input::placeholder {
    color: #a4ada3
}

input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--green)
}

.form-grid {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 17px
}

.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 15px
}

.filters input {
    flex: 1.3
}

.filters select {
    flex: 1
}

.filters input, .filters select {
    font-size: 11px;
    padding: 9px 8px
}

.notice {
    background: #e9f3e9;
    border: 1px solid #cfe3ce;
    padding: 13px 18px;
    border-radius: 8px;
    color: var(--green);
    margin-bottom: 20px
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--line);
    padding: 13px 0
}

.setting-row > label:first-child, .setting-row > input {
    flex: 1
}

.checkbox {
    display: flex !important;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px
}

.checkbox.bill-category-history {
    white-space: normal;
    align-items: flex-start;
}

.settings-intro {
    margin-bottom: 25px
}

.history-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 0;
    border-top: 1px solid var(--line)
}

.history-row > span:first-child {
    flex: 1
}

details {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--line);
    font-size: 12px
}

summary {
    cursor: pointer;
    color: var(--green)
}

footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding: 24px 0;
    color: #a0aa9c;
    font-size: 10px;
    margin-top: 15px
}

dialog {
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 29px;
    width: min(550px, 95vw);
    color: var(--ink);
    box-shadow: 0 25px 100px #17352626
}

dialog::backdrop {
    background: #18342b66;
    backdrop-filter: blur(4px)
}

.dialog-heading {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.dialog-heading h2 {
    font-size: 24px;
    margin-top: 8px
}

.close {
    border: 0;
    background: #f2f5ef;
    color: #748470;
    font-size: 24px;
    width: 34px;
    height: 34px;
    border-radius: 50%
}

.import-steps {
    display: flex;
    gap: 15px;
    margin: 25px 0;
    font-size: 12px
}

.import-steps span {
    padding: 10px 17px;
    color: var(--muted)
}

.import-steps .current {
    background: #e6f0e7;
    color: var(--green);
    border-radius: 6px
}

.upload-area {
    max-width: 550px;
    text-align: center;
    margin: 35px auto
}

.upload-area .stack {
    text-align: left;
    margin-top: 30px
}

.upload-area .button {
    justify-self: stretch
}

.import-options {
    max-width: 500px;
    margin: 25px 0 0
}

.error-page {
    margin: 10vh auto;
    padding: 20px;
    max-width: 650px
}

.error-page h1 {
    font-size: 28px
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0)
}

@media (min-width: 1600px) {
    .content {
        padding-top: 48px
    }

    .stats {
        gap: 24px
    }

    .stat {
        padding: 26px
    }

    .stat strong {
        font-size: 36px
    }

    .bar-chart {
        height: 280px
    }

    .bar-pair {
        height: 200px
    }
}

@media (max-width: 1200px) {
    .sidebar {
        width: 210px;
        padding: 27px 15px
    }

    main {
        margin-left: 210px
    }

    .content {
        padding: 30px 25px 0
    }

    .topbar {
        padding: 0 25px
    }

    .page-heading {
        align-items: flex-start
    }

    .actions {
        flex-direction: column
    }

    .stats {
        gap: 12px
    }

    .stat {
        padding: 16px
    }

    .stat strong {
        font-size: 25px
    }

    .stat small {
        font-size: 9px
    }

    .dashboard-grid {
        grid-template-columns:1.2fr 1fr
    }

    .panel {
        padding: 20px
    }

    .card-grid {
        grid-template-columns:repeat(2, 1fr)
    }

    .filters {
        flex-wrap: wrap
    }

    .filters > * {
        min-width: 100px
    }

    .legend {
        gap: 8px
    }
}

@media (max-width: 850px) {
    .sidebar {
        width: 75px;
        padding: 25px 10px
    }

    .brand {
        justify-content: center
    }

    .brand > span:last-child, .workspace-label, .nav-label, .sidebar-note, .local-note {
        display: none
    }

    .brand-mark {
        width: 38px;
        flex-shrink: 0
    }

    nav {
        margin-top: 30px
    }

    nav a {
        font-size: 0;
        justify-content: center;
        padding: 13px 6px
    }

    nav a span {
        font-size: 22px;
        text-align: center
    }

    .sidebar-bottom nav {
        margin-top: 0
    }

    main {
        margin-left: 75px
    }

    .workspace-pill {
        font-size: 0
    }

    .dashboard-grid {
        grid-template-columns:1fr
    }

    .stats {
        grid-template-columns:repeat(2, 1fr)
    }

    .page-heading h1 {
        font-size: 29px
    }

    .split-grid {
        grid-template-columns:1fr
    }

    .split-grid > .panel {
        margin-bottom: 0
    }

    .split-grid {
        margin-bottom: 24px
    }

    .insight {
        flex-wrap: wrap
    }

    .insight > a {
        margin-left: 44px
    }

    .card-grid {
        gap: 15px
    }

    .panel-heading {
        flex-wrap: wrap
    }

    .bar-pair {
        max-width: 65px
    }

    .bar-chart {
        height: 270px
    }

    .bar-pair {
        height: 190px
    }
}

@media (max-width: 560px) {
    .sidebar {
        position: fixed;
        inset: auto 0 0;
        width: 100%;
        height: 67px;
        border-right: 0;
        border-top: 1px solid var(--line);
        padding: 5px 8px;
        display: block
    }

    .brand, .sidebar-bottom {
        display: none
    }

    .sidebar > nav {
        display: flex;
        margin: 0;
        justify-content: space-around;
        gap: 0
    }

    .sidebar > nav a {
        font-size: 9px;
        display: flex;
        flex-direction: column;
        gap: 3px;
        padding: 5px 10px
    }

    .sidebar > nav a span {
        font-size: 20px
    }

    .sidebar > nav::after {
        content: ''
    }

    main {
        margin-left: 0;
        padding-bottom: 75px
    }

    .topbar {
        height: 58px;
        padding: 0 18px;
        font-size: 10px
    }

    .breadcrumb span {
        padding: 0 6px
    }

    .avatar {
        width: 28px;
        height: 28px;
        margin-left: 2px
    }

    .content {
        padding: 24px 16px 0
    }

    .page-heading {
        display: block
    }

    .page-heading h1 {
        font-size: 29px
    }

    .page-heading .muted {
        font-size: 12px
    }

    .actions {
        flex-direction: row;
        margin-top: 20px
    }

    .actions .button {
        flex: 1
    }

    .stats {
        gap: 10px
    }

    .stat {
        padding: 15px 13px
    }

    .stat strong {
        font-size: 25px
    }

    .stat-label {
        font-size: 11px
    }

    .stat-icon {
        width: 23px;
        height: 23px
    }

    .stat small {
        font-size: 9px
    }

    .panel {
        padding: 19px 16px
    }

    .month-picker > .muted {
        display: none
    }

    .insight {
        padding: 17px
    }

    .insight p {
        font-size: 10px
    }

    .insight > div {
        flex: 1
    }

    .card-grid {
        grid-template-columns:1fr
    }

    .setting-row {
        gap: 9px
    }

    .setting-row .checkbox {
        font-size: 10px
    }

    .setting-row input {
        font-size: 12px
    }

    .form-grid {
        gap: 12px
    }

    .history-row {
        gap: 10px;
        font-size: 11px;
        flex-wrap: wrap
    }

    footer {
        font-size: 8px
    }

    .import-steps {
        gap: 0
    }

    .import-steps span {
        padding: 10px;
        font-size: 11px
    }

    .eyebrow {
        font-size: 8px;
        letter-spacing: 1.5px
    }

    .workspace-pill {
        gap: 0
    }

    .topbar > a {
        font-size: 10px
    }

    .filters input {
        flex-basis: 100%
    }

    .filters select {
        flex-basis: 40%
    }
}

@media (prefers-reduced-motion: no-preference) {
    .button, nav a {
        transition: background .15s ease
    }

    .bar {
        animation: rise .5s ease-out;
        transform-origin: bottom
    }

    @keyframes rise {
        from {
            transform: scaleY(0)
        }
        to {
            transform: scaleY(1)
        }
    }
}

.mobile-settings {
    display: none
}

@media (max-width: 560px) {
    nav a.mobile-settings {
        display: flex
    }
}

.auth-page .auth-content {
    margin: 0 auto;
    padding: 40px 16px;
    max-width: 510px;
    width: 100%;
    min-height: 100dvh;
    display: flex;
    align-items: center
}

.auth-content > .panel {
    width: 100%
}

.auth-content .stack > .button {
    justify-self: stretch
}

.auth-content small {
    line-height: 1.6
}

@media (max-width: 560px) {
    .auth-page .auth-content {
        padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left))
    }
}

/* Keep intrinsic content from forcing cards and flex rows wider than the viewport. */
.stats > *, .form-grid > *, .page-heading > *, .panel-heading > *, .setting-row > * {
    min-width: 0
}

.panel h2, .panel h3, .stat strong, .category-row > div, .history-row, .notice, .page-heading {
    overflow-wrap: anywhere
}

.category-row > div {
    gap: 12px;
    flex-wrap: wrap
}

.actions {
    flex-shrink: 0
}

.table-wrap {
    max-width: 100%;
    overscroll-behavior-x: contain
}

.table-scroll-hint {
    display: none
}

dialog {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain
}

.close {
    flex-shrink: 0
}

body:has(dialog[open]) {
    overflow: hidden
}

.error-page {
    width: 100%
}

@media (max-width: 850px) {
    .button, .button.small, .text-button, .close {
        min-height: 44px
    }

    .close {
        width: 44px;
        height: 44px
    }

    .row-actions > a, .row-actions .text-button {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0 10px
    }

    .row-actions {
        gap: 4px
    }

    .checkbox {
        min-height: 44px;
        white-space: normal
    }

    .checkbox input {
        flex-shrink: 0
    }

    summary {
        min-height: 44px;
        padding: 12px 0
    }

    .sidebar {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        overflow-y: auto
    }

    .topbar {
        height: auto;
        min-height: 58px;
        gap: 12px;
        flex-wrap: wrap;
        padding-top: 10px;
        padding-bottom: 10px
    }

    .topbar > a {
        display: inline-flex;
        align-items: center;
        min-height: 44px
    }

    .bar-column small {
        max-width: 100%;
        overflow-wrap: anywhere;
        text-align: center
    }

    .bar-chart {
        height: auto;
        min-height: 270px;
        padding-bottom: 12px
    }

    .table-wrap[data-overflow="true"] + .table-scroll-hint {
        display: block;
        font-size: 12px;
        color: var(--muted);
        margin: 10px 0 0
    }
}

@media (max-width: 560px) {
    .sidebar {
        height: calc(67px + env(safe-area-inset-bottom));
        padding: 5px max(4px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
        overflow: visible
    }

    .sidebar > nav {
        display: grid;
        grid-template-columns:repeat(6, minmax(0, 1fr))
    }

    .sidebar > nav::after {
        content: none
    }

    .sidebar > nav a {
        min-width: 0;
        min-height: 54px;
        padding: 5px 1px;
        font-size: 9px;
        justify-content: center;
        text-align: center;
        line-height: 1.3
    }

    main {
        padding-bottom: calc(87px + env(safe-area-inset-bottom))
    }

    .content {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right))
    }

    .topbar {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-top: max(10px, env(safe-area-inset-top))
    }

    .breadcrumb {
        flex: 1;
        min-width: 0
    }

    .workspace-pill {
        flex-shrink: 0
    }

    .actions {
        flex-wrap: wrap
    }

    .actions .button {
        flex: 1 1 125px
    }

    .button {
        white-space: normal;
        text-align: center;
        max-width: 100%
    }

    .page-heading > .button {
        margin-top: 20px
    }

    .month-picker {
        flex-wrap: wrap
    }

    .month-picker input {
        flex: 1;
        max-width: 180px
    }

    .form-grid {
        grid-template-columns:minmax(0, 1fr)
    }

    input, select, .filters input, .filters select, .setting-row input {
        font-size: 16px;
        min-height: 44px;
        max-width: 100%
    }

    input[type=checkbox] {
        min-height: 0
    }

    input[type=file] {
        overflow: hidden
    }

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

    .filters input:not([type=hidden]), .filters .button {
        grid-column: 1/-1
    }

    .filters > * {
        min-width: 0
    }

    .setting-row {
        flex-wrap: wrap;
        gap: 8px 12px
    }

    .setting-row > label:first-child {
        flex: 1 1 100%
    }

    .setting-row > .checkbox {
        flex: 1;
        font-size: 12px
    }

    .setting-row > input:not([type=hidden]) {
        flex: 1 1 150px
    }

    .setting-row > .button {
        margin-left: auto
    }

    .stat strong {
        font-size: clamp(20px, 5.5vw, 25px);
        letter-spacing: -.6px
    }

    .stat-icon {
        flex-shrink: 0
    }

    .stat-label {
        gap: 5px
    }

    .bar-chart {
        gap: 5px
    }

    .bar-pair {
        gap: 3px
    }

    .insight > div {
        min-width: 0
    }

    .import-steps {
        display: grid;
        grid-template-columns:repeat(3, minmax(0, 1fr));
        text-align: center
    }

    .import-steps span {
        padding: 10px 5px
    }

    .import-options .checkbox {
        align-items: flex-start
    }

    .import-options .checkbox input {
        margin-top: 3px
    }

    dialog {
        width: calc(100% - 24px);
        max-width: 550px;
        padding: 20px 16px;
        max-height: calc(100dvh - 24px)
    }

    .dialog-heading {
        gap: 10px
    }

    .dialog-heading h2 {
        font-size: 22px
    }

    footer {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 10px
    }

    .error-page {
        margin: 5vh auto;
        padding: 16px max(16px, env(safe-area-inset-left))
    }

    .error-page .button {
        margin-top: 8px
    }
}

.site-footer {
    flex-wrap: wrap;
    gap: 10px
}

.company-credit {
    margin-left: auto
}

.auth-content {
    flex-direction: column;
    justify-content: center;
    align-items: stretch
}

.auth-content .site-footer {
    margin-top: 0
}

.auth-content .company-credit, .error-page .company-credit {
    margin-right: auto
}
