:root {
  --bg: #fff8ef;
  --panel: #ffffff;
  --text: #2f2925;
  --muted: #786a61;
  --line: #eadfd6;
  --brand: #6c5142;
  --brand-dark: #594137;
  --soft: #f3ebe4;
  --success: #237a3b;
  --success-bg: #eaf7ee;
  --danger: #a02f2a;
  --danger-bg: #fff0ef;
  --warning: #8b6514;
  --senior: #a85e35;
  --guardian: #4d6f8c;
  --care-worker: #4f7b63;
  --shadow: 0 10px 30px rgba(64, 45, 32, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.6;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
[hidden] { display: none !important; }

.page-shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 32px; }
.page-header, .dashboard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow, .section-kicker { margin: 0 0 6px; color: #9a7865; font-size: 12px; font-weight: 800; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 5vw, 46px); line-height: 1.15; }
h2 { margin-bottom: 6px; font-size: 24px; }
.page-description, .help-text { margin-bottom: 0; color: var(--muted); }
.home-link, .footer a { color: var(--brand); font-weight: 700; text-decoration: none; }
.home-link:hover, .footer a:hover { text-decoration: underline; }

.panel { margin-bottom: 22px; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); }
.auth-panel { max-width: 720px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.badge { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-muted { background: #eee9e5; color: #756b65; }
.badge-live { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-top: 20px; }
.field { display: grid; gap: 7px; color: #51463f; font-weight: 700; }
.field input { width: 100%; min-height: 52px; padding: 11px 13px; border: 1px solid #d9ccc2; border-radius: 12px; background: #fffdfb; color: var(--text); outline: none; }
.field input:focus { border-color: #9e7762; box-shadow: 0 0 0 3px rgba(108,81,66,.12); }
.button { min-height: 50px; padding: 10px 17px; border-radius: 12px; border: 1px solid transparent; font-weight: 800; }
.button-primary { background: var(--brand); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--brand-dark); }
.button-secondary { background: var(--soft); color: var(--brand); }
.button-outline { border-color: #cbb9ad; background: #fff; color: var(--brand); }
.button-link { margin-top: 8px; padding-left: 0; border: 0; background: transparent; color: var(--brand); }
.recaptcha-box { min-height: 12px; margin-top: 16px; }
.verification-area { margin-top: 8px; }
.message { min-height: 24px; margin: 15px 0 0; color: var(--muted); font-size: 14px; }
.message-success { color: var(--success); }
.message-error { color: var(--danger); }
.message-warning { color: var(--warning); }

.loading-row { display: flex; align-items: center; gap: 16px; }
.spinner { width: 36px; height: 36px; border: 4px solid #eadfd6; border-top-color: var(--brand); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dashboard-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-height: 130px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 6px 18px rgba(64,45,32,.05); }
.stat-label { display: block; color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-value { display: block; margin-top: 8px; font-size: 34px; line-height: 1.2; }
.stat-senior { color: var(--senior); }
.stat-guardian { color: var(--guardian); }
.stat-care-worker { color: var(--care-worker); }
.stat-suspended { color: var(--danger); }
.stat-note { margin: 10px 2px 22px; color: #8e8178; font-size: 13px; }

.menu-panel { margin-top: 8px; }
.menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.menu-card { min-height: 105px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--text); text-align: left; }
.menu-card:hover { border-color: #c9b5a7; background: #fffdfa; }
.menu-card-live { border-color: #b7d9c0; background: #f6fcf7; }
.menu-card span { display: block; margin-bottom: 5px; font-size: 17px; font-weight: 800; }
.menu-card small { color: var(--muted); }
.footer { display: flex; justify-content: center; gap: 10px; padding: 10px 0 24px; color: #a0948c; font-size: 14px; }

@media (max-width: 820px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .page-shell { width: min(100% - 22px, 1080px); padding-top: 22px; }
  .page-header, .dashboard-top { display: grid; }
  .home-link { justify-self: start; }
  .panel { padding: 18px; border-radius: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .button { width: 100%; }
  .dashboard-actions { justify-content: flex-start; }
  .stats-grid, .menu-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 110px; }
  #recaptcha-container { overflow-x: auto; }
}


/* 운영자 30분 세션 만료 안내 */
.admin-session-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(35, 28, 24, 0.62);
}

.admin-session-modal[hidden] {
  display: none !important;
}

.admin-session-dialog {
  width: min(480px, 100%);
  padding: 26px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(35, 28, 24, 0.28);
}

.admin-session-kicker {
  margin: 0 0 6px;
  color: #a02f2a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.admin-session-dialog h2 {
  margin-bottom: 10px;
}

.admin-session-text {
  margin-bottom: 16px;
  color: var(--muted);
}

.admin-session-countdown {
  margin: 0 0 20px;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--warning-bg);
  color: var(--warning);
  text-align: center;
}

.admin-session-countdown strong {
  margin-left: 4px;
  font-size: 20px;
}

.admin-session-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

@media (max-width: 520px) {
  .admin-session-dialog {
    padding: 20px;
  }

  .admin-session-actions {
    flex-direction: column;
  }

  .admin-session-actions .button {
    width: 100%;
  }
}
