:root {
  --blue: #2d98e5;
  --blue-dark: #176fae;
  --ink: #20242a;
  --muted: #6d7780;
  --line: #dce7ef;
  --bg: #f3f8fb;
  --panel: #ffffff;
  --shadow: 0 16px 42px rgba(30, 67, 92, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at 16% 0%, rgba(74, 169, 228, 0.16), transparent 34%),
    linear-gradient(180deg, #f8fcff 0%, var(--bg) 46%, #eef5f9 100%);
  color: var(--ink);
}

button,
input,
select,
textarea,
.button {
  font: inherit;
}

button,
.button {
  min-height: 38px;
  border: 1px solid #cbdce8;
  border-radius: 8px;
  background: #fff;
  color: #17445f;
  padding: 8px 12px;
  text-decoration: none;
  cursor: pointer;
  transition: 0.16s ease;
}

button:hover,
.button:hover {
  border-color: var(--blue);
  background: #f5fbff;
}

.danger {
  color: #b64040;
}

.primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar h1,
.topbar p {
  margin: 0;
}

.eyebrow {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbdce8;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: #496172;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 12px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.55;
}

.viewer {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
  display: grid;
  gap: 20px;
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 30px 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef8ff 100%);
  box-shadow: var(--shadow);
  border: 1px solid rgba(207, 226, 238, 0.75);
}

.dashboard h2 {
  margin: 4px 0 8px;
  font-size: 34px;
}

.dashboard p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 10px;
}

.dashboard-stats div {
  min-width: 98px;
  padding: 16px 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(205, 224, 236, 0.86);
  text-align: center;
}

.dashboard-stats strong {
  display: block;
  font-size: 30px;
  color: var(--blue-dark);
}

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

.doctor-directory {
  padding: 22px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(207, 226, 238, 0.8);
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-title h2,
.section-title p {
  margin: 0;
}

.section-title h2 {
  font-size: 22px;
}

.section-title p {
  color: var(--muted);
  margin-top: 4px;
}

.doctor-grid {
  display: grid;
  gap: 20px;
}

.doctor-store-group {
  min-width: 0;
}

.doctor-store-group + .doctor-store-group {
  padding-top: 18px;
  border-top: 1px solid #dbe8f0;
}

.doctor-store-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 7px 8px;
  border-left: 4px solid var(--blue);
  background: rgba(248, 252, 255, 0.97);
  backdrop-filter: blur(8px);
}

.doctor-store-heading h3 {
  margin: 0;
  color: #1f3544;
  font-size: 17px;
}

.doctor-store-heading span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.doctor-store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.doctor-tile {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 104px;
  width: 100%;
  padding: 12px;
  border: 1px solid #dce8f0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.doctor-tile.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 152, 229, 0.12);
}

.tile-photo {
  width: 58px;
  height: 74px;
  border-radius: 8px;
  background: #eef7fd;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.tile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.tile-info strong {
  display: block;
  font-size: 17px;
  margin-bottom: 3px;
}

.tile-info span,
.tile-info small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.doctor-card,
.schedule-card {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(207, 226, 238, 0.75);
}

.poster-stage {
  display: grid;
  gap: 20px;
}

.exact-poster-wrap {
  display: none;
}

.poster-stage.exact-mode {
  display: block;
}

.poster-stage.exact-mode .exact-poster-wrap {
  display: flex;
  justify-content: center;
}

.poster-stage.exact-mode .doctor-card,
.poster-stage.exact-mode .schedule-card {
  display: none;
}

.exact-poster {
  display: block;
  width: min(100%, 680px);
  height: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.doctor-card {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) 390px;
  overflow: hidden;
}

.doctor-photo {
  min-height: 620px;
  background: linear-gradient(180deg, #f7fbfe, #edf7fd);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 18px 18px 0;
}

.doctor-photo img {
  width: 100%;
  max-height: 640px;
  object-fit: contain;
  object-position: bottom right;
}

.doctor-info {
  padding: 46px;
  min-width: 0;
}

.brand {
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: left;
  white-space: pre-line;
}

.name-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 32px;
}

.name-row span {
  display: block;
  width: 7px;
  height: 64px;
  background: var(--blue);
}

.name-row h2 {
  margin: 0;
  font-size: 56px;
}

