/* ========================================
   기획2 - 어디아파 V2
   컴팩트 / 지역기반 / 사용자 편의 중심
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { color: inherit; font: inherit; }

:root {
  --primary: #0891B2;
  --primary-light: #E0F7FA;
  --primary-dark: #0E7490;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --success: #16A34A;
  --warning: #EAB308;
  --danger: #DC2626;
  --orange: #F97316;
  --open: #16A34A;
  --closing: #EAB308;
  --closed: #9CA3AF;
  --lunch: #F97316;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --header-h: 44px;
  --region-h: 36px;
  --nav-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --bg: #0F172A;
  --card: #1E293B;
  --text: #F1F5F9;
  --text-2: #94A3B8;
  --text-3: #64748B;
  --border: #334155;
  --border-light: #1E293B;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
  --primary-light: #164E63;
}

html { font-size: 13px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font: inherit; }
ul, ol { list-style: none; }

/* --- Layout --- */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* --- Header --- */
#header {
  height: var(--header-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}
.logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.header-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--border-light); }
.icon-btn svg { width: 18px; height: 18px; }

/* --- Region Bar --- */
#region-bar {
  height: var(--region-h);
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  z-index: 99;
}
.region-bar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
  font-size: 12px;
}
.region-icon {
  display: flex;
  color: var(--primary);
}
#region-text {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.region-change-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  padding: 2px 8px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: all 0.15s;
}
.region-change-btn:hover {
  background: var(--primary);
  color: white;
}

/* --- Content --- */
#content {
  flex: 1;
  padding: 12px;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Bottom Nav --- */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  color: var(--text-2);
  transition: color 0.15s;
  font-size: 10px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--primary); }
.nav-item.active svg { stroke-width: 2.5; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-content {
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-3);
  border-radius: var(--radius-full);
}
.modal-close:hover { background: var(--border-light); }
.modal-body {
  padding: 12px 16px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Region Selector */
.region-label {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 8px;
  font-weight: 500;
}
.region-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.region-btn {
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  transition: all 0.15s;
  background: var(--card);
  color: var(--text);
}
.region-btn:hover, .region-btn:active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.region-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}
.region-back-row {
  margin-bottom: 8px;
}
.btn-back {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  padding: 4px 0;
}
.region-btn-all {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.region-btn-all.selected {
  background: var(--primary);
  color: white;
}
/* 지역 확인 버튼 */
.region-confirm-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.region-confirm-btn:hover { background: var(--primary-dark); }
.region-confirm-btn[hidden] { display: none; }

/* 도시 필터 칩 (검색 결과 상단) */
.city-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.city-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.city-chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  font-weight: 600;
}

/* --- Home Page --- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.home-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border-light);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.home-card:active { transform: scale(0.97); }
.home-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.home-card-icon.hospital { background: #DBEAFE; color: #2563EB; }
.home-card-icon.pharmacy { background: #D1FAE5; color: #059669; }
.home-card-icon.emergency { background: #FEE2E2; color: #DC2626; }
.home-card-icon.symptom { background: #FEF3C7; color: #D97706; }
.home-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.quick-section {
  margin-bottom: 16px;
}
.quick-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
  padding-left: 2px;
}
.quick-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: var(--card);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.quick-item:active { background: var(--border-light); }
.quick-item-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}
.quick-item-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}
.quick-item-arrow {
  color: var(--text-3);
  font-size: 14px;
}
.quick-hint {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
  margin-top: 8px;
}

.emergency-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
}
[data-theme="dark"] .emergency-strip {
  background: #450A0A;
  border-color: #7F1D1D;
}
.emergency-strip:active { opacity: 0.8; }
.emergency-strip-icon {
  font-size: 16px;
}
.emergency-strip-text {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
}
.emergency-strip-number {
  font-size: 14px;
  font-weight: 700;
  color: var(--danger);
}

/* --- Facility Cards (Search/Pharmacy) --- */
.page-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}
.result-count {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.dept-filter-bar {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.dept-filter-bar::-webkit-scrollbar { display: none; }
.dept-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--card);
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.dept-chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}
.filter-chip {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--card);
  color: var(--text);
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}
.filter-chip.sort-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.filter-chip.sort-chip svg { flex-shrink: 0; }
.filter-chip.loading {
  opacity: 0.7;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }
