:root {
    --mw-ink: #171717;
    --mw-muted: #757575;
    --mw-line: #e9e4dc;
    --mw-paper: #fbfaf7;
    --mw-panel: #ffffff;
    --mw-green: #1f8a64;
    --mw-red: #d94b4b;
    --mw-blue: #356dd8;
    --mw-gold: #d99a2b;
    --mw-font-color: #000000;
}

* {
    letter-spacing: 0;
}

[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--mw-ink);
    background: var(--mw-paper);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.auth-page {
    background: linear-gradient(180deg, #f5efe6 0%, #fbfaf7 42%, #edf3ef 100%);
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(100%, 442px);
    padding: 32px 23px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(23, 23, 23, 0.08);
}

.eyebrow,
.period {
    margin: 0 0 8px;
    color: var(--mw-green);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-copy {
    margin: 12px 0 28px;
    color: var(--mw-muted);
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form label {
    display: grid;
    gap: 6px;
    color: #3f3f3f;
    font-size: 0.92rem;
    font-weight: 700;
}

.form-control {
    min-height: 48px;
    border-color: var(--mw-line);
    border-radius: 8px;
}

.btn {
    min-height: 46px;
    border-radius: 8px;
    font-weight: 800;
}

.btn-primary {
    --bs-btn-bg: var(--mw-ink);
    --bs-btn-border-color: var(--mw-ink);
    --bs-btn-hover-bg: #333;
    --bs-btn-hover-border-color: #333;
}

.form-message {
    min-height: 20px;
    margin: 0;
    color: var(--mw-red);
    font-size: 0.9rem;
}

.form-message[data-type="success"] {
    color: var(--mw-green);
}

.form-message[data-type="info"] {
    color: var(--mw-blue);
}

.auth-link {
    margin: 22px 0 0;
    color: var(--mw-muted);
    text-align: center;
}

.auth-link a {
    color: var(--mw-ink);
    font-weight: 800;
}

.app-shell {
    max-width: 720px;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--mw-panel);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--mw-line);
    backdrop-filter: blur(16px);
}

.app-topbar-btn {
    width: 50px;
}

.page-topbar {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
}

.page-title {
    align-self: center;
    justify-self: center;
    margin: 0;
}

.brand-mark,
.icon-button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 8px;
}

.brand-mark {
    background: var(--mw-ink);
    color: #fff;
    font-weight: 900;
}

.icon-button {
    border: 0;
    background: #fff;
}

.text-button {
    border: 0;
    background: transparent;
    font-weight: 900;
}

.text-button.danger {
    color: #c1563c;
}

.screen {
    display: grid;
    gap: 18px;
    padding: 18px 18px 96px;
}

.home-screen {
    gap: 14px;
}

.home-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0 6px;
}

.home-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.home-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.home-period {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin: -4px 0 0 34px;
    padding: 5px 9px;
    border: 1px solid #dfe8d9;
    border-radius: 999px;
    background: #f7faf5;
    color: var(--mw-green);
    font-size: 0.78rem;
    font-weight: 800;
}

.investment-screen {
    background: #fff;
}

.investment-hero {
    padding-top: 8px;
}

.investment-card {
    gap: 12px;
}

.investment-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.investment-card-heading > .material-symbols-outlined {
    color: var(--mw-muted);
}

.investment-card-description {
    margin: 0 0 0 34px;
    color: var(--mw-muted);
    font-size: 0.9rem;
}

.investment-card-link:hover {
    border-color: #cfd8ee;
    background: #fbfcff;
}

.investment-goal-row,
.investment-summary-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 46px;
    border-top: 1px solid var(--mw-line);
}

.investment-goal-row strong,
.investment-accent,
.investment-sell {
    color: var(--mw-blue);
}

.investment-principles {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 2px 0 2px 34px;
}

.investment-budget-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
}

.investment-budget-grid div {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 14px 8px;
    border-right: 1px solid var(--mw-line);
    text-align: center;
}

.investment-budget-grid div:last-child {
    border-right: 0;
}

