:root {
  --color-background-secondary: #f3f5f7;
  --color-border-tertiary: #e5e7eb;
  --color-text-secondary: #6b7280;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

.pick-wrap {
  width: 100%;
  padding: 24px 16px;
}

/* 브랜드 로고 (companyName은 JS에서 data-name 주입) */
.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
}
.brand-logo-lg {
  min-height: 100px;
  margin: 8px 0 20px;
}
.brand-logo-sm {
  min-height: 70px;
  margin: 4px 0 16px;
}
.brand-logo-img {
  max-height: 100px;
  max-width: 80%;
  width: auto;
  height: auto;
}
.brand-logo-sm .brand-logo-img {
  max-height: 70px;
}
.brand-logo-fallback::before {
  content: '';
  display: block;
  width: 200px;
  height: 70px;
  background-color: #e5e7eb;
  border-radius: 8px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='5' width='18' height='14' rx='2'/><circle cx='8.5' cy='10' r='1.5' fill='%239ca3af' stroke='none'/><path d='M3 16l5-5 4 4 3-3 6 6'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px 40px;
}
.brand-logo-sm.brand-logo-fallback::before {
  width: 140px;
  height: 50px;
  background-size: 30px 30px;
}

/* 검색 화면 라벨/입력 영역 */
.field-label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  text-align: left;
}

.search-tip-box {
  background: #E6F1FB;
  color: #042C53;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 10px 12px;
  border-radius: var(--border-radius-md);
  margin: 12px 0 16px;
  word-break: keep-all;
  line-height: 1.5;
}

/* 공지사항 */
.notice-board {
  background: #FCEBEB;
  border-radius: var(--border-radius-md);
  padding: 12px 14px;
  margin-top: 20px;
}
.notice-board-title {
  font-size: 13px;
  font-weight: 700;
  color: #791F1F;
  margin-bottom: 6px;
}
.notice-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notice-board-list li {
  font-size: 12px;
  color: #501313;
  line-height: 1.6;
  word-break: keep-all;
}

.nickname-input {
  width: 100%;
  font-size: 16px;
  padding: 14px 16px;
  border: 1.5px solid #cfd8dc;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
  min-height: 48px;
}
.nickname-input:focus {
  outline: none;
  border-color: #042C53;
}
.nickname-input:disabled {
  background: #f5f5f5;
  color: #aaa;
  cursor: not-allowed;
}

