* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Malgun Gothic", sans-serif;
  background: #f5f5f7;
  margin: 0;
  color: #222;
}
.page { max-width: 480px; margin: 60px auto; padding: 0 20px; }
.wide-page { max-width: 1100px; margin: 30px auto; padding: 0 20px; }

/* ---- 회원용 페이지(order.html, mypage.html) 상단 네비게이션: 2줄 배치 ----
   1줄: 왼쪽 페이지 제목 / 오른쪽 메뉴 링크
   2줄: 왼쪽 소속(업체·지점) / 오른쪽 이름 */
nav.top { padding:14px 0; border-bottom:1px solid #ececf1; margin-bottom:22px; }
.top-row1 { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.top-row1 b { font-size:16px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.top-links { display:flex; align-items:center; flex:0 0 auto; }
nav.top a { font-size:14px; color:#444; text-decoration:none; margin-left:16px; white-space:nowrap; }
nav.top a:hover { color:#163e90; }
nav.top a.active { color:#163e90; font-weight:700; }
.top-row2 { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:5px; }
.top-row2 span { font-size:13px; color:#999; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.card { background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 1px 6px rgba(0,0,0,0.06); overflow-x: auto; }
h1 { font-size: 22px; margin: 0 0 20px; }
h2 { font-size: 16px; margin: 0 0 12px; }
label { display:block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color:#444; }
input, select {
  width: 100%; padding: 11px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: #163e90; }
.row { display: flex; gap: 12px; }
.row > div { flex: 1; }
button.primary {
  width: 100%; margin-top: 22px; padding: 13px; border: none; border-radius: 9px;
  background: #163e90; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
button.primary:disabled { background: #ccc; cursor: not-allowed; }
button.secondary {
  padding: 8px 14px; border: 1px solid #ddd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 13px;
}
.link { color: #163e90; text-decoration: none; font-size: 13px; }
.error { color: #e33; font-size: 13px; margin-top: 10px; min-height: 16px; }
.muted { color: #999; font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: center; padding: 9px 8px; border-bottom: 1px solid #eee; }
th { color: #888; font-weight: 600; font-size: 12px; white-space: nowrap; }
.badge { display:inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; }
.badge.paid { background:#eef7ee; color:#2a8; }
.badge.pending { background:#fff6e5; color:#c80; }
.badge.canceled { background:#f2f2f2; color:#999; }
/* ---- 관리자 사이드바 레이아웃 (왼쪽 카테고리 메뉴) ---- */
.admin-shell { display:flex; min-height:100vh; background:#f5f5f7; }
.admin-sidebar {
  width:220px; flex-shrink:0; background:#fff; border-right:1px solid #eee;
  padding:24px 16px; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; box-sizing:border-box;
}
.sidebar-logo { margin:4px 0 28px; text-align:center; }
.sidebar-logo-img { width:100%; max-width:150px; height:auto; display:block; margin:0 auto; }
.sidebar-nav { display:flex; flex-direction:column; gap:4px; flex:1; }
.sidebar-link {
  display:flex; align-items:center; gap:10px; padding:12px 14px; border-radius:10px; text-decoration:none;
  color:#555; font-size:14px; font-weight:700;
}
.sidebar-link:hover { background:#f7f8fa; }
.sidebar-link.active { background:#e7f0fc; color:#163e90; }
.sidebar-link .icon { width:20px; height:20px; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center; }
.sidebar-link .icon svg { width:20px; height:20px; display:block; }
.sidebar-link .label { flex:1; }
.sidebar-link .sidebar-bell { display:inline-flex; color:#bbb; margin-right:2px; opacity:0.85; }
.sidebar-link .sidebar-bell svg { width:15px; height:15px; display:block; }
.sidebar-link.active .sidebar-bell { color:#163e90; }
.sidebar-link.ring { animation: sidebar-ring 0.6s; }
@keyframes sidebar-ring {
  0%, 100% { background-color: inherit; }
  40% { background-color: #ffe3c2; }
}
.sidebar-badge {
  background:#e33; color:#fff; font-size:10px; font-weight:800; border-radius:999px;
  min-width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; padding:0 5px;
}
.sidebar-bottom { border-top:1px solid #eee; padding-top:14px; margin-top:14px; }
.sidebar-bottom a { color:#888; font-size:13px; text-decoration:none; }
.sidebar-bottom a:hover { color:#555; }
.admin-main { flex:1; min-width:0; }


/* ---- 관리자 목록 페이지 공용: 검색/필터 바, 페이지네이션 ---- */
.toolbar { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom:16px; }
.toolbar input[type="text"], .toolbar select { width:auto; }
.toolbar .search-input { flex:1; min-width:200px; }
.toolbar-right { display:flex; gap:8px; margin-left:auto; }
.icon-btn {
  display:inline-flex; align-items:center; gap:6px; padding:9px 14px; border-radius:8px; border:1px solid #ddd;
  background:#fff; cursor:pointer; font-size:13px; font-weight:600; color:#333; white-space:nowrap;
}
.icon-btn:hover { background:#f7f8fa; }
.icon-btn.excel { border-color:#1d7a46; color:#1d7a46; }
.icon-btn.excel:hover { background:#eefaf2; }
.sort-btn {
  display:inline-flex; align-items:center; gap:6px; padding:9px 14px; border-radius:8px; border:1px solid #ddd;
  background:#fff; cursor:pointer; font-size:13px; font-weight:600; color:#333; white-space:nowrap;
}
.sort-btn:hover { background:#f7f8fa; }

.pagination-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; flex-wrap:wrap; }
.page-btns { display:flex; gap:4px; }
.page-btn { min-width:30px; height:30px; border:1px solid #ddd; background:#fff; border-radius:6px; cursor:pointer; font-size:13px; }
.page-btn.active { background:#163e90; color:#fff; border-color:#163e90; }
.page-btn:disabled { opacity:.4; cursor:not-allowed; }
.page-size-select { padding:6px 8px; border:1px solid #ddd; border-radius:6px; font-size:13px; width:auto; }

/* ---- 탭 (현금 관리 페이지 등) ---- */
.tabs { display:flex; gap:8px; margin-bottom:18px; flex-wrap:wrap; }
.tab-btn {
  padding:10px 18px; border-radius:999px; border:1px solid #ddd; background:#fff; cursor:pointer;
  font-size:13.5px; font-weight:700; color:#666;
}
.tab-btn.active { background:#163e90; color:#fff; border-color:#163e90; }
.tab-panel { display:none; }
.tab-panel.active { display:block; }

.btn-branch-add {
  display:flex; align-items:center; justify-content:center;
  white-space:nowrap; padding:8px 16px; width:auto;
}

/* ---- 가격 설정(업체별) ---- */
.price-setting { margin-top:14px; padding-top:14px; border-top:1px dashed #eee; }
.price-setting .row { align-items:flex-end; }
.price-setting input:disabled { background:#f7f8fa; color:#888; cursor:not-allowed; }
.price-saved-badge {
  display:none; align-items:center; padding:6px 12px; border-radius:999px; font-size:12.5px; font-weight:700;
  background:#eafaf0; color:#1d7a46;
}
.price-saved-badge.error-badge { background:#fdeaea; color:#c0392b; }

/* ---- 삭제(X) 버튼 ---- */
.delete-x-btn {
  display:inline-flex; align-items:center; justify-content:center;
  border:none; background:#fdeaea; color:#c0392b; width:24px; height:24px; border-radius:50%;
  font-size:12px; font-weight:700; cursor:pointer; line-height:1; flex-shrink:0; padding:0;
}
.delete-x-btn:hover { background:#f8d0d0; }
.delete-x-btn.small { width:18px; height:18px; font-size:9px; margin-left:6px; }

/* 회원가입 등 실시간 유효성 검사 표시 */
.field-msg { display:none; color:#e33; font-size:11.5px; margin-top:4px; }
input.invalid, select.invalid { border-color:#e33; background:#fff8f8; }

/* ---- 로그인/아이디찾기/비밀번호찾기 공용 ---- */
.logo-wrap { text-align: center; margin-bottom: 22px; }
.logo-box {
  width: 200px; height: auto; margin: 0 auto; display: block;
}

.title-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; }
.title-row h1 { margin: 0; }
.title-row .link { white-space: nowrap; margin-left: 12px; }

.link-row { display: flex; justify-content: center; margin: 16px 0 2px; }
.link-row a { font-size: 13px; margin: 0 11px; }

button.outline {
  width: 100%; margin-top: 12px; padding: 13px; border: 1.5px solid #163e90; border-radius: 9px;
  background: #fff; color: #163e90; font-size: 15px; font-weight: 700; cursor: pointer;
}
button.outline:hover { background: #eef1fa; }

.result-box { text-align: center; padding: 10px 0 4px; }
.result-box p.desc { color: #666; font-size: 14px; margin: 4px 0 0; }
.result-email {
  font-size: 19px; font-weight: 800; margin: 18px 0 22px; color: #222;
  background: #fafafa; border-radius: 10px; padding: 14px; letter-spacing: 0.2px;
}

.step { display: none; }
.step.active { display: block; }

.center-link { display: block; text-align: center; margin-top: 16px; }
.helper { color: #2a8; font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ---- 모바일 화면 대응 ---- */
@media (max-width: 720px) {
  /* 안쪽 어딘가(달력, 상세표 등)가 아무리 넓어져도 페이지 전체가 가로로 밀리지 않게 막는 안전장치.
     각 카드/표는 자기 안에서만(overflow-x:auto) 스크롤되고, 페이지 자체와 상단 탭바는 화면 폭에 고정됩니다. */
  html, body { overflow-x: hidden; max-width: 100vw; }
  .admin-shell, .admin-main, .wide-page { max-width: 100vw; overflow-x: hidden; }

  .page { margin: 24px auto; padding: 0 14px; }
  .wide-page { margin: 16px auto; padding: 0 12px; }
  .card { padding: 18px 16px; }

  /* 관리자 사이드바를 세로 메뉴 -> 가로 5등분 탭바로 전환 (모든 항목이 화면 가로를 꽉 채워 스크롤 없이 다 보이게) */
  .admin-shell { flex-direction: column; }
  .admin-sidebar {
    width: 100%; height: auto; position: static; flex-direction: row; align-items: stretch;
    padding: 0; gap: 0; overflow-x: visible;
  }
  .sidebar-logo { display: none; }
  .sidebar-nav { display: contents; }
  .sidebar-link {
    position: relative; flex: 1 1 0; min-width: 0; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 8px 2px; border-radius: 0; white-space: nowrap;
  }
  .sidebar-link .icon { width: 18px; height: 18px; }
  .sidebar-link .icon svg { width: 18px; height: 18px; }
  .sidebar-link .label { flex: none; font-size: 0; }
  .sidebar-link .label::after { content: attr(data-short); font-size: 10.5px; }
  .sidebar-link .sidebar-bell { display: none; }
  .sidebar-badge { position: absolute; top: 4px; right: 14%; min-width: 14px; height: 14px; font-size: 8.5px; padding: 0 3px; }
  .sidebar-bottom { display: none; }

  /* 입력폼 가로 배치(.row)는 좁은 화면에서 필요할 때만 다음 줄로 넘어가게 해서
     내용이 눌리거나(=글자가 세로로 쌓임) 불필요하게 꽉 늘어나지 않도록 함 */
  .row { flex-wrap: wrap; gap: 10px 12px; }
  .row > div { flex: 0 1 200px; min-width: 0; }
  .btn-branch-add { width: auto; }

  /* 표는 옆으로 스크롤해서 보되, 칸이 너무 좁아져 글씨가 세로로 쌓이지 않도록 줄바꿈을 막음 */
  .scroll-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table th, table td { white-space: nowrap; }

  /* 툴바 안 검색어 placeholder 길이가 탭마다 달라서 엑셀 버튼이 줄바꿈되는 위치가 제각각이었던 것을
     항상 같은 자리(자기 줄, 오른쪽 정렬)에 오도록 고정해 탭마다 다르게 보이지 않게 함 */
  .toolbar-right { margin-left: 0; width: 100%; justify-content: flex-end; }

  /* 페이지당 개수 선택 등 좁은 select도 줄바꿈 없이 */
  select { white-space: nowrap; }

  /* 주문 현황 요약 카드 4개: 2x2 대신 한 줄에 4개, 여백 없이 꽉 차게 */
  .summary-cards { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 8px !important; }
  .summary-card { padding: 10px 6px !important; flex-direction: column !important; align-items: flex-start !important; gap: 4px !important; overflow: hidden; }
  .summary-card-label { white-space: normal !important; overflow: hidden; text-overflow: ellipsis; }
  .summary-card-value { font-size: 17px !important; }
  .summary-card-value .unit { font-size: 11px !important; }
  .summary-card-label { font-size: 10.5px !important; margin-bottom: 0 !important; }
  .summary-card-icon svg { width: 18px !important; height: 18px !important; }

  /* 대시보드 달력을 축소 없이도 한 화면에 다 보이게 */
  .cal-weekday-row, .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; }
  .cal-count, .cal-holiday-name { overflow: hidden; }
  .cal-cell { padding: 4px 2px !important; font-size: 11px !important; }
  .cal-date-num { font-size: 12px !important; }
  .cal-holiday-name { font-size: 8px !important; }
  .cal-count { font-size: 9.5px !important; }
  .cal-blocked-badge { font-size: 8px !important; padding: 1px 4px !important; }

  /* 회원 페이지 상단바 2줄 배치: 글자 크기/간격을 좁혀서 겹치거나 줄바꿈되지 않게 함 */
  nav.top { padding: 10px 0; margin-bottom: 16px; }
  .top-row1 b { font-size: 14px; }
  nav.top a { margin-left: 8px; font-size: 12px; }
  .top-row2 { margin-top: 3px; }
  .top-row2 span { font-size: 11px; }

  /* 주문 페이지 캘린더/주문내역을 세로로 쌓기 */
  .layout { flex-direction: column; }
}
