/* 墨序 — design tokens & layout
   Cool ink paper · jade accent · Literata + IBM Plex Sans */

:root {
  --ink: #152028;
  --ink-soft: #3a4754;
  --ink-mute: #6b7a88;
  --paper: #e8eef2;
  --paper-2: #f3f6f8;
  --paper-3: #ffffff;
  --line: #c5d0d8;
  --line-soft: #d8e0e6;
  --jade: #1f6b5c;
  --jade-deep: #165248;
  --jade-soft: #d5ebe5;
  --warn: #9a4a2a;
  --danger: #8b2e2e;
  --shadow: 0 12px 40px rgba(21, 32, 40, 0.08);
  --radius: 2px;
  --font-ui: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-litera: "Literata", "Songti SC", "Noto Serif SC", serif;
  --space: 8px;
  --topbar-h: 56px;
  --sidebar-w: 280px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9e8e4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #d4dde6 0%, transparent 50%),
    linear-gradient(180deg, #eef3f6 0%, var(--paper) 40%, #e4ebf0 100%);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[v-cloak] {
  display: none !important;
}

.spa-chrome {
  pointer-events: none;
}

.spa-loading {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.spa-toast {
  pointer-events: none;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: var(--jade-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--jade);
}

/* —— Topbar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 calc(var(--space) * 3);
  background: rgba(243, 246, 248, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  justify-self: start;
}

.brand-mark {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--jade) 0%, #2f8f7d 55%, #1a4f5c 100%);
  clip-path: polygon(20% 0, 100% 0, 80% 100%, 0 100%);
  animation: mark-breathe 4.5s var(--ease) infinite;
}

.brand-mark-lg {
  width: 28px;
  height: 28px;
}

.brand-name {
  font-family: var(--font-litera);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
}

.topnav {
  display: flex;
  gap: calc(var(--space) * 2.5);
}

.topnav a {
  color: var(--ink-mute);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.topnav a:hover,
.topnav a.is-active {
  color: var(--ink);
  border-bottom-color: var(--jade);
}

.topbar-end {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.page {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(var(--space) * 5) calc(var(--space) * 3) calc(var(--space) * 8);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.page-title {
  margin: 0;
  font-family: var(--font-litera);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.lede {
  margin: 10px 0 0;
  color: var(--ink-soft);
  max-width: 36em;
}

.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: calc(var(--space) * 4);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
    color 0.2s var(--ease), transform 0.15s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--jade);
  color: #f5faf8;
}

.btn-primary:hover {
  background: var(--jade-deep);
  color: #fff;
}

.btn-secondary {
  background: var(--paper-3);
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--jade);
  color: var(--jade-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover {
  color: var(--ink);
  background: rgba(21, 32, 40, 0.04);
}

.btn-danger {
  color: var(--danger) !important;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink-mute);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius);
}

.icon-btn:hover {
  background: rgba(21, 32, 40, 0.06);
  color: var(--ink);
}

.icon-btn-sm {
  width: 24px;
  height: 24px;
  font-size: 1rem;
}

/* —— Forms —— */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}

.field-input,
input.field-input,
textarea.field-input,
select.field-input,
.auth-form input:not([type="checkbox"]):not([type="radio"]),
.stack-form input:not([type="checkbox"]):not([type="radio"]),
.stack-form textarea,
.stack-form select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-3);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

textarea.field-input,
.stack-form textarea,
.auth-form textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

.field-input:focus,
.auth-form input:not([type="checkbox"]):not([type="radio"]):focus,
.stack-form input:not([type="checkbox"]):not([type="radio"]):focus,
.stack-form textarea:focus,
.stack-form select:focus {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(31, 107, 92, 0.12);
}

.field-input-sm {
  height: 32px;
  font-size: 0.82rem;
}

.field-error,
.form-error {
  color: var(--danger);
  font-size: 0.8rem;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--ink-mute);
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* —— Panels —— */
.panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: calc(var(--space) * 3);
  box-shadow: var(--shadow);
}

.panel-flush {
  padding: 0;
  overflow: hidden;
  margin-top: calc(var(--space) * 3);
}

.panel-flush .panel-head {
  padding: calc(var(--space) * 3);
}

