/* キャストボード 管理画面 v0.2（色はお客さんの画面の紺と生成りに合わせた）。店長がスマホで片手で操作する前提（下に4つの入口・大きな押す所）。 */
:root {
  --paper: #f3f1ec;
  --card: #fdfcfa;
  --ink: #161b27;
  --mute: #6b7180;
  --line: #dcd9d2;
  --wine: #1c2a4a;
  --wine2: #2a3d66;
  --gold: #6f7d9c;
  --ok: #1f6b4a;
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  --latin: "Didot", "Bodoni 72", Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.mark { font-family: var(--latin); letter-spacing: .32em; font-size: 11px; color: var(--gold); }

/* ---- ボタン（角は小さく丸める・影は付けない） */
.primary, .ghost, .danger, .bulk button { border-radius: 6px; min-height: 48px; padding: 0 18px; border: 1px solid transparent; font-weight: 600; letter-spacing: .04em; }
.primary { background: var(--wine); color: #fff; }
.primary:active { background: var(--wine2); }
.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.danger { background: transparent; border-color: #c9a2a2; color: #9b2222; }
.big { width: 100%; min-height: 56px; font-size: 17px; }
.wide { width: 100%; margin-top: 12px; }

/* ---- ログイン */
.login { min-height: 100vh; display: grid; align-items: center; padding: 24px; background: linear-gradient(180deg, #0b0f19 0 38%, var(--paper) 38%); }
.login-box { max-width: 420px; width: 100%; margin: 0 auto; background: var(--card); border: 1px solid var(--line); padding: 30px 24px; border-radius: 8px; }
.login-box h1 { margin: 6px 0 22px; font-family: var(--mincho); font-size: 26px; letter-spacing: .08em; }
.login-box label { display: block; margin-bottom: 16px; font-size: 14px; color: var(--mute); }
.login-box input { display: block; width: 100%; margin-top: 6px; height: 52px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 17px; color: var(--ink); }
.err { color: #a12222; min-height: 1.2em; margin: 6px 0 12px; font-size: 14px; }

/* ---- 上の帯 */
.top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: #0b0f19; color: #ebe5d9; }
.store { display: flex; flex-direction: column; min-width: 0; }
.store strong { font-family: var(--mincho); font-size: 19px; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewlink { flex: none; color: #d9e0ee; border: 1px solid rgba(217, 224, 238, .45); border-radius: 6px; padding: 10px 12px; text-decoration: none; font-size: 14px; }

main { max-width: 760px; margin: 0 auto; padding: 0 14px calc(100px + env(safe-area-inset-bottom)); }
.page { display: none; }
.page.on { display: block; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 2px 14px; }
.page-head h2 { margin: 0; font-family: var(--mincho); font-size: 24px; letter-spacing: .08em; }
.tally { margin: 0; font-size: 15px; color: var(--mute); }
.tally b { font-size: 26px; color: var(--wine); font-family: var(--latin); }
.note { color: var(--mute); font-size: 13px; line-height: 1.6; margin: 10px 2px 12px; }

/* ---- 一覧の行 */
.rows { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); min-height: 72px; background: var(--card); }
.rows li:last-child { border-bottom: 0; }
.thumb { flex: none; width: 52px; height: 64px; object-fit: cover; border-radius: 4px; background: #1a2132; }
.thumb.none { display: grid; place-items: center; color: #d9e0ee; font-family: var(--mincho); font-size: 22px; }
.who { flex: 1; min-width: 0; }
.who .nm { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .sub { font-size: 13px; color: var(--mute); margin-top: 2px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 6px; border-radius: 3px; border: 1px solid var(--line); margin-left: 6px; color: var(--mute); }
.tag.off { color: #9b2222; border-color: #e0b9b9; }
.rowbtn { flex: none; min-height: 48px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-weight: 600; }

/* ---- 出勤 */
.bulk { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bulk button { min-height: 56px; background: var(--card); border-color: var(--line); font-size: 16px; }
.bulk #allOn { background: #eef1f7; border-color: var(--gold); }
.work li { gap: 8px; padding: 8px 8px 8px 4px; }
.work li.dragging { opacity: .9; box-shadow: 0 6px 18px rgba(22, 27, 39, .18); position: relative; z-index: 2; }
.handle { flex: none; width: 40px; height: 56px; display: grid; place-items: center; color: var(--mute); font-size: 22px; touch-action: none; cursor: grab; border: 0; background: none; }
.updown { display: flex; flex-direction: column; gap: 4px; flex: none; }
.updown button { width: 44px; height: 26px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 11px; line-height: 1; padding: 0; color: var(--mute); }
.toggle { flex: none; width: 92px; height: 56px; border-radius: 6px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 16px; color: var(--mute); }
.toggle.on { background: var(--wine); border-color: var(--wine); color: #fff; }
.work li.is-on { background: #f2f4f8; }

/* ---- ランキング */
.seg { display: flex; border: 1px solid var(--wine); border-radius: 6px; overflow: hidden; background: var(--card); }
.seg button { flex: 1; min-height: 48px; border: 0; background: transparent; font-weight: 600; padding: 0 6px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--wine); color: #fff; }
.seg.small button { min-height: 46px; }
.rank-sel { flex: none; width: 104px; height: 50px; border-radius: 6px; border: 1px solid var(--line); background: #fff; padding: 0 10px; font-size: 16px; font-weight: 700; }
.rank-sel.set { border-color: var(--gold); background: #eef1f7; }
.rank-sel.out { color: var(--mute); }

/* ---- 入力 */
.form { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px 16px; }
.form.sub { margin-top: 16px; }
.form.sub h3 { margin: 4px 0 8px; font-size: 15px; }
.field { display: block; margin-bottom: 18px; font-size: 14px; color: var(--mute); }
.field > span { display: block; margin-bottom: 6px; }
.field input, .field textarea, .field select { display: block; width: 100%; margin-top: 6px; min-height: 50px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 16px; color: var(--ink); }
.field textarea { line-height: 1.6; }
.birth { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.birth select { min-height: 50px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 0 8px; font-size: 16px; min-width: 0; }
.switchline { display: flex; align-items: center; gap: 12px; padding: 14px 12px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 18px; background: #fff; font-weight: 600; }
.switchline input { width: 26px; height: 26px; accent-color: var(--wine); flex: none; }
.addr { word-break: break-all; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-size: 14px; margin: 0 0 18px; }

/* ---- 写真の枠 */
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.slots.one { grid-template-columns: minmax(0, 200px); }
.slot { border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.slot .pv { aspect-ratio: 3 / 4; background: #ebe8e2; display: grid; place-items: center; color: var(--mute); font-size: 12px; position: relative; }
.slots.sys .pv, #sysSlots .pv, #logoSlot .pv { aspect-ratio: 4 / 3; }
.slot .pv img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#sysSlots .pv img, #logoSlot .pv img { object-fit: contain; }
.slot .lbl { font-size: 12px; padding: 6px 8px 0; color: var(--ink); font-weight: 600; }
.slot .pend { color: var(--wine); font-weight: 700; }
.slot button { min-height: 40px; border: 0; border-top: 1px solid var(--line); background: #fff; font-size: 12px; padding: 4px; }
.slot button.del { color: #9b2222; }

/* ---- 編集画面 */
.editor { position: fixed; inset: 0; z-index: 40; background: var(--paper); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ed-top { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: #0b0f19; color: #ebe5d9; }
.ed-top strong { text-align: center; font-family: var(--mincho); font-size: 18px; }
.ed-top .ghost { color: #ebe5d9; border-color: rgba(244, 236, 223, .35); min-height: 44px; }
.editor .form { max-width: 760px; margin: 14px auto 60px; border-radius: 8px; }

/* ---- 下の4つの入口（親指で届く所） */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: #0b0f19; }
.dock button { min-height: 56px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #9aa1b0; font-size: 14px; font-weight: 600; padding: 0 2px; }
.dock button.on { color: #0b0f19; background: #d9e0ee; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 60; background: #241a1d; color: #fff; padding: 12px 18px; border-radius: 6px; font-size: 15px; max-width: calc(100% - 32px); }

@media (min-width: 800px) {
  .slots { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ---- ひとこと（c1〜c15・各15文字） */
.words { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; counter-reset: w; }
.words label { display: grid; grid-template-columns: 34px minmax(0, 1fr) 44px; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); }
.words input { margin-top: 0; min-height: 46px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 16px; color: var(--ink); width: 100%; }
.words .n { text-align: right; font-variant-numeric: tabular-nums; }
.words .left { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.words .left.full { color: #9b2222; }
@media (min-width: 800px) { .words { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
