/* evoSaifu · papel washi, tinta sumi, sello bermellón.
   TODOS los colores y medidas están aquí, en variables con nombre de lo que SON. */

@font-face { font-family: "Zen Kaku Gothic New"; font-weight: 400; font-display: swap; src: url(fonts/zen-kaku-gothic-new-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Zen Kaku Gothic New"; font-weight: 500; font-display: swap; src: url(fonts/zen-kaku-gothic-new-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Zen Kaku Gothic New"; font-weight: 700; font-display: swap; src: url(fonts/zen-kaku-gothic-new-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Saifu Mincho"; font-weight: 800; font-display: swap; src: url(fonts/shippori-mincho-b1-latin-800-normal.woff2) format("woff2"); }
/* Solo los kanji que usa la app (7 KB). */
@font-face { font-family: "Saifu Mincho"; font-weight: 800; font-display: swap; src: url(fonts/shippori-kanji-800.woff2) format("woff2"); unicode-range: U+3068, U+306A, U+3070, U+3082, U+308B, U+308C, U+4F4F, U+5165, U+5875, U+5B9A, U+5BF6, U+5C71, U+5E03, U+660E, U+671F, U+78BA, U+7A4D, U+7D30, U+84C4, U+8A2D, U+8A8D, U+8CA1, U+8CAF, U+901A; }

:root {
  --paper: #F5F0E6;          /* washi: fondo */
  --card: #FFFDF8;           /* tarjetas */
  --line: #E3DACB;           /* bordes de tarjeta */
  --line-soft: #EFE8DC;      /* separadores dentro de tarjeta */
  --track: #EAE2D3;          /* pistas de barras y anillo */
  --chip-line: #D9CFBE;
  --ink: #1F1C19;            /* sumi: texto y cifras */
  --ink-2: #5E564C;          /* texto secundario (4,5:1 sobre washi) */
  --ink-on-dark: #F5F0E6;
  --ink-on-dark-2: #CFC6B6;
  --seal: #B8402A;           /* shu: SOLO el sello y lo que pide atención */
  --seal-soft: #F6E3DE;
  --invest: #2E4A6B;         /* ai: invertido */
  --invest-soft: #E3E9F0;
  --keep: #C9A24B;           /* kincha: lo que se queda en cuenta */
  --live: #8A8174;           /* hai: gasto de vivir */
  --muted: #8A8174;
  --ok: #3F6B3A;
  --dark: #1F1C19;
  --dark-2: #3A352F;

  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --font-display: "Saifu Mincho", "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;

  --r-card: 20px;
  --r-row: 16px;
  --r-chip: 22px;
  --pad: 16px;
  --nav-h: 64px;
  --max: 560px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); }
body { -webkit-text-size-adjust: 100%; }

.saifu { font-family: var(--font); color: var(--ink); background: var(--paper); min-height: 100vh; min-height: 100dvh; font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
:where(.saifu) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.saifu) button { cursor: pointer; }
.saifu :focus-visible { outline: 2px solid var(--invest); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.display { font-family: var(--font-display); font-weight: 800; }
.muted { color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.saifu-boot { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.saifu-boot span { width: 56px; height: 56px; border-radius: 8px; background: var(--seal); color: var(--card); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 32px; box-shadow: inset 0 0 0 3px var(--seal), inset 0 0 0 5px var(--card); animation: saifu-pulse 1.4s ease-in-out infinite; }
@keyframes saifu-pulse { 50% { opacity: .55; } }

.app { max-width: var(--max); margin: 0 auto; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }

/* ---------- cabecera ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.brand { display: flex; align-items: center; gap: 10px; }
.seal { width: 36px; height: 36px; border-radius: 6px; background: var(--seal); color: var(--card); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; box-shadow: inset 0 0 0 2px var(--seal), inset 0 0 0 4px var(--card); flex-shrink: 0; }
.brand b { font-family: var(--font-display); font-size: 20px; display: block; line-height: 1.1; }
.brand small { font-size: 11px; color: var(--ink-2); letter-spacing: .2em; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--chip-line); background: var(--card); display: flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 20px; height: 20px; }

.head { padding: 16px 20px 8px; }
.kanji-label { font-size: 12px; color: var(--ink-2); letter-spacing: .2em; }
.kanji-label .k { font-family: var(--font-display); letter-spacing: .1em; }
.head h1 { margin: 4px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.15; }
.head p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 6px; padding: 8px 16px 14px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--chip-line); background: transparent; color: var(--ink-2); font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ink-on-dark); font-weight: 500; }
.chip.big { min-height: 44px; border-radius: 22px; font-size: 14px; color: var(--ink); }
.chip.big[aria-pressed="true"] { color: var(--ink-on-dark); }
.chip.invest[aria-pressed="true"] { background: var(--invest); border-color: var(--invest); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.month-nav { display: inline-flex; align-items: center; border: 1px solid var(--chip-line); border-radius: 18px; }
.month-nav button { min-width: 36px; height: 36px; border: 0; background: transparent; color: var(--ink-2); border-radius: 18px; }
.month-nav .cur { padding: 0 6px; font-size: 13px; }
.month-nav.on { background: var(--ink); border-color: var(--ink); }
.month-nav.on button, .month-nav.on .cur { color: var(--ink-on-dark); font-weight: 500; }

/* ---------- tarjetas ---------- */
.card { margin: 0 16px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; }
.card.dark { background: var(--dark); color: var(--ink-on-dark); border-color: var(--dark); }
.card h2, .section-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.section { margin: 22px 20px 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section small { color: var(--ink-2); font-size: 12px; }
.overline { font-size: 11px; color: var(--ink-2); letter-spacing: .08em; text-transform: uppercase; }
.card.dark .overline, .card.dark .muted { color: var(--ink-on-dark-2); }

.hero { display: flex; align-items: center; gap: 18px; }
.hero .rate { font-family: var(--font-display); font-weight: 800; font-size: 52px; line-height: 1; }
.hero .rate span { font-size: 26px; }
.hero p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.coin { width: 128px; height: 128px; flex-shrink: 0; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.trio span { display: block; font-size: 11px; color: var(--ink-2); }
.trio b { font-size: 17px; white-space: nowrap; }
.trio .inv { color: var(--invest); }
.split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; margin-top: 16px; background: var(--track); }
.split i { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 11px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.live { background: var(--live); } .inv-bg { background: var(--invest); } .keep { background: var(--keep); }
.note-line { margin-top: 10px; font-size: 12px; color: var(--ink-2); }

.tip { display: flex; gap: 14px; align-items: flex-start; text-align: left; width: calc(100% - 32px); }
.tip .badge-k { width: 40px; height: 40px; flex-shrink: 0; border-radius: 20px; background: var(--seal-soft); color: var(--seal); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.tip.calm .badge-k { background: var(--track); color: var(--ink); }
.tip b { display: block; font-size: 15px; }
.tip p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.tip .proverb { font-family: var(--font-display); font-size: 12px; color: var(--ink-2); margin-top: 6px; }
button.card { font: inherit; color: inherit; }

.bars { display: flex; flex-direction: column; gap: 4px; margin: 0 16px; }
.bar-row { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 8px 4px; border-radius: 10px; }
.bar-row:active { background: var(--track); }
.bar-row .top-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bar-row .top-line b { white-space: nowrap; }
.bar-row .track { height: 6px; border-radius: 3px; background: var(--track); margin-top: 6px; }
.bar-row .fill { height: 6px; border-radius: 3px; background: var(--ink); }
.bar-row .fill.inc { background: var(--invest); }
.bar-row .meta { font-size: 11px; color: var(--ink-2); margin-top: 3px; }
.up { color: var(--seal); font-weight: 700; }

.pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.pill.warn { color: var(--seal); background: var(--seal-soft); }
.pill.ink { color: var(--ink-on-dark); background: var(--dark-2); font-weight: 400; }
.pill.solid-seal { color: var(--card); background: var(--seal); }
.pill.inv { color: var(--invest); background: var(--invest-soft); }
.pill.grey { color: var(--ink-2); background: var(--track); font-weight: 500; }

/* ---------- listas ---------- */
.list { margin: 0 16px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-row); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line-soft); text-align: left; min-height: 56px; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--paper); }
.av { width: 36px; height: 36px; border-radius: 8px; background: var(--track); color: var(--ink-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; text-transform: uppercase; }
.av.inc { background: var(--invest-soft); color: var(--invest); }
.av.tr { background: transparent; border: 1px dashed var(--chip-line); }
.av.unknown { background: transparent; border: 1px dashed #B5AB9A; font-size: 16px; }
.row .mid { flex: 1; min-width: 0; }
.row .mid > b { display: block; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .mid > span { display: block; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex-shrink: 0; }
.row .end > b { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; }
.row .end > span { display: block; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.amt-in { color: var(--invest); }
.amt-flat { color: var(--muted); font-weight: 500 !important; }
.day { margin: 16px 20px 6px; font-size: 12px; color: var(--ink-2); font-weight: 700; letter-spacing: .06em; display: flex; justify-content: space-between; }
.dot-review { width: 8px; height: 8px; border-radius: 4px; background: var(--seal); display: inline-block; margin-left: 6px; vertical-align: middle; }

.search { margin: 4px 16px 0; position: relative; }
.search input { width: 100%; height: 44px; border-radius: 22px; border: 1px solid var(--chip-line); background: var(--card); padding: 0 16px 0 42px; font-size: 15px; }
.search svg { position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; color: var(--ink-2); }
.more { display: block; margin: 8px auto 20px; }

/* ---------- botones ---------- */
.btn { min-height: 44px; border-radius: 12px; border: 0; background: var(--ink); color: var(--ink-on-dark); font-weight: 700; padding: 0 18px; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--chip-line); font-weight: 500; }
.btn.danger { background: var(--seal); color: var(--card); }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--invest); font-weight: 500; padding: 8px 0; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; min-height: 36px; }
.btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* ---------- revisar ---------- */
.rv { display: flex; flex-direction: column; gap: 12px; }
.rv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rv-head b { display: block; font-size: 16px; }
.rv-head .detail { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.rv-amt { font-family: var(--font-display); font-weight: 800; font-size: 22px; white-space: nowrap; }
.field label, .lbl { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.input { width: 100%; height: 44px; border: 1px solid var(--chip-line); border-radius: 12px; padding: 0 14px; font-size: 15px; background: var(--paper); }
textarea.input { height: auto; min-height: 80px; padding: 10px 14px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.rv-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.empty { text-align: center; padding: 40px 28px; }
.empty .seal { width: 64px; height: 64px; font-size: 36px; margin: 0 auto 16px; border-radius: 10px; box-shadow: inset 0 0 0 3px var(--seal), inset 0 0 0 6px var(--card); }
.empty h2 { font-family: var(--font-display); margin: 0 0 8px; }
.empty p { color: var(--ink-2); margin: 0 0 18px; }

/* ---------- fijos ---------- */
.total-card { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.total-card .big { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; display: block; margin: 4px 0; }
.total-card .pills { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.group-title { margin: 20px 20px 8px; font-size: 12px; color: var(--ink-2); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- ajustes ---------- */
.set { display: flex; flex-direction: column; gap: 10px; }
.set h3 { margin: 0; font-size: 16px; }
.set p { margin: 0; font-size: 13px; color: var(--ink-2); }
.kv { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .r { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.x { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 18px; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }

/* ---------- navegación ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(8px + env(safe-area-inset-bottom)); }
.nav-in { max-width: var(--max); margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; font-size: 11px; color: var(--ink-2); position: relative; }
.nav button[aria-current="page"] { color: var(--ink); font-weight: 700; }
.nav svg { width: 22px; height: 22px; }
.nav .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--seal); color: var(--card); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ---------- hoja inferior ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(31, 28, 25, .42); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg.fresh { animation: fade .15s ease-out; }
.sheet-bg.fresh .sheet { animation: rise .2s ease-out; }
.sheet { width: 100%; max-width: var(--max); max-height: 92vh; overflow-y: auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--chip-line); margin: 0 auto 12px; }
.sheet h2 { font-family: var(--font-display); font-size: 22px; margin: 0 0 4px; }
.sheet .sheet-body { display: flex; flex-direction: column; gap: 16px; }
.sheet .close { position: absolute; }
.sheet-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.amount-big { font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1.1; }
.orig { font-size: 12px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; word-break: break-word; }
@keyframes rise { from { transform: translateY(30px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }

.drop { border: 1.5px dashed var(--chip-line); border-radius: 16px; background: var(--card); padding: 22px; text-align: center; display: block; cursor: pointer; }
.drop b { display: block; font-size: 16px; margin-bottom: 4px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.how { font-size: 13px; color: var(--ink-2); }
.how b { color: var(--ink); }
.okline { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.okline .ic { flex-shrink: 0; width: 22px; height: 22px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.okline .ic.ok { background: #E1EBDD; color: var(--ok); }
.okline .ic.bad { background: var(--seal-soft); color: var(--seal); }
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; }
.stats3 div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; }
.stats3 b { display: block; font-size: 20px; }
.stats3 span { font-size: 11px; color: var(--ink-2); }

.toast { font-family: var(--font); position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--dark); color: var(--ink-on-dark); padding: 12px 18px; border-radius: 14px; font-size: 14px; z-index: 60; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: rise .2s ease-out; }
.toast.err { background: var(--seal); color: var(--card); }
.busy { opacity: .6; pointer-events: none; }
.banner-ro { margin: 0 16px 12px; font-size: 13px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }

@media (min-width: 720px) {
  .head h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}

/* Moneda mon en el centro del anillo: sutil, color de latón viejo sobre papel. */
.mon-face { fill: #F3EBDA; stroke: #D9C9A3; stroke-width: 1; }
.mon-rim { fill: none; stroke: #D9C9A3; stroke-width: 1; }
.mon-hole { fill: var(--card); stroke: #CDBB92; stroke-width: 1; }
.mon-k { font-family: var(--font-display); font-weight: 800; font-size: 14px; fill: #8C7A55; text-anchor: middle; dominant-baseline: central; }
