:root {
  color-scheme: light;
  --bg: #fafafa;
  --bg-2: #f5f5f5;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --soft: #f4f4f5;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-light: var(--accent-light);
  --accent-soft: rgba(37, 99, 235, 0.07);
  --accent-strong-soft: rgba(37, 99, 235, 0.12);
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --cell-ink: var(--cell-ink);
  --cell-ink-muted: var(--cell-ink-muted);

  --new-bg: rgba(255, 90, 90, 0.16);
  --new-bg-strong: rgba(255, 110, 110, 0.26);
  --changed-bg: rgba(90, 140, 255, 0.22);
  --success-border: rgba(5, 150, 105, 0.28);
  --danger-ring: rgba(220, 38, 38, 0.2);
  --success-ring: rgba(5, 150, 105, 0.14);}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - 48px);
  transition: grid-template-columns 0.18s ease;
}

.app-shell.is-sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  height: calc(100vh - 48px);
  padding: 12px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: padding 0.18s ease;
}

.sidebar-toggle {
  position: absolute;
  right: 18px;
  bottom: 14px;
  z-index: 12;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.sidebar-toggle:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.18s ease;
}

.app-shell.is-sidebar-collapsed .sidebar-toggle {
  right: 8px;
  bottom: 8px;
}

.app-shell.is-sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.profile-panel {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.profile-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.profile-icon svg {
  width: 22px;
  height: 22px;
}

.profile-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  display: block;
}

.profile-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-copy strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.profile-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.profile-action {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent-dark);
}

.profile-action svg {
  width: 16px;
  height: 16px;
}

.profile-action:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.app-shell.is-sidebar-collapsed .profile-panel {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 16px;
}

.app-shell.is-sidebar-collapsed .profile-icon {
  width: 36px;
  height: 36px;
  border-radius: 13px;
}

.app-shell.is-sidebar-collapsed .profile-icon svg {
  width: 20px;
  height: 20px;
}

.app-shell.is-sidebar-collapsed .profile-copy,
.app-shell.is-sidebar-collapsed .profile-action {
  display: none;
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  padding-bottom: 42px;
}

.app-shell.is-sidebar-collapsed .sidebar {
  padding: 8px;
}

.app-shell.is-sidebar-collapsed .sidebar-panel {
  align-items: center;
  gap: 10px;
  padding-bottom: 42px;
}

.brand {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.brand h1,
.brand p,
.workspace-head h2 {
  margin: 0;
}

.brand h1 {
  font-size: 15px;
  line-height: 1.25;
}

.brand p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.app-shell.is-sidebar-collapsed .brand {
  display: none;
}

.guide-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.guide-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.guide-main-icon {
  display: none;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.guide-main-icon svg {
  width: 18px;
  height: 18px;
}

.guide-head::-webkit-details-marker {
  display: none;
}

.guide-head span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.guide-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.guide-panel-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.guide-panel[open] .guide-panel-chevron {
  transform: rotate(90deg);
}

.app-shell.is-sidebar-collapsed .guide-panel {
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 16px;
  background: var(--surface-soft);
}

.app-shell.is-sidebar-collapsed .guide-head {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 0;
}

.app-shell.is-sidebar-collapsed .guide-main-icon {
  display: grid;
}

.app-shell.is-sidebar-collapsed .guide-head > span:not(.guide-main-icon),
.app-shell.is-sidebar-collapsed .guide-head small,
.app-shell.is-sidebar-collapsed .guide-panel-chevron,
.app-shell.is-sidebar-collapsed .guide-list {
  display: none;
}

.guide-list {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
  padding-right: 2px;
}

.guide-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.guide-item[open] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.guide-summary {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 16px;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  padding: 8px 9px;
  background: transparent;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

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

.guide-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent-strong-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.guide-title {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.guide-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.guide-item[open] .guide-chevron {
  transform: rotate(90deg);
}

.guide-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px 40px;
}

.guide-summary-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.guide-block {
  display: grid;
  gap: 5px;
}

.guide-block-title {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.guide-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.guide-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.guide-chip-soft {
  background: var(--accent-strong-soft);
  color: var(--accent-dark);
}

.guide-steps {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.guide-steps li + li {
  margin-top: 4px;
}

.guide-functions {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-function {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.guide-function strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
}

.guide-function span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.guide-function code {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.catalog-section {
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
}

.catalog-section.is-open {
  border-color: var(--accent-border);
  background: var(--surface);
}

.category-button {
  position: relative;
  display: grid;
  grid-template-columns: 28px 24px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 5px 6px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.category-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: var(--accent-border);
  color: var(--accent-dark);
}

.category-icon svg {
  width: 18px;
  height: 18px;
}

.catalog-section.has-suggested .category-button::after {
  position: absolute;
  top: 7px;
  right: 27px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-border);
  content: "";
}

.catalog-section.has-suggested .category-button {
  animation: functionGlow 1.8s ease-in-out infinite;
}

.catalog-section.has-suggested .category-icon {
  background: var(--accent-border);
  color: var(--accent-dark);
}

.catalog-section.has-unavailable .category-button::after {
  position: absolute;
  top: 7px;
  right: 27px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-ring);
  content: "";
}

.category-button:hover {
  background: var(--soft);
}

.catalog-section.is-open .category-button {
  color: var(--ink);
}

.catalog-section.is-open .category-icon {
  background: var(--accent);
  color: #fff;
}

.category-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.catalog-section.is-open .category-index {
  background: var(--accent);
  color: #fff;
}

.category-title {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: var(--muted);
  transition: transform 0.18s ease;
}

.catalog-section.is-open .chevron {
  transform: rotate(90deg);
}

.function-list {
  display: none;
  gap: 6px;
  padding: 0 6px 8px 40px;
}

.catalog-section.is-open .function-list {
  display: grid;
}

.app-shell.is-sidebar-collapsed .catalog {
  width: 48px;
  align-items: center;
  gap: 8px;
  overflow-x: hidden;
  padding-right: 0;
}

.app-shell.is-sidebar-collapsed .catalog-section {
  width: 48px;
  border-radius: 16px;
}

.app-shell.is-sidebar-collapsed .catalog-section.is-open {
  border-color: transparent;
  background: transparent;
}

.app-shell.is-sidebar-collapsed .category-button {
  display: grid;
  place-items: center;
  width: 48px;
  min-height: 46px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 16px;
}

.app-shell.is-sidebar-collapsed .category-button:hover,
.app-shell.is-sidebar-collapsed .catalog-section.is-open .category-button {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.app-shell.is-sidebar-collapsed .category-icon {
  width: 36px;
  height: 36px;
  border-radius: 13px;
}

.app-shell.is-sidebar-collapsed .category-index,
.app-shell.is-sidebar-collapsed .category-title,
.app-shell.is-sidebar-collapsed .chevron,
.app-shell.is-sidebar-collapsed .function-list {
  display: none;
}

.app-shell.is-sidebar-collapsed .catalog-section.has-suggested .category-button::after,
.app-shell.is-sidebar-collapsed .catalog-section.has-unavailable .category-button::after {
  top: 8px;
  right: 8px;
}

.function-button {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 46px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.function-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.function-content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.function-button:hover,
.function-button.is-selected {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.function-button.is-suggested {
  border-color: var(--accent-border);
  background: var(--surface);
  animation: functionGlow 1.8s ease-in-out infinite;
}

.function-button.is-suggested:hover,
.function-button.is-suggested.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-border),
    0 0 16px var(--accent-border);
}

.function-button.is-unavailable {
  border-color: var(--danger-ring);
  background: var(--danger-soft);
  animation: unavailableGlow 2.2s ease-in-out infinite;
}

.function-dot {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  z-index: 2;
}
.function-dot.is-dot-ok {
  background: var(--success);
  box-shadow: 0 0 0 1.5px var(--success-soft);
}
.function-dot.is-dot-no {
  background: var(--danger);
  box-shadow: 0 0 0 1.5px var(--danger-soft);
}

.function-button.is-unavailable:hover,
.function-button.is-unavailable.is-selected {
  border-color: var(--danger);
  background: var(--danger-soft);
  box-shadow: 0 0 0 1px var(--danger-ring),
    0 0 13px var(--danger-ring);
}

@keyframes functionGlow {
  0%,
  100% {
    box-shadow: 0 0 0 1px var(--accent-border),
      0 0 8px var(--accent-border);
  }

  50% {
    box-shadow: 0 0 0 1px var(--accent-border),
      0 0 16px var(--accent-border);
  }
}

@keyframes unavailableGlow {
  0%,
  100% {
    box-shadow: 0 0 0 1px var(--danger-ring),
      0 0 7px var(--danger-ring);
  }

  50% {
    box-shadow: 0 0 0 1px var(--danger-ring),
      0 0 13px var(--danger-ring);
  }
}

.function-button strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.function-button span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100vh - 48px);
  padding: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.workspace-head h2 {
  font-size: 16px;
  line-height: 1.25;
}

.file-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.history-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.history-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent-dark);
}

.history-button:hover:not(:disabled) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.history-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.history-button svg {
  width: 17px;
  height: 17px;
}

.export-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.export-format {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.export-format select {
  min-width: 68px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  outline: none;
}

.export-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.export-button:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-border);
}

.export-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.export-button svg {
  width: 17px;
  height: 17px;
}

.action-bar {
  display: grid;
  grid-template-columns: auto auto minmax(110px, 140px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 0 16px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.config-panel[hidden] {
  display: none;
}

.config-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  min-height: 38px;
  flex-shrink: 0;
  margin: 0 16px 10px;
  padding: 10px;
  border: 1px solid var(--accent-border);
  border-radius: 18px;
  background: var(--accent-border);
}

.config-title {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.config-selection-notice {
  display: inline-flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--accent-border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.config-selection-notice span {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-weight: 800;
}

.config-selection-notice strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-panel label {
  display: grid;
  flex: 1 1 118px;
  grid-template-columns: auto minmax(68px, 1fr);
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.config-panel label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.choice-group {
  display: flex;
  flex: 1 1 460px;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.choice-group.is-multi {
  flex: 1 1 100%;
}

.choice-group.is-from-selection {
  padding: 6px;
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  background: var(--accent-border);
}

.config-choice {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.config-choice:hover,
.config-choice.is-active {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 0 0 2px var(--accent-border);
}

.condition-builder {
  display: grid;
  gap: 8px;
}

.condition-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.condition-add,
.condition-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-dark);
  font-weight: 800;
}

.condition-add {
  padding: 0 8px;
  font-size: 12px;
}

.condition-row {
  display: grid;
  grid-template-columns: minmax(118px, 1fr) 92px minmax(108px, 1fr) 26px;
  gap: 6px;
  align-items: center;
}

.lookup-row {
  grid-template-columns: minmax(118px, 1fr) 26px minmax(118px, 1fr) 26px;
}

.condition-link,
.condition-value-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.config-panel select,
.config-panel input {
  width: 100%;
  min-width: 0;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  outline: 0;
  padding: 0 7px;
}

.config-panel select:focus,
.config-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-border);
}

.config-panel label.is-from-selection select,
.config-panel label.is-from-selection input {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-strong-soft);
}

.import-button,
.execute-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 13px;
}

/* 操作模板命名弹窗 */
.template-name-body {
  padding: 18px 22px 20px;
  gap: 10px;
}

.template-name-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.template-name-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.template-name-input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.template-name-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}

.template-name-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.modal-cancel-btn,
.modal-confirm-btn {
  min-height: 32px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.modal-cancel-btn:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.modal-confirm-btn {
  border: 1px solid var(--accent-border);
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 4px 14px rgba(37, 99, 235, 0.25);
}

.modal-confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.3) inset, 0 6px 18px rgba(37, 99, 235, 0.3);
}

