/* Tipografía Global */
:root {
    color-scheme: light;
    --page-bg: #eef4ef;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-solid: #ffffff;
    --surface-soft: #f7faf7;
    --text: #173327;
    --text-soft: #65746b;
    --border: rgba(36, 80, 61, 0.12);
    --border-strong: rgba(36, 80, 61, 0.2);
    --green-900: #173f32;
    --green-800: #24543f;
    --green-700: #2f6f52;
    --green-600: #3f8764;
    --green-100: #e4f0e7;
    --danger: #9e4742;
    --danger-soft: #f8e9e7;
    --radius-xl: 26px;
    --radius-lg: 18px;
    --radius-md: 13px;
    --shadow: 0 24px 60px rgba(35, 67, 53, 0.11);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    /* Fondo con gradiente animado suave */
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--page-bg);
    /* Opcional: Si prefieres el fondo colorido anterior, descomenta la siguiente línea y comenta la de arriba */
    /* background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab); */
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(63, 135, 100, 0.24);
    outline-offset: 2px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Efecto Glassmorphism (Panel Principal) */
.app-shell {
    width: min(1180px, calc(100% - 32px));
    min-height: calc(100vh - 48px);
    margin: 24px auto 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: var(--radius-xl);
    background: var(--surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

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

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

.brand-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 auto;
}

.brand-icon img {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.brand-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.brand-name {
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.045em;
}

.brand-subtitle {
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 500;
}

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

.secondary-button,
.icon-button,
.primary-button,
.status-button,
.modal-close {
    border: 1px solid var(--border-strong);
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.56);
    color: var(--green-800);
    font-size: 0.82rem;
    font-weight: 650;
}

.secondary-button:hover {
    background: var(--surface-solid);
    border-color: rgba(47, 111, 82, 0.3);
}

.icon-button {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 12px;
    background: var(--green-800);
    color: #ffffff;
}

.icon-button:hover {
    background: var(--green-900);
}

.app-content {
    display: grid;
    grid-template-columns: minmax(250px, 0.72fr) minmax(0, 1.65fr);
    gap: 20px;
    padding: 20px 24px 28px;
    align-items: start;
}

.summary-column {
    display: grid;
    gap: 14px;
}

/* Tarjetas de Lista */
.summary-card,
.method-card,
.history-panel,
.glass-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.summary-card {
    padding: 22px;
    background: var(--green-900);
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(23, 63, 50, 0.16);
}

.summary-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 5px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.summary-card h2 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.goal-copy {
    text-align: right;
}

.goal-copy p:last-child {
    margin: 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.95rem;
    font-weight: 650;
}

.progress-track {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 9px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.75rem;
    font-weight: 600;
}

.method-card {
    padding: 18px;
    background: rgba(255, 255, 255, 0.55);
}

.method-label {
    display: block;
    margin-bottom: 5px;
    color: var(--green-700);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.method-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
}

.method-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.8rem;
    line-height: 1.55;
}

.history-panel {
    min-width: 0;
    padding: 18px;
    background: rgba(255, 255, 255, 0.48);
}

.history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 2px 15px;
    border-bottom: 1px solid var(--border);
}

.history-heading h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.history-heading p {
    margin: 4px 0 0;
    color: var(--text-soft);
    font-size: 0.75rem;
}

.savings-list {
    display: grid;
    gap: 10px;
    padding-top: 14px;
}

.saving-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 14px 15px;
    background: rgba(255, 255, 255, 0.72);
    border-color: var(--border);
    border-radius: var(--radius-md);
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.saving-item:hover {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(47, 111, 82, 0.2);
    box-shadow: 0 8px 22px rgba(35, 67, 53, 0.05);
}

.saving-item.is-completed {
    background: rgba(228, 240, 231, 0.72);
    border-color: rgba(63, 135, 100, 0.22);
}

.saving-item.is-skipped {
    background: rgba(248, 233, 231, 0.62);
    border-color: rgba(158, 71, 66, 0.2);
}

/* Checkbox Personalizado (Animado) */
.saving-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
}

.saving-day,
.saving-amount {
    display: grid;
    gap: 2px;
}

.saving-day span,
.saving-amount span {
    color: var(--text-soft);
    font-size: 0.7rem;
    font-weight: 550;
}

.saving-day strong,
.saving-amount strong {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}

.saving-amount {
    text-align: right;
}

.saving-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.status-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 11px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.64);
    color: var(--text-soft);
    font-size: 0.75rem;
    font-weight: 650;
}

.status-button:hover {
    background: #ffffff;
}

.save-button.is-active {
    border-color: rgba(47, 111, 82, 0.28);
    background: var(--green-100);
    color: var(--green-800);
}

.skip-button.is-active {
    border-color: rgba(158, 71, 66, 0.24);
    background: var(--danger-soft);
    color: var(--danger);
}

/* Barra de progreso */
.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: #71ad86;
    transition: width 320ms ease; /* Efecto rebote suave */
}

.empty-state {
    padding: 44px 20px;
    color: var(--text-soft);
    text-align: center;
    font-size: 0.85rem;
}

