/* 便签页：只使用 tokens.css 的变量与瓷面 --d-* 令牌，不写死颜色、圆角、阴影。
   移动端是主场景（375px 起，两列瀑布墙）；桌面端同一套结构，只是列数更多。 */

.nt-page {
  --nt-ink: var(--d-ink, var(--ink));
  --nt-ink-2: var(--d-ink-2, var(--ink-2));
  --nt-ink-3: var(--d-ink-3, var(--ink-3));
  --nt-surface: var(--d-surface, var(--card));
  --nt-surface-2: var(--d-surface-2, var(--card-hover));
  --nt-line: var(--d-line, var(--line));
  --nt-line-strong: var(--d-line-strong, var(--line-strong));
  --nt-accent: var(--d-accent, var(--accent));
  --nt-accent-soft: var(--d-accent-soft, var(--accent-soft));
  --nt-warn: var(--d-warn, var(--urgent));
  --nt-radius: var(--d-r-card, var(--r-lg));
  --nt-radius-sm: var(--d-r-control, var(--r-md));
  --nt-shadow: var(--d-shadow-sm, var(--shadow-1));
  --nt-shadow-float: var(--d-shadow, var(--shadow-2));
  --nt-font: var(--d-font, inherit);
  display: flex;
  flex-direction: column;
  gap: var(--s-3, 12px);
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding-bottom: 40px;
  font-family: var(--nt-font);
  color: var(--nt-ink);
}

/* ---------- 页头 ---------- */

.nt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nt-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--nt-line);
  background: var(--nt-surface);
  color: var(--nt-ink-3);
  font-size: 13px;
  text-decoration: none;
  transition: color .16s ease, border-color .16s ease;
}
.nt-back:hover { color: var(--nt-ink); border-color: var(--nt-line-strong); }

.nt-head-main { flex: 1; min-width: 120px; }
.nt-head-main h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--nt-ink);
}
.nt-head-main p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--nt-ink-3);
}

.nt-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 15px;
  border: 0;
  border-radius: var(--r-pill, 999px);
  background: var(--nt-accent);
  color: var(--d-on-accent, #fff);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--d-shadow-accent, none);
  transition: transform .14s ease, filter .14s ease;
}
.nt-new:active { transform: scale(.97); filter: brightness(.96); }
.nt-new .ic { display: inline-flex; }

/* ---------- 搜索 ---------- */

.nt-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--nt-line);
  border-radius: var(--nt-radius-sm);
  background: var(--nt-surface);
  box-shadow: var(--nt-shadow);
}
.nt-search-ic {
  display: inline-flex;
  color: var(--nt-ink-3);
  flex: none;
}
.nt-search-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--nt-ink);
  font-family: inherit;
  font-size: 16px; /* 16px 起 iOS 不放大页面 */
}
.nt-search-input::placeholder { color: var(--nt-ink-3); }
.nt-search-input::-webkit-search-cancel-button { display: none; }
.nt-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--nt-surface-2);
  color: var(--nt-ink-3);
  cursor: pointer;
}
.nt-search-clear.is-off { visibility: hidden; }

/* ---------- 便签墙 ---------- */

.nt-wall {
  column-count: 2;
  column-gap: 10px;
}
.nt-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 12px 10px 15px;
  break-inside: avoid;
  border: 1px solid var(--nt-line);
  border-radius: var(--nt-radius);
  background: var(--nt-surface);
  color: var(--nt-ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--nt-shadow);
  transition: transform .14s ease, box-shadow .14s ease;
  -webkit-tap-highlight-color: transparent;
}
.nt-card:active { transform: scale(.985); box-shadow: var(--nt-shadow-float); }

