/* ส่วนที่ template.css กลางไม่มี — เฉพาะของ redeem
   ยึดตัวแปรสีจาก template.css ทั้งหมด ไม่ตั้งสีเองนอกจากสีของ "ว่าง/ไม่ว่าง" */

:root {
  /* สีสถานะที่นั่ง — ต้องแยกออกจากกันได้แม้ตาบอดสี จึงคู่กับสัญลักษณ์เสมอ ไม่ใช้สีอย่างเดียว */
  --seat-open: #15803d;
  --seat-open-bg: #dcfce7;
  --seat-none: #b91c1c;
  --seat-none-bg: #fee2e2;
  --seat-unknown: #6b7280;
  --seat-unknown-bg: #f3f4f6;
}

/* ---------- แถบบน ---------- */
.app-logo .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--brand); color: #fff; font-size: 14px; margin-inline-end: 6px;
}
.user-chip .avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 600;
}
.user-chip .home-link { font-size: 18px; text-decoration: none; margin-inline-end: 4px; }

/* ---------- ฟอร์มค้น ---------- */
.search-card .form-grid { gap: var(--s3); }
.route-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.route-chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; cursor: pointer;
}
.route-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.route-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button {
  border: 0; background: var(--card); color: var(--ink-soft);
  padding: 8px 16px; font: inherit; font-size: 14px; cursor: pointer;
}
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: #fff; }

/* ---------- ความคืบหน้า ---------- */
.prog { display: flex; flex-direction: column; gap: var(--s2); }
.prog-bar { height: 8px; border-radius: 999px; background: var(--tint); overflow: hidden; }
.prog-bar i { display: block; height: 100%; background: var(--brand); transition: width .4s ease; }
.prog-log {
  max-height: 190px; overflow: auto; font-size: 13px; color: var(--ink-soft);
  background: var(--field); border-radius: var(--r); padding: var(--s2) var(--s3); line-height: 1.9;
}
.prog-log .lv-error { color: var(--danger); }
.prog-log .lv-warn { color: var(--warn); }

/* ---------- ตารางผลรายวัน ---------- */
.day-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--s2);
}
.day {
  border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2) var(--s3);
  background: var(--card); display: flex; flex-direction: column; gap: 2px; min-height: 78px;
}
.day .d { font-weight: 600; font-size: 14px; }
.day .dow { font-size: 11px; color: var(--ink-faint); }
.day .mark { font-size: 13px; font-weight: 600; margin-top: auto; }
.day .sub { font-size: 11px; color: var(--ink-faint); }
.day.open { border-color: var(--seat-open); background: var(--seat-open-bg); }
.day.open .mark { color: var(--seat-open); }
.day.none { background: var(--seat-none-bg); border-color: #fecaca; }
.day.none .mark { color: var(--seat-none); }
.day.unknown { background: var(--seat-unknown-bg); }
.day.unknown .mark { color: var(--seat-unknown); }

/* ---------- ปฏิทินทั้งเดือน ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow-head {
  text-align: center; font-size: 12px; color: var(--ink-faint); padding: 4px 0; font-weight: 600;
}
.cal .cell {
  aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: var(--r);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 13px; background: var(--card);
}
.cal .cell.blank { border: 0; background: transparent; }
.cal .cell .n { font-weight: 600; }
.cal .cell .s { font-size: 11px; }
.cal .cell.open { background: var(--seat-open-bg); border-color: var(--seat-open); color: var(--seat-open); }
.cal .cell.none { background: var(--seat-none-bg); border-color: #fecaca; color: var(--seat-none); }
.cal .cell.unknown { background: var(--seat-unknown-bg); color: var(--seat-unknown); }
.cal .cell.today { outline: 2px solid var(--brand); outline-offset: 1px; }

.cal-legend { display: flex; flex-wrap: wrap; gap: var(--s3); font-size: 13px; color: var(--ink-soft); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--line); }

/* ---------- กล่องขอ OTP ---------- */
.otp-box {
  border: 2px solid var(--warn); background: var(--warn-soft);
  border-radius: var(--r-lg); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3);
}
.otp-box .otp-in { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- สถานะ ---------- */
.state-box { display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: var(--s6) var(--s4); text-align: center; }
.state-box .state-icon { font-size: 30px; }
.state-box .sub { color: var(--ink-faint); font-size: 14px; max-width: 46ch; }
.state-box.err .sub { color: var(--danger); }
.form-err { color: var(--danger); font-size: 14px; }
.btn-block { width: 100%; }

#flash-host { position: fixed; inset-block-end: 18px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; }
#flash-host .flash { transition: opacity .3s; }

/* ---------- มือถือ ---------- */
@media (max-width: 640px) {
  .app-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .day-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .cal .cell { font-size: 12px; }
  .user-chip span:not(.avatar) { display: none; }
}

/* ตารางกว้างต้องเลื่อนในกล่องตัวเอง ห้ามให้ทั้งหน้าเลื่อนแนวนอน */
.table-wrap { overflow-x: auto; }