/* 录制操作模板时的「完成并保存」按钮 */
.record-finish-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: linear-gradient(180deg, #34d399, #10b981);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 4px 14px rgba(16, 185, 129, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.record-finish-button[hidden] {
  display: none;
}

.record-finish-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.3) inset, 0 6px 18px rgba(16, 185, 129, 0.3);
}

.record-finish-button:active {
  transform: translateY(0);
}

.import-button {
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-dark);
  cursor: pointer;
}

.reference-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--cell-ink-muted);
}

.reference-button:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.import-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.execute-button {
  border: 0;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
}

.execute-button:hover {
  filter: brightness(0.98);
}

.selected-card,
.formula-card {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.selected-card span,
.formula-card span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.selected-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--accent-dark);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

code {
  min-width: 0;
  overflow: hidden;
  color: var(--cell-ink-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  margin: 0 16px 4px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.3;
}

.status-panel.is-ok {
  border-color: var(--success-border);
  border-left-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.status-panel.is-error {
  border-color: var(--danger-ring);
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.status-panel.is-selection {
  grid-template-columns: auto minmax(0, 1fr);
  border-color: var(--accent-border);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 6px 10px;
  font-size: 12px;
}

.status-panel strong,
.status-panel span {
  min-width: 0;
}

.table-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin: 0 16px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  background: var(--surface-soft);
}

.table-wrap:focus {
  outline: none;
}

.table-wrap:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-border);
}

.table-preview-note {
  position: sticky;
  top: 0;
  z-index: 6;
  flex: 0 0 auto;
  padding: 6px 10px;
  border-bottom: 1px solid var(--accent-border);
  background: var(--accent-strong-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.preview-more-btn {
  margin-left: 8px;
  padding: 2px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.preview-more-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.sheet-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.empty-table {
  display: grid;
  flex: 1;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-table strong {
  color: var(--ink);
  font-size: 18px;
}

.sheet-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  line-height: 1.35;
}

.sheet-table th,
.sheet-table td {
  width: 72px;
  min-width: 44px;
  max-width: 320px;
  height: 30px;
  padding: 5px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--soft);
  color: var(--cell-ink-muted);
  font-weight: 800;
}

.sheet-corner {
  left: 0;
  z-index: 7;
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  cursor: pointer;
  background:
    linear-gradient(135deg, transparent 49%, var(--line-strong) 50%, transparent 51%),
    var(--soft);
}

.sheet-column {
  cursor: pointer;
  text-align: center;
}

.sheet-row-number {
  position: sticky;
  top: auto;
  left: 0;
  z-index: 3;
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  cursor: pointer;
  background: var(--soft);
  color: var(--cell-ink-muted);
  text-align: center;
}

.sheet-table thead .sheet-row-number,
.sheet-table thead .sheet-corner {
  z-index: 7;
}

/* 字段行（真实表头：姓名/班级…）跟随列标行一起冻结 */
.sheet-table tbody .sheet-field-row {
  position: sticky;
  top: 30px;
  z-index: 7;
}
.sheet-table tbody .sheet-field-row td {
  background: var(--surface);
}
.sheet-table tbody .sheet-field-row td.sheet-field-cell {
  background: var(--surface);
}

/* 设置开关：关闭冻结首行 */
body.no-freeze-header .sheet-table thead th {
  position: static;
}
body.no-freeze-header .sheet-table tbody .sheet-field-row {
  position: static;
}

/* 设置开关：冻结首列（A 列数据列固定在序号列右侧） */
body.freeze-first-col .sheet-table thead th:nth-child(2),
body.freeze-first-col .sheet-table tbody td:nth-child(2) {
  position: sticky;
  left: 46px;
  z-index: 6;
  background: var(--surface);
}
body.freeze-first-col .sheet-table thead th:nth-child(2) {
  background: var(--soft);
  z-index: 8;
}

.sheet-field-row .sheet-row-number {
  top: auto;
}

.sheet-field-row .sheet-row-number {
  z-index: 5;
}

.sheet-field-cell {
  background: var(--surface);
  color: var(--cell-ink);
  font-weight: 800;
}

.sheet-table td {
  position: relative;
  background: var(--surface);
  color: var(--cell-ink);
}

.sheet-table th,
.sheet-table td {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.sheet-table td[data-editable-cell="true"] {
  cursor: cell;
  caret-color: transparent;
}

.sheet-table td[contenteditable="true"]:focus {
  cursor: text;
  caret-color: var(--success);
  -webkit-user-select: text;
  user-select: text;
}

body.is-sheet-selecting,
body.is-sheet-selecting .sheet-table {
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
}

body.is-sheet-selecting * {
  -webkit-user-select: none !important;
  user-select: none !important;
}

body.is-sheet-selecting ::selection {
  background: transparent;
}

body.is-sheet-selecting .sheet-table td[contenteditable="true"] {
  cursor: crosshair;
  caret-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.sheet-selection-overlay {
  position: fixed;
  z-index: 70;
  border: 1px solid var(--success);
  background: var(--success-ring);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.sheet-selection-overlay[hidden] {
  display: none;
}

.sheet-table td[contenteditable="true"]:focus {
  outline: 1px solid var(--success);
  outline-offset: -1px;
  z-index: 5;
}

.sheet-table tbody tr:hover td,
.sheet-table tbody tr:hover .sheet-row-number {
  background: var(--surface-soft);
}

/* 冻结首列时 A 列（sticky 背景特异性高）同样跟随行悬停变色 */
body.freeze-first-col .sheet-table tbody tr:hover td:nth-child(2) {
  background: var(--surface-soft);
}

/* 冻结首列时 A 列补齐全部高亮类（整行选中/整列选中/新增/更改等），
   否则 sticky 固定背景会盖住这些标记，表现为"A 列不变色" */
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-active-row,
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-active-column {
  background: var(--success-ring);
}
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-selected-range {
  background: transparent;
}
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-changed {
  background: var(--changed-bg);
}
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-new {
  background: var(--new-bg);
}
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-new.is-selected-range,
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-new.is-active-row,
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-new.is-active-column {
  background: var(--new-bg);
}
/* 新增行（tr.is-new-row 级背景）：A 列 sticky 背景需透出同样高亮 */
body.freeze-first-col .sheet-table tbody tr.is-new-row td:nth-child(2) {
  background: var(--new-bg);
}
body.freeze-first-col .sheet-table tbody tr.is-new-row td:nth-child(2).is-selected-range {
  background: var(--new-bg-strong);
}
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-changed.is-selected-range,
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-changed.is-active-row,
body.freeze-first-col .sheet-table tbody td:nth-child(2).is-changed.is-active-column {
  background: var(--changed-bg);
}

.sheet-corner:hover,
.sheet-column:hover,
.sheet-row-number:hover {
  background-color: var(--line);
  color: var(--success-dark);
}

.sheet-column.is-active,
.sheet-row-number.is-active {
  background: var(--success-ring);
  color: var(--success-dark);
}

.sheet-table td.is-active-row,
.sheet-table td.is-active-column {
  background: var(--success-ring);
}

/* 表头字段行（行号 1）的固定背景特异性更高，选中整行时需显式透出高亮 */
body .sheet-table tbody .sheet-field-row td.sheet-field-cell.is-active-row {
  background: var(--success-ring);
}

/* 表头字段行悬停时跟随普通行变色（固定背景需显式覆盖） */
body .sheet-table tbody .sheet-field-row:hover td.sheet-field-cell {
  background: var(--surface-soft);
}
body .sheet-table tbody .sheet-field-row:hover td.sheet-field-cell.is-active-row,
body .sheet-table tbody .sheet-field-row:hover td.sheet-field-cell.is-selected-range {
  background: var(--success-ring);
}

.sheet-table td.is-selected-range {
  /* 选中区域不做单元格级边框/填充，选中视觉统一由 fixed 定位的选中框承担，
     避免网格线视觉变粗，且滚动时选中框留在屏幕原位置 */
  background: transparent;
}

.sheet-table td.is-selected {
  z-index: 2;
}

.sheet-table td.is-selected::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--surface);
  background: var(--success);
  content: "";
}

.sheet-table td.is-new {
  background: var(--new-bg);
  color: var(--new-ink, var(--danger-dark));
  font-weight: 700;
}

.sheet-table tr.is-new-row td {
  background: var(--new-bg);
  color: var(--new-ink, inherit);
}
.sheet-table tr.is-new-row td.is-selected-range {
  background: var(--new-bg-strong);
}

.sheet-table td.is-changed {
  background: var(--changed-bg);
  color: var(--changed-ink, inherit);
}

.sheet-table td.is-new.is-selected-range {
  background: var(--new-bg);
}

.sheet-table td.is-changed.is-selected-range {
  background: var(--changed-bg);
}

.sheet-table td.is-new.is-active-row,
.sheet-table td.is-new.is-active-column {
  background: var(--new-bg);
}

.sheet-table td.is-changed.is-active-row,
.sheet-table td.is-changed.is-active-column {
  background: var(--changed-bg);
}

.sheet-table td.is-new.is-selected-range.is-active-row,
.sheet-table td.is-new.is-selected-range.is-active-column {
  background: var(--new-bg);
}

.sheet-table td.is-changed.is-selected-range.is-active-row,
.sheet-table td.is-changed.is-selected-range.is-active-column {
  background: var(--changed-bg);
}

.cell-change {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
}

.cell-before,
.cell-after {
  display: inline-block;
  max-width: 104px;
  overflow: hidden;
  padding: 2px 6px;
  border-radius: 6px;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.cell-before {
  background: var(--change-bg);
  color: var(--success);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.cell-after {
  background: var(--changed-bg);
  color: var(--accent-dark);
  font-weight: 700;
}

.cell-arrow {
  color: var(--muted);
  font-size: 12px;
}

.sheet-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  padding: 0 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--cell-ink-muted);
  font-size: 12px;
  font-weight: 700;
}

.sheet-status span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.sheet-selection-stats {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--accent-dark);
  text-align: center;
  text-overflow: ellipsis;
}

.selection-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  min-width: 132px;
  overflow: hidden;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(44, 44, 46, 0.12);
}

.selection-menu[hidden] {
  display: none;
}

.selection-menu button {
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.selection-menu button:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.selection-menu button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.46;
}

.selection-menu-divider {
  height: 1px;
  margin: 5px 4px;
  background: var(--line);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .app-shell.is-sidebar-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.is-sidebar-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .sidebar {
    position: relative;
    height: auto;
    max-height: 58vh;
  }

  .workspace {
    padding: 20px;
  }

  .workspace-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .action-bar,
  .status-panel {
    grid-template-columns: 1fr;
  }

}

@media (prefers-reduced-motion: reduce) {
  .catalog-section.has-suggested .category-button,
  .function-button.is-suggested {
    animation: none;
    box-shadow: 0 0 0 1px var(--accent-border),
      0 0 10px var(--accent-border);
  }

  .function-button.is-unavailable {
    animation: none;
    box-shadow: 0 0 0 1px var(--danger-ring),
      0 0 9px var(--danger-ring);
  }
}

/* ============================================
   顶部标签页布局（方案B）覆盖样式
   ============================================ */

.app-shell.is-top-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: calc(100vh - 48px);
  min-height: 0;
  grid-template-columns: none;
}

