:root {

    --background: #faf9f7;
    --surface: #ffffff;
    --surface-soft: #f5f3f0;

    --border: #e6e2dd;

    --text: #29262d;
    --muted: #85808a;
    --muted-light: #aaa5ad;

    --purple: #7446bd;
    --purple-soft: #f0e9fb;

    --green: #11945f;
    --green-soft: #e8f6ef;

    --red: #e53d48;
    --red-soft: #fbecee;

    --yellow: #c49a3a;

    --sidebar-width: 275px;

    --radius: 20px;

    --shadow:
        0 10px 30px rgba(36, 30, 40, .045);
}


* {
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {

    margin: 0;

    background: var(--background);

    color: var(--text);

    font-family:
        "DM Sans",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
}


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


button {
    cursor: pointer;
}


/* =========================================
   APP
========================================= */

.app {
    min-height: 100vh;
}


/* =========================================
   SIDEBAR
========================================= */

.sidebar {

    position: fixed;

    inset:
        0
        auto
        0
        0;

    width: var(--sidebar-width);

    background: #fbfaf8;

    border-right:
        1px solid var(--border);

    display: flex;

    flex-direction: column;

    justify-content: space-between;

    padding: 28px 16px;

    z-index: 20;
}


.brand {

    padding:
        0
        10px
        34px;
}


.brand h2 {

    margin: 0;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 29px;

    font-weight: 600;

    letter-spacing: -.04em;
}


.brand p {

    margin:
        4px
        0
        0;

    color: var(--muted);

    font-size: 14px;
}


.nav {

    display: flex;

    flex-direction: column;

    gap: 4px;
}


.nav-item {

    width: 100%;

    display: flex;

    align-items: center;

    gap: 13px;

    border: 0;

    background: transparent;

    color: #625e67;

    padding:
        11px
        13px;

    border-radius: 14px;

    text-align: left;

    font-size: 15px;

    transition:
        background .2s ease,
        color .2s ease;
}


.nav-item:hover {

    background: #f2efeb;

    color: var(--text);
}


.nav-item.active {

    background: var(--purple-soft);

    color: #65409d;

    font-weight: 600;
}


.nav-icon {

    width: 20px;

    text-align: center;

    font-size: 17px;

    color: currentColor;
}


.sidebar-bottom {

    display: flex;

    flex-direction: column;

    gap: 13px;
}


.new-button {

    width: 100%;

    border: 0;

    border-radius: 12px;

    background: var(--purple);

    color: white;

    padding:
        13px
        15px;

    font-size: 14px;

    font-weight: 600;

    box-shadow:
        0 6px 15px rgba(116,70,189,.2);

    transition: .2s ease;
}


.new-button:hover {

    transform: translateY(-1px);

    background: #683daf;
}


.logout-button {

    border: 0;

    background: transparent;

    color: #85808a;

    text-align: left;

    padding:
        0
        13px;

    font-size: 13px;
}


/* =========================================
   MAIN
========================================= */

.main {

    margin-left: var(--sidebar-width);

    padding:
        32px
        52px
        70px;

    max-width: 1500px;
}


.section {

    display: none;

    max-width: 1185px;

    margin: 0 auto;
}


.section.active {

    display: block;
}


/* =========================================
   HEADER
========================================= */

.page-header {

    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    margin-bottom: 32px;

    gap: 30px;
}


.section-label {

    margin:
        0
        0
        7px;

    color: #928d97;

    font-size: 11px;

    letter-spacing: .13em;

    font-weight: 500;
}


.page-header h1 {

    margin: 0;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 38px;

    line-height: 1;

    letter-spacing: -.035em;

    font-weight: 600;
}


.month-label {

    margin:
        7px
        0
        0;

    color: var(--muted);

    font-size: 16px;
}


.period-select {

    min-width: 195px;

    border:
        1px solid var(--border);

    background: white;

    border-radius: 13px;

    padding:
        11px
        14px;

    color: #454149;

    outline: none;

    box-shadow:
        0 3px 10px rgba(0,0,0,.03);
}


/* =========================================
   BALANCE
========================================= */

.balance-card {

    background: white;

    border:
        1px solid var(--border);

    border-radius: 22px;

    padding:
        34px
        38px;

    margin-bottom: 14px;

    box-shadow: var(--shadow);
}


.balance-number {

    margin-top: 4px;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 58px;

    letter-spacing: -.055em;

    line-height: 1.1;
}


.balance-description {

    margin:
        5px
        0
        0;

    color: var(--muted);

    font-size: 14px;
}


/* =========================================
   STATS
========================================= */

.stats-grid {

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 14px;

    margin-bottom: 14px;
}


.stat-card {

    background: white;

    border:
        1px solid var(--border);

    border-radius: 20px;

    padding:
        24px;

    box-shadow: var(--shadow);
}


.stat-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    color: #908b94;

    font-size: 11px;

    letter-spacing: .1em;
}


