:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #eef3f5;
  --text: #172126;
  --muted: #60717a;
  --line: #d9e1e5;
  --teal: #087f8c;
  --teal-soft: #d9f0f2;
  --coral: #c94c4c;
  --amber: #b47b1f;
  --green: #2d7a46;
  --ink: #26363d;
  --shadow: 0 18px 45px rgba(22, 33, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.app-header {
  min-height: 132px;
  padding: 28px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #102127;
  color: white;
}

.eyebrow {
  margin: 0 0 8px;
  color: #8dd3d8;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.9rem, 3vw, 3.2rem);
  line-height: 1.12;
  font-weight: 780;
}

h2 {
  font-size: 1.02rem;
  line-height: 1.25;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 36px) 34px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 126px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-label,
.metric-note,
.panel-head p,
.decision-list p,
.route-card p,
.source-card p,
.hospital-card p,
.app-footer {
  color: var(--muted);
}

.metric-label {
  font-size: 0.82rem;
  font-weight: 760;
}

.metric strong {
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1;
  color: var(--ink);
}

.metric-note {
  font-size: 0.82rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  margin-bottom: 16px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.panel-head p {
  margin-top: 5px;
  font-size: 0.9rem;
}

.chart-panel {
  min-height: 430px;
}

#trend-chart {
  width: 100%;
  height: 330px;
  display: block;
}

.legend {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.swatch {
  width: 12px;
  height: 12px;
  display: inline-block;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -1px;
}

.swatch.lung {
  background: var(--teal);
}

.swatch.rolling {
  background: var(--coral);
}

.decision-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.decision-list,
.route-list,
.source-list,
.hospital-list {
  display: grid;
  gap: 10px;
}

.decision-list > div,
.route-card,
.source-card,
.hospital-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfc;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.status.good {
  color: var(--green);
  background: #e2f2e8;
}

.status.warn {
  color: var(--amber);
  background: #fff0d4;
}

.status.hold {
  color: #49545a;
  background: var(--surface-soft);
}

.decision-list p {
  margin-top: 8px;
  font-size: 0.9rem;
}

.route-card strong,
.source-card strong,
.hospital-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.route-meta,
.source-meta,
.hospital-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.hospital-panel {
  margin-bottom: 16px;
}

.hospital-form {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) 74px;
  gap: 8px;
  align-items: center;
  width: min(100%, 520px);
}

.hospital-form input,
.hospital-form button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  font: inherit;
}

.hospital-form button {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
  font-weight: 780;
  cursor: pointer;
}

.hospital-summary {
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.hospital-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 740;
}

.table-panel {
  overflow: hidden;
}

.select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 740;
}

select {
  height: 34px;
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text);
  padding: 0 10px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 0.9rem;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.positive {
  color: var(--green);
  font-weight: 760;
}

.negative {
  color: var(--coral);
  font-weight: 760;
}

.app-footer {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 36px) 28px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.82rem;
}

@media (max-width: 980px) {
  .summary-grid,
  .workspace-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-footer {
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .legend,
  .hospital-form {
    flex-direction: column;
    align-items: flex-start;
  }

  .hospital-form,
  .hospital-list {
    grid-template-columns: 1fr;
  }
}
