:root {
  --ink: #1d2a33;
  --muted: #6b7780;
  --line: #dfe3e6;
  --bg: #f4f5f3;
  --card: #ffffff;
  --brand: #1f4e5f;
  --brand-dark: #163a47;
  --gold: #b08d57;
  --ok: #1f7a4d;
  --ok-bg: #e6f4ec;
  --warn: #9a6a00;
  --warn-bg: #fff4d6;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --call: #c25a00;
  --call-bg: #fff0e0;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
a { color: var(--brand); }
.muted { color: var(--muted); }
.err { color: var(--bad); font-weight: 600; }
.okmsg { color: var(--ok); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.box { padding: 10px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }

/* ---- ボタン ---- */
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); text-decoration: none; line-height: 1.3;
}
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; color: var(--bad); }
.btn-danger-ghost:hover { border-color: var(--bad); }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

/* ---- ログイン・メニュー ---- */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 32px 28px; box-shadow: 0 6px 24px rgba(0,0,0,.05);
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; color: var(--brand); }
.login-input { width: 100%; font-size: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0 16px; }
.menu-card { max-width: 520px; }
.menu-link {
  display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; margin: 12px 0;
}
.menu-link:hover { border-color: var(--brand); background: #f8fbfc; }
.menu-link strong { display: block; color: var(--brand); }
.menu-link span { font-size: 13px; color: var(--muted); }

/* ---- 受付タブレット ---- */
.tablet-body {
  min-height: 100vh; min-height: 100dvh; background: linear-gradient(180deg, #f6f1e9 0%, #ece4d6 100%);
  display: grid; place-items: start center; padding: clamp(10px, 2.5vh, 28px) 24px 14px; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.tablet-back { position: fixed; bottom: 8px; left: 12px; font-size: 13px; color: var(--muted); z-index: 2; }
.tablet-hotel-fixed { position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%); margin: 0; font-size: 12px; z-index: 1; }
.tablet-screen { width: 100%; max-width: 1040px; text-align: center; }
.tablet-screen[hidden] { display: none; }
.tablet-header { margin-bottom: clamp(8px, 1.6vh, 16px); }
.tablet-hotel { margin: 0; letter-spacing: .2em; color: var(--gold); font-weight: 600; font-size: 14px; }
.tablet-title { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: clamp(26px, 4vh, 36px); margin: 0 0 2px; color: var(--brand-dark); }
.tablet-lead { font-size: clamp(17px, 2.6vh, 22px); margin: 0; }
.tablet-lead strong { color: var(--brand); border-bottom: 3px solid var(--gold); }
.tablet-lead .en { display: block; font-size: 13px; }

.tablet-row { display: flex; gap: 12px; align-items: stretch; }
.tablet-input {
  flex: 1; min-width: 0; font-size: clamp(28px, 4.4vh, 38px); text-align: center; line-height: 1.2;
  padding: clamp(12px, 2vh, 20px) 16px; border: 2px solid var(--brand); border-radius: 16px;
  background: #fff; color: var(--ink); min-height: clamp(64px, 9vh, 88px);
  display: flex; align-items: center; justify-content: center; word-break: break-all;
}
.tablet-input.is-empty::before { content: attr(data-placeholder); color: #b3aa99; }
.tablet-input::after {
  content: ''; display: inline-block; width: 3px; height: 1.1em; margin-left: 3px;
  background: var(--brand); animation: caret 1s steps(1) infinite;
}
.tablet-input.is-empty::after { display: none; }
@keyframes caret { 50% { opacity: 0; } }

.tablet-err { min-height: 1.6em; margin: 6px 0 4px; color: var(--bad); font-size: 19px; font-weight: 700; }
.tablet-btn {
  font: inherit; font-size: clamp(24px, 3.6vh, 32px); font-weight: 700; cursor: pointer;
  border: 0; border-radius: 16px; background: var(--brand); color: #fff; letter-spacing: .12em;
  padding: 0 clamp(24px, 4vw, 52px); white-space: nowrap;
}
.tablet-btn:active { background: var(--brand-dark); }
.tablet-btn:disabled { opacity: .55; }
.tablet-btn-sub { margin-top: 28px; font-size: 20px; padding: 14px 40px; background: transparent; color: var(--brand); border: 2px solid var(--brand); letter-spacing: .05em; }
.tablet-note { margin: 10px 0 0; color: #5d5547; font-size: 15px; }
.en { font-size: 14px; color: #8a8171; }

/* 端末名（スタッフが設置確認に使う小さな表示） */
.tablet-device {
  position: fixed; right: 12px; bottom: 8px; font-size: 12px; color: #8a8171;
  border: 1px solid #cfc6b4; border-radius: 99px; padding: 1px 10px; z-index: 2;
}

/* ご用件の選択 */
.tablet-body:not(.is-input) { padding-top: clamp(56px, 13vh, 130px); }
.purpose-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: clamp(18px, 4vh, 40px); }
.purpose-btn {
  font: inherit; color: #fff; border: 0; border-radius: 22px; cursor: pointer; padding: 18px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center;
  min-height: clamp(220px, 40vh, 360px); box-shadow: 0 4px 0 rgba(0,0,0,.18);
}
.purpose-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.pu-checkin { background: var(--brand); }
.pu-key { background: #8a6a2f; }
.pu-other { background: #5d6b73; }
.pu-main { font-size: clamp(30px, 4.6vh, 42px); font-weight: 700; line-height: 1.3; }
.pu-sub { font-size: clamp(15px, 2.2vh, 20px); opacity: .9; min-height: 1.2em; }
.sub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: clamp(14px, 3vh, 30px); }
.pu-sm { background: var(--brand); min-height: clamp(110px, 20vh, 170px); }
.pu-sm .pu-main { font-size: clamp(26px, 3.8vh, 34px); }
.back-btn {
  position: fixed; top: 10px; left: 14px; z-index: 3; font: inherit; font-size: 18px; font-weight: 700;
  padding: 9px 20px; min-height: 44px; border-radius: 99px; cursor: pointer;
  background: #fff; color: var(--ink); border: 2px solid #b9b09d;
}
.back-btn[hidden] { display: none; }

/* 言語切り替えボタン */
.lang-btn {
  position: fixed; top: 10px; right: 14px; z-index: 3; font: inherit; font-size: 17px; font-weight: 700;
  padding: 9px 20px; min-height: 44px; border-radius: 99px; cursor: pointer; letter-spacing: .06em;
  background: #fff; color: var(--brand); border: 2px solid var(--brand);
}
.lang-btn:active { background: #e3edf0; }

/* ---- 英語キーボード（QWERTY） ---- */
.kb-latin { gap: 8px; }
.kb-row { display: flex; justify-content: center; gap: 8px; --u: calc((100% - 72px) / 10); }
.kb-row .key { flex: 0 0 var(--u); }
.kb-row .key-wide2 { flex-basis: calc(var(--u) * 2 + 8px); }
.kb-row .key-wide3 { flex-basis: calc(var(--u) * 3 + 16px); }
.kb-row .key-wide5 { flex-basis: calc(var(--u) * 5 + 32px); }
.key-en { font-size: clamp(24px, 3.8vh, 34px); }

/* ---- 五十音キーボード ---- */
.kb { display: grid; gap: 8px; }
.kb-main {
  display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(5, 1fr);
  grid-auto-flow: column; gap: 8px;
}
.kb-fn { display: grid; grid-template-columns: 1.3fr 1.3fr 1.3fr 0.8fr 2fr 1.6fr 1.6fr; gap: 8px; }
.kb-fn .key { white-space: nowrap; }
.key {
  font: inherit; font-size: clamp(24px, 3.6vh, 32px); font-weight: 600; color: var(--ink);
  min-height: clamp(50px, 7.4vh, 74px); background: #fff; border: 1px solid #d3c9b6;
  border-bottom-width: 3px; border-radius: 12px; cursor: pointer; padding: 0;
}
.key:active { background: #e3edf0; border-color: var(--brand); transform: translateY(1px); }
.key-blank { background: transparent; border: 0; cursor: default; }
.key-fn { background: #f1ece2; font-size: clamp(16px, 2.4vh, 22px); }
.key-del { background: #fbe9e7; color: var(--bad); }
.key-clear { background: #f1ece2; color: var(--muted); }

/* ---- 受付完了 ---- */
.tablet-check {
  width: 120px; height: 120px; margin: 8vh auto 16px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 72px; line-height: 120px;
}
.tablet-done-title { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 48px; margin: 0 0 12px; color: var(--ok); }
.tablet-done-text { font-size: 30px; margin: 0 0 24px; }
.tablet-seq { font-size: 22px; color: var(--muted); margin: 0; }
.tablet-seq strong { font-size: 40px; color: var(--ink); margin-left: 8px; }

/* ---- フロント共通 ---- */
.front-head {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between; padding: 12px 20px; background: var(--brand-dark); color: #fff;
}
.front-head h1 { margin: 0; font-size: 20px; display: inline-block; }
.front-head-left { display: flex; align-items: baseline; gap: 14px; }
.clock { font-size: 22px; font-variant-numeric: tabular-nums; opacity: .9; }
.front-head-right { display: flex; gap: 8px; }
.front-head .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.front-head .btn-ghost:hover { border-color: #fff; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: rgba(255,255,255,.12); padding: 4px 12px; border-radius: 99px; font-size: 14px; }
.chip strong { font-size: 20px; margin: 0 2px; }
.chip-wait { background: var(--gold); color: #1d1a12; }
.chip-call { background: var(--call-bg); color: var(--call); }
.chip-key { background: #fbf5e6; color: #6b4a14; }

.banner { padding: 10px 20px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.banner-err { background: var(--bad-bg); color: var(--bad); }

.front-main { max-width: 1100px; margin: 0 auto; padding: 20px; }
.sec-title { margin: 0 0 12px; font-size: 16px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- 受付カード ---- */
.queue { display: grid; gap: 8px; }
.card {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid #cfc6b4;
  border-radius: 10px; padding: 10px 14px;
}
.card-next { border-left-color: var(--gold); box-shadow: 0 2px 10px rgba(176,141,87,.25); }
.card-called { border-left-color: var(--call); background: #fffaf3; }
.card-seq { text-align: center; }
.seq-num { display: block; font-size: 36px; font-weight: 800; line-height: 1; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.seq-tag { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.seq-tag-next { background: var(--gold); color: #1d1a12; }
.seq-tag-call { background: var(--call); color: #fff; }
.card-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-bottom: 6px; }
.input-name { font-size: 22px; font-weight: 700; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-meta.late { color: var(--bad); font-weight: 700; }
.dev { font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: 99px; white-space: nowrap; }
.dev-a { background: #dcebf1; color: #1b4a5c; }
.pu { font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: 99px; white-space: nowrap; color: #fff; }
.pu-b-checkin { background: var(--brand); }
.pu-b-key { background: #8a6a2f; }
.pu-b-other { background: #5d6b73; }
.grp { font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
.grp-stay { color: #8a6a2f; }
.grp-arrival { color: var(--brand); }
.pax, .nights { font-size: 14px; font-weight: 700; color: var(--ink); background: #eef1ec; border-radius: 4px; padding: 1px 8px; white-space: nowrap; }

/* ご用件ごとの枠の色：カードキーのお受け取りは琥珀色の枠と淡い背景 */
.card-p-key { border: 2px solid #c9a24b; border-left: 8px solid #8a6a2f; background: #fdf6e3; }
.card-p-key .seq-num { color: #6b4a14; }
.card-p-other { border-left-color: #8d99a0; }

.dev-en { background: #1f4e5f; color: #fff; letter-spacing: .05em; }
.dev-b { background: #efe3d0; color: #6b4a14; }
.card-actions { display: grid; gap: 6px; justify-items: stretch; min-width: 170px; }
.btn-main { padding: 11px 14px; font-size: 15px; text-align: center; }
.card-sub { display: flex; gap: 6px; justify-content: flex-end; }

.match { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; border-radius: 8px; padding: 6px 12px; }
.match-exact, .match-manual { background: var(--ok-bg); }
.match-candidate { background: var(--warn-bg); }
.match-none { background: #eef0f1; }
.match-tag { font-size: 12px; font-weight: 700; white-space: nowrap; }
.match-exact .match-tag, .match-manual .match-tag { color: var(--ok); }
.match-candidate .match-tag { color: var(--warn); }
.match-none .match-tag { color: var(--muted); }
.match-note { font-size: 12px; color: var(--muted); }
.match-guests { display: flex; flex-wrap: wrap; gap: 2px 22px; }
.match-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.room { font-size: 30px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.15; }
.gname { font-size: 17px; font-weight: 600; }
.memo { font-size: 13px; color: var(--muted); }

.history { margin-top: 28px; }
.history summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.history-list { margin-top: 10px; display: grid; gap: 6px; }
.hist-row {
  display: grid; grid-template-columns: 48px 1fr 90px 120px auto; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 14px;
}
.hist-cancelled { opacity: .6; }
.hist-seq { font-weight: 800; }
.hist-room { font-weight: 700; }
.hist-state { color: var(--muted); }

/* ---- モーダル ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 14px; width: 100%; max-width: 640px; max-height: 88vh; display: flex; flex-direction: column; padding: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 18px; }
.search-input { font: inherit; font-size: 18px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0 10px; }
.results { overflow-y: auto; display: grid; gap: 6px; }
.result-row {
  display: flex; align-items: center; gap: 14px; text-align: left; font: inherit; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
}
.result-row:hover { border-color: var(--brand); background: #f8fbfc; }
.result-row .room { font-size: 22px; }

/* ---- 名簿取込 ---- */
.import-main { max-width: 900px; display: grid; gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.panel h3 { font-size: 15px; margin: 18px 0 8px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.form-grid select, .form-grid input { font: inherit; font-weight: 400; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: left; white-space: nowrap; }
.tbl th { background: #f1f3f4; position: sticky; top: 0; }
.actions-row { display: flex; gap: 10px; margin-top: 16px; }

@media (max-width: 760px) {
  .card { grid-template-columns: 64px 1fr; }
  .card-actions { grid-column: 1 / -1; }
  .hist-row { grid-template-columns: 36px 1fr auto; }
  .hist-room, .hist-state { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
