:root {
  color-scheme: light;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--card);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px var(--border);
}

/* 데스크톱: 좁은 모바일 프레임 대신 넓은 관리 화면으로 전환 (와이어프레임의 데스크톱 UI 요구사항을 반응형으로 충족) */
@media (min-width: 900px) {
  .app-shell.wide {
    max-width: 1180px;
    box-shadow: none;
  }
  .app-shell.wide .page-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
  }
  .app-shell.wide .side-nav { display: block; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar .brand small { display: block; font-weight: 400; color: var(--text-muted); font-size: 11px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text-muted); }
.topbar-actions .staff-name { color: var(--text); font-weight: 600; }
.back-link {
  font-size: 14px; font-weight: 600; color: var(--text); margin-right: 10px;
  display: inline-flex; align-items: center; gap: 2px; padding: 6px 10px;
  border-radius: 8px; border: 1px solid var(--border); background: #fff;
}
.back-link:hover { background: #f8fafc; }

.side-nav {
  display: none;
  border-right: 1px solid var(--border);
  padding: 18px 10px;
}
.side-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 2px;
}
.side-nav a.active, .side-nav a:hover { background: #eff6ff; color: var(--primary); }

.page-body { padding: 16px 18px 32px; flex: 1; }

.hero {
  height: 170px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e40af;
  font-size: 13px;
  margin-bottom: 14px;
}

.hero.has-photo, .room-thumb.has-photo { color: transparent; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.card h4 { margin: 0 0 8px; font-size: 13px; color: var(--text-muted); font-weight: 600; }

.menu-grid { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
}
.menu-item:hover { border-color: var(--primary); background: #f8fafc; }
.menu-item .ic { font-size: 22px; width: 36px; text-align: center; }
.menu-item .t { font-weight: 600; font-size: 14px; }
.menu-item .d { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.menu-item .chev { color: #cbd5e1; margin-left: auto; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.stat-box { background: #eff6ff; border-radius: var(--radius); padding: 12px; text-align: center; }
.stat-box .n { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-box .l { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; color: var(--text); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
.hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.radio-row { display: flex; gap: 8px; margin-top: 4px; }
.radio-row label {
  flex: 1; margin: 0; text-align: center; padding: 9px; border: 1px solid var(--border);
  border-radius: 8px; font-weight: 500; font-size: 13px; cursor: pointer;
}
.radio-row input { display: none; }
.radio-row input:checked + span { color: var(--primary); }
.radio-row label:has(input:checked) { border-color: var(--primary); background: #eff6ff; color: var(--primary); }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 8px; border: none; font-size: 14px; font-weight: 600;
  cursor: pointer; background: var(--primary); color: #fff; text-align: center;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button:disabled { background: #94a3b8; cursor: not-allowed; }
button.full, .btn.full { width: 100%; margin-top: 16px; }
.btn.secondary { background: #f1f5f9; color: var(--text); }
.btn.secondary:hover { background: #e2e8f0; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 6px 12px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.badge.vacant { background: #dcfce7; color: #166534; }
.badge.occupied { background: #fee2e2; color: #991b1b; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.mock { background: #fef9c3; color: #713f12; }
.badge.muted { background: #e5e7eb; color: #374151; }

.room-card { display: flex; gap: 12px; align-items: center; }
.room-thumb {
  width: 64px; height: 64px; border-radius: 8px; background: #e2e8f0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-muted);
  background-size: cover; background-position: center;
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 13px;
  z-index: 100; box-shadow: 0 8px 20px rgba(0,0,0,.2); max-width: 90vw; text-align: center;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

.error-box {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-top: 10px;
}
.success-box {
  background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-top: 10px;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: var(--radius); padding: 22px; max-width: 340px; width: 100%;
  text-align: center;
}
.modal-box h3 { margin: 0 0 10px; font-size: 16px; }
.modal-box p { font-size: 13px; color: var(--text-muted); margin: 0 0 18px; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions button { flex: 1; }

.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.photo-strip img, .photo-strip .ph {
  width: 80px; height: 80px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #e2e8f0;
}
.photo-strip img { cursor: pointer; }

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lightbox-overlay img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.lightbox-close {
  position: absolute; top: 14px; right: 18px; color: #fff; font-size: 28px; line-height: 1;
  background: none; border: none; padding: 6px 10px; cursor: pointer;
}

/* 공개 홈페이지(index.html) 상단 와이드 사진 갤러리 — page-body 좌우 여백을 상쇄해 화면 끝까지 꽉 차게 표출 */
.home-gallery { margin: -16px -18px 0; overflow: hidden; background: #dbeafe; }
.home-gallery-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.home-gallery-track::-webkit-scrollbar { display: none; }
.home-gallery-slide {
  flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 16 / 10;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  color: #1e40af; font-size: 13px; background-color: transparent;
}
.home-gallery-slide.placeholder { background-image: linear-gradient(135deg, #dbeafe, #bfdbfe) !important; }
.home-gallery-dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0 4px; }
.home-gallery-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: #cbd5e1; transition: all .15s; }
.home-gallery-dots .dot.active { background: var(--primary); width: 16px; border-radius: 3px; }
.tabbar {
  display: flex; border-top: 1px solid var(--border); background: #fff; position: sticky; bottom: 0;
}
.tabbar a {
  flex: 1; text-align: center; padding: 10px 4px 8px; font-size: 10px; color: var(--text-muted);
}
.tabbar a.active { color: var(--primary); font-weight: 700; }
.tabbar .ic { font-size: 18px; display: block; }

.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
.muted { color: var(--text-muted); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.small { font-size: 12px; }

/* 객실현황판(조회 전용) */
.floor-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.floor-tabs button {
  flex-shrink: 0; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.floor-tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.board-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12px; color: var(--text-muted); }
.board-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.room-board-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 900px) { .room-board-grid { grid-template-columns: repeat(6, 1fr); } }
.room-cell {
  border-radius: 8px; padding: 14px 6px; text-align: center; cursor: pointer; color: #fff;
  font-weight: 700; font-size: 16px; border: none; line-height: 1.4; min-height: 68px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.room-cell .st { display: block; font-size: 12px; font-weight: 500; opacity: 0.95; margin-top: 3px; white-space: pre-line; }
.room-cell.st-vacant { background: var(--success); }
.room-cell.st-reserved { background: #0ea5e9; }
.room-cell.st-occupied { background: var(--primary); }
.room-cell.st-overdue { background: var(--danger); }
.room-cell.st-moveout { background: var(--warn); }
.room-cell.st-moveout-reserved { background: #7c3aed; }
.room-cell:hover { filter: brightness(0.95); }
.mt0 { margin-top: 0; }

/* 계약정보 마스터관리 */
.master-table-wrap { overflow-x: auto; }
.master-table { min-width: 980px; }
.master-table td { vertical-align: middle; }
.master-table input, .master-table select {
  width: 100%; padding: 6px 7px; font-size: 12px; border-radius: 6px; min-width: 74px;
}
.master-table input[type="number"] { min-width: 78px; }
.master-table input[type="date"] { min-width: 118px; }
.master-table tr.row-dirty td { background: #fffbeb; }
.master-table tr.row-vacant td { color: var(--text-muted); }
.rev-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; text-align: left; }
.rev-item .rev-head { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.rev-item .rev-field { font-size: 13px; padding: 2px 0; }
.rev-item .rev-field .k { color: var(--text-muted); margin-right: 6px; }
.rev-item .rev-field .from { color: var(--danger); text-decoration: line-through; margin-right: 6px; }
.rev-item .rev-field .to { color: var(--success); font-weight: 600; }
