:root {
  /* Warm editorial Korean clinic palette */
  --bg: #f6f7f3;
  --bg-tint: #eef3ee;
  --surface: #ffffff;
  --surface-raised: #fbfcf9;
  --primary: #153e3b;
  --primary-hover: #0e2d2b;
  --primary-light: #dfeee6;
  --primary-subtle: #f0f7f3;
  --sage: #dfeee6;
  --sage-border: #bcd8cd;
  --text: #182e2b;
  --text-muted: #4e6561;
  --text-subtle: #79908b;
  --border: #dbe4df;
  --border-focus: #153e3b;
  --border-hover: #b8c8c2;
  --danger: #c0392b;
  --danger-light: #fdf2f0;
  --danger-border: #f5c6cb;
  --warning: #b7791f;
  --warning-light: #fefcbf;
  --warning-border: #fbd38d;
  --success: #2e7d58;
  --success-light: #e8f5ec;
  --success-border: #a3d9b8;

  /* Shadows and radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-subtle: 0 2px 10px rgba(21, 62, 59, 0.04), 0 1px 3px rgba(21, 62, 59, 0.03);
  --shadow-hover: 0 6px 20px rgba(21, 62, 59, 0.08), 0 2px 6px rgba(21, 62, 59, 0.04);
  --shadow-active: 0 2px 6px rgba(21, 62, 59, 0.12);

  /* Typography scale */
  --font-family: -apple-system, BlinkMacSystemFont, "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* Common Header & Brand */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.brand__text {
  display: flex;
  flex-direction: column;
}

.brand__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand__name {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.brand__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--sage);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand__sub {
  font-size: 12px;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-nav__link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.header-nav__link:hover {
  color: var(--primary);
}

@media (max-width: 768px) {
  .header-nav {
    display: none;
  }
}

/* Layout Wrappers */
.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.wrap--patient,
.wrap--narrow {
  max-width: 640px;
}

.wrap--result {
  max-width: 860px;
}

main {
  padding: 28px 20px 80px;
}

/* Card & Surface */
.card {
  margin: 0 0 20px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Typography Hierarchy */
.page-title {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--primary);
  letter-spacing: -0.025em;
}

.section-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* Suppress programmatic focus rectangle on heading */
.step-title {
  margin: 12px 0 8px;
  font-size: clamp(22px, 3.8vw, 26px);
  font-weight: 800;
  line-height: 1.35;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.step-title:focus {
  outline: none;
}

.note {
  margin: 6px 0;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.note--success {
  color: var(--success);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: -0.01em;
}

.btn:hover {
  border-color: var(--border-hover);
  background-color: var(--surface-raised);
}

.btn:active {
  transform: scale(0.985);
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(21, 62, 59, 0.2);
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn--secondary:hover {
  background: var(--bg-tint);
  border-color: var(--sage-border);
  color: var(--primary);
}

.btn--sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 10px;
}

.btn--block {
  width: 100%;
}

.btn--cta {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
  margin-top: 14px;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Fields & Inputs */
.field {
  margin: 0 0 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 62, 59, 0.12);
}

.input--readonly {
  background: var(--bg-tint);
  color: var(--text-muted);
  border-style: dashed;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%234e6561' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-row .input {
  flex: 1;
}

.copy-row .btn {
  flex: none;
}

/* Accessible focus visible for interactive controls */
.btn:focus-visible,
.input:focus-visible,
.kind-card input:focus-visible,
.option input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Error Alert */
.error-box {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}

.error-box:empty {
  display: none;
}

/* Generic Row List */
.rows {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.row:hover {
  border-color: var(--sage-border);
  box-shadow: var(--shadow-subtle);
  transform: translateY(-1px);
}

.row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.row__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.row__status {
  font-size: 12.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-tint);
  color: var(--text-muted);
}

.row__meta {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.row__error {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
  font-weight: 600;
}

/* Print Utilities */
@media print {
  .no-print {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
  .card {
    box-shadow: none;
    border: 1px solid #cccccc;
  }
}
