:root {
    color-scheme: light;
    --ink: #17332a;
    --ink-soft: #52675f;
    --paper: #f4f2eb;
    --surface: #fffefa;
    --surface-muted: #ecebe4;
    --line: #deddd5;
    --primary: #247154;
    --primary-dark: #17513b;
    --primary-soft: #dcece4;
    --expense: #b95642;
    --income: #247154;
    --transfer: #6872a7;
    --warning: #b77a16;
    --danger: #ad4138;
    --shadow: 0 18px 45px rgba(29, 52, 43, .08);
    --radius-xl: 26px;
    --radius-lg: 19px;
    --radius-md: 14px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 8% -10%, rgba(60, 137, 103, .15), transparent 30rem),
        var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

body,
button,
input,
select,
textarea {
    font: inherit;
}

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

button,
a {
    touch-action: manipulation;
}

button {
    color: inherit;
}

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

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3,
strong,
b {
    letter-spacing: -.025em;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(1.85rem, 7vw, 2.65rem);
    line-height: 1.05;
    outline: none;
}

h2 {
    margin-bottom: 0;
    font-size: 1.28rem;
}

h3 {
    margin-bottom: .25rem;
    font-size: 1rem;
}

p {
    color: var(--ink-soft);
    line-height: 1.55;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(36, 113, 84, .24);
    outline-offset: 2px;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 66px;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(222, 221, 213, .76);
    background: rgba(244, 242, 235, .88);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--ink);
    font-weight: 760;
    letter-spacing: -.035em;
}

.brand-mark,
.avatar-button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    background: var(--ink);
    color: white;
    font-size: .85rem;
    font-weight: 800;
}

.avatar-button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.connection-pill,
.status-badge,
.local-badge {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    padding: .38rem .65rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 254, 250, .78);
    color: var(--ink-soft);
    font-size: .72rem;
    font-weight: 700;
}

.connection-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #39a678;
    box-shadow: 0 0 0 4px rgba(57, 166, 120, .13);
}

.connection-pill.is-offline {
    color: #8a5b12;
    border-color: #e2ca9e;
    background: #fff6e5;
}

.connection-pill.is-offline .connection-dot {
    background: #d8972b;
    box-shadow: 0 0 0 4px rgba(216, 151, 43, .13);
}

.page-container {
    width: min(100%, 980px);
    min-height: calc(100vh - 66px);
    margin: 0 auto;
    padding: 1.45rem 1rem 7.5rem;
}

.bottom-nav {
    position: fixed;
    z-index: 25;
    right: .75rem;
    bottom: max(.7rem, env(safe-area-inset-bottom));
    left: .75rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 560px;
    margin: 0 auto;
    padding: .42rem;
    border: 1px solid rgba(222, 221, 213, .9);
    border-radius: 22px;
    background: rgba(255, 254, 250, .94);
    box-shadow: 0 15px 45px rgba(23, 51, 42, .16);
    backdrop-filter: blur(22px);
}

.bottom-nav a {
    display: flex;
    min-height: 54px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    border-radius: 16px;
    color: #718078;
    font-size: .67rem;
    font-weight: 680;
}

.bottom-nav a.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.nav-icon {
    min-height: 20px;
    font-size: 1.17rem;
    line-height: 1;
}

.page-heading,
.editor-heading,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.page-heading {
    margin: .5rem 0 1.4rem;
}

.home-heading {
    align-items: flex-end;
}

.compact-heading {
    min-height: 65px;
}

.eyebrow {
    margin-bottom: .38rem;
    color: var(--primary);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.balance-card {
    overflow: hidden;
    margin-bottom: 1rem;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at 88% 5%, rgba(255, 255, 255, .17), transparent 12rem),
        var(--ink);
    box-shadow: var(--shadow);
    color: white;
}

.balance-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.45rem 1.35rem 1.3rem;
}

.balance-card-top span:first-child {
    display: block;
    margin-bottom: .35rem;
    color: rgba(255, 255, 255, .68);
    font-size: .77rem;
}

