 /* ============================================================
   HOGAR FINANZAS — Shared Components
   ============================================================ */

/* ============================================================
   1. PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: clamp(1.5rem, 3vw + 1rem, 2.125rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header-right form {
    background: var(--app-surface);
    padding: 4px 12px;
    border-radius: 14px;
    border: 1px solid var(--app-border);
}

/* ============================================================
   2. STATS GRID (KPIs)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    transition: border-color var(--transition-base), background var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--text-tertiary);
    background: var(--app-surface-hover);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon--indigo {
    background: var(--app-primary-subtle);
    color: var(--app-primary);
}

.stat-icon--green {
    background: var(--app-success-subtle);
    color: var(--app-success);
}

.stat-icon--red {
    background: var(--app-danger-subtle);
    color: var(--app-danger);
}

.stat-icon--amber {
    background: var(--app-warning-subtle);
    color: var(--app-warning);
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.28px;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.stat-period {
    font-size: 12px;
    color: var(--text-tertiary);
}

.stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.stat-delta.up {
    background: var(--app-success-subtle);
    color: var(--app-success);
}

.stat-delta.down {
    background: var(--app-danger-subtle);
    color: var(--app-danger);
}

.stat-sub {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--app-border);
    border-radius: var(--radius-sm);
    background: var(--app-surface);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar:focus-within {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px var(--app-primary-ring);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    height: 100%;
}

.search-bar input::placeholder {
    color: var(--text-tertiary);
}

.stat-card-horizontal {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.stat-card-horizontal .stat-icon {
    flex-shrink: 0;
}

.stat-body {
    flex: 1;
    min-width: 0;
}

.stat-card-horizontal .stat-value {
    font-size: 24px;
}

/* ============================================================
   3. CARDS
   ============================================================ */
.card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-base);
}

.card:hover {
    border-color: var(--text-tertiary);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--app-border);
}

.card-header h2 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.374px;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* ============================================================
   4. BUTTONS — Apple pill grammar
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    font-size: 17px;
    font-weight: 400;
    font-family: inherit;
    letter-spacing: -0.374px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast),
        border-color var(--transition-fast), box-shadow var(--transition-fast),
        transform var(--transition-fast);
    text-decoration: none !important;
    white-space: nowrap;
    user-select: none;
    min-height: 44px;
}

.btn:active {
    transform: scale(0.95);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--app-primary);
    color: #ffffff;
    border-color: var(--app-primary);
}

.btn-primary:hover {
    background: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
    color: #ffffff;
}

.btn-secondary {
    background: transparent;
    color: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-secondary:hover {
    background: var(--app-primary-subtle);
}

.btn-danger {
    background: var(--app-danger);
    color: #ffffff;
    border-color: var(--app-danger);
}

.btn-danger:hover {
    background: #e0352b;
    border-color: #e0352b;
    color: #ffffff;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 14px;
    letter-spacing: -0.224px;
}

.btn-ghost {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: 2px solid transparent !important;
}

.btn-ghost:hover {
    background: var(--app-surface-hover) !important;
    color: var(--text-primary) !important;
}

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

/* FAB Mobile */
.fab-mobile {
    display: none;
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--app-primary);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 102, 204, 0.4);
    cursor: pointer;
    z-index: var(--z-fab);
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-base);
}

.fab-mobile:hover {
    transform: scale(1.05);
}

.fab-mobile svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 834px) {
    .fab-mobile {
        display: flex !important;
        position: fixed !important;
    }
}

/* El FAB no debe quedar sobre el modal — se oculta completamente */
body.modal-open .fab-mobile {
    display: none !important;
}

.btn-desktop {
    display: flex !important;
}

@media (max-width: 834px) {
    .btn-desktop {
        display: none !important;
    }
}

/* ============================================================
   5. TABLES
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    padding: 12px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-tertiary);
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    white-space: nowrap;
}

thead th:first-child {
    padding-left: 24px;
}

thead th:last-child {
    padding-right: 24px;
}

tbody tr {
    border-bottom: 1px solid var(--app-border-light);
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--app-surface-hover);
}

tbody td {
    padding: 14px 20px;
    vertical-align: middle;
}

tbody td:first-child {
    padding-left: 24px;
}

tbody td:last-child {
    padding-right: 24px;
}

.cell-entity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.entity-avatar {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.entity-name {
    font-weight: 600;
    color: var(--text-primary);
}

.cell-amount {
    font-weight: 700 !important;
    font-size: 16px !important;
    color: var(--text-primary) !important;
    text-align: right !important;
    font-variant-numeric: tabular-nums !important;
}

.table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-tertiary);
    gap: 12px;
}

.table-empty svg {
    opacity: 0.4;
}

.table-empty p {
    font-size: 14px;
}

/* Row Actions */
.row-actions {
    display: flex !important;
    align-items: center;
    gap: 8px !important;
    justify-content: flex-end;
}