#doctorMeta,
#doctorIntro {
  color: var(--muted);
  font-size: 22px;
  margin: 8px 0 0 22px;
}

.sections {
  display: grid;
  gap: 26px;
  margin-top: 36px;
}

.sections h3 {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 26px;
}

.sections ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.85;
  color: #4a4f55;
  font-size: 16px;
}

.schedule-card {
  padding: 34px 44px 44px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #acd4ec;
  padding-bottom: 22px;
  margin-bottom: 26px;
}

.card-head h2 {
  margin: 0 0 6px;
  font-size: 32px;
}

.card-head p {
  margin: 0;
  font-size: 22px;
}

.legend {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.legend span {
  border-radius: 999px;
  padding: 7px 14px;
  color: #fff;
  font-weight: 800;
  text-align: center;
}

.week-row,
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.week-row {
  font-size: 24px;
  margin-bottom: 16px;
}

.calendar {
  gap: 12px 4px;
}

.day {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pill {
  min-width: 50px;
  height: 50px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  color: #050505;
}

.pill.both {
  color: #fff;
  background: linear-gradient(135deg, var(--early-color) 0 49%, var(--late-color) 51% 100%) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(380px, 520px) 1fr;
  min-height: calc(100vh - 74px);
}

.admin-panel {
  height: calc(100vh - 74px);
  overflow: auto;
  padding: 18px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.admin-preview {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.preview-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfd;
}

#status {
  color: #327b37;
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  background: #f8fbfd;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
}

.notice {
  border: 1px solid #f3d69a;
  background: #fff8e9;
  color: #684a10;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.grid-2,
.shift-edit,
.schedule-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stack {
  display: grid;
  gap: 12px;
}

.edit-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.edit-card .row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.schedule-tools {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 8px;
  margin: 10px 0;
}

.weekday-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}

.weekday-picks label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  border: 1px solid #d9e3ea;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
  color: #40505e;
  background: #fff;
}

.weekday-picks input {
  width: auto;
}

.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.mini-head {
  text-align: center;
  color: #7b858f;
  font-size: 12px;
  padding: 4px 0;
}

.day-btn {
  aspect-ratio: 1;
  min-height: 42px;
  padding: 2px;
  border-radius: 10px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

.day-btn.empty {
  visibility: hidden;
}

.day-btn.early {
  background: var(--early-color);
  border-color: var(--early-color);
  color: #211d1b;
}

.day-btn.late {
  background: var(--late-color);
  border-color: var(--late-color);
  color: #fff;
}

.day-btn.both {
  color: #fff;
  background: linear-gradient(135deg, var(--early-color) 0 49%, var(--late-color) 51% 100%);
  border-color: #b9cddd;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.day-btn::after {
  content: attr(data-shift);
  position: absolute;
  bottom: 2px;
  font-size: 8px;
  font-weight: 600;
  opacity: 0.85;
}

.action-row {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .topbar,
  .card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    width: 100%;
  }

  nav select,
  nav input,
  nav .button {
    flex: 1 1 100%;
  }

  .viewer {
    width: min(100% - 20px, 640px);
    margin-top: 12px;
  }

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

  .dashboard,
  .doctor-directory {
    display: none;
  }

  .poster-stage {
    display: block;
    background: #fff;
    border: 1px solid #dbeaf3;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 18px 38px rgba(34, 70, 96, 0.13);
  }

  .poster-stage.exact-mode {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .exact-poster {
    width: 100%;
    border-radius: 0;
    box-shadow: none;
  }

  .doctor-card,
  .schedule-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .doctor-card {
    position: relative;
    display: block;
    min-height: 520px;
    background: #fff;
    overflow: hidden;
  }

  .doctor-info {
    position: relative;
    z-index: 2;
    width: 57%;
    padding: 24px 0 12px 22px;
  }

  .brand {
    font-size: 15px;
    line-height: 1.5;
  }

  .name-row {
    gap: 10px;
    margin-top: 28px;
  }

  .name-row span {
    width: 5px;
    height: 54px;
  }

  .name-row h2 {
    font-size: 38px;
    line-height: 1;
    white-space: nowrap;
  }

  #doctorMeta,
  #doctorIntro {
    font-size: 14px;
    line-height: 1.55;
    margin-left: 15px;
  }

  .sections {
    gap: 20px;
    margin-top: 30px;
  }

  .sections h3 {
    font-size: 21px;
    margin-bottom: 10px;
  }

  .sections ul {
    padding-left: 16px;
    font-size: 11.5px;
    line-height: 1.62;
  }

  .doctor-photo {
    position: absolute;
    z-index: 1;
    right: 2px;
    top: 118px;
    width: 53%;
    height: 412px;
    min-height: 0;
    padding: 0;
    background: transparent;
    align-items: flex-end;
  }

  .doctor-photo img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    object-position: bottom center;
  }

  .schedule-card {
    width: calc(100% - 36px);
    margin: -10px auto 22px;
    padding: 24px 20px 28px;
    border-radius: 8px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
    position: relative;
    z-index: 3;
  }

  .card-head {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 20px;
  }

  .card-head h2 {
    font-size: 26px;
    line-height: 1.15;
  }

  .card-head p {
    font-size: 19px;
  }

  .legend {
    min-width: 122px;
    gap: 6px;
  }

  .legend span {
    padding: 5px 9px;
    font-size: 12px;
  }

  .calendar {
    gap: 13px 0;
  }

  .week-row {
    font-size: 18px;
    margin-bottom: 14px;
  }

  .day {
    min-height: 38px;
  }

  .pill {
    min-width: 37px;
    height: 37px;
    font-size: 18px;
  }

  .admin-panel {
    height: auto;
  }

  .admin-preview {
    height: 720px;
  }

}

