:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #647084;
  --line: #d9e1ec;
  --panel: #ffffff;
  --paper: #f5f8fb;
  --mint: #0f9f8f;
  --mint-dark: #087366;
  --coral: #ef6b5b;
  --amber: #f1b44c;
  --navy: #203454;
  --lavender: #8c78d8;
  --shadow: 0 24px 70px rgba(28, 42, 64, 0.16);
  font-family: Inter, "Pretendard", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 159, 143, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(239, 107, 91, 0.12), transparent 32%),
    var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  min-height: 100vh;
}

.brief-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 36px 28px;
  border-right: 1px solid rgba(24, 33, 47, 0.08);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  background: var(--navy);
  color: white;
  font-weight: 800;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eef4f7;
}

.mode-tab {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-tab.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(25, 45, 65, 0.08);
}

.project-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.project-card h2 {
  margin-bottom: 12px;
  font-size: 17px;
}

.project-card ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.tech-note p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.preview-stage {
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 36px;
}

.patient-preview,
.admin-preview {
  display: grid;
  width: 100%;
  place-items: center;
}

.hidden {
  display: none !important;
}

.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 48px));
  min-height: 720px;
  overflow: hidden;
  border: 10px solid #172033;
  border-radius: 38px;
  background: #f7fafc;
  box-shadow: var(--shadow);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 12px 22px 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.phone-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px 10px;
}

.phone-header h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--navy);
  font-size: 20px;
  font-weight: 800;
}

.progress-rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 22px 16px;
}

.progress-dot {
  height: 5px;
  border-radius: 999px;
  background: #dce5ee;
}

.progress-dot.active {
  background: var(--mint);
}

.screen {
  display: none;
  flex: 1;
  overflow: auto;
  padding: 4px 22px 92px;
}

.screen.active {
  display: block;
}

.hero-band {
  min-height: 170px;
  margin-bottom: 24px;
  padding: 22px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(32, 52, 84, 0.92), rgba(15, 159, 143, 0.78)),
    url("https://images.unsplash.com/photo-1588776814546-daab30f310ce?auto=format&fit=crop&w=900&q=80");
  background-position: center;
  background-size: cover;
  color: white;
}

.hero-band p {
  max-width: 250px;
  margin-bottom: 0;
  line-height: 1.6;
  font-weight: 700;
}

.field-label,
.form-grid label span,
.pain-scale > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.text-field,
.form-grid input,
textarea,
.section-head input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

.text-field,
.form-grid input,
.section-head input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  resize: none;
  padding: 14px;
  line-height: 1.5;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  border: 0;
  background: var(--mint);
  color: white;
}

.primary-button:hover {
  background: var(--mint-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
}

.compact {
  width: auto;
  min-height: 42px;
  margin-top: 0;
  padding: 0 16px;
}

.helper-text {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.model-list {
  display: grid;
  gap: 10px;
}

.model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.model-option strong {
  font-size: 16px;
}

.model-option span {
  color: var(--muted);
  font-size: 13px;
}

.model-option.active {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(15, 159, 143, 0.14);
}

.result-panel,
.metric-row article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.result-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 18px;
}

.result-panel strong {
  color: var(--coral);
  font-size: 30px;
}

.result-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.metric-row article {
  padding: 16px;
}

.metric-row span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-row strong {
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
}

.form-grid label:first-child {
  grid-column: 1 / -1;
}

.pain-scale {
  margin: 18px 0;
}

#pain-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.pain-button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 900;
}

.pain-button.active {
  border-color: var(--amber);
  background: #fff4df;
  color: #9a6200;
}

.upload-box {
  display: grid;
  gap: 10px;
  place-items: center;
  min-height: 190px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px dashed #aebbc9;
  border-radius: 8px;
  background: white;
  text-align: center;
}

.camera-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: #eaf7f5;
  color: var(--mint-dark);
  font-size: 34px;
}

.upload-box p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.upload-box input {
  width: 100%;
  color: var(--muted);
}

.bottom-nav {
  position: absolute;
  right: 14px;
  bottom: 12px;
  left: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(24, 33, 47, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(24, 33, 47, 0.12);
}

.bottom-nav button {
  min-height: 42px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.bottom-nav button.active {
  background: var(--navy);
  color: white;
}

.admin-shell {
  width: min(980px, 100%);
  padding: 28px;
  border: 1px solid rgba(24, 33, 47, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.admin-header,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-header h2 {
  margin-bottom: 0;
  font-size: 30px;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 26px 0;
}

.admin-metrics article,
.patient-table,
.report-feed {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-metrics article {
  padding: 18px;
}

.admin-metrics span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-metrics strong {
  font-size: 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 16px;
}

.patient-table,
.report-feed {
  padding: 18px;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h3 {
  margin-bottom: 0;
}

.section-head input {
  max-width: 230px;
  min-height: 40px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 8px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
}

td {
  font-size: 14px;
  font-weight: 700;
}

.badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: #ffece9;
  color: #b23d31;
  font-size: 12px;
  font-weight: 900;
}

.report-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfd;
}

.report-item.urgent {
  border-color: rgba(239, 107, 91, 0.45);
  background: #fff5f3;
}

.report-item strong {
  display: block;
  margin-bottom: 8px;
}

.report-item p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.report-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .brief-panel {
    border-right: 0;
    border-bottom: 1px solid rgba(24, 33, 47, 0.08);
  }

  .admin-grid,
  .admin-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .preview-stage,
  .brief-panel {
    padding: 18px;
  }

  .phone {
    min-height: 720px;
    border-width: 6px;
    border-radius: 28px;
  }

  .admin-header,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head input {
    max-width: none;
  }

  th,
  td {
    padding: 12px 5px;
    font-size: 12px;
  }
}
