/*
 * 表格协作模块专用样式（墨档 · 朱批），与 documents/styles.css 共用同一套设计基线。
 * 本模块是独立静态页，因此在此内联一份完整令牌。
 */

:root {
  --paper: #f6f5f1;
  --surface: #fffefb;
  --surface-2: #fbfaf6;
  --line: #e4e1d8;
  --line-strong: #d1cdc1;

  --ink-soft: #edf2f6;
  --ink-tint: #d9e3ec;
  --ink: #345b7d;
  --ink-strong: #284c6b;
  --ink-deep: #1e3a53;

  --cinnabar-soft: #f8ece8;
  --cinnabar-tint: #eccdc4;
  --cinnabar: #b13a2c;
  --cinnabar-deep: #942f23;

  --ok: #286244;

  --text: #2b323a;
  --heading: #1d2833;
  --muted: #6c747e;
  --border: var(--line);
  --bg: var(--paper);

  --radius-sm: 4px;
  --radius: 6px;
  --shadow-card: 0 1px 0 rgba(29, 40, 51, 0.03);
  --shadow-hover: 0 10px 24px rgba(29, 40, 51, 0.08);
  --shadow-pop: 0 12px 32px rgba(29, 40, 51, 0.14);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 140ms;
  --t: 170ms;

  --font-display: "Source Han Serif SC", "Noto Serif SC", "STZhongsong", "STSong",
    "SimSun", "Songti SC", serif;
  --font-sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 280px);
  background-repeat: no-repeat;
}

::selection {
  background: rgba(177, 58, 44, 0.16);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

a {
  color: var(--ink-strong);
  text-decoration: none;
}

a:hover {
  color: var(--ink-deep);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 32px;
  background: rgba(255, 254, 251, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-deep);
}

.brand-mark {
  display: block;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-deep);
  font-size: 13px;
  font-weight: 500;
}

.btn-quiet {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.btn-quiet:hover {
  border-color: var(--line-strong);
  color: var(--ink-deep);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

body[data-page="tables"] .container {
  max-width: 1120px;
}

.page-head {
  position: relative;
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.module-masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  align-items: end;
  gap: 36px;
  margin: 0 0 34px;
  padding: 8px 0 26px;
  border-bottom: 1px solid var(--line-strong);
}

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

.module-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 4px;
  background: var(--cinnabar);
  color: #fff7ef;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 5px 5px 0 var(--cinnabar-soft);
}

.module-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--ink-deep);
}

.module-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.module-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-note {
  margin: 0;
  padding-left: 18px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.module-actions {
  display: flex;
  justify-content: flex-end;
}

.section-index-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.section-index-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--heading);
}

.section-index-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-count {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 7px;
  padding-bottom: 2px;
  color: var(--ink-strong);
  font-size: 13px;
  font-weight: 600;
}

.section-count::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--cinnabar);
}

@media (max-width: 720px) {
  .module-masthead {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .module-seal {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .module-title {
    font-size: 30px;
  }

  .module-note {
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .module-actions {
    justify-content: flex-start;
  }

  .section-index-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

h1 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--heading);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: var(--ink-strong);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--ink);
  color: var(--ink-deep);
}

.btn-danger {
  background: var(--surface);
  border-color: var(--cinnabar-tint);
  color: var(--cinnabar);
}

.btn-danger:hover {
  border-color: var(--cinnabar);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* 表格清单：新建入口与协作表格共用同一套卡片网格 */
.table-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
}

.table-card-list {
  display: contents;
}

.table-card {
  display: flex;
  min-width: 0;
  min-height: 260px;
  padding: 21px 22px 18px;
  flex-direction: column;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--text);
  transition:
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    transform var(--t) var(--ease);
}

