:root {
  /* Paleta tradicional japonesa (irogana) */
  --washi: #ece2cd;        /* papel washi (fondo) */
  --washi-2: #f4eddc;
  --card: #fbf6ea;         /* papel de tarjeta */
  --sumi: #2c2620;         /* tinta sumi (texto) */
  --shu: #b23a2e;          /* bermellón 朱 (primario) */
  --shu-bright: #c8462f;
  --shu-dark: #8f2c22;
  --ai: #20425e;           /* índigo 藍 (secundario) */
  --ai-dark: #182f44;
  --kin: #a8842b;          /* oro 金 (acentos/filetes) */
  --kin-soft: #d8b85a;
  --muted: #837860;
  --line: #ddccac;         /* filete cálido */
  --paper: var(--washi);
  --ink: var(--sumi);
  --accent: var(--shu);
  --shadow: 0 2px 10px rgba(60, 45, 20, .12);
  --radius: 12px;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Shippori Mincho", "Songti SC", serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background-color: var(--washi);
  /* textura sutil de papel washi */
  background-image:
    repeating-linear-gradient(90deg, rgba(120,95,45,.025) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(0deg, rgba(120,95,45,.02) 0 1px, transparent 1px 5px);
  color: var(--sumi);
  line-height: 1.45;
  padding-bottom: calc(74px + var(--safe-bottom));
  overscroll-behavior-y: none;
}

/* ---------- Cabecera ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(160deg, var(--ai), var(--ai-dark));
  color: var(--washi-2);
  padding: calc(14px + var(--safe-top)) 18px 22px;
  box-shadow: var(--shadow);
}
.app-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30'%3E%3Cg fill='none' stroke='%23d8b85a' stroke-width='2' opacity='0.6'%3E%3Cpath d='M-15 30a15 15 0 0 0 30 0M-11 30a11 11 0 0 0 22 0M-7 30a7 7 0 0 0 14 0'/%3E%3Cpath d='M15 30a15 15 0 0 0 30 0M19 30a11 11 0 0 0 22 0M23 30a7 7 0 0 0 14 0'/%3E%3Cpath d='M45 30a15 15 0 0 0 30 0M49 30a11 11 0 0 0 22 0M53 30a7 7 0 0 0 14 0'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x; background-position: center bottom; background-size: 60px 30px;
}
.header-inner { display: flex; align-items: center; gap: 13px; max-width: 760px; margin: 0 auto; }
.header-seal {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  background: var(--shu); color: var(--washi-2);
  display: grid; place-items: center; font-family: var(--serif); font-size: 22px; font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25), 0 1px 4px rgba(0,0,0,.3);
}
.app-header h1 { font-family: var(--serif); font-size: 19px; margin: 0; font-weight: 600; letter-spacing: .5px; }
.header-sub { margin: 3px 0 0; font-size: 12.5px; opacity: .85; }

/* ---------- Banner de red ---------- */
.net-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--sumi); color: var(--washi-2); text-align: center;
  font-size: 12.5px; padding: calc(4px + var(--safe-top)) 8px 4px; letter-spacing: .3px;
}
.net-banner.hidden { display: none; }

/* ---------- Vista ---------- */
.view { max-width: 760px; margin: 0 auto; padding: 18px 14px 24px; }
.section-title {
  font-family: var(--serif); font-size: 14px; letter-spacing: 1px; color: var(--ai);
  margin: 24px 4px 10px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.section-title::before { content: ""; width: 4px; height: 16px; background: var(--shu); border-radius: 1px; }
.section-title:first-child { margin-top: 4px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card.tappable { cursor: pointer; transition: transform .08s; }
.card.tappable:active { transform: scale(.985); }

/* ---------- Grid de accesos ---------- */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px; text-align: left; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 7px; min-height: 116px;
  cursor: pointer; transition: transform .08s; position: relative;
}
.home-tile:active { transform: scale(.97); }
.home-tile .t-ico {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--shu);
  color: var(--shu); font-family: var(--serif); font-size: 21px; font-weight: 600;
  display: grid; place-items: center; background: #fff;
}
.home-tile .t-name { font-family: var(--serif); font-weight: 600; font-size: 16px; color: var(--sumi); }
.home-tile .t-desc { font-size: 12px; color: var(--muted); }