/* 管理员登录弹窗 */
body.modal-open {
  overflow: hidden;
}

.login-modal[hidden] {
  display: none !important;
}

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(14, 31, 43, 0.46);
  backdrop-filter: blur(7px);
}

.login-panel {
  position: relative;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid #d8e7f1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(16, 44, 63, 0.26);
}

.login-panel h2,
.login-panel p {
  margin: 0;
}

.login-panel h2 {
  margin-top: 4px;
  font-size: 27px;
}

.login-tip {
  margin: 8px 0 20px !important;
  color: var(--muted);
  line-height: 1.6;
}

.login-panel form {
  display: grid;
  gap: 2px;
}

.login-close {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 36px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #647582;
  background: #f2f7fa;
  font-size: 24px;
  line-height: 1;
}

.login-error {
  min-height: 24px;
  margin: 2px 0 8px !important;
  color: #b23a3a;
  font-size: 14px;
}

.login-submit {
  width: 100%;
  min-height: 44px;
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.68;
}

/* 移动端左右滑动切换医生与保存排班图片 */
.mobile-poster-toolbar {
  display: none;
}

.save-image-modal[hidden] {
  display: none !important;
}

.save-image-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(14, 31, 43, 0.58);
  backdrop-filter: blur(8px);
}

.save-image-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  display: grid;
  gap: 12px;
  padding: 22px;
  overflow: auto;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(16, 44, 63, 0.3);
}

.save-image-panel h2,
.save-image-panel p {
  margin: 0;
}

.save-image-panel h2 {
  padding-right: 42px;
  font-size: 24px;
}

.save-image-tip {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.save-image-preview-wrap {
  display: flex;
  justify-content: center;
  min-height: 180px;
  overflow: auto;
  border: 1px solid #dbe8f0;
  border-radius: 10px;
  background: #edf3f7;
}

.save-image-preview-wrap img {
  display: block;
  width: min(100%, 360px);
  height: auto;
  object-fit: contain;
  background: #fff;
}

.save-image-download {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #fff;
  text-decoration: none;
  font-weight: 750;
}

.viewer-toast {
  position: fixed;
  z-index: 1200;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 38, 50, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.viewer-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .mobile-poster-toolbar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto 42px;
    gap: 8px;
    align-items: center;
    width: 100%;
    margin: 0 auto 10px;
    padding: 8px;
    border: 1px solid #d7e6ef;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(34, 70, 96, 0.1);
  }

  .mobile-nav-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
  }

  .mobile-doctor-status {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .mobile-doctor-status strong,
  .mobile-doctor-status span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-doctor-status strong {
    font-size: 16px;
  }

  .mobile-doctor-status span {
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-save-button {
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 14px;
  }

  .mobile-save-button:disabled {
    cursor: wait;
    opacity: 0.66;
  }

  .poster-stage.reference-poster-mode {
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    will-change: transform, opacity;
  }

  .save-image-panel {
    padding: 18px;
  }

  .save-image-preview-wrap img {
    width: min(100%, 300px);
  }
}


/* 移动端将管理员入口收纳到页面最底部，避免在顶部主操作区过于显眼。 */
.mobile-admin-entry {
  display: none;
}

@media (max-width: 900px) {
  .topbar #adminEditBtn {
    display: none;
  }

  .mobile-admin-entry {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    padding: 14px 4px 24px;
  }

  .mobile-admin-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #aeb9c1;
    box-shadow: none;
    font-size: 15px;
    line-height: 32px;
    opacity: 0.52;
  }

  .mobile-admin-button:hover,
  .mobile-admin-button:focus-visible {
    border: 0;
    background: rgba(121, 143, 157, 0.08);
    color: #71818c;
    opacity: 0.85;
  }
}

