:root {
  --ink: #12302e;
  --muted: rgba(52, 83, 79, 0.72);
  --line: rgba(255, 255, 255, 0.68);
  --line-strong: rgba(255, 255, 255, 0.86);
  --panel: rgba(255, 255, 255, 0.42);
  --panel-strong: rgba(255, 255, 255, 0.62);
  --bg: #eefbf5;
  --accent: rgba(34, 153, 132, 0.82);
  --accent-dark: rgba(20, 122, 105, 0.9);
  --accent-soft: rgba(34, 197, 154, 0.18);
  --danger-soft: rgba(248, 113, 113, 0.22);
  --glass-blur: blur(24px) saturate(155%);
  --glass-shadow: 0 22px 60px rgba(25, 85, 73, 0.18);
  --glass-shadow-soft: 0 12px 32px rgba(25, 85, 73, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.8), transparent 24%),
    radial-gradient(circle at 78% 8%, rgba(187, 247, 208, 0.72), transparent 30%),
    radial-gradient(circle at 88% 78%, rgba(94, 234, 212, 0.34), transparent 32%),
    linear-gradient(135deg, #f8fffc 0%, #e5f8ee 38%, #c9f0df 70%, #f8fffc 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.72), transparent 18%),
    radial-gradient(circle at 62% 48%, rgba(167, 243, 208, 0.46), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.12));
  filter: blur(2px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  margin: 16px auto 0;
  width: min(1500px, calc(100% - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

p,
span {
  color: var(--muted);
}

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 28px 42px;
}

button,
input,
select,
textarea {
  font: inherit;
  border-radius: 8px;
}

button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--glass-shadow);
}

button:active {
  transform: translateY(1px);
}

button.ghost {
  background: var(--panel);
  color: var(--ink);
  box-shadow: none;
}

button.ghost:hover {
  background: var(--panel-strong);
}