.panel-narrow {
  max-width: 640px;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-litera);
  font-size: 1.25rem;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--ink-mute);
  font-size: 0.88rem;
}

.panel-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--space) * 3);
}

/* —— Writer —— */
.writer-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: calc(var(--space) * 4);
  padding-bottom: calc(var(--space) * 3);
  border-bottom: 1px solid var(--line-soft);
}

.writer-identity {
  display: flex;
  gap: 18px;
  align-items: center;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--jade-soft) center/cover no-repeat;
  display: grid;
  place-items: center;
  font-family: var(--font-litera);
  font-size: 1.6rem;
  color: var(--jade-deep);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.motto {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-family: var(--font-litera);
  font-style: italic;
}

.stat-row {
  display: flex;
  gap: 28px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 72px;
}

.stat-value {
  font-family: var(--font-litera);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
}

.novel-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line-soft);
}

.novel-mini-list li,
.novel-mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
  padding-right: calc(var(--space) * 2);
}

.novel-mini-list li a,
.novel-mini-list .novel-mini-main {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px calc(var(--space) * 3);
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
  transition: background 0.2s var(--ease);
}

.novel-mini-list li a:hover,
.novel-mini-list .novel-mini-main:hover {
  background: rgba(31, 107, 92, 0.05);
}

.cover-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.mini-title {
  font-weight: 500;
}

.mini-meta {
  font-size: 0.8rem;
  color: var(--ink-mute);
}

.empty-line {
  padding: calc(var(--space) * 3);
  color: var(--ink-mute);
}

/* —— Novel grid —— */
.novel-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: calc(var(--space) * 2.5);
}

.novel-tile {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.novel-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 48px rgba(21, 32, 40, 0.12);
}

.novel-tile-main {
  text-decoration: none;
  color: inherit;
  flex: 1;
}

.novel-cover {
  aspect-ratio: 3 / 4;
  max-height: 200px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.18) 0%, transparent 42%),
    linear-gradient(200deg, var(--cover) 0%, #152028 140%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  color: #f7fbf9;
}

.novel-cover-title {
  font-family: var(--font-litera);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
  line-height: 1.25;
}

.novel-cover-sub {
  margin-top: 4px;
  font-size: 0.75rem;
  opacity: 0.85;
}

.novel-tile-body {
  padding: 10px 12px 8px;
}

.novel-tile-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

.novel-tile-stats {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.novel-tile-syn {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--ink-mute);
  line-height: 1.45;
}

.novel-tile-actions {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px 12px;
  border-top: 1px solid var(--line-soft);
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.45);
}

.empty-state h2 {
  margin: 0;
  font-family: var(--font-litera);
}

.empty-state p {
  color: var(--ink-mute);
  margin: 10px 0 24px;
}

/* —— Auth —— */
.auth-body {
  min-height: 100vh;
}

.auth-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line-soft);
}

.auth-brand {
  margin-bottom: 36px;
}

.auth-title {
  margin: 14px 0 8px;
  font-family: var(--font-litera);
  font-size: 2.4rem;
  letter-spacing: 0.16em;
}

.auth-sub {
  margin: 0;
  color: var(--ink-mute);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-foot {
  margin-top: 24px;
  color: var(--ink-mute);
  font-size: 0.9rem;
}

.auth-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(31, 107, 92, 0.18), transparent 40%),
    linear-gradient(200deg, #1a4f5c 0%, #152028 55%, #0e1a22 100%);
}

.auth-visual-inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 48px;
}

.auth-quote {
  max-width: 12em;
  margin: 0;
  font-family: var(--font-litera);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: #e8f2ef;
  letter-spacing: 0.08em;
  line-height: 1.35;
  animation: fade-up 0.9s var(--ease) both;
}

.auth-visual::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -80px;
  bottom: -100px;
  border: 1px solid rgba(232, 242, 239, 0.12);
  border-radius: 50%;
  animation: orbit 18s linear infinite;
}

/* —— Modal —— */
.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  width: min(480px, calc(100vw - 32px));
  background: var(--paper-3);
  box-shadow: 0 24px 80px rgba(21, 32, 40, 0.2);
}