.stat-card strong {

    display: block;

    margin-top: 18px;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 29px;

    letter-spacing: -.04em;
}


.stat-card small {

    display: block;

    margin-top: 4px;

    color: var(--muted);

    font-size: 12px;
}


.stat-indicator {

    display: flex;

    align-items: center;

    justify-content: center;

    width: 27px;

    height: 27px;

    border-radius: 50%;

    font-size: 14px;
}


.stat-indicator.income {

    background: var(--green-soft);

    color: var(--green);
}


.stat-indicator.expense {

    background: var(--red-soft);

    color: var(--red);
}


.stat-indicator.result {

    background: var(--purple-soft);

    color: var(--purple);
}


.neutral {

    color: var(--text);
}


/* =========================================
   CARDS
========================================= */

.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 27px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    min-width: 0;
}


.card-header {

    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 25px;
}


.card-header h2 {

    margin: 0;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 21px;

    letter-spacing: -.025em;
}


.card-header select {

    border:
        1px solid var(--border);

    background: white;

    border-radius: 9px;

    padding:
        7px
        10px;

    color: var(--muted);

    font-size: 12px;
}

.chart-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: wrap;
}

.chart-controls strong {
    min-width: 132px;
    color: var(--text);
    text-align: center;
    font-size: 13px;
    text-transform: capitalize;
}

.chart-nav {
    width: 29px;
    height: 29px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
}

.chart-content { min-height: 245px; }
.chart-svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart-grid-line { stroke: #eeeae6; stroke-width: 1; }
.chart-bar { fill: var(--purple); opacity: .82; transition: opacity .15s ease; }
.chart-bar:hover { opacity: 1; }
.chart-axis-label { fill: var(--muted); font: 10px "DM Sans", sans-serif; }
.chart-summary { display: flex; gap: 18px; color: var(--muted); font-size: 12px; margin-top: 8px; }
.chart-summary strong { color: var(--text); }
.chart-custom-range { display: flex; align-items: end; justify-content: flex-end; gap: 9px; margin: -8px 0 16px; }
.chart-custom-range label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.chart-custom-range input { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--text); }

@media (max-width: 600px) {
    .chart-controls { justify-content: flex-start; }
    .chart-controls strong { min-width: 110px; }
    .chart-custom-range { justify-content: flex-start; flex-wrap: wrap; }
    .chart-summary { flex-direction: column; gap: 4px; }
}


/* =========================================
   EMPTY CHART
========================================= */

.chart-empty {

    min-height: 220px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    color: var(--muted);

    background:
        linear-gradient(
            to bottom,
            transparent 24.5%,
            #eeeae6 25%,
            transparent 25.5%,
            transparent 49.5%,
            #eeeae6 50%,
            transparent 50.5%,
            transparent 74.5%,
            #eeeae6 75%,
            transparent 75.5%
        );
}


.chart-empty strong {

    color: var(--text);

    font-size: 13px;

    margin-top: 4px;
}


.chart-empty span {

    max-width: 350px;

    margin-top: 5px;

    font-size: 11px;

    line-height: 1.6;
}


/* =========================================
   DASHBOARD GRID
========================================= */

.dashboard-grid {

    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 14px;
}


/* =========================================
   RESUMEN EJECUTIVO
========================================= */

.home-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 14px 0;
}

.overview-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 19px;
    box-shadow: var(--shadow);
}

.overview-card.wide { grid-column: span 2; }
.overview-card .section-label { margin-bottom: 8px; }
.overview-card h3 { margin: 0; font-size: 16px; }
.overview-card strong { display: block; margin-top: 6px; font-size: 23px; }
.overview-card p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.overview-card .link-button { margin-top: 12px; padding: 0; }

