:root {
  --bg: #100e0b;
  --panel: #1b1712;
  --panel2: #241e16;
  --line: #3a3226;
  --text: #f3eee3;
  --muted: #b3a88f;
  --gold: #c9a44c;
  --gold-dark: #9a7b2d;
  --danger: #e0655f;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.view { max-width: 720px; margin: 0 auto; padding: 16px 14px 48px; }

/* ---------- 認証 ---------- */
.auth-card { margin-top: 10vh; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 22px; }
.logo { margin: 0 0 6px; font-size: 28px; letter-spacing: .08em; color: var(--gold); text-align: center; }
.auth-sub { margin: 0 0 22px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- 共通部品 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field-inline { display: flex; align-items: center; gap: 10px; margin-bottom: 0; }
.field-inline > span { margin-bottom: 0; }
input[type="email"], input[type="password"], input[type="text"], input[type="number"],
input[type="date"], input[type="month"], select {
  width: 100%; min-height: 48px; padding: 10px 12px; font-size: 17px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
.btn {
  min-height: 48px; padding: 10px 18px; font-size: 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--gold); border-color: var(--gold-dark); color: #1c1608; font-weight: 700; }
.btn-ghost { background: transparent; }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger); margin-top: 22px; }
.btn-save { position: sticky; top: 8px; z-index: 5; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.error { color: var(--danger); font-size: 14px; margin: 4px 0 10px; }
.note { color: var(--muted); font-size: 13px; }
.section-title { font-size: 17px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.section-title.danger { color: var(--danger); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.inline-form .btn { flex: 0 0 auto; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: 16px; }
.check-row input { width: 24px; height: 24px; accent-color: var(--gold); }

/* ---------- ヘッダー・タブ ---------- */
.app-header { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.header-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.header-row:last-child { margin-bottom: 0; }
.header-title { flex: 1; font-size: 19px; font-weight: 700; color: var(--gold); letter-spacing: .06em; }
#store-select { flex: 1; }
.tabs { display: flex; gap: 6px; margin: 14px 0 4px; }
.tab {
  flex: 1; min-height: 48px; font-size: 16px; border-radius: 8px; cursor: pointer;
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
}
.tab.active { background: var(--gold); color: #1c1608; font-weight: 700; border-color: var(--gold-dark); }
.empty-box { margin-top: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* ---------- 出勤チップ・入力カード ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip {
  min-height: 48px; padding: 10px 16px; font-size: 16px; border-radius: 999px; cursor: pointer;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}
.chip.selected { background: var(--gold); color: #1c1608; font-weight: 700; border-color: var(--gold-dark); }
.entry-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 14px; }
.entry-name { font-size: 18px; font-weight: 700; margin: 0 0 10px; }
.sales-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 6px; }
.sales-row .field { flex: 1; margin-bottom: 0; }
.counter-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.counter-label { flex: 1; font-size: 16px; }
.counter-btn {
  width: 48px; height: 48px; min-width: 48px; min-height: 48px; border-radius: 50%;
  font-size: 22px; line-height: 1; background: var(--panel2); color: var(--gold);
  border: 1px solid var(--gold-dark); cursor: pointer;
}
.counter-btn:active { background: var(--gold); color: #1c1608; }
.counter-value { width: 44px; text-align: center; font-size: 19px; font-weight: 700; }

/* ---------- リスト ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 8px; min-height: 56px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; margin-bottom: 8px;
}
.list .item-name { flex: 1; font-size: 16px; word-break: break-all; }
.list .btn { min-height: 44px; padding: 6px 12px; font-size: 14px; }

/* ---------- 成績表 ---------- */
.report-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.report-head .field { flex: 1; }
.report-title { font-size: 19px; margin: 10px 0 12px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border: 1px solid var(--line); padding: 8px 6px; text-align: right; white-space: nowrap; }
th { background: #2c2517; color: var(--gold); font-weight: 700; }
td.name, th.name { text-align: left; white-space: normal; min-width: 84px; }
td.rank, th.rank { text-align: center; }
tr.total td { background: var(--panel2); font-weight: 700; }
.print-note { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--gold); color: #1c1608; font-weight: 700; font-size: 16px;
  padding: 12px 22px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.55); z-index: 50;
}

/* ---------- 印刷（A4縦・1ページ） ---------- */
@page { size: A4 portrait; margin: 10mm; }
@media print {
  body { background: #fff; color: #000; }
  .no-print, header, nav, #toast { display: none !important; }
  .view { max-width: none; padding: 0; }
  .tab-page { display: none !important; }
  #tab-report { display: block !important; }
  .report-title { color: #000; font-size: 16px; margin: 0 0 8px; }
  .table-wrap { overflow: visible; }
  table { font-size: 10.5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  th, td { border: 1px solid #888; padding: 4px 5px; color: #000; }
  th { background: #d9d9d9 !important; color: #000; }
  tr.total td { background: #eeeeee !important; }
}
