/* Travia brand: navy #021446（単色軸・キラキラNG・航路点線モチーフ） */
:root {
  --navy: #021446;
  --navy2: #0a2260;
  --gold: #c9a45c;
  --grad: linear-gradient(150deg, #021446 0%, #0e2a6e 100%);
  --bg: #f5f6f9;
  --card: #ffffff;
  --text: #1c2333;
  --sub: #6b7280;
  --line: #dde2ec;
  --tint: #eef1f7;
  --ok: #2fa06a;
  --danger: #c0392b;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.65;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font-family: inherit; }
.serif, .auth-brand .b1, .hero h1, .mh-total { font-family: "Shippori Mincho", "Hiragino Mincho ProN", serif; }

.loading-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--grad); color: #fff;
}
.loading-logo { font-family: "Shippori Mincho", serif; font-size: 1.9rem; font-weight: 600; letter-spacing: .14em; }
.loading-sub { opacity: .8; margin-top: .5rem; font-size: .85rem; letter-spacing: .06em; }

.muted { color: var(--sub); }
.center { text-align: center; }
.form-error { color: var(--danger); font-size: .88rem; margin: .5rem 0; min-height: 1.2em; }
.warn-text { color: #b06000; font-weight: 700; }

/* ---- auth ---- */
.auth-wrap { min-height: 100vh; background: var(--grad); display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.auth-card { background: #fff; border-radius: 20px; padding: 1.8rem 1.4rem; width: 100%; max-width: 420px; box-shadow: 0 18px 50px rgba(2,10,40,.4); }
.auth-brand { text-align: center; margin-bottom: 1.2rem; }
.auth-logo { height: 30px; margin-bottom: .6rem; }
.auth-brand .b1 { font-size: 1.45rem; font-weight: 600; color: var(--navy); letter-spacing: .1em; }
.auth-brand .b2 { color: var(--sub); font-size: .88rem; margin-top: .2rem; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--navy); margin-bottom: .3rem; }
.field input {
  width: 100%; padding: .8rem .9rem; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 1rem; background: #fbfcfe; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--navy2); background: #fff; }
.btn {
  display: block; width: 100%; padding: .9rem; border: none; border-radius: 12px;
  background: var(--navy); color: #fff; font-size: 1.02rem; font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--tint); color: var(--navy); }
.btn.small { display: inline-block; width: auto; padding: .5rem .9rem; font-size: .85rem; border-radius: 9px; text-decoration: none; }
.seg { display: flex; background: var(--tint); border-radius: 12px; padding: 4px; margin-bottom: 1.1rem; }
.seg button {
  flex: 1; border: none; background: none; padding: .55rem; border-radius: 9px;
  font-size: .95rem; font-weight: 700; color: var(--sub); cursor: pointer;
}
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgba(2,20,70,.12); }
.name-list { max-height: 240px; overflow-y: auto; border: 1.5px solid var(--line); border-radius: 10px; margin-top: .4rem; background: #fff; }
.name-item {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  padding: .65rem .8rem; border: none; border-bottom: 1px solid var(--line); background: #fff;
  font-size: .95rem; color: var(--text); cursor: pointer;
}
.name-item:last-child { border-bottom: none; }
.name-item.dim { color: #b7bdcc; }
.name-item .tag, .tag { font-size: .68rem; background: var(--tint); color: #8791ab; border-radius: 99px; padding: .1rem .5rem; }
.tag.warn { background: #fdf0e2; color: #b06000; }
.confirm-name {
  text-align: center; font-size: 1.5rem; font-weight: 800; color: var(--navy);
  background: var(--tint); border-radius: 14px; padding: 1rem; margin-bottom: .3rem;
}
.auth-switch { text-align: center; margin-top: 1rem; font-size: .9rem; color: var(--sub); }
.auth-switch a { color: var(--navy2); font-weight: 600; text-decoration: none; }
.badge { font-size: .68rem; background: var(--tint); color: var(--navy); border-radius: 99px; padding: .12rem .55rem; }
.warn-banner {
  display: block; width: 100%; text-align: left; background: #fdf7ec; border: 1.5px solid #ead9b4;
  color: #7a5a16; border-radius: var(--radius); padding: .8rem 1rem; font-size: .88rem;
  margin-bottom: .8rem;
}
.sel {
  width: 100%; padding: .7rem .75rem; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 16px; font-family: inherit; background: #fbfcfe; color: var(--text); margin-top: .1rem;
}
.sel:focus { outline: none; border-color: var(--navy2); background: #fff; }
textarea {
  width: 100%; padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 16px; font-family: inherit; background: #fbfcfe; color: var(--text); resize: vertical;
}
textarea:focus { outline: none; border-color: var(--navy2); background: #fff; }

/* ---- app shell ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem; display: flex; align-items: center; gap: .6rem;
}
.topbar .back { background: none; border: none; color: #fff; font-size: 1.3rem; padding: .2rem .4rem; cursor: pointer; }
.topbar .title { font-weight: 700; font-size: 1.02rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.container { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 4.5rem; }
.section { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: 0 4px 16px rgba(2,20,70,.06); }
.section h3 { font-size: 1rem; color: var(--navy); }
.guide-list { padding-left: 1.2rem; font-size: .88rem; margin-top: .4rem; }
.guide-list li { margin-bottom: .3rem; }

/* ---- home ---- */
.hero-wrap { position: relative; }
.hero { background: var(--grad); color: #fff; padding: calc(1.3rem + env(safe-area-inset-top)) 1.2rem 3.4rem; }
.hero-logo { height: 22px; opacity: .95; margin-bottom: .7rem; display: block; }
.hero .hello { font-size: .82rem; opacity: .85; letter-spacing: .05em; }
.hero h1 { font-size: 1.4rem; margin-top: .15rem; font-weight: 600; letter-spacing: .04em; }
.hero-actions { position: absolute; top: calc(.9rem + env(safe-area-inset-top)); right: .9rem; display: flex; gap: .4rem; }
.menu-btn { background: rgba(255,255,255,.16); border: none; color: #fff; border-radius: 8px; padding: .38rem .65rem; font-size: .8rem; cursor: pointer; }

/* マイルサマリ（ホーム最上部） */
.mile-hero { max-width: 640px; margin: -2.4rem auto 0; padding: 0 1rem; position: relative; z-index: 5; }
.mh-card {
  display: block; width: 100%; text-align: left; background: #fff; border: none; cursor: pointer;
  border-radius: 16px; padding: 1rem 1.15rem 1.05rem; box-shadow: 0 12px 30px rgba(2,20,70,.16);
  border-top: 3px solid var(--gold);
}
.mh-top { display: flex; justify-content: space-between; align-items: center; }
.mh-label { font-size: .76rem; font-weight: 700; color: var(--sub); letter-spacing: .05em; }
.mh-more { font-size: .76rem; color: var(--navy2); font-weight: 700; }
.mh-total { font-size: 2.3rem; font-weight: 700; color: var(--navy); line-height: 1.25; letter-spacing: .02em; }
.mh-unit { font-size: .9rem; margin-left: .2rem; color: var(--sub); }
.mh-progs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .35rem; }
.mh-prog { background: var(--tint); border-radius: 9px; padding: .3rem .6rem; font-size: .78rem; display: flex; gap: .4rem; align-items: baseline; }
.mh-prog .p { color: var(--sub); }
.mh-prog b { color: var(--navy); }
.mh-expiry { margin-top: .5rem; font-size: .78rem; color: var(--sub); }
.mh-expiry.soon { color: #b06000; font-weight: 700; }
.mh-expiry.warn { color: var(--danger); font-weight: 700; }
.mh-sub { margin-top: .45rem; font-size: .76rem; color: var(--sub); border-top: 1px dashed var(--line); padding-top: .45rem; }
.mh-cta { margin-top: .3rem; font-size: .92rem; color: var(--text); }
.mh-cta b { color: var(--navy2); }
.mh-empty { background: #fff; border-radius: 16px; padding: .9rem 1.1rem; font-size: .85rem; color: var(--sub); box-shadow: 0 12px 30px rgba(2,20,70,.12); }

.hm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.hm-card {
  display: flex; flex-direction: column; text-align: left; background: var(--card); border: none; cursor: pointer;
  border-radius: var(--radius); overflow: hidden; box-shadow: 0 4px 16px rgba(2,20,70,.07); padding: 0;
}
.hm-card.wide { flex-direction: row; align-items: center; grid-column: 1 / -1; margin-bottom: .8rem; }
.hm-card.wide .hm-thumb { width: 74px; aspect-ratio: 1; }
.hm-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 16/9; width: 100%; background: var(--tint); position: relative; }
.hm-emoji { font-size: 1.9rem; }
.g-trips { background: linear-gradient(140deg, #0a2260, #16388f); }
.g-cards { background: linear-gradient(140deg, #26314f, #4a5878); }
.g-miles { background: linear-gradient(140deg, #7a5c1e, #c9a45c); }
.g-tickets { background: linear-gradient(140deg, #021446, #274b9f); }
.g-events { background: linear-gradient(140deg, #33415e, #5c6b8c); }
.g-ai { background: linear-gradient(140deg, #123, #35558a); }
.g-dm { background: linear-gradient(140deg, #0e2a5e, #3a6ab8); }
.g-vault { background: linear-gradient(140deg, #3d3423, #8a744a); }
.g-code { background: linear-gradient(140deg, #16324f, #3e78a8); }
.hm-body { padding: .6rem .7rem .7rem; display: flex; flex-direction: column; gap: .15rem; }
.hm-body .t { font-weight: 700; font-size: .9rem; color: var(--navy); }
.hm-body .d { font-size: .74rem; color: var(--sub); line-height: 1.45; }

.total-card {
  background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem;
  box-shadow: 0 4px 16px rgba(2,20,70,.07);
}
.total-card .row { display: flex; justify-content: space-between; align-items: baseline; }
.total-card .pct { font-size: 1.6rem; font-weight: 800; color: var(--navy); }

/* ---- trips（地球儀＋地図） ---- */
.trips-page { padding-bottom: 3rem; }
.globe-wrap { background: var(--grad); padding: 1rem 0 1.1rem; text-align: center; }
#globe { width: min(72vw, 300px); aspect-ratio: 1; touch-action: pan-y; cursor: grab; }
.globe-cap { color: rgba(255,255,255,.85); font-size: .74rem; margin-top: .3rem; }
.globe-cap b { color: #e8c987; }
.region-tabs { display: flex; gap: .4rem; overflow-x: auto; padding: .2rem 0 .6rem; -webkit-overflow-scrolling: touch; }
.region-tabs button {
  flex-shrink: 0; border: 1.5px solid var(--line); background: #fff; border-radius: 99px;
  padding: .35rem .8rem; font-size: .8rem; font-weight: 600; color: var(--sub); cursor: pointer;
}
.region-tabs button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.map-wrap { background: #eaf0f7; border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
#worldmap { display: block; width: 100%; aspect-ratio: 16/10; }
#worldmap .ct { fill: #d3dbe8; stroke: #f2f5f9; stroke-width: .28; cursor: pointer; }
#worldmap .ct.v1 { fill: #33508f; }
#worldmap .ct.v2 { fill: #1c3a80; }
#worldmap .ct.v3 { fill: #0a2260; }
.map-note { font-size: .74rem; color: var(--sub); margin: .4rem 0 1rem; text-align: center; }
.cty-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }
.cty-chip {
  display: inline-flex; align-items: center; gap: .35rem; border: 1.5px solid var(--line);
  background: #fff; border-radius: 99px; padding: .35rem .75rem; font-size: .84rem; font-weight: 600;
  color: var(--navy); cursor: pointer;
}
.cty-chip span { background: var(--navy); color: #fff; font-size: .68rem; border-radius: 99px; padding: .05rem .42rem; }

.trip-card { border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; margin-top: .7rem; }
.tc-head { display: flex; justify-content: space-between; align-items: baseline; }
.tc-date { font-size: .74rem; color: var(--sub); }
.tc-route { font-size: .92rem; font-weight: 600; margin-top: .2rem; }
.tc-cty { font-size: .74rem; color: var(--navy2); background: var(--tint); border-radius: 99px; padding: .08rem .5rem; margin-left: .2rem; }
.tc-line { font-size: .8rem; color: var(--sub); margin-top: .2rem; }
.tc-cash { font-size: .86rem; margin-top: .35rem; }
.tc-cash b { color: var(--navy); font-size: 1rem; }
.tc-ref { font-size: .72rem; color: var(--sub); margin-left: .2rem; }
.tc-open { border: none; background: none; color: var(--navy2); font-size: .8rem; font-weight: 700; margin-top: .45rem; cursor: pointer; padding: 0; }
.tc-report { white-space: pre-wrap; font-size: .84rem; background: var(--tint); border-radius: 10px; padding: .7rem .8rem; margin-top: .5rem; }

/* ---- cards ---- */
.card-item { border: 1px solid var(--line); border-radius: 12px; padding: .85rem .95rem; margin-top: .7rem; }
.card-item.past { opacity: .6; }
.ci-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ci-status { font-size: .7rem; border-radius: 99px; padding: .12rem .55rem; background: var(--tint); color: var(--sub); flex-shrink: 0; }
.ci-status.s-決済修行中 { background: #fdf0e2; color: #b06000; font-weight: 700; }
.ci-status.s-達成済み { background: #e8f5ee; color: var(--ok); font-weight: 700; }
.ci-status.s-申込中 { background: #e8eefb; color: var(--navy2); font-weight: 700; }
.ci-meta { display: flex; gap: .7rem; font-size: .74rem; color: var(--sub); margin-top: .2rem; flex-wrap: wrap; }
.cp-badge { display: inline-block; font-size: .74rem; font-weight: 800; border-radius: 8px; padding: .2rem .55rem; margin-top: .45rem; }
.cp-badge.warn { background: #fdeaea; color: var(--danger); }
.cp-badge.soon { background: #fdf0e2; color: #b06000; }
.cp-badge.over { background: var(--danger); color: #fff; }
.ci-rows { margin-top: .5rem; }
.ci-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .84rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.ci-row:last-child { border-bottom: none; }
.ci-row span { color: var(--sub); flex-shrink: 0; }
.ci-row b { text-align: right; }
.ci-note { margin-top: .5rem; font-size: .8rem; background: #fdf7ec; border-radius: 8px; padding: .5rem .7rem; color: #7a5a16; }

/* ---- miles ---- */
.mile-row { border-bottom: 1px solid var(--line); padding: .65rem 0; }
.mile-row:last-child { border-bottom: none; }
.mr-main { display: flex; justify-content: space-between; align-items: baseline; }
.mr-bal { font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.mr-sub { display: flex; gap: .8rem; font-size: .74rem; color: var(--sub); margin-top: .1rem; flex-wrap: wrap; }
.tag-self { background: var(--tint); color: var(--navy2); border-radius: 99px; padding: .02rem .5rem; font-size: .68rem; }
.mr-memo { font-size: .76rem; color: var(--sub); margin-top: .15rem; }
.hist-row { display: flex; gap: .8rem; font-size: .82rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.hist-row:last-child { border-bottom: none; }
.hist-row span:first-child { color: var(--sub); font-size: .74rem; width: 5.2em; flex-shrink: 0; }
.hist-row .hb { margin-left: auto; font-weight: 700; color: var(--navy); }

/* ---- tickets ---- */
.tk-row {
  display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: .7rem .85rem; margin-top: .6rem; cursor: pointer;
}
.tk-main { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.tk-title { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-sub { font-size: .74rem; color: var(--sub); margin-top: .15rem; }
.st-badge { font-size: .7rem; font-weight: 700; border-radius: 99px; padding: .12rem .6rem; flex-shrink: 0; }
.st-new { background: #e8eefb; color: var(--navy2); }
.st-work { background: #fdf0e2; color: #b06000; }
.st-done { background: #e8f5ee; color: var(--ok); }
.st-closed { background: var(--tint); color: var(--sub); }
.td-head { display: flex; gap: .7rem; align-items: center; margin-bottom: .7rem; }

/* ---- chat ---- */
.chat-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .8rem; }
.chat-list.conc { min-height: 30vh; }
.chat-msg { max-width: 88%; }
.chat-msg.me { align-self: flex-end; }
.chat-msg.them { align-self: flex-start; }
.cm-meta { font-size: .68rem; color: var(--sub); margin: 0 .3rem .15rem; }
.chat-msg.me .cm-meta { text-align: right; }
.cm-body { border-radius: 14px; padding: .6rem .85rem; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.chat-msg.me .cm-body { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.them .cm-body { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: .5rem; align-items: flex-end; }
.chat-input textarea { flex: 1; }
.chat-input .btn { flex-shrink: 0; padding: .7rem 1rem; }
.conc-hello { background: #fff; border-radius: var(--radius); padding: .8rem 1rem; font-size: .85rem; margin-bottom: .8rem; box-shadow: 0 4px 16px rgba(2,20,70,.06); }
.src-dc { font-size: .62rem; background: #e8eaf2; color: #7681a3; border-radius: 99px; padding: .02rem .4rem; }
.cm-media { display: block; max-width: 100%; border-radius: 12px; margin-top: .3rem; background: #000; }
video.cm-media { width: 100%; aspect-ratio: 16/9; }
img.cm-media { max-height: 260px; width: auto; background: none; }
.cm-file { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .45rem .7rem; font-size: .82rem; color: var(--navy2); text-decoration: none; margin-top: .3rem; word-break: break-all; }

/* ---- vault ---- */
.vt-item { margin-top: .8rem; }
.vt-video { width: 100%; aspect-ratio: 16/9; border-radius: 12px; background: #000; }
.vt-meta { display: flex; justify-content: space-between; gap: .6rem; font-size: .8rem; margin-top: .3rem; align-items: baseline; }
.vt-meta span { color: var(--sub); font-size: .72rem; flex-shrink: 0; }
.vt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .6rem; }
.vt-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--tint); }

/* ---- airport search ---- */
.ap-row { display: flex; gap: .8rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.ap-row:last-child { border-bottom: none; }
.ap-code { font-family: "Shippori Mincho", serif; font-size: 1.15rem; font-weight: 700; color: var(--navy); background: var(--tint); border-radius: 9px; padding: .25rem .5rem; letter-spacing: .06em; flex-shrink: 0; }
.ap-main { display: flex; flex-direction: column; font-size: .88rem; min-width: 0; }
.ap-main span { font-size: .74rem; color: var(--sub); }

/* ---- events ---- */
.ev-row { display: flex; gap: .9rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.ev-row:last-child { border-bottom: none; }
.ev-date { flex-shrink: 0; font-size: .82rem; font-weight: 700; color: var(--navy); width: 6.4em; }
.ev-main { flex: 1; font-size: .9rem; }
.ev-note { font-size: .78rem; color: var(--sub); margin-top: .15rem; white-space: pre-wrap; }

/* ---- admin ---- */
.adm-row { border-bottom: 1px solid var(--line); padding: .6rem 0; }
.adm-row:last-child { border-bottom: none; }
.am-main { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.am-sub { font-size: .74rem; color: var(--sub); margin-top: .1rem; }
.am-acts { display: flex; gap: .4rem; margin-top: .35rem; }

/* ---- toast / tabbar ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(4.6rem + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: rgba(10,20,50,.92); color: #fff; padding: .6rem 1.1rem; border-radius: 99px;
  font-size: .85rem; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex;
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding: .3rem 0 calc(.3rem + env(safe-area-inset-bottom));
}
.tabbar[hidden] { display: none; }
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem;
  border: none; background: none; color: #98a1b5; font-size: .62rem; font-weight: 600; cursor: pointer; padding: .2rem 0;
}
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.on { color: var(--navy); }
body.has-tabbar { padding-bottom: calc(3.6rem + env(safe-area-inset-bottom)); }
body.kb-open .tabbar { display: none; }