.fc-distance {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 8px;
  margin-right: 4px;
  vertical-align: middle;
}
.facility-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.facility-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.facility-card:active { box-shadow: var(--shadow-md); }
.fc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.fc-name {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  line-height: 1.3;
}
.fc-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}
.fc-status.open { background: #DCFCE7; color: #15803D; }
.fc-status.closing { background: #FEF9C3; color: #A16207; }
.fc-status.closed { background: #F3F4F6; color: #6B7280; }
.fc-status.lunch { background: #FFEDD5; color: #C2410C; }
.fc-status.unknown { background: #F3F4F6; color: #9CA3AF; }
[data-theme="dark"] .fc-status.open { background: #14532D; color: #86EFAC; }
[data-theme="dark"] .fc-status.closing { background: #713F12; color: #FDE047; }
[data-theme="dark"] .fc-status.closed { background: #374151; color: #9CA3AF; }
[data-theme="dark"] .fc-status.lunch { background: #7C2D12; color: #FDBA74; }
[data-theme="dark"] .fc-status.unknown { background: #374151; color: #6B7280; }

.fc-address {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fc-dept {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fc-schedule-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr;
  gap: 1px 6px;
  font-size: 11px;
  margin: 4px 0 2px;
  align-items: center;
}
.fc-sched-label {
  color: var(--text-3);
  font-weight: 500;
}
.fc-sched-time {
  color: var(--text-1);
}
.fc-sched-time.off {
  color: var(--text-3);
}
.fc-lunch {
  font-size: 10px;
  color: var(--orange);
  font-weight: 500;
  margin: 2px 0 0;
}
.fc-lunch.no-lunch {
  color: var(--text-3);
}
.fc-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fc-hours {
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.fc-hours svg { width: 12px; height: 12px; flex-shrink: 0; }
.fc-actions {
  display: flex;
  gap: 4px;
}
.fc-action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  transition: all 0.15s;
}
.fc-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.fc-action-btn svg { width: 14px; height: 14px; }
.fc-action-btn.call { color: var(--success); border-color: var(--success); }
.fc-action-btn.call:hover { background: var(--success); color: white; }
.fc-action-btn.nav { color: var(--primary); border-color: var(--primary); }
.fc-action-btn.nav:hover { background: var(--primary); color: white; }

/* Badge */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  margin-right: 4px;
}
.badge.night { background: #312E81; color: #C7D2FE; }
.badge.weekend { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.badge.emergency-badge { background: #FEE2E2; color: #DC2626; }
[data-theme="dark"] .badge.weekend { background: #14532D; color: #86EFAC; border-color: #166534; }

/* --- Detail Page --- */
.detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.btn-back-page {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}
.btn-back-page svg { width: 18px; height: 18px; }
.detail-name {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}
.detail-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  margin-bottom: 10px;
}
.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.detail-row + .detail-row { border-top: 1px solid var(--border-light); }
.detail-label {
  font-weight: 600;
  color: var(--text-2);
  min-width: 60px;
  font-size: 12px;
}
.detail-value {
  flex: 1;
  word-break: break-all;
}
.detail-value-action {
  display: flex;
  align-items: center;
  gap: 6px;
}
.inline-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  text-decoration: none;
}
.inline-action-btn:active {
  background: var(--primary);
  color: white;
}
.detail-phone-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.detail-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  transition: all 0.15s;
}
.detail-action-btn svg { width: 16px; height: 16px; }
.detail-action-btn.call {
  color: var(--success);
  border-color: var(--success);
}
.detail-action-btn.call:hover { background: var(--success); color: white; }
.detail-action-btn.nav-btn {
  color: var(--primary);
  border-color: var(--primary);
}
.detail-action-btn.nav-btn:hover { background: var(--primary); color: white; }

.schedule-table {
  width: 100%;
  font-size: 12px;
}
.schedule-table tr + tr td { border-top: 1px solid var(--border-light); }
.schedule-table td {
  padding: 5px 0;
}
.schedule-table .day { font-weight: 600; color: var(--text-2); width: 50px; }
.schedule-table .time { color: var(--text); }
.schedule-table .off { color: var(--text-3); }

/* --- Emergency Page --- */
.er-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.er-notice {
  font-size: 11px;
  color: var(--danger);
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
  line-height: 1.4;
}
[data-theme="dark"] .er-notice {
  background: #450A0A;
  border-color: #7F1D1D;
}
.er-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}
.er-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.er-name {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  line-height: 1.3;
}
.er-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.er-status.normal { background: #DCFCE7; color: #15803D; }
.er-status.busy { background: #FEF9C3; color: #A16207; }
.er-status.crowded { background: #FFEDD5; color: #C2410C; }
.er-status.full { background: #FEE2E2; color: #DC2626; }
[data-theme="dark"] .er-status.normal { background: #14532D; color: #86EFAC; }
[data-theme="dark"] .er-status.busy { background: #713F12; color: #FDE047; }
[data-theme="dark"] .er-status.crowded { background: #7C2D12; color: #FDBA74; }
[data-theme="dark"] .er-status.full { background: #450A0A; color: #FCA5A5; }

.er-address {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.er-beds {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.er-bed {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  background: var(--border-light);
}
[data-theme="dark"] .er-bed { background: var(--border); }
.er-bed-label {
  font-size: 10px;
  color: var(--text-3);
  margin-bottom: 2px;
}
.er-bed-count {
  font-size: 14px;
  font-weight: 700;
}
.er-bed-count.available { color: var(--success); }
.er-bed-count.caution { color: var(--warning); }
.er-bed-count.full { color: var(--danger); }
.er-bed-total {
  font-size: 10px;
  color: var(--text-3);
}
.er-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.er-wait {
  font-size: 11px;
  color: var(--text-2);
}
.er-updated {
  font-size: 10px;
  color: var(--text-3);
}

/* --- Symptoms Page --- */
.body-parts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.body-part-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  transition: all 0.15s;
}
.body-part-btn:active { transform: scale(0.97); }
.body-part-btn .bp-icon { font-size: 24px; }
.body-part-btn .bp-name { font-size: 12px; font-weight: 600; }

.symptom-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.symptom-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}
.symptom-item:active { background: var(--border-light); }
.symptom-item .s-name { flex: 1; font-size: 13px; font-weight: 500; }
.symptom-item .s-desc { font-size: 11px; color: var(--text-2); }
.symptom-item .s-arrow { color: var(--text-3); }

.dept-result {
  padding: 14px;
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}
.dept-result h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}
.dept-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.dept-tag {
  padding: 5px 12px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.dept-tag:hover { background: var(--primary); color: white; }
.emergency-warning {
  padding: 10px 12px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--danger);
  margin-top: 8px;
}
[data-theme="dark"] .emergency-warning {
  background: #450A0A;
  border-color: #7F1D1D;
}

/* --- Settings Page --- */
.settings-group {
  margin-bottom: 16px;
}
.settings-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  padding-left: 2px;
}
.settings-list {
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  gap: 12px;
}
.settings-item + .settings-item { border-top: 1px solid var(--border-light); }
.settings-item-label {
  font-size: 13px;
  font-weight: 500;
}
.settings-item-desc {
  font-size: 11px;
  color: var(--text-3);
}
.settings-item-value {
  font-size: 12px;
  color: var(--text-2);
}

/* Toggle switch */
.toggle {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.active { background: var(--primary); }
.toggle::after {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.toggle.active::after { transform: translateX(18px); }

/* Small button */
.btn-sm {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  transition: all 0.15s;
}
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* --- Cache info --- */
.cache-info {
  font-size: 10px;
  color: var(--text-3);
}
.cache-refresh-btn {
  font-size: 10px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0 2px;
}

/* --- Skeleton loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-card {
  height: 80px;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
}

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
}
.empty-state-icon { font-size: 32px; margin-bottom: 8px; }
.empty-state-text { font-size: 13px; }
.empty-state-sub { font-size: 11px; margin-top: 4px; }

/* --- Utilities --- */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }

/* --- Region required notice --- */
.region-notice {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-2);
}
.region-notice-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.region-notice-text {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
}
.region-notice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
}

/* --- Quick Search Page --- */
.quick-search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.btn-back-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border-light);
  color: var(--text);
  flex-shrink: 0;
}
.btn-back-page svg { width: 18px; height: 18px; }
.quick-search-title {
  font-size: 16px;
  font-weight: 700;
}
.quick-search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}
.qs-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.qs-loading-text {
  font-size: 13px;
  color: var(--text-2);
}
.qs-location-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 4px;
}
.qs-location-info svg { flex-shrink: 0; }

/* PC responsive */
@media (min-width: 481px) {
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
