/* ============================================================
   漫剧文件夹工作台 — Paper + Stamp Red
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* paper + stamp palette */
  --paper:        #F5F2EC;
  --paper-deep:   #EDE7DA;
  --paper-edge:   #E3DDCD;
  --ink:          #1A1816;
  --ink-2:        #3B3833;
  --ink-3:        #6E6A60;
  --ink-4:        #9C978A;
  --stamp:        #C7392E;
  --stamp-deep:   #9F2A22;
  --stamp-soft:   #F4E0DC;
  --link:         #2563EB;
  --link-deep:    #1D4ED8;

  /* channel tints — used as table block backgrounds */
  --tint-warm:    #FBF1DA;  /* 抖音·自然流 — amber */
  --tint-warm-h:  #F6E8C2;
  --tint-blue:    #E4ECF8;  /* 抖音·投流 — blue */
  --tint-blue-h:  #D2DEF1;
  --tint-green:   #E2EDDF;  /* 视频号 — green */
  --tint-green-h: #CFE0CA;

  /* status */
  --status-ok:    #2F8F4C;
  --status-warn:  #C97A12;
  --status-stop:  #A04136;
  --status-mute:  #8A867C;

  /* layout */
  --topbar-h:   52px;
  --sidebar-w:  240px;

  --font-sans:  "Noto Sans SC", "HarmonyOS Sans SC", "PingFang SC", system-ui, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
#root { min-height: 100%; }

/* ---------- TOP BAR ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: #0E0D0C;
  color: #F5F2EC;
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 24px;
  border-bottom: 1px solid #000;
}
.topbar__brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; letter-spacing: 0.02em;
}
.topbar__stamp {
  width: 26px; height: 26px;
  background: var(--stamp);
  color: #F5F2EC;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  border-radius: 4px;
  font-family: var(--font-sans);
  transform: rotate(-3deg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}
.topbar__crumbs { font-size: 13px; color: #B8B3A7; flex: 1; }
.topbar__crumbs strong { color: #F5F2EC; font-weight: 500; }
.topbar__actions { display: flex; align-items: center; gap: 12px; }

.edit-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent;
  border: 1px solid #3A3833;
  color: #D9D4C7;
  padding: 6px 12px;
  border-radius: 6px;
  font: inherit; font-size: 13px;
  cursor: pointer;
  transition: all 120ms;
}
.edit-toggle:hover { background: #1F1D1A; border-color: #54514A; }
.edit-toggle.is-on {
  background: var(--stamp);
  border-color: var(--stamp);
  color: #FFF;
}
.edit-toggle .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #6E6A60;
}
.edit-toggle.is-on .dot { background: #FFF; box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }

/* topbar icon buttons (导出/导入) */
.topbar__icon-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent;
  border: 1px solid #3A3833;
  color: #D9D4C7;
  padding: 6px 10px;
  border-radius: 6px;
  font: inherit; font-size: 12.5px;
  cursor: pointer;
  transition: all 120ms;
}
.topbar__icon-btn:hover {
  background: #1F1D1A;
  border-color: #54514A;
  color: #FFF;
}

/* ---------- LAYOUT ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

/* ---------- SIDEBAR (v2 · 4 folders) ---------- */
.sidebar {
  background: var(--paper-deep);
  border-right: 1px solid var(--paper-edge);
  padding: 24px 12px 40px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar__intro {
  padding: 6px 12px 18px;
  border-bottom: 1px dashed var(--paper-edge);
  margin-bottom: 12px;
}
.sidebar__intro-title {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.sidebar__intro-desc {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 2px;
  line-height: 1.5;
}
.sidebar__folder {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 4px;
  transition: background 120ms;
  align-items: start;
}
.sidebar__folder:hover { background: rgba(0,0,0,0.04); }
.sidebar__folder.is-active {
  background: #FFF;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), inset 3px 0 0 var(--stamp);
}
.sidebar__folder-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-4);
  font-weight: 500;
  padding-top: 1px;
}
.sidebar__folder.is-active .sidebar__folder-num {
  color: var(--stamp);
}
.sidebar__folder-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.sidebar__folder-desc {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
  margin-top: 3px;
}

