/* 实验笔记模块样式
   ⚠️ 本站约束（见 MEMORY-css.md）：
      · 没有全局 box-sizing，需要边框内缩的元素自己写 box-sizing:border-box
      · responsive.css:93 有 [class*="-grid"]{grid-template-columns:1fr!important}
        ⇒ 本文件所有类名一律避开 "-grid"，否则桌面端会被压成单列
      · responsive.css:368 button{min-height:44px} 会撑高小按钮，紧凑按钮用 !important 钉回
*/

.nt-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  min-height: calc(100vh - 160px);
}

/* ── 页头 ── */
.nt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.nt-head h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nt-head .nt-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}
.nt-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── 按钮 ── */
.nt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
  box-sizing: border-box;
  white-space: nowrap;
}
.nt-btn-primary { background: var(--accent-primary); color: #fff; }
.nt-btn-primary:hover { opacity: .9; }
.nt-btn-outline { background: var(--bg-card); border-color: var(--border-color); color: var(--text-primary); }
.nt-btn-outline:hover { background: var(--bg-hover); }
.nt-btn-danger { background: var(--accent-danger); color: #fff; }
.nt-btn-danger:hover { opacity: .9; }
.nt-btn-success { background: var(--accent-success); color: #fff; }
.nt-btn-success:hover { opacity: .9; }
.nt-btn-sm { padding: 5px 12px !important; font-size: 12px; min-height: 30px !important; border-radius: 6px; }

/* ── 统计条（不用 -grid，躲开强制单列） ── */
.nt-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.nt-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.nt-stat b {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.nt-stat span { font-size: 12px; color: var(--text-secondary); }
.nt-stat.warn b { color: var(--accent-warning-text); }
.nt-stat.ok b { color: var(--accent-success-text); }

/* ── 工具栏 ── */
.nt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.nt-search { position: relative; flex: 1; min-width: 220px; }
.nt-search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  box-sizing: border-box;
}
.nt-search input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}
.nt-search .nt-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: var(--text-secondary); pointer-events: none;
}
.nt-select {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  box-sizing: border-box;
}
.nt-select:focus { outline: none; border-color: var(--accent-primary); }

/* ── 列表 ── */
.nt-list { display: flex; flex-direction: column; gap: 18px; }

/* 一天一组：同一天做多个实验时日期只出现一次 */
.nt-day { display: flex; gap: 14px; align-items: flex-start; }
.nt-day-head {
  width: 66px;
  flex: 0 0 66px;
  text-align: center;
  padding-top: 10px;
}
.nt-day-head .nt-date { border-right: none; padding-right: 0; }
.nt-day-w { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.nt-day-c {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 5px;
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 2px 0;
  line-height: 1.4;
}
.nt-day-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.nt-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, transform .18s;
  box-sizing: border-box;
}
.nt-item:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
.nt-date {
  text-align: center;
  border-right: 1px solid var(--border-color);
  padding-right: 12px;
}
.nt-date .d { font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.nt-date .m { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.nt-main { min-width: 0; }
.nt-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nt-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.nt-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.nt-actions { display: flex; gap: 6px; }

/* ── 状态徽章 ── */
.nt-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.nt-badge-draft { background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border-color); }
.nt-badge-submitted { background: rgba(245,158,11,.14); color: var(--accent-warning-text); border-color: rgba(245,158,11,.35); }
.nt-badge-reviewed { background: rgba(34,197,94,.14); color: var(--accent-success-text); border-color: rgba(34,197,94,.35); }

/* ── 空状态 ── */
.nt-empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
}
.nt-empty .ico { font-size: 44px; display: block; margin-bottom: 12px; opacity: .7; }
.nt-empty p { margin: 0 0 16px; font-size: 14px; }

/* ── 表单（编辑页） ── */
.nt-form { display: flex; flex-direction: column; gap: 18px; }
.nt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-sizing: border-box;
}
.nt-card > h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nt-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 14px;
}
.nt-row.one { grid-template-columns: 1fr; }
.nt-field { display: flex; flex-direction: column; gap: 6px; }
.nt-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.nt-field label .req { color: var(--accent-danger-text); margin-left: 2px; }
.nt-field .nt-hint { font-size: 11px; color: var(--text-secondary); font-weight: 400; }
.nt-input, .nt-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  box-sizing: border-box;
  font-family: inherit;
}
.nt-textarea { line-height: 1.7; resize: vertical; min-height: 80px; }
.nt-input:focus, .nt-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.nt-form-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 14px 0 4px;
  background: linear-gradient(to top, var(--bg-body) 60%, transparent);
}

