/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:     #2563EB;
  --primary-dk:  #1D4ED8;
  --success:     #16A34A;
  --danger:      #DC2626;
  --warning:     #D97706;
  --gray-50:     #F9FAFB;
  --gray-100:    #F3F4F6;
  --gray-200:    #E5E7EB;
  --gray-300:    #D1D5DB;
  --gray-400:    #9CA3AF;
  --gray-500:    #6B7280;
  --gray-700:    #374151;
  --gray-900:    #111827;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.10);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Apple SD Gothic Neo',
               'Noto Sans KR', sans-serif;
  font-size: 16px;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
}

/* ── Auth 화면 (로그인·회원가입) ─────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1rem 3rem;
  background: var(--gray-50);
}

.auth-header-nav {
  width: 100%;
  max-width: 420px;
  margin-bottom: 0.5rem;
}

.btn-back {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.25rem 0;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-mark {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

.logo-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-900);
}

.logo-sub {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.75rem 1.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--gray-900);
}

.success-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #DCFCE7;
  color: var(--success);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.success-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.success-sub {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ── Form ─────────────────────────────────────── */
.form-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--gray-200);
}

.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}

.required {
  color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--gray-900);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.6;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 0.3rem;
}

/* ── 동의서 ───────────────────────────────────── */
.consent-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 1rem;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.consent-text {
  font-size: 0.82rem;
  color: var(--gray-700);
  line-height: 1.7;
}

.consent-checks {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}

.check-input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--primary);
  cursor: pointer;
}

.check-text {
  font-size: 0.88rem;
  color: var(--gray-700);
  line-height: 1.4;
}

/* ── Buttons ──────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 0.85rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary:hover { background: var(--primary-dk); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  background: #fff;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--gray-100); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  background: #FEE2E2;
  color: var(--danger);
  border: 1.5px solid #FECACA;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  background: #DCFCE7;
  color: var(--success);
  border: 1.5px solid #BBF7D0;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.auth-footer-text {
  font-size: 0.88rem;
  color: var(--gray-500);
}

/* ── Error / Alert ────────────────────────────── */
.error-banner {
  background: #FEE2E2;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.error-banner.hidden { display: none; }

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 99px;
  font-size: 0.9rem;
  z-index: 1000;
  animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── 모바일 기록 화면 ─────────────────────────── */
.recorder-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
  max-width: 480px;
  margin: 0 auto;
}

.recorder-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.recorder-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.recorder-header-sub {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.recorder-content {
  flex: 1;
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

/* 어르신 카드 */
.elder-card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-200);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.elder-card:active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.elder-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
}

.elder-meta {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 0.2rem;
}

/* 상태 배지 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-draft     { background: var(--gray-100); color: var(--gray-500); }
.badge-submitted { background: #DBEAFE; color: #1D4ED8; }
.badge-approved  { background: #DCFCE7; color: var(--success); }
.badge-none      { background: var(--gray-100); color: var(--gray-400); }

/* ── 관리자 웹 레이아웃 ───────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 20;
}

.admin-sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}

.admin-sidebar-logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.admin-sidebar-logo-sub {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.1rem;
}

.admin-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.25rem;
  font-size: 0.9rem;
  color: var(--gray-700);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
  transition: background 0.1s;
}

.admin-nav-item:hover { background: var(--gray-50); }
.admin-nav-item.active {
  background: #EFF6FF;
  color: var(--primary);
  font-weight: 600;
}

.admin-nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.admin-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-100);
}

.admin-main {
  margin-left: 220px;
  flex: 1;
  padding: 2rem;
  min-height: 100vh;
}

.admin-page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1.5rem;
}

/* ── Table (관리자) ───────────────────────────── */
.data-table-wrap {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-900);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

.data-table .clickable { cursor: pointer; }

/* ── Card (관리자) ────────────────────────────── */
.admin-card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.admin-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--gray-900);
}

/* ── 반응형 (관리자 사이드바 모바일) ─────────── */
@media (max-width: 768px) {
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    flex-direction: row;
    align-items: center;
  }
  .admin-main { margin-left: 0; padding: 1rem; }
  .admin-nav { display: flex; flex-direction: row; padding: 0; }
  .admin-nav-item { padding: 0.6rem 0.75rem; font-size: 0.8rem; }
  .admin-nav-icon { display: none; }
  .admin-sidebar-footer { display: none; }
  .admin-sidebar-logo { padding: 0.75rem 1rem; border-bottom: none; border-right: 1px solid var(--gray-100); }
}

/* ── 기타 유틸 ────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--gray-400); font-size: 0.88rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 1.25rem 0;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--gray-400);
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.empty-state-text {
  font-size: 0.9rem;
}

/* ── 승인완료 카드 비활성 ─────────────────────── */
.elder-card-done {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