.row-action-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 12px !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--text-tertiary) !important;
    cursor: pointer;
    padding: 0 !important;
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.row-action-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
}

.row-action-btn:hover {
    transform: scale(1.18) translateY(-2px);
    z-index: 10;
}

.row-action-btn--edit:hover {
    color: var(--app-primary) !important;
    background: var(--app-primary-subtle) !important;
    border-color: var(--app-primary) !important;
}

.row-action-btn--delete:hover {
    color: var(--app-danger) !important;
    background: var(--app-danger-subtle) !important;
    border-color: var(--app-danger) !important;
}

.row-action-btn--duplicate:hover {
    color: #06b6d4 !important;
    background: rgba(6, 182, 212, 0.1) !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
}

.row-action-btn--pay:hover {
    color: var(--app-success) !important;
    background: var(--app-success-subtle) !important;
    border-color: var(--app-success) !important;
}

.row-action-btn--unlock:hover {
    color: var(--app-warning) !important;
    background: var(--app-warning-subtle) !important;
    border-color: var(--app-warning) !important;
}

.row-action-btn--view:hover {
    color: var(--app-primary) !important;
    background: var(--app-primary-subtle) !important;
    border-color: var(--app-primary) !important;
}

@media (max-width: 834px) {
    .row-actions {
        gap: 15px !important;
    }

    .row-action-btn {
        width: auto !important;
        height: 48px !important;
        min-width: 48px !important;
        padding: 0 16px !important;
        gap: 8px;
    }

    .row-action-btn span {
        display: inline !important;
        font-size: 14px;
        font-weight: 600;
    }
}

/* ============================================================
   6. APPLE LIST — Modern rows
   ============================================================ */
.apple-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--app-border);
    border-radius: var(--radius-lg);
    background: var(--app-surface);
}

.apple-list-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: var(--app-bg);
    border-bottom: 1px solid var(--app-border);
}

.apple-list-header-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-tertiary);
}

.apple-list-header-label--amount {
    text-align: right;
    min-width: 100px;
}

.apple-list-header-label--actions {
    min-width: 88px;
    text-align: center;
}

.apple-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--app-border-light);
    transition: background var(--transition-fast);
    cursor: default;
    min-height: 52px;
}

.apple-list-row:last-child {
    border-bottom: none;
}

.apple-list-row:hover {
    background: var(--app-surface-hover);
}

.apple-list-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.apple-list-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.apple-list-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.374px;
    line-height: 1.24;
}

.apple-list-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.apple-list-category {
    font-size: 12px;
    font-weight: 500;
    color: var(--app-primary);
    background: var(--app-primary-subtle);
    padding: 2px 10px;
    border-radius: var(--radius-xs);
    white-space: nowrap;
}

.apple-list-date {
    font-size: 13px;
    color: var(--text-tertiary);
    letter-spacing: -0.12px;
    white-space: nowrap;
}

.apple-list-amount-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 120px;
}

.apple-list-amount {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.374px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 1.24;
}

.apple-list-amount--paid {
    color: var(--text-tertiary);
    font-weight: 500;
}

.apple-list-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.apple-list-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.apple-list-status-badge--paid {
    background: var(--app-success-subtle);
    color: var(--app-success);
}

.apple-list-status-badge--paid::before {
    background: var(--app-success);
}

.apple-list-status-badge--pending {
    background: var(--app-warning-subtle);
    color: var(--app-warning);
}

.apple-list-status-badge--pending::before {
    background: var(--app-warning);
}

.apple-list-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.apple-list-date-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    gap: 0;
}

.apple-list-date-day {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--text-primary);
}

.apple-list-date-month {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.3px;
}

.apple-list-category-col {
    min-width: 80px;
}

.apple-list-action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.apple-list-action-btn:hover {
    background: var(--app-surface-hover);
    color: var(--app-primary);
}

.apple-list-action-btn--delete:hover {
    background: var(--app-danger-subtle);
    color: var(--app-danger);
}

