/* 共通の画面ルール（導入店用・運営用）
   ・角：入力欄だけ角丸、それ以外（枠・カード・パネル・ボタン）は角四角
   ・項目名：入力欄の中に表示し、入力すると上に移動（文字の大きさは変えない・枠とかぶらせない）
   ・各項目の境目は線で区切る
   ・数字の入力は右揃え（右端に余白）
   ・読ませる文字は14px以上
   ・キャンセルは保存の左隣、エラーは押したボタンのそば */
:root {
  --bg: #f4f5f7; --panel: #fff; --line: #d9dce1; --text: #1f2328; --sub: #5b6470; --main: #1f5fbf; --main-dark: #164a96;
  --ok: #1a7f37; --warn: #b35900; --ng: #c62828; --soft: #eef3fb; --radius-input: 8px; --gap: 12px;
}
* { box-sizing: border-box; border-radius: 0; }
html, body { margin: 0; height: 100%; }
body { font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif; font-size: 15px; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.sub { color: var(--sub); font-size: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* レイアウト：サイドバー（スマホでは上） */
.layout { display: flex; min-height: 100vh; }
.side { width: 200px; flex: none; background: #1d2733; color: #fff; padding: 10px 0; overflow-y: auto; }
.side .brand { padding: 6px 16px 12px; font-weight: bold; font-size: 16px; }
.side .group { padding: 10px 16px 4px; font-size: 14px; color: #a9b4c2; }
.side a { display: block; padding: 9px 16px 9px 24px; color: #fff; text-decoration: none; font-size: 15px; }
.side a.on { background: var(--main); }
.main { flex: 1; min-width: 0; padding: 16px; }
.topbar { display: none; }
@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .side { width: 100%; display: none; }
  .side.open { display: block; }
  .topbar { display: flex; align-items: center; gap: 10px; background: #1d2733; color: #fff; padding: 8px 12px; position: sticky; top: 0; z-index: 20; }
  .topbar button { background: transparent; border: 1px solid #fff; color: #fff; padding: 6px 12px; }
  .topbar .crumb { font-size: 15px; }
  .main { padding: 12px; }
}

/* パネル */
.panel { background: var(--panel); border: 1px solid var(--line); padding: 14px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ボタン（角四角） */
.btn { border: 1px solid var(--line); background: #fff; padding: 9px 16px; cursor: pointer; min-height: 40px; white-space: nowrap; }
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--main); border-color: var(--main); color: #fff; }
.btn.primary:hover { background: var(--main-dark); }
.btn.danger { background: #fff; border-color: var(--ng); color: var(--ng); }
.btn.big { min-height: 56px; font-size: 17px; padding: 12px 22px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sel { background: var(--soft); border-color: var(--main); color: var(--main); font-weight: bold; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.err { color: var(--ng); font-size: 14px; }
.actions .err { margin-right: auto; }

/* 入力欄（角丸）と項目名 */
.form { border-top: 1px solid var(--line); }
.form .f { border-bottom: 1px solid var(--line); padding: 8px 0; }
.form .f:nth-child(even) { background: #fafbfc; }
.fl { position: relative; display: inline-block; padding-top: 22px; vertical-align: top; }
.fl > input, .fl > select, .fl > textarea {
  border: 1px solid #b9bfc7; border-radius: var(--radius-input); padding: 9px 12px; background: #fff; min-height: 42px; width: 100%;
}
.fl > input:focus, .fl > select:focus, .fl > textarea:focus { outline: none; border-color: var(--main); box-shadow: 0 0 0 2px #1f5fbf33; }
.fl > label { position: absolute; left: 13px; top: 32px; color: var(--sub); font-size: 15px; pointer-events: none; transition: top .12s, left .12s; white-space: nowrap; }
.fl > input:focus + label, .fl > input:not(:placeholder-shown) + label, .fl > textarea:focus + label, .fl > textarea:not(:placeholder-shown) + label,
.fl > select + label { top: 0; left: 2px; color: var(--text); }
.fl.n > input { text-align: right; padding-right: 16px; }
.fl.n > label { left: auto; right: 16px; }
.fl.n > input:focus + label, .fl.n > input:not(:placeholder-shown) + label { left: auto; right: 2px; }
.w-xs { width: 90px; } .w-s { width: 130px; } .w-m { width: 210px; } .w-l { width: 320px; } .w-xl { width: 100%; max-width: 560px; }
.check { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; margin-top: 22px; }
.check input { width: 20px; height: 20px; }

/* 一覧表（横スライダーにせず画面幅で表示） */
table.list { width: 100%; border-collapse: collapse; background: #fff; table-layout: auto; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 8px 8px; text-align: left; font-size: 15px; word-break: break-word; }
table.list th { background: #f0f2f5; font-weight: normal; color: var(--sub); }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover { background: var(--soft); }
table.list td.num, table.list th.num { text-align: right; }

/* ダイアログ */
.modal-bg { position: fixed; inset: 0; background: #0006; display: flex; align-items: center; justify-content: center; z-index: 100; padding: 12px; }
.modal { background: #fff; border: 1px solid var(--line); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; padding: 18px; }
.modal.wide { max-width: 900px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #1d2733; color: #fff; padding: 10px 18px; z-index: 200; font-size: 15px; }
.badge { display: inline-block; padding: 1px 8px; font-size: 14px; border: 1px solid currentColor; }
.ok { color: var(--ok); } .ng { color: var(--ng); } .warn { color: var(--warn); }

/* 合計の行 */
.reg-total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-top: 2px solid var(--text); margin-top: 8px; font-size: 18px; }
.reg-total b { font-size: 24px; }