/* 隐藏旧sidebar（HTML中已移除，这里防御性处理） */
.app-shell.is-top-nav .sidebar {
  display: none !important;
}

/* 顶部导航栏 */
.top-nav {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 12px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 3px;
}

.top-nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-nav-left .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-nav-left .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: url('icon.png') center / cover no-repeat;
  box-shadow: 0 1px 3px var(--accent-border);
}

.top-nav-left .brand-text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.top-nav-left .brand-text p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.top-nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.top-nav-center .guide-panel {
  width: auto;
  min-width: 160px;
}

.top-nav-center .guide-head {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.top-nav-right {
  display: flex;
  align-items: center;
}

.top-nav-right .profile-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 10px;
  background: var(--soft);
}

.top-nav-right .profile-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.top-nav-right .profile-icon svg {
  width: 16px;
  height: 16px;
}

.top-nav-right .profile-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.top-nav-right .profile-copy strong {
  font-size: 12px;
  color: var(--ink);
}

.top-nav-right .profile-copy span {
  font-size: 10px;
  color: var(--muted);
}

/* 功能分类标签页 */
.category-tabs {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 2px;
  overflow: hidden;
}

.category-tabs-scroll {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.category-tabs-scroll::-webkit-scrollbar {
  height: 4px;
}

.category-tabs-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

.category-tab-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 6px;
  border-right: 1px solid var(--line);
}

.category-tab-group:last-child {
  border-right: none;
}

.category-tab-group-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 4px;
  line-height: 1.3;
  white-space: nowrap;
}

.category-tab-group-tabs {
  display: flex;
  gap: 4px;
}

.category-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
}

.category-tab:hover {
  background: var(--soft);
  color: var(--ink);
}

.category-tab.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-border);
}

.category-tab-icon {
  display: grid;
  place-items: center;
}

.category-tab-icon svg {
  width: 14px;
  height: 14px;
}

.category-tab-label {
  line-height: 1;
}

/* 主工作区 */
.app-shell.is-top-nav .workspace {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* 操作栏 */
.app-shell.is-top-nav .action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px 8px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.action-bar-left {
  display: flex;
  gap: 8px;
}

.action-bar-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.action-bar-right {
  display: flex;
  align-items: center;
}

.app-shell.is-top-nav .selected-card,
.app-shell.is-top-nav .formula-card {
  padding: 3px 10px;
  min-height: 26px;
}

.app-shell.is-top-nav .selected-card strong,
.app-shell.is-top-nav .formula-card code {
  font-size: 12px;
}

/* 函数按钮网格区 */
.function-grid-panel {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 4px 8px;
}

.function-grid-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
}

.function-grid-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.function-grid-count {
  font-size: 11px;
  color: var(--muted);
}

/* catalog改为网格布局 */
.app-shell.is-top-nav .catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 0;
  overflow: visible;
}

.app-shell.is-top-nav .catalog-section {
  display: none;
}

.app-shell.is-top-nav .function-button {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.app-shell.is-top-nav .function-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-border);
}

.app-shell.is-top-nav .function-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-border);
}

.app-shell.is-top-nav .function-number {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.app-shell.is-top-nav .function-button.is-selected .function-number {
  background: var(--accent);
  color: #fff;
}

.app-shell.is-top-nav .function-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.app-shell.is-top-nav .function-content strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.app-shell.is-top-nav .function-content span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 配置面板 */
.app-shell.is-top-nav .config-panel {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 7px 10px;
}

/* 状态栏 */
.app-shell.is-top-nav .status-panel {
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 12px;
}

/* 表格预览区 */
.app-shell.is-top-nav .table-panel {
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-shell.is-top-nav .table-wrap {
  height: 100%;
  max-height: none;
  min-height: 0;
}

/* 底部工具条 */
.workspace-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.foot-left {
  display: flex;
  align-items: center;
}

.foot-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workspace-foot .file-meta {
  font-size: 12px;
  color: var(--muted);
}

.selection-stats {
  margin-left: 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}

.app-version {
  margin-left: 10px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  background: var(--accent-border);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  white-space: nowrap;
}

.workspace-foot .export-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-foot .export-format {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.workspace-foot .export-format select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  background: var(--surface);
}

.workspace-foot .export-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.workspace-foot .export-button:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.workspace-foot .export-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.workspace-foot .export-button svg {
  width: 14px;
  height: 14px;
}

.workspace-foot .history-actions {
  display: flex;
  gap: 4px;
}

.workspace-foot .history-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  transition: all 0.15s ease;
}

.workspace-foot .history-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.workspace-foot .history-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.workspace-foot .history-button svg {
  width: 16px;
  height: 16px;
}

/* 旧workspace-head隐藏（内容已移到底部工具条） */
.app-shell.is-top-nav .workspace-head {
  display: none;
}

/* 响应式 */
@media (max-width: 900px) {
  .top-nav {
    flex-wrap: wrap;
  }

  .top-nav-center {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .action-bar {
    flex-wrap: wrap;
  }

  .action-bar-center {
    order: 3;
    width: 100%;
  }

  .app-shell.is-top-nav .catalog {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .app-shell.is-top-nav .catalog {
    grid-template-columns: 1fr;
  }

  .workspace-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .foot-right {
    justify-content: space-between;
  }
}

/* ============================================
   紧凑模式：压缩上方区域，扩大表格区
   ============================================ */

/* 整体间距压缩 */
.app-shell.is-top-nav {
  gap: 0;
}

.app-shell.is-top-nav .workspace {
  gap: 8px;
}

/* 顶部导航栏压缩 */
.top-nav {
  padding: 8px 16px;
  margin-bottom: 8px;
  border-radius: 12px;
}

.top-nav-left .brand-mark {
  width: 30px;
  height: 30px;
  font-size: 14px;
  border-radius: 8px;
}

.top-nav-left .brand-text h1 {
  font-size: 14px;
}

.top-nav-left .brand-text p {
  font-size: 10px;
  margin-top: 1px;
}

.top-nav-center .guide-head {
  padding: 6px 12px;
  font-size: 12px;
}

.top-nav-right .profile-panel {
  padding: 4px 10px;
}

.top-nav-right .profile-icon {
  width: 24px;
  height: 24px;
}

.top-nav-right .profile-icon svg {
  width: 14px;
  height: 14px;
}

/* 标签页栏压缩 */
.category-tabs {
  margin-bottom: 8px;
  border-radius: 12px;
}

.category-tabs-scroll {
  padding: 6px 10px;
}

.category-tab-group {
  gap: 2px;
  padding: 0 6px;
}

.category-tab-group-label {
  font-size: 9px;
  padding: 0 2px;
}

.category-tab {
  padding: 5px 10px;
  font-size: 11px;
  gap: 4px;
  border-radius: 8px;
}

.category-tab-icon svg {
  width: 12px;
  height: 12px;
}

/* 操作栏压缩 */
.app-shell.is-top-nav .action-bar {
  padding: 8px 12px;
  border-radius: 12px;
  gap: 8px;
}

.app-shell.is-top-nav .selected-card,
.app-shell.is-top-nav .formula-card {
  padding: 6px 10px;
}

.app-shell.is-top-nav .selected-card strong,
.app-shell.is-top-nav .formula-card code {
  font-size: 11px;
}

.app-shell.is-top-nav .selected-card span,
.app-shell.is-top-nav .formula-card span {
  font-size: 10px;
}

/* 函数按钮区：改为紧凑横向滚动 */
.function-grid-panel {
  padding: 8px 12px;
  border-radius: 12px;
}

.function-grid-header {
  display: none;
}

.app-shell.is-top-nav .catalog {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 6px;
  padding: 2px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.app-shell.is-top-nav .catalog::-webkit-scrollbar {
  height: 3px;
}

.app-shell.is-top-nav .function-button {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  width: auto;
  min-height: 0;
}

.app-shell.is-top-nav .function-button:hover {
  transform: none;
}

.app-shell.is-top-nav .function-number {
  width: 20px;
  height: 20px;
  font-size: 10px;
  border-radius: 6px;
}

.app-shell.is-top-nav .function-content {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.app-shell.is-top-nav .function-content strong {
  font-size: 12px;
  white-space: nowrap;
}

.app-shell.is-top-nav .function-content span {
  display: none;
}

/* 配置面板压缩 */
.app-shell.is-top-nav .config-panel {
  padding: 10px 14px;
  border-radius: 12px;
}

.app-shell.is-top-nav .config-panel label {
  margin-bottom: 6px;
}

.app-shell.is-top-nav .config-panel label span {
  font-size: 11px;
  margin-bottom: 3px;
}

.app-shell.is-top-nav .config-panel select,
.app-shell.is-top-nav .config-panel input {
  padding: 5px 8px;
  font-size: 12px;
}

.app-shell.is-top-nav .config-title {
  font-size: 12px;
  margin-bottom: 8px;
}

/* 状态栏压缩 */
.app-shell.is-top-nav .status-panel {
  padding: 8px 14px;
  border-radius: 10px;
}

.app-shell.is-top-nav .status-panel strong {
  font-size: 12px;
}

.app-shell.is-top-nav .status-panel span {
  font-size: 11px;
}

/* 表格区域扩大 */
.app-shell.is-top-nav .table-panel {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 12px;
}

.app-shell.is-top-nav .table-wrap {
  min-height: 0;
}

/* 底部工具条压缩 */
.workspace-foot {
  padding: 6px 14px;
  border-radius: 12px;
  gap: 10px;
}

.workspace-foot .file-meta {
  font-size: 11px;
}

.workspace-foot .export-format {
  font-size: 11px;
}

.workspace-foot .export-format select {
  padding: 4px 8px;
  font-size: 11px;
}

.workspace-foot .export-button {
  padding: 6px 14px;
  font-size: 11px;
}

.workspace-foot .export-button svg {
  width: 12px;
  height: 12px;
}

.workspace-foot .history-button {
  width: 28px;
  height: 28px;
}

.workspace-foot .history-button svg {
  width: 14px;
  height: 14px;
}

/* ============================================
   极致压缩 + 按钮质感升级
   ============================================ */

/* 全局间距压缩 */
body {
  padding: 10px 14px;
}

.app-shell.is-top-nav {
  min-height: calc(100vh - 20px);
  gap: 0;
}

/* workspace去除背景阴影，子元素各自有 */
.app-shell.is-top-nav .workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 0 !important;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  border-radius: 0;
}

/* 隐藏表格内重复的状态栏（底部工具条已有） */
.app-shell.is-top-nav .sheet-status {
  display: none;
}

/* 顶部导航极致压缩 */
.top-nav {
  padding: 5px 12px;
  margin-bottom: 4px;
  border-radius: 10px;
  gap: 10px;
}

.top-nav-left .brand {
  gap: 8px;
}

.top-nav-left .brand-mark {
  width: 28px;
  height: 28px;
  font-size: 13px;
  border-radius: 7px;
}

.top-nav-left .brand-text h1 {
  font-size: 13px;
}

.top-nav-left .brand-text p {
  font-size: 9px;
  margin-top: 0;
}

.top-nav-center .guide-head {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
}

.top-nav-right .profile-panel {
  padding: 3px 8px;
  gap: 6px;
}

.top-nav-right .profile-icon {
  width: 22px;
  height: 22px;
}

.top-nav-right .profile-copy strong {
  font-size: 11px;
}

.top-nav-right .profile-copy span {
  font-size: 9px;
}

/* 标签页极致压缩 */
.category-tabs {
  margin-bottom: 4px;
  border-radius: 10px;
}

.category-tabs-scroll {
  padding: 3px 8px;
  gap: 0;
}

.category-tab-group {
  gap: 2px;
  padding: 0 5px;
}

.category-tab-group-label {
  font-size: 8px;
  padding: 0 2px;
}

.category-tab {
  padding: 3px 8px;
  font-size: 11px;
  gap: 4px;
  border-radius: 7px;
}

/* 操作栏极致压缩 */
.app-shell.is-top-nav .action-bar {
  padding: 5px 10px;
  border-radius: 10px;
  gap: 8px;
}

.app-shell.is-top-nav .selected-card,
.app-shell.is-top-nav .formula-card {
  padding: 4px 8px;
  gap: 4px;
}

.app-shell.is-top-nav .selected-card strong,
.app-shell.is-top-nav .formula-card code {
  font-size: 11px;
}

.app-shell.is-top-nav .selected-card span,
.app-shell.is-top-nav .formula-card span {
  font-size: 9px;
}

/* 函数按钮区极致压缩 */
.function-grid-panel {
  padding: 5px 10px;
  border-radius: 10px;
  margin-top: 0;
}

.app-shell.is-top-nav .catalog {
  gap: 4px;
  padding: 0;
}

.app-shell.is-top-nav .function-button {
  padding: 2px 7px;
  gap: 5px;
  border-radius: 7px;
}

.app-shell.is-top-nav .function-number {
  width: 18px;
  height: 18px;
  font-size: 9px;
  border-radius: 5px;
}

.app-shell.is-top-nav .function-content strong {
  font-size: 11px;
}

/* 配置面板压缩 */
.app-shell.is-top-nav .config-panel {
  padding: 6px 10px;
  border-radius: 10px;
}

.app-shell.is-top-nav .config-title {
  font-size: 11px;
  margin-bottom: 6px;
}

.app-shell.is-top-nav .config-panel label {
  margin-bottom: 5px;
  gap: 3px;
}

.app-shell.is-top-nav .config-panel label span {
  font-size: 10px;
  margin-bottom: 2px;
}

.app-shell.is-top-nav .config-panel select,
.app-shell.is-top-nav .config-panel input {
  padding: 4px 7px;
  font-size: 11px;
  border-radius: 6px;
}

/* 状态栏压缩 */
.app-shell.is-top-nav .status-panel {
  padding: 5px 10px;
  border-radius: 8px;
  gap: 8px;
}

.app-shell.is-top-nav .status-panel strong {
  font-size: 11px;
}

.app-shell.is-top-nav .status-panel span {
  font-size: 10px;
}

/* 表格区域 */
.app-shell.is-top-nav .table-panel {
  min-height: 0;
  border-radius: 10px;
}

.app-shell.is-top-nav .table-wrap {
  min-height: 0;
}

/* 底部工具条压缩 */
.workspace-foot {
  padding: 4px 10px;
  border-radius: 10px;
  gap: 8px;
}

/* ============================================
   按钮质感升级
   ============================================ */

/* 主按钮（开始执行） */
.execute-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 50%, var(--accent-dark) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 1px 2px var(--accent-border),
    0 4px 12px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.execute-button:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 50%, var(--accent) 100%);
  box-shadow:
    0 2px 4px var(--accent-border),
    0 6px 16px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.execute-button:active {
  transform: translateY(0);
  box-shadow:
    0 1px 2px var(--accent-border),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 导出按钮 */
.workspace-foot .export-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 1px 2px var(--accent-border),
    0 2px 8px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.workspace-foot .export-button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  box-shadow:
    0 2px 4px var(--accent-border),
    0 4px 12px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* 导入/参考表按钮 */
.import-button {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.import-button:hover {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border-color: var(--accent);
  box-shadow:
    0 2px 6px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
  color: var(--accent);
}

.import-button:active {
  transform: translateY(0);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.05),
    inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 函数按钮质感 */
.app-shell.is-top-nav .function-button {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-shell.is-top-nav .function-button:hover {
  background: linear-gradient(180deg, var(--surface) 0%, var(--accent-strong-soft) 100%);
  border-color: var(--accent);
  box-shadow:
    0 2px 6px var(--accent-border),
    0 0 0 1px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.app-shell.is-top-nav .function-button.is-selected {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--accent-strong-soft) 100%);
  border-color: var(--accent);
  box-shadow:
    0 2px 8px var(--accent-border),
    0 0 0 2px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.app-shell.is-top-nav .function-button.is-selected .function-number {
  background: linear-gradient(135deg, var(--accent), var(--accent));
  box-shadow: 0 1px 3px var(--accent-border);
}

/* 函数编号质感 */
.app-shell.is-top-nav .function-number {
  background: linear-gradient(180deg, var(--soft) 0%, var(--line) 100%);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-weight: 700;
}

/* 标签页按钮质感 */
.category-tab {
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-tab:hover {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.category-tab.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 2px 6px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 600;
}

/* 历史按钮质感 */
.workspace-foot .history-button {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.workspace-foot .history-button:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--surface) 0%, var(--accent-strong-soft) 100%);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow:
    0 2px 4px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* 下拉选择框质感 */
.app-shell.is-top-nav .config-panel select,
.workspace-foot .export-format select {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.18s ease;
  cursor: pointer;
}

.app-shell.is-top-nav .config-panel select:focus,
.workspace-foot .export-format select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px var(--accent-border),
    0 1px 2px rgba(0, 0, 0, 0.03);
}

/* 卡片容器质感统一 */
.top-nav,
.category-tabs,
.app-shell.is-top-nav .action-bar,
.function-grid-panel,
.app-shell.is-top-nav .config-panel,
.app-shell.is-top-nav .status-panel,
.app-shell.is-top-nav .table-panel,
.workspace-foot {
  margin: 0;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ============================================
   顶部导航重新设计
   ============================================ */

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
}

.top-nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8);
}

.nav-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--ink);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon-btn:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--surface) 0%, var(--accent-strong-soft) 100%);
  box-shadow: 0 2px 6px rgba(37,99,235,0.1), inset 0 1px 0 rgba(255,255,255,0.9);
  transform: translateY(-1px);
}

