/* アレグレイル 連絡システム（alegreir-renraku）と同じトンマナ：色・部品の名前と寸法をそろえる */
:root {
  --main: #0A7CBA; --main-l: #E6F4FB; --main-d: #0B3A5C;
  --acc: #FFD60A; --acc-l: #FFF6C2;
  --bg: #F4F6F4; --card: #FFFFFF; --text: #1C2321; --sub: #5B6661; --line: #D9DFDB; --ctl: #B9C3BE;
  --red: #B42318; --red-l: #FDECEC; --org: #A04A00; --org-l: #FFF6EB;
  --ok: #1D6B3A; --ok-l: #E7F4EC; --grey: #8A938F; --grey-l: #ECEFED;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  font-size: 15px; line-height: 1.6; overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.4; }
[hidden] { display: none !important; }

/* demo bar */
.demobar { background: var(--main-d); color: #fff; position: sticky; top: 0; z-index: 30; }
.demobar-in { max-width: 1240px; margin: 0 auto; padding: 8px 12px; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.demo-tag { white-space: nowrap; font-size: 12px; border: 1px solid rgba(255,255,255,.5); border-radius: 4px; padding: 1px 6px; }
.stripe { height: 5px; background: linear-gradient(90deg, var(--main) 0 75%, var(--acc) 75% 100%); }

/* common */
.wrap-g { max-width: 480px; margin: 0 auto; padding: 0 16px 140px; }
.wrap-s { max-width: 1240px; margin: 0 auto; padding: 0 16px 120px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
.card h2 { font-size: 16px; margin-bottom: 8px; }
.muted { color: var(--sub); font-size: 13px; }
.center { text-align: center; }
.note { background: var(--main-l); color: var(--main-d); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.note.warn { background: var(--org-l); color: var(--org); }
.note.y { background: var(--acc-l); color: #4d4000; }
.note.err { background: var(--red-l); color: var(--red); }
.note ul { margin: 0; padding-left: 1.2em; }
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--main); background: #fff; color: var(--main); font-weight: 700; text-decoration: none; }
.btn.pri { background: var(--main); color: #fff; }
.btn.pri:disabled { background: var(--ctl); border-color: var(--ctl); cursor: default; }
.btn.ghost { border-color: var(--line); color: var(--text); font-weight: 400; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger.armed { background: var(--red); color: #fff; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.badge { display: inline-block; font-size: 12px; font-weight: 400; padding: 1px 8px; border-radius: 99px; background: var(--grey-l); color: var(--sub); white-space: nowrap; vertical-align: 1px; }
.b-main { background: var(--main-l); color: var(--main-d); }
.b-ok { background: var(--ok-l); color: var(--ok); }
.b-red { background: var(--red-l); color: var(--red); }
.b-y { background: var(--acc-l); color: #4d4000; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field { margin: 12px 0; }
.field > label, .lbl { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field select { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--ctl); border-radius: 8px; background: #fff; font-size: 16px; }
.field textarea { width: 100%; min-height: 70px; padding: 10px 12px; border: 1px solid var(--ctl); border-radius: 8px; background: #fff; resize: vertical; font-size: 16px; }
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--main-d); outline-offset: 2px; }

/* header */
.g-head { display: flex; align-items: center; gap: 8px; padding: 14px 0 6px; }
.g-head h1 { font-size: 17px; }
.g-head .who { font-size: 12px; color: var(--sub); }
.s-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; flex-wrap: wrap; }
.s-head h1 { font-size: 18px; }
.pending { background: var(--red); color: #fff; border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: 700; }
.pending.zero { background: var(--ok); }

/* numbered steps & option list（連絡システムの振替申請と同じ） */
.step { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 18px 0 6px; flex-wrap: wrap; }
.card > .step:first-child { margin-top: 0; }
.step b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--main); color: #fff; font-size: 14px; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; min-height: 52px; padding: 10px 14px; border: 1px solid var(--ctl); border-radius: 10px; background: #fff; margin: 8px 0; }
.opt[aria-pressed="true"] { border: 2px solid var(--main); background: var(--main-l); font-weight: 700; padding: 9px 13px; }
.opt .grow { flex: 1; }
.opt .dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ctl); background: #fff; }
.opt[aria-pressed="true"] .dot { border-color: var(--main); background: radial-gradient(var(--main) 0 5px, #fff 6px); }

/* chips（選択ボタン） */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 8px 14px; border: 1px solid var(--ctl); border-radius: 99px; background: #fff; font-size: 14px; }
.pill[aria-pressed="true"] { background: var(--main); border-color: var(--main); color: #fff; font-weight: 700; }

/* 氏名（姓・名を横並び） */
.name-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
.name-grid .field { min-width: 0; }

/* back name（ユニフォームのすぐ下に出る） */
.backbox { border: 2px solid var(--main); border-top: 0; border-radius: 0 0 10px 10px; background: var(--main-l); padding: 12px; margin: 0 0 10px; }
.joined .prod:last-child { border-radius: 10px 10px 0 0; margin-bottom: 0; }
.backbox .field input { background: #fff; }
.cands { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cands .pill { font-family: 'Helvetica Neue', Arial, sans-serif; letter-spacing: .04em; font-weight: 700; }
.back-grid { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.shirt { margin: 12px auto 0; width: 210px; max-width: 100%; aspect-ratio: 210 / 220; position: relative; color: #fff; }
.shirt svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.shirt .bn { position: absolute; top: 24%; left: 0; right: 0; text-align: center; font: 500 15px/1 'Helvetica Neue', Arial, sans-serif; letter-spacing: .08em; white-space: nowrap; overflow: hidden; padding: 0 44px; }
.shirt .no { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font: 500 80px/1 'Helvetica Neue', Arial, sans-serif; color: #fff; }
.shirt .empty { opacity: .45; }

/* products */
.prod { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; background: #fff; }
.prod.has { border: 2px solid var(--main); padding: 11px; }
.prod-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.prod-img { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.prod-name { font-weight: 700; flex: 1; min-width: 0; }
.prod-name .muted { font-weight: 400; }
.nw { white-space: nowrap; display: inline-block; margin-right: 8px; }
.price { white-space: nowrap; font-weight: 700; text-align: right; font-size: 14px; }
.price s { color: var(--sub); font-weight: 400; font-size: 12px; margin-right: 4px; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.size { min-width: 52px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--ctl); border-radius: 10px; background: #fff; font-size: 14px; position: relative; }
.size.on { background: var(--main); border-color: var(--main); color: #fff; font-weight: 700; }
.size .n { position: absolute; top: -8px; right: -6px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--acc); color: #1C2321; font-size: 11px; line-height: 20px; font-weight: 800; }
.lines { margin-top: 10px; }
.line { display: flex; align-items: center; gap: 8px; padding: 8px 0 0; margin-top: 8px; border-top: 1px solid var(--line); font-size: 14px; }
.line .what { flex: 1; font-weight: 700; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--ctl); border-radius: 10px; overflow: hidden; }
.qty button { width: 40px; height: 40px; border: 0; background: var(--grey-l); font-size: 18px; }
.qty span { min-width: 32px; text-align: center; font-weight: 700; }
.sub { min-width: 76px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* bottom bar（連絡システムと同じ） */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 20; }
.bottom .in { max-width: 448px; margin: 0 auto; }
.bottom.wide .in { max-width: 1208px; }
.bottom .tot { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 13px; color: var(--sub); }
.bottom .tot b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.bottom .acts { display: flex; gap: 8px; }
.bottom .acts .btn { flex: 1; }
.bottom .acts .btn.ghost { flex: 0 0 auto; }

/* confirm / summary */
.sum { width: 100%; border-collapse: collapse; font-size: 14px; }
.sum th, .sum td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.sum th { width: 38%; color: var(--sub); font-weight: 400; font-size: 13px; }
.sum .r { text-align: right; white-space: nowrap; }
.sum tfoot td { font-weight: 700; font-size: 17px; border-bottom: 0; }
.done-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 4px auto 8px; font-size: 28px; }

/* staff */
.s-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); overflow-x: auto; margin-top: 6px; }
.s-tabs button { flex: none; border: 0; background: none; min-height: 44px; padding: 8px 14px; color: var(--sub); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.s-tabs button[aria-selected="true"] { color: var(--main); border-bottom-color: var(--main); font-weight: 700; }
.s-tabs .n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; margin-left: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.stat { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.stat div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 130px; font-size: 13px; color: var(--sub); }
.stat b { display: block; font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat .warn b { color: var(--red); }
.ord { margin: 10px 0; }
.ord-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ord-top .nm { font-weight: 700; font-size: 16px; }
.ord-top .amt { margin-left: auto; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.ord .items { font-size: 13px; color: var(--sub); margin: 6px 0 10px; }
.seg { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ctl); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; min-height: 40px; padding: 0 12px; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--ctl); }
.seg button[aria-pressed="true"] { background: var(--main); color: #fff; font-weight: 700; }
.chk { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.chk:first-child { border-top: 0; }
.chk input { width: 20px; height: 20px; flex: none; }
.chk .grow { flex: 1; min-width: 0; }
.chk .amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.imgs figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.imgs img { display: block; width: 100%; height: auto; }
.imgs figcaption { font-size: 12px; padding: 6px 10px; color: var(--sub); display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.imgs figcaption a { color: var(--main); }
.gate { max-width: 400px; margin: 40px auto; padding: 0 16px; }

/* table（連絡システムと同じ） */
.tscroll { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; }
.tscroll table { border-collapse: collapse; width: 100%; font-size: 13px; }
.tscroll th, .tscroll td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; white-space: nowrap; }
.tscroll th { background: #F0F3F1; font-size: 12px; color: var(--sub); font-weight: 700; position: sticky; top: 0; }
.tscroll td:nth-child(13) { white-space: normal; min-width: 220px; }
.toolbar select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--ctl); border-radius: 8px; background: #fff; }

/* 写真から読み取る */
.photo-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 12px; }
.photo-row img { width: 96px; height: 128px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; background: #fff; }
.photo-row .grow { flex: 1; min-width: 0; font-size: 14px; }
.photo-notes { margin: 6px 0 0; padding-left: 1.2em; color: var(--org); font-size: 13px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 140px; transform: translateX(-50%); background: var(--main-d); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