/* 颜色只用令牌表达：左侧一枚细色条 + 很浅的同色底 */
.nt-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--nt-edge, var(--nt-line-strong));
}
.nt-card[data-color="default"] { --nt-edge: var(--nt-line-strong); }
.nt-card[data-color="sky"] {
  --nt-edge: var(--d-accent, var(--accent));
  --nt-tint: var(--nt-accent-soft);
}
.nt-card[data-color="sage"] {
  --nt-edge: var(--pc-area-life, var(--nt-accent));
  --nt-tint: color-mix(in srgb, var(--pc-area-life, var(--nt-accent)) 12%, var(--nt-surface));
}
.nt-card[data-color="sand"] {
  --nt-edge: var(--pc-warm, var(--nt-accent));
  --nt-tint: color-mix(in srgb, var(--pc-warm-soft, var(--nt-accent-soft)) 62%, var(--nt-surface));
}
.nt-card[data-color="rose"] {
  --nt-edge: var(--pc-area-fun, var(--nt-accent));
  --nt-tint: color-mix(in srgb, var(--pc-area-fun, var(--nt-accent)) 12%, var(--nt-surface));
}
.nt-card[data-color="sky"],
.nt-card[data-color="sage"],
.nt-card[data-color="sand"],
.nt-card[data-color="rose"] {
  background: color-mix(in srgb, var(--nt-tint) 52%, var(--nt-surface));
}

.nt-card-pin {
  position: absolute;
  top: 9px;
  right: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--nt-surface);
  color: var(--nt-accent);
  box-shadow: var(--nt-shadow);
}
.nt-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 20px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  color: var(--nt-ink);
  word-break: break-word;
}
.nt-card-body {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.55;
  color: var(--nt-ink-3);
  white-space: pre-line;
  word-break: break-word;
}
.nt-card-body.is-empty { color: var(--nt-ink-3); font-style: italic; }
.nt-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--nt-ink-3);
}
.nt-day-tag {
  padding: 1px 6px;
  border-radius: var(--r-pill, 999px);
  background: var(--nt-surface-2);
  color: var(--nt-ink-2);
}

.nt-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
  border: 1px solid var(--nt-line);
  border-radius: var(--nt-radius-sm);
  background: var(--nt-surface);
  color: var(--nt-ink-3);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.nt-hint {
  margin-top: 6px;
  text-align: center;
  font-size: 11px;
  color: var(--nt-ink-3);
}

.nt-inline-loading {
  padding: 4px 0 8px;
  text-align: center;
  font-size: 12px;
  color: var(--nt-ink-3);
}

/* ---------- 空 / 错 / 未登录 ---------- */

.nt-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 20px;
  border: 1px dashed var(--nt-line);
  border-radius: var(--nt-radius);
  background: var(--nt-surface-2);
  text-align: center;
  color: var(--nt-ink-3);
}
.nt-state-ic {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--nt-surface);
  color: var(--nt-accent);
  box-shadow: var(--nt-shadow);
}
.nt-state h3 {
  margin: 2px 0 0;
  font-size: 17px;
  color: var(--nt-ink);
}
.nt-state p {
  max-width: 320px;
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
}
.nt-state .btn { margin-top: 6px; }
.nt-state-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.nt-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
  font-size: 12px;
  color: var(--nt-ink-3);
}
.nt-spin {
  width: 16px;
  height: 16px;
  border: 2px solid var(--nt-line);
  border-top-color: var(--nt-accent);
  border-radius: 50%;
  animation: nt-spin .8s linear infinite;
}
@keyframes nt-spin { to { transform: rotate(360deg); } }

.nt-skel { column-count: 2; column-gap: 10px; }
.nt-skel-card {
  display: block;
  height: 104px;
  margin-bottom: 10px;
  border: 1px solid var(--nt-line);
  border-radius: var(--nt-radius);
  background: linear-gradient(100deg, var(--nt-surface-2) 30%, var(--nt-surface) 50%, var(--nt-surface-2) 70%);
  background-size: 200% 100%;
  break-inside: avoid;
  animation: nt-shimmer 1.2s linear infinite;
}
.nt-skel-card.is-tall { height: 146px; }
@keyframes nt-shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
@media (prefers-reduced-motion: reduce) {
  .nt-skel-card { animation: none; }
  .nt-spin { animation: none; }
}