/* ============================================================
   7. BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-success {
    background: var(--app-success-subtle);
    color: var(--app-success);
}

.badge-success .badge-dot {
    background: var(--app-success);
}

.badge-warning {
    background: var(--app-warning-subtle);
    color: var(--app-warning);
}

.badge-warning .badge-dot {
    background: var(--app-warning);
}

.badge-secondary {
    background: var(--app-surface-hover);
    color: var(--text-secondary);
}

.badge-secondary .badge-dot {
    background: var(--text-tertiary);
}

.category-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    letter-spacing: 0.1px;
    line-height: 1.4;
    transition: background 0.2s, color 0.2s;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.6;
    white-space: nowrap;
}

.badge-status.status-pagado {
    background: #064e3b !important;
    color: #34d399 !important;
}

.badge-status.status-pendiente {
    background: #451a03 !important;
    color: #fbbf24 !important;
}

.badge-status.status-vencido {
    background: #4c0519 !important;
    color: #f43f5e !important;
}

/* ============================================================
   8. MODALS
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: saturate(180%) blur(4px);
    overflow-y: auto;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 100%; /* inherits from overlay flex container constraints */
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    animation: modalIn 0.25s ease-out;
    flex-shrink: 1;
    align-self: center;
    margin: auto; /* centers and ensures it spans only available space */
}

.modal--sm {
    max-width: 400px;
}

.modal--md {
    max-width: 480px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
    flex-shrink: 0;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.374px;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
    background: var(--app-surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body--confirm {
    text-align: center;
    padding: 32px 24px 16px;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirm-icon--danger {
    background: var(--app-danger-subtle);
    color: var(--app-danger);
}

.confirm-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--app-border);
    flex-shrink: 0;
}

.modal-footer--confirm {
    justify-content: center;
}

.modal-form-field {
    margin-bottom: 18px;
}

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

.modal-form-field.has-error .modal-input {
    border-color: var(--app-danger);
    box-shadow: 0 0 0 3px var(--app-danger-subtle);
}

.modal-form-field .field-error {
    display: block;
    font-size: 12px;
    color: var(--app-danger);
    margin-top: 4px;
    min-height: 16px;
}

.modal-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--app-border);
    border-radius: var(--radius-sm);
    background: var(--app-surface);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.modal-input:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px var(--app-primary-ring);
}

.modal-input--select {
    cursor: pointer;
}

.modal-input-prefix-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.modal-input-prefix {
    position: absolute;
    left: 14px;
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 600;
    z-index: 1;
    pointer-events: none;
}

.modal-input-prefix-wrapper .modal-input {
    padding-left: 42px;
}

.radio-group {
    display: flex;
    gap: 16px;
}

.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    user-select: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--app-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition-fast);
    flex-shrink: 0;
}

.radio-custom::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--app-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.radio-option input:checked+.radio-custom {
    border-color: var(--app-primary);
}

.radio-option input:checked+.radio-custom::after {
    opacity: 1;
}

/* ============================================================
   9. TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left: 3px solid var(--app-success);
}

.toast.error {
    border-left: 3px solid var(--app-danger);
}

.toast.warning {
    border-left: 3px solid var(--app-warning);
}

.toast.info {
    border-left: 3px solid var(--app-primary);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--app-success);
}

.toast.error .toast-icon {
    color: var(--app-danger);
}

.toast.warning .toast-icon {
    color: var(--app-warning);
}

.toast.info .toast-icon {
    color: var(--app-primary);
}

.toast-content {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
    padding: 4px;
    margin-left: 8px;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ============================================================
   10. SKELETON
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--app-surface) 25%, var(--app-surface-hover) 50%, var(--app-surface) 75%);
    background-size: 200% 100%;
    animation: skel 1.5s ease-in-out infinite;
    border-radius: var(--radius-lg);
}

@keyframes skel {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 140px;
}

/* ============================================================
   11. FILTERS & INPUTS
   ============================================================ */
.filter-input,
.user-select,
.form-control {
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: 12px !important;
    padding: 8px 16px !important;
    font-size: 13.5px !important;
    color: var(--text-primary) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
}

.filter-input:focus,
.user-select:focus {
    border-color: var(--app-primary) !important;
    box-shadow: 0 0 0 3px var(--app-primary-ring) !important;
}

.filter-input--search {
    padding-left: 36px;
}

.filter-input--month {
    min-width: 150px;
}

.filter-input--select {
    min-width: 140px;
    cursor: pointer;
}

