*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #0f3f68;
  --brand-mid: #1a5a96;
  --accent: #0374d8;
  --accent-hover: #025fb8;
  --bg: #eef2f7;
  --surface: #ffffff;
  --border: #ccd8e8;
  --border-focus: #0374d8;
  --text-primary: #0D1B2A;
  --text-secondary: #4a5f74;
  --text-hint: #8fa3b8;
  --input-bg: #f5f8fc;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15,63,104,0.08), 0 4px 16px rgba(15,63,104,0.06);
}

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ── Header ── */
.header {
  background: white;
  border-bottom: 3px solid var(--accent);
  padding: 0 28px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo img {
  height: 40px;
  width: auto;
  display: block;
}
.header-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.25);
}
.header-title {
  font-size: 15px;
  font-weight: 600;
  color: black;
  letter-spacing: -0.01em;
}

/* ── Page layout ── */
.page {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 16px 48px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}
.card-section:last-child { border-bottom: none; }

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Grid ── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ── Fields ── */
.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field input,
.field select {
  height: 40px;
  padding: 0 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.field input::placeholder { color: var(--text-hint); }
.field input:hover,
.field select:hover { border-color: #b0bec5; }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(3,116,255,0.12);
}

/* custom select arrow */
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239AAAB8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ── Two-column layout for patient + orientation ── */
.top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.top-col {
  padding: 24px 28px;
}
.top-col:first-child {
  border-right: 1px solid var(--border);
}

/* ── Footer / action bar ── */
.card-footer {
  padding: 20px 28px;
  display: flex;
  justify-content: flex-end;
  background: #eef2f7;
  border-top: 1px solid var(--border);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 0 28px;
  height: 42px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary svg { width: 16px; height: 16px; }

/* ── Responsive ── */
@media (max-width: 680px) {
  .page { margin: 16px auto; }
  .top-grid { grid-template-columns: 1fr; }
  .top-col:first-child { border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .col-span-2 { grid-column: span 1; }
  .col-span-3 { grid-column: span 2; }
  .card-section { padding: 20px 16px; }
  .top-col { padding: 20px 16px; }
  .card-footer { padding: 16px; }
}

@media (max-width: 420px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .col-span-3 { grid-column: span 1; }
}