/* ---------- 编辑页 ---------- */

.nt-editor { max-width: 760px; }
.nt-editor-head { gap: 8px; }
.nt-save {
  margin-left: auto;
  padding: 0 2px;
  font-size: 12px;
  color: var(--nt-ink-3);
  white-space: nowrap;
}

.nt-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--nt-line);
  border-radius: var(--r-pill, 999px);
  background: var(--nt-surface);
  color: var(--nt-ink-3);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.nt-chip.is-on {
  border-color: var(--nt-accent-soft);
  background: var(--nt-accent-soft);
  color: var(--nt-accent);
}
.nt-chip.is-danger { color: var(--nt-warn); }
.nt-chip[aria-pressed="true"] { font-weight: 600; }

.nt-editor-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  border: 1px solid var(--nt-line);
  border-radius: var(--nt-radius);
  background: var(--nt-surface);
  box-shadow: var(--nt-shadow);
}

.nt-title {
  width: 100%;
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--nt-ink);
  font-family: inherit;
  font-size: 22px;
  font-weight: 650;
  line-height: 1.35;
}
.nt-title::placeholder { color: var(--nt-ink-3); font-weight: 500; }

.nt-editor-body {
  width: 100%;
  min-height: 40vh;
  padding: 2px 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--nt-ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.7;
}
.nt-editor-body::placeholder { color: var(--nt-ink-3); }

.nt-editor-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--nt-line);
}
.nt-day {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 12px;
  color: var(--nt-ink-3);
}
.nt-day input {
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--nt-line);
  border-radius: var(--nt-radius-sm);
  background: var(--nt-surface-2);
  color: var(--nt-ink);
  font-family: inherit;
  font-size: 13px;
}
.nt-day-clear {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--nt-line);
  border-radius: var(--r-pill, 999px);
  background: var(--nt-surface);
  color: var(--nt-ink-3);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.nt-day-clear.is-off { visibility: hidden; }

.nt-colors {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}
.nt-swatch {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--nt-line);
  border-radius: 50%;
  cursor: pointer;
  background: var(--nt-swatch, var(--nt-surface-2));
  transition: transform .14s ease, box-shadow .14s ease;
}
.nt-swatch[data-color="default"] { --nt-swatch: var(--nt-surface-2); }
.nt-swatch[data-color="sky"] { --nt-swatch: var(--nt-accent-soft); }
.nt-swatch[data-color="sage"] { --nt-swatch: color-mix(in srgb, var(--pc-area-life, var(--nt-accent)) 26%, var(--nt-surface)); }
.nt-swatch[data-color="sand"] { --nt-swatch: color-mix(in srgb, var(--pc-warm-soft, var(--nt-accent-soft)) 90%, var(--nt-surface)); }
.nt-swatch[data-color="rose"] { --nt-swatch: color-mix(in srgb, var(--pc-area-fun, var(--nt-accent)) 24%, var(--nt-surface)); }
.nt-swatch.is-on { box-shadow: 0 0 0 2px var(--nt-surface), 0 0 0 4px var(--nt-accent); transform: scale(1.04); }
.nt-swatch:active { transform: scale(.95); }

.nt-editor-note {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--nt-ink-3);
}

.nt-del-preview {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--nt-radius-sm);
  background: var(--nt-surface-2);
  color: var(--nt-ink-2);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

/* ---------- 宽度适配 ---------- */

@media (min-width: 640px) {
  .nt-wall, .nt-skel { column-count: 3; }
}
@media (min-width: 960px) {
  .nt-wall, .nt-skel { column-count: 4; }
  .nt-head-main h1 { font-size: 26px; }
}
@media (max-width: 380px) {
  .nt-head-main h1 { font-size: 22px; }
  .nt-new span { display: none; }
  .nt-new { width: 44px; padding: 0; justify-content: center; }
  .nt-card-title { font-size: 14px; }
}
