:root {
  --ink: #191615;
  --muted: #6d6864;
  --line: #e6e0dc;
  --paper: #fffdfb;
  --surface: #ffffff;
  --rose: #b9545d;
  --rose-dark: #88353e;
  --sage: #6e8376;
  --blue: #506f8e;
  --gold: #b2894c;
  --black: #111111;
  --soft-rose: #f7e8e9;
  --soft-sage: #eaf0ec;
  --soft-blue: #e9f0f6;
  --soft-gold: #f6efe3;
  --shadow: 0 16px 40px rgba(29, 24, 20, 0.08);
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #fffaf8;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--black);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

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

.toc {
  display: grid;
  gap: 6px;
}

.toc a {
  color: var(--ink);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.toc a:hover,
.toc a.active {
  background: var(--soft-rose);
  color: var(--rose-dark);
}

.side-panel {
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.side-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bridge-dot-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
}

.status-dot.online {
  background: var(--sage);
}

.status-dot.offline {
  background: var(--rose);
}

.side-path {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.main {
  max-width: 1440px;
  padding: 28px 32px 64px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rose-dark);
  font-weight: 800;
}

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

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
}

h2 {
  margin: 0;
  font-size: 24px;
}

h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

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

.source-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 122px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--black);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.source-button:hover {
  background: var(--rose-dark);
}

.source-button.secondary {
  background: var(--soft-sage);
  color: var(--sage);
}

.source-button.secondary:hover {
  background: var(--sage);
  color: #fff;
}

.source-button.compact {
  min-width: 96px;
  margin-top: 12px;
}

.source-button.full {
  width: 100%;
  margin-top: 18px;
}

.source-button:disabled {
  cursor: not-allowed;
  background: #d6d0cc;
  color: #8d8580;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--rose-dark);
  font-size: 13px;
  font-weight: 800;
}

.section {
  scroll-margin-top: 24px;
  padding: 34px 0 0;
}

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

.section-note {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.action-panel,
.control-panel {
  padding: 18px;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f6;
}

.mode-button {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.mode-button.active {
  background: var(--black);
  color: #fff;
}

.mode-pane {
  display: none;
  margin-top: 16px;
}

.mode-pane.active {
  display: block;
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fff;
  line-height: 1.55;
}

textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px var(--soft-rose);
}

.inline-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 244px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbf8f6;
  text-align: center;
  color: var(--muted);
}

.drop-zone.dragover {
  border-color: var(--rose);
  background: var(--soft-rose);
}

.drop-zone strong {
  color: var(--ink);
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 28px;
  font-weight: 400;
}

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

.rule-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbf8f6;
}

.rule-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rule-row strong {
  color: var(--rose-dark);
  font-size: 14px;
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

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

.mini-metrics div {
  min-height: 74px;
  padding: 12px;
  border-radius: 6px;
  background: var(--soft-blue);
}

.mini-metrics div:nth-child(2) {
  background: var(--soft-sage);
}

.mini-metrics div:nth-child(3) {
  background: var(--soft-rose);
}

.mini-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.run-message {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  color: var(--ink);
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.file-name {
  font-weight: 800;
  word-break: break-word;
}

.file-path {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.remove-button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.result-grid {
  display: grid;
  gap: 12px;
}

.result-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.result-title {
  font-weight: 800;
  word-break: break-word;
}

.result-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.result-status.ok {
  background: var(--soft-sage);
  color: var(--sage);
}

.result-status.fail {
  background: var(--soft-rose);
  color: var(--rose-dark);
}

.output-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.output-item {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fbf8f6;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

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

.status-card {
  min-height: 112px;
  padding: 18px;
}

.status-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-card strong {
  display: block;
  margin-top: 12px;
  font-size: 17px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toc {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .workspace-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 22px 16px 48px;
  }

  .topbar,
  .section-head,
  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .mode-switch,
  .mini-metrics {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .source-button,
  .icon-button {
    width: 100%;
  }
}
