/* ==========================================================================
   SomangPay Zero-Clipping Responsive Design System (v7.0 Final)
   Ensures absolute zero visual clipping or truncation on all device viewports
   ========================================================================== */

/* Pretendard을 로컬에서 서빙(WOFF2, 외부 CDN 의존 제거 - 키오스크 네트워크 불안정/차단
   대비) - 기본 서체를 이걸로 바꾼다. Noto Sans KR은 만약을 위해 폴백으로 남겨둔다. */
@font-face {
  font-family: 'Pretendard';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./fonts/Pretendard-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/Pretendard-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/Pretendard-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./fonts/Pretendard-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('./fonts/Pretendard-Black.woff2') format('woff2');
}

/* Noto Sans KR을 로컬에서 서빙 (외부 CDN 의존 제거 - 키오스크 네트워크 불안정/차단 대비) -
   Pretendard 폴백용으로 유지. */
@font-face {
  font-family: 'Noto Sans KR';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./fonts/NotoSansKR-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Noto Sans KR';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/NotoSansKR-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Noto Sans KR';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./fonts/NotoSansKR-700.ttf') format('truetype');
}
@font-face {
  font-family: 'Noto Sans KR';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('./fonts/NotoSansKR-900.ttf') format('truetype');
}

:root {
  --bg-dark: #070a12;
  --bg-card: rgba(15, 23, 42, 0.88);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --border-glass: rgba(255, 255, 255, 0.14);
  --border-active: #06b6d4;

  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-senior: #f59e0b;
  --accent-amber: #f59e0b; /* --accent-senior의 별칭 - kiosk.js/admin.js가 이 이름으로도 참조함 */
  --accent-emerald: #10b981; /* --accent-success의 별칭 - admin.js/admin.html이 이 이름으로도 참조함 */
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --accent-rose: #f43f5e; /* kiosk.html의 로그 "비우기" 버튼이 참조하는데 정의가 빠져있었음(라이트 테마 작업 중 발견) */

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* 카드 위에 얹는 은은한 패널(설정 하위 섹션, 비활성 탭 배경 등) / 오목하게 들어간 패널
     (입력창·표시창 배경, 표 컨테이너 등) - 지금까지 이 두 가지를 rgba(255,255,255,0.05~0.1)
     / rgba(0,0,0,0.25~0.5)로 화면마다 제각각 하드코딩해왔는데, 라이트 테마에서는 그 값들이
     그대로 못 쓰인다(흰 배경 위에 흰 반투명은 안 보이고, 검은 반투명은 톤이 다르다) - 변수로
     묶어서 테마별로 한 곳에서 바꿀 수 있게 한다. */
  --surface-1: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(0, 0, 0, 0.35);
  --modal-bg: #0f172a;

  --font-family: 'Pretendard', 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-subtle: 0 8px 32px rgba(0, 0, 0, 0.4);
  --backdrop-blur: blur(16px);
}

/* 라이트/다크 테마(시스템/라이트/다크, .kiosk-wrapper[data-theme] 스위칭 - 설정 탭 > 화면
   테마, kiosk.html/kiosk.js 참고)의 실제 색 값은 여기가 아니라 src/instagram-theme.css에
   있다 - 이 사이트의 브랜드 컬러(로고 남색/블루/스카이 톤)와 인스타그램풍 스킨이 전부 그
   파일 하나에 몰려있어서, 라이트 모드도 같은 브랜드 톤으로 맞추려면 색 정의를 한 곳(그
   파일)에만 두는 게 어긋날 일이 없다. 이 파일(style.css)의 :root는 그 파일이 아예 로드
   안 됐을 때를 위한 다크 기본값(순수 청록 계열)만 갖고 있다. */

/* Global Reset & Protection against Overflow */
*, *::before, *::after {
  box-sizing: border-box !important;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  /* 100vh는 모바일 브라우저에서 주소창이 보이는/숨는 상태와 무관하게 "가장 큰" 뷰포트
     기준으로 고정되는 경우가 많아, 실제 보이는 화면보다 커져서 바깥 스크롤이 생기는
     원인이 된다. 100dvh(동적 뷰포트 높이)를 지원하는 브라우저에서는 이 값으로 덮어써서
     실제 보이는 높이에 맞춘다 (미지원 브라우저는 유효하지 않은 값이라 무시되고 위 100vh가 유지됨). */
  min-height: 100dvh;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  /* 본문 기본 굵기는 Medium(500)만 - 제목/섹션타이틀처럼 강조가 필요한 곳은 각 클래스에서
     개별적으로 700~900을 쓴다. 본문까지 전부 Bold면 오히려 제목과 구분이 안 돼 위계가
     무너진다(참고 이미지: 큰 제목은 굵게, 본문 불릿 텍스트는 가볍게). */
  font-weight: 500;
  line-height: 1.4;
  overflow-x: hidden !important; /* Block horizontal scrollbars */
  word-break: keep-all !important; /* Keep Korean words intact */
  word-wrap: break-word !important;
}

/* 위 html,body의 color: var(--text-main)는 body 시점의(=문서 루트, 다크 기본값) --text-main
   으로 한 번 계산돼서 자식 요소에 "이미 계산된 색"으로 상속된다 - 라이트 테마 스코프
   (.kiosk-wrapper[data-theme="light"] 등)가 --text-main을 262626으로 재정의해도, 그 스코프
   안의 개별 요소가 직접 color: var(--text-main)을 쓰지 않는 한(= 그냥 상속만 받는 대부분의
   <div>/<p>) 상속받은 값은 그대로 다크(#fafafa 등)라 라이트 배경 위에서 텍스트가 거의
   안 보이는 버그가 생긴다. 각 페이지의 최상위 래퍼에서 color를 다시 명시적으로 선언해
   그 스코프 안에서 var(--text-main)이 새로 계산되게 한다.
   background도 마찬가지 이유 - body { background: var(--bg-dark) }(instagram-theme.css)도
   body 시점의 값으로 고정돼서, 래퍼가 라이트로 바뀌어도 그 아래(body) 배경은 계속 다크로
   남아 카드 사이 여백/탭바 뒤로 다크가 비친다. .kiosk-wrapper는 원래도 자기 background를
   따로 갖고 있어(아래 .kiosk-wrapper 규칙) 문제 없었지만 admin-shell/mobile-wrapper는
   없었다 - 여기서 공통으로 채워준다. */
.kiosk-wrapper,
.admin-shell,
.mobile-wrapper {
  color: var(--text-main);
  background: var(--bg-dark);
  min-height: 100vh;
  min-height: 100dvh;
}

/* user.html은 kiosk/admin과 달리 상단 타이틀바가 없어(#14) 첫 카드가 화면 맨 위에 바로
   붙는다 - 노치/상태바 아래로 안전하게 내려주는 여백을 래퍼가 직접 갖는다.
   좌우 여백은 admin.html의 .admin-main과 동일하게 카드가 화면 가장자리에 바로 붙지 않도록
   준다(#17 - 이전에는 좌우 패딩이 아예 없어 카드가 화면 끝까지 꽉 찼었다). */
.mobile-wrapper {
  padding: max(1rem, env(safe-area-inset-top)) clamp(0.75rem, 4vw, 1.5rem) 1.5rem;
}