.nav-icon-btn:hover svg {
  stroke: var(--accent);
}

.top-nav .brand {
  gap: 8px;
}

.top-nav .brand-mark {
  width: 28px;
  height: 28px;
  font-size: 13px;
  border-radius: 7px;
}

.top-nav .brand-text h1 {
  font-size: 14px;
  margin: 0;
}

.top-nav-right {
  display: flex;
  align-items: center;
}

.profile-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8);
}

.profile-panel:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--surface) 0%, var(--accent-strong-soft) 100%);
  box-shadow: 0 2px 6px rgba(37,99,235,0.1);
  transform: translateY(-1px);
}

.profile-panel .profile-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-strong-soft));
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-panel .profile-icon svg {
  width: 14px;
  height: 14px;
  stroke: var(--accent);
  stroke-width: 1.8;
  fill: none;
}

.profile-panel .profile-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.profile-panel .profile-copy strong {
  font-size: 12px;
  color: var(--ink);
}

.profile-panel .profile-copy span {
  font-size: 10px;
  color: var(--muted);
}

.profile-chevron {
  width: 14px;
  height: 14px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
  transition: transform 0.2s ease;
}

.profile-panel:hover .profile-chevron {
  stroke: var(--accent);
}

/* ============================================
   弹窗通用样式
   ============================================ */

/* 查找替换弹窗 */
.find-modal { width: min(560px, calc(100vw - 48px)); }
.find-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.format-btns { display: flex; gap: 8px; align-items: center; padding-bottom: 2px; }
.format-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.format-toggle:hover { border-color: var(--accent); color: var(--accent); }
.format-toggle.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.format-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.format-hint { font-size: 12px; color: var(--muted); }
.format-actions .modal-confirm-btn { margin: 0; }
.find-row { display: flex; gap: 12px; align-items: flex-end; }
.find-row > label { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.find-row label > span { font-size: 12px; color: var(--muted); }
.find-row input[type="text"] {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.find-row input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.find-row .find-range, .find-row .find-options { flex: 0 0 auto; }
.find-row select {
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.find-options { flex-direction: row !important; align-items: center !important; gap: 8px !important; }
.find-result {
  min-height: 20px;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--soft);
}
.find-actions { display: flex; gap: 10px; justify-content: flex-end; }
.find-actions .tool-button {
  min-height: 32px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.find-actions .tool-button:hover { border-color: var(--accent); color: var(--accent); }
.find-actions .execute-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

/* 匹配高亮（颜色可在设置-外观-查找高亮色中自定义，默认浅黄/深色模式深黄） */
.sheet-table td.find-match {
  background: var(--find-hl, #fef08a) !important;
  color: var(--find-hl-ink, #1f2937) !important;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--find-hl-ring, #f59e0b);
  border-radius: 2px;
}

/* 查找模式下弹窗遮罩变浅，保证表格高亮可见 */
.highlight-color-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.hl-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.hl-color-dot:hover {
  transform: scale(1.12);
}
.hl-color-dot.is-active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}
.hl-custom {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px dashed var(--line);
  cursor: pointer;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hl-custom input[type="color"] {
  position: absolute;
  inset: -6px;
  width: 34px;
  height: 34px;
  opacity: 0;
  cursor: pointer;
}
.hl-custom-swatch {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(#f87171, #fbbf24, #4ade80, #60a5fa, #a78bfa, #f472b6, #f87171);
}

.modal-overlay.is-find-mode {
  background: rgba(0, 0, 0, 0.06);
  backdrop-filter: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.08);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== 收起动画 ===== */
.modal-overlay.modal-exit,
.drawer-overlay.modal-exit {
  animation: overlayFadeOut 0.3s ease forwards;
  pointer-events: none;
}

.modal-overlay.modal-exit .modal,
.drawer-overlay.modal-exit .drawer {
  animation: modalExit 0.3s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* 左侧抽屉（模板/文件管理/设置）：向左滑出收起 */
#templateModal.modal-exit .template-modal,
#fileHistoryModal.modal-exit .file-history-modal,
#settingsModal.modal-exit .settings-modal {
  animation: slideOutLeft 0.3s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* 右侧个人中心抽屉：向右滑出收起 */
.drawer-overlay.modal-exit .drawer {
  animation: slideOutRight 0.3s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

@keyframes overlayFadeOut {
  to { opacity: 0; }
}

@keyframes modalExit {
  to { opacity: 0; transform: translateY(40px) scale(0.97); }
}

@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100%); opacity: 0; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.modal-title svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
  stroke-width: 1.8;
  fill: none;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--soft);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

/* 说明书弹窗 */
.guide-modal .guide-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: none;
}

.guide-modal {
  max-width: 780px;
}

.guide-modal .guide-item {
  overflow: visible;
}

/* ============================================
   个人中心侧边抽屉
   ============================================ */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.drawer-overlay[hidden] {
  display: none;
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100%;
  background: var(--surface);
  box-shadow: -8px 0 32px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, var(--accent-strong-soft) 0%, var(--surface) 100%);
}

.drawer-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}

.drawer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.drawer-avatar svg {
  width: 24px;
  height: 24px;
  stroke: #fff;
  stroke-width: 1.8;
  fill: none;
}

.drawer-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-user-info strong {
  font-size: 15px;
  color: var(--ink);
}

.drawer-user-info span {
  font-size: 11px;
  color: var(--muted);
}

.drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drawer-close:hover {
  background: rgba(0,0,0,0.05);
}

.drawer-close svg {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.drawer-section {
  margin-bottom: 20px;
}

.drawer-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-left: 4px;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-card {
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--surface-soft) 0%, var(--surface) 100%);
  text-align: center;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

/* 菜单 */
.drawer-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.drawer-menu-item:hover {
  background: var(--accent-strong-soft);
}

.drawer-menu-item svg:first-child {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}

.drawer-menu-item:hover svg:first-child {
  stroke: var(--accent);
}

.drawer-menu-item span {
  flex: 1;
  font-size: 13px;
  color: var(--ink);
}

.menu-arrow {
  width: 14px;
  height: 14px;
  stroke: var(--line-strong);
  stroke-width: 2;
  fill: none;
}

/* 设置列表 */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.setting-item:hover {
  background: var(--surface-soft);
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-label {
  font-size: 13px;
  color: var(--ink);
}

.setting-desc {
  font-size: 11px;
  color: var(--muted);
}

.setting-select {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  background: var(--surface);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

.setting-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--line);
  border-radius: 22px;
  transition: 0.2s;
}

.switch-slider:before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--surface);
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch input:checked + .switch-slider {
  background: var(--accent);
}

.switch input:checked + .switch-slider:before {
  transform: translateX(18px);
}

/* 关于 */
.about-info {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.about-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bg-2);
}

.about-row:last-child {
  border-bottom: none;
}

.about-row span {
  font-size: 12px;
  color: var(--muted);
}

.about-row strong {
  font-size: 12px;
  color: var(--ink);
}

/* 底部 */
.drawer-footer {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.danger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--danger-soft);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--danger-soft) 100%);
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.danger-btn:hover {
  background: linear-gradient(180deg, var(--danger-soft) 0%, var(--danger-soft) 100%);
  border-color: var(--danger);
}