.overview-card.available { background: var(--green-soft); border-color: transparent; }
.overview-card.warning { background: var(--red-soft); border-color: transparent; }
.overview-card.receivable { background: var(--purple-soft); border-color: transparent; }
.overview-card.peak strong { font-size: 17px; }

@media (max-width: 900px) {
    .home-overview { grid-template-columns: repeat(2, 1fr); }
    .overview-card.wide { grid-column: span 2; }
}

@media (max-width: 560px) {
    .home-overview { grid-template-columns: 1fr; }
    .overview-card.wide { grid-column: span 1; }
}


/* =========================================
   CATEGORY EMPTY
========================================= */

.category-empty {

    min-height: 215px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    color: var(--muted);
}


.category-empty strong {

    color: var(--text);

    font-size: 13px;

    margin-top: 4px;
}


.category-empty span {

    max-width: 330px;

    margin-top: 5px;

    font-size: 11px;

    line-height: 1.6;
}


/* =========================================
   EMPTY CIRCLE
========================================= */

.empty-circle {

    width: 52px;

    height: 52px;

    border-radius: 16px;

    background: var(--surface-soft);

    color: #8c8790;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 20px;

    margin-bottom: 10px;
}


/* =========================================
   MOVEMENTS
========================================= */

.link-button {
    border: 0;
    background: transparent;
    color: var(--purple);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.link-button:hover {
    background: var(--purple-soft);
    opacity: 0.9;
}

.movement-list {
    width: 100%;
    min-height: 140px;
    display: flex;
    flex-direction: column;
}

.recent-movements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

@media (max-width: 720px) {
    .recent-movements-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

.recent-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
}

.recent-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.recent-column-title {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.recent-column-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.recent-column-dot.expense {
    background: var(--red);
}

.recent-column-dot.income {
    background: var(--green);
}

.recent-column-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.recent-column-count {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.recent-column-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

.recent-column-list .movement-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    width: 100%;
    min-width: 0;
}

.recent-column-list .movement-row:last-child {
    border-bottom: none;
    padding-bottom: 2px;
}

.recent-column-list .movement-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.recent-column-list .movement-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 13px;
    flex-shrink: 0;
}

.recent-column-list .movement-info > div {
    min-width: 0;
    flex: 1;
}

.recent-column-list .movement-info strong {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.recent-column-list .movement-info span {
    display: block;
    margin-top: 2px;
    font-size: 10.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.recent-column-list .movement-right {
    text-align: right;
    flex-shrink: 0;
}

.recent-column-list .movement-right > strong {
    font-size: 12.5px;
    font-family: "DM Mono", monospace;
    font-weight: 600;
    white-space: nowrap;
}

.recent-empty-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px 12px;
    font-size: 11.5px;
    color: var(--muted);
    text-align: center;
}


.empty-state {

    width: 100%;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    color: var(--muted);
}


.empty-state strong {

    color: var(--text);

    font-size: 13px;
}


.empty-state h2 {

    margin:
        8px
        0
        0;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 21px;
}


.empty-state p {

    margin:
        7px
        0
        18px;

    color: var(--muted);

    font-size: 12px;

    line-height: 1.6;
}


/* =========================================
   INSIGHT
========================================= */

.insight {

    display: flex;

    gap: 15px;

    align-items: flex-start;

    background: var(--purple-soft);

    border:
        1px solid #e4d9f5;

    border-radius: 20px;

    padding: 24px;

    margin-top: 14px;
}


.insight-icon {

    width: 34px;
    height: 34px;

    flex-shrink: 0;

    background: white;

    color: var(--purple);

    border-radius: 10px;

    display: flex;

    align-items: center;

    justify-content: center;
}


.insight h3 {

    margin: 0;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 17px;
}


.insight p:last-child {

    margin:
        6px
        0
        0;

    color: #777084;

    font-size: 12px;

    line-height: 1.6;
}


/* =========================================
   BUTTONS
========================================= */

.primary-button {

    border: 0;

    background: var(--purple);

    color: white;

    border-radius: 12px;

    padding:
        12px
        17px;

    font-size: 13px;

    font-weight: 600;

    box-shadow:
        0 5px 14px rgba(116,70,189,.18);

    transition: .2s ease;
}


.primary-button:hover {

    transform: translateY(-1px);

    background: #683daf;
}


.cancel-button {

    border: 0;

    background: var(--surface-soft);

    color: var(--text);

    border-radius: 11px;

    padding:
        11px
        15px;

    font-size: 12px;
}


/* =========================================
   TOOLBAR
========================================= */

.toolbar {

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 15px;

    margin-bottom: 16px;
}

.movement-period-filter {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    padding: 9px 12px;
    font-size: 14px;
}

.feature-page {
    display: grid;
    gap: 18px;
}

.feature-form, .feature-list, .goal-card, .settings-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

.feature-form { display: grid; gap: 14px; }
.feature-form-grid, .fixed-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature-form label { display: grid; gap: 7px; font-size: 14px; font-weight: 600; }
.feature-form input, .feature-form select, .settings-panel select, .settings-panel textarea { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface); }
.settings-panel textarea { resize: vertical; font: inherit; line-height: 1.45; }
.settings-panel small { color: var(--muted); font-weight: 400; }
.feature-list { display: grid; gap: 10px; }
.feature-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.feature-row:last-child { border-bottom: 0; }
.feature-row span, .goal-card small { color: var(--muted); display: block; margin-top: 4px; }
.feature-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.compact-button { border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); padding: 8px 10px; }
.compact-button.done { background: var(--green-soft); color: var(--green); border-color: transparent; }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.goal-progress { height: 9px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); margin: 14px 0 10px; }
.goal-progress > div { height: 100%; background: var(--purple); border-radius: inherit; }
.settings-panel { max-width: 600px; display: grid; gap: 16px; }
.settings-panel label { display: grid; gap: 8px; font-weight: 600; }
.feature-empty { color: var(--muted); text-align: center; padding: 24px; }