/* 키오스크 화면 잠금 - 길게 눌러 텍스트 선택/컨텍스트 메뉴 호출 차단.
   입력 필드는 정상적인 커서 배치/편집이 필요하므로 예외로 둔다. */
.kiosk-wrapper, .kiosk-wrapper * {
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}
.kiosk-wrapper input,
.kiosk-wrapper textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* Flexible App Header - Wraps gracefully on mobile */
.app-header, .kiosk-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  padding: clamp(0.4rem, 1.2vh, 0.85rem) clamp(0.5rem, 1.5vw, 1.2rem);
  padding-top: max(clamp(0.4rem, 1.2vh, 0.85rem), env(safe-area-inset-top));
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 800;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo .logo-icon {
  font-size: clamp(1.1rem, 2.8vw, 1.5rem);
  background: var(--accent-cyan-glow);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-cyan);
}

.icon-line {
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.brand-logo .logo-icon-img {
  width: clamp(24px, 6vw, 32px);
  height: clamp(24px, 6vw, 32px);
  border-radius: var(--radius-sm, 8px);
  display: block;
  flex-shrink: 0;
}

.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

.nav-item {
  padding: 0.35rem 0.75rem;
  font-size: clamp(0.72rem, 1.2vw, 0.82rem);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.nav-item.active, .nav-item:hover {
  color: #fff;
  background: var(--accent-cyan);
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(0.5rem, 1.5vw, 1.2rem);
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: clamp(0.85rem, 2vw, 1.4rem);
  box-shadow: var(--shadow-subtle);
  max-width: 100%;
  overflow: hidden;
}

/* Global Mobile Touch & Button Protection against Event Blocking */
button, .btn, .btn-action, .btn-primary, .btn-senior, .btn-emerald, select, input, .nav-item {
  touch-action: manipulation !important; /* Eliminate 300ms touch delay */
  -webkit-tap-highlight-color: rgba(6, 182, 212, 0.3) !important;
  pointer-events: auto !important; /* Force click/touchability */
  cursor: pointer !important;
  position: relative;
  z-index: 20 !important;
}

button, .btn, .btn-action, .btn-primary, .btn-senior, .btn-emerald {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: clamp(0.5rem, 1.2vh, 0.75rem) clamp(0.75rem, 1.5vw, 1.1rem);
  font-size: clamp(0.8rem, 1.2vw, 0.92rem);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  border: none;
  border-radius: var(--radius-md);
  white-space: nowrap !important; /* Never break button text into lines */
  word-break: keep-all !important;
  max-width: 100%;
  min-height: 42px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.btn-senior {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn-emerald {
  background: linear-gradient(135deg, #10b981, #059669);
}

.form-control {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: clamp(0.85rem, 1.2vw, 0.92rem);
  color: var(--text-main);
  background: var(--surface-2);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  outline: none;
  min-height: 42px;
}

/* 포커스 표시를 별도로 정의해둔다 - 브라우저 기본 포커스 링(outline)은 요소 바깥으로
   번져 그려지는데, 모달들이 overflow: hidden이라 인풋이 모달 가장자리에 붙어 있으면
   그 바깥으로 번진 부분이 잘려서 테두리 굵기가 고르지 않아 보인다. outline-offset을
   음수로 줘서 링을 박스 안쪽으로 그리면 어떤 조상의 overflow에도 잘리지 않는다. */
.form-control:focus {
  border-color: var(--accent-cyan);
  outline: 2px solid var(--accent-cyan);
  outline-offset: -2px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   Admin Dashboard (admin.html) - glass-container/table-custom/badge-tag/
   form-group/form-label were referenced across admin.html, kiosk.html,
   user.html and index.html with no matching rules anywhere in this file,
   so those pages were rendering as bare unstyled divs/tables. Defining
   .glass-container as an alias of the existing .glass-panel card style
   fixes all of them at once; the rest are admin.html-specific.
   ========================================================================== */
.glass-container {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  max-width: 100%;
  overflow: hidden;
}

/* 설정 > 수신 로그: 항목이 아무리 많이 쌓여도(최대 50건) 패널 높이는 고정되고
   내부에서만 스크롤된다. overscroll-behavior로 끝까지 스크롤했을 때 페이지 전체가
   같이 스크롤되는(scroll chaining) 것도 막는다. */
.sms-log-scroll {
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.3rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-glass) transparent;
}
/* flex 컨테이너에 overflow:auto가 붙으면 자식의 "콘텐츠 크기만큼은 안 줄어드는" 기본 동작이
   사라져서(min-height:auto -> 0), 로그가 많이 쌓였을 때 각 항목이 컨테이너 높이(340px)에
   맞춰 다 같이 짜부라지며 겹쳐 보인다 - 항목마다 자기 콘텐츠 높이를 유지하고 컨테이너가
   스크롤되도록 고정한다. */
.sms-log-scroll > * {
  flex-shrink: 0;
}
.sms-log-scroll::-webkit-scrollbar {
  width: 6px;
}
.sms-log-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sms-log-scroll::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 999px;
}

.admin-wrapper {
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  align-items: flex-end;
}

@media screen and (min-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media screen and (min-width: 640px) {
  .admin-form-grid-3 {
    grid-template-columns: 2fr 1fr 1fr;
  }
  .admin-form-grid-4 {
    grid-template-columns: 2fr 1fr 1fr auto;
  }
}

/* ==========================================================================
   Admin Shell (admin.html v2) - 트위터 스타일 탭 내비게이션.
   모바일: 하단 고정 아이콘 탭바. 데스크톱(>=900px, .admin-grid와 동일 기준):
   왼쪽 sticky 사이드바로 전환. 콘텐츠는 항상 단일 컬럼 피드.
   ========================================================================== */
.admin-shell {
  display: flex;
  flex-direction: column;
  max-width: 1360px;
  margin: 0 auto;
  /* --header-h는 admin.js가 .app-header의 실제 렌더된 높이를 재서 채워준다(고정된 60px
     추정치는 safe-area-inset-top이 있는 기기 등에서 실제 헤더 높이와 어긋나 아래 admin-main이
     (flex:1로) 필요 이상 늘어나 바깥 스크롤이 생기는 원인이었다). 100dvh 우선, 미지원
     브라우저는 100vh로 폴백. */
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - var(--header-h, 60px));
}

.admin-tabbar {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-top: 1px solid var(--border-glass);
  padding: 0.4rem 0.2rem max(0.4rem, env(safe-area-inset-bottom));
}

.admin-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-width: 56px;
}

.admin-tab-btn .tab-icon {
  font-size: 1.3rem;
  line-height: 1;
  position: relative;
}

.admin-tab-btn.active {
  color: var(--accent-cyan);
}

.admin-tab-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--accent-danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.admin-main {
  flex: 1;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  padding-bottom: 5.5rem; /* 하단 탭바에 안 가리게 */
}

.admin-view {
  display: none;
}
.admin-view.active {
  display: block;
}

/* 탭별 본문 제목 - 최상단 타이틀바를 없앤 뒤로 각 탭의 본문(admin-main) 맨 위에 직접 넣는다.
   home/search/inbox는 :not() 셀렉터로 이 요소도 이미 flex-shrink:0 처리되어(위 fixed-height
   뷰 규칙 참고) 스크롤 영역 계산에 자동으로 반영된다 - 별도 대응 불필요. */
.admin-page-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0.1rem 0 1rem;
}

/* 사용자 관리 탭처럼 제목 옆에 글씨만 있는 액션 버튼(+)이 필요한 경우 - 예전 하단 우측
   FAB(＋ 새 회원 등록) 버튼을 대신한다. */
.admin-page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.admin-page-title-row .admin-page-title {
  margin: 0.1rem 0 0;
}
.admin-page-title-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.admin-page-title-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.2rem 0.3rem;
  min-height: auto;
  color: var(--text-main);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.admin-page-title-action:hover {
  opacity: 0.75;
}

/* 사용자 관리 탭 - 돋보기 버튼을 누르면 검색창/스캔 버튼 카드가 제목줄 바로 아래로
   펼쳐지는 드롭다운(키오스크 선택기 .kiosk-selector-list와 같은 위치/느낌). 화면 전체
   폭을 덮으면 뒤 목록이 안 보여 답답하므로 절반 정도만 차지하고 돋보기 버튼 아래
   우측에 붙인다(#26) - min-width는 "NFC/QR 검색" 버튼이 한 줄로 나올 최소 폭. 부모
   .kiosk-title-row가 이미 position:relative를 준다. */
.member-search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 50%;
  min-width: 220px;
  margin-top: 0.4rem;
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-subtle);
  z-index: 95;
}
.member-search-dropdown.open {
  display: block;
}

