@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #090c1a;
    --card: rgba(255, 255, 255, 0.05);
    --card-hover: rgba(255, 255, 255, 0.08);
    --line: rgba(255, 255, 255, 0.09);
    --line-focus: rgba(34, 211, 238, 0.5);
    --txt: #f1f4ff;
    --mut: #949ab8;
    --p1: #7c5cff;
    --p2: #22d3ee;
    --p-grad: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
    --ok: #34d399;
    --warn: #fbbf24;
    --bad: #fb7185;
    --info: #38bdf8;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--txt);
    min-height: 100vh;
    background: radial-gradient(1000px 600px at 20% -10%, #271a5c 0%, transparent 60%),
                radial-gradient(900px 500px at 100% 10%, #0d3e54 0%, transparent 55%),
                var(--bg);
    background-attachment: fixed;
    line-height: 1.4;
    padding-bottom: 40px;
}

body.center {
    display: grid;
    place-items: center;
    padding: 1rem;
    min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1.05rem; }

.muted { color: var(--mut); font-size: 0.85rem; }
.color-ok { color: var(--ok); }
.color-warn { color: var(--warn); }
.color-info { color: var(--info); }
.alert-text { color: var(--bad); font-weight: 600; }

/* Top Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 680px;
    margin: 0 auto;
    padding: 1rem 1.1rem 0.6rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-icon {
    font-size: 1.6rem;
    background: rgba(124, 92, 255, 0.18);
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 12px;
    border: 1px solid rgba(124, 92, 255, 0.3);
}
.user-greeting { font-size: 0.78rem; color: var(--mut); display: block; }

/* Navigation Tabs Móvil */
.tabs-bar {
    display: flex;
    gap: 0.4rem;
    max-width: 680px;
    margin: 0.5rem auto 1rem;
    padding: 0 1rem;
    position: sticky;
    top: 0.5rem;
    z-index: 20;
}
.tab-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: rgba(13, 16, 32, 0.75);
    border: 1px solid var(--line);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--mut);
    padding: 0.65rem 0.5rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tab-item:hover { color: var(--txt); }
.tab-item.active {
    background: var(--p-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(124, 92, 255, 0.35);
}
.tab-icon { font-size: 1rem; }

/* Main Container */
.app-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1rem;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.25s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards Generales */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
.card-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}
.card-title { font-size: 1.05rem; }

