/* ==========================================================================
   问一哈 · 管理后台 (admin-web)
   风格：Wise —— 柠檬绿 + 近黑墨 + 鼠尾草画布；重字重展示体、纯平贴面、胶囊控件。
   没有渐变、没有发光、没有投影：层次靠"白卡浮在鼠尾草画布上"来分，
   侧栏与登录页左栏是整块近黑，承载"权威"的一侧。
   与小程序端共用一套设计令牌；无预处理器、无框架、无构建步骤。
   ========================================================================== */

:root {
  --paper:#e8ebe6; --paper-2:#d3d8cf; --surface:#ffffff; --surface-2:#dfe3dc;
  --line:#cdd3c9; --line-soft:#dde1d9; --line-strong:#0e0f0c;
  --ink:#0e0f0c; --ink-2:#454745; --ink-3:#454745; --muted:#868685; --muted-2:#868685;
  --brand:#9fe870; --brand-deep:#163300; --brand-darker:#0e0f0c;
  --brand-mid:#cdffad; --brand-soft:#e2f6d5; --brand-wash:#e2f6d5;
  /* 健康绿：与主色解耦，主色换成蓝/青时"已完成/正常"仍是绿色 */
  --success:#2ead4b; --success-deep:#054d28; --success-soft:#e2f6d5;
  --wheat:#ffd11a; --wheat-deep:#b86700; --wheat-soft:#fdf4cd;
  --sky:#38c8ff; --sky-deep:#0b5f80; --sky-soft:#e2f6ff;
  --indigo:#0e0f0c; --indigo-deep:#163300; --indigo-soft:#e8ebe6;
  --clay:#d03238; --clay-deep:#a72027; --clay-soft:#fbe3e4;
  --grad-brand:#9fe870;
  --glow-brand:none;
  --on-brand:#0e0f0c; --on-brand-2:#163300; --on-brand-3:#163300;
  --on-brand-fill:rgba(14, 15, 12, 0.10); --on-brand-cta:#0e0f0c; --on-brand-cta-fg:#9fe870;
  --bg-wash:none;
  --shadow-card:none;
  --shadow-float:none;
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 24px;
  --r-pill: 999px;
  --font-sans:"PingFang SC","HarmonyOS Sans SC","Source Han Sans CN","Noto Sans CJK SC","Microsoft YaHei",system-ui,-apple-system,sans-serif;
  --font-num:var(--font-sans);
  --ease-out:cubic-bezier(0.16,1,0.3,1);

  /* 非令牌：布局节奏 */
  --rail:264px;
  /* 墨色带：与小程序同族的近黑色带（card feature dark / hero band dark） */
  --band:#0e0f0c;
  --on-band:#9fe870;
  --on-band-2:#e8ebe6;
  --on-band-3:#868685;
  --on-band-fill:rgba(255, 255, 255, 0.08);
  --on-band-line:rgba(232, 235, 230, 0.16);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  /* 纯平的鼠尾草画布：没有洗色。白卡靠"比画布更亮"浮起来 */
  background-color: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, figure, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--brand-deep); }
svg { display: block; }
::selection { background: var(--brand); color: var(--on-brand); }

/* 焦点指示：近黑实线，在鼠尾草和白卡上都看得见 */
:where(a, button, input, select):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* 登录 / 已登录视图切换（与 app.js 的 body.is-authed 契约保持一致） */
body:not(.is-authed) .app-shell { display: none; }
body.is-authed .login-view { display: none; }

/* ==========================================================================
   1. 排版：层级几乎全靠字重。900 用在展示级标题与关键数字上。
   ========================================================================== */

.kicker {
  display: block;
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .14em;
}

.kicker--wheat { color: var(--wheat-deep); }
.kicker--sky { color: var(--sky-deep); }
.kicker--indigo { color: var(--indigo-deep); }

h1 {
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
}

h2 {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--ink);
}

h3 {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
}

/* 数字：等宽字形纵向对齐。旧版的 Georgia 账本数字已取消——
   Wise 全系统一套无衬线，数字的分量来自字重而不是衬线。 */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.cap {
  display: block;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.6;
}

/* ==========================================================================
   2. 栏头：标题 + 延伸发丝线
   ========================================================================== */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head__idx {
  flex: 0 0 auto;
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .04em;
}

.section-head__title { flex: 0 0 auto; }

.section-head__meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
}

.section-head__rule {
  flex: 1 1 auto;
  min-width: 24px;
  height: 1px;
  background: var(--line);
  transform: translateY(-3px);
}

