:root {
  --patient-primary: #3f8f52;
  --patient-primary-dark: #2f7945;
  --patient-accent: #e7aa2d;
  --surface: #ffffff;
  --surface-muted: #f6f8f7;
  --line: #e7e9eb;
  --text: #202329;
  --muted: #72777f;
  --danger: #b42318;
  --success: #087443;
  --shadow: 0 18px 40px rgba(16, 24, 40, 0.14);
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.patient-page {
  min-height: 100vh;
  background: var(--patient-primary);
  color: var(--text);
}

.mobile-shell-bar {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  min-height: 96px;
  padding: 14px 12px 10px;
  background: #f5f5f5;
  color: #111318;
  text-align: center;
}

.shell-close,
.shell-menu {
  color: #111318;
  font-size: 42px;
  line-height: 1;
  text-decoration: none;
}

.shell-menu {
  font-size: 30px;
  letter-spacing: 3px;
}

.shell-title {
  font-size: 28px;
  font-weight: 500;
}

.shell-subtitle {
  margin-top: 6px;
  color: #70747a;
  font-size: 22px;
  line-height: 1;
}

.patient-main {
  min-height: calc(100vh - 96px);
  padding: 40px 28px 80px;
}

.patient-wrap {
  width: min(878px, 100%);
  margin: 0 auto;
}

.patient-wrap > h1 {
  margin: 0 0 34px;
  color: #ffffff;
  font-size: clamp(30px, 6vw, 42px);
  font-weight: 500;
  text-align: center;
}

.appointment-panel {
  padding: 28px 24px 32px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 8px 28px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  color: var(--patient-primary-dark);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
}

.scan-mark {
  position: relative;
  width: 62px;
  height: 48px;
  flex: 0 0 auto;
}

.scan-mark::before,
.scan-mark::after {
  position: absolute;
  inset: 0;
  border: 5px solid var(--patient-primary-dark);
  content: "";
}

.scan-mark::before {
  clip-path: polygon(0 0, 36% 0, 36% 12%, 12% 12%, 12% 42%, 0 42%, 0 0, 64% 0, 100% 0, 100% 42%, 88% 42%, 88% 12%, 64% 12%);
}

.scan-mark::after {
  clip-path: polygon(0 58%, 12% 58%, 12% 88%, 36% 88%, 36% 100%, 0 100%, 0 58%, 88% 58%, 100% 58%, 100% 100%, 64% 100%, 64% 88%, 88% 88%);
}

.doctor-chip {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 104px;
  margin: 0 0 34px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.02);
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 700;
}

.check-dot {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: #27b96f;
  color: #ffffff;
  font-size: 28px;
  font-weight: 700;
}

.field-row {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: start;
  gap: 0;
  margin: 28px 0;
}

.field-row label,
.field-row legend {
  padding: 18px 0 0 30px;
  color: #30343a;
  font-size: clamp(24px, 4.5vw, 34px);
  line-height: 1.2;
}

.field-row legend {
  float: left;
  width: 230px;
}

.field-control {
  min-width: 0;
}

.field-control input,
.filters input,
.filters select {
  width: 100%;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  font-size: clamp(22px, 4vw, 32px);
  outline: none;
  padding: 0 34px;
}

.field-control input:focus,
.filters input:focus,
.filters select:focus {
  border-color: var(--patient-primary);
  box-shadow: 0 0 0 4px rgba(63, 143, 82, 0.14);
}

.field-control input::placeholder {
  color: #8e9096;
}

.field-error {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 16px;
}

.visit-row {
  border: 0;
  padding: 0;
}

.visit-row::after {
  display: block;
  clear: both;
  content: "";
}

.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  min-height: 88px;
  align-items: center;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  font-size: clamp(24px, 4.5vw, 34px);
}

.radio-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.radio-dot {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid #c9ccd1;
  border-radius: 999px;
  background: #ffffff;
}

.radio-option input:checked + .radio-dot {
  border-color: #27b96f;
  background: #27b96f;
}