.fixed-coverage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--purple-soft);
}

.fixed-coverage.covered { background: var(--green-soft); }
.fixed-coverage.shortfall { background: var(--red-soft); }
.fixed-coverage p { margin: 4px 0 0; color: var(--muted); }
.fixed-coverage strong { font-size: 24px; }
.fixed-coverage.covered strong { color: var(--green); }
.fixed-coverage.shortfall strong { color: var(--red); }

@media (max-width: 700px) {
    .feature-form-grid, .fixed-summary { grid-template-columns: 1fr; }
    .feature-row { align-items: flex-start; flex-direction: column; }
    .fixed-coverage { align-items: flex-start; flex-direction: column; }
}

/* =========================================
   ALERTAS Y NOTIFICACIONES DE PAGO
========================================= */

.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(36, 30, 40, .03);
    transition: all 0.2s ease;
}

.alert-banner-today {
    border-color: #ebdcdb;
    background: #fdfbfb;
    border-left: 3px solid var(--red);
}

.alert-banner-today .alert-icon-box {
    background: var(--red-soft);
    color: var(--red);
    border-color: #f7dcd9;
}

.alert-banner-today .section-label {
    color: var(--red);
}

.alert-banner-overdue {
    border-color: #eae5d9;
    background: #fdfcf9;
    border-left: 3px solid var(--yellow);
}

.alert-banner-overdue .alert-icon-box {
    background: #fdf8eb;
    color: #9c7324;
    border-color: #f3e8cb;
}

.alert-banner-overdue .section-label {
    color: #9c7324;
}

.alert-icon-box {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
}

.alert-banner-content {
    flex: 1;
    min-width: 0;
}

.alert-banner-content .section-label {
    margin: 0 0 5px;
    font-size: 10px;
    letter-spacing: .12em;
    font-weight: 600;
}

.alert-banner-content h3 {
    margin: 0 0 5px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.alert-banner-content p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

.alert-banner-content strong {
    color: var(--text);
    font-weight: 600;
}

.alert-banner-button {
    align-self: center;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
}

.alert-banner-button:hover {
    background: var(--surface-soft);
    border-color: var(--muted-light);
    color: var(--text);
}

/* =========================================
   BADGES DE ESTADO Y SUBTEXTOS
========================================= */

.feature-info-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.feature-row-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-today {
    background: #fdf2f2;
    color: #c9353f;
    border: 1px solid #f9d8d8;
    font-weight: 600;
}

.badge-upcoming {
    background: var(--surface-soft);
    color: var(--muted);
    border: 1px solid transparent;
}

.badge-overdue {
    background: #fdf6ec;
    color: #a16207;
    border: 1px solid #f6e3c6;
    font-weight: 500;
}

.badge-paid {
    background: var(--green-soft);
    color: var(--green);
    border: 1px solid transparent;
}

.badge-pending {
    background: var(--surface-soft);
    color: var(--muted);
    border: 1px solid transparent;
}

.row-due-today {
    border-left: 2px solid var(--red);
    padding-left: 12px !important;
}

.compact-button.delete {
    color: var(--muted);
}

.compact-button.delete:hover {
    color: var(--red);
    border-color: var(--red);
}

/* =========================================
   CHIPS DE CLIENTES FRECUENTES
========================================= */

.client-quick-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-soft);
    border-radius: 12px;
    margin-top: -4px;
    margin-bottom: 4px;
}