.block { margin-top: 44px; }
.main__inner > .block:first-of-type { margin-top: 32px; }

/* ==========================================================================
   3. 登录视图：左栏墨色带（hero band dark）+ 右栏白卡
   ========================================================================== */

.login-view {
  grid-column: 1 / -1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 480px);
  background: var(--paper);
}

.login-copy {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 16px;
  padding: clamp(36px, 5vw, 84px);
  background: var(--band);
}

.login-copy h1 { color: var(--on-band); margin-top: 2px; }
.login-copy .kicker { color: var(--on-band); }

.login-note {
  max-width: 460px;
  color: var(--on-band-2);
  font-size: 15px;
  line-height: 1.7;
}

.login-list {
  width: 100%;
  max-width: 540px;
  margin-top: 16px;
  border-top: 1px solid var(--on-band-line);
}

.login-list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--on-band-line);
}

.login-list__idx {
  flex: 0 0 auto;
  color: var(--on-band);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
}

.login-list__text {
  color: var(--on-band-2);
  font-size: 13.5px;
  line-height: 1.6;
}

.login-card {
  display: grid;
  align-self: center;
  justify-self: center;
  gap: 16px;
  width: min(calc(100% - 64px), 400px);
  padding: 32px;
  border-radius: var(--r-lg);
  background: var(--surface);
}

.login-card__head { display: grid; gap: 6px; margin-bottom: 2px; }

/* ==========================================================================
   4. 品牌标记：柠檬绿实底方块 + 近黑字形
   ========================================================================== */

.brand-tile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: var(--on-brand);
}

.brand-tile--lg {
  width: 60px;
  height: 60px;
  border-radius: var(--r-md);
}

/* ==========================================================================
   5. 侧栏：整条墨色带
   ========================================================================== */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 20px;
  background: var(--band);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 6px 20px;
}

.brand__text { display: grid; gap: 1px; min-width: 0; }

.brand__name {
  color: var(--on-band);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .01em;
  line-height: 1.3;
}

.brand__sub { color: var(--on-band-3); font-size: 11.5px; line-height: 1.4; }

.sidebar__rule { height: 1px; margin: 0 6px 18px; background: var(--on-band-line); }

.nav { display: grid; gap: 4px; }