/* ---------- Portada (hero) ---------- */
.hero {
  position: relative; border-radius: var(--radius); overflow: hidden;
  margin-bottom: 16px; min-height: 200px; box-shadow: var(--shadow);
  background: linear-gradient(150deg, var(--ai), var(--ai-dark));
  border: 1px solid var(--kin); outline: 1px solid rgba(168,132,43,.25); outline-offset: -5px;
}
.hero-img { width: 100%; display: block; object-fit: cover; max-height: 380px; }
.hero-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 16px; color: #fff;
  background: linear-gradient(to top, rgba(20,15,10,.66), rgba(20,15,10,.05) 58%);
}
.hero-count { font-family: var(--serif); font-size: 34px; font-weight: 700; line-height: 1.05; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.hero-lbl { font-size: 14px; font-weight: 600; margin-top: 3px; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.hero-dates { font-size: 12.5px; opacity: .92; margin-top: 3px; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.hero-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--washi-2); gap: 4px; }
.hero-empty .he-ico { font-size: 30px; }
.hero-empty .he-txt { font-size: 13px; opacity: .95; }
.hero-btns { position: absolute; top: 10px; right: 10px; display: flex; gap: 8px; z-index: 2; }
.hero-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(20,15,10,.45); color: #fff; font-size: 17px; backdrop-filter: blur(4px);
  display: grid; place-items: center;
}
.hero-btn:active { background: rgba(20,15,10,.65); }

/* ---------- Frases ---------- */
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-size: 13px; font-weight: 600; color: var(--sumi); cursor: pointer;
  white-space: nowrap;
}
.chip.active { background: var(--shu); color: #fff; border-color: var(--shu-dark); }

.phrase { padding: 12px 14px; }
.phrase .es { font-weight: 700; font-size: 15px; color: var(--sumi); }
.phrase .jp { font-family: var(--serif); font-size: 21px; margin-top: 5px; color: var(--ai); }
.phrase .pho { font-size: 14px; color: var(--shu); font-weight: 600; margin-top: 3px; }
.phrase .romaji { font-size: 12.5px; color: var(--muted); font-style: italic; }
.phrase-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.btn-speak {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; font-size: 18px; cursor: pointer; display: grid; place-items: center;
}
.btn-speak:active { background: #f0e8d6; }

/* ---------- Búsqueda ---------- */
.search {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  font-size: 15px; background: var(--card); margin-bottom: 12px; color: var(--sumi);
}
.search:focus { outline: 2px solid var(--kin-soft); border-color: var(--kin); }

/* ---------- Formularios ---------- */
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border-radius: 9px; border: 1px solid var(--line);
  font-size: 15px; background: var(--card); font-family: inherit; color: var(--sumi);
}
.field textarea { min-height: 70px; resize: vertical; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: 9px; border: none; font-size: 15px; font-weight: 700;
  cursor: pointer; background: var(--shu); color: #fff; letter-spacing: .3px;
}
.btn:active { background: var(--shu-dark); }
.btn.ghost { background: transparent; color: var(--shu); border: 1px solid var(--line); }
.btn.full { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; }

/* ---------- Conversor ---------- */
.conv-box { text-align: center; }
.conv-amount {
  width: 100%; font-family: var(--serif); font-size: 42px; font-weight: 700; text-align: center; border: none;
  background: transparent; color: var(--sumi); padding: 8px 0;
}
.conv-amount:focus { outline: none; }
.conv-result { font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--shu); }
.conv-swap {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0;
  font-size: 14px; color: var(--muted);
}
.conv-cur { font-weight: 700; color: var(--ai); }
.rate-info { font-size: 12px; color: var(--muted); text-align: center; margin-top: 8px; }
.quick-amts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.quick-amts .chip { font-size: 13px; }