/* Hero Card (Meta Diaria) */
.hero-card {
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.16) 0%, rgba(34, 211, 238, 0.08) 100%), var(--card);
    border: 1px solid rgba(124, 92, 255, 0.3);
    position: relative;
    overflow: hidden;
}
.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.badge-pill {
    background: rgba(124, 92, 255, 0.25);
    color: #c4b5fd;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    border: 1px solid rgba(124, 92, 255, 0.4);
}
.hero-date { font-size: 0.8rem; color: var(--mut); }
.hero-amount {
    font-size: 2.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    background: linear-gradient(135deg, #ffffff 40%, #a5f3fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0.2rem 0;
}
.hero-hint { margin: 0 0 1rem; color: var(--mut); font-size: 0.85rem; }
.progress-wrap { margin-top: 0.6rem; }
.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

/* Barras de Progreso */
.bar {
    height: 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.bar.big { height: 12px; }
.bar i {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: var(--p-grad);
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar i.warn { background: var(--warn); }
.bar i.danger { background: var(--bad); }

/* Efectivo */
.cash-metric-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.metric-val { font-size: 1.85rem; font-weight: 700; }
.metric-sub { font-size: 0.82rem; color: var(--mut); }
.small-msg { margin: 0.4rem 0 0.8rem; min-height: 1.2rem; }

/* Acordeón para colapsar y ahorrar vista */
.accordion {
    border-top: 1px solid var(--line);
    margin-top: 0.7rem;
    padding-top: 0.6rem;
}
.accordion.sub-accordion {
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
    margin-top: 0.4rem;
}
.accordion-summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--txt);
    user-select: none;
    padding: 0.3rem 0;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-summary .arrow { font-size: 0.7rem; color: var(--mut); transition: transform 0.2s ease; }
.accordion[open] > .accordion-summary .arrow { transform: rotate(180deg); }
.muted-summary { color: var(--mut); font-weight: 500; font-size: 0.8rem; }
.accordion-body { padding-top: 0.6rem; }

/* Lista de Gastos en Efectivo */
.list { display: grid; gap: 0.35rem; }
.row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.5rem;
    background: rgba(0, 0, 0, 0.18);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* Gastos Fijos (Items) */
.expenses-list { display: grid; gap: 0.75rem; margin-top: 0.5rem; }
.item {
    padding: 0.95rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    display: grid;
    gap: 0.6rem;
    transition: border-color 0.2s;
}
.item:hover { border-color: rgba(255, 255, 255, 0.2); }
.item.done {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.03);
}
.item.done .bar i { background: var(--ok); }
.item-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}
.item-title-col { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.item-title-col strong { font-size: 1rem; }
.item-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* Tags y Badges */
.tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(124, 92, 255, 0.2);
    color: #c4b5fd;
    padding: 0.15rem 0.5rem;
    border-radius: 99px;
    font-weight: 600;
}
.tag.ok-tag {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.35);
}
.tag.warn-tag {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

/* Acciones de cada gasto */
.actions {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}
.actions input {
    width: 72px;
    padding: 0.38rem 0.45rem;
    font-size: 0.85rem;
    text-align: right;
}

/* Botones */
.btn {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.95rem;
    font-family: inherit;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-decoration: none;
    transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
    background: var(--p-grad);
    box-shadow: 0 4px 12px rgba(124, 92, 255, 0.3);
}
.btn.ok { background: var(--ok); color: #064e3b; font-weight: 700; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.82rem; border-radius: 8px; }
.btn.icon-btn { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

/* Formularios & Inputs */
input, select {
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--line);
    color: var(--txt);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.8rem;
    font: inherit;
    min-width: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--p2);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}
.input-lg { font-size: 1.3rem; font-weight: 700; text-align: center; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.row.small { align-items: center; }

/* MODALES (<dialog>) */
.modal-dialog {
    background: transparent;
    border: 0;
    padding: 1rem;
    max-width: 440px;
    width: 100%;
}
.modal-dialog::backdrop {
    background: rgba(4, 7, 18, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.modal-content {
    background: #12162d;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-lg);
    padding: 1.3rem;
    color: var(--txt);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    display: grid;
    gap: 1rem;
    animation: modalPop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 0;
    color: var(--mut);
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.close-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.15); }
.form-group { display: grid; gap: 0.35rem; }
.form-group label { font-size: 0.82rem; color: var(--mut); font-weight: 500; }
.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}
.modal-actions .btn { flex: 1; }

/* Reportes View */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 0.8rem;
}
.stat-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    display: grid;
    gap: 0.25rem;
}
.stat-box strong { font-size: 1.35rem; }
.categories-bars { display: grid; gap: 0.6rem; margin-top: 0.8rem; }
.cat-bar-item { display: grid; gap: 0.25rem; font-size: 0.85rem; }
.cat-bar-header { display: flex; justify-content: space-between; }

/* Tickets IA Escáner */
.drop-zone {
    display: grid;
    gap: 0.35rem;
    justify-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
    border: 2px dashed rgba(124, 92, 255, 0.5);
    border-radius: var(--radius-lg);
    cursor: pointer;
    margin-bottom: 0.8rem;
    background: rgba(124, 92, 255, 0.06);
    transition: all 0.2s;
    color: var(--txt);
}
.drop-zone:hover, .drop-zone:active {
    background: rgba(124, 92, 255, 0.14);
    border-color: var(--p2);
}
.drop-icon { font-size: 2.2rem; }
.check-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.84rem;
    color: var(--mut);
    margin-bottom: 0.8rem;
    cursor: pointer;
}
.chips-container { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.chip {
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.25);
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.8rem;
}
.tickets-grid { display: grid; gap: 0.6rem; }
.rec {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.18);
}
.rec img {
    width: 68px; height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}
