:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  color: #111827;
  background: #f5f7fb;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  min-height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: rgba(255,255,255,.95); border-bottom: 1px solid #e5e7eb;
}
.brand { font-size: 20px; font-weight: 800; }
nav { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.primary-link { font-weight: 700; }
.container { max-width: 920px; margin: 0 auto; padding: 22px 16px 80px; }
.page-head, .section-head, .row { display: flex; align-items: center; }
.page-head, .section-head { justify-content: space-between; gap: 12px; }
.page-head h1 { margin: 0; font-size: 26px; }
.section-head { margin-top: 28px; }
.section-head h2 { margin: 0; font-size: 19px; }
.between { justify-content: space-between; }
.muted { color: #6b7280; }
.stats { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-top:18px; }
.stat { background:white; border:1px solid #e5e7eb; border-radius:16px; padding:16px; }
.stat span { display:block; color:#6b7280; font-size:13px; }
.stat strong { display:block; margin-top:6px; font-size:28px; }
.cards { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-top:12px; }
.reservation-card {
  display:block; background:white; border:1px solid #e5e7eb;
  border-radius:16px; padding:15px; line-height:1.65;
}
.badge { padding:3px 8px; border-radius:999px; background:#eef2ff; font-size:12px; font-weight:700; }
.status { font-size:12px; color:#374151; }
.amount { margin-top:6px; font-weight:800; }
.btn {
  display:inline-flex; justify-content:center; align-items:center;
  border:1px solid #d1d5db; background:white; min-height:42px;
  border-radius:10px; padding:0 14px; font-weight:700; cursor:pointer;
}
.btn.primary { background:#111827; color:white; border-color:#111827; }
.btn.danger { background:#fff; color:#b91c1c; border-color:#fecaca; margin-top:12px; }
.full-width { width:100%; }
.filter { display:flex; gap:8px; align-items:center; margin:16px 0; flex-wrap:wrap; }
.form-card, .login-card {
  background:white; border:1px solid #e5e7eb; border-radius:18px; padding:18px; margin-top:16px;
}
.login-card { max-width:420px; margin:80px auto; }
.form-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.form-grid .full { grid-column:1 / -1; }
label { display:block; margin-bottom:6px; font-size:13px; font-weight:700; }
input, select, textarea {
  width:100%; padding:11px 12px; border:1px solid #d1d5db;
  border-radius:10px; font:inherit; background:white;
}
.actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.empty { margin-top:14px; padding:30px 18px; text-align:center; background:white; border-radius:16px; color:#6b7280; }
.error { color:#b91c1c; font-size:13px; margin:6px 0; }
.logout { max-width:920px; margin:0 auto 30px; padding:0 16px; }
.logout button { border:0; background:transparent; color:#6b7280; cursor:pointer; }

@media (max-width: 640px) {
  .container { padding-top:16px; }
  .topbar { min-height:58px; }
  nav a:not(.primary-link) { display:none; }
  .stats { grid-template-columns:repeat(2,1fr); }
  .cards { grid-template-columns:1fr; }
  .form-grid { grid-template-columns:1fr; }
  .form-grid .full { grid-column:auto; }
  .page-head h1 { font-size:22px; }
}


/* ===== v2: 객실 + 달력 ===== */
.container { max-width: 1180px; }
.logout { max-width:1180px; }
.stats-six { grid-template-columns:repeat(6,1fr); }
.quick-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:14px; }
.room-list { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:16px; }
.room-item { background:white; border:1px solid #e5e7eb; border-radius:14px; padding:15px; display:flex; justify-content:space-between; align-items:center; }
.room-item strong { font-size:18px; margin-right:8px; }
.room-item span { color:#6b7280; font-size:13px; }
.room-item.inactive { opacity:.55; }
.room-state { font-size:12px; color:#374151; }
.checkbox-field { display:flex; align-items:end; padding-bottom:10px; }
.checkbox-field label { display:flex; align-items:center; gap:8px; margin:0; }
.checkbox-field input { width:auto; }
.calendar-toolbar, .calendar-date-form { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.calendar-toolbar { margin:16px 0; }
.calendar-date-form { margin-left:auto; }
.calendar-scroll { overflow:auto; border:1px solid #e5e7eb; border-radius:16px; background:white; -webkit-overflow-scrolling:touch; }
.room-calendar { display:grid; grid-template-columns:105px repeat(var(--days), 86px); min-width:max-content; }
.cal-corner, .cal-date, .cal-room, .cal-cell { border-right:1px solid #e5e7eb; border-bottom:1px solid #e5e7eb; }
.cal-corner { position:sticky; left:0; z-index:8; display:flex; align-items:center; justify-content:center; min-height:58px; background:#f9fafb; font-weight:800; }
.cal-date { min-height:58px; padding:8px 6px; text-align:center; background:#f9fafb; }
.cal-date strong, .cal-date span { display:block; }
.cal-date span { color:#6b7280; font-size:12px; margin-top:3px; }
.cal-date.today { box-shadow:inset 0 -3px 0 #111827; }
.cal-room { position:sticky; left:0; z-index:6; min-height:58px; padding:9px; background:white; display:flex; flex-direction:column; justify-content:center; }
.cal-room strong { font-size:15px; }
.cal-room span { font-size:11px; color:#6b7280; margin-top:2px; }
.cal-cell { min-height:58px; display:flex; align-items:center; justify-content:center; }
.empty-cell { color:#d1d5db; font-size:18px; background:white; }
.empty-cell:hover { background:#f9fafb; color:#111827; }
.booked { background:#e0e7ff; color:#1e1b4b; padding:5px; align-items:flex-start; flex-direction:column; justify-content:center; }
.booked .guest { font-size:12px; font-weight:800; max-width:74px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.booked .channel { font-size:10px; opacity:.75; }
.calendar-help { margin-top:10px; color:#6b7280; font-size:12px; }

@media (max-width: 800px) {
  .stats-six { grid-template-columns:repeat(3,1fr); }
  .room-list { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 640px) {
  .stats-six { grid-template-columns:repeat(2,1fr); }
  .room-list { grid-template-columns:1fr; }
  .calendar-date-form { width:100%; margin-left:0; }
  nav a { display:none; }
  nav a[href*="Calendar"], nav .primary-link { display:inline-flex; }
}


/* V3 - 가족계정 / 활동기록 */
.user-chip {
  margin-left: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.user-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.user-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-item.inactive { opacity: .5; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  color: white;
  font-weight: 800;
}
.grow { flex: 1; }
.role {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f4f6;
}
.role-admin { background: #fee2e2; color: #991b1b; }
.role-family { background: #dcfce7; color: #166534; }
.role-viewer { background: #e5e7eb; color: #374151; }

.activity-list {
  margin-top: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
}
.activity-item {
  display: flex;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid #f3f4f6;
}
.activity-item:last-child { border-bottom: 0; }
.activity-time {
  width: 85px;
  flex: none;
  color: #6b7280;
  font-size: 12px;
}
.activity-main {
  font-size: 13px;
  line-height: 1.55;
}
.login-help {
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  margin-top: 18px;
}
.login-card input { margin-bottom: 14px; }

@media (max-width: 640px) {
  .user-chip { display: none; }
  .user-list { grid-template-columns: 1fr; }
  .activity-item { gap: 8px; }
  .activity-time { width: 72px; }
}


/* V4 - PWA / Push */
.mobile-app-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.mobile-app-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-app-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
button[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .mobile-app-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .mobile-app-actions {
    justify-content: stretch;
  }
  .mobile-app-actions .btn {
    flex: 1;
  }
}


/* V6 - Naver actual status */
.naver-sync-strip {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.naver-sync-strip.error { background:#fff7ed; border-color:#fed7aa; color:#9a3412; }
.naver-sync-strip strong,.naver-sync-strip span { display:block; }
.naver-sync-strip span { margin-top:2px; font-size:12px; opacity:.85; }
.naver-sync-strip a { font-weight:800; }
.naver-error-inline { margin-top:8px; color:#b91c1c; font-size:12px; }

.cal-cell.naver-open { background:#f0fdf4; color:#166534; flex-direction:column; gap:3px; }
.cal-cell.naver-closed { background:#fef2f2; color:#991b1b; flex-direction:column; gap:2px; }
.cal-cell.status-mismatch { background:#ffedd5; color:#9a3412; box-shadow:inset 0 0 0 2px #fb923c; }
.naver-dot { width:9px; height:9px; border-radius:50%; background:#16a34a; display:inline-block; }
.naver-label { font-size:11px; font-weight:900; }
.naver-sub { font-size:9px; line-height:1.15; opacity:.8; text-align:center; }
.naver-mini { font-size:8px; font-weight:900; border-radius:999px; padding:2px 4px; margin-top:2px; }
.naver-mini.closed { background:#fee2e2; color:#991b1b; }
.naver-mini.mismatch { background:#ffedd5; color:#9a3412; }
.calendar-legend { display:flex; flex-wrap:wrap; gap:12px; margin-top:10px; font-size:11px; color:#6b7280; }
.legend-box { display:inline-block; width:11px; height:11px; border-radius:3px; margin-right:4px; vertical-align:-1px; }
.legend-box.green { background:#dcfce7; }
.legend-box.red { background:#fee2e2; }
.legend-box.blue { background:#e0e7ff; }
.legend-box.orange { background:#ffedd5; }

.mapping-list { display:flex; flex-direction:column; gap:8px; margin-top:12px; }
.mapping-row { background:white; border:1px solid #e5e7eb; border-radius:13px; padding:10px; display:grid; grid-template-columns:150px 1fr 90px 70px; gap:8px; align-items:center; }
.mapping-room { display:flex; flex-direction:column; }
.mapping-room span { color:#6b7280; font-size:11px; }
.mapping-enabled { display:flex; align-items:center; gap:5px; margin:0; font-size:12px; }
.mapping-enabled input { width:auto; }
.success-box,.error-box { margin-top:14px; padding:13px 15px; border-radius:12px; }
.success-box { background:#ecfdf5; border:1px solid #a7f3d0; color:#065f46; }
.error-box { background:#fef2f2; border:1px solid #fecaca; color:#991b1b; }
.integration-status { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:16px; }
.integration-status > div { background:white; border:1px solid #e5e7eb; border-radius:14px; padding:14px; }
.integration-status span { display:block; color:#6b7280; font-size:12px; }
.integration-status strong { display:block; margin-top:5px; font-size:16px; }
.integration-actions { display:flex; gap:8px; margin-top:14px; flex-wrap:wrap; }
code { background:#f3f4f6; padding:2px 5px; border-radius:5px; }

@media (max-width:640px) {
  .mapping-row { grid-template-columns:90px 1fr; }
  .mapping-row .mapping-enabled { grid-column:1 / 2; }
  .mapping-row .btn { grid-column:2 / 3; }
  .integration-status { grid-template-columns:1fr; }
  .naver-sync-strip { align-items:flex-start; }
}