/* ── 详情页 ── */
.nt-doc {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 32px 36px;
  box-sizing: border-box;
}
.nt-doc-head {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 18px;
  margin-bottom: 22px;
}
.nt-doc-head h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px;
  line-height: 1.4;
}
.nt-doc-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
}
.nt-doc-info b { color: var(--text-primary); font-weight: 600; }
.nt-sec { margin-bottom: 22px; }
.nt-sec h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nt-sec pre,
.nt-sec-body {
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 12px 14px;
  box-sizing: border-box;
}
.nt-sec pre.empty { color: var(--text-muted); font-style: italic; }
/* 富文本正文由 L.render() 产出块级元素，不能沿用 pre 的 white-space */
.nt-sec-body { white-space: normal; }

/* 批阅区 */
.nt-review {
  margin-top: 8px;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-success);
  border-radius: 10px;
  padding: 18px 20px;
  background: var(--bg-card);
  box-sizing: border-box;
}
.nt-review h3 { margin: 0 0 12px; font-size: 14px; color: var(--text-primary); }
.nt-review .nt-review-meta { font-size: 12px; color: var(--text-secondary); margin-top: 10px; }

/* ── 打印 ── */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff !important; }
  .app-header, .app-sidebar, .app-footer, .nt-toolbar, .nt-head-actions,
  .nt-review, .nt-no-print, #app-header-container, #app-footer-container,
  #app-toast-container, .sidebar-toggle { display: none !important; }
  .nt-page { max-width: none; padding: 0; margin: 0; }
  .nt-doc { border: none; padding: 0; border-radius: 0; }
  .nt-sec pre { background: transparent; padding: 0; }
  .nt-sec { page-break-inside: avoid; }
  .nt-doc-head h1 { font-size: 18pt; }
}

/* ── 手机端 ── */
@media (max-width: 767px) {
  .nt-page { padding: 16px 16px 40px; }
  .nt-head h1 { font-size: 20px; }
  .nt-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .nt-stat { padding: 12px; }
  .nt-stat b { font-size: 20px; }
  .nt-item {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }
  /* 手机上日期组头改为横排一行，避免左侧窄栏挤压内容 */
  .nt-day { flex-direction: column; gap: 8px; }
  .nt-day-head {
    width: auto;
    flex: none;
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-align: left;
    padding: 2px 2px 0;
  }
  .nt-day-head .nt-date { display: flex; align-items: baseline; gap: 6px; }
  .nt-day-w, .nt-day-c { margin-top: 0; }
  .nt-day-c { padding: 2px 8px; }
  .nt-date .d { font-size: 15px; }
  .nt-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .nt-row { grid-template-columns: 1fr; gap: 12px; }
  .nt-doc { padding: 20px 16px; }
  .nt-doc-info { grid-template-columns: 1fr; }
  .nt-form-footer { position: static; }
  .nt-form-footer .nt-btn { flex: 1; }
}

/* ═══════════════════════════════════════════════════════════
   Evernote 式组织：笔记本 / 标签 / 星标 / 筛选
   注意：站点 responsive.css 有 [class*="-grid"]{1fr!important}，
   本区块一律不使用带 -grid 的类名。
   ═══════════════════════════════════════════════════════════ */
.nt-layout { display: flex; gap: 20px; align-items: flex-start; }
.nt-aside {
  width: 220px;
  flex: 0 0 220px;
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.nt-aside-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
}
.nt-aside-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: .02em;
  margin-bottom: 8px;
}
.nt-mini-btn {
  width: 22px; height: 22px; padding: 0;
  min-height: 22px !important;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.nt-mini-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary-text); }

.nt-nb-list { display: flex; flex-direction: column; gap: 2px; }
.nt-nb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--text-primary);
  box-sizing: border-box;
  min-height: 32px !important;
}
.nt-nb-item:hover { background: var(--bg-hover); }
.nt-nb-item.active { background: var(--bg-hover); font-weight: 600; }
.nt-nb-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.nt-nb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-nb-count { font-size: 11px; color: var(--text-secondary); flex: 0 0 auto; }

.nt-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.nt-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  min-height: 26px !important;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  box-sizing: border-box;
}
.nt-tag:hover { border-color: var(--accent-primary); color: var(--accent-primary-text); }
.nt-tag.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }
.nt-tag i { font-style: normal; opacity: .65; font-size: 10px; }
.nt-tag-hint { font-size: 11px; color: var(--text-muted); line-height: 1.6; }

