/* ==========================================================================
   チケット管理 — 明るい・かわいい・タップしやすい（iPhone優先／ライトのみ）
   ========================================================================== */
:root {
  color-scheme: light;

  --pink: #ff6fa5;
  --pink-deep: #f0468a;
  --pink-soft: #ffe6ef;
  --mint: #23bd93;
  --mint-soft: #d9f7ec;
  --blue: #5b9cf8;
  --blue-soft: #e6f0ff;
  --amber: #ef8f22;
  --amber-soft: #fff0d8;
  --purple: #9b7fd4;
  --purple-soft: #f0eaff;
  --red: #e4483c;
  --red-soft: #ffe4e1;
  --gray: #8e8798;
  --gray-soft: #f0edf3;

  --bg: #fff7fb;
  --card: #ffffff;
  --ink: #3f3548;
  --ink-2: #6d6478;
  --ink-3: #9a93a4;
  --line: #f0e6ee;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 4px 18px rgba(196, 138, 170, .13);
  --shadow-lg: 0 10px 34px rgba(160, 100, 140, .22);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
a { color: var(--pink-deep); }
h1, h2, h3, p, ul, ol { margin: 0; }
ul { list-style: none; padding: 0; }

/* ---------------------------------------------------------------- layout */
.app { min-height: 100dvh; padding-bottom: calc(var(--safe-b) + 16px); }
.app.has-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  background: linear-gradient(180deg, #fff7fb 72%, rgba(255,247,251,0));
  display: flex; align-items: center; gap: 10px;
}
.topbar h1 { font-size: 19px; font-weight: 800; letter-spacing: .02em; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 18px; flex: none;
}
.icon-btn.ghost { background: transparent; box-shadow: none; }

.page { padding: 0 14px 8px; display: flex; flex-direction: column; gap: 14px; }
.section { display: flex; flex-direction: column; gap: 9px; }
.section > h2 {
  font-size: 13px; font-weight: 800; color: var(--ink-2); letter-spacing: .06em;
  display: flex; align-items: center; gap: 7px; padding-left: 4px;
}
.section > h2 .count { color: var(--ink-3); font-weight: 700; }
.spacer { flex: 1; }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.card.tight { padding: 10px 12px; }
.card.flat { box-shadow: none; border: 1.5px solid var(--line); }

.tour-card { text-align: left; width: 100%; }
.tour-card .name { font-size: 17px; font-weight: 800; }
.tour-card .row { display: flex; align-items: center; gap: 8px; }
.tour-card .stats { display: flex; flex-wrap: wrap; gap: 6px; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--pink); flex: none;
}
.avatar.sm { width: 21px; height: 21px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.avatar.c1 { background: #ff8fb4; } .avatar.c2 { background: #6fc6f5; }
.avatar.c3 { background: #7fd6a8; } .avatar.c4 { background: #f2b45c; }
.avatar.c5 { background: #b198ea; } .avatar.c6 { background: #f18fa0; }

/* ---------------------------------------------------------------- chips */
.chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 3px 10px; font-size: 12px; font-weight: 800; background: var(--gray-soft); color: var(--ink-2);
  white-space: nowrap;
}
.chip.pink { background: var(--pink-soft); color: var(--pink-deep); }
.chip.mint { background: var(--mint-soft); color: #0d8f6c; }
.chip.blue { background: var(--blue-soft); color: #2f6fd0; }
.chip.amber { background: var(--amber-soft); color: #b96a09; }
.chip.purple { background: var(--purple-soft); color: #6f56ad; }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.gray { background: var(--gray-soft); color: var(--gray); }
.chip.big { font-size: 13px; padding: 5px 12px; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 50px; padding: 0 18px; border-radius: 16px; font-weight: 800; font-size: 16px;
  background: var(--gray-soft); color: var(--ink); transition: transform .08s ease, filter .12s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #ff85b3, #ff5f9c); color: #fff; box-shadow: 0 6px 16px rgba(255,105,160,.35); }
.btn.mint { background: linear-gradient(135deg, #4fd6ae, #1eb68c); color: #fff; box-shadow: 0 6px 16px rgba(35,189,147,.3); }
.btn.blue { background: linear-gradient(135deg, #86bcff, #4d90f5); color: #fff; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.line { background: #fff; box-shadow: inset 0 0 0 1.6px var(--line); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 13px; }
.btn.xs { min-height: 33px; font-size: 12.5px; padding: 0 11px; border-radius: 11px; }
.btn[disabled] { opacity: .42; pointer-events: none; }
.btn-row { display: flex; gap: 9px; }
.btn-row > .btn { flex: 1; }

/* ----------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.row-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: var(--card); border-radius: var(--r-md); padding: 12px 13px; box-shadow: var(--shadow);
  min-height: 58px;
}
.row-item:active { filter: brightness(.975); }
.row-item .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-item .title { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-item .tail { display: flex; align-items: center; gap: 7px; flex: none; }
.row-item .arrow { color: var(--ink-3); font-size: 15px; }
.row-item.sel { box-shadow: 0 0 0 2.5px var(--pink), var(--shadow); }
.row-item.dim { opacity: .55; }

.big-num { font-size: 20px; font-weight: 900; color: var(--pink-deep); line-height: 1; }
.big-num small { font-size: 11px; font-weight: 800; color: var(--ink-3); margin-left: 2px; }

.empty { text-align: center; color: var(--ink-3); padding: 26px 12px; font-size: 14px; }
.empty .emo { font-size: 34px; display: block; margin-bottom: 8px; }

/* -------------------------------------------------------------- checkbox */
.check {
  width: 26px; height: 26px; border-radius: 9px; flex: none;
  border: 2.2px solid #e3d9e6; display: grid; place-items: center;
  color: transparent; font-size: 15px; font-weight: 900; background: #fff;
}
.sel .check, .check.on { background: var(--pink); border-color: var(--pink); color: #fff; }
.check.round { border-radius: 50%; }

/* ---------------------------------------------------------------- fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 800; color: var(--ink-2); padding-left: 3px; }
.field .hint { font-size: 11.5px; color: var(--ink-3); padding-left: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1.8px solid var(--line);
  background: #fff; padding: 12px 13px; font-size: 16px; appearance: none;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink); }
select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%239a93a4' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; }
.switch .lbl { font-weight: 700; font-size: 15px; }
.switch .lbl small { display: block; font-weight: 600; font-size: 11.5px; color: var(--ink-3); }
.toggle { width: 54px; height: 32px; border-radius: 999px; background: #e6dfe9; position: relative; flex: none; transition: background .18s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .18s; }
.toggle.on { background: var(--pink); }
.toggle.on::after { transform: translateX(22px); }

.segmented { display: flex; background: var(--gray-soft); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; min-height: 40px; border-radius: 11px; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.segmented button.on { background: #fff; color: var(--pink-deep); box-shadow: var(--shadow); }

/* ------------------------------------------------------------------ tabs */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar button { height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 800; color: var(--ink-3); position: relative; }
.tabbar button .ico { font-size: 19px; line-height: 1; }
.tabbar button.on { color: var(--pink-deep); }
.tabbar .dot { position: absolute; top: 9px; right: calc(50% - 19px); min-width: 17px; height: 17px; border-radius: 999px;
  background: var(--pink); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }

/* ---------------------------------------------------------------- sheets */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(60,40,60,.34); z-index: 60;
  display: flex; align-items: flex-end; animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideup { from { transform: translateY(4%); opacity: .6 } to { transform: none; opacity: 1 } }
.sheet {
  background: var(--bg); width: 100%; max-height: 94dvh; border-radius: 26px 26px 0 0;
  display: flex; flex-direction: column; animation: slideup .2s cubic-bezier(.2,.8,.3,1);
  box-shadow: var(--shadow-lg);
}
.sheet.tall { height: 94dvh; }
.sheet-head {
  padding: 14px 14px 10px; display: flex; align-items: center; gap: 10px; flex: none;
  border-bottom: 1px solid var(--line); background: #fff; border-radius: 26px 26px 0 0;
}
.sheet-head h2 { font-size: 16.5px; font-weight: 800; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head .sub { font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 13px 14px; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot {
  flex: none; padding: 11px 14px calc(11px + var(--safe-b)); background: #fff;
  border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px;
}
.grab { width: 40px; height: 4.5px; border-radius: 3px; background: #e6dbe6; margin: 7px auto 0; flex: none; }

.dialog-backdrop { position: fixed; inset: 0; background: rgba(60,40,60,.4); z-index: 70; display: grid; place-items: center; padding: 22px; animation: fade .14s; }
.dialog { background: #fff; border-radius: var(--r-lg); padding: 20px 18px 16px; width: 100%; max-width: 360px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 13px; }
.dialog h3 { font-size: 17px; font-weight: 800; }
.dialog p { font-size: 14px; color: var(--ink-2); white-space: pre-wrap; }

/* ---------------------------------------------------------------- toasts */
.toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--safe-b) + 12px); z-index: 80;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.toast {
  background: #46394d; color: #fff; border-radius: 16px; padding: 12px 14px; font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px; pointer-events: auto;
  max-width: 460px; width: 100%; animation: slideup .18s;
}
.toast.err { background: #c33f36; }
.toast.ok { background: #17976f; }
.toast .undo { background: rgba(255,255,255,.18); border-radius: 10px; padding: 7px 12px; font-weight: 800; flex: none; }

.net-error {
  position: fixed; top: calc(var(--safe-t) + 8px); left: 14px; right: 14px; z-index: 90;
  background: var(--red); color: #fff; border-radius: 14px; padding: 11px 14px; font-size: 13.5px; font-weight: 800;
  box-shadow: var(--shadow-lg); text-align: center;
}

/* --------------------------------------------------------------- misc UI */
.progress { height: 9px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #ffa5c6, #ff5f9c); border-radius: 999px; transition: width .3s; }
.progress.mint > i { background: linear-gradient(90deg, #7ce0bf, #1eb68c); }

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.kpi { background: #fff; border-radius: var(--r-md); box-shadow: var(--shadow); padding: 12px 13px; display: flex; flex-direction: column; gap: 3px; }
.kpi .k { font-size: 11.5px; font-weight: 800; color: var(--ink-3); }
.kpi .v { font-size: 22px; font-weight: 900; line-height: 1.15; }
.kpi .v small { font-size: 12px; font-weight: 800; color: var(--ink-3); }
.kpi.warn .v { color: var(--amber); }
.kpi.alert .v { color: var(--red); }
.kpi.good .v { color: var(--mint); }

.banner { border-radius: var(--r-md); padding: 12px 13px; font-size: 13.5px; font-weight: 700; display: flex; gap: 9px; align-items: flex-start; }
.banner.red { background: var(--red-soft); color: #a5322a; }
.banner.amber { background: var(--amber-soft); color: #96560a; }
.banner.blue { background: var(--blue-soft); color: #2b5fae; }
.banner.mint { background: var(--mint-soft); color: #0d7d5f; }

.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row .lbl { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; margin-top: 5px; }
.bar-track > i { display: block; height: 100%; background: linear-gradient(90deg, #ffbcd4, #ff5f9c); }
.rate { font-weight: 900; font-size: 15px; flex: none; }
.rate small { font-weight: 700; font-size: 11.5px; color: var(--ink-3); margin-left: 3px; }

.money { font-size: 30px; font-weight: 900; letter-spacing: -.02em; }
.money.mint { color: #0d8f6c; }
.money.pink { color: var(--pink-deep); }

.flow { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.flow .who { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; }
.flow .to { font-size: 22px; color: var(--pink); }

.select-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 10px); z-index: 45;
  background: #46394d; color: #fff; border-radius: 18px; padding: 10px 12px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.select-bar .n { font-weight: 800; font-size: 14px; flex: 1; }
.select-bar .btn { min-height: 38px; font-size: 13px; border-radius: 12px; }

.pill-list { display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 4px; -webkit-overflow-scrolling: touch; }
.pill-list::-webkit-scrollbar { display: none; }
.pill { flex: none; border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 800; background: #fff; color: var(--ink-2); box-shadow: var(--shadow); }
.pill.on { background: var(--pink); color: #fff; }

.rank-badge { width: 26px; height: 26px; border-radius: 9px; background: var(--pink-soft); color: var(--pink-deep);
  font-size: 12px; font-weight: 900; display: grid; place-items: center; flex: none; }
.rank-badge.r2 { background: var(--blue-soft); color: #2f6fd0; }
.rank-badge.r3 { background: var(--purple-soft); color: #6f56ad; }

.mini-table { display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: var(--r-sm); overflow: hidden; }
.mini-table > div { background: #fff; padding: 9px 11px; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.mini-table .g { color: var(--ink-3); flex: 1; }

.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px calc(24px + var(--safe-b)); gap: 16px; }
.auth-logo { text-align: center; font-size: 46px; }
.auth-title { text-align: center; font-size: 21px; font-weight: 900; }
.auth-sub { text-align: center; font-size: 13px; color: var(--ink-3); }

.stack { display: flex; flex-direction: column; gap: 11px; }
.wrap-row { display: flex; flex-wrap: wrap; gap: 7px; }
.center { text-align: center; }
.muted { color: var(--ink-3); font-size: 13px; }
.strike { text-decoration: line-through; opacity: .6; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