.balance-card-top strong {
    display: block;
    font-size: clamp(2rem, 10vw, 3.2rem);
    line-height: 1;
}

.local-badge {
    flex: 0 0 auto;
    border-color: rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .8);
}

.balance-card-bottom {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(255, 255, 255, .1);
}

.balance-card-bottom > div {
    min-width: 0;
    padding: .95rem .65rem;
    background: rgba(255, 255, 255, .055);
    text-align: center;
}

.balance-card-bottom small,
.balance-card-bottom span {
    display: block;
}

.balance-card-bottom small {
    overflow: hidden;
    margin-bottom: .28rem;
    color: rgba(255, 255, 255, .6);
    font-size: .62rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.balance-card-bottom span {
    overflow: hidden;
    font-size: .77rem;
    font-weight: 720;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.balance-card-bottom .positive {
    color: #89d8b3;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: .65rem;
    margin-bottom: 2rem;
}

.quick-action {
    display: flex;
    min-width: 0;
    min-height: 128px;
    flex-direction: column;
    align-items: flex-start;
    padding: .9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 8px 24px rgba(23, 51, 42, .04);
}

.quick-action > span {
    display: grid;
    width: 32px;
    height: 32px;
    margin-bottom: auto;
    place-items: center;
    border-radius: 10px;
    background: var(--surface-muted);
    color: var(--primary);
    font-size: 1.2rem;
}

.quick-action strong {
    margin-top: .75rem;
    font-size: .82rem;
    line-height: 1.15;
}

.quick-action small {
    display: none;
    margin-top: .22rem;
    color: var(--ink-soft);
    font-size: .66rem;
}

.quick-action.primary-action {
    border-color: transparent;
    background: var(--primary);
    color: white;
}

.quick-action.primary-action > span {
    background: rgba(255, 255, 255, .14);
    color: white;
}

.quick-action.primary-action small {
    color: rgba(255, 255, 255, .68);
}

.section-block {
    margin-top: 2rem;
}

.section-heading {
    margin-bottom: .85rem;
}

.section-heading a,
.text-button {
    border: 0;
    background: none;
    color: var(--primary);
    font-size: .76rem;
    font-weight: 760;
    cursor: pointer;
}

.account-strip {
    display: grid;
    grid-auto-columns: minmax(190px, 64%);
    grid-auto-flow: column;
    gap: .7rem;
    overflow-x: auto;
    padding: .1rem .1rem .5rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.account-strip::-webkit-scrollbar {
    display: none;
}

.account-mini-card {
    position: relative;
    display: flex;
    min-height: 126px;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    scroll-snap-align: start;
}

.account-mini-card::after {
    position: absolute;
    top: -35px;
    right: -35px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--account-color);
    content: "";
    opacity: .12;
}

.account-color {
    width: 22px;
    height: 5px;
    margin-bottom: .75rem;
    border-radius: 999px;
    background: var(--account-color);
}

.account-mini-card small {
    color: var(--ink-soft);
    font-size: .65rem;
}

.account-mini-card strong {
    margin: .1rem 0 auto;
    font-size: .9rem;
}

.account-mini-card b {
    margin-top: .7rem;
    font-size: 1.15rem;
}

.card-list,
.settings-list,
.action-card-list {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.movement-row {
    display: flex;
    min-width: 0;
    border-bottom: 1px solid var(--line);
}

.movement-row:last-child {
    border-bottom: 0;
}

.movement-main {
    display: grid;
    min-width: 0;
    flex: 1;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: .7rem;
    padding: .82rem .8rem;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.movement-main:hover {
    background: rgba(236, 235, 228, .5);
}

.movement-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--movement-color) 14%, white);
    color: var(--movement-color);
    font-size: 1rem;
    font-weight: 800;
}

.movement-copy {
    min-width: 0;
}

.movement-copy strong,
.movement-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.movement-copy strong {
    margin-bottom: .2rem;
    font-size: .84rem;
}

.movement-copy small {
    color: var(--ink-soft);
    font-size: .67rem;
}

.movement-amount {
    font-size: .79rem;
    font-weight: 760;
    white-space: nowrap;
}

.movement-amount.is-income {
    color: var(--income);
}

.movement-amount.is-expense {
    color: var(--expense);
}

.movement-amount.is-transfer {
    color: var(--transfer);
}

.icon-button {
    display: grid;
    width: 40px;
    min-width: 40px;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}

.icon-button:disabled {
    cursor: not-allowed;
    opacity: .3;
}

.danger-on-hover:hover {
    background: #faece9;
    color: var(--danger);
}

.empty-card,
.state-card {
    padding: 1.5rem;
    border: 1px dashed #c9c8be;
    border-radius: var(--radius-lg);
    background: rgba(255, 254, 250, .58);
    text-align: center;
}

.empty-card > span {
    display: grid;
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    place-items: center;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.25rem;
}

.empty-card p {
    max-width: 34rem;
    margin: .4rem auto 1.1rem;
    font-size: .82rem;
}

.large-empty {
    margin-top: 2rem;
    padding: 3.5rem 1.2rem;
}

.not-found {
    margin-top: 10vh;
}

.state-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    text-align: left;
}