.modal-wide {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.modal-gen {
  width: min(420px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(21, 32, 40, 0.45);
  backdrop-filter: blur(2px);
}

.modal-form {
  padding: 20px 22px 18px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-litera);
  font-size: 1.2rem;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.modal-foot-spacer {
  flex: 1;
}

/* —— Toasts —— */
.toast-stack {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  background: var(--ink);
  color: #eef3f6;
  font-size: 0.9rem;
  border-radius: var(--radius);
  animation: fade-up 0.35s var(--ease);
  box-shadow: var(--shadow);
  max-width: min(360px, 92vw);
  pointer-events: auto;
}

.toast-success {
  background: #1f6b5c;
}

.toast-error,
.toast-warning {
  background: #8b3a3a;
}

/* —— Write workspace —— */
.write-body {
  background: #dfe7ec;
}

.write-app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

.write-sidebar {
  display: flex;
  flex-direction: column;
  background: #eef3f6;
  border-right: 1px solid var(--line);
  min-height: 0;
}

.sidebar-brand {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.brand-compact .brand-name {
  font-size: 1.1rem;
}

.sidebar-novel-link {
  display: block;
  margin-top: 10px;
  font-family: var(--font-litera);
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-novel-link:hover {
  color: var(--jade-deep);
}

.sidebar-scroll {
  flex: 1;
  overflow: auto;
  padding: 8px 0 24px;
}

.side-section {
  border-bottom: 1px solid var(--line-soft);
}

.side-section summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1f6b5c;
  background: linear-gradient(90deg, rgba(31, 107, 92, 0.1), transparent 70%);
  border-left: 3px solid var(--jade);
  display: flex;
  justify-content: space-between;
  user-select: none;
}

.side-section summary::-webkit-details-marker {
  display: none;
}

.side-section summary .count {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #7a93a3;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.side-list {
  list-style: none;
  margin: 0;
  padding: 6px 8px 10px;
  background: rgba(255, 255, 255, 0.35);
}

.side-list li {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius);
}

.side-list li.is-active {
  background: rgba(31, 107, 92, 0.12);
}

.side-list li.is-active a,
.side-list li.is-active .side-item {
  color: var(--jade-deep);
  font-weight: 500;
}

.side-list a,
.side-item {
  flex: 1;
  display: flex;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.88rem;
  color: #3d4f5c;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pub-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  background: #9aa3a0;
  flex-shrink: 0;
  vertical-align: middle;
}

.pub-dot.is-on {
  background: var(--jade);
  box-shadow: 0 0 0 2px rgba(31, 107, 92, 0.2);
}

.publish-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.publish-history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--paper-3);
}

.modal-foot-spacer {
  flex: 1;
}

.chapter-link {
  display: flex;
  align-items: center;
}

.presence-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.presence-dot.is-online {
  background: var(--jade);
  box-shadow: 0 0 0 2px rgba(31, 107, 92, 0.2);
}

.presence-dot.is-offline {
  background: #9aa3a0;
}

.presence-tag {
  margin-left: 6px;
  font-size: 0.68rem;
  color: var(--ink-mute);
  font-weight: 500;
  flex-shrink: 0;
}

.side-list a:hover,
.side-item:hover {
  background: rgba(61, 79, 92, 0.06);
  color: #152028;
}

.chapter-row .chapter-outline-btn {
  flex-shrink: 0;
  height: 26px;
  padding: 0 8px;
  font-size: 0.72rem;
  color: var(--ink-mute);
  opacity: 0.75;
}

.chapter-row:hover .chapter-outline-btn,
.chapter-row.is-active .chapter-outline-btn {
  opacity: 1;
}

.chapter-row .chapter-outline-btn.has-outline {
  color: var(--jade-deep);
  font-weight: 600;
}

.chapter-row .chapter-outline-btn:hover {
  color: var(--jade);
}

.side-empty {
  padding: 6px 10px;
  font-size: 0.8rem;
  color: #8a9bab;
}

.side-add,
.side-add-btn {
  margin: 0 12px 12px;
}

.side-add {
  display: flex;
  gap: 6px;
}

.side-del {
  opacity: 0;
  transition: opacity 0.15s;
}

.side-list li:hover .side-del {
  opacity: 1;
}

.write-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, #f7fafb 0%, #f2f6f8 100%);
}

.write-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(247, 250, 251, 0.92);
  flex-wrap: wrap;
}

.write-toolbar-left,
.write-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.write-toolbar-right .btn {
  flex-shrink: 0;
}

