:root {
  --bg: #f6f6f1;
  --panel: #ffffff;
  --panel-soft: #fbfbf7;
  --text: #20211f;
  --muted: #6d706b;
  --line: #dedfd7;
  --line-strong: #c6c8bd;
  --accent: #2f6f63;
  --accent-soft: #e0eee9;
  --warn: #8a6130;
  --warn-soft: #f2e4cc;
  --rose: #9f354a;
  --rose-soft: #f3d8dd;
  --shadow: 0 8px 22px rgba(29, 31, 27, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  border-right: 1px solid var(--line);
  background: #f0f1eb;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.brand-title {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 750;
}

.brand-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.nav {
  padding: 12px;
}

.nav-item {
  display: block;
  padding: 10px 11px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.crawler-box {
  margin: auto 12px 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.crawler-state,
.crawler-note {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.crawler-note {
  color: var(--muted);
}

.main {
  margin-left: 236px;
  min-height: 100vh;
}

.page-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 246, 241, 0.95);
  backdrop-filter: blur(8px);
}

.eyebrow,
.tiny-label,
.metric-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin-top: 4px;
  font-size: 23px;
  line-height: 1.2;
}

.page-head p {
  margin-top: 6px;
  max-width: 860px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.head-actions {
  flex: 0 0 auto;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-button.loading {
  opacity: 0.65;
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(120px, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  min-height: 72px;
  padding: 13px 18px;
  background: var(--panel);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.metric.wide strong {
  font-size: 13px;
  line-height: 1.4;
}

.view {
  display: none;
  padding: 20px 24px 28px;
}

.view.active {
  display: block;
}

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

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

h3 {
  font-size: 15px;
  line-height: 1.35;
}

h4 {
  font-size: 14px;
  line-height: 1.35;
}

.section-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.pill {
  flex: 0 0 auto;
  max-width: 360px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.today-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.report-outline,
.report-reader,
.record-card,
.asset-detail,
.asset-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.report-outline {
  position: sticky;
  top: 100px;
  padding: 13px;
}

.outline-title {
  font-weight: 700;
  font-size: 13px;
}

.outline-item {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: #3a3b37;
  font-size: 12px;
  line-height: 1.45;
}

.report-reader {
  min-width: 0;
  padding: 18px;
  overflow: visible;
}

.report-reader.compact {
  max-height: calc(100vh - 168px);
  overflow: auto;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  width: 100%;
  display: grid;
  gap: 5px;
  text-align: left;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
}

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

.history-item span,
.history-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.fundamental-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  overflow-anchor: none;
}

.asset-panel {
  padding: 14px;
}

.module-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.module-switch-button {
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.module-switch-button:hover,
.module-switch-button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.module-section {
  display: none;
}

.module-section.active {
  display: block;
}

.module-title {
  font-size: 13px;
  font-weight: 750;
}

.asset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.mobile-detail-slot {
  display: none;
}

.asset-button {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

.asset-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.asset-button:hover,
.asset-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.asset-detail {
  min-width: 0;
  padding: 16px;
  overflow: hidden;
}

.detail-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-lead {
  color: #343631;
  font-size: 13px;
  line-height: 1.65;
}

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

.analysis-block {
  min-width: 0;
  margin-top: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.description {
  margin-top: 8px;
  color: #343631;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.analysis-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: #343631;
  font-size: 12px;
  line-height: 1.55;
}

.analysis-list li + li {
  margin-top: 4px;
}

.analysis-subtitle {
  margin-top: 10px;
}

.subhead {
  margin-top: 18px;
}

.records-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.record-card {
  min-width: 0;
  padding: 16px;
}

.record-body {
  margin-top: 12px;
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.run-list {
  margin-top: 10px;
  display: grid;
  gap: 7px;
}

.run-item {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.analysis-table,
.markdown-body table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.45;
}

.analysis-table th,
.analysis-table td,
.markdown-body th,
.markdown-body td {
  padding: 8px 9px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.analysis-table th,
.markdown-body th {
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 700;
}

.markdown-body {
  color: #2e302c;
  font-size: 14px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.markdown-body.compact {
  font-size: 13px;
}

.markdown-body h1 {
  margin: 0 0 10px;
  font-size: 22px;
}

.markdown-body h2 {
  margin: 22px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 18px;
}

.markdown-body h3 {
  margin: 16px 0 8px;
  font-size: 15px;
}

.markdown-body h4 {
  margin: 14px 0 8px;
}

.markdown-body p {
  margin: 9px 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown-body ul,
.markdown-body ol {
  margin: 9px 0;
  padding-left: 22px;
}

.markdown-body li + li {
  margin-top: 5px;
}

.markdown-body hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.markdown-body code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--panel-soft);
  font-family: Consolas, "Courier New", monospace;
}

.markdown-body table,
.analysis-table {
  display: block;
  overflow-x: auto;
  white-space: normal;
}

.missing-line {
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  background: var(--panel-soft);
}

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

.small {
  font-size: 12px;
}

@media (max-width: 1040px) {
  .today-layout,
  .history-layout,
  .fundamental-shell,
  .records-layout {
    grid-template-columns: 1fr;
  }

  .report-outline {
    position: static;
    order: 2;
  }

  .today-layout .report-reader {
    order: 1;
  }

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

  .record-body,
  .report-reader.compact {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    padding: 12px 14px 10px;
  }

  .brand-title {
    font-size: 17px;
  }

  .brand-subtitle,
  .crawler-box {
    display: none;
  }

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

  .nav-item {
    min-width: 0;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 4px;
    text-align: center;
    font-size: 13px;
    white-space: nowrap;
  }

  .main {
    margin-left: 0;
  }

  .page-head {
    position: static;
    padding: 14px 14px 12px;
    align-items: flex-start;
  }

  h1 {
    font-size: 21px;
  }

  .page-head p {
    font-size: 12px;
  }

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

  .metric {
    min-height: 62px;
    padding: 10px 12px;
  }

  .metric strong {
    font-size: 14px;
  }

  .view {
    padding: 16px 12px 24px;
  }

  .section-head {
    display: grid;
    gap: 8px;
  }

  .pill {
    max-width: 100%;
  }

  .report-reader,
  .asset-detail,
  .asset-panel,
  .record-card {
    padding: 12px;
  }

  .mobile-detail-slot {
    display: block;
    margin-top: 10px;
  }

  .mobile-detail-slot:empty {
    display: none;
  }

  .asset-detail.mobile-inline-detail {
    margin-top: 10px;
    box-shadow: none;
  }

  .markdown-body {
    font-size: 14px;
    line-height: 1.68;
    word-break: break-all;
  }

  .markdown-body h1 {
    font-size: 19px;
  }

  .markdown-body h2 {
    font-size: 16px;
  }

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

  .fundamental-shell,
  .asset-panel,
  .mobile-detail-slot {
    min-width: 0;
    max-width: 100%;
  }

  .asset-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 148px;
    grid-template-columns: none;
    grid-template-rows: repeat(2, minmax(66px, auto));
    gap: 8px;
    margin-top: 8px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .asset-button {
    width: 100%;
    min-height: 66px;
    scroll-snap-align: start;
  }

  .asset-button strong,
  .asset-button span {
    overflow-wrap: anywhere;
  }

  .history-item {
    padding: 10px;
  }
}

@media (max-width: 430px) {
  .nav {
    gap: 4px;
    padding-inline: 8px;
  }

  .nav-item {
    font-size: 12px;
  }

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

  .head-actions {
    align-self: flex-start;
  }
}