.nt-main-area { flex: 1; min-width: 0; }

.nt-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
}
.nt-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.nt-chip-clear {
  border: none;
  background: transparent;
  color: var(--accent-danger-text);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  min-height: 26px !important;
}
.nt-star { margin-right: 4px; font-size: 13px; }
.nt-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.nt-tag-mini {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* 模板选择器 */
.nt-tpl-groups { display: block; }
.nt-tpl-group {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .04em;
  margin: 12px 0 6px;
}
.nt-tpl-group:first-child { margin-top: 0; }
.nt-tpl-row { display: flex; flex-wrap: wrap; gap: 8px; }
.nt-tpl {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-secondary);
  cursor: pointer;
  text-align: left;
  min-width: 150px;
  box-sizing: border-box;
}
.nt-tpl:hover { border-color: var(--accent-primary); }
.nt-tpl.active { border-color: var(--accent-primary); background: var(--bg-hover); }
.nt-tpl b { font-size: 13px; color: var(--text-primary); font-weight: 600; }
.nt-tpl span { font-size: 11px; color: var(--text-muted); }

/* 标签输入 */
.nt-tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  box-sizing: border-box;
}
.nt-tag-input-wrap input {
  flex: 1;
  min-width: 100px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  padding: 3px 0;
}

/* 版本历史 */
.nt-ver-list { display: flex; flex-direction: column; gap: 6px; }
.nt-ver-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
}
.nt-ver-item b { color: var(--text-primary); font-weight: 600; }

@media (max-width: 900px) {
  .nt-layout { flex-direction: column; }
  .nt-aside {
    width: 100%;
    flex: none;
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .nt-aside-block:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .nt-aside { grid-template-columns: 1fr; }
  .nt-aside-block:nth-child(3) { grid-column: auto; }
}


/* ═══════════════════════════════════════════════════════════
   调用方法 / 带入仪器参数（弹窗）
   ⚠️ responsive.css 有 button{min-height:44px}，弹窗内的小按钮
      必须显式钉回高度，否则会被撑成大方块。
   ═══════════════════════════════════════════════════════════ */
.nt-pick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-color);
}
.nt-pick-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.nt-pick-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
.nt-pick-mask[hidden] { display: none; }

.nt-pick-box {
  background: var(--bg-card);
  border-radius: 12px;
  width: 100%;
  max-width: 620px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .3);
  box-sizing: border-box;
}
.nt-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  flex: 0 0 auto;
}
.nt-pick-head h3 {
  margin: 0;
  font-size: .96rem;
  font-weight: 700;
  color: var(--text-primary);
}
.nt-pick-x {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 28px !important;
  font-family: inherit;
}
.nt-pick-body {
  padding: 12px 18px;
  overflow-y: auto;
  flex: 1;
}
.nt-pick-search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: .86rem;
  box-sizing: border-box;
  margin-bottom: 10px;
  font-family: inherit;
}
.nt-pick-search input:focus { outline: none; border-color: var(--accent-primary); }

.nt-pick-list { display: flex; flex-direction: column; gap: 8px; }
.nt-pick-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-secondary);
  cursor: pointer;
  box-sizing: border-box;
  font-family: inherit;
  min-height: 44px !important;
  transition: border-color .16s, background .16s;
}
.nt-pick-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
}
.nt-pick-item b {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  word-break: break-word;
}
.nt-pick-item span {
  display: block;
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.55;
}
.nt-pick-flag {
  font-style: normal;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 6px;
  white-space: nowrap;
}
.nt-pick-empty {
  font-size: .84rem;
  color: var(--text-muted);
  line-height: 1.8;
  padding: 18px 6px;
  text-align: center;
}
.nt-pick-empty a { color: var(--accent-primary-text, var(--text-primary)); }

.nt-pick-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--border-color);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.nt-pick-tip {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  min-width: 140px;
}