/* 검색어가 입력된 상태에서는 돋보기 아이콘 버튼 아래에 작은 점을 찍어 필터가 걸려있음을
   표시한다(#26) - 하단 탭바 활성 표시(.admin-tab-btn.active::after, instagram-theme.css)와
   같은 패턴. */
#member-search-toggle {
  position: relative;
}
#member-search-toggle.filter-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

/* 검색어 입력칸 - 입력값이 있을 때만 오른쪽 끝에 X(지우기) 버튼을 겹쳐 보여준다(#26) */
.member-search-input-wrap {
  position: relative;
  margin-bottom: 0.8rem;
}
.member-search-input-wrap .form-control {
  margin-bottom: 0;
  padding-right: 2.2rem;
}
.member-search-clear-btn {
  display: none;
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.member-search-input-wrap.has-value .member-search-clear-btn {
  display: flex;
}

/* 필터가 걸린 상태에서 목록 맨 위에 뜨는 "필터 해제" 버튼(#26) */
.member-search-clear-filter {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
  background: rgba(103,129,192,0.1);
  border: 1px dashed var(--accent-cyan);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* admin.js의 showToast()가 #admin-toast를 만들어 .show 클래스로 토글하는데, 지금까지 이
   id에 대한 스타일이 전혀 없어서 그냥 body 맨 끝에 평범한 문서 흐름 콘텐츠로 붙어 하단
   고정 탭바와 겹쳐 보이고, 그 실제 텍스트 높이만큼 body가 늘어나 바깥(페이지) 스크롤이
   생기는 원인이 되고 있었다. position:fixed로 흐름에서 완전히 빼서 그 문제를 없앤다. */
#admin-toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.2rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  max-width: min(92vw, 420px);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#admin-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media screen and (min-width: 900px) {
  .admin-shell {
    flex-direction: row;
    gap: 1.5rem;
  }
  .admin-tabbar {
    position: sticky;
    top: 60px;
    bottom: auto;
    left: auto;
    right: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    width: 200px;
    flex-shrink: 0;
    height: fit-content;
    border-top: none;
    border-right: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 0.8rem;
    gap: 0.3rem;
  }
  .admin-tab-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.7rem;
    font-size: 0.92rem;
    padding: 0.65rem 0.9rem;
    min-width: 0;
  }
  .admin-tab-btn .tab-icon {
    font-size: 1.15rem;
  }
  .admin-tab-btn.active {
    background: var(--accent-cyan-glow);
  }
  .admin-main {
    padding: 1.5rem 1.5rem 1.5rem 0;
  }
  #admin-toast {
    bottom: 1.5rem; /* 데스크톱은 하단 탭바가 왼쪽 사이드바로 바뀌므로 여유를 둘 필요 없음 */
  }
}

/* Dashboard stat tiles */
/* 홈 최상단 카드 - 잔액 보유 회원수(작게, 좌측 상단)와 총 보유 잔액 합계(크게, 우측)를
   한 카드 안에 위아래로 나눠 담는다. min-height로 카드를 세로로 넉넉하게 늘린다. */
.hero-stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1rem;
}
.hero-stat-bottom {
  text-align: right;
}
.hero-stat .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.hero-stat .stat-value {
  font-size: clamp(2.2rem, 6vw, 3rem);
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.2rem;
}
.hero-stat .stat-value-sm {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.2rem;
}

@media screen and (max-width: 480px) {
  .hero-stat {
    padding: 1rem 1rem;
    min-height: 150px;
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.stat-tile {
  padding: 1rem 1.1rem;
}
.stat-tile .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-tile .stat-value {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.2rem;
}

/* 통계 그리드 셀은 라벨/값 모두 우측 정렬. */
.stat-grid .stat-tile {
  text-align: right;
}

.attention-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.attention-tile {
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
}
.attention-tile .attention-icon {
  font-size: 1.5rem;
}
.attention-tile > div {
  flex: 1 1 auto;
  text-align: right;
}
.attention-tile .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.attention-tile .stat-value {
  font-size: 1.4rem;
  font-weight: 800;
}
.attention-tile.has-items {
  border-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
}
.attention-tile.has-items .stat-value {
  color: var(--accent-amber);
}
.attention-tile:not(.has-items) .stat-value {
  color: var(--text-muted);
}

/* 회원 관리 탭 - 검색창/스캔 버튼은 고정, 목록만 남은 공간을 차지하며 그 안에서
   스크롤된다 (홈 탭과 동일한 패턴). --search-view-h는 admin.js의
   updateFixedViewLayoutMetrics()가 채워준다. */
#admin-view-search.active {
  display: flex;
  flex-direction: column;
  height: var(--search-view-h, 70vh);
  overflow: hidden;
}
#admin-view-search.active > *:not(.member-feed) {
  flex-shrink: 0;
}

/* Member search feed (회원 관리 탭) */
.member-feed {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* flex 컨테이너 자신에 overflow:auto가 붙으면 자식의 "콘텐츠 크기 밑으로는 안 줄어드는"
   기본 동작이 사라져서(min-height:auto -> 0), 회원이 많아지면 카드가 컨테이너 높이에 맞춰
   다 같이 짜부라질 수 있다 - 카드마다 자기 콘텐츠 높이를 유지하도록 고정한다
   (설정 > 수신 로그의 .sms-log-scroll과 동일한 이슈/수정). */
.member-feed > * {
  flex-shrink: 0;
}

.member-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1.3rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.member-card:hover {
  background: var(--bg-card-hover);
}
.member-card .member-card-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.02rem;
}
.member-card .member-card-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.member-card .member-card-balance {
  font-weight: 800;
  color: var(--accent-emerald);
  font-size: 1.05rem;
  white-space: nowrap;
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  margin-right: 0.35rem;
}
.status-dot.suspended {
  background: var(--accent-danger);
}