/* ---------- FOLDER HEAD ---------- */
.folder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 0 20px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--paper-edge);
}
.folder-head__main {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.folder-head__index {
  width: 44px; height: 44px;
  background: var(--stamp);
  color: #FFF;
  border-radius: 6px;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.folder-head__title {
  font-size: 24px;
  font-weight: 600;
  margin: 2px 0 4px;
  letter-spacing: -0.01em;
}
.folder-head__sub {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
  max-width: 720px;
}
.folder-head__meta {
  font-size: 12px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  text-align: right;
  white-space: nowrap;
}

/* ---------- PROCESS FLOW ---------- */
.proc {
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 8px;
  padding: 18px 22px 22px;
  margin-top: 20px;
}
.proc__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.proc__dot {
  width: 8px; height: 8px;
  background: var(--stamp);
  border-radius: 50%;
}
.proc__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.proc__steps {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.proc__step {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  padding: 14px 16px 16px;
  min-width: 0;
}
.proc__num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--stamp);
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 3px;
  padding: 2px 7px;
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}
.proc__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.3;
}
.proc__who {
  font-size: 11.5px;
  color: var(--stamp);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.proc__desc {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.6;
}
.proc__arrow {
  align-self: center;
  flex: 0 0 28px;
  text-align: center;
  font-size: 16px;
  color: var(--stamp);
  font-weight: 500;
}

/* ---------- FILTER BAR ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: 10px 4px 14px;
  margin-bottom: 4px;
}
.filter-bar__group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-bar__label {
  font-size: 11.5px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
  margin-right: 4px;
  font-weight: 500;
}
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--paper-edge);
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 120ms;
  user-select: none;
}
.filter-tab:hover {
  border-color: var(--ink-4);
  background: #FFF;
}
.filter-tab.is-active {
  background: var(--ink);
  color: #FFF;
  border-color: var(--ink);
}
.filter-tab__count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-4);
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
}
.filter-tab.is-active .filter-tab__count {
  background: rgba(255,255,255,0.18);
  color: #FFF;
}

/* type-tinted active tabs — subtle accent only when active */
.filter-tab--books.is-active    { background: #B47A12; border-color: #B47A12; }
.filter-tab--site.is-active     { background: #1D4ED8; border-color: #1D4ED8; }
.filter-tab--brief.is-active    { background: #2F6B2E; border-color: #2F6B2E; }
.filter-tab--campaign.is-active { background: #A04136; border-color: #A04136; }
.filter-tab--sop.is-active      { background: #2F6B2E; border-color: #2F6B2E; }
.filter-tab--deal.is-active     { background: #A04136; border-color: #A04136; }
.filter-tab--sched.is-active    { background: #6332A0; border-color: #6332A0; }
.filter-tab--apply.is-active    { background: #B47A12; border-color: #B47A12; }
.filter-tab--feedback.is-active { background: #B0561A; border-color: #B0561A; }
.filter-tab--dict.is-active     { background: #1D4ED8; border-color: #1D4ED8; }
.filter-tab--entity.is-active   { background: #3F4856; border-color: #3F4856; }

.filter-select {
  font: inherit;
  font-size: 12.5px;
  border: 1px solid var(--paper-edge);
  background: #FFF;
  color: var(--ink);
  padding: 4px 24px 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
.filter-select:hover { border-color: var(--ink-4); }
.filter-clear {
  background: transparent;
  border: none;
  color: var(--ink-4);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.filter-clear:hover { color: var(--stamp); background: rgba(199,57,46,0.05); }
.tbl--docs-v2 thead th {
  background: var(--paper-deep);
  font-size: 12px;
}
.tbl--docs-v2 td.col-name .cell {
  font-weight: 500;
  color: var(--ink);
  align-items: center;
}
.tbl--docs-v2 td .cell {
  align-items: center;
  font-size: 12.5px;
}

/* stacked 文档名 + 描述 in one cell */
.tbl--docs-v2 td.col-doc {
  padding: 0;
}
.cell-stack {
  display: flex;
  flex-direction: column;
  padding: 7px 12px 8px;
  gap: 1px;
}
.cell-stack .cell {
  padding: 0;
  min-height: auto;
  background: transparent !important;
}
.cell-stack__primary .cell {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}
.cell-stack__secondary .cell {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
  font-weight: 400;
}
.cell-stack__secondary .cell.empty .muted {
  font-style: italic;
  opacity: 0.6;
}
/* keep hover edit affordance distinct */
.cell-stack .cell.is-editable:hover { outline-offset: 0; padding: 0; }
.cell-stack .cell.is-editing { outline-offset: 0 !important; padding: 1px 3px !important; }

/* URL columns — always clamp to 1 line, ellipsis. Full content shown via tooltip.
   Pasted URLs render as compact clickable links; plain text gets ellipsis too,
   so all rows have uniform height. */
td.col-url .cell {
  align-items: center;
  padding: 9px 12px;
  overflow: hidden;
  white-space: nowrap;
}
td.col-url .cell > a.link,
td.col-url .cell > span,
td.col-url .cell .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}
td.col-url .link {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}
td.col-url .link > :first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
td.col-url .link .arrow {
  flex-shrink: 0;
  margin-left: 4px;
}

/* override earlier 2-line clamp in docs-v2 — now consistent single-line everywhere */
.tbl--docs-v2 td.col-url .link {
  -webkit-line-clamp: unset;
  display: inline-flex;
  white-space: nowrap;
  word-break: normal;
}

/* additional tag colors for doc types */
.tag--sop      { background: #E2EDDF; color: #2F6B2E; }
.tag--deal     { background: #F4DCD8; color: #A04136; }
.tag--sched    { background: #ECE3F5; color: #6332A0; }
.tag--apply    { background: #FBEFD6; color: #7A5810; }
.tag--feedback { background: #FFEFE5; color: #B0561A; }
.tag--dict     { background: #DDE7F8; color: #1D4ED8; }
.tag--entity   { background: #E0E5EC; color: #3F4856; }
.tag--default  { background: var(--paper-deep); color: var(--ink-3); }

/* ---------- CONTENT ---------- */
.content {
  padding: 32px 40px 80px;
  max-width: 1500px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--paper-edge);
  padding-bottom: 16px;
}
.page-head__title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 14px;
  margin: 0;
}
.page-head__title .badge-stamp {
  background: var(--stamp);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  transform: rotate(-2deg);
  font-family: var(--font-mono);
}
.page-head__sub {
  color: var(--ink-3);
  font-size: 13px;
  margin-top: 4px;
}
.page-head__meta {
  font-size: 12px;
  color: var(--ink-4);
  font-family: var(--font-mono);
}

.section {
  margin-top: 32px;
}
.section__head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 12px;
}
.section__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.section__sub {
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---------- TABLE ---------- */
.tbl-wrap {
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.tbl thead th {
  background: var(--paper-deep);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 12.5px;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--paper-edge);
  border-right: 1px solid var(--paper-edge);
  position: sticky; top: 0;
  white-space: nowrap;
}
.tbl thead th:last-child { border-right: none; }
.tbl thead th.center { text-align: center; }
.tbl thead .group-head {
  text-align: center;
  border-bottom: 1px solid var(--paper-edge);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.tbl thead .group-head.tint-warm { background: var(--tint-warm); }
.tbl thead .group-head.tint-blue { background: var(--tint-blue); }
.tbl thead .group-head.tint-green { background: var(--tint-green); }
.tbl thead .sub-head.tint-warm { background: var(--tint-warm); color: #7A5810; }
.tbl thead .sub-head.tint-blue { background: var(--tint-blue); color: #1E3F75; }
.tbl thead .sub-head.tint-green { background: var(--tint-green); color: #28522A; }

.tbl tbody td {
  padding: 0;
  border-bottom: 1px solid var(--paper-edge);
  border-right: 1px solid var(--paper-edge);
  vertical-align: top;
}
.tbl tbody td:last-child { border-right: none; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover .cell { background: rgba(0,0,0,0.015); }
.tbl tbody tr.is-paused { opacity: 0.45; }

/* compact mode — denser rows for long lists (operators / platforms) */
.tbl--compact tbody td { font-size: 12.5px; }
.tbl--compact .cell { min-height: 32px; padding: 6px 10px; }
.tbl--compact thead th { padding: 7px 10px; font-size: 12px; }

/* Chinese keep-all (no per-character break) — applies to cells that DO wrap.
   Multi-line cells use this to break at word/punctuation boundaries only. */
.tbl td .cell { word-break: keep-all; }

/* Lock uniform row height. */
.tbl tbody td .cell { box-sizing: border-box; }

.tbl td.tint-warm  .cell { background: rgba(251,241,218,0.55); }
.tbl td.tint-blue  .cell { background: rgba(228,236,248,0.55); }
.tbl td.tint-green .cell { background: rgba(226,237,223,0.55); }
.tbl td.tint-warm  .cell.is-edit { background: var(--tint-warm-h); }
.tbl td.tint-blue  .cell.is-edit { background: var(--tint-blue-h); }
.tbl td.tint-green .cell.is-edit { background: var(--tint-green-h); }

.cell {
  padding: 9px 12px;
  min-height: 36px;
  display: flex; align-items: center;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  min-width: 0;
  position: relative;
  transition: background 100ms;
}
.cell.center { justify-content: center; text-align: center; }
.cell.num { font-variant-numeric: tabular-nums; }
.cell.muted { color: var(--ink-4); font-style: italic; }
.cell.is-editable { cursor: text; }
.cell.is-editable:hover { background: rgba(199,57,46,0.05); outline: 1px dashed rgba(199,57,46,0.3); outline-offset: -1px; }
.cell.is-editing { background: #FFF8E5 !important; outline: 2px solid var(--stamp) !important; outline-offset: -2px; }
.cell input, .cell textarea {
  flex: 1; width: 100%;
  border: none; background: transparent;
  font: inherit; color: inherit;
  padding: 0; margin: 0;
  outline: none;
  resize: none;
  font-variant-numeric: tabular-nums;
}

/* row name col */
.tbl td.col-name .cell { font-weight: 500; color: var(--ink); }
.tbl td.col-id .cell {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-4);
  word-break: break-all;
}
.tbl td.col-pct .cell { justify-content: flex-end; }
.tbl td.col-pct .cell::after {
  content: "%";
  margin-left: 2px;
  color: var(--ink-4);
  font-size: 11px;
}
.tbl td.col-pct .cell.empty::after { content: ""; }

/* status badges */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.status--ok    { color: var(--status-ok);   background: #E6F2EA; }
.status--warn  { color: var(--status-warn); background: #FBEFD6; }
.status--stop  { color: var(--status-stop); background: #F4DCD8; }
.status--mute  { color: var(--status-mute); background: #ECE9E0; }
.status--info  { color: #1D4ED8;            background: #DDE7F8; }

/* link */
.link {
  color: var(--link);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 3px;
  word-break: break-all;
  border-bottom: 1px solid transparent;
}
.link:hover { color: var(--link-deep); border-bottom-color: var(--link-deep); }
.link .arrow { font-size: 0.9em; opacity: 0.7; }

.link-list {
  display: flex; flex-direction: column; gap: 2px;
}

/* add row */
.tbl-foot {
  background: var(--paper-deep);
  border-top: 1px solid var(--paper-edge);
  padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
}
.btn-add {
  background: transparent;
  border: 1px dashed var(--ink-4);
  color: var(--ink-3);
  padding: 6px 14px;
  font: inherit; font-size: 12.5px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-add:hover { color: var(--stamp); border-color: var(--stamp); border-style: solid; background: rgba(199,57,46,0.04); }
/* horizontal-scroll wrapper for wide tables */
.tbl-wrap--scroll {
  overflow-x: auto;
}
.tbl-wrap--scroll .tbl-foot { position: sticky; left: 0; }

/* fixed-layout table — colgroup widths strictly respected, single-line ellipsis by default */
.tbl--fixed { table-layout: fixed; }
.tbl--fixed td .cell { min-width: 0; }
.tbl--fixed td .cell-stack { min-width: 0; }
.tbl--fixed td .cell input,
.tbl--fixed td .cell textarea { min-width: 0; }

/* default cells in fixed tables: single line + ellipsis (uniform row height) */
.tbl--fixed tbody td .cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tbl--fixed tbody td .cell.is-editing { overflow: visible; }
.tbl--fixed tbody td .cell-stack .cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* allow specific cells / columns to wrap when needed (备注 / 多行说明) */
.tbl--fixed tbody td.col-wrap .cell,
.tbl--fixed tbody td .cell.cell--wrap {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* clickable rows in the entity table */
.entity-tbl tbody tr.entity-row { cursor: pointer; }
.entity-tbl tbody tr.entity-row:hover td { background: rgba(199,57,46,0.04); }
.entity-row__chev {
  color: var(--ink-4);
  font-size: 18px;
  line-height: 1;
  transition: color 120ms, transform 120ms;
}
.entity-tbl tbody tr.entity-row:hover .entity-row__chev {
  color: var(--stamp);
  transform: translateX(2px);
}

/* ---------- DRAWER ---------- */
.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(15, 14, 12, 0.32);
  z-index: 200;
  animation: drawer-fade 180ms ease-out;
}
@keyframes drawer-fade { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 520px;
  max-width: 92vw;
  background: var(--paper);
  border-left: 1px solid var(--paper-edge);
  box-shadow: -12px 0 32px rgba(0,0,0,0.08);
  z-index: 201;
  display: flex; flex-direction: column;
  animation: drawer-slide 220ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes drawer-slide {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--paper-edge);
  background: #FFF;
}
.drawer__eyebrow {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.drawer__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
  line-height: 1.35;
  word-break: break-all;
}
.drawer__close {
  background: transparent;
  border: 1px solid var(--paper-edge);
  color: var(--ink-3);
  width: 30px; height: 30px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  display: grid; place-items: center;
  margin-left: 16px;
}
.drawer__close:hover {
  color: var(--stamp);
  border-color: var(--stamp);
  background: rgba(199,57,46,0.05);
}
/* wider drawer variant for entities with many fields */
.drawer--wide {
  width: 600px;
}
.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 28px 60px;
}
.drawer__hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--ink-3);
  background: #FAF7EF;
  border: 1px dashed var(--paper-edge);
  padding: 10px 14px;
  border-radius: 4px;
  line-height: 1.6;
}
.drawer__hint strong { color: var(--stamp); }
.drawer__hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--ink-3);
  background: #FAF7EF;
  border: 1px dashed var(--paper-edge);
  padding: 10px 14px;
  border-radius: 4px;
  line-height: 1.6;
}
.drawer__hint strong { color: var(--stamp); }

/* ---------- PLATFORM DRAWER: sub-tables + doc list ---------- */
.pd-list {
  display: flex;
  flex-direction: column;
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  overflow: hidden;
}
.pd-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  border-bottom: 1px solid var(--paper-edge);
  align-items: center;
}
.pd-row:last-child { border-bottom: none; }
.pd-row__label {
  background: var(--paper);
  padding: 7px 14px;
  font-size: 12px;
  color: var(--ink-2);
  border-right: 1px solid var(--paper-edge);
  min-height: 36px;
  display: flex; align-items: center;
}
.pd-row__val { padding: 0; min-width: 0; }
.pd-row__val .cell {
  padding: 7px 14px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-row__val .cell .link {
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
}

.sub-tbl-wrap {
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  overflow-x: auto;
}
.sub-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.sub-tbl thead th {
  background: var(--paper);
  padding: 6px 10px;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: left;
  border-bottom: 1px solid var(--paper-edge);
  border-right: 1px solid var(--paper-edge);
  white-space: nowrap;
}
.sub-tbl thead th:last-child { border-right: none; }
.sub-tbl tbody td {
  padding: 0;
  border-bottom: 1px solid var(--paper-edge);
  border-right: 1px solid var(--paper-edge);
  vertical-align: top;
  font-size: 12px;
  word-break: keep-all;
}
.sub-tbl tbody td:last-child { border-right: none; }
.sub-tbl tbody tr:last-child td { border-bottom: none; }
.sub-tbl tbody td .cell {
  padding: 6px 10px;
  min-height: 28px;
  font-size: 12px;
}
.sub-tbl-foot {
  padding: 8px 10px;
  background: var(--paper);
  border-top: 1px solid var(--paper-edge);
  display: flex;
  align-items: center;
}

.btn-coltype {
  background: transparent;
  border: 1px solid var(--paper-edge);
  color: var(--ink-4);
  width: 18px; height: 18px;
  font-size: 10px;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  display: inline-grid; place-items: center;
}
.btn-coltype:hover {
  color: var(--stamp);
  border-color: var(--stamp);
}

/* ---------- Revenue split rows in publisher drawer ---------- */
.rev-row {
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 100px 200px 1fr;
  gap: 12px;
  align-items: center;
}
.rev-row__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.rev-row__nums {
  display: flex;
  gap: 8px;
}
.rev-row__num {
  flex: 1;
  text-align: center;
}
.rev-row__sub {
  font-size: 10.5px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.rev-row__val {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 4px;
  padding: 4px 0;
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
}
.rev-row__val .cell {
  padding: 0 6px;
  min-height: 0;
  justify-content: center;
}
.rev-row__val .cell input {
  text-align: center;
}
.rev-row__val--readonly {
  background: transparent;
  color: var(--ink-3);
}
.rev-row__pct {
  font-size: 10.5px;
  color: var(--ink-4);
  margin-left: 1px;
}
.rev-row__note {
  font-size: 12px;
  color: var(--ink-3);
  min-width: 0;
}
.rev-row__note .cell {
  padding: 4px 8px;
  min-height: 26px;
  background: var(--paper);
  border-radius: 4px;
}
  margin-top: 22px;
}
.drawer-sec:first-child { margin-top: 6px; }
.drawer-sec__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--paper-edge);
}
.drawer-sec__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.02em;
}
.drawer-sec__hint {
  font-size: 11px;
  color: var(--ink-4);
}
.drawer-sec__body {
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  overflow: hidden;
}
.drawer-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  border-bottom: 1px solid var(--paper-edge);
  align-items: stretch;
  min-height: 36px;
}
.drawer-row.drawer-row--full {
  grid-template-columns: 1fr;
}
.drawer-row--full .drawer-row__value .cell {
  padding: 12px 14px;
  min-height: 80px;
  align-items: flex-start;
}
.drawer-row:last-child { border-bottom: none; }
.drawer-row__label {
  background: var(--paper);
  padding: 9px 14px;
  font-size: 12px;
  color: var(--ink-3);
  border-right: 1px solid var(--paper-edge);
  display: flex; align-items: center;
}
.drawer-row__value {
  padding: 0;
  font-size: 13px;
  color: var(--ink);
  min-width: 0;
}
.drawer-row__value .cell {
  padding: 9px 14px;
  min-height: 36px;
}
.drawer-row__value .status {
  margin: 9px 14px;
}

.btn-add[disabled] { opacity: 0.4; cursor: not-allowed; }

/* expand row toggle (entity detail) */
.btn-expand {
  background: transparent;
  border: 1px solid var(--paper-edge);
  color: var(--ink-3);
  width: 20px; height: 20px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: grid; place-items: center;
  padding: 0;
  font-family: var(--font-mono);
  transition: all 120ms;
}
.btn-expand:hover {
  border-color: var(--stamp);
  color: var(--stamp);
  background: rgba(199,57,46,0.05);
}
tr.entity-detail td {
  border-bottom: 2px solid var(--paper-edge);
}

.btn-del {
  background: transparent; border: none;
  color: var(--ink-4);
  font: inherit; font-size: 11px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
}
.btn-del:hover { color: var(--stamp); background: rgba(199,57,46,0.08); }

/* ---------- CARDS ---------- */
.card {
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  padding: 20px 24px;
}
.card + .card { margin-top: 12px; }
.card__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  display: flex; align-items: center; gap: 10px;
}
.card__title .stamp-tag {
  background: var(--stamp);
  color: #fff; font-size: 11px;
  padding: 1px 7px; border-radius: 3px;
  font-weight: 500; letter-spacing: 0.04em;
}
.card__sub {
  font-size: 12.5px; color: var(--ink-3);
  margin-bottom: 14px;
}

/* grid of cards — grid-auto-rows: 1fr forces every implicit row to be equal */
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 12px;
  align-items: stretch;
  grid-auto-rows: 1fr;
}
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 > .card,
.grid-3 > .card,
.grid-4 > .card {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
.grid-2 > .card .card__sub:last-child,
.grid-3 > .card .card__sub:last-child,
.grid-4 > .card .card__sub:last-child { margin-bottom: 0; }

/* ---------- FLOW DIAGRAM ---------- */
.flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 20px;
}
.flow__col {
  padding: 24px 22px 28px;
  border-right: 1px dashed var(--paper-edge);
  position: relative;
}
.flow__col:last-child { border-right: none; }
.flow__num {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  background: var(--stamp); color: #fff;
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.flow__title {
  font-size: 17px; font-weight: 600;
  margin: 0 0 4px;
}
.flow__sub {
  font-size: 12px; color: var(--ink-3);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}
.flow__step {
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 7px 0 7px 14px;
  border-left: 2px solid var(--paper-edge);
  position: relative;
  margin-bottom: 2px;
}
.flow__step::before {
  content: ""; position: absolute;
  left: -5px; top: 13px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--paper-edge);
}
.flow__step.is-key::before { background: var(--stamp); border-color: var(--stamp); }
.flow__step.is-key { color: var(--ink); font-weight: 500; }
.flow__arrow {
  position: absolute;
  right: -10px; top: 38px;
  width: 20px; height: 20px;
  background: #FFF;
  display: grid; place-items: center;
  border: 1px solid var(--paper-edge);
  border-radius: 50%;
  color: var(--stamp);
  font-size: 11px;
  z-index: 2;
}

/* hero */
.hero {
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 8px;
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
}
.hero__title {
  font-size: 26px; font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.hero__sub {
  font-size: 13.5px;
  color: var(--ink-3);
  margin: 0 0 12px;
  max-width: 720px;
  line-height: 1.7;
}
.hero__meta {
  display: flex; gap: 24px;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.hero__meta strong {
  display: block;
  font-size: 20px;
  font-family: var(--font-sans);
  color: var(--ink);
  font-weight: 600;
}
.hero__stamp {
  width: 110px; height: 110px;
  border: 2.5px solid var(--stamp);
  color: var(--stamp);
  border-radius: 50%;
  display: grid; place-items: center;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: 0.04em;
  transform: rotate(-8deg);
  font-family: var(--font-sans);
  opacity: 0.88;
  position: relative;
}
.hero__stamp::after {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid var(--stamp);
  border-radius: 50%;
  opacity: 0.4;
}

/* kv list (公司主体 / 文档索引 etc.) */
.kv {
  background: #FFF;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  overflow: hidden;
}
.kv__row {
  display: grid;
  grid-template-columns: 160px 1fr;
  border-bottom: 1px solid var(--paper-edge);
}
.kv__row:last-child { border-bottom: none; }
.kv__k {
  background: var(--paper-deep);
  padding: 11px 16px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
  border-right: 1px solid var(--paper-edge);
}
.kv__v { padding: 0; }

/* callout */
.callout {
  background: var(--stamp-soft);
  border-left: 3px solid var(--stamp);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--stamp-deep);
  border-radius: 0 4px 4px 0;
  margin-bottom: 16px;
  line-height: 1.6;
}
.callout strong { color: var(--stamp-deep); }

.note {
  background: #FAF7EF;
  border: 1px solid var(--paper-edge);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.7;
  margin-bottom: 12px;
}
.note strong { color: var(--ink); }

/* helper */
.muted { color: var(--ink-4); }
.mono { font-family: var(--font-mono); }
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--paper-deep);
  color: var(--ink-3);
  margin-left: 6px;
  font-family: var(--font-mono);
}

/* doc-type tags — small, color-coded */
.tag--type {
  margin-left: 0;
  font-family: var(--font-sans);
  font-size: 11.5px;
  padding: 2px 8px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tag--books    { background: #FBEFD6; color: #7A5810; }
.tag--site     { background: #DDE7F8; color: #1D4ED8; }
.tag--brief    { background: #E2EDDF; color: #2F6B2E; }
.tag--campaign { background: #F4DCD8; color: #A04136; }

/* multi-doc per party — visual grouping via rowspan party cell */
.tbl--docs td.doc-party {
  background: var(--paper);
  border-right: 2px solid var(--paper-edge);
  vertical-align: top;
}
.tbl--docs td.doc-party .cell {
  font-weight: 500;
  padding: 11px 12px;
  align-items: flex-start;
}
.tbl--docs tr.doc-row + tr.doc-row:not(.doc-row--first) > td:not(.doc-party) {
  border-top: 1px dashed var(--paper-edge);
}
.tbl--docs tr.doc-row--last > td {
  border-bottom: 2px solid var(--paper-edge);
}
.tbl--docs tr.doc-row--last:last-child > td {
  border-bottom: none;
}

.btn-add-doc {
  background: transparent;
  border: 1px dashed var(--ink-4);
  color: var(--ink-3);
  font: inherit; font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add-doc:hover {
  border-style: solid;
  border-color: var(--stamp);
  color: var(--stamp);
  background: rgba(199,57,46,0.05);
}

/* edit mode global hint */
.edit-banner {
  background: var(--stamp);
  color: #FFF;
  padding: 6px 20px;
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.02em;
}
.edit-banner strong { font-weight: 600; }