@media (max-width: 600px) {
  .nt-pick-mask { padding: 10px; }
  .nt-pick-box { max-height: 92vh; }
  .nt-pick-body { padding: 10px 14px; }
  .nt-pick-head, .nt-pick-foot { padding: 12px 14px; }
  .nt-pick-hint { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   富文本：格式栏 / 预览 / 图片（笔记编辑页）
   ⚠️ responsive.css:368 button{min-height:44px} 会把格式栏每个
      小方块撑到 44px，整条工具栏变胖 ⇒ 必须 !important 钉回 26px。
   ⚠️ 正文仍以纯文本 + Markdown 子集存储，这里只负责“看起来是富文本”。
   ═══════════════════════════════════════════════════════════ */
.nt-fmt-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  margin: -4px 0 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  box-sizing: border-box;
  position: relative;
  z-index: 5;
}
.nt-fmt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 8px !important;
  margin: 0 !important;
  font-family: inherit;
  font-size: 12px;
  line-height: 1 !important;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nt-fmt:hover { background: var(--bg-hover); color: var(--text-primary); }
.nt-fmt:active { transform: translateY(1px); }
.nt-fmt.active { background: var(--accent-primary-light); color: var(--accent-primary); }
.nt-fmt b, .nt-fmt i, .nt-fmt u, .nt-fmt s { font-size: 12.5px; }
.nt-fmt-sep {
  width: 1px;
  height: 16px;
  margin: 0 5px;
  background: var(--border-color);
  flex: 0 0 auto;
}
.nt-fmt-select {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 4px !important;
  margin: 0 !important;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.nt-fmt-select:hover { background: var(--bg-hover); }
.nt-fmt-select:focus { outline: none; background: var(--bg-hover); }
.nt-fmt-img { font-size: 11px; padding: 0 8px !important; }
.nt-fmt-stat {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: nowrap;
}

/* ── 表格网格选择器 ── */
.nt-table-picker { position: relative; display: inline-flex; }
.nt-table-grid {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
  box-sizing: border-box;
}
.nt-table-grid[hidden] { display: none !important; }
.nt-tg-grid {
  display: grid;
  grid-template-columns: repeat(8, 17px);
  gap: 3px;
}
.nt-tg-cell {
  display: block;
  width: 17px;
  height: 17px;
  box-sizing: border-box;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  cursor: pointer;
}
.nt-tg-cell.on {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}
.nt-tg-label {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

/* ── 表格（Markdown 管道语法渲染结果，详情页 / 预览共用） ── */
.nt-table-wrap {
  overflow-x: auto;
  margin: .6em 0 .8em;
}
.nt-rich table, .nt-sec-preview table {
  border-collapse: collapse;
  min-width: 50%;
  font-size: 13px;
  line-height: 1.6;
}
.nt-rich th, .nt-rich td,
.nt-sec-preview th, .nt-sec-preview td {
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}
.nt-rich th, .nt-sec-preview th {
  background: var(--bg-hover);
  font-weight: 600;
  white-space: nowrap;
}
.nt-rich td img, .nt-sec-preview td img { max-width: 100%; }

/* 编辑时拖拽图片进入段落区的高亮（drag 事件绑在 #secWrap 上，高亮也给外层） */
#secWrap.nt-drag-over {
  outline: 2px dashed var(--accent-primary);
  outline-offset: 4px;
  border-radius: 8px;
}

/* 预览块：替换 textarea 显示渲染结果 */
.nt-sec-preview {
  background: var(--bg-hover);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-primary);
  box-sizing: border-box;
  word-break: break-word;
}
.nt-sec-preview[hidden] { display: none !important; }
.nt-pv-empty { color: var(--text-muted); font-style: italic; font-size: 13px; }

/* ── 渲染结果（详情页 / 预览共用） ── */
.nt-rich p { margin: 0 0 .7em; }
.nt-rich p:last-child, .nt-sec-preview p:last-child { margin-bottom: 0; }
.nt-rich h4, .nt-sec-preview h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 1em 0 .45em;
  color: var(--text-primary);
  line-height: 1.5;
}
.nt-rich h5, .nt-sec-preview h5,
.nt-rich h6, .nt-sec-preview h6 {
  font-size: 13px;
  font-weight: 700;
  margin: .9em 0 .4em;
  color: var(--text-primary);
  line-height: 1.5;
}
.nt-rich h4:first-child, .nt-rich h5:first-child, .nt-rich h6:first-child,
.nt-sec-preview h4:first-child, .nt-sec-preview h5:first-child, .nt-sec-preview h6:first-child {
  margin-top: 0;
}
.nt-rich ul, .nt-rich ol,
.nt-sec-preview ul, .nt-sec-preview ol {
  margin: 0 0 .7em;
  padding-left: 1.5em;
}
.nt-rich li, .nt-sec-preview li { margin: .15em 0; }
.nt-rich blockquote, .nt-sec-preview blockquote {
  margin: 0 0 .7em;
  padding: 4px 0 4px 12px;
  border-left: 3px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13.5px;
}
.nt-rich hr, .nt-sec-preview hr {
  border: none;
  border-top: 1px dashed var(--border-color);
  margin: 1em 0;
}
.nt-rich code, .nt-sec-preview code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ── 图片 ── */
.nt-img {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
  line-height: 0;
}
.nt-img img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  box-sizing: border-box;
}
.nt-img-cap {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}
.nt-img-line { text-align: center; }
.nt-img-line .nt-img img { margin: 0 auto; }
.nt-img-missing {
  display: inline-block;
  padding: 8px 12px;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
}

