/* ==========================================================================
   WalletManager — design tokens
   Income/expense hues mirror WalletManager/DesignSystem/Theme.swift so the
   web portal and the iOS app read the same way.
   ========================================================================== */

:root {
    /* Surfaces */
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e8eaf1;
    --border-strong: #d8dce8;

    /* Text */
    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    /* Brand */
    --brand: #667eea;
    --brand-strong: #5b4bd6;
    --brand-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --brand-soft: rgba(102, 126, 234, 0.10);
    --brand-ring: rgba(102, 126, 234, 0.22);

    /* Semantic */
    --income: #21a86b;
    --income-soft: #e7f6ee;
    --expense: #db4545;
    --expense-soft: #fdecec;
    --info: #2563eb;
    --info-soft: #e8f0fe;
    --warn: #ea580c;
    --warn-soft: #fdeee2;

    /* Shape */
    --r-card: 16px;
    --r-control: 10px;
    --r-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.06), 0 2px 4px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 18px 40px rgba(16, 24, 40, 0.14);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ==========================================================================
   Base
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 420px at 12% -8%, rgba(102, 126, 234, 0.13), transparent 60%),
        radial-gradient(760px 380px at 92% -12%, rgba(118, 75, 162, 0.11), transparent 60%);
    background-repeat: no-repeat;
    min-height: 100vh;
    padding: 20px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.icon {
    width: 1em;
    height: 1em;
    flex: none;
}

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-ring);
    border-radius: var(--r-control);
}

/* ==========================================================================
   Login
   ========================================================================== */

.login-page {
    background-image: var(--brand-grad);
    background-attachment: fixed;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.login-box {
    background: var(--surface);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--brand-grad);
    color: #fff;
    font-size: 26px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.35);
}

.login-box h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    color: var(--text);
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 14px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--r-control);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background-color: var(--expense-soft);
    color: #9b1c1c;
    border: 1px solid rgba(219, 69, 69, 0.25);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}

.form-group input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-control);
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface-2);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.form-group input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.login-info {
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: var(--r-control);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    padding: 13px 24px;
    border: none;
    border-radius: var(--r-control);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    width: 100%;
}

.btn-primary {
    background-image: var(--brand-grad);
    color: #fff;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.28);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(102, 126, 234, 0.34);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-filter,
.btn-reset {
    width: auto;
    padding: 10px 18px;
    font-size: 14px;
    border-radius: var(--r-control);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.btn-filter {
    background: var(--brand);
    color: #fff;
    border: 1px solid transparent;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.24);
}

.btn-filter:hover {
    background: var(--brand-strong);
    transform: translateY(-1px);
}

.btn-reset {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}

.btn-reset:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--text-muted);
}

.btn-filter:active,
.btn-reset:active {
    transform: translateY(0);
}

/* ==========================================================================
   Shell: container, header, nav
   ========================================================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    position: sticky;
    /* Flush to the viewport top: any offset would let content show through above it. */
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 14px 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-grad);
    color: #fff;
    font-size: 20px;
    box-shadow: 0 6px 14px rgba(102, 126, 234, 0.32);
}