.nav__label {
  padding: 0 10px 10px;
  color: var(--on-band-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  color: var(--on-band-2);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.nav-item__ico {
  display: grid;
  place-items: center;
  color: var(--on-band-3);
  transition: color 160ms var(--ease-out);
}

.nav-item:hover { background: var(--on-band-fill); color: var(--on-band); }
.nav-item:hover .nav-item__ico { color: var(--on-band); }

/* 选中态 = 柠檬绿实底 + 近黑字。柠檬绿只做底，不做深底上的文字色 */
.nav-item.active { background: var(--brand); color: var(--on-brand); }
.nav-item.active .nav-item__ico { color: var(--on-brand); }

.sidebar__foot {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid var(--on-band-line);
}

.sidebar__foot .cap { color: var(--on-band-3); }

/* ==========================================================================
   6. 主区
   ========================================================================== */

.main {
  min-width: 0;
  padding: 32px clamp(20px, 3.4vw, 56px) 72px;
}

.main__inner { max-width: 1200px; margin: 0 auto; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 24px;
  flex-wrap: wrap;
  padding-bottom: 24px;
}

.topbar__title { display: grid; gap: 4px; min-width: 0; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px 0 15px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-chip__ico { display: grid; place-items: center; color: var(--brand-deep); }

/* ==========================================================================
   7. 指标卡：四张白卡，数字用重字重展示体。
      唯一一张墨色卡是"待确认"——它是需要动手的那一个。
   ========================================================================== */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric {
  display: grid;
  align-content: start;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
}

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

.metric__ico { display: grid; place-items: center; color: var(--ink-3); }

.metric__label {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
}

.metric__value {
  margin-top: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 48px;
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.03em;
}

.metric__unit {
  margin-left: 7px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.metric--brand .metric__ico { color: var(--brand-deep); }
.metric--wheat .metric__ico { color: var(--wheat-deep); }
.metric--sky .metric__ico { color: var(--sky-deep); }
.metric--indigo .metric__ico { color: var(--ink); }

/* 精选卡：极性翻转（近黑实底 + 柠檬绿数字），一屏只此一张 */
.metric--brand {
  background: var(--band);
}

.metric--brand .metric__label { color: var(--on-band-3); }
.metric--brand .metric__ico { color: var(--on-band); }
.metric--brand .metric__value { color: var(--on-band); }
.metric--brand .metric__unit { color: var(--on-band-3); }

/* ==========================================================================
   8. 容器
   ========================================================================== */

.panel {
  border-radius: var(--r-lg);
  background: var(--surface);
}

.panel--pad { padding: 24px; }

/* ==========================================================================
   9. 按钮：胶囊。主按钮 = 柠檬绿实底 + 近黑字。
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out),
    color 160ms var(--ease-out);
}

.btn__ico { display: grid; place-items: center; }

.btn--primary { background: var(--brand); color: var(--on-brand); }
/* 按下用 primary-active（更亮的一档），不是变深——压暗会让近黑字糊掉 */
.btn--primary:hover { background: var(--brand-mid); }

.btn--ghost { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.btn--ghost:hover { background: var(--brand-soft); }

.btn--quiet { background: var(--surface-2); color: var(--ink); }
.btn--quiet:hover { background: var(--brand-soft); }

.btn--clay { border-color: var(--clay); background: var(--surface); color: var(--clay-deep); }
.btn--clay:hover { background: var(--clay-soft); }

.btn--sm { height: 36px; padding: 0 16px; gap: 5px; font-size: 13px; }
.btn--block { width: 100%; }

/* ==========================================================================
   10. 表单：白底 + 一根硬边。这根边是"这里可以输入"的唯一提示，必须看得见。
   ========================================================================== */

.field { display: block; min-width: 0; }

.field__label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
}

.field__box { position: relative; display: flex; align-items: center; }

.field__ico,
.field__chev {
  position: absolute;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.field__ico { left: 13px; color: var(--muted); }
.field__chev { right: 12px; color: var(--muted); }

input,
select {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

input::placeholder { color: var(--ink-3); }

input:hover,
select:hover { border-color: var(--brand-deep); }

/* 焦点：保留墨边 + 垫一层极浅柠檬底。焦点不靠变色，靠"边还在、底变了" */
input:focus,
select:focus {
  border-color: var(--line-strong);
  background: var(--brand-soft);
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
}

input[type="number"] { letter-spacing: .02em; }

.form-error {
  min-height: 17px;
  margin-top: -8px;
  color: var(--clay-deep);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
}

.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--wheat-soft);
  color: var(--wheat-deep);
  font-size: 12.5px;
  line-height: 1.5;
}

.notice b { font-weight: 700; }
.notice__ico { flex: 0 0 auto; display: grid; place-items: center; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 16px;
}

.field--wide { grid-column: 1 / -1; }

.form-grid__actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

/* ==========================================================================
   11. 诊断记录
   ========================================================================== */

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.record-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
}

/* 诊断照片：AI 结论的依据，缩略图放在事实表左侧，点击看原图 */
.record-card__body {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.record-card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  cursor: zoom-in;
}

.record-card__media--empty {
  color: var(--ink-3);
  font-size: 12px;
  cursor: default;
  border: 1px dashed var(--line-soft);
  background: transparent;
}

.record-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.record-card__media-hint {
  position: absolute;
  inset: auto 0 0 0;
  padding: 6px 8px;
  background: rgba(14, 15, 12, .72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  opacity: 0;
  transition: opacity .15s ease;
}

.record-card__media:hover .record-card__media-hint,
.record-card__media:focus-visible .record-card__media-hint {
  opacity: 1;
}

/* 全屏原图查看器 */
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(14, 15, 12, .82);
}

.image-viewer[hidden] { display: none; }

.image-viewer__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-md);
  background: var(--surface);
}

.image-viewer__close {
  position: absolute;
  top: 24px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  cursor: pointer;
}

.image-viewer__close:hover { background: rgba(255, 255, 255, .28); }

body.is-viewing-image { overflow: hidden; }

.record-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.record-card__id { min-width: 0; }

.record-card__date {
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: .02em;
}

.record-card__title {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.record-card dl {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  margin-top: 2px;
}

.record-card dt,
.record-card dd {
  padding: 9px 0;
  font-size: 13px;
  line-height: 1.6;
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}

.record-card dt { color: var(--ink-3); font-weight: 600; }
.record-card dd { color: var(--ink-2); }

.record-card dl > :nth-last-child(-n + 2) { border-bottom: 0; padding-bottom: 2px; }

.record-card__foot { margin-top: 16px; }

/* 标签：浅底 + 深字，全部胶囊 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  height: 28px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.tag__ico { display: grid; place-items: center; }
.tag--brand { background: var(--brand-soft); color: var(--brand-deep); }
.tag--success { background: var(--success-soft); color: var(--success-deep); }
.tag--wheat { background: var(--wheat-soft); color: var(--wheat-deep); }
.tag--sky { background: var(--sky-soft); color: var(--sky-deep); }
.tag--indigo { background: var(--indigo-soft); color: var(--indigo-deep); }
.tag--clay { background: var(--clay-soft); color: var(--clay-deep); }
.tag--muted { background: var(--surface-2); color: var(--ink-3); }

/* ==========================================================================
   12. 预约订单表：表头是鼠尾草底 + 说明级小字，行线取最浅一档
   ========================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r-lg);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  white-space: nowrap;
}

thead th {
  padding: 14px 16px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  font-size: 13.5px;
}

thead th:first-child,
tbody td:first-child { padding-left: 24px; }

thead th:last-child,
tbody td:last-child { padding-right: 24px; }

tbody tr:hover td { background: var(--brand-soft); }
tbody tr:last-child td { border-bottom: 0; }

.td-strong { color: var(--ink); font-weight: 700; }
.td-num { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.td-dim { color: var(--ink-3); }
.th--action, .td-action { text-align: right; }
.td-action { padding-left: 8px; }

/* 状态下拉：外观是标签，行为仍是原生 select */
.status-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 28px 0 13px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.status-tag select {
  width: auto;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.status-tag select:focus { outline: 0; }
.status-tag:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }

.status-tag > svg {
  position: absolute;
  right: 10px;
  pointer-events: none;
  opacity: .75;
}

.status-tag--brand { background: var(--brand-soft); color: var(--brand-deep); }
.status-tag--success { background: var(--success-soft); color: var(--success-deep); }
.status-tag--wheat { background: var(--wheat-soft); color: var(--wheat-deep); }
.status-tag--sky { background: var(--sky-soft); color: var(--sky-deep); }
.status-tag--indigo { background: var(--indigo-soft); color: var(--indigo-deep); }
.status-tag--clay { background: var(--clay-soft); color: var(--clay-deep); }
.status-tag--muted { background: var(--surface-2); color: var(--ink-3); }

/* ==========================================================================
   13. 响应式
   ========================================================================== */

@media (max-width: 1100px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--wide { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  body { grid-template-columns: minmax(0, 1fr); }

  /* 侧栏收成顶栏——仍然是那条墨色带，只是横过来 */
  .sidebar {
    position: static;
    height: auto;
    padding: 16px 16px 14px;
  }

  .brand { padding: 0 0 14px; }
  .sidebar__rule { display: none; }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar { display: none; }
  .nav__label { display: none; }

  .nav-item {
    flex: 0 0 auto;
    padding: 10px 16px;
    background: var(--on-band-fill);
    color: var(--on-band-2);
    white-space: nowrap;
  }

  .nav-item.active { background: var(--brand); color: var(--on-brand); }

  .sidebar__foot { display: none; }

  .main { padding: 26px 20px 56px; }

  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .record-grid { grid-template-columns: minmax(0, 1fr); }

  .login-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-copy { padding: 44px 24px 40px; }
  .login-card { width: min(calc(100% - 48px), 420px); margin: 40px 0; }
  .login-list { max-width: none; }
}

@media (max-width: 560px) {
  h1 { font-size: 28px; }
  h2 { font-size: 21px; }

  .topbar { align-items: flex-start; }
  .top-actions { justify-content: flex-start; width: 100%; }
  .admin-chip { flex: 1 1 auto; }

  .metrics { grid-template-columns: minmax(0, 1fr); }
  .metric { padding: 20px; }
  .metric__value { font-size: 40px; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .field--wide { grid-column: auto; }

  .form-grid__actions { flex-direction: column; align-items: stretch; }
  .form-grid__actions .btn { width: 100%; }

  .panel--pad { padding: 20px 16px; }
  .record-card { padding: 20px 16px; }
  .record-card dl { grid-template-columns: 56px minmax(0, 1fr); }
  /* 窄屏放不下并排的缩略图，改为上下堆叠 */
  .record-card__body { grid-template-columns: minmax(0, 1fr); }
  .record-card__media { aspect-ratio: 16 / 9; max-height: 200px; }
  .record-card__media-hint { opacity: 1; }

  .login-list__text { font-size: 13px; }
  .login-card { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}