/* 충전함(Inbox) - 본문 제목 아래로 "최근 처리 내역" 피드(구 홈 탭 피드, 계좌 입금/충전
   신청을 시간순으로 합친 목록)만 남은 공간을 차지하며 그 안에서 스크롤된다.
   --inbox-view-h는 admin.js의 updateFixedViewLayoutMetrics()가 실제 렌더된 헤더/탭바
   높이를 재서 채워준다(모바일 하단 고정 탭바 vs 데스크톱 사이드바 전환 때문에 고정 px로는
   정확히 계산할 수 없어 런타임에 측정). 기존 계좌 입금/충전 신청 표(.inbox-half)는 지금
   admin.html에서 주석 처리되어 있어 실제로는 렌더되지 않지만, 나중에 되살릴 수 있게
   아래 스타일은 그대로 남겨둔다. */
#admin-view-inbox.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: var(--inbox-view-h, 70vh);
  overflow: hidden;
}
#admin-view-inbox.active > *:not(.activity-feed-scroll) {
  flex-shrink: 0;
}
/* 제목 줄(.admin-page-title-row) 자체의 margin-bottom과 위 flex의 gap이 겹쳐 카드 시작
   위치가 다른 탭보다 한 칸 더 내려가 있었다 - flex gap이 이미 간격을 주므로 여기서는 0으로. */
#admin-view-inbox.active > .admin-page-title-row {
  margin-bottom: 0;
}

/* "최근 처리 내역" 실시간 피드 - 남은 공간 안에서만 스크롤되고, 스크롤이
   하단에 가까워지면 admin.js가 다음 페이지를 이어붙인다(무한 스크롤). */
.activity-feed-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.1rem;
}
.activity-row .activity-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}
.activity-row .activity-info {
  flex: 1;
  min-width: 0;
}
.activity-row .activity-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
}
.activity-row .activity-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.activity-row .activity-amount {
  font-weight: 800;
  color: var(--accent-emerald);
  font-size: 1rem;
  white-space: nowrap;
  text-align: right;
}
.activity-row .activity-amount-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}
.activity-status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.25rem;
  white-space: nowrap;
}
.activity-status.status-done {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}
.activity-status.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}
.activity-status.status-rejected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
}
.activity-status.status-other {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}
/* 회원 앱 지난 내역에서 "결제 완료"(잔액 차감)를 "충전 완료"(status-done, 초록)와
   구분되게 표시한다(#17) - 둘 다 초록이면 금액 부호(+/-)를 안 보고는 구분이 안 된다. */
.activity-status.status-payment {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

/* user.html은 40~50대 이용자가 많아 다른 페이지보다 글자를 더 키운다(위 html 루트
   font-size 참고) - 이 목록의 상태 배지는 예외적으로 고정 rem이라 그 스케일을 못 받아서
   여전히 작다는 피드백(#17)이 있었다. .mobile-wrapper로 스코프를 걸어 admin.html 등
   다른 페이지의 동일 클래스에는 영향이 없게 한다. */
.mobile-wrapper .activity-status {
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
}

/* 충전/결제 통합 이력 카드 - 어드민 회원상세와 유저 앱 이용내역이 동일한 레이아웃을
   쓴다(#19): 좌상단 종류 배지, 좌하단 사유(충전 메모/실패 사유/결제 목록), 우상단
   금액(+/-), 우하단 잔액. */
.history-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
}
.history-item:last-child {
  margin-bottom: 0;
}
.history-item-left {
  min-width: 0;
}
.history-item-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.history-item-top .activity-status {
  margin-top: 0;
}
.history-item-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.history-item-reason {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item-right {
  text-align: right;
  flex-shrink: 0;
}
.history-item-amount {
  font-weight: 800;
  font-size: 1.05rem;
  white-space: nowrap;
}
.history-item-amount.amount-positive {
  color: var(--accent-emerald);
}
.history-item-amount.amount-negative {
  color: var(--accent-danger);
}
.history-item-amount.amount-neutral {
  color: var(--text-muted);
}
/* 이용내역 날짜 구분선(#33) - 카드를 날짜별로 묶어 이 줄로 나누고, 카드 자체에는
   시간만 남긴다(historyItemHtml 참고). */
.history-date-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1rem 0 0.6rem;
}
.history-date-divider:first-child {
  margin-top: 0;
}
.history-date-divider::before,
.history-date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-glass);
}

.history-item-balance {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Member detail view (회원 상세 - 트위터 프로필 페이지 격) */
.detail-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  /* #27: 하드코딩 흰색이라 라이트 테마(옅은 배경 위 흰 화살표)에서 거의 안 보였다 -
     테마별로 이미 재정의되는 --text-main을 따라가게 해 라이트/다크 모두에서 보이게 함. */
  color: var(--text-main);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* #27: 회원 상세 카드 우측 상단의 정보수정 버튼 - 테두리/음영 없이 이름과 같은 글자색만
   써서 카드 위에 얹힌 듯 가볍게 보이도록 한다 (정지/삭제는 정보수정 모달 안으로 이동). */
.icon-plain-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
}

/* #27: 라이트 테마에서 rgba(0,0,0,0.25) 고정값이 흰 카드 위에 너무 짙게 떠 보였다 -
   이용 내역 아이템(.history-item)과 같은 톤(var(--surface-2))으로 맞춘다. */