.investment-budget-grid span {
    color: var(--mw-muted);
    font-size: 0.82rem;
}

.investment-budget-grid strong {
    overflow: hidden;
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.investment-summary-list {
    display: grid;
}

.investment-summary-list span {
    color: #3f3f3f;
}

.investment-buy {
    color: var(--mw-red);
}

.investment-record-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--mw-blue);
    background: #f1f4fc;
}

.investment-record-button:hover {
    color: #2358bd;
    background: #e7edfb;
}

.investment-message {
    min-height: 0;
    text-align: center;
}

.investment-tip {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 18px;
    border: 1px solid #dde4f3;
    border-radius: 8px;
    background: #f8faff;
}

.investment-tip > .material-symbols-outlined,
.investment-tip strong {
    color: var(--mw-blue);
}

.investment-tip p {
    margin: 6px 0 0;
    color: var(--mw-muted);
    font-size: 0.9rem;
    line-height: 1.65;
}

.investment-save-top {
    color: var(--mw-blue);
}

.investment-record-screen {
    gap: 14px;
}

.investment-form-guide {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border: 1px solid #dfe6f6;
    border-radius: 8px;
    background: #f7f9fe;
    color: var(--mw-muted);
}

.investment-form-guide > .material-symbols-outlined,
.investment-form-guide strong {
    color: var(--mw-blue);
}

.investment-form-guide p {
    margin: 0;
    line-height: 1.6;
}

.investment-record-form {
    display: grid;
    gap: 14px;
}

.investment-form-card {
    position: relative;
}

.investment-form-card label,
.investment-form-card > strong {
    margin: 0;
}

.investment-recent-products {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.investment-recent-products button {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
    font-size: 0.82rem;
}

.investment-previous-record {
    margin: 2px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f7f9fe;
    color: var(--mw-blue);
    font-size: 0.8rem;
    font-weight: 700;
}

.investment-amount-fields,
.investment-rate-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.investment-rate-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.investment-rate-fields > label {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 800;
}

.investment-rate-fields input {
    min-width: 0;
    padding-right: 6px;
}

.investment-counter {
    color: var(--mw-muted);
    text-align: right;
}

.investment-rule-card {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.investment-rule-options {
    display: flex;
    gap: 4px;
}

.investment-rule-options .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    border: 1px solid transparent;
}

.investment-rule-options .btn-check:checked + .btn {
    border-color: var(--mw-line);
    background: #fbfaf7;
}

.rule-circle {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid;
    border-radius: 50%;
}

.rule-circle.yes {
    border-color: var(--mw-green);
}

.rule-circle.no {
    border-color: var(--mw-red);
}

@media (max-width: 460px) {
    .investment-rate-fields {
        gap: 6px;
    }

    .investment-rate-fields > label {
        padding: 10px 7px;
        font-size: 0.72rem;
    }

    .investment-rate-fields .input-group-text,
    .investment-rate-fields input {
        padding-left: 6px;
        font-size: 0.78rem;
    }

    .investment-rule-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    .investment-budget-grid strong {
        font-size: 0.82rem;
    }
}

.step-badge {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #000;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
}

.goal-list {
    overflow: hidden;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
}

.goal-list a {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    min-height: 58px;
    padding: 0 18px;
    border-bottom: 1px solid var(--mw-line);
    font-weight: 800;
}

.goal-list a:last-child {
    border-bottom: 0;
}

.goal-list .material-symbols-outlined {
    color: var(--mw-muted);
    font-size: 1.1rem;
}

.action-list {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 4px 0 4px 28px;
}

.budget-equation {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}

.budget-equation div {
    display: grid;
    gap: 6px;
    min-height: 72px;
    align-content: center;
    padding: 10px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    text-align: center;
}

.budget-equation small {
    color: var(--mw-muted);
    font-weight: 800;
}

.budget-equation > span {
    color: var(--mw-muted);
    font-weight: 900;
}

.setting-readonly {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fbfaf7;
}

.setting-readonly strong {
    font-size: 1rem;
}

.setting-readonly a {
    flex: 0 0 auto;
    color: var(--mw-green);
    font-weight: 900;
}

.warning-card {
    border-color: #efd7b3;
    background: #fffaf1;
}

.choice-list {
    display: grid;
    gap: 10px;
}

.choice-list label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
    font-weight: 800;
}

