/* ==========================================================================
   月子中心探店助手 · 南京版
   设计：清晰、克制、可信、医疗信息感
   语义色：绿=确认 / 黄=存疑待确认 / 红=风险一票否决 / 蓝=普通信息 / 灰=中性
   移动优先：390px 设计目标，最低兼容 320px
   ========================================================================== */

:root {
  /* 语义色 - 文字/主色 */
  --green: #17794a;
  --green-bg: #e8f5ed;
  --green-bd: #b7ddc7;

  --yellow: #8a5a00;
  --yellow-bg: #fdf4e3;
  --yellow-bd: #f0d9a8;

  --red: #b3261e;
  --red-bg: #fdecea;
  --red-bd: #f3c2bd;

  --blue: #1a56c4;
  --blue-bg: #eaf0fd;
  --blue-bd: #c2d3f5;

  --gray: #5b6472;
  --gray-bg: #f1f3f6;
  --gray-bd: #dfe3e9;

  /* 中性 */
  --ink: #1b1f27;
  --ink-2: #454c58;
  --ink-3: #6b7280;
  --line: #e4e7ec;
  --bg: #f5f6f8;
  --surface: #ffffff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);

  --nav-h: 58px;
  --header-h: 52px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

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

/* 布局 -------------------------------------------------------------------- */

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.app-header.is-fixed-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
}

.app-header .title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-btn {
  min-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px;
  padding: 0 6px;
  cursor: pointer;
}

.page {
  padding: 14px 14px 8px;
}

.page.no-header-space {
  padding-top: 8px;
}

/* 卡片 -------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card.tight {
  padding: 12px;
}

.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

.card-sub {
  font-size: 15px;
  color: var(--ink-3);
  margin: 0 0 10px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  margin: 18px 2px 10px;
}

.section-title:first-child {
  margin-top: 4px;
}

/* 按钮 -------------------------------------------------------------------- */

.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-bd);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}