.rec-body { flex: 1; display: grid; gap: 0.3rem; min-width: 0; }
.key-status-text { font-size: 0.82rem; margin-left: 0.5rem; }

/* Responsive móvil */
@media (max-width: 480px) {
    .hero-amount { font-size: 2.3rem; }
    .metric-val { font-size: 1.6rem; }
    .top-nav { padding: 0.8rem 1rem 0.4rem; }
    .card { padding: 1rem; border-radius: var(--radius-md); }
    .item { padding: 0.85rem; }
}

/* Animación de carga para escáner de tickets */
.drop-zone.loading {
    opacity: 0.75;
    pointer-events: none;
    border-color: var(--p2);
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.35);
    animation: dropPulse 1.4s ease-in-out infinite alternate;
}
@keyframes dropPulse {
    from { transform: scale(1); border-color: var(--p1); }
    to { transform: scale(0.99); border-color: var(--p2); }
}

/* Smalltext Gasto Real Mensual y División */
.hero-subtext {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: var(--mut);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    display: inline-block;
}
.hero-subtext b {
    color: var(--txt);
}

/* Calendario de Metas Diarias */
.cal-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}
.cal-title-center {
    text-align: center;
}
.cal-title-center h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.cal-summary-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.cal-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.3rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    text-align: center;
}
.cal-chip.ok { background: rgba(52, 211, 153, 0.08); border-color: rgba(52, 211, 153, 0.25); color: var(--ok); }
.cal-chip.danger { background: rgba(251, 113, 133, 0.08); border-color: rgba(251, 113, 133, 0.25); color: var(--bad); }
.cal-chip.purple { background: rgba(124, 92, 255, 0.08); border-color: rgba(124, 92, 255, 0.25); color: var(--p1); }
.cal-chip-num {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
}
.cal-chip-label {
    font-size: 0.68rem;
    color: var(--mut);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 2px;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--mut);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.cal-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
}
.cal-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.2rem 0.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--txt);
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    position: relative;
    user-select: none;
}
.cal-cell:active {
    transform: scale(0.95);
}
.cal-cell.empty {
    border: none;
    background: transparent;
    cursor: default;
    pointer-events: none;
}
.cal-date-num {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}
.cal-cell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: 100%;
}
.cal-badge-mini {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
}
.cal-badge-mini.ok {
    background: rgba(52, 211, 153, 0.2);
    color: var(--ok);
}
.cal-badge-mini.missed {
    background: rgba(251, 113, 133, 0.15);
    color: var(--bad);
}
.cal-badge-mini.today {
    background: rgba(34, 211, 238, 0.2);
    color: var(--p2);
}
.cal-amt-sub {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--ok);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.cal-cell.ok {
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.08);
}
.cal-cell.missed {
    border-color: rgba(251, 113, 133, 0.25);
    background: rgba(251, 113, 133, 0.04);
    color: var(--mut);
}
.cal-cell.is-today {
    border-color: var(--p1);
    box-shadow: 0 0 10px rgba(124, 92, 255, 0.35);
    background: rgba(124, 92, 255, 0.12);
}
.cal-cell.future {
    opacity: 0.55;
    border-style: dashed;
}

.cal-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
    font-size: 0.72rem;
    color: var(--mut);
}
.leg-tag {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.leg-bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.leg-bullet.ok { background: var(--ok); }
.leg-bullet.missed { background: var(--bad); }
.leg-bullet.today { background: var(--p1); }
.leg-bullet.future { background: var(--mut); opacity: 0.4; }

.cal-status-badge {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.4;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}
.cal-status-badge.ok { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }
.cal-status-badge.missed { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.35); color: #fecdd3; }
.cal-status-badge.today { background: rgba(124, 92, 255, 0.12); border-color: rgba(124, 92, 255, 0.35); color: #ddd6fe; }
.cal-status-badge.future { background: rgba(255, 255, 255, 0.05); color: var(--mut); }