.choice-list input {
    margin-top: 3px;
}

.today-list {
    overflow: hidden;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
}

.today-list div,
.today-list a {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--mw-line);
}

.today-list div:last-child,
.today-list a:last-child {
    border-bottom: 0;
}

.today-list a:hover {
    background: #fbfaf7;
}

.record-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--mw-line);
    background: #fff;
}

.record-form {
    display: grid;
    gap: 12px;
}

.record-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.record-edit-summary {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.record-edit-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    background: #f0f0f3;
    color: var(--mw-muted);
}

.record-edit-summary p {
    margin: 4px 0 0;
    color: var(--mw-muted);
}

.record-edit-summary-amount {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    white-space: nowrap;
}

.record-edit-section-title {
    margin: 18px 0 0;
    font-size: 1.1rem;
}

.record-amount-sign {
    min-width: 42px;
    justify-content: center;
    font-weight: 900;
}

.record-amount-input {
    font-weight: 900;
}

.mood-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.record-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.mood-grid .btn {
    min-height: 54px;
    display: grid;
    place-items: center;
    white-space: nowrap;
}

.record-tip {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #f7f8fb;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.calendar-weekdays {
    margin-bottom: 8px;
    color: var(--mw-muted);
    text-align: center;
    font-weight: 800;
}

.calendar-day,
.calendar-empty {
    min-height: 44px;
    border-radius: 8px;
}

.calendar-day {
    border: 0;
    background: #fff;
    font-weight: 800;
}

.calendar-day.active {
    color: #fff;
    background: var(--mw-ink);
    border-color: var(--mw-ink);
}

.summary-band,
.profile-band {
    padding: 24px;
    border-radius: 8px;
    background: #f0f5ed;
}

.summary-band.budget {
    background: #f8f0df;
}

.summary-band.invest {
    background: #edf1fb;
}