.card-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  margin-bottom: 0.6rem;
}
.card-slot .card-slot-type {
  font-weight: 700;
  color: var(--text-main);
}
.card-slot .card-slot-uid {
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-senior {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-senior);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-general {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

/* user.html 로그인 후 잔액 표시 카드 (회원 PWA 메인 화면) */
.user-card-widget {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-subtle);
  color: #fff;
}

/* badge-general/badge-senior의 기본 색(파랑/앰버 계열 텍스트)은 이 카드의 남색~블루
   그라디언트 배경 위에서는 거의 안 보인다(#14) - 이 카드 위에서만 흰 반투명 필로 덮어써
   항상 대비를 확보한다. */
.user-card-widget .badge-tag {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.user-balance-big {
  font-size: 2.4rem;
  font-weight: 900;
  margin-top: 0.2rem;
}

/* 충전 대기 카드(#18) - 메인 잔액 카드 바로 아래, 비슷한 크기로 강조 표시해 눈에 띄게 한다.
   확정은 별도 모달 대신 행 안에 버튼을 오버레이해서 처리(모달 사용성이 안 좋다는 요청). */
.pending-deposit-card {
  background: var(--surface-1);
  border: 1.5px solid rgba(245, 158, 11, 0.55);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-subtle);
  animation: pendingDepositGlow 2.6s ease-in-out infinite;
}

@keyframes pendingDepositGlow {
  0%, 100% { box-shadow: var(--shadow-subtle), 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: var(--shadow-subtle), 0 0 22px rgba(245, 158, 11, 0.45); }
}

.pending-deposit-header {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.pending-deposit-header svg {
  flex-shrink: 0;
  color: var(--accent-amber);
  margin-top: 0.15rem;
}

.pending-deposit-title {
  font-weight: 800;
  font-size: 1.02rem;
  color: var(--accent-amber);
}

.pending-deposit-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.pending-deposit-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pending-deposit-row {
  position: relative;
  background: var(--surface-2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
}

.pending-deposit-row-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  transition: opacity 0.15s ease;
}

.pending-deposit-row.armed .pending-deposit-row-info {
  opacity: 0;
}

.pending-deposit-row-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pending-deposit-row-amount {
  font-weight: 800;
  color: var(--accent-emerald);
  font-size: 1.1rem;
}

/* 확정 오버레이 - 카드(행) 밖으로 나가는 별도 모달 대신 같은 행 위에 겹쳐서 보여준다 */
.pending-deposit-confirm-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0 0.7rem 0 1rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.pending-deposit-row.armed .pending-deposit-confirm-overlay {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.pending-deposit-confirm-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-deposit-confirm-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.pending-deposit-confirm-actions .btn-action {
  width: auto;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.table-custom th,
.table-custom td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  white-space: nowrap;
}

.table-custom th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-glass);
}

.table-custom tbody tr {
  border-bottom: 1px solid var(--border-glass);
}

.table-custom tbody tr:hover {
  background: var(--surface-1);
}

/* Zero-Clipping Modal Dialog System */
.modal-overlay, [role="dialog"] {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: clamp(0.5rem, 2vw, 1rem);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-content, .modal-box-large {
  background: var(--modal-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  width: min(94vw, 480px) !important;
  max-width: 100% !important;
  max-height: 86vh !important;
  max-height: 86dvh !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

/* 관리자 설정 모달은 기기 설정 그리드/메뉴 목록 표를 담기엔 기본 480px이 너무 좁아
   라벨이 줄바꿈되고 불필요한 스크롤이 생김 - 더 넓게 확보 (ID 특이도로 위 규칙을 이김) */
#kiosk-admin-modal.modal-overlay .modal-box-large {
  width: min(94vw, 900px) !important;
  /* 탭(메뉴 설정/로그 확인) 콘텐츠 높이가 서로 달라도 모달 크기가 탭 전환마다
     바뀌지 않도록 max-height뿐 아니라 height 자체를 고정한다. */
  height: 86vh !important;
  height: 86dvh !important;
}

/* 관리자 설정 모달의 메뉴 설정/로그 확인 탭 버튼 - 선택 여부는 JS가 .btn-primary
   클래스만 토글해서 표시하고(인라인 style은 건드리지 않는다), 비선택 상태의 배경/글자색은
   여기서 고정해둔다. 예전엔 JS가 비활성 탭에 style.background를 직접 덮어썼는데, 탭을
   다시 활성화할 때 그 인라인 값을 지우지 않아 .btn-primary보다 우선 적용되면서 흰 글자가
   거의 흰 배경 위에 남아 안 보이는 버그가 있었다. */
.kiosk-settings-tab-btn {
  background: var(--surface-1);
  color: var(--text-main);
}
.kiosk-settings-tab-btn.btn-primary {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #fff;
}

.modal-body {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  padding-right: 0.25rem;
}

.modal-footer {
  flex-shrink: 0;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-glass);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Responsive Grid Layouts */
.grid-menu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
}

/* Screen Size Media Queries */
@media screen and (max-width: 480px) {
  .grid-menu {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .nav-pills {
    display: none; /* Hide top pills on tiny portrait screens to save header space */
  }
  .btn-action {
    width: 100%;
  }
}

@media screen and (min-width: 768px) {
  .kiosk-body {
    display: grid !important;
    grid-template-columns: 1.6fr 1fr !important;
    height: calc(100vh - 56px) !important;
    overflow: hidden !important;
    gap: 0.85rem !important;
    padding: 0.85rem !important;
  }
  .kiosk-menu-section, .kiosk-checkout-section {
    height: 100% !important;
    overflow-y: auto !important;
    margin-bottom: 0 !important;
  }
}

/* Galaxy S25 Ultra Landscape Mode (Low Height) Optimization */
@media screen and (min-width: 768px) and (max-height: 500px) {
  .kiosk-body {
    height: calc(100vh - 46px) !important;
    padding: 0.5rem !important;
    gap: 0.6rem !important;
  }
  .kiosk-checkout-section {
    padding: 0.75rem !important;
    overflow-y: hidden !important;
  }
  .section-title {
    font-size: 0.95rem !important;
    margin-bottom: 0.4rem !important;
  }
  /* 결제 금액 타이틀은 초기화 버튼과 한 줄 정렬돼야 하므로 예외적으로 margin-bottom 0 유지 */
  .kiosk-checkout-section .section-title {
    margin-bottom: 0 !important;
  }

  /* 결제 금액 / 최근 결제 내역 블록이 각자 콘텐츠 높이만큼만 차지하고 남는 공간을 그냥
     비워두던 것을, 아래 min-height:700px 블록과 동일한 방식(2분할 flex)으로 바꾼다 -
     이 저해상도 가로 모드는 세로 공간이 워낙 빠듯해서(#35) 콘텐츠 실높이 합이 섹션 높이에
     거의 딱 맞아떨어져 "최근 결제 내역" 카드 아래 여백이 사실상 0으로 보였다. flex로
     남는 공간을 나눠주고 내부 리스트가 스크롤되게 하면 카드 자체는 항상 여유 있는 높이를
     유지한다. 1:1로 반씩 나눴더니 최근 결제 내역은 항목이 몇 줄 없어도 늘 크게 비어 보이고
     정작 "선택된 메뉴" 목록은 좁아 보인다는 피드백이 있어, 결제 금액 쪽에 더 많은 비중을 줌. */
  .kiosk-checkout-section > #kiosk-checkout-amount-block {
    flex: 2 1 0 !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .kiosk-checkout-section > #kiosk-checkout-recent-block {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #kiosk-checkout-amount-grid {
    flex: 1;
    min-height: 0;
    padding: 0.5rem !important;
    gap: 0.4rem !important;
  }
  /* "선택된 메뉴" 라벨 + 카트 목록을 담은 위쪽 서브패널 - 예전 HTML의 justify-content:center는
     카트가 비었을 때 안내 문구를 세로 중앙에 두려던 의도인데, flex:1 min-height:0인 이
     서브패널 자체가 grid 안에서 남는 공간을 받아도 justify-content:center 때문에 카트 목록이
     그 공간을 채우지 못하고 라벨 바로 아래 붙어버린다. flex-start로 바꿔 카트 목록이 남는
     세로 공간을 실제로 차지하게 한다. */
  #kiosk-checkout-amount-grid > div:first-child {
    justify-content: flex-start !important;
  }
  #cart-items-container {
    max-height: none !important;
    flex: 1;
    min-height: 2.4rem;
  }
  #kiosk-checkout-recent-block {
    display: flex !important;
  }
  #recent-payments-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  #recent-payments-list {
    max-height: none !important;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* Payment Success Screen Edge Green Glow Animation */
@keyframes greenEdgePulse {
  0% { box-shadow: inset 0 0 0px rgba(16, 185, 129, 0); }
  35% { box-shadow: inset 0 0 80px rgba(16, 185, 129, 0.95), 0 0 40px rgba(16, 185, 129, 0.8); }
  100% { box-shadow: inset 0 0 0px rgba(16, 185, 129, 0); }
}
.success-glow-active {
  animation: greenEdgePulse 1.4s ease-out forwards;
}

/* Unregistered Card / Error Edge Red Glow Animation */
@keyframes redEdgePulse {
  0% { box-shadow: inset 0 0 0px rgba(239, 68, 68, 0); }
  35% { box-shadow: inset 0 0 80px rgba(239, 68, 68, 0.95), 0 0 40px rgba(239, 68, 68, 0.8); }
  100% { box-shadow: inset 0 0 0px rgba(239, 68, 68, 0); }
}
.error-glow-active {
  animation: redEdgePulse 1.4s ease-out forwards;
}