.chips-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.chips-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.client-chip {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.client-chip:hover {
    background: var(--purple-soft);
    color: var(--purple);
    border-color: var(--purple);
    transform: translateY(-1px);
}


.search {

    display: flex;

    align-items: center;

    gap: 8px;

    background: white;

    border:
        1px solid var(--border);

    border-radius: 11px;

    padding:
        0
        12px;

    width: 320px;
}


.search input {

    width: 100%;

    border: 0;

    outline: 0;

    padding:
        11px
        0;

    font-size: 12px;
}


.filters {

    display: flex;

    gap: 5px;
}


.filter {

    border:
        1px solid var(--border);

    background: white;

    color: var(--muted);

    border-radius: 9px;

    padding:
        9px
        13px;

    font-size: 11px;
}


.filter.active {

    background: var(--text);

    color: white;

    border-color: var(--text);
}


/* =========================================
   EMPTY PAGE
========================================= */

.empty-page {

    min-height: 370px;

    background: white;

    border:
        1px solid var(--border);

    border-radius: 20px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    padding: 30px;
}


.empty-page h2 {

    margin: 5px 0 0;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 21px;
}


.empty-page p {

    max-width: 430px;

    color: var(--muted);

    font-size: 13px;

    line-height: 1.6;

    margin:
        7px
        0;
}


/* =========================================
   FIXED SUMMARY
========================================= */

.fixed-summary {

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 14px;

    margin-bottom: 14px;
}


.fixed-summary > div {

    background: white;

    border:
        1px solid var(--border);

    border-radius: 18px;

    padding: 22px;
}


.fixed-summary span {

    display: block;

    color: var(--muted);

    font-size: 11px;
}


.fixed-summary strong {

    display: block;

    margin-top: 12px;

    font-family:
        "DM Mono",
        monospace;

    font-size: 19px;
}


/* =========================================
   SETTINGS
========================================= */

.settings-card {

    background: white;

    border:
        1px solid var(--border);

    border-radius: 20px;

    overflow: hidden;
}


.setting {

    min-height: 80px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding:
        18px
        23px;

    border-bottom:
        1px solid var(--border);
}


.setting:last-child {

    border-bottom: 0;
}


.setting strong {

    display: block;

    font-size: 13px;
}


.setting span {

    display: block;

    margin-top: 4px;

    color: var(--muted);

    font-size: 11px;
}


.setting button {

    border: 0;

    background: transparent;

    color: var(--purple);

    font-size: 11px;

    font-weight: 600;
}


/* =========================================
   MODAL
========================================= */

.modal-overlay {

    position: fixed;

    inset: 0;

    background: rgba(34,30,36,.4);

    display: none;

    align-items: center;

    justify-content: center;

    padding: 20px;

    z-index: 1000;
}


.modal-overlay.open {

    display: flex;
}


.modal {

    width: min(100%, 520px);

    max-height: 92vh;

    overflow-y: auto;

    background: white;

    border-radius: 22px;

    padding: 29px;

    box-shadow:
        0 30px 80px rgba(0,0,0,.16);
}


.modal-header {

    display: flex;

    justify-content: space-between;

    margin-bottom: 23px;
}


.modal-header h2 {

    margin: 0;

    font-family:
        "Playfair Display",
        Georgia,
        serif;

    font-size: 25px;
}


.close-button {

    width: 32px;
    height: 32px;

    border: 0;

    border-radius: 50%;

    background: var(--surface-soft);

    color: #77717b;

    font-size: 20px;
}


.type-selector {

    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 5px;

    padding: 4px;

    background: var(--surface-soft);

    border-radius: 11px;

    margin-bottom: 20px;
}


.type-button {

    border: 0;

    background: transparent;

    color: var(--muted);

    padding: 10px;

    border-radius: 8px;

    font-size: 12px;

    font-weight: 600;
}


.type-button.active {

    background: white;

    color: var(--text);

    box-shadow:
        0 2px 7px rgba(0,0,0,.05);
}


.modal label {

    display: block;

    margin-bottom: 15px;

    color: #57525b;

    font-size: 11px;

    font-weight: 600;
}


.modal input,
.modal select,
.modal textarea {

    display: block;

    width: 100%;

    margin-top: 7px;

    padding:
        11px
        12px;

    border:
        1px solid var(--border);

    border-radius: 10px;

    outline: none;

    color: var(--text);

    background: white;

    font-size: 13px;
}


.modal input:focus,
.modal select:focus,
.modal textarea:focus {

    border-color: var(--purple);

    box-shadow:
        0 0 0 3px var(--purple-soft);
}


.form-grid {

    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 12px;
}


.amount-input {

    display: flex;

    align-items: center;

    border:
        1px solid var(--border);

    border-radius: 10px;

    margin-top: 7px;

    padding-left: 12px;
}


.amount-input span {

    color: var(--muted);

    font-family:
        "DM Mono",
        monospace;

    font-size: 13px;
}


.amount-input input {

    border: 0;

    box-shadow: none;

    margin-top: 0;
}


.optional {

    float: right;

    color: var(--muted-light);

    font-weight: 400;
}


.modal-actions {

    display: flex;

    justify-content: flex-end;

    gap: 8px;

    margin-top: 23px;
}


/* =========================================
   MOBILE HEADER
========================================= */

.mobile-header {

    display: none;
}


/* =========================================
   MOBILE NAV
========================================= */

.mobile-nav {

    display: none;
}


/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 1000px) {

    :root {
        --sidebar-width: 230px;
    }

    .main {

        padding-left: 30px;

        padding-right: 30px;
    }

}