/* ════════════════════════════════════════════════
   富文本增强：sup / sub / mark / small / span-color
   详情页 .nt-rich 与预览 .nt-sec-preview 共用
   ════════════════════════════════════════════════ */
.nt-rich sup, .nt-sec-preview sup {
  font-size: 0.72em;
  vertical-align: super;
  line-height: 0;
}
.nt-rich sub, .nt-sec-preview sub {
  font-size: 0.72em;
  vertical-align: sub;
  line-height: 0;
}
.nt-rich mark, .nt-sec-preview mark {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
  color: inherit;
}
.nt-rich small, .nt-sec-preview small {
  font-size: 0.82em;
  color: var(--text-secondary);
}
.nt-rich big, .nt-sec-preview big {
  font-size: 1.2em;
  font-weight: 500;
}

/* ── Popover 弹出面板（颜色 / 高亮 / 对齐 / 字号） ── */
.nt-popover {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 100;
  white-space: nowrap;
}
.nt-popover[hidden] { display: none !important; }

/* 颜色面板 */
.nt-color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 2px;
}
.nt-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s;
  position: relative;
}
.nt-color-dot:hover { transform: scale(1.18); border-color: var(--text-primary); }
.nt-color-dot.clear {
  background: #fff;
  border-color: var(--border-color);
  background-image:
    linear-gradient(45deg, transparent 45%, #ef4444 45%, #ef4444 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #ef4444 45%, #ef4444 55%, transparent 55%);
}

/* 字号 / 对齐按钮组 */
.nt-popover-btns {
  display: flex;
  gap: 4px;
  flex-direction: column;
}
.nt-popover-btns .nt-fmt {
  width: 100%;
  min-width: 80px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  justify-content: flex-start;
}

/* 工具栏增强按钮（上/下标、颜色、高亮等） */
.nt-fmt-pop { position: relative; }
.nt-fmt-sub,
.nt-fmt-sup {
  font-size: 11px;
  line-height: 1;
}
.nt-fmt-sub sub,
.nt-fmt-sup sup {
  font-size: 10px;
}
.nt-fmt-color::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e, #3b82f6, #8b5cf6, #ec4899);
}
.nt-fmt-hl {
  background: linear-gradient(180deg, transparent 55%, #fef08a 55%);
}
.nt-fmt-align {
  font-size: 13px;
  line-height: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  padding: 4px 6px !important;
}
.nt-fmt-align i {
  display: block;
  width: 12px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.nt-fmt-align i:nth-child(2) { width: 10px; }
.nt-fmt-align i:nth-child(3) { width: 11px; }

/* 工具栏按钮：悬停 tooltip 显示快捷键（原生浏览器 title） */
.nt-fmt:hover { position: relative; }
/* 之前的两行布局 CSS 已移除，按钮恢复单行图标 */

/* 打印：图片与表格不要跨页断开 */
@media print {
  .nt-rich img, .nt-img img { page-break-inside: avoid; max-width: 100%; }
  .nt-img-line { page-break-inside: avoid; }
  .nt-rich table, .nt-sec-preview table { page-break-inside: avoid; }
}

/* 手机端：格式栏按钮略放大便于点按（仍低于 responsive 的 44px 基线） */
@media (max-width: 767px) {
  .nt-fmt { min-width: 32px !important; height: 30px !important; min-height: 30px !important; }
  .nt-fmt-select { height: 30px !important; min-height: 30px !important; }
  .nt-fmt-stat { display: none; }
  .nt-sec-body { padding: 10px 12px; }
  .nt-tg-grid { grid-template-columns: repeat(8, 20px); gap: 4px; }
  .nt-tg-cell { width: 20px; height: 20px; }
  .nt-table-grid { left: auto; right: 0; }   /* 靠右弹出，避免溢出屏幕 */
}

/* ── 卡片标题行（标题 + 预览按钮） ──
   ⚠️ h2 被 .nt-sec-head 包起来后就不再是 .nt-card 的直接子元素，
      拿不到 .nt-card > h2 的下边框与字号，必须在这里补一遍。 */
.nt-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}
.nt-sec-head h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
