/* ============================================================
   nimoer_site.css — 全局共享样式
   所有子应用都继承这套变量和基础组件
   ============================================================ */

:root {
  --bg:        #f0ede6;
  --bg2:       #e8e3da;
  --bg3:       #ddd8ce;
  --surface:   #ffffff;
  --ink:       #1c1917;
  --ink2:      #57534e;
  --ink3:      #a8a29e;
  --accent:    #d4522a;
  --accent2:   #ea8a5a;
  --border:    #d6d0c8;
  --success:   #3d7a45;
  --danger:    #b91c1c;
  --radius:    8px;
  --shadow:    0 2px 12px rgba(28,25,23,.09);
  --shadow-lg: 0 8px 32px rgba(28,25,23,.14);
  --font-body: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", Arial, sans-serif;
  --font-disp: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --header-h:  72px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); }
img, svg, video, canvas, iframe { max-width: 100%; height: auto; }

/* ── 全局小屏防溢出兜底 ── */
.nm-header__inner,
.nm-body,
.nm-card,
.nm-grid,
.nm-tc-grid,
.nm-tc-card,
.nm-tc-row,
.nm-tc-value {
  min-width: 0;
}

/* ── 通用 header ── */
.nm-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: .9rem 1.5rem 0;
  background: transparent;
  border-bottom: none;
  box-shadow: none;
  height: auto;
}
.nm-header__inner {
  max-width: 1280px;
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: color-mix(in srgb, var(--surface) 88%, rgba(255,255,255,.55));
  border: 1px solid color-mix(in srgb, var(--border) 86%, transparent);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nm-header__icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; box-shadow: 0 2px 12px rgba(0,0,0,.3); flex-shrink: 0;
}
.nm-header__titles { display: flex; flex-direction: column; gap: .1rem; }
.nm-header__title {
  font-family: var(--font-disp); font-size: 1.15rem; font-weight: 700;
  color: var(--ink); line-height: 1.2;
}
.nm-header__sub { font-size: .75rem; color: var(--ink3); }

/* ── 通用 body 容器 ── */
.nm-body { max-width: 1280px; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; }

/* ── 通用卡片 ── */
.nm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.nm-card__title {
  font-family: var(--font-disp); font-size: 1rem; font-weight: 700;
  color: var(--ink); margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .5rem;
}

/* ── 通用表单字段 ── */
.nm-field { display: flex; flex-direction: column; gap: .25rem; }
.nm-label { font-size: .78rem; font-weight: 600; color: var(--ink2); letter-spacing: .02em; }
.nm-input {
  width: 100%; padding: .6rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: .95rem;
  background: var(--bg); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.nm-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,82,42,.12); }
.nm-input.nm-computed {
  background: var(--bg2); color: var(--ink2);
  border-color: transparent; cursor: default;
}
.nm-input.nm-computed:focus { border-color: transparent; box-shadow: none; }

/* ── 通用网格 ── */
.nm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .85rem; }

/* ── 通用按钮 ── */
.nm-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .6rem 1.25rem; border-radius: var(--radius);
  font-family: var(--font-body); font-size: .88rem; font-weight: 600;
  cursor: pointer; border: none; transition: background .15s, opacity .15s;
}
.nm-btn--primary { background: var(--accent); color: #fff; }
.nm-btn--primary:hover { opacity: .88; }
.nm-btn--ghost { background: var(--bg2); color: var(--ink2); border: 1.5px solid var(--border); }
.nm-btn--ghost:hover { background: var(--border); }

/* ── 提示框 ── */
.nm-hint {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: var(--radius); padding: .85rem 1rem;
  font-size: .83rem; color: var(--ink2); line-height: 1.65;
  margin-bottom: 1.25rem;
}
.nm-hint strong { color: var(--accent); }

/* ── 分隔线 ── */
.nm-divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── 公式列表 ── */
.nm-formula-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.nm-formula-list li { font-size: .85rem; color: var(--ink2); }
.nm-formula-list li code {
  font-family: var(--font-mono); font-size: .82rem;
  background: var(--bg2); padding: .1rem .45rem; border-radius: 4px;
  color: var(--accent); white-space: nowrap;
}
.nm-formula-note { font-size: .75rem; font-family: var(--font-mono); color: var(--ink3); margin-top: .5rem; }

/* ── 门幅/选项组 ── */
.nm-chip-row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.nm-chip {
  padding: .28rem .65rem; border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--ink2);
  font-size: .78rem; font-family: var(--font-mono);
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.nm-chip.active, .nm-chip--active, .nm-chip:hover {
  border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.nm-chip-input {
  width: 72px; padding: .28rem .55rem;
  border: 1.5px solid var(--border); border-radius: 99px;
  font-family: var(--font-mono); font-size: .78rem;
  background: var(--bg); color: var(--ink);
}
.nm-chip-input:focus { outline: none; border-color: var(--accent); }

/* ── 通用表格/卡片切换 ── */
.nm-tc-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .55rem;
}

.nm-tc-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
}