@media (max-width: 760px) {

    .sidebar {

        display: none;
    }


    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: calc(52px + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0px);
        background: #7446bd;
        box-shadow: 0 2px 14px rgba(116, 70, 189, 0.28);
        z-index: 90;
        box-sizing: border-box;
    }

    .mobile-header-brand {
        display: flex;
        align-items: center;
        gap: 9px;
    }

    .mobile-header-logo {
        width: 26px;
        height: 26px;
        flex-shrink: 0;
    }

    .mobile-header-title {
        font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
        font-size: 20px;
        font-weight: 700;
        color: #ffffff;
        letter-spacing: -0.4px;
    }

    .main {
        margin-left: 0;
        padding-top: calc(52px + env(safe-area-inset-top, 0px) + 16px);
        padding-bottom: calc(65px + env(safe-area-inset-bottom, 10px) + 24px);
        padding-left: 17px;
        padding-right: 17px;
        box-sizing: border-box;
    }


    .page-header {

        flex-direction: column;

        gap: 18px;

        margin-bottom: 22px;
    }


    .page-header h1 {

        font-size: 32px;
    }


    .period-select {

        width: 100%;
    }


    .balance-card {

        padding: 25px;
    }


    .balance-number {

        font-size: 44px;
    }


    .stats-grid {

        grid-template-columns:
            1fr;
    }


    .dashboard-grid {

        grid-template-columns:
            1fr;
    }


    .toolbar {

        flex-direction: column;

        align-items: stretch;
    }


    .search {

        width: 100%;
    }


    .filters {

        width: 100%;
    }


    .filter {

        flex: 1;
    }


    .fixed-summary {

        grid-template-columns:
            1fr;
    }


    .mobile-nav {
        position: fixed;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        left: 0;
        right: 0;
        bottom: 0;
        padding-top: 8px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
        padding-left: 10px;
        padding-right: 10px;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(230, 226, 221, 0.85);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
        z-index: 90;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border: 0;
        background: transparent;
        color: var(--muted);
        padding: 6px 4px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 500;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-item span {
        display: block;
        margin-bottom: 2px;
        font-size: 18px;
        line-height: 1;
    }

    .mobile-nav-item.active {
        background: var(--purple-soft);
        color: var(--purple);
        font-weight: 600;
    }

}