.chapter-title-input {
  border: 0;
  background: transparent;
  font-family: var(--font-litera);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  width: min(420px, 40vw);
  outline: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

.chapter-title-input:focus {
  border-bottom-color: var(--jade);
}

.save-status {
  font-size: 0.75rem;
  color: var(--ink-mute);
  white-space: nowrap;
}

.save-status.is-dirty {
  color: var(--warn);
}

.save-status.is-saving {
  color: var(--jade);
}

.save-status.is-local {
  color: var(--warn);
}

.entity-local-hint {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line-soft));
  background: color-mix(in srgb, var(--warn) 8%, var(--paper-3));
  color: var(--ink);
  border-radius: 6px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  background: var(--paper-3);
  font-size: 0.78rem;
  color: var(--ink-soft);
  border-radius: var(--radius);
}

.meta-pill-input input {
  width: 64px;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  outline: none;
  text-align: center;
}

.editor-wrap {
  min-height: 0;
  padding: 0 0 0;
  overflow: hidden;
  position: relative;
}

.editor {
  width: 100%;
  height: 100%;
  border: 0;
  resize: none;
  outline: none;
  padding: 36px max(48px, calc((100% - 720px) / 2));
  background: transparent;
  font-family: var(--font-litera);
  font-size: 1.08rem;
  line-height: 1.9;
  color: var(--ink);
  caret-color: var(--jade);
}

.editor.is-checking {
  color: transparent;
  caret-color: var(--jade);
  -webkit-text-fill-color: transparent;
}

.editor-highlight {
  position: absolute;
  inset: 0;
  padding: 36px max(48px, calc((100% - 720px) / 2));
  overflow: auto;
  pointer-events: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-litera);
  font-size: 1.08rem;
  line-height: 1.9;
  color: var(--ink);
  z-index: 0;
}

.editor.is-checking {
  position: relative;
  z-index: 1;
  background: transparent;
}

.hl-typo {
  background: rgba(232, 168, 56, 0.45);
  border-radius: 2px;
  color: inherit;
}

.hl-sensitive {
  background: rgba(220, 70, 70, 0.4);
  border-radius: 2px;
  color: inherit;
}

.relation-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.field-radio .check-grid {
  margin-top: 6px;
}

.editor::placeholder {
  color: #9aabba;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* AI dock */
.ai-dock {
  border-top: 1px solid var(--line);
  background: rgba(238, 243, 246, 0.95);
  backdrop-filter: blur(8px);
}

.ai-dock.is-collapsed .ai-dock-body {
  display: none;
}

.ai-dock-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
}

.ai-dock-head strong {
  font-size: 0.88rem;
  margin-right: 10px;
}

.ai-hint {
  font-size: 0.75rem;
  color: var(--ink-mute);
}

.ai-dock-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-dock-body {
  display: grid;
  grid-template-rows: minmax(100px, 160px) auto;
  border-top: 1px solid var(--line-soft);
  max-height: 260px;
}

.ai-messages {
  overflow: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.ai-msg-sys {
  align-self: center;
  max-width: 100%;
  background: transparent;
  color: var(--ink-mute);
  font-size: 0.8rem;
  text-align: center;
}

.ai-msg-user {
  align-self: flex-end;
  background: var(--jade);
  color: #f5faf8;
}

.ai-msg-ai {
  align-self: flex-start;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
  color: var(--ink);
}

.ai-msg-err {
  align-self: center;
  color: var(--danger);
  background: #f8eaea;
}

.ai-mode-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 16px 0;
}

.ai-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.ai-mode-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ai-mode-switch-ui {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #c5ced6;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.ai-mode-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.ai-mode-switch input:checked + .ai-mode-switch-ui {
  background: var(--jade);
}

.ai-mode-switch input:checked + .ai-mode-switch-ui::after {
  transform: translateX(16px);
}

.ai-mode-switch-label {
  font-weight: 600;
  color: var(--ink);
}

.ai-mode-select-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.ai-mode-select {
  appearance: none;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, #fff 0%, #f4f7f8 100%);
  border-radius: 8px;
  padding: 6px 28px 6px 10px;
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  min-width: 11rem;
  max-width: 100%;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-mute) 50%),
    linear-gradient(135deg, var(--ink-mute) 50%, transparent 50%),
    linear-gradient(180deg, #fff 0%, #f4f7f8 100%);
  background-position:
    calc(100% - 14px) 55%,
    calc(100% - 9px) 55%,
    0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
}