.danger-btn svg {
  width: 16px;
  height: 16px;
  stroke: #dc2626;
  stroke-width: 1.8;
  fill: none;
}

/* ============================================
   7 项新增功能样式
   ============================================ */

/* 表格区顶部工具条 */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.table-toolbar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.selection-info-bar {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 10px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-ring);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.selection-info-bar.empty {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.chart-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.chart-button:hover:not(:disabled) {
  filter: brightness(0.97);
  transform: translateY(-1px);
}

.chart-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 表格面板改为纵向布局：工具条 + 表格区 */
.app-shell.is-top-nav .table-panel {
  display: flex;
  flex-direction: column;
}

.app-shell.is-top-nav .table-wrap {
  height: auto;
  flex: 1;
  min-height: 0;
}

/* 合并表格按钮（操作栏） */
.merge-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--cell-ink-muted);
}

.merge-button:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* 打印 / 透视表按钮（底部工具条，覆盖导出渐变） */
.print-button,
.pivot-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--cell-ink-muted);
}

.print-button:hover:not(:disabled),
.pivot-button:hover:not(:disabled) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* 弹窗表单控件通用 */
.chart-controls,
.pivot-fields,
.print-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
}

.chart-controls label,
.pivot-fields label,
.print-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.chart-controls select,
.pivot-fields select,
.print-controls select,
.cloud-input {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chart-controls select:focus,
.pivot-fields select:focus,
.print-controls select:focus,
.cloud-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-strong-soft);
}

/* 图表画布 */
.chart-modal {
  width: 92%;
  max-width: 900px;
}

.chart-body {
  display: flex;
  flex-direction: column;
}

.chart-confirm-modal {
  max-width: 380px;
  width: 380px;
}
.chart-confirm-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.chart-confirm-hint {
  margin: 4px 0 14px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
}
.chart-check-label {
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  min-height: 32px;
  font-weight: 600;
}
.chart-check-label input {
  width: 15px;
  height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
}
.chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.chart-stats {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
  min-width: 0;
}
.chart-footer .import-button {
  flex: 0 0 auto;
}
.chart-canvas-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.chart-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-soft);
}

.chart-empty[hidden] {
  display: none;
}

/* 合并弹窗 */
.merge-modal {
  max-width: 560px;
}

.merge-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.merge-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.merge-file-index {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.merge-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.merge-file-info strong {
  font-size: 13px;
  color: var(--ink);
}

.merge-file-info span {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merge-empty,
.template-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}

.merge-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.merge-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.merge-mode-option:has(input:checked) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.merge-mode-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.merge-mode-option div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.merge-mode-option strong {
  font-size: 13px;
  color: var(--ink);
}

.merge-mode-option span {
  font-size: 12px;
  color: var(--muted);
}

.merge-execute,
.pivot-execute {
  width: 100%;
}

/* 透视表弹窗 */
.pivot-modal {
  max-width: 640px;
}

.pivot-fields label {
  flex: 1 1 30%;
  min-width: 180px;
}

/* 打印弹窗 */
.print-modal {
  width: 94%;
  max-width: 840px;
}

.print-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.print-preview iframe {
  display: block;
  width: 100%;
  height: 420px;
  border: 0;
  background: var(--surface);
}

.print-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* 模板弹窗 */
.template-modal {
  max-width: 560px;
}

.template-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.template-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 12px 0 8px;
}

.template-group-title:first-child {
  margin-top: 0;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
}

.template-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  transition: all 0.15s ease;
}

.template-item:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.template-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.template-item-main strong {
  font-size: 13px;
  color: var(--ink);
}

.template-item-main span {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-item-main .template-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  line-height: 1.55;
  color: var(--ink-2);
}

.template-item-main .template-meta {
  color: var(--muted);
}

.template-badge {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.template-delete {
  flex: 0 0 auto;
  padding: 4px 10px;
  border: 1px solid var(--danger-soft);
  border-radius: 8px;
  background: var(--surface);
  color: #dc2626;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.template-delete:hover {
  background: var(--danger-soft);
}

/* 云同步 */
.cloud-sync {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.cloud-status {
  font-size: 12px;
  color: var(--muted);
}

.cloud-row {
  display: flex;
  gap: 8px;
}

.cloud-row[hidden] {
  display: none;
}

.cloud-input {
  flex: 1;
  min-width: 0;
}

.cloud-btn {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cloud-btn:hover {
  filter: brightness(0.98);
}

.cloud-logout {
  background: var(--surface);
  color: #dc2626;
  border: 1px solid var(--danger-soft);
}

.cloud-logout:hover {
  background: var(--danger-soft);
  filter: none;
}

.cloud-note {
  font-size: 11px;
  color: var(--muted);
}

/* ===== 工作表标签（多 Sheet） ===== */
.sheet-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  flex: 0 0 auto;
  min-width: 84px;
  max-width: 320px;
  scrollbar-width: thin;
  padding: 2px 0;
}
.sheet-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--cell-ink-muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  transition: background 0.15s, color 0.15s;
}
.sheet-tab:hover {
  background: var(--soft);
}
.sheet-tab.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--line-strong);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.04);
}
.sheet-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-tab-close {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.sheet-tab:hover .sheet-tab-close {
  opacity: 1;
}
.sheet-tab-close:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}
.sheet-tabs-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
}
.sheet-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 13px;
  line-height: 1;
  color: var(--cell-ink-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sheet-tab-btn:hover {
  color: var(--accent);
  background: var(--accent-border);
  border-color: var(--line-strong);
}
.foot-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.foot-left .file-meta {
  flex: 0 0 auto;
}

/* ===== 快捷键设置弹窗 ===== */
.shortcut-modal {
  width: 460px;
  max-width: calc(100vw - 32px);
}
.shortcut-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.shortcut-hint {
  margin: 0;
  font-size: 12px;
  color: var(--cell-ink-muted);
  line-height: 1.5;
}
.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.shortcut-label {
  font-size: 13px;
  color: var(--cell-ink);
}
.shortcut-value {
  min-width: 110px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.shortcut-value:hover {
  border-color: var(--accent);
}
.shortcut-value.recording {
  color: #b45309;
  border-color: #b45309;
  background: var(--warn-soft);
}
.shortcut-value.empty {
  color: var(--muted);
}
.shortcut-footer {
  display: flex;
  justify-content: flex-end;
}
.ghost-button {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--cell-ink-muted);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ghost-button:hover {
  background: var(--soft);
  color: var(--accent);
}

/* ===== 文件管理弹窗 ===== */
.file-history-modal {
  width: 520px;
  max-width: calc(100vw - 32px);
}
.file-history-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.file-history-hint {
  margin: 0;
  font-size: 12px;
  color: var(--cell-ink-muted);
  line-height: 1.5;
}
.settings-body {
  overflow-y: auto;
}
.settings-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}
.file-history-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-history-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.file-history-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}
.file-history-icon svg {
  width: 18px;
  height: 18px;
}
.file-history-info {
  flex: 1;
  min-width: 0;
}
.file-history-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--cell-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-history-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}
.file-history-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.file-history-del {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.file-history-del:hover {
  color: #dc2626;
  border-color: var(--danger-soft);
}
.file-history-empty {
  padding: 32px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.file-history-footer {
  display: flex;
  justify-content: flex-end;
}
.ghost-button.danger:hover {
  color: #dc2626;
  border-color: var(--danger-soft);
  background: var(--danger-soft);
}

/* ===== 文件管理：铺满导航栏下方主区域 ===== */
#fileHistoryModal {
  align-items: stretch;
  justify-content: flex-start;
  background: transparent;
  backdrop-filter: none;
  right: 360px;
}
#fileHistoryModal .file-history-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  right: 360px;
  bottom: 0;
  height: 100%;
  margin: 0;
  border-radius: 0;
  background: var(--surface);
  max-height: none;
  max-width: none;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.1);
  z-index: 999;
  }
/* ===== 设置弹窗：和文件管理同款抽屉式 ===== */
#settingsModal {
  align-items: stretch;
  justify-content: flex-start;
  background: transparent;
  backdrop-filter: none;
  right: 360px;
}
#settingsModal .settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  right: 360px;
  bottom: 0;
  height: 100%;
  margin: 0;
  border-radius: 0;
  background: var(--surface);
  max-height: none;
  max-width: none;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.1);
  z-index: 999;
  }
#settingsModal .settings-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 20px 20px;
}

@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
#fileHistoryModal .file-history-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 20px 20px;
}
#fileHistoryModal .file-history-list {
  flex: 1;
  max-height: none;
  overflow-y: auto;
  min-height: 0;
}

/* ===== 操作历史弹窗（同文件管理布局） ===== */
#historyModal {
  align-items: stretch;
  justify-content: flex-start;
  background: transparent;
  backdrop-filter: none;
  right: 360px;
}
#historyModal .history-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 360px;
  bottom: 0;
  width: auto;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.1);
  z-index: 999;
}
#historyModal .history-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 20px 20px;
}
.history-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--cell-ink-muted);
  line-height: 1.5;
}
.history-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-group {
  margin-bottom: 8px;
}
.history-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 8px;
  background: var(--accent-soft);
  border-radius: 6px;
  margin-bottom: 6px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.history-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.history-item.current {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.history-item-time {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, Menlo, monospace;
  min-width: 60px;
}
.history-item-func {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-label {
  flex: 1;
  font-size: 13px;
  color: var(--cell-ink);
}
.history-item.can-undo {
  border-color: var(--success-border);
}
.history-item.can-undo:hover {
  border-color: var(--success);
  background: var(--success-soft);
}
.history-item-undo {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
.history-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--cell-ink-muted);
}
.history-empty {
  padding: 32px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ===== 登录页 ===== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 84px);
  padding-right: clamp(80px, 12vw, 210px);
  background: url("login-bg.jpg?v=20260910") center / cover no-repeat;
  background-color: #eaf2fb;
}
.login-screen[hidden] { display: none; }

