:root { --red:#b3261e; --bg:#fffaf5; --card:#fff; --line:#e6ddd3; --text:#2a2320; --sub:#7a6e66; --ok:#2e7d32; --warn:#e65100; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin:0; background:var(--bg); color:var(--text); font-family:-apple-system,"Hiragino Sans","Noto Sans JP",sans-serif; font-size:16px; }
body { padding-top:env(safe-area-inset-top); padding-bottom:calc(64px + env(safe-area-inset-bottom)); min-height:100vh; }
.top { position:sticky; top:0; z-index:5; display:flex; justify-content:space-between; align-items:center; padding:8px 12px; background:var(--red); color:#fff; }
.month { display:flex; align-items:center; gap:4px; position:relative; }
.month button { background:transparent; color:#fff; border:0; font-size:22px; padding:6px 12px; min-width:44px; min-height:44px; }
.month .month-label { font-size:19px; font-weight:700; }
.month-center { position:relative; display:inline-block; }
#month-picker { position:absolute; inset:0; width:100%; height:100%; opacity:0; font-size:16px; }
.icon-btn { background:transparent; border:0; color:inherit; font-size:22px; min-width:44px; min-height:44px; }
main { padding:12px; max-width:720px; margin:0 auto; }
.card { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:14px; margin-bottom:12px; }
.lead { margin:0 0 12px; line-height:1.6; }
.note { color:var(--sub); font-size:13px; line-height:1.5; }
.btn-row { display:flex; flex-direction:column; gap:10px; }
.btn { display:inline-flex; justify-content:center; align-items:center; gap:6px; padding:12px 16px; min-height:48px; border-radius:12px; border:1px solid var(--line); background:#fff; color:var(--text); font-size:16px; font-weight:600; cursor:pointer; text-align:center; }
.btn.primary { background:var(--red); border-color:var(--red); color:#fff; }
.btn.danger { color:var(--red); border-color:var(--red); }
.btn.big { min-height:56px; font-size:17px; }
.btn.link { border:0; background:transparent; color:var(--red); margin-top:6px; width:100%; }
.btn:active { opacity:.75; }
.tabbar { position:fixed; bottom:0; left:0; right:0; display:flex; background:#fff; border-top:1px solid var(--line); padding-bottom:env(safe-area-inset-bottom); z-index:5; }
.tabbar button { flex:1; border:0; background:transparent; padding:8px 0 6px; font-size:12px; color:var(--sub); display:flex; flex-direction:column; align-items:center; gap:2px; min-height:56px; }
.tabbar button span { font-size:22px; }
.tabbar button.active { color:var(--red); font-weight:700; }
.badge { background:var(--warn); color:#fff; border-radius:9px; padding:0 6px; font-size:11px; margin-left:2px; }
.tab[hidden], [hidden] { display:none !important; }

.queue { display:flex; flex-direction:column; gap:8px; }
.q-item { display:flex; gap:10px; align-items:center; background:var(--card); border:1px solid var(--line); border-radius:12px; padding:8px; }
.q-item img { width:48px; height:64px; object-fit:cover; border-radius:6px; background:#eee; }
.q-body { flex:1; min-width:0; }
.q-title { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.q-status { font-size:13px; color:var(--sub); }
.q-status.done { color:var(--ok); } .q-status.err { color:var(--red); }
.bar { height:6px; background:#eee; border-radius:3px; margin-top:4px; overflow:hidden; } .bar i { display:block; height:100%; background:var(--red); width:0; transition:width .2s; }

.list-summary { display:flex; justify-content:space-between; align-items:baseline; margin:0 4px 8px; }
.list-summary b { font-size:20px; }
.list { display:flex; flex-direction:column; gap:8px; }
.row { display:flex; gap:10px; align-items:center; background:var(--card); border:1px solid var(--line); border-radius:12px; padding:10px; width:100%; text-align:left; font:inherit; color:inherit; }
.row img { width:44px; height:58px; object-fit:cover; border-radius:6px; background:#eee; flex:none; }
.row .ph { width:44px; height:58px; border-radius:6px; background:#f0e8df; flex:none; display:flex; align-items:center; justify-content:center; font-size:20px; }
.row .mid { flex:1; min-width:0; }
.row .store { font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row .meta { font-size:13px; color:var(--sub); display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.row .amt { font-weight:700; font-size:17px; white-space:nowrap; }
.chip { display:inline-block; padding:1px 8px; border-radius:10px; background:#f3e7dc; color:#5a4636; font-size:12px; font-weight:600; }
.chip.warn { background:#fde7d6; color:var(--warn); }
.empty { text-align:center; color:var(--sub); padding:36px 12px; line-height:1.7; }

.group { background:var(--card); border:1px solid var(--line); border-radius:14px; margin-bottom:10px; overflow:hidden; }
.group > summary { list-style:none; display:flex; justify-content:space-between; align-items:center; padding:14px; font-weight:700; cursor:pointer; }
.group > summary::-webkit-details-marker { display:none; }
.group .sub { color:var(--sub); font-weight:400; font-size:13px; margin-left:8px; }
.group .lines { border-top:1px solid var(--line); }
.line { display:flex; justify-content:space-between; gap:8px; padding:10px 14px; border-bottom:1px solid #f3ede6; font-size:15px; width:100%; background:transparent; border-left:0; border-right:0; border-top:0; text-align:left; font-family:inherit; color:inherit; }
.line:last-child { border-bottom:0; }
.line small { color:var(--sub); }
.grand { display:flex; justify-content:space-between; padding:14px; font-size:19px; font-weight:800; background:#fff3e8; border-radius:14px; margin-bottom:12px; }
.export-card { display:flex; flex-direction:column; gap:10px; }

dialog { border:0; border-radius:16px; padding:0; width:min(560px, 100vw - 16px); max-height:92vh; color:var(--text); }
dialog::backdrop { background:rgba(0,0,0,.45); }
dialog form, dialog > *:not(form):not(.sheet-head) { }
dialog > label, dialog > p, dialog > .btn-row { margin:12px 16px; }
#edit-form { padding:0 16px 16px; display:flex; flex-direction:column; gap:12px; }
.sheet-head { display:flex; justify-content:space-between; align-items:center; position:sticky; top:0; background:#fff; padding:8px 8px 8px 16px; z-index:1; }
label { display:flex; flex-direction:column; gap:4px; font-size:13px; color:var(--sub); font-weight:600; }
input[type=text], input[type=date], input[type=month], select { font:inherit; font-size:17px; color:var(--text); padding:10px 12px; min-height:48px; border:1px solid var(--line); border-radius:10px; background:#fff; width:100%; }
.hint { font-weight:400; font-size:12px; }
.img-wrap { max-height:38vh; overflow:auto; border:1px solid var(--line); border-radius:10px; background:#eee; }
.img-wrap img { width:100%; display:block; }
.img-wrap.zoom { max-height:70vh; } .img-wrap.zoom img { width:200%; max-width:none; }
.warn { background:#fde7d6; color:var(--warn); padding:8px 10px; border-radius:8px; font-size:13px; line-height:1.5; }
details summary { cursor:pointer; font-size:14px; color:var(--sub); padding:4px 0; }
details ul { margin:4px 0; padding-left:20px; font-size:14px; } details pre { white-space:pre-wrap; font-size:12px; background:#f7f2ec; padding:8px; border-radius:8px; max-height:200px; overflow:auto; }
.sheet-actions { flex-direction:row; } .sheet-actions .btn { flex:1; }
.toast { position:fixed; left:50%; bottom:calc(76px + env(safe-area-inset-bottom)); transform:translateX(-50%); background:#2a2320; color:#fff; padding:10px 16px; border-radius:20px; font-size:14px; z-index:50; max-width:90vw; text-align:center; }
.stores-list { margin:0 12px; display:flex; flex-direction:column; gap:8px; }
.st { border:1px solid var(--line); border-radius:12px; padding:10px; display:flex; flex-direction:column; gap:6px; background:#fff; }
.st .r { display:flex; gap:6px; align-items:center; }
.st .r > * { min-width:0; }
.st input, .st select { min-height:42px; font-size:15px; padding:6px 8px; }
.st .mini { min-width:40px; min-height:40px; border:1px solid var(--line); background:#fff; border-radius:8px; font-size:16px; }
.grp { font-size:12px; color:var(--sub); margin:8px 4px 0; font-weight:700; }