.state-card p {
    margin: .2rem 0 0;
    font-size: .78rem;
}

.spinner {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 3px solid var(--primary-soft);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.state-symbol {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: #fae9e6;
    color: var(--danger);
    font-weight: 800;
}

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

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: .7rem 1rem;
    border: 1px solid transparent;
    border-radius: 13px;
    font-size: .76rem;
    font-weight: 780;
    cursor: pointer;
}

.button.primary {
    background: var(--primary);
    color: white;
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.secondary {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.button.ghost {
    background: transparent;
    color: var(--ink-soft);
}

.button.danger {
    border-color: #edc6c0;
    background: #fff5f3;
    color: var(--danger);
}

.button.compact {
    min-height: 38px;
    padding: .55rem .8rem;
}

.button.wide {
    width: 100%;
}

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

.fab {
    position: fixed;
    z-index: 24;
    right: 1rem;
    bottom: calc(max(.7rem, env(safe-area-inset-bottom)) + 76px);
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 18px;
    background: var(--primary);
    box-shadow: 0 12px 28px rgba(36, 113, 84, .32);
    color: white;
    font-size: 1.6rem;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1rem;
    padding: .2rem .7rem;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
}

.search-bar > span {
    color: var(--ink-soft);
    font-size: 1.15rem;
}

.search-bar input {
    width: 100%;
    min-height: 46px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: .8rem;
}

.search-bar button {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}

.movement-page-list {
    margin-bottom: 1rem;
}

.toast {
    position: fixed;
    z-index: 40;
    right: 1rem;
    bottom: calc(max(.7rem, env(safe-area-inset-bottom)) + 82px);
    left: 1rem;
    display: flex;
    max-width: 430px;
    min-height: 52px;
    align-items: center;
    gap: .8rem;
    margin: auto;
    padding: .65rem .75rem .65rem 1rem;
    border-radius: 15px;
    background: var(--ink);
    box-shadow: var(--shadow);
    color: white;
    font-size: .78rem;
}

.toast span {
    flex: 1;
}

.toast button {
    border: 0;
    background: transparent;
    color: #9bd9bc;
    font-size: .73rem;
    font-weight: 800;
    cursor: pointer;
}

.toast .toast-close {
    color: rgba(255, 255, 255, .6);
    font-size: 1.1rem;
}

.editor-heading {
    justify-content: flex-start;
    margin: .45rem 0 1.25rem;
}

.back-button {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
}

.movement-form {
    max-width: 670px;
    margin: 0 auto;
}

.segment-control,
.tab-control {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .3rem;
    margin-bottom: 1.2rem;
    padding: .3rem;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-muted);
}

.segment-control button,
.tab-control button {
    min-height: 40px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--ink-soft);
    font-size: .73rem;
    font-weight: 730;
    cursor: pointer;
}

