
/* Anthropic Sans: Text para lectura, Display para títulos y cifras grandes */
@font-face { font-family: 'Anthropic Sans Text'; src: url('fonts/AnthropicSans-Text-Regular-Static.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Anthropic Sans Text'; src: url('fonts/AnthropicSans-Text-Medium-Static.otf') format('opentype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Anthropic Sans Text'; src: url('fonts/AnthropicSans-Text-Semibold-Static.otf') format('opentype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Anthropic Sans Text'; src: url('fonts/AnthropicSans-Text-Bold-Static.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Anthropic Sans Text'; src: url('fonts/AnthropicSans-Text-Extrabold-Static.otf') format('opentype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Anthropic Sans Display'; src: url('fonts/AnthropicSans-Display-Bold-Static.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Anthropic Sans Display'; src: url('fonts/AnthropicSans-Display-Extrabold-Static.otf') format('opentype'); font-weight: 800; font-style: normal; font-display: swap; }

/* Títulos y cifras grandes en Display */
.app-brand,
.hero-amount-usd,
.amount-hero-val,
.binance-bal,
.section-title,
.sheet-title,
.cat-item-name,
.balance-usd {
    font-family: 'Anthropic Sans Display', 'Anthropic Sans Text', -apple-system, sans-serif;
}

:root {
    --bg-page: #000000;
    --card-bg: #141814;
    --primary-matcha: #72B01D;
    --primary-dark: #B9E572;
    --primary-light: #1C2617;
    --text-main: #F2F7EA;
    --text-muted: #9AAB88;
    --border: #2A3424;
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 14px 34px rgba(114, 176, 29, 0.18);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Anthropic Sans Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    padding: 20px 18px 90px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Header */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 2px;
}
.app-brand {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.6px;
}
.bcv-chip {
    background: #141814;
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Tarjeta Principal Hero (Estilo Matcha Suave) */
.hero-card {
    background: linear-gradient(135deg, #2D4A12 0%, #132609 100%);
    border-radius: 28px;
    padding: 26px 22px;
    color: #FFFFFF;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
}
.hero-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    pointer-events: none;
}
.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hero-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    opacity: 0.9;
}
.hero-amount-usd {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -1.2px;
    line-height: 1.05;
}
.hero-amount-bs {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 4px;
}

/* Resumen Stats */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.stat-card {
    background: #141814;
    border-radius: 22px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}
.stat-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.stat-val-income {
    color: #6FD13A;
    font-size: 19px;
    font-weight: 800;
}
.stat-val-expense {
    color: #FF5C5C;
    font-size: 19px;
    font-weight: 800;
}

/* Botones de acción */
.actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.pill-btn {
    border: none;
    outline: none;
    padding: 15px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.12s ease;
}
.pill-btn:active {
    transform: scale(0.96);
}
.pill-btn-income {
    background: #72B01D;
    color: #FFFFFF;
    box-shadow: 0 8px 20px rgba(114, 176, 29, 0.25);
}
.pill-btn-expense {
    background: #1C2617;
    color: #B9E572;
    border: 1px solid var(--border);
}

/* Categorías en Grid de 2 Columnas simétricas */
.section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.3px;
    margin-top: 2px;
}
.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.cat-item-card {
    background: #141814;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.cat-item-card:active {
    transform: scale(0.97);
}
.cat-icon-bubble {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #222B1D;
    color: var(--primary-matcha);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.cat-info {
    display: flex;
    flex-direction: column;
}
.cat-item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}
.cat-item-spent {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Movimientos Recientes */
.movements-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.movement-row {
    background: #141814;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-soft);
}

/* ==========================================================
   MODAL BOTTOM-SHEET & TECLADO TÁCTIL
   ========================================================== */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.sheet-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.sheet-content {
    background: #141814;
    width: 100%;
    max-width: 440px;
    border-radius: 32px 32px 0 0;
    padding: 24px 20px 32px;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sheet-backdrop.active .sheet-content {
    transform: translateY(0);
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sheet-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
}

.close-sheet-btn {
    background: #222B1D;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--primary-dark);
    cursor: pointer;
}

.amount-hero-box {
    background: #1A1F18;
    border-radius: 24px;
    padding: 20px;
    text-align: center;
}

.amount-hero-val {
    font-size: 42px;
    font-weight: 800;
    color: #B9E572;
    letter-spacing: -1px;
}

.sheet-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #1A1F18;
    font-size: 15px;
    color: var(--text-main);
    outline: none;
}

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

.kp-btn {
    background: #1A1F18;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.1s ease;
}

.kp-btn:active {
    background: #2A3424;
}

/* ==========================================================
   AJUSTES v2 (minimalista, mismo diseño)
   ========================================================== */
[hidden] { display: none !important; }

.status-line {
    font-size: 13px;
    font-weight: 600;
    color: #FFC857;
    background: #2A2110;
    border-radius: 14px;
    padding: 9px 14px;
    margin-top: -6px;
}

.cat-item-card {
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: left;
}

.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 14px;
}

.mv-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.mv-left .cat-icon-bubble { width: 40px; height: 40px; border-radius: 14px; font-size: 20px; }
.mv-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mv-title { font-size: 14px; font-weight: 700; color: var(--text-main); }
.mv-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mv-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-left: 8px;
    flex-shrink: 0;
}
.mv-amount { font-size: 15px; font-weight: 800; }
.mv-amount.income { color: #6FD13A; }
.mv-amount.expense { color: #FF5C5C; }
.mv-del {
    background: #3A1717;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FF6B6B;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
    margin-left: 10px;
}

.seg { display: flex; justify-content: center; gap: 10px; }
.seg-btn {
    padding: 8px 20px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #1A1F18;
    color: var(--text-main);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.seg-btn.active { background: #72B01D; color: #FFFFFF; }

.amount-sub { font-size: 13px; color: var(--text-muted); font-weight: 600; margin-top: 4px; min-height: 16px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
    border: 1px solid var(--border);
    background: #1A1F18;
    color: var(--primary-dark);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.chip.active { background: var(--primary-matcha); border-color: var(--primary-matcha); color: #FFFFFF; }

.save-btn { width: 100%; padding: 16px; font-size: 16px; }
.sheet-content { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
.sheet-input:focus { border-color: var(--primary-matcha); }

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    background: #72B01D;
    color: #FFFFFF;
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    z-index: 1100;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.link-danger {
    align-self: center;
    background: none;
    border: none;
    color: #FF5C5C;
    font-size: 14px;
    font-weight: 700;
    padding: 14px;
    cursor: pointer;
}
.link-danger:disabled { opacity: 0.5; }

.stat-val-bs { font-size: 17px; font-weight: 800; color: #B9E572; }
.binance-card {
    background: #141814;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.binance-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.binance-bal { font-size: 28px; font-weight: 800; color: var(--text-main); letter-spacing: -0.6px; }
.binance-sub { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.binance-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.binance-actions .pill-btn { padding: 12px 10px; font-size: 13px; }

/* ==========================================================
   TEMA OSCURO
   ========================================================== */
html { background: #000000; overscroll-behavior-y: contain; }
body { background-color: #000000; overscroll-behavior-y: contain; }
.pill-btn-income, .seg-btn.active, .save-btn { color: #0B0F08; }
.seg-btn.active { background: #72B01D; }
.toast { background: #72B01D; color: #0B0F08; }
.chip.active { color: #0B0F08; }
.hero-card { box-shadow: 0 14px 34px rgba(114, 176, 29, 0.12); }
.sheet-backdrop { background: rgba(0, 0, 0, 0.7); }
.sheet-content { box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6); border-top: 1px solid #1F271A; }
.kp-btn:active { background: #2A3424; }

/* ---------- Selector de mes y análisis ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.month-label { font-family: 'Anthropic Sans Display', 'Anthropic Sans Text', sans-serif; font-weight: 700; font-size: 17px; color: var(--text-main); text-transform: capitalize; }
.month-btn {
    width: 40px; height: 40px; border-radius: 14px; border: 1px solid var(--border);
    background: var(--card-bg); color: var(--primary-dark); font-size: 22px; line-height: 1; cursor: pointer;
}
.month-btn:disabled { opacity: 0.3; cursor: default; }

.chart-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 22px;
    padding: 18px; box-shadow: var(--shadow-soft); margin-bottom: 14px;
}
.chart-title { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; }

.bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 160px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; gap: 6px; }
.bar-val { font-size: 11px; font-weight: 700; color: var(--text-muted); height: 14px; }
.bar-track { flex: 1; width: 100%; max-width: 34px; background: #1A1F18; border-radius: 10px; display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill { width: 100%; background: #3F5A22; border-radius: 10px; min-height: 0; transition: height .3s; }
.bar-col.current .bar-fill { background: var(--primary-matcha); }
.bar-col.current .bar-lbl { color: var(--primary-dark); font-weight: 800; }
.bar-lbl { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: capitalize; }

.donut-wrap { position: relative; width: 170px; height: 170px; margin: 4px auto 14px; }
.donut-wrap svg { width: 100%; height: 100%; }
.donut-center {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-family: 'Anthropic Sans Display', 'Anthropic Sans Text', sans-serif; font-weight: 800; font-size: 16px; color: var(--text-main);
}
.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-name { font-weight: 600; color: var(--text-main); flex: 1; }
.legend-val { font-weight: 700; color: var(--text-muted); font-size: 13px; }

.binance-actions { grid-template-columns: 1fr 1fr 1fr; }
.binance-actions .pill-btn { padding: 12px 6px; font-size: 12px; }

/* ---------- v3: cabecera, búsqueda, edición, fijos y ajustes ---------- */
.header-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 14px; border: 1px solid var(--border);
    background: var(--card-bg); color: var(--primary-dark); font-size: 22px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

.stat-sub { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-top: 4px; }

.fixed-banner {
    background: var(--card-bg); border: 1px solid #3F5A22; border-radius: 18px;
    padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.fixed-text { font-size: 13px; font-weight: 600; color: var(--text-main); }
.fixed-btn { padding: 12px; font-size: 14px; width: 100%; }

.search-box {
    display: flex; align-items: center; gap: 10px; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: 16px; padding: 0 14px; margin-bottom: 12px;
}
.search-box ion-icon { color: var(--text-muted); font-size: 18px; }
.search-input {
    flex: 1; background: transparent; border: none; outline: none; color: var(--text-main);
    font-size: 15px; padding: 12px 0; font-family: inherit;
}

.mv-actions { display: flex; align-items: center; gap: 8px; margin-left: 10px; flex-shrink: 0; }
.mv-actions .mv-del { margin-left: 0; }
.mv-edit {
    background: #1C2617; border: none; width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; color: var(--primary-dark);
    cursor: pointer; font-size: 18px; flex-shrink: 0;
}

.chip.repeat-chip { align-self: center; }

.panel-section { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.panel-title { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.panel-row { display: flex; gap: 10px; align-items: center; }
.panel-row .sheet-input { flex: 1; }
.panel-btn { padding: 12px 18px; font-size: 14px; color: #0B0F08; }
.panel-hint { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.panel-field .sheet-input { font-size: 14px; }
.fixed-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.fixed-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.fixed-remove { padding: 10px 14px; font-size: 13px; color: #FF5C5C; }

/* Paneles altos (ajustes): el contenido se desplaza y el botón de cerrar siempre queda visible */
.sheet-backdrop { align-items: flex-end; }
.sheet-content {
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.sheet-header { position: sticky; top: 0; background: #141814; z-index: 2; padding-bottom: 8px; }
.sheet-content > * { flex-shrink: 0; }