/* Insufficient Balance Edge Yellow Glow Animation */
@keyframes yellowEdgePulse {
  0% { box-shadow: inset 0 0 0px rgba(245, 158, 11, 0); }
  35% { box-shadow: inset 0 0 80px rgba(245, 158, 11, 0.95), 0 0 40px rgba(245, 158, 11, 0.8); }
  100% { box-shadow: inset 0 0 0px rgba(245, 158, 11, 0); }
}
.warning-glow-active {
  animation: yellowEdgePulse 1.4s ease-out forwards;
}

.kiosk-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
}

.kiosk-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  overflow-y: auto;
}

/* Redesigned Section Title Wording Style */
.section-title {
  font-size: 1.15rem !important;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--accent-cyan);
  padding-left: 0.5rem;
  line-height: 1.2;
}

/* Checkout cart and scanning boxes layout styling */
.kiosk-checkout-section {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.85rem !important;
  padding: 1rem !important;
  justify-content: flex-start !important;
}

.checkout-cart-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  border: 1px solid var(--border-glass);
}

/* "선택된 메뉴" 아래 담긴 항목 목록(kiosk.js updateCheckoutSummary가 .cart-item으로 생성) -
   색 지정이 없어 상속에 맡겨져 있었는데 실제로는 잘 안 보인다는 피드백이 있어 위 "선택된
   메뉴" 레이블과 동일한 색으로 명시. */
.cart-item {
  color: var(--text-muted);
  padding: 0.2rem 0;
}

.checkout-scan-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.desc-text-senior {
  font-size: 0.82rem !important;
  color: var(--accent-senior) !important;
  margin-top: 0.35rem;
  text-align: right;
  font-weight: 500;
}

.scanner-title {
  font-size: 1.18rem !important;
  color: #fff !important;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.desc-text {
  color: var(--text-muted) !important;
  font-size: 0.85rem !important;
  margin-bottom: 0.75rem;
}

.camera-scanner-panel {
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(6, 182, 212, 0.25) !important;
  border-radius: var(--radius-md) !important;
  padding: 0.65rem !important;
  text-align: center;
}

.scanner-live-badge {
  font-size: 0.78rem;
  color: #67e8f9;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.12);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.status-msg-text {
  font-size: 0.78rem !important;
  color: var(--text-dim) !important;
  margin-top: 0.35rem;
}

/* Admin Scan Grid - Vertical stack on mobile to prevent touch element overlap */
.admin-scan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media screen and (min-width: 768px) {
  .admin-scan-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
  }
}

/* 전면 카메라 미러 모드 - .mirror-mode 클래스가 붙은 video 요소만 좌우반전 */
.mirror-mode {
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

/* 관리자 "키오스크 관리" 탭 - 제목/카드 헤더 옆 선택기(누르면 바로 아래로 목록이 펼쳐지는
   드롭다운 트리거). 키오스크 선택기와 메뉴별 매출 기간 선택기가 같은 패턴을 공유한다 -
   트리거를 담은 행에 position: relative를 주고, 목록을 그 아래에 절대배치한다. */
.kiosk-title-row {
  position: relative;
}
.kiosk-selector-btn {
  display: flex !important;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.2rem 0.3rem;
  min-height: auto;
  text-align: right;
}
.kiosk-selector-arrow-icon {
  display: inline-flex;
  font-size: 0.85em;
  transition: transform 0.2s ease;
  color: var(--text-muted);
  flex-shrink: 0;
}
.kiosk-selector-list, .kiosk-sales-period-list {
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.4rem;
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  box-shadow: var(--shadow-subtle);
  /* 하단 고정 탭바(.admin-tabbar, z-index:90)보다 위에 오도록 - 화면 아래쪽에서 열려
     JS로 미처 위쪽으로 뒤집기 전 한 프레임 동안 가려지는 것까지 막는 안전장치. */
  z-index: 95;
}
.kiosk-selector-list {
  min-width: 12rem;
  max-width: min(22rem, 90vw);
  max-height: 60vh;
  overflow-y: auto;
}
.kiosk-sales-period-list {
  min-width: 7rem;
}
/* 트리거 아래쪽에 펼칠 공간이 부족하면(fitDropdownVertically) 위로 뒤집어 연다. */
.kiosk-selector-list.drop-up, .kiosk-sales-period-list.drop-up {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 0.4rem;
}
.kiosk-selector-empty {
  padding: 0.6rem 0.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.kiosk-selector-item-main {
  display: flex !important;
  align-items: center;
  width: 100%;
  min-height: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  text-align: left;
}
.kiosk-selector-item-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}
.kiosk-selector-item-main.active {
  border-color: var(--accent-cyan);
  background: rgba(103, 129, 192, 0.1);
}

/* 키오스크 상세 정보 - 이름 아래 읽기 전용으로 보여주는 UUID(키오스크 ID) */
.kiosk-detail-uuid {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: monospace;
  overflow-wrap: anywhere;
  background: var(--surface-2);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.8rem;
}

/* 키오스크에 배정할 메뉴 그리드 - 실제 키오스크 화면(.menu-card)과 같은 모양으로 2열,
   카드를 누르면 배정 활성/비활성이 토글된다(체크박스 대신 버튼 느낌). */
.kiosk-menu-assign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.kiosk-menu-assign-grid .menu-card {
  cursor: pointer;
  min-height: auto !important;
  opacity: 0.5;
  filter: grayscale(0.4);
  position: relative;
  transition: opacity 0.15s ease, filter 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.kiosk-menu-assign-grid .menu-card.assigned {
  opacity: 1;
  filter: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1.5px var(--accent-cyan);
}
.kiosk-menu-assign-grid .menu-card .menu-toggle-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-cyan);
  color: #fff;
  font-size: 0.65rem;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.kiosk-menu-assign-grid .menu-card.assigned .menu-toggle-badge {
  opacity: 1;
  transform: scale(1);
}

/* 어드민 "메뉴 관리" 모달 - 각 카드 우측 상단에 삭제 버튼, 마지막 칸은 "+" 추가 카드
   (.kiosk-menu-assign-grid와 같은 2열 카드 그리드를 재사용하되 배정 토글이 아니라
   삭제/추가 액션이라 별도 클래스로 분리). */
.menu-manage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.menu-manage-grid .menu-card {
  min-height: auto !important;
  position: relative;
}
.menu-manage-grid .menu-card .menu-delete-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  min-height: auto !important;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  color: var(--icon-danger, #fca5a5);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
}
.menu-manage-grid .menu-card-add {
  cursor: pointer;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1.5px dashed var(--border-glass);
  box-shadow: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.menu-manage-grid .menu-card-add:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

/* Kiosk Menu Card Aspect Ratio & Compact Button Fix */
.menu-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
  gap: 0.75rem !important;
}

.menu-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  height: auto !important;
  min-height: 145px !important;
  max-height: 200px !important;
  box-shadow: var(--shadow-subtle);
}

.menu-card .menu-name {
  font-size: 0.95rem !important;
  font-weight: 800;
  margin-bottom: 0.3rem;
  color: var(--text-menu-name, var(--text-main));
}

.menu-card .menu-price {
  font-size: 0.82rem !important;
  color: var(--text-muted);
}