.brand-text {
    font-size: 19px;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.brand-text strong {
    font-weight: 700;
}

nav {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

nav::-webkit-scrollbar {
    display: none;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: var(--r-pill);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-link .icon {
    font-size: 17px;
}

.nav-link:hover {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.nav-link.active {
    background-image: var(--brand-grad);
    color: #fff;
    box-shadow: 0 6px 14px rgba(102, 126, 234, 0.3);
}

.nav-link-logout {
    color: var(--text-muted);
}

.nav-link-logout:hover {
    background: var(--expense-soft);
    color: var(--expense);
}

/* The page body is now a set of cards on the neutral background, not one big box. */
main {
    display: block;
}

/* ==========================================================================
   Page header, sync banner
   ========================================================================== */

.page-header {
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-header .page-subtitle,
.ranking-note {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 14px;
}

.sync-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--info);
    border-radius: var(--r-control);
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.sync-info .icon {
    font-size: 18px;
    color: var(--info);
}

/* ==========================================================================
   Filters
   ========================================================================== */

.filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 18px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.filter-form {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.form-group-inline label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group-inline select,
.form-group-inline input[type="date"],
.form-group-inline input[type="number"] {
    padding: 9px 34px 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-control);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background-color: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group-inline select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 140px;
}

.form-group-inline input[type="date"],
.form-group-inline input[type="number"] {
    padding-right: 12px;
}

.form-group-inline input[type="number"] {
    width: 130px;
}

.form-group-inline select:focus,
.form-group-inline input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

/* Submit/reset stay side by side when the filter row wraps */
.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* Active filter chips */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 12px;
    border-radius: var(--r-pill);
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.chip:hover {
    background: rgba(102, 126, 234, 0.18);
}

.chip .icon {
    font-size: 14px;
    opacity: 0.8;
}

/* ==========================================================================
   Stat cards
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent, var(--brand));
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 22px;
    background: var(--accent-soft, var(--brand-soft));
    color: var(--accent, var(--brand));
}

.stat-income {
    --accent: var(--income);
    --accent-soft: var(--income-soft);
}

.stat-expense {
    --accent: var(--expense);
    --accent-soft: var(--expense-soft);
}

.stat-balance-positive {
    --accent: var(--info);
    --accent-soft: var(--info-soft);
}

.stat-balance-negative {
    --accent: var(--warn);
    --accent-soft: var(--warn-soft);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent, var(--text));
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Charts
   ========================================================================== */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
}

.chart-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.chart-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text);
}

.chart-card h2 .subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 8px;
    text-align: left;
}

.chart-canvas {
    position: relative;
    height: 320px;
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.no-data {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 15px;
}

.no-data .icon {
    font-size: 34px;
    color: var(--border-strong);
    margin-bottom: 10px;
}

.no-data-title {
    color: var(--text-secondary);
    font-weight: 500;
}

.no-data-hint {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.movements-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--text-secondary);
}

.movements-count strong {
    font-size: 16px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.movements-table-container {
    overflow-x: auto;
    border-radius: var(--r-card);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

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

.movements-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    z-index: 1;
}

.movements-table th,
.summary-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.movements-table tbody tr,
.summary-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.15s ease;
}

.movements-table tbody tr:last-child,
.summary-table tbody tr:last-child {
    border-bottom: none;
}

.movements-table tbody tr:hover,
.summary-table tbody tr:hover {
    background: var(--surface-2);
}

.movements-table td {
    padding: 14px 16px;
    font-size: 14px;
    vertical-align: middle;
}

.movements-table th:first-child,
.movements-table td:first-child {
    padding-left: 22px;
}

.movements-table th:last-child,
.movements-table td:last-child {
    padding-right: 22px;
}

.date-cell {
    white-space: nowrap;
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.text-muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* Element-qualified so it also beats the left-aligned `th` rules above. */
.text-right,
th.text-right,
td.text-right {
    text-align: right;
}

.amount-cell,
.summary-table .amount-income,
.summary-table .amount-expense {
    white-space: nowrap;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

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

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

/* Badges */

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.tipo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
}

.tipo-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.tipo-entrata {
    background: var(--income-soft);
    color: #0f7a4c;
}

.tipo-spesa {
    background: var(--expense-soft);
    color: #a52c2c;
}

/* Pagination */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
}

.pagination-btn {
    padding: 9px 16px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--r-pill);
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.pagination-btn:hover {
    background: var(--brand-soft);
    border-color: transparent;
    color: var(--brand-strong);
    transform: translateY(-1px);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Summary & rankings tables
   ========================================================================== */

.summary-section {
    margin-top: 28px;
    margin-bottom: 28px;
}

.summary-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

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

.summary-table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 20px 6px 8px;
    box-shadow: var(--shadow-sm);
}

.summary-table-container h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 16px 10px;
    color: var(--text);
}

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

.summary-table td {
    padding: 11px 16px;
    font-size: 14px;
}

.summary-total {
    background: var(--surface-2);
    font-weight: 600;
}

.summary-total td {
    border-top: 1px solid var(--border);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: var(--brand-soft) !important;
}

/* Rankings */