/* ---------- Itinerario ---------- */
.day-head { display: flex; align-items: center; gap: 10px; margin: 18px 4px 8px; }
.day-num {
  background: var(--ai); color: var(--washi-2); width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 14px; flex: 0 0 auto;
}
.day-title { font-family: var(--serif); font-weight: 600; font-size: 16px; color: var(--sumi); }
.day-date { font-size: 12px; color: var(--muted); }
.plan-item { display: flex; gap: 10px; align-items: flex-start; }
.plan-item .bullet { color: var(--shu); font-size: 14px; line-height: 1.6; }
.plan-item .pi-body { flex: 1; }
.plan-item .pi-place { font-weight: 600; color: var(--sumi); }
.plan-item .pi-note { font-size: 13px; color: var(--muted); }
.plan-item a { color: var(--shu); font-size: 13px; text-decoration: none; font-weight: 600; }

/* ---------- Equipaje ---------- */
.progress { height: 9px; background: rgba(32,66,94,.12); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-bar { height: 100%; background: var(--shu); border-radius: 999px; transition: width .25s ease; }
.pack-card { padding: 2px 14px; }
.pack-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.pack-item:last-child { border-bottom: none; }
.pack-item input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--shu); flex: 0 0 auto; }
.pack-text { flex: 1; font-size: 15px; color: var(--sumi); }
.pack-item.done .pack-text { text-decoration: line-through; color: var(--muted); }
.pack-del { background: none; border: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 4px 2px; }

/* ---------- Info Japón ---------- */
.info-head { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--ai); margin-bottom: 10px; }
.info-list { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.85; color: var(--sumi); }
.info-list li { margin-bottom: 3px; }
.tel-link, .map-link { color: var(--shu); font-weight: 700; text-decoration: none; }
.map-link { display: inline-block; margin-top: 8px; font-weight: 600; }

/* ---------- Aviso de solo lectura ---------- */
.ro-banner {
  background: rgba(32,66,94,.08); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: var(--ai);
  text-align: center; font-weight: 600;
}

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 36px 16px; font-size: 14px; }
.empty .e-ico { font-size: 40px; display: block; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: rgba(32,66,94,.1); color: var(--ai); }
.doc-field { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.doc-field:last-child { border-bottom: none; }
.doc-field .k { color: var(--muted); }
.doc-field .v { font-weight: 600; text-align: right; word-break: break-word; color: var(--sumi); }
.doc-photo { width: 100%; border-radius: 10px; margin-top: 10px; display: block; border: 1px solid var(--line); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.fab-add { display: inline-flex; align-items: center; gap: 6px; }
.link-del { color: var(--shu-dark); font-size: 13px; background: none; border: none; cursor: pointer; font-weight: 600; padding: 4px; }
.hidden { display: none !important; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(30,22,14,.5); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--washi-2); width: 100%; max-width: 760px; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(20px + var(--safe-bottom)); max-height: 90vh; overflow-y: auto;
  border-top: 3px solid var(--shu);
}
.modal h3 { font-family: var(--serif); font-weight: 600; margin: 4px 0 14px; color: var(--sumi); }
.modal-handle { width: 40px; height: 4px; background: var(--line); border-radius: 999px; margin: 0 auto 12px; }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: rgba(251,246,234,.97); backdrop-filter: blur(8px);
  border-top: 2px solid var(--kin); padding-bottom: var(--safe-bottom);
}
.tab {
  flex: 1; border: none; background: none; padding: 9px 2px 7px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted);
}
.tab-ico { font-family: var(--serif); font-size: 20px; line-height: 1; color: var(--muted); }
.tab-lbl { font-size: 10.5px; font-weight: 600; }
.tab.active { color: var(--shu); }
.tab.active .tab-ico { color: var(--shu); }

@media (min-width: 760px) {
  .home-grid { grid-template-columns: repeat(3, 1fr); }
}