/* 登录页辅助入口 */
.login-links {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  font-size: 14px;
}

.login-links a {
  color: var(--blue);
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}


/* 2026-06-24：移动端医生/月选择同排，并统一控件高度。 */
@media (max-width: 900px) {
  .topbar nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    align-items: stretch;
  }

  .topbar nav select,
  .topbar nav input[type="month"] {
    width: 100%;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border-radius: 9px;
    line-height: 44px;
    font-size: 16px;
    box-sizing: border-box;
  }

  .topbar nav select {
    padding-right: 30px;
  }
}

/* 2026-06-24：修正移动端医生与月份选择框左右边距、等宽和高度。 */
@media (max-width: 900px) {
  .topbar {
    width: 100%;
    max-width: 100%;
    padding: 14px 20px;
    box-sizing: border-box;
    overflow-x: clip;
  }

  .topbar > div,
  .topbar nav {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
  }

  .topbar nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 10px;
    row-gap: 0;
    padding: 0;
  }

  .topbar nav select,
  .topbar nav input[type="month"] {
    display: block;
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    margin: 0;
    box-sizing: border-box;
    flex: none;
  }
}

/* 2026-06-24：iPhone Safari 的 month 输入框存在固有最小宽度，使用固定外壳显示文本，透明原生控件只负责唤起选择器。 */
.month-control-shell {
  display: contents;
}

.month-picker-display {
  display: none;
}

@media (max-width: 900px) {
  .topbar nav {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    overflow: hidden;
  }

  .month-control-shell {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    overflow: hidden;
    border: 1px solid #cbdce8;
    border-radius: 9px;
    background: #fff;
    box-sizing: border-box;
  }

  .month-picker-display {
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0 10px;
    overflow: hidden;
    color: var(--ink);
    font-size: 16px;
    line-height: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-sizing: border-box;
  }

  .topbar nav .month-control-shell input[type="month"] {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 9px;
    background: transparent;
    opacity: 0.001;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
  }

  .topbar nav .month-control-shell input[type="month"]::-webkit-calendar-picker-indicator {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
  }
}

/* 2026-06-24：所有移动浏览器统一修正医生/月选择框宽度。
   不再依赖原生 month 控件的固有宽度，两个控件固定各占可用宽度的一半。 */
@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .topbar {
    width: 100%;
    max-width: 100%;
    padding-inline: 20px;
    overflow: hidden;
  }

  .topbar nav {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  .topbar nav > #doctorSelect,
  .topbar nav > .month-control-shell {
    flex: 0 0 calc((100% - 10px) / 2) !important;
    width: calc((100% - 10px) / 2) !important;
    min-width: 0 !important;
    max-width: calc((100% - 10px) / 2) !important;
    height: 44px;
    box-sizing: border-box;
  }

  .topbar nav > #doctorSelect {
    display: block;
    margin: 0;
  }

  .topbar nav > .month-control-shell {
    position: relative;
    display: block;
    overflow: hidden;
    contain: inline-size layout paint;
  }

  .topbar nav > .month-control-shell .month-picker-display {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }

  .topbar nav > .month-control-shell input[type="month"] {
    position: absolute;
    inset: 0;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100% !important;
    box-sizing: border-box;
  }
}