.segment-control button.active,
.tab-control button.active {
    background: var(--surface);
    box-shadow: 0 3px 10px rgba(23, 51, 42, .08);
    color: var(--ink);
}

.tab-control {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 1.3rem;
}

.amount-field {
    display: flex;
    max-width: 460px;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: 1.7rem auto;
}

.amount-field span {
    color: var(--ink-soft);
    font-size: 1.7rem;
}

.amount-field input {
    width: min(80%, 330px);
    border: 0;
    border-bottom: 2px solid var(--line);
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: clamp(2.4rem, 13vw, 4.2rem);
    font-weight: 750;
    letter-spacing: -.06em;
    text-align: center;
}

.amount-field input:focus {
    border-bottom-color: var(--primary);
}

.form-card,
.inline-editor {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.field-group {
    display: block;
    margin-bottom: .9rem;
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-group > span {
    display: flex;
    justify-content: space-between;
    margin-bottom: .38rem;
    color: var(--ink-soft);
    font-size: .68rem;
    font-weight: 700;
}

.field-group > span small {
    font-size: .62rem;
    font-weight: 500;
}

.field-group input,
.field-group select,
.field-group textarea {
    width: 100%;
    min-height: 47px;
    padding: .7rem .75rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    background: #faf9f4;
    color: var(--ink);
    font-size: .79rem;
}

.field-group textarea {
    resize: vertical;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(36, 113, 84, .09);
}

.validation-message,
.inline-error {
    display: block;
    margin-top: .35rem;
    color: var(--danger);
    font-size: .68rem;
}

.invalid {
    border-color: var(--danger) !important;
}

.editor-actions {
    display: grid;
    gap: .6rem;
    margin-top: 1rem;
}

.settings-section {
    margin-top: 0;
}

.inline-editor {
    margin-bottom: 1rem;
    background: rgba(255, 254, 250, .78);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 .7rem;
}

.field-wide {
    grid-column: 1 / -1;
}

.color-field input[type="color"] {
    padding: .3rem;
}

.settings-list {
    border-radius: var(--radius-lg);
}

.account-row {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto 40px;
    align-items: center;
    gap: .75rem;
    min-height: 72px;
    padding: .65rem .45rem .65rem .85rem;
    border-bottom: 1px solid var(--line);
}

.account-row:last-child {
    border-bottom: 0;
}

.account-row.is-archived {
    opacity: .55;
}

.account-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.account-row strong,
.account-row small {
    display: block;
}

.account-row strong {
    font-size: .83rem;
}

.account-row small {
    margin-top: .15rem;
    color: var(--ink-soft);
    font-size: .65rem;
}

.account-row b {
    font-size: .77rem;
    white-space: nowrap;
}

.category-columns {
    display: grid;
    gap: 1.3rem;
}

.category-columns h3 {
    margin: 0 0 .55rem .15rem;
    color: var(--ink-soft);
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.category-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
}

.category-item {
    display: grid;
    min-width: 0;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: .55rem;
    padding: .65rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.category-item > span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    background: color-mix(in srgb, var(--category-color) 14%, white);
    color: var(--category-color);
    font-weight: 800;
}

.category-item strong {
    overflow: hidden;
    font-size: .73rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-item small {
    color: var(--ink-soft);
    font-size: .58rem;
}

.vault-hero,
.cloud-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.vault-symbol,
.cloud-mark {
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    border-radius: 18px;
    background: var(--ink);
    color: white;
    font-size: 1.45rem;
}

.vault-hero h2,
.cloud-card h2 {
    font-size: 1.05rem;
}

.vault-hero p,
.cloud-card p {
    margin-bottom: 0;
    font-size: .72rem;
}

.status-badge.good {
    border-color: #bedccc;
    background: #edf8f2;
    color: var(--primary);
}

.status-badge.warning {
    border-color: #e2ca9e;
    background: #fff6e5;
    color: #8a5b12;
}

.vault-grid {
    display: grid;
    gap: .7rem;
    margin-top: .8rem;
}

.info-card {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 254, 250, .68);
}

.info-icon,
.action-symbol {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
}

.info-card small,
.info-card strong {
    display: block;
}

.info-card small {
    margin-bottom: .15rem;
    color: var(--ink-soft);
    font-size: .62rem;
}

.info-card strong {
    font-size: .88rem;
}

.info-card p {
    margin: .25rem 0 0;
    font-size: .68rem;
}

.action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem;
    border-bottom: 1px solid var(--line);
}

.action-card:last-child {
    border-bottom: 0;
}

.action-card > div:first-child {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .75rem;
}

.action-card h3 {
    margin-bottom: .15rem;
    font-size: .83rem;
}

.action-card p {
    margin-bottom: 0;
    font-size: .66rem;
}

.file-button {
    position: relative;
    overflow: hidden;
}

.file-button input {
    position: absolute;
    inset: 0;
    width: 100%;
    cursor: pointer;
    opacity: 0;
}

.confirm-card {
    margin-top: .8rem;
    padding: 1rem;
    border: 1px solid #e7c2bb;
    border-radius: var(--radius-lg);
    background: #fff8f6;
}

.confirm-card p {
    margin: .3rem 0 .8rem;
    font-size: .72rem;
}

.confirm-card > div:last-child {
    display: flex;
    gap: .45rem;
}

.success-message {
    margin: .75rem 0 0;
    padding: .7rem .8rem;
    border-radius: 12px;
    background: #eaf6ef;
    color: var(--primary-dark);
    font-size: .72rem;
}

.cloud-card {
    margin-top: 2rem;
    box-shadow: none;
    background: linear-gradient(135deg, #e8eef7, #f7f9fc);
}

.cloud-panel {
    margin-top: 2rem;
    overflow: hidden;
    border: 1px solid #cfd8e4;
    border-radius: var(--radius-xl);
    background: linear-gradient(145deg, #edf3fa, #fffefa 64%);
}

.cloud-panel-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem;
}

.cloud-panel-header h2 {
    margin-bottom: .15rem;
    font-size: 1.08rem;
}

.cloud-panel-header p {
    margin-bottom: 0;
    font-size: .7rem;
}

.cloud-panel-body {
    padding: 1rem 1.15rem 1.15rem;
    border-top: 1px solid rgba(173, 189, 205, .55);
    background: rgba(255, 254, 250, .72);
}

.cloud-setup {
    display: grid;
    gap: 1rem;
}

.setup-copy p,
.setup-copy li,
.setup-copy a {
    font-size: .72rem;
    line-height: 1.5;
}

.setup-copy ol {
    margin: .7rem 0;
    padding-left: 1.2rem;
    color: var(--ink-soft);
}

.setup-copy li + li {
    margin-top: .3rem;
}

.cloud-config-form {
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.redirect-code {
    display: block;
    padding: .7rem;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #f5f4ef;
    font-size: .65rem;
    line-height: 1.45;
    user-select: all;
}

.cloud-connect {
    display: grid;
    gap: .9rem;
}

.cloud-connect p {
    margin: .25rem 0;
    font-size: .72rem;
}

.cloud-connect small {
    color: var(--ink-soft);
    font-size: .64rem;
}

.cloud-actions,
.cloud-primary-actions,
.cloud-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.cloud-account-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .8rem;
}

.account-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    background: #446d9b;
    color: white;
    font-size: .75rem;
    font-weight: 800;
}

.cloud-account-row strong,
.cloud-account-row small {
    display: block;
}

.cloud-account-row strong {
    font-size: .78rem;
}

.cloud-account-row small {
    margin-top: .12rem;
    color: var(--ink-soft);
    font-size: .64rem;
}

.sync-status-card {
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.sync-status-card strong {
    font-size: .78rem;
}

.sync-status-card p {
    margin: .28rem 0 0;
    font-size: .68rem;
}

.sync-status-card.good-card {
    border-color: #bedccc;
    background: #edf8f2;
}

.sync-status-card.warning-card {
    border-color: #e2ca9e;
    background: #fff8e9;
}

.sync-status-card.danger-card {
    border-color: #e7c2bb;
    background: #fff5f3;
}

.sync-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
    margin: .7rem 0;
}

.sync-meta-grid > div {
    min-width: 0;
    padding: .7rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.sync-meta-grid small,
.sync-meta-grid strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-meta-grid small {
    margin-bottom: .18rem;
    color: var(--ink-soft);
    font-size: .58rem;
}

.sync-meta-grid strong {
    font-size: .68rem;
}

.cloud-primary-actions {
    margin-top: .75rem;
}

.cloud-confirm {
    margin-top: 1rem;
}

.cloud-footer-actions {
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: .7rem;
    border-top: 1px solid var(--line);
}

.text-button.muted {
    color: var(--ink-soft);
}

.cloud-message {
    margin: 0 1.15rem 1.15rem;
}

.cloud-mark {
    background: #446d9b;
}

code {
    color: var(--primary-dark);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

#blazor-error-ui {
    position: fixed;
    z-index: 1000;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    display: none;
    max-width: 650px;
    margin: auto;
    padding: .85rem 2.5rem .85rem 1rem;
    border-radius: 14px;
    background: #8f322d;
    box-shadow: var(--shadow);
    color: white;
    font-size: .75rem;
}

#blazor-error-ui a {
    color: white;
    font-weight: 800;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: .55rem;
    right: .8rem;
    cursor: pointer;
    font-size: 1.1rem;
}

.blazor-error-boundary {
    padding: 1rem;
    border-radius: 14px;
    background: #8f322d;
    color: white;
}

.blazor-error-boundary::after {
    content: "Si è verificato un errore.";
}

.loading-progress {
    position: absolute;
    inset: 25vh 0 auto;
    display: block;
    width: 5rem;
    height: 5rem;
    margin: auto;
}

.loading-progress circle {
    fill: none;
    stroke: #d5ddd7;
    stroke-width: .55rem;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.loading-progress circle:last-child {
    stroke: var(--primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * .8), 500%;
    transition: stroke-dasharray .08s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    inset: calc(25vh + 2.05rem) 0 auto;
    text-align: center;
    font-size: .65rem;
    font-weight: 800;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Apro");
}

@media (min-width: 560px) {
    .page-container,
    .topbar {
        padding-right: 1.5rem;
        padding-left: 1.5rem;
    }

    .quick-action small {
        display: block;
    }

    .account-strip {
        grid-auto-columns: minmax(210px, 38%);
    }

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

    .form-card {
        padding: 1.25rem;
    }

    .editor-actions {
        grid-template-columns: 1fr auto;
    }

    .editor-actions .danger {
        width: auto;
    }

    .cloud-setup,
    .cloud-connect {
        grid-template-columns: minmax(0, 1fr) minmax(260px, .8fr);
        align-items: start;
    }

    .cloud-connect .cloud-actions {
        justify-content: flex-end;
    }
}

@media (min-width: 820px) {
    .page-container {
        padding-top: 2rem;
    }

    .topbar {
        width: min(100%, 980px);
        margin: auto;
        border-right: 1px solid rgba(222, 221, 213, .4);
        border-left: 1px solid rgba(222, 221, 213, .4);
    }

    .home-heading {
        margin-top: 1rem;
    }

    .balance-card-top {
        padding: 2rem 1.8rem 1.7rem;
    }

    .balance-card-bottom > div {
        padding: 1.1rem;
    }

    .quick-actions {
        gap: .85rem;
    }

    .quick-action {
        min-height: 145px;
        padding: 1.1rem;
    }

    .quick-action strong {
        font-size: .92rem;
    }

    .movement-main {
        padding: .9rem 1rem;
    }

    .fab {
        right: max(1.5rem, calc((100vw - 980px) / 2 + 1.5rem));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
