:root {
  --user: #2563eb;
  --user-soft: #eaf1ff;
  --hospital: #059669;
  --hospital-soft: #e8f8f2;
  --headquarters: #7c3aed;
  --headquarters-soft: #f2ebff;
  --ink: #162033;
  --muted: #667085;
  --line: #e5e9f0;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --success: #079455;
  --warning: #dc6803;
  --danger: #d92d20;
  --info: #175cd3;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 16px 40px rgba(16, 24, 40, 0.10);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.page-title { margin: 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.045em; }
.page-description { margin: 12px 0 0; color: var(--muted); line-height: 1.7; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.success { color: var(--success); background: #ecfdf3; }
.status-badge.warning { color: var(--warning); background: #fff6ed; }
.status-badge.danger { color: var(--danger); background: #fef3f2; }
.status-badge.info { color: var(--info); background: #eff8ff; }
.status-badge.neutral { color: #475467; background: #f2f4f7; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 800;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent, var(--user)); color: white; }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: #fff1f0; color: var(--danger); border-color: #fecdca; }
.btn-sm { min-height: 34px; padding: 7px 11px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { padding: 18px; }
.metric-card .label { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-card .value { margin-top: 10px; font-size: 28px; font-weight: 900; letter-spacing: -.04em; }
.metric-card .trend { margin-top: 8px; color: var(--muted); font-size: 12px; }

.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 16px; color: #475467; background: #f8fafc; text-align: left; font-size: 12px; white-space: nowrap; }
td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fafbfc; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.search-field input { width: 220px; border: 0; outline: 0; background: transparent; color: var(--ink); }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}
.chip.active { color: var(--accent, var(--user)); border-color: color-mix(in srgb, var(--accent, var(--user)) 35%, white); background: color-mix(in srgb, var(--accent, var(--user)) 8%, white); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  background: #101828;
  color: white;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent); color: white; font-weight: 900; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.brand-copy strong { display: block; font-size: 15px; }
.brand-copy span { color: #98a2b3; font-size: 11px; }
.nav-group-label { margin: 18px 10px 8px; color: #667085; font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.side-nav { display: grid; gap: 5px; }
.side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d0d5dd;
  text-align: left;
  font-weight: 700;
}
.side-nav button:hover { background: rgba(255,255,255,.06); color: white; }
.side-nav button.active { background: color-mix(in srgb, var(--accent) 28%, transparent); color: white; }
.side-nav .nav-icon { width: 22px; text-align: center; }

.workspace { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 70px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(14px); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, white); color: var(--accent); font-size: 12px; font-weight: 900; }
.main-content { padding: 28px; }
.view-panel { display: none; animation: reveal .22s ease; }
.view-panel.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 20px; }
.section-heading h1 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 24, 40, .55);
  backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal-dialog { width: min(520px, 100%); max-height: 88vh; overflow: auto; padding: 24px; background: white; border-radius: 20px; box-shadow: var(--shadow-md); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-header h2 { margin: 0; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

.toast {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  padding: 14px 16px;
  border-radius: 13px;
  background: #101828;
  color: white;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: #05603a; }
.toast.warning { background: #93370d; }

.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { font-size: 34px; }
.empty-state strong { display: block; margin-top: 10px; color: var(--ink); }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 18px 10px; }
  .brand-copy, .nav-group-label, .side-nav button span:not(.nav-icon) { display: none; }
  .brand { justify-content: center; padding-inline: 0; }
  .side-nav button { justify-content: center; padding-inline: 0; }
  .topbar { padding: 0 16px; }
  .main-content { padding: 18px 14px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-field input { width: 100%; }
  .metric-grid { grid-template-columns: 1fr; }
}