button.danger {
  background: var(--panel);
  color: #b91c1c;
  box-shadow: none;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(120, 221, 214, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: rgba(52, 83, 79, 0.48);
}

.toolbar,
.table-section,
.output-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.app-shell {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.content-area {
  min-width: 0;
}

.view-tabs {
  display: grid;
  gap: 10px;
}

.view-tab {
  width: 100%;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid transparent;
  text-align: left;
  font-weight: 700;
  box-shadow: none;
}

a.view-tab {
  display: block;
  text-decoration: none;
}

.doc-manual {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.doc-manual-toc {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 4px;
  padding: 14px 10px;
  color: #646a73;
  font-size: 13px;
}

.doc-manual-toc strong {
  display: block;
  padding: 0 8px 8px;
  color: #1f2329;
  font-size: 13px;
}

.doc-manual-toc a {
  padding: 7px 8px;
  border-radius: 6px;
  color: #646a73;
  text-decoration: none;
}

.doc-manual-toc a:hover {
  background: #f2f3f5;
  color: #1f2329;
}

.doc-page {
  min-height: 72vh;
  padding: 48px 64px 72px;
  border: 1px solid rgba(31, 35, 41, 0.08);
  border-radius: 8px;
  background: #ffffff;
  color: #1f2329;
  box-shadow: 0 16px 40px rgba(31, 35, 41, 0.08);
}

.doc-header {
  padding-bottom: 26px;
  border-bottom: 1px solid #eff0f1;
}

.doc-header p {
  margin: 0 0 10px;
  color: #8f959e;
  font-size: 14px;
}

.doc-header h1 {
  margin: 0 0 14px;
  color: #1f2329;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 800;
}

.doc-header span {
  color: #8f959e;
  font-size: 13px;
}

.doc-section {
  padding-top: 34px;
  scroll-margin-top: 18px;
}

.doc-section h2 {
  margin: 0 0 10px;
  color: #1f2329;
  font-size: 26px;
  line-height: 1.35;
  font-weight: 800;
}

.doc-lead {
  margin: 0 0 26px;
  color: #646a73;
  line-height: 1.75;
}

.doc-block {
  margin: 26px 0 0;
}

.doc-block h3 {
  margin: 0 0 14px;
  color: #1f2329;
  font-size: 20px;
  line-height: 1.4;
}

.doc-subblock {
  margin: 20px 0 0;
}

.doc-subblock h4,
.doc-qa h4 {
  margin: 0 0 8px;
  color: #1f2329;
  font-size: 16px;
  line-height: 1.55;
}

.doc-subblock ol {
  margin: 0;
  padding-left: 22px;
}

.doc-subblock li {
  margin: 7px 0;
  padding-left: 2px;
  color: #373c43;
  line-height: 1.75;
}

.doc-qa-list {
  display: grid;
  gap: 18px;
}

.doc-qa {
  padding: 0 0 18px;
  border-bottom: 1px solid #eff0f1;
}

.doc-qa p {
  margin: 0;
  color: #373c43;
  line-height: 1.75;
}

.doc-keyword {
  display: inline;
  color: #1f2329;
  font-weight: 800;
  background: #eef3ff;
  border-radius: 4px;
  padding: 1px 4px;
}

.markdown-doc {
  font-size: 15px;
  line-height: 1.85;
}

.markdown-doc h1,
.markdown-doc h2,
.markdown-doc h3,
.markdown-doc h4 {
  color: #1f2329;
  font-weight: 800;
  letter-spacing: 0;
}

.markdown-doc h1 {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.24;
}

.markdown-doc h2 {
  margin: 44px 0 12px;
  padding-top: 8px;
  font-size: 26px;
  line-height: 1.38;
}

.markdown-doc h3 {
  margin: 30px 0 12px;
  font-size: 20px;
  line-height: 1.45;
}

.markdown-doc h4 {
  margin: 24px 0 8px;
  font-size: 16px;
  line-height: 1.55;
}

.markdown-doc p {
  margin: 10px 0;
  color: #373c43;
}

.markdown-doc blockquote {
  margin: 14px 0 20px;
  padding: 10px 14px;
  border-left: 4px solid #d0d3d6;
  background: #f7f8fa;
  color: #646a73;
}

.markdown-doc blockquote p {
  margin: 4px 0;
  color: #646a73;
}

.markdown-doc ol {
  margin: 8px 0 18px;
  padding-left: 24px;
}

.markdown-doc li {
  margin: 8px 0;
  padding-left: 4px;
  color: #373c43;
}

.markdown-doc strong {
  color: #1f2329;
  font-weight: 850;
  background: #eef3ff;
  border-radius: 4px;
  padding: 1px 4px;
}

.markdown-doc em {
  color: #646a73;
  font-style: italic;
}

.markdown-doc code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #f2f3f5;
  color: #1f2329;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.view-tab.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.toolbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.search-box {
  min-width: 0;
}

.archive-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 10px;
}

.channel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.channel-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid transparent;
  background: var(--panel);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-tab:hover {
  background: var(--panel-strong);
}

.channel-tab.active {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.channel-tab span {
  color: inherit;
  opacity: 0.75;
  font-size: 12px;
}

.toolbar-actions,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.icon-refresh {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.page-size-control select {
  width: 74px;
  padding: 7px 8px;
}

.checkbox-label {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
}

.manual-order-channel {
  color: #047857;
  background: rgba(187, 247, 208, 0.54);
}

.table-section {
  padding: 0;
  overflow: hidden;
}

.table-wrap {
  max-height: calc(100vh - 270px);
  min-height: 260px;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.62);
  color: #17423d;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

[data-toggle-row] {
  cursor: pointer;
}

[data-toggle-row]:hover td {
  background: rgba(255, 255, 255, 0.38);
}

.duplicate-code-row td {
  background: rgba(254, 243, 199, 0.52);
}

[data-toggle-row].duplicate-code-row:hover td {
  background: rgba(254, 240, 138, 0.62);
}

.selected-row td {
  background: rgba(187, 247, 208, 0.5);
}

.duplicate-code-row.selected-row td {
  background: rgba(253, 230, 138, 0.68);
}

.check-col {
  width: 48px;
  text-align: center;
}

th:nth-child(2),
td:nth-child(2) {
  width: 150px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 330px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 120px;
}

th:nth-child(5),
td:nth-child(5),
th:nth-child(7),
td:nth-child(7),
th:nth-child(8),
td:nth-child(8) {
  width: 110px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 150px;
}

.archive-table th:nth-child(1),
.archive-table td:nth-child(1) {
  width: 150px;
}

.archive-table th:nth-child(2),
.archive-table td:nth-child(2) {
  width: 150px;
}

.archive-table th:nth-child(3),
.archive-table td:nth-child(3) {
  width: 330px;
}

.archive-table th:nth-child(4),
.archive-table td:nth-child(4),
.archive-table th:nth-child(5),
.archive-table td:nth-child(5),
.archive-table th:nth-child(6),
.archive-table td:nth-child(6),
.archive-table th:nth-child(8),
.archive-table td:nth-child(8) {
  width: 110px;
}

.archive-table th:nth-child(7),
.archive-table td:nth-child(7) {
  width: 150px;
}

.archive-table th:nth-child(9),
.archive-table td:nth-child(9) {
  width: 150px;
}

.manual-order-table th,
.manual-order-table td {
  width: 25%;
}

.check-col input {
  width: 18px;
  height: 18px;
}

.commission-input {
  width: 92px;
}

.inline-edit-input {
  padding: 7px 8px;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

.archive-actions {
  flex-wrap: nowrap;
}

.inline-actions button {
  padding: 7px 9px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.pagination button {
  min-width: 54px;
  padding: 7px 10px;
}

.pagination button:disabled {
  cursor: default;
  opacity: 0.45;
}

.pagination button:disabled:hover {
  background: var(--panel);
}

.page-numbers {
  display: grid;
  grid-template-columns: repeat(3, 38px);
  gap: 6px;
  align-items: center;
}

.page-number {
  min-width: 38px !important;
  width: 38px;
  height: 34px;
  padding: 0 !important;
  border: 1px solid transparent;
  background: var(--panel);
  color: var(--ink);
}

.page-number:hover {
  background: var(--panel-strong);
}

.page-number.active {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

.page-placeholder {
  width: 38px;
  height: 34px;
}

.output-panel {
  margin-top: 14px;
  padding: 16px;
}

.output-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

#quoteOutput {
  min-height: 220px;
  margin-top: 12px;
  line-height: 1.7;
  resize: vertical;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 40, 34, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-card {
  display: grid;
  gap: 14px;
  width: min(500px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.confirm-card {
  width: min(460px, 100%);
}

.duplicate-card {
  width: min(840px, 100%);
}

.confirm-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.duplicate-list {
  display: grid;
  gap: 12px;
  max-height: min(520px, calc(100vh - 220px));
  overflow: auto;
}

.duplicate-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.duplicate-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.duplicate-row {
  display: grid;
  grid-template-columns: 82px minmax(120px, 1fr) minmax(220px, 1.7fr) 100px 110px auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.duplicate-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.duplicate-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.duplicate-actions button {
  padding: 7px 10px;
}

.cell-note {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-card {
  width: min(860px, 100%);
}

.archive-import-card {
  width: min(760px, 100%);
  padding-top: 0;
}

.archive-import-title {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -18px;
  padding: 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.modal-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.modal-card select[multiple],
.modal-card textarea {
  width: 100%;
  resize: vertical;
}

.manual-topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.manual-sections {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.manual-sections h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.manual-sections button {
  margin-top: 12px;
}

.manual-import-row {
  display: grid;
  gap: 10px;
}

.import-help {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.import-result {
  margin: 12px 0 0;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.archive-repair-panel {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.archive-repair-panel h3 {
  margin: 0;
  font-size: 16px;
}

.archive-repair-rows {
  display: grid;
  gap: 12px;
  max-height: min(360px, calc(100vh - 360px));
  overflow: auto;
}

.archive-repair-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-radius: 8px;
}

.repair-row-title {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-align: center;
  font-weight: 700;
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.native-like-tooltip {
  position: fixed;
  z-index: 50;
  max-width: min(520px, calc(100vw - 16px));
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  pointer-events: none;
}

.context-menu {
  position: fixed;
  z-index: 60;
  display: grid;
  gap: 6px;
  min-width: 150px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.context-menu button {
  width: 100%;
  color: var(--ink);
  background: var(--panel);
  box-shadow: none;
  text-align: left;
}

.context-menu button:hover {
  background: var(--panel-strong);
  color: var(--ink);
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .topbar,
  .toolbar,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .view-tabs {
    display: flex;
    overflow-x: auto;
  }

  .view-tab {
    flex: 0 0 auto;
    width: auto;
  }

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

  .sidebar {
    position: static;
  }

  .archive-filters {
    grid-template-columns: 1fr;
  }

  main {
    padding: 14px;
  }

  .topbar {
    padding: 16px;
  }

  h1 {
    font-size: 22px;
  }

  .table-wrap {
    max-height: none;
    min-height: 280px;
  }

  .manual-grid {
    grid-template-columns: 1fr;
  }

  .manual-sections {
    grid-template-columns: 1fr;
  }

  .archive-repair-row {
    grid-template-columns: 1fr;
  }
}

/* Minimal editorial theme: black, white, gray, no decoration. */
:root {
  --ink: #111111;
  --muted: #6f6f6f;
  --line: #dedede;
  --line-strong: #111111;
  --panel: #ffffff;
  --panel-strong: #f5f5f5;
  --bg: #ffffff;
  --accent: #111111;
  --accent-dark: #000000;
  --accent-soft: #eeeeee;
  --danger-soft: #f2f2f2;
}

* {
  box-shadow: none !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body {
  color: var(--ink);
  background: #ffffff !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body::before {
  content: none !important;
}

h1,
h2,
.view-tab,
strong {
  font-family: "Playfair Display", Georgia, "Times New Roman", "Songti SC", serif;
  font-weight: 600;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 21px;
}

p,
span,
.cell-note,
.import-help,
.page-size-control,
.modal-card label {
  color: var(--muted);
}

.topbar,
.toolbar,
.table-section,
.output-panel,
.sidebar,
.channel-tabs,
.modal-card,
.duplicate-group,
.archive-repair-row,
.import-result,
.context-menu,
.native-like-tooltip,
.toast {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
}

.topbar {
  margin-top: 28px;
  padding: 26px 0 24px;
  border-width: 0 0 1px !important;
  width: min(1500px, calc(100% - 56px));
  justify-content: flex-start;
}

.brand-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

main {
  padding-top: 32px;
}

.app-shell {
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 32px;
}

.sidebar {
  padding: 0;
  border-width: 0 !important;
  background: transparent !important;
}

.view-tabs {
  gap: 0;
}

.view-tab {
  padding: 14px 0;
  background: transparent !important;
  border-width: 0 0 1px !important;
  border-color: var(--line) !important;
  color: var(--muted);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.view-tab.active {
  color: var(--ink);
  background: transparent !important;
  border-color: var(--ink) !important;
}

.toolbar {
  padding: 0 0 22px;
  margin-bottom: 24px;
  border-width: 0 0 1px !important;
}

.table-section,
.output-panel,
.channel-tabs {
  border-width: 1px 0 !important;
}

.channel-tabs {
  padding: 16px 0;
  margin: 0 0 24px;
}

button,
input,
select,
textarea {
  border: 1px solid var(--line) !important;
  background: #ffffff !important;
  color: var(--ink) !important;
}

button {
  padding: 9px 16px;
}

button:hover,
button.ghost:hover,
button.danger:hover,
.channel-tab:hover,
.page-number:hover {
  background: #f5f5f5 !important;
}

button:not(.ghost):not(.danger):not(.channel-tab):not(.view-tab):not(.page-number),
.page-number.active,
.channel-tab.active {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #111111 !important;
}

button.danger {
  color: #111111 !important;
}

.mini-refresh {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  color: #111111 !important;
  border-color: #111111 !important;
  box-shadow: none !important;
  font-size: 18px;
  line-height: 1;
}

.mini-refresh:hover {
  background: #f5f5f5 !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #111111 !important;
  outline: 1px solid #111111;
}

input::placeholder,
textarea::placeholder {
  color: #8a8a8a;
}

table {
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line) !important;
  color: var(--ink);
  background: #ffffff !important;
}

th {
  background: #f7f7f7 !important;
  color: #111111 !important;
  font-weight: 600;
}

[data-toggle-row]:hover td,
.selected-row td,
.duplicate-code-row td,
[data-toggle-row].duplicate-code-row:hover td,
.duplicate-code-row.selected-row td {
  background: #f4f4f4 !important;
}

.manual-order-channel {
  color: #111111 !important;
  background: #eeeeee !important;
}

.pagination {
  background: #ffffff !important;
  border-top: 1px solid var(--line) !important;
}

.modal {
  background: rgba(255, 255, 255, 0.82) !important;
}

.modal-card {
  border: 1px solid #111111 !important;
}

.duplicate-row span {
  color: var(--ink);
}

.toast {
  border-color: #111111 !important;
}

.context-menu button {
  border: 0 !important;
  text-align: left;
}

.channel-tab.manual-order-channel,
.channel-tab.manual-order-channel.active {
  background: #0f7a4f !important;
  border-color: #0f7a4f !important;
  color: #ffffff !important;
}

.channel-edit-input {
  width: 130px;
  min-width: 100px;
  padding: 0;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font: inherit;
  text-align: center;
}

.view-tab {
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid #111111 !important;
}

.view-tab.active {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #111111 !important;
}

.channel-tab {
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid #111111 !important;
}

.channel-tab.active {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #111111 !important;
}

.channel-tab.manual-order-channel,
.channel-tab.manual-order-channel.active {
  background: #0f7a4f !important;
  border-color: #0f7a4f !important;
  color: #ffffff !important;
}

.selected-row td {
  background: #e8e8e8 !important;
  border-top: 1px solid #111111 !important;
  border-bottom: 1px solid #111111 !important;
}

/* Final state locks: keep manual-order green and active states unmistakable. */
.view-tabs .view-tab {
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid #111111 !important;
}

.view-tabs .view-tab.active {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #111111 !important;
}

#archivedChannelTabs .channel-tab {
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid #111111 !important;
}

#archivedChannelTabs .channel-tab.active {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #111111 !important;
}

#archivedChannelTabs .channel-tab.manual-order-channel,
#archivedChannelTabs .channel-tab.manual-order-channel.active {
  background: #0f7a4f !important;
  color: #ffffff !important;
  border-color: #0f7a4f !important;
}

tbody tr.selected-row td {
  background: #dddddd !important;
  border-top: 2px solid #111111 !important;
  border-bottom: 2px solid #111111 !important;
  color: #111111 !important;
}

tbody tr.selected-row td:first-child {
  border-left: 6px solid #111111 !important;
}

.channel-select-label {
  position: relative;
}

.compact-channel-search {
  width: 128px !important;
  min-height: 30px !important;
  padding: 5px 8px !important;
  margin: 6px 0 8px auto !important;
  display: block;
  font-size: 12px !important;
}

.mapping-panel {
  border: 1px solid #d8d8d8;
  padding: 12px;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mapping-grid select {
  width: 100%;
}

.settings-table th,
.settings-table td {
  text-align: center !important;
}

.settings-table {
  width: min(760px, 100%) !important;
  margin: 0 auto;
}

.settings-table th:nth-child(1),
.settings-table td:nth-child(1) {
  width: 220px !important;
}

.settings-table th:nth-child(2),
.settings-table td:nth-child(2) {
  width: 300px !important;
}

.settings-table th:nth-child(3),
.settings-table td:nth-child(3) {
  width: 120px !important;
}

.settings-table th,
.settings-table td {
  font-size: 18px !important;
}

.settings-table .visitor-name-btn {
  font-size: 18px !important;
}

.permission-check {
  width: 18px;
  height: 18px;
}

.visitor-name-btn {
  padding: 0 !important;
  min-width: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #111111 !important;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.visitor-name-btn:hover {
  background: transparent !important;
}

.permission-list {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.permission-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border-bottom: 1px solid #e5e5e5;
  font-size: 18px;
}

.permission-status-row.allowed span {
  color: #111111;
  font-weight: 700;
}

.permission-status-row.missing span {
  color: #9a9a9a;
}

.permission-apply-btn {
  min-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #1d4ed8 !important;
  font-size: 16px;
  font-weight: 700;
}

.permission-apply-btn:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.permission-denied {
  opacity: 0.44 !important;
  cursor: not-allowed !important;
}

#visitorDialog {
  display: grid;
  place-items: center;
}

#visitorDialog.hidden {
  display: none !important;
}

#visitorNameInput {
  width: 100%;
}

/* Final pagination lock: three fixed page slots, active page only is inverted. */
.pagination .page-numbers {
  display: grid !important;
  grid-template-columns: repeat(3, 38px) !important;
  gap: 8px !important;
}

.pagination .page-number {
  width: 38px !important;
  min-width: 38px !important;
  height: 34px !important;
  padding: 0 !important;
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid #d8d8d8 !important;
}

.pagination .page-number.active {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #111111 !important;
}

.pagination .page-placeholder {
  width: 38px !important;
  height: 34px !important;
  background: transparent !important;
  border: 0 !important;
}

/* Final compact table layout: keep primary fields visible without horizontal scrolling. */
.table-wrap {
  overflow-x: auto !important;
  overflow-y: auto !important;
}

table {
  min-width: 0 !important;
  width: 100% !important;
  table-layout: fixed !important;
}

th,
td {
  padding: 6px 8px !important;
  font-size: 13px !important;
  line-height: 1.28 !important;
}

#exportView table {
  min-width: 820px !important;
}

#exportView .check-col {
  width: 38px !important;
}

#exportView th:nth-child(2),
#exportView td:nth-child(2) {
  width: 120px !important;
}

#exportView th:nth-child(3),
#exportView td:nth-child(3) {
  width: 230px !important;
}

#exportView th:nth-child(4),
#exportView td:nth-child(4) {
  width: 78px !important;
}

#exportView th:nth-child(5),
#exportView td:nth-child(5),
#exportView th:nth-child(7),
#exportView td:nth-child(7),
#exportView th:nth-child(8),
#exportView td:nth-child(8) {
  width: 72px !important;
}

#exportView th:nth-child(6),
#exportView td:nth-child(6) {
  width: 118px !important;
}

#exportView .commission-input {
  width: 64px !important;
  padding: 5px 6px !important;
}

.archive-table {
  min-width: 1040px !important;
}

.archive-table th:nth-child(1),
.archive-table td:nth-child(1) {
  width: 100px !important;
}

.archive-table th:nth-child(2),
.archive-table td:nth-child(2) {
  width: 120px !important;
}

.archive-table th:nth-child(3),
.archive-table td:nth-child(3) {
  width: 230px !important;
}

.archive-table th:nth-child(4),
.archive-table td:nth-child(4),
.archive-table th:nth-child(5),
.archive-table td:nth-child(5),
.archive-table th:nth-child(6),
.archive-table td:nth-child(6) {
  width: 70px !important;
}

.archive-table th:nth-child(7),
.archive-table td:nth-child(7) {
  width: 120px !important;
}

.archive-table th:nth-child(8),
.archive-table td:nth-child(8) {
  width: 96px !important;
}

.archive-table th:nth-child(9),
.archive-table td:nth-child(9) {
  width: 120px !important;
}

.archive-actions {
  gap: 4px !important;
}

.archive-actions button,
.inline-actions button {
  padding: 5px 7px !important;
  font-size: 12px !important;
}

.manual-order-table,
.settings-table {
  min-width: 0 !important;
}

.channel-list-card {
  width: min(760px, calc(100vw - 32px)) !important;
}

.channel-list-tabs {
  max-height: 52vh;
  overflow: auto;
  margin: 0 !important;
}

.empty-hint {
  display: block;
  padding: 12px 0;
  color: #777777;
}

.current-channel-label {
  align-self: center;
  padding: 8px 0;
  color: #111111 !important;
  font-weight: 600;
}

#exportView .table-section {
  position: sticky;
  top: 92px;
  z-index: 2;
  max-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

#exportView .table-wrap {
  flex: 1 1 auto;
  max-height: calc(100vh - 184px) !important;
  min-height: 390px;
  overscroll-behavior: contain;
}

#exportView #cargoPagination {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 12px 12px;
  background: rgba(255, 255, 255, 0.34);
  border-top: 1px solid var(--line);
}

.manual-page {
  color: var(--ink);
}

.manual-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1280px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.manual-hero h1 {
  margin-top: 12px;
  font-size: clamp(28px, 5vw, 54px);
  line-height: 1.02;
}

.manual-hero p {
  max-width: 720px;
  margin-top: 12px;
  font-size: 15px;
}

.manual-back-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.manual-meta {
  white-space: nowrap;
  align-self: flex-start;
}

.manual-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  width: min(1280px, calc(100% - 32px));
  max-width: none;
  margin: 0 auto;
  padding: 18px 0 46px;
}

.manual-sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.manual-nav {
  display: grid;
  gap: 8px;
}

.manual-nav a {
  padding: 10px 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 8px;
}

.manual-nav a:hover {
  background: rgba(255, 255, 255, 0.62);
  border-color: var(--line);
}

.manual-content {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.manual-overview,
.manual-section,
.manual-topic,
.manual-qa,
.manual-qa-card,
.manual-layout-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.manual-overview,
.manual-section {
  padding: 22px;
}

.manual-overview h2 {
  margin-bottom: 12px;
}

.manual-overview ul,
.manual-topic ul {
  margin: 0;
  padding-left: 20px;
}

.manual-overview li,
.manual-topic li {
  margin: 8px 0;
  line-height: 1.7;
}

.manual-section {
  scroll-margin-top: 18px;
}

.manual-section-head {
  margin-bottom: 16px;
}

.manual-section-head p {
  color: var(--ink);
  font-weight: 800;
}

.manual-section-head h2 {
  max-width: 820px;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.35;
}

.manual-layout-card {
  padding: 16px;
  margin-bottom: 16px;
}

.manual-keyword {
  display: inline-block;
  margin: 0 2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #062f2a;
  color: #ffffff;
  font-weight: 900;
  line-height: 1.45;
  box-shadow: none;
}

.manual-layout-card h3,
.manual-topic h3 {
  margin: 0 0 12px;
}

.manual-annotation {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.manual-callout {
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.manual-callout span,
.manual-flow-step span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.manual-callout strong {
  display: block;
  color: var(--ink);
}

.manual-callout p {
  margin-top: 8px;
  line-height: 1.6;
}

.manual-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.manual-basic {
  display: grid;
  gap: 12px;
}

.manual-basic > h3 {
  margin: 0;
  font-size: 18px;
}

.manual-basic-list {
  display: grid;
  gap: 10px;
}

.manual-basic-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.manual-basic-item h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.manual-basic-item ul {
  margin: 0;
  padding-left: 20px;
}

.manual-basic-item li {
  margin: 8px 0;
  line-height: 1.75;
}

.manual-qa {
  padding: 16px;
  margin-top: 16px;
}

.manual-qa h3 {
  margin: 0 0 12px;
}

.manual-qa-grid {
  display: grid;
  gap: 10px;
}

.manual-qa-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.46);
}

.manual-question {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.55;
}

.manual-answer {
  margin-top: 8px;
  line-height: 1.7;
}

.manual-flow-step {
  position: relative;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.manual-flow-step p {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.4;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.manual-topic {
  padding: 16px;
}

@media (max-width: 980px) {
  .manual-hero,
  .manual-shell {
    width: calc(100% - 24px);
  }

  .manual-shell {
    grid-template-columns: 1fr;
  }

  .manual-sidebar {
    position: static;
  }

  .manual-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .manual-annotation,
  .manual-qa-grid,
  .manual-topic-grid {
    grid-template-columns: 1fr;
  }

  .manual-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #exportView .table-section {
    position: static;
    max-height: none;
  }

  #exportView .table-wrap {
    max-height: none !important;
    min-height: 280px;
  }
}

@media (max-width: 640px) {
  .manual-hero {
    display: block;
    padding: 20px;
  }

  .manual-meta {
    margin-top: 16px;
  }

  .manual-nav,
  .manual-flow {
    grid-template-columns: 1fr;
  }
}