.btn:active {
  opacity: 0.75;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

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

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

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

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

.btn-ghost {
  background: var(--surface);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 50px;
  font-size: 17px;
}

.btn-sm {
  min-height: 36px;
  font-size: 15px;
  padding: 0 12px;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row > .btn {
  flex: 1;
}

/* 标签 -------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 1.5;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--gray-bd);
  background: var(--gray-bg);
  color: var(--gray);
  white-space: nowrap;
}

.tag.green { background: var(--green-bg); border-color: var(--green-bd); color: var(--green); }
.tag.yellow { background: var(--yellow-bg); border-color: var(--yellow-bd); color: var(--yellow); }
.tag.red { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.tag.blue { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--blue); }
.tag.gray { background: var(--gray-bg); border-color: var(--gray-bd); color: var(--gray); }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 提示块 ------------------------------------------------------------------ */

.alert {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--gray-bd);
  background: var(--gray-bg);
  color: var(--ink-2);
  margin-bottom: 10px;
}

.alert.green { background: var(--green-bg); border-color: var(--green-bd); color: var(--green); }
.alert.yellow { background: var(--yellow-bg); border-color: var(--yellow-bd); color: var(--yellow); }
.alert.red { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.alert.blue { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--blue); }

.alert strong {
  display: block;
  margin-bottom: 2px;
}

/* 列表 -------------------------------------------------------------------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list > li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.list > li:last-child {
  border-bottom: none;
}

.list-checked > li {
  padding-left: 22px;
  position: relative;
}

.list-checked > li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
}

.list-checked.green > li::before { background: var(--green); }
.list-checked.yellow > li::before { background: var(--yellow); }
.list-checked.red > li::before { background: var(--red); }
.list-checked.blue > li::before { background: var(--blue); }

.muted {
  color: var(--ink-3);
  font-size: 15px;
}

.small {
  font-size: 14px;
  color: var(--ink-3);
}

.strong {
  font-weight: 600;
}

/* 状态选择按钮组 ---------------------------------------------------------- */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--gray-bd);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill.is-on {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.pill.is-on.green { border-color: var(--green); background: var(--green); color: #fff; }
.pill.is-on.yellow { border-color: var(--yellow); background: var(--yellow); color: #fff; }
.pill.is-on.red { border-color: var(--red); background: var(--red); color: #fff; }
.pill.is-on.blue { border-color: var(--blue); background: var(--blue); color: #fff; }

.pills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pills-grid .pill {
  width: 100%;
  border-radius: var(--radius-sm);
}

/* 问题项 ------------------------------------------------------------------ */

.q-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px;
  margin-bottom: 12px;
}

.q-head {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 8px;
}

.q-why {
  font-size: 15px;
  color: var(--ink-3);
  background: var(--gray-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.q-signals {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.signal {
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid var(--gray-bd);
  background: var(--surface);
}

.signal .signal-h {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 15px;
}

.signal.good { background: var(--green-bg); border-color: var(--green-bd); color: var(--green); }
.signal.warn { background: var(--yellow-bg); border-color: var(--yellow-bd); color: var(--yellow); }
.signal.bad { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }

.signal ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.signal li {
  margin-bottom: 2px;
}

.q-hint {
  font-size: 15px;
  color: var(--yellow);
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-bd);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.field {
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input[type="text"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--gray-bd);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
}

.field textarea {
  min-height: 80px;
  line-height: 1.6;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--blue-bd);
  border-color: var(--blue);
}

.input-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-inline .unit {
  font-size: 15px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* 探店进度 ---------------------------------------------------------------- */

.progress-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.progress-bar span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-bd);
}

.progress-bar span.done {
  background: var(--ink);
}

.progress-bar span.current {
  background: var(--blue);
}

.step-count {
  font-size: 15px;
  color: var(--ink-3);
}

/* 机构卡片 ---------------------------------------------------------------- */

.center-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.center-name {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 6px;
}

.stars {
  color: var(--yellow);
  font-size: 16px;
  letter-spacing: 2px;
}

.stars .off {
  color: var(--gray-bd);
}

.meta-grid {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 6px 10px;
  font-size: 15px;
  margin-top: 10px;
  align-items: start;
}

.meta-grid dt {
  color: var(--ink-3);
}

.meta-grid dd {
  margin: 0;
}

/* 可折叠 ------------------------------------------------------------------ */

details.fold {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 8px;
  overflow: hidden;
}

details.fold > summary {
  list-style: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

details.fold > summary::-webkit-details-marker {
  display: none;
}

details.fold > summary::after {
  content: "›";
  color: var(--ink-3);
  font-size: 20px;
  transform: rotate(90deg);
  transition: transform 0.15s;
}

details.fold[open] > summary::after {
  transform: rotate(-90deg);
}

details.fold .fold-body {
  padding: 0 12px 12px;
  font-size: 15px;
}

/* 底部导航 ---------------------------------------------------------------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 30;
}

.bottom-nav button {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  min-height: 44px;
  padding: 4px 0;
}

.bottom-nav button .ico {
  font-size: 19px;
  line-height: 1;
}

.bottom-nav button.is-on {
  color: var(--ink);
  font-weight: 600;
}

/* 底部固定操作条 ---------------------------------------------------------- */

.footer-bar {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  z-index: 25;
}

.footer-bar .btn {
  flex: 1;
}

.has-footer-bar {
  padding-bottom: 74px;
}

/* 结果页 ------------------------------------------------------------------ */

.verdict {
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border: 1px solid var(--gray-bd);
  background: var(--gray-bg);
  margin-bottom: 12px;
}

.verdict .v-icon {
  font-size: 30px;
  line-height: 1;
  display: block;
  margin-bottom: 6px;
}

.verdict .v-text {
  font-size: 20px;
  font-weight: 700;
}

.verdict .v-sub {
  font-size: 15px;
  margin-top: 4px;
}

.verdict.green { background: var(--green-bg); border-color: var(--green-bd); color: var(--green); }
.verdict.yellow { background: var(--yellow-bg); border-color: var(--yellow-bd); color: var(--yellow); }
.verdict.red { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.verdict.gray { background: var(--gray-bg); border-color: var(--gray-bd); color: var(--gray); }

/* 表格 -------------------------------------------------------------------- */

.kv {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px 10px;
  font-size: 15px;
}

.kv dt {
  color: var(--ink-3);
}

.kv dd {
  margin: 0;
  word-break: break-all;
}

/* 杂项 -------------------------------------------------------------------- */

.hr {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.center-text {
  text-align: center;
}

.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-3);
  font-size: 15px;
}

.empty .e-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.5;
}

.sticky-note {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0;
  margin: 0 -14px;
  padding-left: 14px;
  padding-right: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
  background: rgba(27, 31, 39, 0.92);
  color: #fff;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 60;
  max-width: 88%;
  text-align: center;
}

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.check-line:last-child {
  border-bottom: none;
}

.check-line .cl-main {
  flex: 1;
  min-width: 0;
}

.check-line .cl-name {
  font-size: 16px;
}

.check-line .cl-note {
  font-size: 14px;
  color: var(--ink-3);
  margin-top: 2px;
}

@media (max-width: 340px) {
  .pills-grid {
    grid-template-columns: 1fr;
  }
  .meta-grid {
    grid-template-columns: 68px 1fr;
  }
}