.filters-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-search {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.filter-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    z-index: 1;
}

.filter-search .filter-input {
    padding-left: 38px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============================================================
   12. TOMSELECT CUSTOM THEME
   ============================================================ */
.ts-control {
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--app-surface) !important;
    color: var(--text-primary) !important;
    font-size: 15px !important;
    font-family: inherit !important;
    padding: 8px 14px !important;
    box-shadow: none !important;
    min-height: 42px !important;
    display: flex !important;
    align-items: center !important;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast) !important;
}

.ts-control.focus {
    border-color: var(--app-primary) !important;
    box-shadow: 0 0 0 3px var(--app-primary-ring) !important;
}

.ts-control>input {
    color: var(--text-primary) !important;
    font-family: inherit !important;
    font-size: 15px !important;
}

.ts-dropdown {
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    color: var(--text-primary) !important;
    font-size: 15px !important;
    margin-top: 4px !important;
    overflow: hidden !important;
    z-index: 10000 !important;
}

.ts-dropdown .option {
    padding: 10px 14px !important;
    color: var(--text-primary) !important;
    cursor: pointer !important;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: var(--app-surface-hover) !important;
    color: var(--app-primary) !important;
}

.ts-wrapper.single .ts-control:after {
    border-color: var(--text-secondary) transparent transparent transparent !important;
    border-width: 5px 4px 0 4px !important;
}

/* ============================================================
   13. DROPDOWN ACTIONS (Three-dot menu)
   ============================================================ */
.dropdown-actions {
    position: relative;
    display: inline-block;
}

.btn-dropdown-trigger {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 18px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-dropdown-trigger:hover,
.btn-dropdown-trigger:focus {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.dropdown-actions-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 180px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.dropdown-actions-menu.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-actions-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast);
}

.dropdown-actions-item:hover {
    background: var(--app-surface-hover);
}

.dropdown-actions-item.delete-action {
    color: var(--app-danger);
}

.dropdown-actions-item.delete-action:hover {
    background: var(--app-danger-subtle);
}

/* ============================================================
   14. CHARTS
   ============================================================ */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

.chart-container {
    padding: 24px;
    position: relative;
    height: 350px;
}