@media (max-width: 480px) {

    .card {

        padding: 20px;
    }


    .form-grid {

        grid-template-columns:
            1fr;
    }


    .modal {

        padding: 22px;
    }

}
/* =========================================
   MOVIMIENTOS DINÁMICOS
========================================= */

.movements-table {
    width: 100%;
}


.movement-row {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding:
        15px
        0;

    border-bottom:
        1px solid var(--border);
}


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


.movement-info {

    display: flex;

    align-items: center;

    gap: 12px;

    min-width: 0;
}


.movement-icon {

    width: 38px;
    height: 38px;

    flex-shrink: 0;

    border-radius: 11px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 16px;
}


.movement-income {

    color: var(--green);
}


.movement-expense {

    color: var(--red);
}


.movement-icon.movement-income {

    background:
        var(--green-soft);
}


.movement-icon.movement-expense {

    background:
        var(--red-soft);
}


.movement-info strong {

    display: block;

    color: var(--text);

    font-size: 13px;

    font-weight: 600;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.movement-info span {

    display: block;

    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}


.movement-right {

    text-align: right;

    flex-shrink: 0;
}


.movement-right > strong {

    display: block;

    font-family:
        "DM Mono",
        monospace;

    font-size: 13px;
}


.movement-actions {

    display: flex;

    justify-content: flex-end;

    gap: 8px;

    margin-top: 5px;
}


.movement-actions button {

    border: 0;

    background: transparent;

    color: var(--muted);

    padding: 0;

    font-size: 10px;
}


.movement-actions button:hover {

    color: var(--purple);
}


.positive {
    color: var(--green) !important;
}


.negative {
    color: var(--red) !important;
}


.category-list {

    width: 100%;
}


.category-row {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding:
        11px
        0;

    border-bottom:
        1px solid var(--border);
}


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


.category-row div {

    display: flex;

    flex-direction: column;

    gap: 3px;
}


.category-row div strong {

    font-size: 12px;
}


.category-row div span {

    color: var(--muted);

    font-size: 10px;
}


.category-row > strong {

    font-family:
        "DM Mono",
        monospace;

    font-size: 12px;
}


@media (max-width: 600px) {

    .movement-row {

        align-items: flex-start;

    }


    .movement-info {

        min-width: 0;

    }


    .movement-info > div:last-child {

        min-width: 0;

    }


    .movement-right > strong {

        font-size: 11px;

    }

}


/* =========================================
   DEUDAS Y PRÉSTAMOS EN CUOTAS
========================================= */

.badge-installment {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--purple-soft, rgba(124, 58, 237, 0.08));
    color: var(--purple, #7c3aed);
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.badge-installment.completed {
    background: var(--green-soft, rgba(16, 185, 129, 0.1));
    color: var(--green, #10b981);
}

.installment-remain-text {
    color: var(--purple, #7c3aed);
    font-weight: 500;
}

.installment-remain-text.completed {
    color: var(--green, #10b981);
    font-weight: 600;
}

.installment-progress-track {
    width: 100%;
    max-width: 260px;
    height: 4px;
    background: var(--border, #e5e5eb);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.installment-progress-fill {
    height: 100%;
    background: var(--purple, #7c3aed);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.installment-progress-fill.completed {
    background: var(--green, #10b981);
}

.installment-toggle-container {
    margin: 12px 0 16px;
    padding: 14px 16px;
    background: var(--surface-soft, #fafafc);
    border: 1px dashed var(--border, #e5e5eb);
    border-radius: 12px;
}

.installment-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #111);
    user-select: none;
}

.installment-toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--purple, #7c3aed);
    cursor: pointer;
}

.installment-fields-box {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border, #e5e5eb);
}

.installment-hint {
    margin: 8px 0 0;
    font-size: 11.5px;
    color: var(--muted, #666);
    line-height: 1.4;
}

.installment-hint strong {
    color: var(--purple, #7c3aed);
}

.stat-card-installments strong {
    color: var(--purple, #7c3aed);
}

.stat-card-subtext {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--muted, #666);
}

.compact-button.edit {
    border: 1px solid var(--border, #e5e5eb);
    background: transparent;
    color: var(--text, #111);
}

.compact-button.edit:hover {
    background: var(--surface-soft, #fafafc);
    border-color: var(--purple, #7c3aed);
    color: var(--purple, #7c3aed);
}