/* Scrollbar Personalizado (Fino y Elegante) */
.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(47, 111, 82, 0.16);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(47, 111, 82, 0.32);
}

.project-footer {
    width: min(1180px, calc(100% - 32px));
    margin: 22px auto 0;
    padding: 18px 8px 28px;
    color: #68776e;
    font-size: 0.78rem;
    text-align: center;
}

.project-footer p {
    margin: 3px 0;
}

.project-footer a {
    color: var(--green-800);
    text-decoration: none;
}

.project-footer a:hover,
.project-footer a:focus-visible {
    text-decoration: underline;
}

/* Elementos de fondo borrosos */
.config-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(17, 31, 24, 0.42);
    opacity: 0;
    transition: opacity 180ms ease;
}

.config-modal.hidden {
    display: none;
}

.config-modal.is-open {
    opacity: 1;
}

.config-card {
    width: min(430px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 28px 70px rgba(20, 48, 36, 0.2);
    transform: translateY(8px);
    transition: transform 180ms ease;
}

.config-card.is-open {
    transform: translateY(0);
}

.config-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.config-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--green-700);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.config-header h3 {
    margin: 0;
    font-size: 1.45rem;
    letter-spacing: -0.04em;
}

.modal-close {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--text-soft);
}

.modal-close:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.config-fields {
    display: grid;
    gap: 12px;
}

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

.field-card {
    display: grid;
    gap: 6px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.field-card > span,
.days-field > span {
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.field-card input {
    width: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 650;
}

.days-field {
    display: grid;
    gap: 8px;
}

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

.days-grid label {
    cursor: pointer;
}

.days-grid input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.days-grid span {
    display: grid;
    min-height: 38px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 0.75rem;
    font-weight: 700;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.days-grid input:checked + span {
    border-color: var(--green-700);
    background: var(--green-800);
    color: #ffffff;
}

.primary-button {
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
    border-color: var(--green-800);
    border-radius: 12px;
    background: var(--green-800);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
}

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

.reset-note {
    margin: -3px 0 0;
    color: var(--text-soft);
    font-size: 0.7rem;
    text-align: center;
}

.notice-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(17, 31, 24, 0.34);
    opacity: 0;
    transition: opacity 180ms ease;
}

.notice-modal.hidden {
    display: none;
}

.notice-modal.is-open {
    opacity: 1;
}

.notice-card {
    display: grid;
    width: min(410px, 100%);
    gap: 16px;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 24px 60px rgba(20, 48, 36, 0.18);
    transform: translateY(8px);
    transition: transform 180ms ease;
}

.notice-card.is-open {
    transform: translateY(0);
}

.notice-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    background: var(--green-100);
    color: var(--green-800);
    font-size: 1rem;
}

.notice-card[data-tone="warning"] .notice-icon {
    background: #f7efe1;
    color: #93621d;
}

.notice-card[data-tone="success"] .notice-icon {
    background: var(--green-100);
    color: var(--green-800);
}

.notice-copy h3 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 1.18rem;
    letter-spacing: -0.035em;
}

.notice-copy p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.83rem;
    line-height: 1.6;
}

.notice-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.notice-primary,
.notice-secondary {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    font-size: 0.8rem;
    font-weight: 700;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.notice-primary {
    border-color: var(--green-800);
    background: var(--green-800);
    color: #ffffff;
}

.notice-primary:hover {
    background: var(--green-900);
}

.notice-secondary {
    background: var(--surface-soft);
    color: var(--text-soft);
}

.notice-secondary:hover {
    background: #ffffff;
    color: var(--text);
}

.notice-secondary.hidden {
    display: none;
}

/* Ajustes para móviles muy pequeños */
@media (max-width: 820px) {
    .app-shell {
        width: min(720px, calc(100% - 24px));
        margin-top: 12px;
        border-radius: 22px;
    }

    .app-content {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .app-header {
        padding: 18px 16px 15px;
    }

    .project-footer {
        width: calc(100% - 24px);
    }
}

@media (max-width: 620px) {
    .secondary-button span {
        display: none;
    }

    .secondary-button {
        width: 40px;
        padding: 0;
        justify-content: center;
    }

    .saving-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .saving-actions {
        width: 100%;
    }

    .status-button {
        flex: 1;
    }
}

@media (max-width: 420px) {
    .app-shell {
        width: calc(100% - 16px);
        margin-top: 8px;
        border-radius: 18px;
    }

    .app-header {
        align-items: flex-start;
    }

    .brand-icon,
    .brand-icon img {
        width: 38px;
        height: 38px;
    }

    .brand-name {
        font-size: 1.3rem;
    }

    .brand-subtitle {
        font-size: 0.7rem;
    }

    .app-content {
        padding: 12px;
    }

    .summary-card,
    .history-panel,
    .method-card {
        border-radius: 16px;
    }

    .summary-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .goal-copy,
    .saving-amount {
        text-align: left;
    }

    .saving-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

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

    .days-grid {
        gap: 4px;
    }

    .days-grid span {
        min-height: 34px;
        border-radius: 8px;
    }

    .project-footer {
        width: calc(100% - 16px);
        padding-bottom: 22px;
    }
}
