.tablet-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}

/* ---- 헤더 ---- */
.tablet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.brand-logo {
  width: 32px;
  height: 32px;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.clock {
  display: flex;
  gap: 10px;
  font-size: 16px;
  color: var(--color-text-sub);
}

.settings-btn {
  font-size: 22px;
  color: var(--color-text-sub);
  padding: 8px;
  border-radius: 50%;
}

/* ---- 공통 화면 레이아웃 ---- */
.tablet-main {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.screen.active {
  display: flex;
}

.screen-title {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--color-text);
}

.screen-title.small {
  font-size: 24px;
  margin-bottom: 24px;
}

.screen-desc {
  font-size: 17px;
  color: var(--color-text-sub);
  margin: 0 0 28px;
}

/* ---- 코드 입력 표시 ---- */
.code-dots {
  display: flex;
  gap: 22px;
  margin-bottom: 36px;
}

.dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-white);
  transition: all 0.15s ease;
}

.dot.filled {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.1);
}

/* ---- 키패드 ---- */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 120px));
  gap: 16px;
}

.key {
  min-width: 90px;
  min-height: 76px;
  font-size: 30px;
  font-weight: 700;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--color-text);
  transition: transform 0.05s ease, background 0.1s ease;
}

.key:active {
  transform: scale(0.95);
  background: var(--color-primary-light);
}

.key-action {
  font-size: 24px;
  color: var(--color-text-sub);
}

.key-confirm {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.key-confirm:active {
  background: var(--color-primary-dark);
}

/* ---- 결과 없음 / 오류 ---- */
.result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.result-icon {
  font-size: 56px;
}

.result-message {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.big-btn {
  min-width: 220px;
  min-height: 70px;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-white);
  background: var(--color-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.big-btn:active {
  background: var(--color-primary-dark);
  transform: scale(0.97);
}

.big-btn:disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* ---- 학생 카드 선택 ---- */
.student-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  max-width: 900px;
  margin-bottom: 24px;
}

.student-card {
  width: 180px;
  padding: 20px 16px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.student-card:active {
  transform: scale(0.97);
  background: var(--color-primary-light);
}

.card-photo,
.profile-photo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  overflow: hidden;
}

.card-photo img,
.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-name {
  font-size: 18px;
  font-weight: 700;
}

.card-sub {
  font-size: 14px;
  color: var(--color-text-sub);
}

/* ---- 학생 확인 / 출결 처리 ---- */
.student-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}

.profile-photo {
  width: 120px;
  height: 120px;
  font-size: 44px;
  margin-bottom: 8px;
}

.profile-name {
  font-size: 28px;
  font-weight: 800;
}

.profile-sub {
  font-size: 17px;
  color: var(--color-text-sub);
}

.action-btn {
  min-width: 260px;
  min-height: 80px;
  font-size: 24px;
}

.notice-box {
  width: 100%;
  max-width: 480px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 24px;
  padding: 16px 20px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fffbeb;
  text-align: left;
}

.notice-item + .notice-item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.notice-item-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}

.notice-item-content {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
}

.notice-item-content img {
  max-width: 100%;
}

.already-out {
  margin-top: 20px;
  font-size: 18px;
  color: var(--color-text-sub);
}

.point-badge {
  margin-top: 6px;
  padding: 6px 18px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 17px;
  font-weight: 800;
}

.point-guide {
  margin: -8px 0 20px;
  font-size: 13px;
  color: var(--color-text-sub);
}

/* ---- 완료 화면 ---- */
.done-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.done-check {
  font-size: 64px;
  color: var(--color-success);
  font-weight: 800;
}

.done-name {
  font-size: 30px;
  font-weight: 800;
}

.done-status {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
}

.done-time {
  font-size: 18px;
  color: var(--color-text-sub);
}

.done-sms {
  margin-top: 14px;
  font-size: 16px;
  color: var(--color-text-sub);
}

.done-points {
  margin-top: 12px;
  padding: 10px 20px;
  border-radius: 12px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 18px;
  font-weight: 800;
}

.done-birthday {
  margin-top: 10px;
  padding: 10px 20px;
  border-radius: 12px;
  background: #fdf2f8;
  color: #be185d;
  font-size: 18px;
  font-weight: 800;
}

/* ---- 학생 확인 화면: 등하원 + 스낵바 버튼 ---- */
.action-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.shop-open-btn {
  min-width: 160px;
  min-height: 80px;
  font-size: 20px;
  background: var(--color-white);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.shop-open-btn:active {
  background: var(--color-primary-light);
  transform: scale(0.97);
}

/* ---- 스낵바 (포인트 상점) ---- */
.shop-screen-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  width: 100%;
  max-width: 900px;
}