.table-card:hover {
  border-color: var(--ink-tint);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.table-card-top {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-card-shape {
  color: var(--ink-strong);
  font-size: 12px;
  font-weight: 600;
}

.table-card-version {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ink-soft);
  color: var(--ink-deep);
  font-size: 11px;
  font-weight: 700;
}

.table-card-title {
  display: -webkit-box;
  min-height: 52px;
  overflow: hidden;
  color: var(--heading);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.table-card-description {
  display: -webkit-box;
  min-height: 42px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.table-card-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.table-card-footer > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.table-card-footer strong {
  overflow: hidden;
  color: var(--ink-deep);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-card-label,
.table-card-time {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.table-card-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-table-card {
  display: flex;
  width: 100%;
  min-height: 260px;
  padding: 30px 24px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-deep);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--t) var(--ease),
    background-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    transform var(--t) var(--ease);
}

.create-table-card:hover {
  border-color: var(--ink);
  background-color: rgba(237, 242, 246, 0.52);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.create-table-card:focus-visible {
  border-color: var(--ink);
  outline-offset: 4px;
}

.create-table-card-icon {
  display: inline-flex;
  width: 58px;
  height: 58px;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  background: var(--ink-soft);
  color: var(--ink-deep);
}

.create-table-card-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.create-table-card-copy {
  display: grid;
  gap: 5px;
}

.create-table-card-copy strong {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.35;
}

.create-table-card-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.table-grid-empty {
  display: flex;
  min-height: 160px;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 960px) {
  .table-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--heading);
  font-weight: 600;
}

.form-grid input,
.form-grid textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: #fff;
}

.form-grid input:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(52, 91, 125, 0.16);
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 40, 51, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 40;
}

.dialog {
  width: min(480px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(29, 40, 51, 0.28);
  padding: 22px;
}

.dialog h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--heading);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.import-dialog {
  width: min(560px, 100%);
}

.import-warning,
.formula-help,
.import-result {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.65;
}

.import-warning {
  border: 1px solid var(--cinnabar-tint);
  background: var(--cinnabar-soft);
  color: var(--cinnabar-deep);
}

.formula-help {
  border-left: 3px solid var(--ink);
  background: var(--ink-soft);
  color: var(--ink-deep);
}

.import-result {
  border: 1px solid var(--cinnabar-tint);
  background: #fff8f5;
  color: var(--cinnabar-deep);
  word-break: break-word;
}

.dialog input[type="file"] {
  padding: 8px;
  background: var(--surface-2);
}

.create-table-dialog {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.create-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.create-dialog-head h2 {
  margin-bottom: 5px;
}

.create-dialog-head p:not(.dialog-kicker) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.dialog-kicker {
  margin: 0 0 5px;
  color: var(--cinnabar);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.dialog-close {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  border-color: var(--ink);
  color: var(--ink-deep);
}

.create-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 18px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.create-mode-tab {
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.create-mode-tab.active {
  background: var(--surface);
  color: var(--ink-deep);
  box-shadow: 0 1px 5px rgba(29, 40, 51, 0.1);
}

.create-table-form {
  gap: 16px;
}

.form-field > label {
  display: block;
  margin-bottom: 7px;
  color: var(--heading);
  font-size: 13px;
  font-weight: 600;
}

.required-mark,
.optional-mark {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 500;
}

.required-mark {
  color: var(--cinnabar);
}

.optional-mark {
  color: var(--muted);
}

.form-error {
  margin: 6px 0 0;
  color: var(--cinnabar);
  font-size: 12px;
}

.create-form-error {
  padding: 10px 12px;
  border: 1px solid var(--cinnabar-tint);
  border-radius: var(--radius-sm);
  background: #fff8f5;
}

.create-mode-panel {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.create-mode-panel.invalid,
.form-field.invalid > input,
.form-field.invalid > textarea {
  border-color: var(--cinnabar);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-heading strong {
  color: var(--heading);
  font-size: 14px;
}

.panel-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.column-count {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ink-soft);
  color: var(--ink-deep);
  font-size: 11px;
  font-weight: 700;
}

.column-builder {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.column-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.column-order {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.column-row input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  font-size: 13px;
}

.column-row input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(52, 91, 125, 0.14);
}

.column-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.column-remove:hover:not(:disabled) {
  border-color: var(--cinnabar-tint);
  color: var(--cinnabar);
}

.column-remove:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-drop {
  display: flex !important;
  min-height: 132px;
  margin: 0 !important;
  padding: 18px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.file-drop:hover,
.file-drop.dragging {
  border-color: var(--ink);
  background: var(--ink-soft);
}

.file-drop strong {
  color: var(--ink-deep);
  font-size: 14px;
}

.file-drop span:last-child,
.file-hint {
  font-size: 12px;
}

.file-drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
}

.selected-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.selected-file strong,
.selected-file span {
  display: block;
}

.selected-file strong {
  color: var(--heading);
  font-size: 13px;
  word-break: break-all;
}

.selected-file span,
.file-hint {
  color: var(--muted);
}

/* 表格编辑器布局 */
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 980px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

.grid-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.selection-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-deep);
}

.selection-text {
  flex: 1;
}

.grid-scroll {
  overflow: auto;
  max-height: 70vh;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table thead th {
  background: var(--surface-2);
  color: var(--ink-deep);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

col.col-rowhead {
  width: 48px;
}

.corner {
  width: 48px;
  background: var(--surface-2);
}

.row-head {
  width: 48px;
  text-align: center;
  color: var(--ink-deep);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  cursor: pointer;
  user-select: none;
}

.col-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  margin-right: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--ink-soft);
  color: var(--ink-deep);
  font-size: 11px;
  font-weight: 700;
}

.col-head {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  padding-right: 14px;
}

.col-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-resize {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
}

.data-table thead th {
  position: sticky;
}

.data-table thead th:has(.col-resize) {
  position: sticky;
}

.data-table tbody tr:hover td {
  background: var(--surface-2);
}

.cell {
  display: block;
  min-height: 22px;
  min-width: 80px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.cell:focus {
  box-shadow: 0 0 0 2px rgba(52, 91, 125, 0.3);
  border-radius: 3px;
}

.cell-editing {
  background: #fbf7eb;
  border-radius: 3px;
}

.cell-active {
  box-shadow: inset 0 0 0 2px rgba(52, 91, 125, 0.35);
}

.cell-formula {
  position: relative;
  padding-right: 16px;
}

.cell-formula::after {
  content: "ƒ";
  position: absolute;
  top: -2px;
  right: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  opacity: 0.75;
}

.cell-locked {
  color: var(--muted);
  cursor: not-allowed;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    rgba(177, 58, 44, 0.035) 5px,
    rgba(177, 58, 44, 0.035) 10px
  );
}

.cell-locked::after {
  content: "锁";
  color: var(--cinnabar);
  font-family: var(--font-sans);
  font-size: 11px;
}

.row-selected td {
  background: var(--ink-soft);
}

.col-selected {
  background: var(--ink-soft);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--heading);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  padding: 6px 12px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.change-list,
.version-list {
  display: grid;
  gap: 10px;
}

.change-item,
.version-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
}

.change-item .kind {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-deep);
}

.change-item .summary {
  font-size: 13px;
  color: var(--text);
  margin-top: 2px;
  word-break: break-word;
}

.change-item .byline,
.version-item .byline {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.version-item .changelog {
  font-size: 13px;
  color: var(--text);
}

.version-item .actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.saving {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--ink-deep);
  color: #fff;
  padding: 8px 14px;
  border-radius: 3px;
  font-size: 13px;
  z-index: 30;
}

.context-menu {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  display: grid;
  gap: 2px;
}

.context-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 3px;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.context-item:hover {
  background: var(--ink-soft);
  color: var(--ink-deep);
}

.context-item.danger {
  color: var(--cinnabar);
}

.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  background: var(--heading);
  color: #fff;
  border-radius: 3px;
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  z-index: 55;
}

.undo-toast .btn-ghost {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.undo-close {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

#toastBox {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 8px;
  z-index: 50;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-hover);
}

.toast-info {
  background: var(--ink-strong);
}

.toast-error {
  background: var(--cinnabar);
}

.toast-success {
  background: #3d7459;
}