.ai-mode-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-mode-target {
  min-width: 9rem;
}

.side-add-chapter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.side-add-chapter-btn {
  writing-mode: horizontal-tb;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gen-hint-lg {
  min-height: 140px;
}

.equip-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  margin-bottom: 6px;
}

.equip-row-skill {
  grid-template-columns: 1fr 1.4fr auto;
}

@media (max-width: 640px) {
  .equip-row,
  .equip-row-skill {
    grid-template-columns: 1fr;
  }
}

.ai-dock-foot {
  border-top: 1px solid var(--line-soft);
}

.ai-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px 16px 14px;
}

.ai-compose textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.9rem;
  resize: none;
  outline: none;
  background: var(--paper-3);
}

.ai-compose textarea:focus {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(31, 107, 92, 0.12);
}

.warn-link {
  font-size: 0.78rem;
  color: var(--warn);
}

.ok-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 3px rgba(31, 107, 92, 0.18);
}

.panel-entries-field .panel-entry-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--paper-3);
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
}

.panel-entries-field .panel-entry-row .entry-full {
  grid-column: 1 / -1;
}

.check-inline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.88rem;
  line-height: 1.4;
  cursor: pointer;
}

.check-inline input {
  margin-top: 3px;
  accent-color: var(--jade);
}

/* Animations */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mark-breathe {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1px);
  }
}

@keyframes orbit {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .writer-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat {
    align-items: flex-start;
  }

  .auth-stage {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .write-app {
    grid-template-columns: 1fr;
  }

  .write-sidebar {
    display: none;
  }

  .page-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
  }
}

/* —— Cert / account —— */
.cert-badge {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.cert-none { color: var(--ink-mute); background: #fff; }
.cert-pending { color: #8a5a1a; background: #f8efd8; border-color: #e2c98a; }
.cert-approved { color: var(--jade-deep); background: var(--jade-soft); border-color: #9ecfc3; }
.cert-rejected { color: var(--danger); background: #f8eaea; border-color: #e0b4b4; }

.cert-state { display: flex; flex-direction: column; gap: 14px; }
.cert-ok { color: var(--jade-deep); margin: 0; }
.cert-bad { color: var(--danger); margin: 0; }
.cert-quote {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--jade);
  background: rgba(31, 107, 92, 0.06);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.field-check {
  width: 18px;
  height: 18px;
  accent-color: var(--jade);
}

.field-check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.field-check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--jade);
}

.field-check-row span {
  flex: 1 1 auto;
  line-height: 1.45;
  writing-mode: horizontal-tb;
  white-space: normal;
}

.site-footer {
  margin-top: auto;
  padding: 20px 24px 28px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.78rem;
}

.site-footer p {
  margin: 0;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: center;
  align-items: center;
}

.site-footer a {
  color: var(--ink-mute);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--jade-deep);
  text-decoration: underline;
}

.writer-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  margin-right: 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--jade-deep);
  background: var(--jade-soft);
  border: 1px solid #9ecfc3;
  vertical-align: middle;
}

.writer-tag-lg {
  height: 26px;
  padding: 0 10px;
  margin-right: 10px;
  font-size: 0.85rem;
}

.badge-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

/* —— Reader —— */
.book-hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  margin-bottom: calc(var(--space) * 4);
  align-items: start;
}

.book-cover-lg {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.18) 0%, transparent 42%),
    linear-gradient(200deg, var(--cover) 0%, #152028 140%);
  color: #f7fbf9;
  display: grid;
  place-items: end start;
  padding: 18px;
  font-family: var(--font-litera);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: var(--shadow);
}

.book-author {
  margin: 12px 0 0;
  color: var(--ink-soft);
}

.book-stats {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: var(--ink-mute);
}

.book-syn {
  margin: 16px 0 24px;
  max-width: 40em;
  color: var(--ink-soft);
  line-height: 1.7;
}

.chapter-toc {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line-soft);
}

.chapter-toc li a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px calc(var(--space) * 3);
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.2s var(--ease);
}