.shop-screen-actions {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.point-history-btn,
.voucher-open-btn {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-white);
  border: 1.5px solid var(--color-primary);
  border-radius: 999px;
  padding: 8px 16px;
}

.point-history-btn:active,
.voucher-open-btn:active {
  background: var(--color-primary-light);
}

.voucher-code-dots {
  flex-wrap: wrap;
  justify-content: center;
  max-width: 400px;
  gap: 12px;
}

.voucher-code-dots .dot {
  width: 20px;
  height: 20px;
}

.voucher-code-dots .dot:nth-child(4n):not(:last-child) {
  margin-right: 14px;
}

.shop-screen-points {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.shop-screen-message {
  margin-bottom: 16px;
  padding: 10px 18px;
  border-radius: 10px;
  background: #ecfdf5;
  color: var(--color-success);
  font-size: 15px;
  font-weight: 700;
}

.shop-screen-message-error {
  background: #fef2f2;
  color: var(--color-danger);
}

.shop-items-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  max-width: 900px;
  max-height: 380px;
  overflow-y: auto;
  margin-bottom: 24px;
  padding: 4px;
}

.shop-empty {
  color: var(--color-text-sub);
  font-size: 15px;
}

.shop-item-card {
  width: 170px;
  padding: 16px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.shop-item-card:active {
  transform: scale(0.97);
  background: var(--color-primary-light);
}

.shop-item-card-disabled {
  opacity: 0.45;
}

.shop-item-photo {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  overflow: hidden;
}

.shop-item-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shop-item-name {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.shop-item-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--color-primary);
}

/* ---- 포인트 이력 ---- */
.point-history-list {
  width: 100%;
  max-width: 640px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.point-history-empty {
  color: var(--color-text-sub);
  font-size: 15px;
  text-align: center;
  padding: 40px 0;
}

.point-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.point-history-info {
  flex: 1;
  min-width: 0;
}

.point-history-reason {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.point-history-meta {
  font-size: 13px;
  color: var(--color-text-sub);
  margin-top: 2px;
}

.point-history-amount {
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.point-history-amount-plus {
  color: var(--color-success);
}

.point-history-amount-minus {
  color: var(--color-danger);
}

.point-history-pagination {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.point-history-pagination button {
  min-width: 36px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-white);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 700;
}

.point-history-pagination button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

/* ---- 구매 확인 오버레이 ---- */
.shop-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.shop-confirm-box {
  width: 320px;
  max-width: 90vw;
  padding: 28px 24px;
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.shop-confirm-photo {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  overflow: hidden;
  margin-bottom: 6px;
}

.shop-confirm-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shop-confirm-name {
  font-size: 20px;
  font-weight: 800;
}

.shop-confirm-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-primary);
}

.shop-confirm-desc {
  font-size: 13px;
  color: var(--color-text-sub);
  min-height: 1em;
}

.shop-confirm-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  width: 100%;
}

.shop-confirm-actions .big-btn {
  width: 100%;
  min-width: 0;
}

/* ---- 포스기 모드 (관리자 설정 > 화면설정에서 등록한 해상도와 일치하는 기기) ---- */
.pos-mode .tablet-header {
  padding: 26px 44px;
}

.pos-mode .brand-logo {
  width: 42px;
  height: 42px;
}

.pos-mode .brand-name {
  font-size: 26px;
}

.pos-mode .clock {
  font-size: 20px;
}

.pos-mode .screen-title {
  font-size: 40px;
}

.pos-mode .screen-title.small {
  font-size: 32px;
}

.pos-mode .screen-desc {
  font-size: 21px;
}

.pos-mode .key {
  min-width: 118px;
  min-height: 96px;
  font-size: 38px;
}

.pos-mode .big-btn {
  min-width: 280px;
  min-height: 88px;
  font-size: 25px;
}

.pos-mode .profile-photo {
  width: 150px;
  height: 150px;
  font-size: 54px;
}

.pos-mode .profile-name {
  font-size: 36px;
}

.pos-mode .profile-sub {
  font-size: 21px;
}

/* ---- 포스기 모드: 스낵바(상점) 화면을 더 크게 + 한 번에 더 많이 표시 ---- */
.pos-mode .shop-screen-header,
.pos-mode .shop-items-grid {
  max-width: min(1600px, 94vw);
}

.pos-mode .shop-screen-points {
  font-size: 24px;
}

.pos-mode .shop-items-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-height: 74vh;
  gap: 26px;
}

.pos-mode .shop-item-card {
  width: auto;
  padding: 20px;
}

.pos-mode .shop-item-photo {
  width: 128px;
  height: 128px;
  font-size: 44px;
}

.pos-mode .shop-item-name,
.pos-mode .shop-item-price {
  font-size: 19px;
}

@media (max-width: 600px) {
  #clock-date {
    display: none;
  }
}
