:root {
  --bg: #f6f2e9; --card: #fffdf8; --ink: #1d1d1a; --mut: #6b6a62; --line: #e1dacb;
  --green: #1f4d3a; --green2: #2f6b52; --red: #b3261e; --amber: #b26a00;
  --top: env(safe-area-inset-top, 0px); --bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.35 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }
body { min-height: 100dvh; padding-top: calc(64px + var(--top)); padding-bottom: calc(150px + var(--bot)); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
header#top { position: fixed; z-index: 20; top: 0; left: 0; right: 0; padding: calc(8px + var(--top)) 12px 8px; background: var(--green); color: #fff; }
.tour-btn { width: 100%; min-height: 48px; background: rgba(255,255,255,.12); border: 0; border-radius: 12px; color: #fff; text-align: left; padding: 6px 14px; display: flex; flex-direction: column; justify-content: center; }
.tour-btn::after { content: "▾"; position: absolute; right: 26px; top: calc(14px + var(--top)); font-size: 18px; }
#tour-name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 24px; }
.sub { font-size: 12.5px; opacity: .8; }
.view { padding: 12px 12px 0; }
#dock { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 10px 12px calc(6px + var(--bot)); }
.capture-row { display: flex; gap: 10px; }
.big-btn { flex: 1; min-height: 64px; border: 0; border-radius: 18px; background: var(--green); color: #fff; font-size: 24px; font-weight: 700; box-shadow: 0 3px 8px rgba(31,77,58,.35); }
.big-btn:active { background: var(--green2); }
.side-btn { width: 112px; min-height: 64px; border-radius: 18px; border: 2px solid var(--green); background: #fff; color: var(--green); font-weight: 600; font-size: 16px; }
.tabs { display: flex; margin-top: 8px; }
.tab { flex: 1; min-height: 48px; border: 0; background: none; color: var(--mut); font-size: 16px; font-weight: 600; border-radius: 12px; }
.tab.on { color: var(--green); background: #e9efe9; }

.banner { background: #fff7df; border: 1px solid #ecd68a; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 15px; }
.banner button { margin-top: 8px; }
.empty { text-align: center; color: var(--mut); padding: 40px 20px; }
.empty .ico { font-size: 54px; }

.day { margin-bottom: 16px; }
.day-h { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px; font-weight: 700; }
.day-h .sum { color: var(--green); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.row { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 72px; padding: 10px 12px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
.row:last-child { border-bottom: 0; }
.row:active { background: #f1ece0; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #e8e2d4; flex: none; }
.row .mid { flex: 1; min-width: 0; }
.row .t1 { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { font-size: 14px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { text-align: right; flex: none; }
.row .amt b { display: block; }
.row .amt span { font-size: 13px; color: var(--mut); }
.warn { color: var(--amber); }

.btn { min-height: 52px; padding: 0 18px; border-radius: 14px; border: 2px solid var(--green); background: #fff; color: var(--green); font-weight: 650; font-size: 17px; }
.btn.primary { background: var(--green); color: #fff; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.block { display: block; width: 100%; margin: 10px 0; }
.btn:disabled { opacity: .5; }
.btn:active { filter: brightness(.93); }
.btn.small { min-height: 40px; font-size: 15px; padding: 0 12px; }

.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; }
.sheet-card { width: 100%; max-height: 94dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); border-radius: 22px 22px 0 0; padding: 16px 14px calc(18px + var(--bot)); }
.sheet-card h2 { margin: 2px 0 12px; font-size: 22px; }
.sheet-card .sub2 { color: var(--mut); font-size: 14px; margin: -6px 0 10px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13.5px; color: var(--mut); margin-bottom: 4px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 52px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); -webkit-appearance: none; appearance: none; }
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--green2); border-color: var(--green2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2.amt { grid-template-columns: 1.4fr 1fr; }
.status { padding: 10px 12px; border-radius: 12px; background: #e9efe9; margin-bottom: 12px; font-size: 15px; display: flex; gap: 10px; align-items: center; }
.status.err { background: #fbe9e7; }
.status.ok { background: #e3f1e6; }
.spin { width: 18px; height: 18px; border: 3px solid #bcd0c4; border-top-color: var(--green); border-radius: 50%; animation: sp 0.8s linear infinite; flex: none; }
@keyframes sp { to { transform: rotate(360deg); } }
.photo-prev { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.photo-prev img { width: 84px; height: 112px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.chf-line { font-size: 15px; background: #fff; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.btnrow { display: flex; gap: 10px; }
.btnrow .btn { flex: 1; }
.detail-photo { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: block; margin-bottom: 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv span:first-child { color: var(--mut); }
.kv span:last-child { text-align: right; font-weight: 600; }
.viewer { position: fixed; inset: 0; z-index: 70; background: #000; overflow: auto; -webkit-overflow-scrolling: touch; }
.viewer img { display: block; width: 100%; height: auto; }
.viewer.zoom img { width: 250%; max-width: none; }
.viewer .close { position: fixed; top: calc(10px + var(--top)); right: 12px; z-index: 71; min-height: 48px; padding: 0 18px; border-radius: 24px; border: 0; background: rgba(255,255,255,.9); font-weight: 700; }
.viewer .zoom-btn { position: fixed; top: calc(10px + var(--top)); left: 12px; z-index: 71; min-height: 48px; padding: 0 18px; border-radius: 24px; border: 0; background: rgba(255,255,255,.9); font-weight: 700; }

.total-card { background: var(--green); color: #fff; border-radius: 18px; padding: 18px; margin-bottom: 14px; }
.total-card .big { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; }
.total-card .small { opacity: .85; font-size: 14px; }
.sect { margin-bottom: 18px; }
.sect h3 { margin: 0 0 6px 4px; font-size: 16px; color: var(--green); }
.bar-row { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bar-row:last-child { border-bottom: 0; }
.bar-row .l { display: flex; justify-content: space-between; gap: 8px; }
.bar-row .l b { white-space: nowrap; }
.bar { height: 7px; border-radius: 4px; background: #e8e2d4; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green2); }
.more-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 0 14px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 600; }
.more-btn:last-child { border-bottom: 0; }
.more-btn small { display: block; font-weight: 400; color: var(--mut); font-size: 13px; }
.more-btn .e { font-size: 24px; width: 30px; text-align: center; }
.toast { position: fixed; z-index: 90; left: 16px; right: 16px; bottom: calc(170px + var(--bot)); background: #222; color: #fff; padding: 12px 16px; border-radius: 14px; text-align: center; }
.tour-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); }
.tour-item:last-child { border-bottom: 0; }
.tour-item .pick { flex: 1; min-height: 56px; text-align: left; background: none; border: 0; }
.tour-item .pick b { display: block; }
.tour-item .pick span { color: var(--mut); font-size: 14px; }
.tour-item.cur .pick b::before { content: "✓ "; color: var(--green); }
p.hint { color: var(--mut); font-size: 14px; }
header#top { display: flex; gap: 8px; }
.tour-btn { position: relative; flex: 1; min-width: 0; }
.tour-btn::after { right: 12px; }
.seg { display: flex; flex: none; background: rgba(255,255,255,.12); border-radius: 12px; padding: 3px; }
.seg button { min-width: 54px; min-height: 42px; border: 0; border-radius: 9px; background: none; color: #fff; font-weight: 700; font-size: 15px; }
.seg button.on { background: #fff; color: var(--green); }
.tour-btn::after { top: 50%; transform: translateY(-50%); }