.rank-cell {
    width: 44px;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.summary-table tbody .rank-cell {
    color: var(--text-secondary);
}

.summary-table tbody tr:nth-child(1) .rank-cell,
.summary-table tbody tr:nth-child(2) .rank-cell,
.summary-table tbody tr:nth-child(3) .rank-cell {
    color: var(--brand-strong);
}

.ranking-hint {
    font-weight: 400;
    font-size: 13px;
    color: var(--text-muted);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
    .summary-tables,
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
        font-size: 14px;
    }

    header {
        top: 0;
        padding: 12px 14px;
        border-radius: var(--r-control);
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    nav {
        margin: 0 -14px;
        padding: 0 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 23px;
    }

    .filters {
        padding: 14px;
    }

    .filter-form {
        gap: 12px;
    }

    .form-group-inline {
        flex: 1 1 140px;
    }

    .form-group-inline select,
    .form-group-inline input[type="number"] {
        width: 100%;
        min-width: 0;
    }

    .chart-canvas {
        height: 260px;
    }

    .summary-table-container {
        padding: 16px 0 4px;
    }

    .summary-table-container h4 {
        margin: 0 12px 8px;
    }

    .movements-table {
        font-size: 13px;
    }

    .movements-table th,
    .movements-table td,
    .summary-table td,
    .summary-table th {
        padding: 10px 12px;
    }

    .movements-table th:first-child,
    .movements-table td:first-child {
        padding-left: 14px;
    }

    .movements-table th:last-child,
    .movements-table td:last-child {
        padding-right: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   Autenticazione: pagine account/utenti, secondo fattore, avvisi
   ========================================================================== */

/* Il logout è diventato un form POST (prima era un link GET, quindi
   attivabile da qualsiasi pagina esterna): il bottone deve però restare
   indistinguibile dalle altre voci di navigazione. */
.nav-logout-form {
    display: inline-flex;
    margin: 0;
}

.nav-logout-form .nav-link-logout {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    width: auto;
}

.alert-success {
    background-color: var(--income-soft);
    color: #106b45;
    border: 1px solid rgba(33, 168, 107, 0.25);
}

.alert-info {
    background-color: var(--info-soft);
    color: #1e40af;
    border: 1px solid rgba(37, 99, 235, 0.22);
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-5);
    align-items: start;
}

.account-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
}

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

.account-card-highlight {
    border-color: var(--brand);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-5);
}

.account-card h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 16px;
    margin-bottom: var(--space-3);
}

.account-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: var(--space-3);
}

.account-status {
    font-weight: 600;
}

.account-status-ok {
    color: var(--income);
}

.account-status-warn {
    color: var(--warn);
}

.stacked-form {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

.inline-form {
    display: inline;
}

/* Codici di recupero e token: mostrati una sola volta, vanno letti e copiati
   senza ambiguità fra caratteri simili. */
.recovery-codes {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    font-size: 15px;
    line-height: 1.9;
    letter-spacing: 0.06em;
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-control);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    white-space: pre-wrap;
    word-break: break-all;
}

.totp-secret code {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    font-size: 15px;
    letter-spacing: 0.08em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-control);
    padding: 6px 10px;
}

.badge-current {
    display: inline-block;
    margin-left: var(--space-2);
    padding: 2px 10px;
    border-radius: var(--r-pill);
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 11px;
    font-weight: 600;
}

.btn-secondary {
    width: auto;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--brand);
    color: var(--brand-strong);
}

.btn-danger {
    width: auto;
    background: var(--expense-soft);
    color: #9b1c1c;
    border: 1px solid rgba(219, 69, 69, 0.3);
}

.btn-danger:hover {
    background: var(--expense);
    color: #fff;
}

.btn-link {
    width: auto;
    padding: 4px 8px;
    background: none;
    border: none;
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--brand);
}

.login-recovery {
    margin-top: var(--space-4);
    font-size: 13px;
    color: var(--text-secondary);
}

.login-recovery summary {
    cursor: pointer;
    padding: var(--space-2) 0;
}

.login-recovery form {
    margin-top: var(--space-3);
}

/* Le righe cliccabili ora sono raggiungibili anche da tastiera. */
.clickable-row:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}