.balance {
    display: block;
    margin-bottom: 18px;
    font-size: clamp(2rem, 8vw, 3.1rem);
    line-height: 1;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.section-block {
    display: grid;
    gap: 12px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title a {
    color: var(--mw-muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.ledger-list,
.budget-list,
.trade-list,
.menu-list {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.ledger-row,
.trade-list article,
.menu-list a {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--mw-line);
}

.ledger-date {
    display: grid;
    min-width: 66px;
    height: 44px;
    place-items: center;
    font-siez:14px;
}

.ledger-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ledger-amount-mood {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.ledger-row-actions b {
    white-space: nowrap;
}

.ledger-mood {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid var(--mw-line);
    border-radius: 50%;
    background: #fff;
    font-size: 1rem;
}

.ledger-row-actions .icon-button {
    width: 34px;
    height: 34px;
}

.ledger-budget-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.ledger-budget-grid div {
    display: grid;
    gap: 6px;
    padding: 12px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
}

.ledger-budget-grid span {
    color: var(--mw-muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.ledger-budget-grid strong {
    font-size: 1rem;
    white-space: nowrap;
}

.income-summary-total {
    margin-top: 12px;
}
.info-txt {margin: 0;color: var(--mw-muted);}
.text-sm {font-size: 0.8rem !important;}


.ledger-row:last-child,
.trade-list article:last-child,
.menu-list a:last-child {
    border-bottom: 0;
}

.ledger-row p,
.trade-list p,
.profile-band p {
    margin: 2px 0 0;
    color: var(--mw-muted);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.ledger-row.income b {
    color: var(--mw-red);
}

.ledger-row.expense b {
    color: var(--mw-ink);
}

.record-category-balance-wrap {
    overflow-x: auto;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.record-category-balance-table {
    min-width: 420px;
    vertical-align: middle;
}

.record-category-balance-table th,
.record-category-balance-table td {
    padding: 13px 14px;
    white-space: nowrap;
}

.record-category-balance-table thead th {
    color: var(--mw-muted);
    font-size: 0.82rem;
    font-weight: 900;
}

.record-category-balance-table tbody th {
    font-weight: 900;
}

.record-category-action-col {
    width: 48px;
}

.record-category-link {
    width: 32px;
    height: 32px;
    margin-left: auto;
}

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

.category-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.category-dot.food {
    background: var(--mw-gold);
}

.category-dot.income {
    background: var(--mw-red);
}

.category-dot.invest {
    background: var(--mw-blue);
}

.spend-bars {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    height: 180px;
    align-items: end;
    padding: 18px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
}

.spend-bars div {
    display: grid;
    gap: 8px;
    height: 100%;
    align-items: end;
    color: var(--mw-muted);
    font-size: 0.75rem;
    text-align: center;
}

.spend-bars span {
    display: block;
    min-height: 24px;
    border-radius: 8px 8px 2px 2px;
    background: var(--mw-green);
}

.budget-list article {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--mw-line);
}

.budget-list article:last-child {
    border-bottom: 0;
}

.budget-list article > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.budget-list small {
    color: var(--mw-muted);
}

.budget-detail-line {
    display: flex;
    justify-content: space-between;
    color: var(--mw-muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.progress {
    height: 9px;
    overflow: hidden;
    background: #eee9df;
    border-radius: 999px;
}

.progress span {
    display: block;
    height: 100%;
    background: var(--mw-gold);
}

.progress.invest span {
    background: var(--mw-blue);
}

.empty-panel {
    display: grid;
    gap: 10px;
    padding: 18px;
}

.empty-panel .btn {
    width: fit-content;
}

.date-range-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.budget-settings-form {
    display: grid;
    gap: 18px;
}

.budget-settings-summary {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fbfaf7;
}

.budget-settings-summary div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.budget-settings-summary span {
    color: var(--mw-muted);
    font-weight: 800;
}

.budget-settings-summary strong,
.budget-settings-summary strong span {
    color: var(--mw-ink);
    font-weight: 900;
}

.budget-input-list {
    display: grid;
    overflow-x: auto;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.budget-input-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
}

.budget-input-table th,
.budget-input-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--mw-line);
    vertical-align: middle;
    font-weight: normal;
    white-space: nowrap;
}

.budget-input-table thead th {
    background: #fbfaf7;
    color: var(--mw-muted);
    font-size: 0.84rem;
}

.budget-input-table tbody tr:last-child th,
.budget-input-table tbody tr:last-child td {
    border-bottom: 0;
}

.budget-input-table tbody th {
    color: var(--mw-ink);
}

.budget-input-table td:nth-child(2) {
    min-width: 190px;
}

.budget-input-table td:nth-child(2),
.budget-input-table th:nth-child(2) {
    text-align: right;
}

.budget-input-table td:last-child,
.budget-input-table th:last-child {
    text-align: right;
}

.budget-input-table input {
    text-align: right;
    font-weight: 900;
}

.budget-amount-button {
    display: inline-flex;
    min-width: 96px;
    min-height: 42px;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--mw-ink);
    font: inherit;
    font-weight: normal;
    text-align: right;
}

.budget-amount-button:focus,
.budget-amount-button:hover {
    border-color: var(--mw-line);
    background: #fbfaf7;
    outline: none;
}

.budget-input-row {
    display: grid;
    grid-template-columns: 1fr minmax(130px, 180px);
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--mw-line);
    font-weight: 800;
}

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

.budget-input-row input {
    text-align: right;
    font-weight: 900;
}

.budget-percent-line {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    color: var(--mw-muted);
    font-size: 0.82rem;
    font-weight: 900;
}

.category-empty-link {
    color: inherit;
}

.sortable-category-row {
    grid-template-columns: auto 1fr auto;
}

.sortable-category-row.dragging {
    background: #fbfaf7;
    opacity: 0.35;
}

.sortable-category-row[data-drag-ghost="true"] {
    position: fixed;
    z-index: 1000;
    margin: 0;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 42px rgba(23, 23, 23, 0.18);
    opacity: 0.96;
    pointer-events: none;
    transition: none;
}

.drag-handle {
    display: grid;
    width: 36px;
    height: 42px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--mw-muted);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.category-form-tabs {
    gap: 8px;
}

.category-form-tabs .nav-link {
    display: grid;
    min-height: 46px;
    place-items: center;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    cursor: pointer;
}

.category-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.category-row-actions .icon-button {
    width: 34px;
    height: 34px;
    background: #fbfaf7;
    border: 0;
    color: var(--mw-muted);
}

.category-row-actions button.icon-button {
    padding: 0;
}

.category-row-actions [data-delete-category] {
    color: var(--mw-red);
}

.category-lock {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--mw-muted);
    opacity: 0.6;
}

.category-edit-form {
    display: grid;
    gap: 12px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.metric-grid div {
    padding: 16px;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 8px;
}

.metric-grid span {
    display: block;
    color: var(--mw-muted);
    font-size: 0.84rem;
}

.metric-grid strong {
    display: block;
    margin-top: 4px;
}

.trade-list article {
    grid-template-columns: 1fr auto;
}

.trade-list b {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
}

.trade-list .buy {
    background: var(--mw-red);
}

.trade-list .sell {
    background: var(--mw-blue);
}

.profile-band {
    display: flex;
    gap: 14px;
    align-items: center;
    background: #f5efe6;
}

.settings-profile {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 22px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #f5efe6;
}

.settings-profile p:last-child {
    margin: 0;
    color: var(--mw-muted);
    font-size: 0.92rem;
}

.avatar {
    display: grid;
    width: 56px;
    height: 56px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--mw-ink);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 900;
}

.menu-list a {
    grid-template-columns: 1fr auto;
}

.menu-list span {
    color: var(--mw-muted);
    font-size: 1.4rem;
}

.section-count {
    color: var(--mw-muted);
    font-size: 0.88rem;
    font-weight: 800;
}

.account-form {
    display: grid;
    gap: 12px;
}

.account-form label {
    display: grid;
    gap: 6px;
    color: #3f3f3f;
    font-size: 0.9rem;
    font-weight: 800;
}

.check-row {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 8px !important;
}

.check-row input {
    width: 18px;
    height: 18px;
}

.account-list {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.account-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--mw-line);
    cursor: pointer;
}

.account-row:hover {
    background: #fbfaf7;
}

.category-tabs .nav-link {
    color: var(--mw-muted);
    font-weight: 800;
}

.category-tabs .nav-link.active {
    background: var(--mw-ink);
}

.category-list {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.category-row {
    display: flex;
    justify-content:space-between;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--mw-line);
}

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

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

.account-row-title {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.account-row-title span {
    padding: 3px 7px;
    color: #fff;
    background: var(--mw-green);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 900;
}

.account-row p,
.empty-state {
    margin: 4px 0 0;
    color: var(--mw-muted);
    font-size: 0.9rem;
}

.account-actions {
    display: flex;
    gap: 6px;
}

.account-actions button {
    min-width: 48px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
    color: var(--mw-ink);
    font-size: 0.82rem;
    font-weight: 800;
}

.account-actions button:disabled {
    color: var(--mw-muted);
    background: #f4f1eb;
}

.empty-state {
    padding: 18px;
    text-align: center;
}

.modal-open {
    overflow: hidden;
}

.bottom-tabs {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    max-width: 720px;
    margin: 0 auto;
    padding: 8px 12px 12px;
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--mw-line);
    backdrop-filter: blur(18px);
}

.bottom-tabs a {
    display: grid;
    min-height: 54px;
    place-items: center;
    color: var(--mw-muted);
    border-radius: 8px;
    /*font-weight: 800;*/
}

.bottom-tabs small {
    font-size: 0.72rem;
}

.bottom-tabs .material-symbols-outlined {
    font-size: 1.35rem;
}

.bottom-tabs a.active {
    color: #000;
    /*background: var(--mw-ink);*/
}
.bottom-tabs a.active small {
    font-weight: 800;
}

.budget-page-topbar {
    display: grid;
    grid-template-columns: 1fr auto;
}

.budget-page-topbar .page-title {
    justify-self: start;
}

.budget-settings-link {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--mw-muted);
    font-size: 0.9rem;
    font-weight: 900;
}

.budget-settings-link .material-symbols-outlined {
    font-size: 1rem;
}

.budget-screen {
    gap: 16px;
}

.budget-overview {
    display: grid;
    gap: 12px;
    padding: 4px 0 2px;
}

.budget-period-pill {
    justify-self: center;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--mw-line);
    border-radius: 999px;
    background: #fff;
    color: var(--mw-muted);
    font-size: 0.86rem;
    font-weight: 900;
}

.budget-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: hidden;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.budget-overview-grid div {
    display: grid;
    gap: 6px;
    min-height: 78px;
    align-content: center;
    padding: 12px 10px;
    border-right: 1px solid var(--mw-line);
    text-align: center;
}

.budget-overview-grid div:last-child {
    border-right: 0;
}

.budget-overview-grid span {
    color: var(--mw-muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.budget-overview-grid strong {
    font-size: 1rem;
    white-space: nowrap;
}

.budget-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--mw-line);
}

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

.budget-row-main {
    display: grid;
    gap: 9px;
    min-width: 0;
}

.budget-row-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    background: #f0f0f3;
    color: var(--mw-muted);
}

.budget-row-icon.income {
    background: #fff0f0;
    color: var(--mw-red);
}

.budget-ledger-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
}