/* ===== 背景装饰层：光晕 + 漂浮数据元素 ===== */
.login-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
}
.glow-1 {
  width: min(560px, 42vw);
  height: min(560px, 42vw);
  left: -8%;
  top: -12%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.55), transparent 68%);
}
.glow-2 {
  width: min(640px, 48vw);
  height: min(640px, 48vw);
  right: -10%;
  bottom: -14%;
  background: radial-gradient(circle, rgba(147, 197, 253, 0.5), transparent 68%);
}
.deco-item {
  position: absolute;
  opacity: 0.4;
  filter: drop-shadow(0 10px 24px rgba(30, 64, 175, 0.12));
}
.deco-item svg { display: block; width: 100%; height: 100%; }
.deco-table { left: 4%; top: 8%; width: clamp(90px, 10vw, 150px); animation: decoFloat 9s ease-in-out infinite; }
.deco-bar { right: 4%; top: 6%; width: clamp(100px, 11vw, 170px); animation: decoFloat 11s ease-in-out infinite 1s; }
.deco-line { left: 10%; bottom: 9%; width: clamp(88px, 10vw, 150px); animation: decoFloat 10s ease-in-out infinite 0.5s; }
.deco-pie { right: 6%; bottom: 8%; width: clamp(84px, 9.5vw, 140px); animation: decoFloat 12s ease-in-out infinite 1.5s; }
@keyframes decoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(-1.5deg); }
}
.deco-plus {
  position: absolute;
  font-size: 22px;
  color: rgba(30, 58, 138, 0.3);
  font-weight: 200;
  line-height: 1;
}
.plus-1 { left: 30%; top: 22%; }
.plus-2 { right: 24%; bottom: 26%; }
.deco-dot {
  position: absolute;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.35);
}
.dot-1 { width: 7px; height: 7px; left: 46%; top: 13%; }
.dot-2 { width: 5px; height: 5px; left: 56%; bottom: 18%; background: rgba(30, 58, 138, 0.3); }
/* 窄窗口：弱化装饰 */
@media (max-width: 1100px) {
  .deco-item { opacity: 0.26; }
}
@media (max-width: 640px) {
  .login-deco { display: none; }
}