.nm-tc-btn {
  min-height: 34px;
  padding: .28rem .62rem;
}

.nm-tc-btn.is-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  color: var(--ink);
}

.nm-tc-grid {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
}

.nm-tc-card {
  border: 1px solid var(--border);
  border-radius: .7rem;
  padding: .62rem;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  display: grid;
  gap: .42rem;
}

.nm-tc-head {
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
}

.nm-tc-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: .4rem;
  align-items: start;
}

.nm-tc-label {
  color: var(--ink3);
  font-size: .75rem;
  line-height: 1.45;
}

.nm-tc-value {
  color: var(--ink2);
  font-size: .86rem;
  line-height: 1.45;
  min-width: 0;
  word-break: break-word;
}

.nm-tc-value .nm-btn {
  min-height: 34px;
}

/* ── 响应式 ── */
@media (max-width: 900px) {
  .nm-header {
    padding: .8rem 1rem 0;
  }
  .nm-header__inner {
    padding: .85rem 1rem;
    gap: .8rem;
    border-radius: 14px;
  }
  .nm-header__icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  .nm-body {
    padding: 1.4rem 1rem;
  }
  .nm-card {
    padding: 1.1rem;
    margin-bottom: 1rem;
  }
  .nm-card__title {
    margin-bottom: .9rem;
  }
  .nm-input {
    padding: .58rem .72rem;
    font-size: .92rem;
  }
  .nm-btn {
    min-height: 38px;
    padding: .52rem .95rem;
  }
  .nm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
  }
  .nm-hint {
    padding: .75rem .85rem;
    margin-bottom: 1rem;
    line-height: 1.55;
  }
  .nm-divider {
    margin: 1rem 0;
  }
}

@media (max-width: 600px) {
  .nm-header {
    padding: .75rem .75rem 0;
  }
  .nm-header__inner {
    padding: .72rem .82rem;
    min-height: 0;
    align-items: flex-start;
    gap: .65rem;
    border-radius: 12px;
  }
  .nm-header__icon {
    width: 36px;
    height: 36px;
    font-size: 1.05rem;
  }
  .nm-header__title {
    font-size: .98rem;
  }
  .nm-header__sub {
    line-height: 1.4;
  }
  .nm-body {
    padding: 1rem .8rem;
  }
  .nm-card {
    padding: .9rem .85rem;
    margin-bottom: .8rem;
  }
  .nm-card__title {
    margin-bottom: .7rem;
    font-size: .95rem;
  }
  .nm-input {
    padding: .55rem .68rem;
    font-size: .9rem;
  }
  .nm-btn {
    min-height: 36px;
    padding: .48rem .82rem;
    font-size: .83rem;
  }
  .nm-chip-row {
    gap: .32rem;
  }
  .nm-chip,
  .nm-chip-input {
    max-width: 100%;
  }
  .nm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
  }
  .nm-hint {
    padding: .68rem .75rem;
    margin-bottom: .85rem;
    font-size: .8rem;
    line-height: 1.5;
  }
  .nm-divider {
    margin: .85rem 0;
  }
  .nm-tc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }
  .nm-tc-card {
    padding: .55rem;
    gap: .35rem;
  }
  .nm-tc-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: .34rem;
  }
  .nm-tc-value .nm-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .nm-header {
    padding: .55rem .55rem 0;
  }
  .nm-header__inner {
    padding: .65rem .7rem;
  }
  .nm-body {
    padding: .85rem .6rem;
  }
  .nm-card {
    padding: .8rem .75rem;
    border-radius: 7px;
  }
  .nm-btn {
    width: 100%;
    justify-content: center;
  }
  .nm-grid,
  .nm-tc-grid {
    grid-template-columns: 1fr;
  }
  .nm-tc-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }
}