.radio-option input:checked + .radio-dot::after {
  color: #ffffff;
  content: "✓";
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.form-message {
  min-height: 28px;
  margin: 8px 30px 0;
  color: var(--muted);
  font-size: 18px;
}

.form-message[data-kind="success"] {
  color: var(--success);
  font-weight: 700;
}

.form-message[data-kind="error"] {
  color: var(--danger);
  font-weight: 700;
}

.submit-button {
  display: block;
  width: min(746px, calc(100% - 64px));
  min-height: 118px;
  margin: 72px auto 0;
  border: 0;
  border-radius: 14px;
  background: var(--patient-accent);
  color: #ffffff;
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.submit-button:focus-visible,
.secondary-button:focus-visible,
.primary-small-button:focus-visible {
  outline: 4px solid rgba(63, 143, 82, 0.35);
  outline-offset: 2px;
}

.not-found {
  width: min(720px, 100%);
  margin: 80px auto;
  padding: 36px;
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}

.not-found h1 {
  margin: 0 0 12px;
}

.admin-page {
  min-height: 100vh;
  background: #f5f7f8;
  color: var(--text);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.admin-header h1 {
  margin: 2px 0 0;
  font-size: clamp(28px, 4vw, 40px);
}

.eyebrow {
  margin: 0;
  color: var(--patient-primary-dark);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.admin-main {
  width: min(1220px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.doctor-admin-panel {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.doctor-admin-heading {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.2fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.doctor-admin-heading h2 {
  margin: 0;
  font-size: 22px;
}

.doctor-admin-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.doctor-admin-heading p span {
  color: var(--text);
  font-family: Consolas, "Segoe UI Mono", monospace;
}

.doctor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.doctor-list a {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #d7dfda;
  border-radius: 999px;
  color: var(--patient-primary-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doctor-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.doctor-form label {
  display: grid;
  gap: 8px;
  color: #48505a;
  font-size: 14px;
  font-weight: 700;
}

.doctor-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  padding: 0 12px;
}

.doctor-form input:focus {
  border-color: var(--patient-primary);
  box-shadow: 0 0 0 4px rgba(63, 143, 82, 0.14);
}

.doctor-form-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.doctor-form-status[data-kind="success"] {
  color: var(--success);
  font-weight: 700;
}

.doctor-form-status[data-kind="error"] {
  color: var(--danger);
  font-weight: 700;
}

.filters {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(140px, 0.8fr) minmax(180px, 1.2fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.filters label {
  display: grid;
  gap: 8px;
  color: #48505a;
  font-size: 14px;
  font-weight: 700;
}

.filters input,
.filters select {
  min-height: 44px;
  border-radius: 8px;
  font-size: 15px;
  padding: 0 12px;
}

.primary-small-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-small-button {
  border: 0;
  background: var(--patient-primary);
  color: #ffffff;
  padding: 0 22px;
}

.secondary-button {
  border: 1px solid #cfd6dc;
  background: #ffffff;
  color: #242930;
  padding: 0 18px;
}

.admin-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0;
  color: var(--muted);
}

.admin-summary span {
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
}

.admin-summary p {
  margin: 0;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f0f4f2;
  color: #38413c;
  font-size: 13px;
  letter-spacing: 0.03em;
}

td {
  font-size: 15px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 16px;
}

#page-info {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 760px) {
  .mobile-shell-bar {
    min-height: 76px;
    grid-template-columns: 44px 1fr 44px;
  }

  .shell-close {
    font-size: 34px;
  }

  .shell-title {
    font-size: 20px;
  }

  .shell-subtitle {
    font-size: 14px;
  }

  .patient-main {
    min-height: calc(100vh - 76px);
    padding: 30px 16px 56px;
  }

  .appointment-panel {
    padding: 20px 14px 22px;
  }

  .panel-heading {
    gap: 14px;
    padding-bottom: 20px;
  }

  .scan-mark {
    width: 46px;
    height: 36px;
  }

  .doctor-chip {
    min-height: 76px;
    margin-bottom: 18px;
    padding: 14px;
  }

  .field-row {
    grid-template-columns: 124px minmax(0, 1fr);
    margin: 18px 0;
  }

  .field-row label,
  .field-row legend {
    width: 124px;
    padding: 16px 0 0;
    font-size: 20px;
    white-space: nowrap;
  }

  .field-row legend {
    float: left;
  }

  .field-control input {
    min-height: 58px;
    padding: 0 16px;
    font-size: 20px;
  }

  .radio-group {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    min-height: 58px;
  }

  .radio-option {
    gap: 12px;
    font-size: 22px;
  }

  .radio-dot,
  .check-dot {
    width: 32px;
    height: 32px;
  }

  .radio-option input:checked + .radio-dot::after {
    font-size: 22px;
  }

  .submit-button {
    width: 100%;
    min-height: 72px;
    margin-top: 36px;
  }

  .form-message {
    margin: 8px 0 0;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .doctor-admin-heading,
  .doctor-form {
    grid-template-columns: 1fr;
  }

  .doctor-list {
    justify-content: flex-start;
  }

  .admin-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .pager {
    justify-content: space-between;
  }
}

/* Simplified patient form UI */
.patient-page {
  background: #eef5f0;
}

.patient-hero {
  background: linear-gradient(135deg, var(--patient-primary-dark), var(--patient-primary));
  color: #ffffff;
  padding: 44px 20px 86px;
}

.patient-hero-inner {
  width: min(760px, 100%);
  margin: 0 auto;
}

.patient-hero h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 48px);
  font-weight: 800;
  line-height: 1.14;
}

.patient-doctor-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 16px;
}

.patient-doctor-line strong {
  color: #ffffff;
}

.patient-doctor-line span:empty {
  display: none;
}

.patient-main {
  min-height: auto;
  padding: 0 20px 56px;
}

.patient-wrap {
  width: min(760px, 100%);
  margin: -48px auto 0;
}

.appointment-panel {
  padding: 30px;
  border: 1px solid rgba(47, 121, 69, 0.12);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(32, 35, 41, 0.12);
}

.form-intro {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.form-intro h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.25;
}

.form-intro p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 18px;
}

.field-row label,
.field-row legend {
  width: auto;
  padding: 0;
  color: #30343a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.field-row > label > span[aria-hidden="true"],
.field-row > legend > span[aria-hidden="true"] {
  color: var(--danger);
}

.field-row legend {
  float: none;
}

.field-control input {
  min-height: 48px;
  border-radius: 8px;
  font-size: 16px;
  padding: 0 14px;
}

.visit-row {
  display: grid;
  border: 0;
  padding: 0;
}

.radio-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(360px, 100%);
  gap: 4px;
  min-height: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.radio-option {
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  color: #30343a;
  font-size: 15px;
  font-weight: 700;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.radio-option:has(input:checked) {
  background: var(--patient-primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(32, 35, 41, 0.12);
}

.radio-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-color: currentColor;
  opacity: 0.72;
}

.radio-option input:checked + .radio-dot {
  border-color: #ffffff;
  background: #ffffff;
  opacity: 1;
}

.radio-option input:checked + .radio-dot::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--patient-primary);
  content: "";
  transform: translate(-50%, -50%);
}

.form-message {
  min-height: 24px;
  margin: 2px 0 0;
  font-size: 15px;
}

.submit-button {
  width: min(220px, 100%);
  min-height: 46px;
  margin: 16px 0 0 auto;
  border-radius: 8px;
  background: var(--patient-primary);
  font-size: 16px;
  font-weight: 800;
}

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

@media (max-width: 560px) {
  .patient-hero {
    padding: 34px 16px 72px;
  }

  .patient-main {
    padding: 0 14px 40px;
  }

  .patient-wrap {
    margin-top: -40px;
  }

  .appointment-panel {
    padding: 22px 18px;
  }

  .radio-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .submit-button {
    width: 100%;
    min-height: 48px;
  }
}