/* 左侧文字栏：设计感排版 */
.login-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  max-width: min(44vw, 620px);
  padding-left: clamp(24px, 4vw, 60px);
}
/* 主标语：超大横排，深蓝渐变，描边加投影 */
.bg-text-main {
  font-size: clamp(42px, 5.2vw, 86px);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.18;
  margin: 0;
  color: transparent;
  background: linear-gradient(115deg, #1e3a8a 5%, #2563eb 55%, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 14px 34px rgba(30, 64, 175, 0.25));
  white-space: nowrap;
}
/* 主标语上方细横线 */
.bg-text-rule {
  display: block;
  width: 72px;
  height: 3px;
  margin-bottom: 26px;
  background: linear-gradient(90deg, #2563eb, rgba(56, 189, 248, 0.35));
  border-radius: 3px;
}
/* 副标语：宽字距小字 */
.bg-text-sub {
  margin: 18px 0 0;
  font-size: clamp(14px, 1.5vw, 19px);
  font-weight: 400;
  letter-spacing: 0.3em;
  color: rgba(30, 58, 138, 0.82);
}
/* 介绍文案：多行趣味介绍 */
.bg-text-intro {
  margin-top: 38px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.bg-text-intro p {
  margin: 0;
  padding-left: 16px;
  border-left: 1px solid rgba(30, 58, 138, 0.28);
  font-size: clamp(13px, 1.25vw, 17px);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.5;
  color: rgba(30, 58, 138, 0.78);
}
/* 右上标签：细边框磨砂 */
.bg-text-tag {
  margin-top: 42px;
  display: inline-block;
  font-size: clamp(11px, 1.1vw, 14px);
  font-weight: 400;
  letter-spacing: 0.24em;
  padding: 10px 22px;
  border-radius: 2px;
  color: rgba(30, 58, 138, 0.9);
  border: 1px solid rgba(30, 58, 138, 0.35);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
/* 杂志式大编号装饰 */
.bg-text-index {
  position: absolute;
  left: 0;
  bottom: 6%;
  font-size: clamp(72px, 9vw, 140px);
  font-weight: 200;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(30, 58, 138, 0.3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.02em;
  pointer-events: none;
}
.bg-text-index-2 {
  left: auto;
  right: 8%;
  bottom: auto;
  top: 4%;
  font-size: clamp(48px, 6vw, 96px);
  -webkit-text-stroke: 1.5px rgba(30, 58, 138, 0.22);
}
/* 进场动画：依次从左往右滑入 */
.login-side > * {
  opacity: 0;
  animation: bgTextIn 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.login-side > *:nth-child(1) { animation-delay: 0.05s; }
.login-side > *:nth-child(2) { animation-delay: 0.17s; }
.login-side > *:nth-child(3) { animation-delay: 0.29s; }
.login-side > *:nth-child(4) { animation-delay: 0.41s; }
.login-side > *:nth-child(5) { animation-delay: 0.53s; }
.login-side > *:nth-child(6) { animation-delay: 0.65s; }
.login-side > *:nth-child(7) { animation-delay: 0.77s; }
.login-side > *:nth-child(8) { animation-delay: 0.89s; }
.login-side > *:nth-child(9) { animation-delay: 1.01s; }
@keyframes bgTextIn {
  from { opacity: 0; transform: translateX(-42px); }
  to { opacity: 1; transform: translateX(0); }
}
/* 介绍文案内每行也递进进场 */
.bg-text-intro p {
  opacity: 0;
  animation: bgTextIn 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.bg-text-intro p:nth-child(1) { animation-delay: 0.7s; }
.bg-text-intro p:nth-child(2) { animation-delay: 0.82s; }
.bg-text-intro p:nth-child(3) { animation-delay: 0.94s; }
.bg-text-intro p:nth-child(4) { animation-delay: 1.06s; }
@media (prefers-reduced-motion: reduce) {
  .login-side > *, .bg-text-intro p {
    opacity: 1;
    animation: none;
    transform: none;
  }
  .leaf { display: none; }
  .login-card { animation: none; }
}
/* 窄窗口：文字栏压缩 */
@media (max-width: 1100px) {
  .login-side { max-width: 30vw; }
  .bg-text-main { font-size: clamp(30px, 4.4vw, 46px); letter-spacing: 0.04em; }
  .bg-text-intro { gap: 10px; margin-top: 26px; }
  .bg-text-tag { margin-top: 28px; }
}
@media (max-width: 960px) {
  .login-side { display: none; }
}
@media (max-width: 760px) {
  .notebook { width: calc(100vw - 24px); min-height: 480px; }
  .login-card { padding: 30px 22px 24px; }
  .cover-title { font-size: 23px; }
  .cover-logo { width: 62px; height: 62px; }
}

/* ===== 笔记本翻页登录（双面纸 · 翻到左页） ===== */
.notebook {
  position: relative;
  display: flex;
  width: min(920px, calc(100vw - 40px));
  min-height: 520px;
  perspective: 1800px;
  border-radius: 26px;
}
/* 左半：翻过去的纸最终平贴在这里（封底衬页 / 纸背） */
.notebook-left {
  flex: 1;
  min-width: 0;
  position: relative;
  border-radius: 26px 0 0 26px;
  background: linear-gradient(135deg, rgba(246, 248, 252, 0.92), rgba(231, 238, 247, 0.92));
  box-shadow:
    inset -4px 0 8px rgba(30, 58, 138, 0.1),
    inset 0 0 0 1px rgba(30, 58, 138, 0.07);
}
/* 右半：当前活动页（封面 / 表格页 / 登录卡） */
.notebook-right {
  flex: 1;
  min-width: 0;
  position: relative;
  border-radius: 0 26px 26px 0;
  background: linear-gradient(135deg, rgba(248, 250, 253, 0.88), rgba(237, 243, 251, 0.88));
  box-shadow:
    inset 4px 0 8px rgba(30, 58, 138, 0.09),
    inset 0 0 0 1px rgba(30, 58, 138, 0.05);
}
/* 纸页：占满右半，绕书脊（右半左边缘）翻到左半 */
.leaf {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  border-radius: 0 26px 26px 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
}
.leaf .face-front,
.leaf .face-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
/* 正面页显示在右半：右缘圆角；背面页翻到左半后以正面显示：左缘圆角 */
.leaf .face-front { border-radius: 0 26px 26px 0; }
.leaf .face-back { border-radius: 26px 0 0 26px; transform: rotateY(180deg); }
.leaf-cover { z-index: 4; }
.leaf-table { z-index: 3; }
/* 翻页动画：封面厚重起步慢、甩动、过头回弹；表格页轻快。翻到底 -180° 平贴左半 */
.leaf-cover.flip { animation: leafFlipCover 1.15s cubic-bezier(0.33, 0, 0.2, 1) both; }
.leaf-table.flip { animation: leafFlipTable 0.88s cubic-bezier(0.33, 0, 0.2, 1) both; }
@keyframes leafFlipCover {
  0%   { transform: rotateY(0deg) scaleX(1); }
  11%  { transform: rotateY(-32deg) scaleX(0.99); }
  55%  { transform: rotateY(-158deg) scaleX(0.966); }
  76%  { transform: rotateY(-184deg) scaleX(0.99); }
  90%  { transform: rotateY(-176deg) scaleX(1); }
  100% { transform: rotateY(-180deg) scaleX(1); }
}
@keyframes leafFlipTable {
  0%   { transform: rotateY(0deg) scaleX(1); }
  15%  { transform: rotateY(-26deg) scaleX(0.994); }
  58%  { transform: rotateY(-160deg) scaleX(0.972); }
  82%  { transform: rotateY(-183deg) scaleX(0.994); }
  93%  { transform: rotateY(-176deg) scaleX(1); }
  100% { transform: rotateY(-180deg) scaleX(1); }
}
/* 翻页明暗：正面纸页立起时右侧受光变暗，落下后恢复 */
.cover-face::after,
.table-face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to right, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 16%, rgba(8,18,45,0.14) 60%, rgba(8,18,45,0.42) 100%);
  opacity: 0;
  pointer-events: none;
}
.leaf-cover.flip .cover-face::after { animation: pageShadeCover 1.15s ease both; }
.leaf-table.flip .table-face::after { animation: pageShadeTable 0.88s ease both; }
@keyframes pageShadeCover {
  0% { opacity: 0; }
  30% { opacity: 1; }
  72% { opacity: 0.35; }
  100% { opacity: 0; }
}
@keyframes pageShadeTable {
  0% { opacity: 0; }
  32% { opacity: 0.85; }
  78% { opacity: 0.3; }
  100% { opacity: 0; }
}
/* 封面背面（衬页） */
.cover-back {
  background:
    radial-gradient(120% 90% at 85% 8%, rgba(255, 255, 255, 0.75), transparent 55%),
    linear-gradient(135deg, #eef3fa 0%, #dfe8f4 100%);
  box-shadow: inset 0 0 0 1px rgba(30, 58, 138, 0.08);
}
.back-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.back-logo {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  overflow: hidden;
  opacity: 0.75;
  box-shadow: inset 0 0 0 1px rgba(30, 58, 138, 0.2);
}
.back-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.back-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: rgba(37, 58, 110, 0.55);
}
/* 表格纸背 */
.table-back {
  background:
    repeating-linear-gradient(0deg, rgba(148, 163, 184, 0.1) 0 1px, transparent 1px 26px),
    linear-gradient(135deg, #f7f9fc 0%, #eef2f8 100%);
  box-shadow: inset 0 0 0 1px rgba(30, 58, 138, 0.07);
}
.back-watermark {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5em;
  color: rgba(59, 130, 246, 0.16);
  transform: rotate(-8deg);
}
.back-hint {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(100, 116, 139, 0.5);
}
/* 封面 */
.cover-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  background:
    radial-gradient(120% 80% at 18% 0%, rgba(255,255,255,0.14), transparent 52%),
    linear-gradient(150deg, #14244a 0%, #1d3a7a 55%, #274a96 100%);
  box-shadow:
    0 30px 70px rgba(20, 36, 74, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.cover-logo {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28), inset 0 0 0 1.5px rgba(255, 255, 255, 0.35);
}
.cover-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-face::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(to right, rgba(255,255,255,0.3), rgba(255,255,255,0.05) 55%, transparent);
  border-radius: 26px 0 0 26px;
}
.cover-title { font-size: 28px; font-weight: 800; letter-spacing: 0.06em; }
.cover-sub { font-size: 12px; color: rgba(255, 255, 255, 0.62); letter-spacing: 0.22em; }
.cover-tag { margin-top: 10px; font-size: 11px; color: rgba(255, 255, 255, 0.42); letter-spacing: 0.32em; }
/* 空白表格页 */
.table-face {
  position: absolute;
  inset: 0;
  padding: 26px 24px 40px;
  background: #fbfcfe;
  box-shadow: 0 30px 70px rgba(30, 64, 175, 0.16), inset 0 0 0 1px rgba(30, 58, 138, 0.08);
  border-radius: 26px;
}
.table-face::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  background: linear-gradient(to right, rgba(148, 163, 184, 0.25), rgba(148, 163, 184, 0.04) 55%, transparent);
  border-radius: 26px 0 0 26px;
}
.table-head {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.16em;
  margin-bottom: 12px;
}
.table-grid { width: 100%; height: calc(100% - 64px); display: block; border-radius: 6px; }
.table-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  font-size: 11px;
  color: #b6c4d8;
  letter-spacing: 0.1em;
}
/* 登录页（白色玻璃） */
.login-card {
  position: relative;
  z-index: 6;
  box-sizing: border-box;
  width: 100%;
  padding: 26px 32px 22px;
  overflow: hidden;
  transform-origin: left center;
  animation: loginCardReveal 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: 1.58s;
  background:
    radial-gradient(95% 62% at 14% -6%, rgba(255,255,255,0.96) 0%, rgba(255,255,255,0.4) 46%, transparent 72%),
    linear-gradient(155deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.58) 48%, rgba(224,236,252,0.55) 100%);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 26px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.3),
    0 26px 64px rgba(30, 64, 175, 0.16),
    0 4px 14px rgba(15, 23, 42, 0.05),
    inset 0 1.5px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(255, 255, 255, 0.35);
  text-align: left;
}
/* 白色玻璃左上角阳光高光 */
.login-card::after {
  content: "";
  position: absolute;
  top: -18%;
  left: -14%;
  width: 62%;
  height: 76%;
  background: radial-gradient(ellipse at 32% 18%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.12) 52%, transparent 72%);
  pointer-events: none;
}
@keyframes loginCardReveal {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* 卡片左上角装饰圆点组 */
.login-card .card-dots {
  position: absolute;
  top: 18px;
  left: 20px;
  display: flex;
  gap: 5px;
}
.login-card .card-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.25);
}
.login-card .card-dots i:nth-child(2) { background: rgba(59, 130, 246, 0.45); }
.login-card .card-dots i:nth-child(3) { background: rgba(59, 130, 246, 0.65); }
/* 卡片顶部高光细线 */
.login-card::before {
  content: "";
  position: absolute;
  left: 26px;
  right: 26px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95), transparent);
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.login-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.login-brand::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.35), transparent);
}
.login-logo {
  position: relative;
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(255,255,255,0.55));
  box-shadow: 0 10px 26px rgba(30, 64, 175, 0.22), inset 0 0 0 1.5px rgba(255,255,255,0.9);
}
.login-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.12);
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-brand-text { text-align: left; }
.login-title { margin: 0; font-size: 24px; font-weight: 800; color: #0f2447; letter-spacing: -0.5px; }
.login-subtitle { margin: 3px 0 0; font-size: 12px; color: #64748b; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
/* 登录方式：下划线式标签切换 */
.login-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}
.login-tab {
  position: relative;
  flex: 1;
  height: 38px;
  border: none;
  background: transparent;
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  padding: 0 2px;
  transition: color 0.18s;
}
.login-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light, #60a5fa));
  transform: scaleX(0);
  transition: transform 0.24s ease;
}
.login-tab:hover { color: var(--ink); }
.login-tab.is-active { color: var(--accent); font-weight: 600; }
.login-tab.is-active::after { transform: scaleX(1); }
/* 输入框 */
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field[hidden] { display: none !important; }
.login-field span { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: #64748b; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.input-wrap { position: relative; flex: 1; min-width: 0; }
.input-wrap .input-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: rgba(100, 116, 139, 0.65);
  pointer-events: none;
  transition: color 0.18s;
}
.input-wrap input {
  height: 46px;
  width: 100%;
  padding: 0 18px 0 48px;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  font-size: 15px;
  color: #1f2937;
  outline: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04), inset 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.input-wrap:focus-within .input-icon { color: #2563eb; }
.input-wrap input::placeholder { color: rgba(100, 116, 139, 0.7); }
/* 密码可见性切换 */
#pwdField .input-wrap input { padding-right: 46px; }
.pwd-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: rgba(100, 116, 139, 0.7);
  cursor: pointer;
  border-radius: 9px;
  padding: 0;
  transition: color 0.16s, background 0.16s;
}
.pwd-eye svg { width: 19px; height: 19px; }
.pwd-eye:hover { color: #2563eb; background: rgba(37, 99, 235, 0.08); }
.input-wrap input:hover { border-color: rgba(100, 116, 139, 0.5); }
.input-wrap input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), inset 0 1px 3px rgba(15, 23, 42, 0.03);
}
/* 登录按钮：渐变 + 光晕 */
.login-btn {
  margin-top: 6px;
  height: 46px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #3b82f6 55%, #60a5fa);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.12s, box-shadow 0.18s, filter 0.18s;
}
.login-btn::after {
  content: "→";
  font-size: 16px;
  line-height: 1;
  transition: transform 0.18s;
}
.login-btn:hover::after { transform: translateX(3px); }
.login-btn:hover {
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
  filter: brightness(1.04);
}
.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.24);
}
.login-switch { margin: 8px 0 0; font-size: 13px; text-align: center; color: rgba(100, 116, 139, 0.9); }
.login-switch .switch-link { margin-left: 2px; color: #2563eb; font-weight: 600; cursor: pointer; text-decoration: none; border-bottom: 1px dashed rgba(37, 99, 235, 0.45); transition: color 0.15s; }
.login-switch .switch-link:hover { color: #1d4ed8; }
.login-privacy { margin: 12px 0 0; font-size: 11px; line-height: 1.6; text-align: center; color: rgba(100, 116, 139, 0.8); }
/* 协议勾选 + 忘记密码（同排，切换登录方式时不改变卡片高度） */
.forgot-link {
  font-size: 12px;
  color: #2563eb;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-left: 12px;
  white-space: nowrap;
}
.forgot-link:hover { text-decoration: underline; }
.login-agree {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.login-agree input {
  width: 15px;
  height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
  margin: 0;
}
.login-agree a { color: #2563eb; text-decoration: none; }
.login-agree a:hover { text-decoration: underline; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-btn {
  height: 46px; padding: 0 16px;
  border: 1.5px solid rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border-radius: 14px;
  font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: all 0.18s;
}
.code-btn:hover { background: rgba(37, 99, 235, 0.14); border-color: #2563eb; }
.code-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ===== 完善资料弹窗 ===== */
/* 登录完成后：登录卡向左翻走，资料页从右侧翻入 */
/* 首次入场动画播完后固定登录卡，避免移除覆盖类时带 1.58s 延迟重播（必须定义在翻页动画类之前） */
.login-card.card-anim-done { animation: none; }
.login-card.page-flip-out { animation: cardFlipOut 0.8s cubic-bezier(0.4, 0, 0.2, 1) both; }
/* 从协议页返回登录：登录卡作为"前面那页"从左侧翻回来（往回翻），盖住协议书页 */
@keyframes cardFlipBack {
  0%   { transform: perspective(1200px) rotateY(-118deg) translateX(-36px); opacity: 0; }
  16%  { transform: perspective(1200px) rotateY(-94deg) translateX(-26px); opacity: 0; }
  32%  { transform: perspective(1200px) rotateY(-68deg) translateX(-19px); opacity: 0.9; }
  100% { transform: perspective(1200px) rotateY(0deg) translateX(0); opacity: 1; }
}
.login-card.card-flip-back {
  animation: cardFlipBack 0.65s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  z-index: 9;
}
/* 从协议/资料页返回登录卡时：立即淡入，不等 1.58s 的初始入场延迟 */
.login-card.reveal-now { animation: loginCardReveal 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both; animation-delay: 0s; }
/* 翻页动画期间：纯色背景 + 关掉毛玻璃，避免 3D 翻转时每帧做渐变混合/模糊（纯色不透明层开销最小） */
.login-card.page-flip-out,
.login-card.card-flip-back {
  background: #f8fbff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 14px 40px rgba(30, 64, 175, 0.14);
}
/* 往回翻隐藏背面镜像（从背面翻回，正面才可见）；往过翻保留完整翻转+渐隐 */
.login-card.card-flip-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.page-doc.flip-back { background: #f4f8ff; }
/* 返回登录时协议页快速原地淡出（0.16s），随后登录卡单独翻回，避免大纹理层参与混合 */
.page-doc.fade-out-fast {
  opacity: 0;
  transform: none;
  transition: opacity 0.12s ease;
}
/* 滚动正文独立合成层，旋转动画时只合成可视部分 */
.doc-page-body { contain: paint; }
@keyframes cardFlipOut {
  0%   { transform: rotateY(0deg) scaleX(1); opacity: 1; }
  22%  { transform: rotateY(-30deg) scaleX(0.98); opacity: 1; }
  68%  { transform: rotateY(-152deg) scaleX(0.9); opacity: 0.55; }
  100% { transform: rotateY(-168deg) scaleX(0.86); opacity: 0; }
}
/* 资料完善页：笔记本里的下一页（浅色纸面 + 横线纹理） */
.page-profile {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 0 26px 26px 0;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,0.92) 0%, rgba(237,243,251,0.86) 55%, rgba(224,236,252,0.72) 100%),
    repeating-linear-gradient(0deg, rgba(148,163,184,0.10) 0, rgba(148,163,184,0.10) 1px, transparent 1px, transparent 34px);
  box-shadow: inset 4px 0 8px rgba(30, 58, 138, 0.08), inset 0 0 0 1px rgba(30, 58, 138, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: perspective(1200px) rotateY(9deg) translateX(26px);
  transform-origin: left center;
  pointer-events: none;
  transition: opacity 0.45s ease 0.15s, transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s;
}
.page-profile[hidden] { display: none; }
.page-profile.show { opacity: 1; transform: none; pointer-events: auto; }
.profile-inner { width: 100%; max-width: 290px; text-align: center; padding: 0 8px; }
.avatar-preview {
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden;
  background: rgba(255,255,255,0.7);
  border: 2px solid rgba(59, 130, 246, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 6px 16px rgba(30, 64, 175, 0.1);
  display: flex; align-items: center; justify-content: center;
}
.avatar-preview svg { width: 34px; height: 34px; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-title { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: 0.02em; color: #1e293b; }
.profile-sub { margin: 5px 0 12px; font-size: 11.5px; letter-spacing: 0.06em; color: #8fa0b5; }
.page-profile .login-field { margin-bottom: 12px; text-align: left; }
.page-profile .login-field span { color: #64748b; font-size: 12.5px; }
.page-profile .login-field input {
  height: 46px;
  width: 100%;
  padding: 0 16px;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04), inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.page-profile .input-wrap input { padding: 0 16px; }
.page-profile .login-field input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), inset 0 1px 3px rgba(15, 23, 42, 0.03);
}
.page-profile .login-btn { margin-top: 10px; height: 40px; font-size: 14px; width: 100%; }
.profile-skip { margin-top: 10px; font-size: 12px; color: #94a3b8; cursor: pointer; }
.profile-skip:hover { color: #2563eb; }

.avatar-upload { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 14px; }
.ghost-btn {
  padding: 9px 18px;
  border: 1.5px solid rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.08);
  border-radius: 12px;
  font-size: 13px;
  color: #2563eb;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.ghost-btn:hover { border-color: #2563eb; background: rgba(37, 99, 235, 0.14); }

/* ============================================================
 * 外观主题：深色模式 + 主题色
 * 通过 <html data-theme="dark"> 与 <html data-accent="xxx"> 切换
 * ============================================================ */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15181d;
  --bg-2: #1a1e25;
  --surface: #1e232b;
  --surface-soft: #181c23;
  --soft: #262c36;
  --ink: #dde2ea;
  --muted: #8f98a7;
  --line: #232933;
  --line-strong: #2e3641;
  --cell-ink: #d8dce3;
  --cell-ink-muted: #8b94a3;
  --success-dark: #2fbf85;
  --danger-dark: #f0a0a0;
  --new-bg: rgba(255, 90, 90, 0.16);
  --new-bg-strong: rgba(255, 110, 110, 0.26);
  --changed-bg: rgba(90, 140, 255, 0.22);
  --change-bg: rgba(70, 200, 140, 0.14);
  --success-border: rgba(62, 207, 142, 0.28);
  --danger-ring: rgba(248, 113, 113, 0.22);
  --success-ring: rgba(62, 207, 142, 0.2);
  --warn: #f5b04c;
  --warn-soft: #372c15;
  --danger: #f87171;
  --danger-soft: #3a1e20;
  --success: #3ecf8e;
  --success-soft: #123227;
  --accent-light: #7aa7f7;
  --accent-soft: rgba(96, 140, 255, 0.08);
  --accent-strong-soft: rgba(96, 140, 255, 0.13);
  --accent-border: rgba(96, 140, 255, 0.22);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* 主题色：覆盖主色及其透明变体（样式均通过变量引用） */
[data-accent="teal"] {
  --accent: #0d9488;
  --accent-dark: #0f766e;
  --accent-light: #5eead4;
  --accent-soft: rgba(13, 148, 136, 0.07);
  --accent-strong-soft: rgba(13, 148, 136, 0.12);
  --accent-border: rgba(13, 148, 136, 0.26);
}
[data-accent="violet"] {
  --accent: #7c3aed;
  --accent-dark: #6d28d9;
  --accent-light: #c4b5fd;
  --accent-soft: rgba(124, 58, 237, 0.07);
  --accent-strong-soft: rgba(124, 58, 237, 0.12);
  --accent-border: rgba(124, 58, 237, 0.26);
}
[data-accent="green"] {
  --accent: #059669;
  --accent-dark: #047857;
  --accent-light: #6ee7b7;
  --accent-soft: rgba(5, 150, 105, 0.07);
  --accent-strong-soft: rgba(5, 150, 105, 0.12);
  --accent-border: rgba(5, 150, 105, 0.26);
}
[data-accent="orange"] {
  --accent: #ea580c;
  --accent-dark: #c2410c;
  --accent-light: #fdba74;
  --accent-soft: rgba(234, 88, 12, 0.07);
  --accent-strong-soft: rgba(234, 88, 12, 0.12);
  --accent-border: rgba(234, 88, 12, 0.26);
}
[data-accent="rose"] {
  --accent: #e11d48;
  --accent-dark: #be123c;
  --accent-light: #fda4af;
  --accent-soft: rgba(225, 29, 72, 0.06);
  --accent-strong-soft: rgba(225, 29, 72, 0.11);
  --accent-border: rgba(225, 29, 72, 0.24);
}
[data-accent="teal"][data-theme="dark"],
[data-accent="violet"][data-theme="dark"],
[data-accent="green"][data-theme="dark"],
[data-accent="orange"][data-theme="dark"],
[data-accent="rose"][data-theme="dark"] {
  --accent-soft: rgba(255, 255, 255, 0.06);
  --accent-strong-soft: rgba(255, 255, 255, 0.11);
  --accent-border: rgba(255, 255, 255, 0.2);
}

/* 深色模式下个别白底区域微调 */
[data-theme="dark"] .login-page,
[data-theme="dark"] .login-card {
  background: rgba(18, 22, 28, 0.72);
}

/* ===== 暗色模式：弱化白色内高光与亮线条，避免晃眼 ===== */
[data-theme="dark"] .import-button,
[data-theme="dark"] .app-shell.is-top-nav .function-button,
[data-theme="dark"] .app-shell.is-top-nav .function-number,
[data-theme="dark"] .workspace-foot .history-button,
[data-theme="dark"] .app-shell.is-top-nav .config-panel select,
[data-theme="dark"] .workspace-foot .export-format select {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .import-button:hover,
[data-theme="dark"] .app-shell.is-top-nav .function-button:hover,
[data-theme="dark"] .workspace-foot .history-button:hover:not(:disabled) {
  box-shadow:
    0 2px 6px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .top-nav,
[data-theme="dark"] .category-tabs,
[data-theme="dark"] .app-shell.is-top-nav .action-bar,
[data-theme="dark"] .function-grid-panel,
[data-theme="dark"] .app-shell.is-top-nav .config-panel,
[data-theme="dark"] .app-shell.is-top-nav .status-panel,
[data-theme="dark"] .app-shell.is-top-nav .table-panel,
[data-theme="dark"] .workspace-foot {
  border: 1px solid var(--line);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .execute-button,
[data-theme="dark"] .workspace-foot .export-button {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 1px 2px var(--accent-border),
    0 4px 12px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .category-tab.is-active {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 2px 6px var(--accent-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ===== 常用模板弹窗：同文件管理抽屉式（左侧弹出铺满，不覆盖导航栏） ===== */
#templateModal {
  align-items: stretch;
  justify-content: flex-start;
  background: transparent;
  backdrop-filter: none;
  right: 360px;
}
#templateModal .template-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  right: 360px;
  bottom: 0;
  height: 100%;
  margin: 0;
  border-radius: 0;
  background: var(--surface);
  max-height: none;
  max-width: none;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.1);
  z-index: 999;
  animation: slideInLeft 0.18s ease;
  }
#templateModal .template-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 20px 20px;
}
/* 两个分区：操作模板 flex 占满可滚动，内置模板自然高度 */
.template-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.template-section + .template-section {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}
.template-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.template-section-title svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
#templateModal .template-body {
  display: flex;
  flex-direction: row;
  min-height: 0;
}
#templateModal .template-section {
  flex: 1;
  min-height: 0;
}
#templateModal .template-list {
  flex: 1;
  max-height: none;
  overflow-y: auto;
  min-height: 0;
}
@keyframes slideInLeft {
  from { transform: translateX(-40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== 模版场景分组（折叠式） ===== */
.template-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.template-group-title {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  list-style: none;
  background: var(--surface-soft);
  transition: background 0.15s ease;
}
.template-group-title::-webkit-details-marker {
  display: none;
}
.template-group-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-2, var(--text));
  border-bottom: 2px solid var(--text-2, var(--text));
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
.template-group[open] .template-group-title::before {
  transform: rotate(-135deg);
}
.template-group-title:hover {
  background: var(--accent-soft);
}
.template-group-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2, var(--text));
  background: var(--line);
  border-radius: 20px;
  padding: 1px 8px;
}
.template-group .template-item {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-top: 1px solid var(--line);
}
.template-group .template-item:last-child {
  border-bottom: none;
}

/* ===== 协议书页（用户协议 / 隐私政策，笔记本内翻页展示） ===== */
.page-doc {
  position: absolute;
  inset: 0;
  z-index: 7;
  border-radius: 0 26px 26px 0;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,0.94) 0%, rgba(237,243,251,0.9) 55%, rgba(224,236,252,0.76) 100%),
    repeating-linear-gradient(0deg, rgba(148,163,184,0.10) 0, rgba(148,163,184,0.10) 1px, transparent 1px, transparent 34px);
  box-shadow: inset 4px 0 8px rgba(30, 58, 138, 0.08), inset 0 0 0 1px rgba(30, 58, 138, 0.05);
  display: flex;
  align-items: stretch;
  justify-content: center;
  opacity: 0;
  transform: perspective(1200px) rotateY(9deg) translateX(26px);
  transform-origin: left center;
  pointer-events: none;
  transition: opacity 0.45s ease 0.15s, transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s;
}
.page-doc[hidden] { display: none; }
.page-doc.show { opacity: 1; transform: none; pointer-events: auto; }
/* 返回登录：协议书页绕左侧书脊往回翻（露出下面的登录卡） */
@keyframes docFlipBack {
  0%   { transform: perspective(1200px) rotateY(0deg) translateX(0); opacity: 1; }
  26%  { transform: perspective(1200px) rotateY(-34deg) translateX(-10px); opacity: 1; }
  72%  { transform: perspective(1200px) rotateY(-156deg) translateX(-44px); opacity: 0.5; }
  100% { transform: perspective(1200px) rotateY(-170deg) translateX(-52px); opacity: 0; }
}
.page-doc.flip-back { animation: docFlipBack 0.85s cubic-bezier(0.4, 0, 0.2, 1) both; }
.doc-page-inner {
  width: 100%;
  max-width: 318px;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  box-sizing: border-box;
}
.doc-page-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}
.doc-page-tab {
  flex: 1;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.doc-page-tab:hover { background: rgba(255, 255, 255, 0.8); color: #334155; }
.doc-page-tab.is-active {
  background: linear-gradient(135deg, #2563eb, #3b82f6 60%, #60a5fa);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}
.doc-page-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 10px 2px;
  font-size: 12.5px;
  line-height: 1.75;
  color: #334155;
}
.doc-page-content { display: none; }
.doc-page-content.is-active { display: block; }
.doc-page-content p { margin: 0 0 9px; }
.doc-page-content h3 { margin: 14px 0 5px; font-size: 13.5px; font-weight: 700; color: #0f2447; }
.doc-page-content .doc-update { margin-bottom: 12px; font-size: 11px; color: #94a3b8; }
.doc-page-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}
.doc-page-foot .ghost-btn {
  height: 42px;
  padding: 0 18px;
  border: 1.5px solid rgba(100, 116, 139, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  color: #475569;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.doc-page-foot .ghost-btn:hover { border-color: rgba(37, 99, 235, 0.5); color: #2563eb; background: rgba(255,255,255,0.9); }
.doc-page-foot .doc-ok-btn {
  flex: 1;
  margin-top: 0;
  height: 42px;
  font-size: 13.5px;
}
