:root {
  --bg: #121018; --panel: #1c1924; --panel2: #262231; --line: #343042;
  --text: #f1edf7; --muted: #9a93ab; --gold: #d8b46a; --gold2: #f0d79a;
  --ok: #4fb38a; --soon: #e0a640; --confirm: #e5546a; --check: #7d8cf0;
  --r: 12px;
}
* { 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", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif; font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
button:active { transform: scale(.98); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #241c0c; border: 0; font-weight: 700; }
button.ghost { background: transparent; }
button.danger { color: #ff8b9b; border-color: #5a2e38; }
button.big { min-height: 56px; font-size: 17px; width: 100%; }
button.sm { min-height: 32px; padding: 4px 10px; }
button.on { border-color: var(--gold); color: var(--gold2); background: #2d2618; }
input, select, textarea { background: #0f0d14; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
label > input, label > select, label > .inp { margin-top: 4px; color: var(--text); font-size: 15px; }
label.chk { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 15px; }
label.chk input { width: 22px; min-height: 22px; }
.inp { display: flex; align-items: center; gap: 8px; }
.inp em { font-style: normal; color: var(--muted); }
h2 { margin: 0; font-size: 22px; }
h3 { margin: 18px 0 8px; font-size: 14px; color: var(--gold); letter-spacing: .05em; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); margin-left: 6px; vertical-align: middle; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* ヘッダー */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); background: #0c0a10ee; border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.logo { color: var(--gold); }
.demo-tag { font-size: 11px; color: #241c0c; background: var(--gold); border-radius: 6px; padding: 1px 6px; margin-left: 8px; vertical-align: 2px; }
.tabs { display: flex; gap: 6px; }
.tabs button { min-height: 40px; }
.clock { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.clock-label { font-size: 11px; color: var(--muted); }
.clock-time { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold2); margin-right: 6px; }
.clock button { min-height: 36px; padding: 4px 10px; font-size: 13px; }
body:not(.demo-clock) .clock button { display: none; }
body:not(.demo-clock) .clock-label::after { content: "（本物の時刻）"; }
body.demo-clock .clock-label::after { content: "（デモ）"; color: var(--soon); }
.clock-label { font-size: 0; }
.clock-label::after { font-size: 11px; }

main { padding: 16px; padding-bottom: 60px; }

/* フロア */
.floor-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.floor { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.table { text-align: left; padding: 14px; min-height: 150px; border-radius: var(--r); background: var(--panel); border: 2px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.t-name { font-size: 20px; font-weight: 700; }
.t-state { font-size: 13px; font-weight: 700; }
.t-sub { font-size: 12px; color: var(--muted); }
.t-cast { font-size: 12px; color: #f3a9c4; }
.t-total { margin-top: auto; font-size: 18px; font-weight: 700; color: var(--gold2); text-align: right; }
.st-empty { border-style: dashed; opacity: .7; }
.st-empty .t-state { color: var(--muted); }
.st-ok { border-color: #2e5c4a; } .st-ok .t-state { color: var(--ok); }
.st-soon { border-color: var(--soon); } .st-soon .t-state { color: var(--soon); }
.st-grace { border-color: var(--soon); } .st-grace .t-state { color: var(--soon); }
.st-confirm { border-color: var(--confirm); animation: blink 1.2s infinite; } .st-confirm .t-state { color: var(--confirm); }
.st-check { border-color: var(--check); } .st-check .t-state { color: var(--check); }
.pill.st-ok { color: var(--ok); } .pill.st-soon, .pill.st-grace { color: var(--soon); } .pill.st-confirm { color: var(--confirm); } .pill.st-check { color: var(--check); }
@keyframes blink { 50% { box-shadow: 0 0 0 4px #e5546a55; } }

/* 伝票 */
.ticket-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.banner { background: #3a1820; border: 1px solid var(--confirm); border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; }
.ticket { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 12px; align-items: start; }
.checkout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 12px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 14px 14px; }
.guest { border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: #17141e; }
.guest.st-soon, .guest.st-grace { border-left-color: var(--soon); }
.guest.st-confirm { border-left-color: var(--confirm); }
.guest.st-stop { border-left-color: var(--muted); opacity: .75; }
.guest .row-btns { margin: 6px 0 0; }
.guest .row-btns button { min-height: 36px; padding: 4px 10px; font-size: 13px; }
.nom-add { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.nom-add select { grid-column: 1 / -1; }
.cast-pick { display: flex; align-items: center; gap: 10px; color: var(--text); }
.cast-pick select { flex: 1; margin: 0; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.cats button { min-height: 38px; }
.menu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 70px; text-align: left; }
.menu button b { color: var(--gold2); }
.line { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #2c2838; }
.line .amt { white-space: nowrap; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.qty { display: inline-flex; gap: 4px; }
.qty button { min-height: 30px; min-width: 30px; padding: 0 6px; }
.lines { max-height: 42vh; overflow: auto; }
.totals { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
.totals .line { border-bottom: 0; padding: 4px 0; }
.line.grand { font-size: 22px; font-weight: 800; color: var(--gold2); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; }
.pay-split { display: flex; gap: 16px; margin: 10px 0; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.change { font-size: 18px; margin: 10px 0 14px; }
.change b { font-size: 26px; color: var(--gold2); }
.ok-badge { color: var(--ok); font-weight: 700; margin: 8px 0; }
.bill .row-btns .big { flex: 1; }

/* 本日の会計 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.stats span { font-size: 12px; color: var(--muted); }
.stats b { font-size: 20px; color: var(--gold2); font-variant-numeric: tabular-nums; }
.rep { display: grid; grid-template-columns: 60px 70px 50px 1fr 60px 110px auto; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.rep b { text-align: right; }
.rep.voided { opacity: .5; text-decoration: line-through; }
.rep.voided .muted { text-decoration: none; }
.logs { font-size: 13px; display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; background: var(--panel); border-radius: var(--r); padding: 10px 14px; }

/* 設定 */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 14px 14px; }
.card.wide { grid-column: 1 / -1; }
.bands .bh, .bands .br { display: grid; grid-template-columns: 1.1fr 1fr 1fr 40px; gap: 6px; margin-bottom: 6px; }
.menu-edit .mh, .menu-edit .mr { display: grid; grid-template-columns: 1fr 2fr 1fr 50px 40px; gap: 6px; margin-bottom: 6px; align-items: center; }
.bh, .mh { font-size: 12px; color: var(--muted); }
.mr input[type=checkbox] { width: 24px; min-height: 24px; justify-self: center; }
.warn { font-size: 12px; color: #ffc27a; background: #3a2c14; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
textarea { min-height: 120px; resize: vertical; }
.filebtn { display: inline-flex; align-items: center; margin: 0; padding: 10px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); color: var(--text); font-size: 15px; cursor: pointer; }
.filebtn input { display: none; }

/* モーダル */
.modal { position: fixed; inset: 0; background: #000a; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; width: min(480px, 100%); }
.modal-box h3 { margin-top: 0; font-size: 18px; }
.num-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.num-grid button { min-height: 64px; font-size: 20px; font-weight: 700; }

/* お客様確認画面（明るく・大きく） */
.customer { position: fixed; inset: 0; z-index: 100; background: #faf7f0; color: #2a2333; overflow: auto; }
.cust-inner { max-width: 720px; margin: 0 auto; padding: 36px 28px 90px; text-align: center; }
.cust-store { font-size: 22px; font-weight: 700; letter-spacing: .1em; color: #8a6a2c; }
.cust-table { color: #7a7286; margin-top: 4px; }
.cust-total-label { margin-top: 28px; font-size: 18px; color: #7a7286; }
.cust-total { font-size: 72px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.cust-split { font-size: 18px; color: #5a5266; }
.cust-lines { text-align: left; margin: 26px 0; background: #fff; border-radius: 14px; padding: 12px 20px; box-shadow: 0 2px 12px #0001; font-size: 17px; }
.customer .line { border-bottom-color: #eee6d8; }
.customer .line.grand { color: #2a2333; border-top-color: #e2d8c4; }
.customer .muted { color: #8a8296; }
.customer .totals { border-top-color: #e2d8c4; }
.cust-inv { color: #7a7286; font-size: 14px; margin-bottom: 18px; }
.cust-ok { width: 100%; min-height: 72px; font-size: 22px; font-weight: 700; background: #2a2333; color: #fff; border: 0; border-radius: 16px; }
.cust-thanks { font-size: 22px; font-weight: 700; color: #3b8a66; padding: 18px; }
.cust-staff { position: fixed; right: 14px; bottom: 14px; min-height: 40px; font-size: 12px; background: #eee6d8; color: #7a7286; border: 0; user-select: none; -webkit-user-select: none; touch-action: none; }
.cust-staff.pressing { background: #d8b46a; color: #241c0c; transition: background 1.2s; }

@media (max-width: 980px) {
  .ticket, .checkout { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .rep { grid-template-columns: 50px 60px 40px 1fr 110px; }
  .rep > span:nth-child(5) { display: none; }
  .rep > :last-child { grid-column: 1 / -1; justify-self: end; }
}

/* アカウント */
.user { display: flex; gap: 6px; align-items: center; }
.user-btn { color: var(--gold2); }
.login { max-width: 640px; margin: 30px auto; text-align: center; }
.login h2 { font-size: 26px; color: var(--gold2); }
.login-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 20px 0; }
.login-users button { min-height: 72px; display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.login-users small { color: var(--muted); }
.pin-box { max-width: 320px; margin: 0 auto; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 10px 0 16px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gold); }
.pin-dots span.on { background: var(--gold); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { min-height: 64px; font-size: 22px; font-weight: 700; }
.err { color: #ff8b9b; margin-top: 10px; }
.acc-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.acc { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #17141e; }
.acc.off { opacity: .5; }
.acc-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acc-head b { font-size: 16px; min-width: 120px; }
.acc-head select { width: auto; min-height: 36px; padding: 4px 8px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 12px; }
.perm-grid label.chk { font-size: 13px; margin: 6px 0; }
.who { display: inline-block; font-size: 11px; background: var(--panel2); border-radius: 6px; padding: 1px 6px; color: var(--gold2); }
.who.ap { color: #f3a9c4; margin-left: 4px; }


/* 操作履歴 */
.audit-alert { background: #5a1a24; color: #ffd6dc; padding: 10px 16px; font-weight: 700; border-bottom: 1px solid var(--confirm); }
.audit-ok { background: #173328; color: #8fe0bd; border: 1px solid #2e5c4a; border-radius: 10px; padding: 10px 14px; font-weight: 700; }
.audit-ng { background: #3a1820; color: #ffb3bf; border: 1px solid var(--confirm); border-radius: 10px; padding: 10px 14px; font-weight: 700; }
.hist-filter { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.hist-filter label { margin: 0 0 8px; min-width: 180px; }
.hist-filter label.chk { min-width: 0; }
.hist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-top: 8px; font-size: 13px; }
.hist > div { display: grid; grid-template-columns: 54px 92px 50px 150px auto 1fr; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.hist > div.warn-row { background: #2a1a12; }
.hist .who { justify-self: start; }
h3 .sm { margin-left: 10px; vertical-align: middle; }
@media (max-width: 980px) { .hist > div { grid-template-columns: 44px 84px 46px auto 1fr; } .hist > div > :nth-child(4) { display: none; } }


/* 日報・集計 */
.sub-tabs { flex: 0 0 auto; }
.sub-tabs button { flex: 0 0 auto; }
.daily-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; margin-top: 12px; }
.change b.ng { color: #ff8b9b; }
.stats .warn-stat b { color: #ff8b9b; }
.stats small { font-size: 12px; color: var(--muted); margin-left: 6px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; font-size: 14px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--panel2); }
.tbl .sum-row td { font-weight: 700; color: var(--gold2); }
.tbl a { color: var(--gold2); }
.voided-line { opacity: .5; text-decoration: line-through; }
.small { font-size: 12px; }
@media (max-width: 980px) { .daily-cols { grid-template-columns: 1fr; } .tbl { font-size: 12px; } .tbl th, .tbl td { padding: 6px; } }


/* 勤怠 */
.att-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.att { display: grid; grid-template-columns: 130px 190px 1fr 1fr 90px 120px; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.att.st-work { border-left-color: var(--ok); }
.att.st-off { border-left-color: var(--muted); opacity: .8; }
.att-name { font-size: 16px; }
.att-seg button { min-height: 40px; }
.att label { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.att label .inp { margin: 0; }
.att input[type=time] { min-height: 40px; padding: 4px 8px; }
.att-dur { font-weight: 700; color: var(--gold2); }
.att-none { grid-column: span 3; }
.att-by { text-align: right; }
@media (max-width: 980px) { .att { grid-template-columns: 1fr 1fr; } .att-none { grid-column: span 2; } .att-by { text-align: left; } }