.chapter-toc li a:hover {
  background: rgba(31, 107, 92, 0.05);
}

.toc-meta {
  color: var(--ink-mute);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.read-body .page {
  max-width: 760px;
}

.read-article {
  --read-bg: #f7f3ea;
  --read-fg: #1f1c18;
  --read-fs: 18px;
  background: var(--read-bg);
  color: var(--read-fg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: calc(var(--space) * 4) calc(var(--space) * 4) calc(var(--space) * 5);
  box-shadow: var(--shadow);
  transition: background .2s ease, color .2s ease;
}

.read-article.is-night {
  border-color: rgba(255, 255, 255, 0.08);
}

.read-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 16px;
  padding: 10px 0 0;
  border-top: 1px solid var(--line-soft);
}

.read-set {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--ink-mute);
}

.read-set input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.read-set input[type="range"] {
  width: 88px;
}

.read-stage {
  margin-top: 20px;
}

.read-article.is-page-mode .read-stage {
  height: min(70vh, 640px);
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
}

.read-article.is-page-mode .read-body-text {
  margin-top: 0;
  transition: transform .25s ease;
  will-change: transform;
}

.read-title {
  margin: 0;
  font-family: var(--font-litera);
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  color: inherit;
}

.read-meta {
  margin: 8px 0 0;
  color: inherit;
  opacity: 0.7;
  font-size: 0.85rem;
}

.read-body-text {
  margin-top: 28px;
  font-family: var(--font-litera);
  font-size: var(--read-fs);
  line-height: 2;
  color: inherit;
}

.read-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.read-end {
  font-size: 0.85rem;
  color: var(--ink-mute);
}

@media (max-width: 700px) {
  .book-hero {
    grid-template-columns: 1fr;
  }

  .book-cover-lg {
    max-width: 160px;
  }

  .read-article {
    padding: 20px 16px 28px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .read-settings {
    gap: 8px;
  }
  .relation-row {
    grid-template-columns: 1fr;
  }
}

/* —— Account stats / XP / ledger —— */
.account-stats {
  margin-bottom: calc(var(--space) * 3);
  padding: calc(var(--space) * 2) 0;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.xp-bar-wrap {
  margin-bottom: calc(var(--space) * 4);
}

.xp-bar {
  height: 8px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}

.xp-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--jade), #2f8f7d);
  border-radius: 999px;
  transition: width 0.35s var(--ease);
}

.xp-bar-meta {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--ink-mute);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

.data-table th {
  font-size: 0.75rem;
  color: var(--ink-mute);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.delta-pos { color: var(--jade-deep); font-weight: 600; }
.delta-neg { color: var(--danger); font-weight: 600; }

#points-pill {
  color: var(--jade-deep);
  border-color: #9ecfc3;
  background: var(--jade-soft);
}

.store-hero {
  text-align: center;
  margin: 0 0 28px;
}

.store-title {
  margin-bottom: 8px;
}

.store-lede {
  margin: 0 auto 18px;
  max-width: 36rem;
}

.store-search {
  display: flex;
  gap: 8px;
  min-width: min(420px, 100%);
}

.store-search-center {
  margin: 0 auto;
  max-width: 520px;
  width: 100%;
  justify-content: center;
}

.store-search-center .field-input {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.store-search-center .field-input:focus {
  text-align: left;
}

.store-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  justify-content: center;
}

.store-fold {
  margin: 0 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  padding: 0 12px;
}

.store-fold-summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 4px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}

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

.store-fold-summary::after {
  content: "展开";
  float: right;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--ink-mute);
}

.store-fold[open] > .store-fold-summary::after {
  content: "收起";
}

.store-fold .store-filters {
  margin-bottom: 12px;
  justify-content: flex-start;
}

.store-sort {
  margin-top: 4px;
}

.shelf-toggle-form {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

.store-filters a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  font-size: 0.88rem;
}

.store-filters a.is-active {
  color: var(--ink);
  border-bottom-color: var(--jade);
}

.novel-tile-tags {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--jade-deep);
  line-height: 1.4;
}

.book-tags {
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.book-tags a {
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--jade-deep);
  background: var(--jade-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.store-tags a {
  font-size: 0.82rem;
}

.panel-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-studio {
  border-bottom-color: color-mix(in srgb, var(--jade) 35%, var(--line));
}

.topbar-studio .brand-name {
  letter-spacing: 0.04em;
}

.recharge-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.recharge-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  background: var(--paper-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recharge-label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-mute);
}

.recharge-points {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--jade-deep);
}