.search-btn {
  width: 100%;
  min-height: 48px;
  padding: 14px 16px;
  background: #042C53;
  color: #fff;
  border: none;
  border-radius: var(--border-radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.search-btn:hover:not(:disabled) { background: #063a6e; }
.search-btn:disabled {
  background: #cfd8dc;
  color: #888;
  cursor: not-allowed;
}

/* 공통 알림 — 향후 모든 inline/안내 메시지에 일관 적용 */
.notice {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  padding: 10px 8px;
  line-height: 1.5;
}
.notice-error   { color: #d32f2f; }
.notice-info    { color: #1976d2; }
.notice-success { color: #388e3c; }

/* 결과 화면 공통 */
.back-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: #042C53;
  text-decoration: none;
  margin-bottom: 16px;
  padding: 8px 0;
}
.back-link:hover { text-decoration: underline; }

/* 화면 #2: 다중 매칭 선택 */
.result-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}
.result-subtitle {
  font-size: 14px;
  color: #777;
  margin-bottom: 16px;
}
.nickname-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.nickname-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 12px 16px;
  background: #fff;
  border: 0.5px solid #d0d0d0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.nickname-card:hover,
.nickname-card:active { background: #eaf2fb; }
.nickname-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.nickname-card-name {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  word-break: break-all;
}
.nickname-card-count {
  font-size: 12px;
  color: #777;
}
.nickname-card-arrow {
  font-size: 20px;
  color: #999;
  flex-shrink: 0;
  margin-left: 12px;
}
.result-footer {
  text-align: center;
  font-size: 13px;
  color: #777;
  margin-top: 8px;
}

/* 화면 #3: 주문 상세 (3-A-1) */

/* 주문 요약 박스 */
.payment-summary {
  background: #042C53;
  color: #fff;
  border-radius: var(--border-radius-lg);
  padding: 14px 12px;
  margin-bottom: 14px;
}
.payment-summary-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.ps-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.ps-label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.ps-value {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 4px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ps-value-emphasis {
  background: #fff;
  color: #042C53;
}

/* 주문 요약 안 그룹 배지 영역 (구분선 + 4종 배지) */
.payment-summary-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 14px;
  padding-top: 12px;
}
.payment-summary-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

/* 결제 정보 박스 */
.payment-info {
  background: #042C53;
  color: #fff;
  border-radius: var(--border-radius-lg);
  padding: 14px 12px;
  margin-bottom: 14px;
}
.payment-info-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
.payment-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 4px;
}
.pi-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.pi-label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.pi-value {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 6px;
  background: #fff;
  color: #042C53;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pi-value-account {
  gap: 6px;
  padding: 0 6px;
  font-size: 12px;
}
.pi-value-account span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.copy-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
}
.copy-btn:active { transform: scale(0.9); }

.badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.badge-sm {
  font-size: 12px;
  padding: 3px 8px;
}
.badge-combined { background: #d4edda; color: #155724; }
.badge-new      { background: #ffe5b4; color: #8a4a00; }
.badge-free     { background: #d1ecf1; color: #0c5460; }
.badge-card     { background: #e2d4f1; color: #4a1d72; }
.badge-gift     { background: #FBEAF0; color: #4B1528; }

/* 주문 내역 컨테이너 */
.orders-container {
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-lg);
  padding: 14px 12px;
}
.orders-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.orders-header {
  font-size: 17px;
  font-weight: 600;
  color: #1a1a1a;
}
.orders-date {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* 탭 */
.orders-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.orders-tab {
  flex: 1;
  padding: 8px 4px;
  border-radius: var(--border-radius-md);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  background: #fff;
  border: 0.5px solid var(--color-border-tertiary);
  color: var(--color-text-secondary);
  transition: background 0.12s;
  user-select: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
/* hover는 마우스 환경에만 — 모바일 sticky :hover 잔상 차단 */
@media (hover: hover) {
  .orders-tab:hover { background: #f3f5f7; }
  .orders-tab-active:hover {
    background: #042C53;
    color: #fff;
    border-color: #042C53;
  }
}
.orders-tab:focus { outline: none; }
.orders-tab-active {
  background: #042C53;
  color: #fff;
  border-color: #042C53;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}
.orders-list::-webkit-scrollbar { width: 4px; }
.orders-list::-webkit-scrollbar-track { background: transparent; }
.orders-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 2px;
}

/* 주문 카드 (한 줄 압축형) */
.order-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  padding: 10px 12px;
  border-radius: var(--border-radius-md);
}
.order-num {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #e9ecef;
  color: #4a4a4a;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.order-body {
  flex: 1;
  min-width: 0;
}
.order-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-height: 1.4;
  margin-bottom: 2px;
}
.order-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.order-options {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}
.order-amount {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: right;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 24px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}
.toast.toast-show { opacity: 1; }

/* 전체주문 모달 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.modal-content {
  position: relative;
  background: #fafafa;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
@media (min-width: 600px) {
  .modal-content {
    width: 92%;
    max-width: 500px;
    height: 90vh;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--color-border-tertiary);
  flex-shrink: 0;
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}
.modal-close {
  background: var(--color-background-secondary);
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.modal-close:hover { background: #e9ecef; }
.modal-close:active { transform: scale(0.96); }
.modal-close:focus { outline: none; }
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}
.modal-orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

/* 화면 #4 / #5 공통 */
.empty-message,
.too-many-message {
  text-align: center;
  padding: 32px 16px;
}
.empty-main,
.too-many-main {
  margin-bottom: 8px;
  word-break: break-all;
}
.empty-sub,
.too-many-sub {
  font-size: 14px;
  color: #777;
  margin-bottom: 24px;
}