.menu-card .menu-price-senior {
  font-size: 0.82rem !important;
  color: var(--accent-senior);
  font-weight: 500;
}

/* 실제 키오스크 고객 화면(#kiosk-menu-grid)만 - 2열 카드 그리드 대신 메뉴 하나가 가로
   한 줄을 통째로 차지하도록 바꾸고(단일 열), "메뉴 이름 - 금액 - 개수" 3단 가로 배치로
   바꾼다(이름 아래에 가격을 붙이지 않고 가격을 별도 칸으로 오른쪽 정렬). 글씨도 전체적으로
   키운다. admin.js의 단말기별 메뉴 배정 화면(.kiosk-menu-assign-grid)은 여전히 2열 카드
   그리드+세로 스택을 그대로 쓰므로, 그쪽 .menu-card까지 같이 바뀌지 않도록 .menu-grid로
   범위를 좁혀 덮어쓴다.
   (Kiosk Menu Card Aspect Ratio & Compact Button Fix 블록의 기본값을 그대로 상속받고
   여기서 필요한 것만 다시 덮어쓴다.) */
.menu-grid {
  grid-template-columns: 1fr !important;
  /* CSS 그리드는 기본값(align-content: normal, 실질적으로 stretch)이 행 높이를 컨테이너의
     남는 세로 공간에 맞춰 늘린다 - 메뉴가 몇 개 없을 때 카드가 쓸데없이 커 보이는 원인이라,
     항목 수와 무관하게 카드 높이가 항상 고정값(아래 .menu-card height)을 유지하도록 위쪽부터
     제 크기로 쌓고 나머지는 그냥 빈 공간으로 남긴다. */
  align-content: start !important;
}
.menu-grid .menu-card {
  flex-direction: row !important;
  align-items: center !important;
  gap: 1.2rem;
  /* min/max가 아니라 고정 height - 메뉴 개수가 적어서 그리드에 남는 공간이 있어도(위
     align-content: start와 함께) 카드가 늘어나지 않고, 많아서 스크롤이 생겨도 줄어들지
     않는다. 위쪽 bare .menu-card 규칙(admin의 2열 카드 그리드용)이 min-height: 145px
     !important / max-height: 200px !important를 걸어두는데, height만 덮어쓰고 이 둘을
     그대로 두면 min-height가 height보다 커서 실제로는 145px로 렌더링된다(#35) - 여기서도
     같이 초기화해야 의도한 88px 고정 높이가 실제로 적용된다. */
  height: 88px !important;
  min-height: 88px !important;
  max-height: none !important;
}
.menu-grid .menu-card .menu-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.4rem !important;
  margin-bottom: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-grid .menu-card .menu-price-block {
  flex-shrink: 0;
  text-align: right;
}
.menu-grid .menu-card .menu-price,
.menu-grid .menu-card .menu-price-senior {
  font-size: 0.95rem !important;
}
.menu-grid .menu-card .touch-qty-box {
  margin-top: 0 !important;
  flex-shrink: 0;
}
.menu-grid .touch-qty-btn {
  width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  font-size: 1.3rem !important;
}
.menu-grid .touch-qty-val {
  font-size: 1.15rem !important;
  font-weight: 800;
  padding: 0 0.6rem;
  color: var(--text-muted);
  /* 최대 99(updateQty의 상한)까지는 자릿수가 늘어나도(1자리→2자리) 폭이 안 바뀌도록
     "99" 기준으로 고정 - ch 단위는 폰트별 "0" 글리프 폭 기준이라 Pretendard Black(800)
     굵기의 실제 두 자리 숫자 폭보다 작게 잡혀서(2ch, 2.6ch 둘 다 부족했음, 실측 결과
     2자리일 때 41px 필요) 폰트에 안 흔들리는 rem 고정값으로 교체. */
  min-width: 2.8rem;
  text-align: center;
}

.touch-qty-box {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: var(--surface-2) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.2rem !important;
  margin-top: 0.6rem !important;
}