.recharge-points small {
  font-size: 0.85rem;
  font-weight: 500;
}

.recharge-price {
  margin: 0 0 8px;
  color: var(--ink-soft);
}

.gen-estimate {
  margin: 4px 0 0;
}

.gen-estimate.is-warn {
  color: #b42318;
}

.meta-pill[href] {
  text-decoration: none;
  color: inherit;
}

.meta-pill[href]:hover {
  border-color: var(--jade);
  color: var(--jade-deep);
}

.zhuque-result {
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: 8px 0 4px;
}

.zhuque-pie-wrap {
  width: 220px;
  height: 220px;
}

.zhuque-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  justify-content: center;
  font-size: 0.9rem;
}

.zhuque-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.zhuque-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

#zhuque-meta {
  text-align: center;
  margin: 0;
}

.novel-mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.novel-mini-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 10px 0;
}

.captcha-code {
  font-family: "IBM Plex Sans", monospace;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  background: var(--jade-soft);
  color: var(--jade-deep);
  border-radius: 4px;
  margin-left: 6px;
}

.name-picker {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
}

.name-picker-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.token-usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.token-usage-card {
  padding: 0.25rem 0;
}

.token-usage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}

.token-usage-head span {
  color: var(--ink-mute);
  font-size: 0.8rem;
}

.code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.code-row .field-input {
  flex: 1;
  min-width: 0;
}

.code-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .token-usage-grid {
    grid-template-columns: 1fr;
  }
}

.name-picker-genders .btn.is-active {
  border-color: var(--jade);
  color: var(--jade-deep);
  background: var(--jade-soft);
}

.name-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.name-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.84rem;
  cursor: pointer;
}

.name-chip:hover {
  border-color: var(--jade);
  color: var(--jade-deep);
}

.gen-scene-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.gen-scene-chips .name-chip.is-active {
  border-color: var(--jade);
  background: color-mix(in srgb, var(--jade) 12%, var(--paper-3));
  color: var(--ink);
}

.novel-tile-actions .inline-form {
  display: inline;
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-3);
  font-size: 0.84rem;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  width: auto;
  height: auto;
  white-space: nowrap;
}

.check-chip input[type="checkbox"],
.check-chip input[type="radio"] {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  flex: none;
  accent-color: var(--jade);
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.check-chip:has(input:checked) {
  border-color: var(--jade);
  background: var(--jade-soft);
  color: var(--jade-deep);
}

.field-checks {
  gap: 8px;
}

.field-checks .field-hint {
  margin: 0;
}

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

.comment-list li {
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

.comment-list time {
  margin-left: 8px;
  font-size: 0.78rem;
  color: var(--ink-mute);
}

.comment-list p {
  margin: 8px 0 0;
  line-height: 1.6;
}

.console-body { background: #dfe7ec; }
.console-app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.console-side {
  background: #eef3f6;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.console-nav { display: flex; flex-direction: column; gap: 4px; }
.console-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.console-nav a:hover,
.console-nav a.is-active {
  background: var(--jade-soft);
  color: var(--jade-deep);
}
.console-side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.console-back {
  margin-top: auto;
  font-size: 0.82rem;
  color: var(--ink-mute);
}
.console-main { padding: 28px 32px 48px; max-width: 1080px; }
.console-search { display: flex; gap: 8px; }
.console-search .field-input { width: 180px; }
.console-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.console-inline .field-input { width: 220px; }
.console-todo { list-style: none; margin: 0; padding: 0; }
.console-todo li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.console-tabs { display: flex; gap: 12px; }
.console-tabs a { text-decoration: none; color: var(--ink-mute); }
.console-tabs a.is-active { color: var(--jade-deep); font-weight: 600; }
.console-pager { display: flex; gap: 16px; margin-top: 20px; align-items: center; color: var(--ink-mute); }

@media (max-width: 800px) {
  .console-app { grid-template-columns: 1fr; }
  .console-side { flex-direction: row; flex-wrap: wrap; }
  .console-nav { flex-direction: row; flex-wrap: wrap; }
}