.budget-ledger-table {
    min-width: 420px;
    vertical-align: middle;
}

.budget-ledger-table th,
.budget-ledger-table td {
    padding: 13px 14px;
    white-space: nowrap;
}

.budget-ledger-table thead th {
    color: var(--mw-muted);
    font-size: 0.82rem;
    font-weight: 900;
}

.budget-ledger-table tbody th,
.budget-ledger-table tfoot th {
    font-weight: 900;
}


.budget-ledger-table tfoot th,
.budget-ledger-table tfoot td {
    border-top: 2px solid var(--mw-line);
    /*font-weight: 900;*/
}

.budget-table-category {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.budget-ledger-table .drag-handle {
    width: 30px;
    height: 30px;
}

.budget-row-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.budget-row-head small {
    color: var(--mw-muted);
    font-weight: 800;
    white-space: nowrap;
}

.sortable-budget-row.dragging {
    background: #fbfaf7;
    opacity: 0.35;
}

.sortable-budget-row[data-budget-drag-ghost="true"] {
    position: fixed;
    z-index: 1000;
    margin: 0;
    border: 1px solid var(--mw-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 42px rgba(23, 23, 23, 0.18);
    opacity: 0.96;
    pointer-events: none;
    transition: none;
}

@media (min-width: 760px) {
    body {
        background: #efebe3;
    }

    .app-shell {
        border-right: 1px solid var(--mw-line);
        border-left: 1px solid var(--mw-line);
    }
}

@media (max-width: 420px) {
    .auth-panel {
        padding: 26px 18px;
    }

    .quick-actions,
    .metric-grid,
    .budget-equation,
    .ledger-budget-grid,
    .mood-grid,
    .record-type-grid {
        grid-template-columns: 1fr;
    }

    .budget-equation > span {
        display: none;
    }

    .budget-list article > div:first-child {
        display: grid;
    }

    .settings-profile,
    .account-row,
    .budget-input-row {
        grid-template-columns: 1fr;
    }

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

    .settings-profile {
        display: grid;
    }

    .account-actions {
        justify-content: stretch;
    }

    .account-actions button {
        flex: 1;
    }
}
