:root {
  color-scheme: light;
  --bg: #f2efe7;
  --panel: #fffdfa;
  --panel-strong: #f9f6ef;
  --ink: #15231b;
  --muted: #61716b;
  --line: #d6d0c4;
  --accent: #14532d;
  --accent-soft: #d8ead7;
  --amber: #9a3412;
  --amber-soft: #ffedd5;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --teal: #0f766e;
  --teal-soft: #ccfbf1;
  --slate-soft: #e7ecea;
  --empty-soft: #f0ece3;
  --shadow: 0 18px 40px rgba(20, 35, 27, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(20, 83, 45, 0.08), transparent 28%),
    linear-gradient(180deg, #f8f4eb 0%, var(--bg) 100%);
  color: var(--ink);
}

code,
pre {
  font-family: "Cascadia Code", "Consolas", monospace;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.button-subtle {
  background: white;
  color: var(--accent);
  border: 1px solid rgba(20, 83, 45, 0.2);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--accent);
  color: white;
  text-decoration: none;
}

.button-link--subtle {
  background: white;
  color: var(--accent);
  border: 1px solid rgba(20, 83, 45, 0.2);
}

.shell {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.shell--monitor {
  width: min(1600px, calc(100% - 32px));
}

.shell--detail {
  width: min(1180px, calc(100% - 32px));
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px;
  border: 1px solid rgba(21, 35, 27, 0.08);
  border-radius: 24px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1;
}

.lede {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.summary-card,
.matrix-panel,
.detail-panel {
  border: 1px solid rgba(21, 35, 27, 0.08);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-card {
  border-radius: 20px;
  padding: 18px 20px;
}

.summary-card p {
  margin: 0;
  color: var(--muted);
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

.workspace {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.matrix-panel--full {
  margin-top: 0;
  border-radius: 24px;
  overflow: hidden;
}

.matrix-panel,
.detail-panel {
  border-radius: 24px;
  overflow: hidden;
}

.toolbar {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(21, 35, 27, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.search {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.search input {
  width: min(420px, 40vw);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: white;
}

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

.matrix-scroll {
  overflow-x: auto;
  padding: 18px 18px 22px;
}

.matrix-header,
.matrix-row {
  display: grid;
  grid-template-columns: 72px repeat(8, minmax(132px, 1fr));
  gap: 10px;
  min-width: 1180px;
}

.matrix-header {
  margin-bottom: 10px;
}

.matrix-corner,
.matrix-slot-heading,
.matrix-box-label {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
}

.matrix-corner,
.matrix-slot-heading {
  min-height: 46px;
  background: var(--panel-strong);
  color: var(--muted);
  border: 1px solid rgba(21, 35, 27, 0.08);
  font-weight: 600;
}

.matrix-row + .matrix-row {
  margin-top: 10px;
}

.matrix-box-label {
  min-height: 152px;
  background: linear-gradient(180deg, #f8f3ea 0%, #f1ede5 100%);
  border: 1px solid rgba(21, 35, 27, 0.1);
  color: #8a1f11;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.channel-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  min-height: 152px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid rgba(21, 35, 27, 0.1);
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.98), rgba(244, 239, 229, 0.92));
  color: var(--ink);
  text-align: left;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.channel-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 83, 45, 0.24);
  box-shadow: 0 12px 24px rgba(20, 35, 27, 0.1);
}

.channel-tile[data-selected="true"] {
  border-color: rgba(29, 78, 216, 0.5);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15), 0 12px 24px rgba(20, 35, 27, 0.1);
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.95), rgba(255, 253, 250, 0.98));
}

.channel-tile[data-matched="false"] {
  opacity: 0.42;
}

.channel-tile[data-tone="active"] {
  background: linear-gradient(180deg, rgba(216, 234, 215, 0.9), rgba(255, 253, 250, 0.98));
}

.channel-tile[data-tone="archive"] {
  background: linear-gradient(180deg, rgba(255, 237, 213, 0.85), rgba(255, 253, 250, 0.98));
}

.channel-tile[data-tone="pending"] {
  background: linear-gradient(180deg, rgba(204, 251, 241, 0.85), rgba(255, 253, 250, 0.98));
}

.channel-tile[data-tone="idle"] {
  background: linear-gradient(180deg, rgba(231, 236, 234, 0.9), rgba(255, 253, 250, 0.98));
}

.channel-tile[data-tone="empty"] {
  background: linear-gradient(180deg, rgba(240, 236, 227, 0.9), rgba(255, 253, 250, 0.98));
}

.tile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.slot-tag {
  color: #9a2313;
  font-weight: 700;
  font-size: 18px;
}

.tile-age {
  color: var(--muted);
  font-size: 12px;
}

.tile-readout {
  flex: 1;
  display: grid;
  gap: 6px;
  align-content: center;
}

.tile-primary,
.tile-secondary,
.tile-tertiary {
  margin: 0;
}

.tile-primary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  word-break: break-all;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.22;
  color: var(--ink);
}

.tile-secondary,
.tile-tertiary {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.detail-panel {
  position: sticky;
  top: 18px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.98), rgba(247, 243, 235, 0.95));
}

.detail-panel--page {
  position: static;
  margin-top: 18px;
}

.detail-page-status {
  margin-top: 18px;
  border: 1px solid rgba(21, 35, 27, 0.08);
  border-radius: 20px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--shadow);
  padding: 16px 20px;
}

.detail-empty-label {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-empty h2 {
  margin: 8px 0 0;
  font-size: 28px;
}

.detail-empty p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.detail-content {
  display: grid;
  gap: 18px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.detail-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-title {
  margin: 8px 0 0;
  font-size: 28px;
  line-height: 1.2;
}

.detail-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.detail-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(20, 83, 45, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.detail-badge[data-tone="archive"],
.detail-badge--source[data-source="data_old"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.detail-badge[data-tone="pending"] {
  background: var(--teal-soft);
  color: var(--teal);
}

.detail-badge[data-tone="idle"],
.detail-badge--source[data-source="sysinfo_only"] {
  background: var(--slate-soft);
  color: #35534a;
}

.detail-badge[data-tone="empty"],
.detail-badge--source[data-source="empty_slot"] {
  background: var(--empty-soft);
  color: #6a6257;
}

.detail-badge[data-tone="loaded"],
.detail-badge--source[data-source="data_now"] {
  background: var(--blue-soft);
  color: var(--blue);
}

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

.metric-card,
.detail-section,
.raw-panel {
  border: 1px solid rgba(21, 35, 27, 0.08);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 18px;
}

.metric-card {
  padding: 16px;
}

.metric-card--cycle {
  background: linear-gradient(180deg, rgba(204, 251, 241, 0.92), rgba(255, 255, 255, 0.78));
  border-color: rgba(15, 118, 110, 0.18);
  padding: 14px;
}

.metric-card--cycle .metric-value {
  color: var(--teal);
  font-size: 21px;
}

.metric-label,
.metric-helper,
.section-head p {
  margin: 0;
  color: var(--muted);
}

.metric-value {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.1;
}

.metric-helper {
  display: block;
  margin-top: 8px;
  font-size: 12px;
}

.detail-section {
  padding: 18px;
}

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

.section-head h3 {
  margin: 0;
  font-size: 18px;
}

.section-head p {
  max-width: 320px;
  line-height: 1.5;
  text-align: right;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 18px 0 0;
}

.detail-facts div {
  min-width: 0;
}

.detail-facts dt {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-facts dd {
  margin: 8px 0 0;
  word-break: break-word;
}

.curve-shell {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.curve-stage {
  position: relative;
  min-height: 220px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(21, 35, 27, 0.08);
  background:
    linear-gradient(180deg, rgba(219, 234, 254, 0.35), rgba(255, 255, 255, 0.9)),
    linear-gradient(90deg, rgba(20, 83, 45, 0.03), transparent 30%);
}

.curve-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(21, 35, 27, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(21, 35, 27, 0.08) 1px, transparent 1px);
  background-size: 12.5% 25%;
}

.curve-callout {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 253, 250, 0.92);
  backdrop-filter: blur(6px);
}

.curve-callout strong {
  font-size: 18px;
}

.curve-callout span {
  color: var(--muted);
  line-height: 1.5;
}

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

.future-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px dashed rgba(21, 35, 27, 0.16);
}

.future-field span {
  color: var(--muted);
  font-size: 13px;
}

.future-field strong {
  color: var(--ink);
  font-size: 13px;
}

.future-field--pending {
  background: rgba(255, 248, 235, 0.92);
  border-style: solid;
}

.file-list {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.file-card {
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(21, 35, 27, 0.08);
}

.file-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.file-card p,
.file-card code {
  margin: 10px 0 0;
}

.file-card p {
  font-weight: 600;
}

.file-card code {
  display: block;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.raw-panel {
  padding: 16px 18px;
}

.raw-panel summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.raw-panel pre {
  margin: 14px 0 0;
  padding: 14px;
  border-radius: 16px;
  background: #17261f;
  color: #d9f3de;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

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

  .detail-panel {
    position: static;
  }
}

@media (max-width: 920px) {
  .hero,
  .toolbar,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

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

  .metric-strip,
  .detail-facts,
  .future-fields {
    grid-template-columns: 1fr;
  }

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

  .search input {
    width: 100%;
  }
}