.touch-qty-btn {
  width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  font-size: 1.1rem !important;
  font-weight: bold !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Large Kiosk Tablet Landscape Optimization (e.g. Galaxy Tab A11+ SM-X236, 1920x1200)
   Mobile/short-landscape layouts above are untouched by this block (min-height gate excludes them).
   Placed at end of file so it wins cascade ties (same specificity + !important) against the
   unconditional base rules defined earlier (e.g. .kiosk-checkout-section's justify-content).
   Spreads checkout content top-to-bottom and enlarges touch targets/typography instead of
   leaving large stretches of empty space below the compact mobile-sized layout. */
@media screen and (min-width: 768px) and (min-height: 700px) {
  /* 스타일시트 전반이 rem/clamp(rem,vw,rem) 단위를 쓰고 있어서, 루트 폰트 크기를 키우면
     개별 요소를 일일이 손보지 않아도 전체 글씨가 비례적으로 커진다.
     22px 고정값은 1920px 폭 태블릿 기준으로 잡은 값이라 1280px처럼 더 좁은 가로 태블릿에서는
     글자가 상대적으로 너무 커서 잘리거나 줄바꿈이 생긴다 - 폭에 비례해 17~22px 사이로 스케일. */
  html {
    font-size: clamp(17px, 1.15vw, 22px);
  }

  .kiosk-body {
    grid-template-columns: 1.5fr 1fr !important;
    gap: 1.5rem !important;
    padding: 1.75rem !important;
  }

  .kiosk-menu-section .section-title,
  .kiosk-checkout-section .section-title {
    font-size: 1.75rem !important;
    margin-bottom: 1.25rem !important;
  }

  /* 결제 금액 타이틀만 예외 - 옆에 초기화 버튼과 한 줄로 정렬돼야 해서(kiosk.html의
     inline margin:0 + align-items:center) 위 공통 규칙의 margin-bottom을 다시 0으로
     되돌린다. 안 그러면 !important끼리 부딪혀 이 규칙(더 뒤에 선언됨)이 이기면서
     inline margin:0가 무력화되고 타이틀만 아래로 처져 보인다. */
  .kiosk-checkout-section .section-title {
    margin-bottom: 0 !important;
  }

  /* 타이틀 아랫줄(메뉴 목록 시작 / "선택된 메뉴" 시작)의 위치를 서로 맞춤 - 원래 메뉴 목록
     쪽이 더 아래(margin-bottom 0.6rem)에서 시작하고 "선택된 메뉴" 쪽은 더 위(카드 패딩
     0.7rem만)에서 시작해 어긋나 있었다. 둘 사이 간격의 중간 지점에서 만나도록 메뉴 쪽은
     줄이고 결제 쪽은 늘림(각각 ~6px, 이 브레이크포인트의 루트 폰트 17px 기준 0.36rem). */
  #kiosk-menu-content-wrap > div:first-child {
    margin-bottom: 0.24rem !important;
  }
  #kiosk-checkout-amount-grid {
    margin-top: 0.73rem;
  }

  /* 초기화 버튼 높이를 결제 금액 타이틀의 줄박스 높이(font-size 1.75rem * line-height 1.2)와
     맞춰 위/아래 선이 둘 다 일치하게 함 - 기존엔 버튼 자체 패딩으로 높이가 결정돼 타이틀보다
     더 컸다. */
  #kiosk-checkout-amount-block button {
    height: 2.1rem !important;
    min-height: 2.1rem !important;
  }

  /* 메뉴 그리드 영역 자체가 타이틀 아래 남는 세로 공간을 전부 차지하도록 늘림 - 단일 열이라
     행 수는 항상 메뉴 개수만큼이고(grid-auto-rows 기본값 auto), 다 못 담으면 이 블록
     .kiosk-menu-section의 overflow-y:auto(768px 미디어 쿼리)로 스크롤된다. */
  #kiosk-menu-content-wrap {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
  }

  .menu-grid {
    gap: 1.25rem !important;
    flex: 1;
  }

  /* 카드가 그리드 셀 전체(가로/세로)를 꽉 채우도록 - 기존 height:auto/max-height 캡을 해제
     (admin.js의 단말기별 메뉴 배정 화면(.kiosk-menu-assign-grid)에서 쓰는 2열 카드 그리드용). */
  .menu-card {
    height: 100% !important;
    max-height: none !important;
    padding: 1.4rem !important;
  }

  /* 실제 키오스크 고객 화면만 - 위 height:100%(그리드 셀 전체를 채움)를 고정값으로 덮어써서,
     메뉴가 몇 개 없어 그리드에 남는 공간이 있어도(.menu-grid의 align-content: start와 함께)
     카드가 늘어나지 않게 한다. .menu-grid .menu-card(0,2,0)가 바로 위 bare .menu-card(0,1,0)
     보다 특정성이 높아 이긴다. */
  .menu-grid .menu-card {
    height: 108px !important;
  }

  /* .menu-grid .menu-card ...(specificity 0,3,0)로 잡는 이유: 위쪽 "실제 키오스크 고객
     화면만" 블록의 기본(모바일) 폰트 크기 규칙과 동일한 형태의 선택자라 특정성이 같고, 이
     미디어 쿼리가 더 뒤에 선언돼 있어(그리고 매치될 때만) 태블릿에서 더 크게 이긴다 -
     특정성이 낮은 bare .menu-card 선택자를 썼다면 반대로 모바일 쪽 규칙에 져서 태블릿에서도
     작은 글씨가 나온다. */
  .menu-grid .menu-card .menu-name {
    font-size: 1.8rem !important;
    margin-bottom: 0 !important;
  }

  .menu-grid .menu-card .menu-price,
  .menu-grid .menu-card .menu-price-senior {
    font-size: 1.1rem !important;
  }

  .touch-qty-box {
    padding: 0.4rem !important;
  }

  .menu-grid .touch-qty-btn {
    width: 68px !important;
    height: 68px !important;
    min-height: 68px !important;
    font-size: 2.1rem !important;
  }

  .menu-grid .touch-qty-val {
    font-size: 1.7rem !important;
    font-weight: 800;
    min-width: 3.8rem;
    text-align: center;
  }

  /* 결제 금액 / 최근 결제 내역 2분할 — 카메라는 화면에 표시되지 않으므로 두 블록이 균등 배분.
     기존 .kiosk-checkout-section 규칙의 justify-content:flex-start는 더 이상 필요 없음
     (flex:1 자식들이 이미 전체 높이를 나눠 채움). */
  .kiosk-checkout-section {
    justify-content: flex-start !important;
    padding: 1.75rem !important;
    gap: 1.25rem !important;
  }

  /* 메뉴 선택 섹션의 가로 여백도 결제 금액 섹션(위)과 동일하게 - 안 맞추면 두 섹션의
     제목/목록이 태블릿에서 좌우로 서로 다른 폭만큼 들어가 보인다. */
  .kiosk-menu-section {
    padding: 1.75rem !important;
  }

  .kiosk-checkout-section > #kiosk-checkout-amount-block,
  .kiosk-checkout-section > #kiosk-checkout-recent-block {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .checkout-cart-box {
    padding: 1.5rem !important;
  }

  #kiosk-total-price {
    font-size: 3rem !important;
  }

  /* 결제 금액 블록: 제목 아래 그리드 영역이 남는 세로 공간을 채우도록 */
  #kiosk-checkout-amount-grid {
    flex: 1;
    min-height: 0;
  }

  #cart-items-container {
    max-height: none !important;
    flex: 1;
    min-height: 0;
  }

  /* 최근 결제 내역 블록: 컨테이너 자체를 flex:1로 늘리고 내부 리스트가 그 공간을 채움 */
  #kiosk-checkout-recent-block {
    display: flex !important;
  }

  #recent-payments-container {
    padding: 1.2rem 1.4rem !important;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  #recent-payments-list {
    max-height: none !important;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .recent-payments-title {
    font-size: 1.25rem !important;
  }

  .recent-payments-subtitle {
    font-size: 1rem !important;
  }

  .recent-payment-row {
    font-size: 1.15rem !important;
    padding: 0.6rem 0.8rem !important;
    gap: 0.6rem;
  }

  .recent-payment-time {
    font-size: 1rem !important;
  }

  .recent-payment-name {
    font-size: 1.2rem !important;
  }

  .recent-payment-badge {
    font-size: 1rem !important;
    padding: 0.15rem 0.6rem !important;
  }

  .recent-payment-amount {
    font-size: 1.4rem !important;
  }

  .recent-payment-empty {
    font-size: 1.2rem !important;
  }
}

/* Tablet Portrait Layout (세로로 긴 태블릿, 예: 800x1280, 810x1080 이상)
   세로로 긴 화면은 폭 조건만 보는 위 min-height:700px 블록에도 걸려 좌우 반쪽 분할이 그대로
   적용되는데, 폭이 좁고 높이가 긴 화면에서는 이 가로 2분할이 부자연스럽다.
   대신 위(메뉴 선택 전체 폭) / 아래(좌: 결제 금액, 우: 최근 결제 내역) 구조로 재배치.
   이 블록이 캐스케이드상 위 min-height:700px 블록보다 뒤에 있으므로, 동일 특이도(!important)
   조건에서 겹치는 속성은 이 블록이 이긴다. */
@media screen and (min-width: 768px) and (orientation: portrait) {
  .kiosk-body {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
  }

  .kiosk-menu-section {
    flex: 1.4 1 0 !important;
    min-height: 0 !important;
  }

  .kiosk-checkout-section {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    gap: 1.25rem !important;
  }

  /* 좌: 결제 금액, 우: 최근 결제 내역 - 카메라가 화면에 표시되지 않으므로 그 자리를
     결제 금액이 대신 차지하고, 두 블록 모두 이 행의 높이 전체를 채운다. */
  .kiosk-checkout-section > #kiosk-checkout-amount-block {
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .kiosk-checkout-section > #kiosk-checkout-recent-block {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* 카드 대리 발급 패널이 열리면 하단에 좌우 폭 전체로 별도 행 추가 (평소엔 숨김 상태라 공간 차지 없음) */
  #admin-tab-card {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }

  #kiosk-checkout-amount-grid {
    flex: 1;
    min-height: 0;
  }

  #cart-items-container {
    max-height: none !important;
    flex: 1;
    min-height: 0;
  }

  #recent-payments-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  #recent-payments-list {
    max-height: none !important;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* 최근 결제 내역 한 줄 항목도 좁은 컬럼 기준으로 살짝 축소 (가로 모드 700px+ 확대 폰트 기준 대비) */
  .recent-payment-row {
    font-size: 0.95rem !important;
  }

  .recent-payment-amount {
    font-size: 1.05rem !important;
  }
}