.chart-empty {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* ============================================================
   15. RESPONSIVE OVERRIDES - MOBILE & TABLET
   ============================================================ */
@media (max-width: 1024px) {
    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 834px) {
    .page-title {
        font-size: 28px;
    }

    .page-header-right {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .page-header-right .btn {
        font-size: 14px;
        padding: 8px 16px;
    }

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

    .page-header-right .btn-desktop {
        display: none !important;
    }

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

    .card-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .card-header .search-bar {
        width: 100%;
        max-width: 100%;
    }
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
        bottom: var(--bottom-nav-height);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .modal {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 85vh;
        overflow-y: auto;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin: 0;
        animation: modalSlideUp 0.3s ease-out;
    }

    .modal--sm {
        max-width: 100% !important;
        width: 100% !important;
    }

    .modal--md {
        max-width: 100% !important;
        width: 100% !important;
    }

    @keyframes modalSlideUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .modal-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .apple-list-header {
        display: none;
    }

    .apple-list-row {
        padding: 14px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .apple-list-row .apple-list-icon {
        order: 0;
    }

    .apple-list-row .apple-list-date-col {
        order: 1;
    }

    .apple-list-row .apple-list-content {
        order: 2;
        flex: 1 1 calc(100% - 120px);
        min-width: 150px;
    }

    .apple-list-row .apple-list-category-col {
        order: 4;
        min-width: auto;
        flex: 0 0 auto;
    }

    .apple-list-row .apple-list-amount-wrapper {
        order: 3;
        min-width: auto;
        margin-left: auto;
    }

    .apple-list-row .apple-list-status-col {
        order: 5;
        min-width: auto;
        flex: 0 0 auto;
    }

    .apple-list-row .apple-list-actions {
        order: 6;
    }

    .apple-list-amount {
        font-size: 17px;
    }

    .apple-list-title {
        font-size: 15px;
    }

    .apple-list-category {
        font-size: 11px;
        padding: 1px 8px;
    }

    .apple-list-status-badge {
        font-size: 11px;
        padding: 2px 8px;
    }

    .apple-list-date-day {
        font-size: 15px;
    }

    .apple-list-date-month {
        font-size: 9px;
    }

    .apple-list-icon {
        width: 40px;
        height: 40px;
    }

    .apple-list-icon svg {
        width: 16px;
        height: 16px;
    }

    .apple-list-action-btn {
        width: 36px;
        height: 36px;
    }

    .apple-list-action-btn svg {
        width: 16px;
        height: 16px;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-search {
        min-width: 0;
        width: 100%;
    }

    .filter-input--month,
    .filter-input--select {
        min-width: 0;
        width: 100%;
    }

    /* Tablas → cards apiladas en mobile/tablet */
    .table-responsive {
        overflow: visible;
    }

    .card .table-wrapper table thead,
    .card table thead,
    #expensesMainTable thead,
    #usersTable thead,
    #creditsMainTable thead,
    .expenses-table-card .table-wrapper table thead,
    .users-table-card .table-wrapper table thead,
    .credits-table-card .table-wrapper table thead {
        display: none;
    }

    .card .table-wrapper table,
    .card .table-wrapper table tbody,
    .card .table-wrapper table tr,
    .card .table-wrapper table td,
    .card table,
    .card table tbody,
    .card table tr,
    .card table td,
    #expensesMainTable,
    #expensesMainTable tbody,
    #expensesMainTable tr,
    #expensesMainTable td,
    #usersTable,
    #usersTable tbody,
    #usersTable tr,
    #usersTable td,
    #creditsMainTable,
    #creditsMainTable tbody,
    #creditsMainTable tr,
    #creditsMainTable td,
    .expenses-table-card .table-wrapper table,
    .expenses-table-card .table-wrapper table tbody,
    .expenses-table-card .table-wrapper table tr,
    .expenses-table-card .table-wrapper table td,
    .users-table-card .table-wrapper table,
    .users-table-card .table-wrapper table tbody,
    .users-table-card .table-wrapper table tr,
    .users-table-card .table-wrapper table td,
    .credits-table-card .table-wrapper table,
    .credits-table-card .table-wrapper table tbody,
    .credits-table-card .table-wrapper table tr,
    .credits-table-card .table-wrapper table td {
        display: block;
        width: 100%;
    }

    .card .table-wrapper table tr,
    .card table tr,
    #expensesMainTable tr,
    #usersTable tr,
    #creditsMainTable tr:not(.credits-detail-row),
    .expenses-table-card .table-wrapper table tr,
    .users-table-card .table-wrapper table tr,
    .credits-table-card .table-wrapper table tr:not(.credits-detail-row) {
        background: var(--app-surface);
        border: 1px solid var(--app-border);
        border-radius: 16px;
        margin-bottom: 16px;
        padding: 16px;
        box-shadow: var(--shadow-sm);
        position: relative;
    }

    .card .table-wrapper table td,
    .card table td,
    #expensesMainTable td,
    #usersTable td,
    #creditsMainTable td,
    .expenses-table-card .table-wrapper table td,
    .users-table-card .table-wrapper table td,
    .credits-table-card .table-wrapper table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--app-border-light);
        text-align: right;
        font-size: 14px;
        color: var(--text-primary);
        word-break: break-word;
    }

    .card .table-wrapper table td .cell-entity,
    .card table td .cell-entity,
    #expensesMainTable td .cell-entity,
    #usersTable td .cell-entity,
    #creditsMainTable td .cell-entity,
    .expenses-table-card .table-wrapper table td .cell-entity,
    .users-table-card .table-wrapper table td .cell-entity,
    .credits-table-card .table-wrapper table td .cell-entity {
        display: flex !important;
        justify-content: flex-end;
        width: auto;
        flex: 1;
    }

    .card .table-wrapper table td:not([data-label]),
    .card table td:not([data-label]),
    #expensesMainTable td:not([data-label]),
    #usersTable td:not([data-label]),
    #creditsMainTable td:not([data-label]),
    .expenses-table-card .table-wrapper table td:not([data-label]),
    .users-table-card .table-wrapper table td:not([data-label]),
    .credits-table-card .table-wrapper table td:not([data-label]) {
        justify-content: flex-end;
        gap: 8px;
    }

    .card .table-wrapper table td:last-child,
    .card table td:last-child,
    #expensesMainTable td:last-child,
    #usersTable td:last-child,
    #creditsMainTable td:last-child,
    .expenses-table-card .table-wrapper table td:last-child,
    .users-table-card .table-wrapper table td:last-child,
    .credits-table-card .table-wrapper table td:last-child {
        border-bottom: none;
        padding-top: 16px;
        justify-content: flex-start;
        gap: 10px;
        flex-wrap: wrap;
    }

    .card .table-wrapper table td[data-label]::before,
    .card table td[data-label]::before,
    #expensesMainTable td[data-label]::before,
    #usersTable td[data-label]::before,
    #creditsMainTable td[data-label]::before,
    .expenses-table-card .table-wrapper table td[data-label]::before,
    .users-table-card .table-wrapper table td[data-label]::before,
    .credits-table-card .table-wrapper table td[data-label]::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-tertiary);
        text-align: left;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.8px;
        margin-right: auto;
        flex-shrink: 0;
    }

    .card .table-wrapper table td.d-none,
    .card .table-wrapper table td.d-md-table-cell,
    .card table td.d-none,
    .card table td.d-md-table-cell,
    #expensesMainTable td.d-none,
    #expensesMainTable td.d-md-table-cell,
    #usersTable td.d-none,
    #usersTable td.d-md-table-cell,
    #creditsMainTable td.d-none,
    #creditsMainTable td.d-md-table-cell,
    .expenses-table-card .table-wrapper table td.d-none,
    .expenses-table-card .table-wrapper table td.d-md-table-cell,
    .users-table-card .table-wrapper table td.d-none,
    .users-table-card .table-wrapper table td.d-md-table-cell,
    .credits-table-card .table-wrapper table td.d-none,
    .credits-table-card .table-wrapper table td.d-md-table-cell {
        display: none !important;
    }

    .card .table-wrapper table td .badge,
    .card table td .badge,
    #expensesMainTable td .badge,
    #usersTable td .badge,
    #creditsMainTable td .badge,
    .expenses-table-card .table-wrapper table td .badge,
    .users-table-card .table-wrapper table td .badge,
    .credits-table-card .table-wrapper table td .badge {
        margin: 0;
    }

    .btn-sm {
        height: 38px;
        padding: 0 16px;
        flex: 0 1 auto;
        min-width: auto;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 21px;
    }

    .page-header {
        flex-direction: column;
    }

    .page-header-right {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .page-header-right .btn,
    .page-header-right form {
        width: 100% !important;
    }

    .fab-mobile {
        display: flex !important;
        position: fixed !important;
    }

    .topbar {
        padding: 0 12px;
        height: 56px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }

    .main-content {
        padding-top: 56px;
    }

    .content-body {
        padding: 12px;
        padding-bottom: 100px;
    }
}

/* Modal centrado en desktop */
@media (min-width: 834px) {
    .modal-overlay {
        align-items: center !important;
        justify-content: center !important;
        padding: 20px !important;
    }

    .modal {
        margin-top: 0 !important;
        max-width: 520px !important;
        border-radius: var(--radius-lg) !important;
    }
}

/* Small phones (≤480px) */
@media (max-width: 480px) {
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .page-title {
        font-size: 19px;
    }

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

    .toast-container {
        left: 5px;
        right: 5px;
        width: 95%;
    }
}

/* Utility classes extracted from inline styles */
.mr-2px { margin-right: 2px !important; }
.mr-4px { margin-right: 4px !important; }
.mt-4px { margin-top: 4px !important; }
.mt-8px { margin-top: 8px !important; }
.mt-18px { margin-top: 18px !important; }
.mt-20px { margin-top: 20px !important; }
.p-40px { padding: 40px !important; }
.py-60px-px-20px { padding: 60px 20px !important; }
.text-center { text-align: center !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-primary { color: var(--text-primary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-app-primary { color: var(--app-primary) !important; }
.text-success { color: var(--app-success) !important; }
.text-warning-amber { color: #fbbf24 !important; }
.bg-primary-subtle-text { background: var(--app-primary-subtle) !important; color: var(--app-primary) !important; }
.fw-400 { font-weight: 400 !important; }
.fw-500 { font-weight: 500 !important; }
.font-11px { font-size: 11px !important; }
.font-14px { font-size: 14px !important; }
.font-18px { font-size: 18px !important; }
.text-decoration-none { text-decoration: none !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.border-none { border: none !important; }
.vertical-align-sub { vertical-align: -2px !important; }

/* Display Utilities */
.d-none { display: none !important; }

@media (min-width: 835px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    .d-md-table-cell { display: table-cell !important; }
    .d-md-table-row { display: table-row !important; }
}

.reports-d-md-none { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; color: var(--text-secondary); font-size: 11px; }
