:root {
  --bg: #f4efe6;
  --panel: #fbf8f2;
  --panel-strong: #fffdf9;
  --ink: #172033;
  --muted: #5d687b;
  --line: #d7cfbf;
  --accent: #1d5c63;
  --accent-2: #b86432;
  --accent-soft: #dcebed;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.08);
  --radius: 18px;
  --mono: "Consolas", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(29, 92, 99, 0.12), transparent 26%),
    linear-gradient(180deg, #f1eadf 0%, #f8f4ec 100%);
  color: var(--ink);
}

.mobile-topbar,
.sidebar-backdrop,
.sidebar-close-btn {
  display: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: var(--ink);
}

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

.sidebar {
  padding: 28px 22px;
  border-right: 1px solid rgba(93, 104, 123, 0.12);
  background: rgba(255, 253, 249, 0.76);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #153d4f);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 22px;
}

.brand h1,
.page-header h2 {
  margin: 0;
  font-weight: 700;
}

.brand p,
.page-header p,
.sidebar-meta p {
  margin: 4px 0 0;
  color: var(--muted);
}

.brand-copyright {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.nav {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.sidebar-section {
  margin-bottom: 22px;
}

.sidebar-section h3,
.helper-title {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-links {
  display: grid;
  gap: 10px;
}

.nav-btn,
.secondary-btn,
.primary-btn,
.ghost-btn,
.sidebar-link-btn,
.date-chip,
.futures-link {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: 150ms ease;
}

.nav-btn,
.sidebar-link-btn {
  text-align: left;
}

.nav-btn:hover,
.sidebar-link-btn:hover,
.secondary-btn:hover,
.primary-btn:hover,
.ghost-btn:hover,
.date-chip:hover,
.futures-link:hover,
.stock-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(29, 92, 99, 0.12), rgba(184, 100, 50, 0.09));
  border-color: rgba(29, 92, 99, 0.4);
}

.filters {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

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

.filters input[type="search"],
.filters input[type="date"],
.filters select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: 12px;
  padding: 12px 14px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 2px;
}

.checkbox-row label {
  margin: 0;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
}

.helper-block {
  margin-top: 8px;
}

.calendar-controls select,
.compare-controls select {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: 12px;
  padding: 10px 12px;
}

.recent-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.date-chip {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--panel);
}

.date-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-status {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.sidebar-meta {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(93, 104, 123, 0.14);
  font-size: 13px;
}

.sidebar-footer,
.page-footer {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid rgba(93, 104, 123, 0.14);
}

.page-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(93, 104, 123, 0.12);
  text-align: right;
}

.main-content {
  padding: 28px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card,
.panel,
.viewer {
  background: rgba(255, 253, 249, 0.9);
  border: 1px solid rgba(93, 104, 123, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

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

.card h3,
.panel h3 {
  margin: 0;
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.updated-at {
  font-size: 12px;
  color: var(--muted);
}

.item-tags,
.card-actions,
.list-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #efe8da;
  color: #111111;
}

.history-tag {
  background: #ddecec;
  color: var(--accent);
}

.date-tag {
  background: #f3e5d6;
  color: var(--accent-2);
}

.table-tag {
  background: #e8eef7;
  color: #284f86;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.ghost-btn {
  background: transparent;
}

.split-layout {
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  gap: 16px;
}

.panel {
  padding: 16px;
}

.futures-hub {
  margin-bottom: 16px;
}

.stock-dashboard,
.stock-hub {
  margin-bottom: 16px;
}

.futures-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.stock-hub-grid,
.stock-hero,
.market-grid,
.stock-doc-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.futures-link {
  background: #f6f0e6;
  color: #111111;
  text-align: left;
}

.stock-link {
  border: 1px solid var(--line);
  background: #eef4ef;
  color: #111111;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.stock-link.active {
  border-color: rgba(29, 92, 99, 0.45);
  background: linear-gradient(135deg, rgba(29, 92, 99, 0.12), rgba(184, 100, 50, 0.08));
}

.stock-link strong {
  display: block;
  margin-bottom: 6px;
}

.stock-link span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.market-card,
.stock-doc-card {
  border: 1px solid rgba(93, 104, 123, 0.12);
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
}

.market-card h4,
.stock-doc-card h4 {
  margin: 0 0 8px;
}

.ashare-review {
  margin-bottom: 16px;
}

.ashare-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 12px;
  margin-top: 12px;
}

.theme-ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.theme-rank-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(93, 104, 123, 0.12);
  background: #fffdf9;
}

.theme-rank-item strong,
.theme-rank-item span {
  display: block;
}

.theme-rank-item span {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.theme-rank-score {
  min-width: 52px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: #efe8da;
  color: #111111;
  font-weight: 700;
}

.theme-board-stack {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.theme-board {
  border: 1px solid rgba(93, 104, 123, 0.12);
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
}

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

.theme-board-head h3 {
  margin: 6px 0 0;
}

.theme-board-meta {
  display: grid;
  gap: 6px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

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

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

.role-card {
  border: 1px solid rgba(93, 104, 123, 0.12);
  border-radius: 14px;
  padding: 14px;
  background: #fffdf9;
}

.role-card.leader {
  background: linear-gradient(180deg, rgba(220, 235, 237, 0.72), rgba(255, 253, 249, 0.95));
}

.role-card.middle {
  background: linear-gradient(180deg, rgba(243, 229, 214, 0.75), rgba(255, 253, 249, 0.95));
}

.role-card.follower {
  background: linear-gradient(180deg, rgba(238, 244, 239, 0.82), rgba(255, 253, 249, 0.95));
}

.role-badge,
.section-label {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #efe8da;
  color: #111111;
  font-size: 12px;
}

.role-card h4 {
  margin: 10px 0 6px;
}

.role-code {
  margin: 0 0 8px;
  font-family: var(--mono);
  color: var(--accent-2);
  font-size: 13px;
}

.follower-section {
  margin-top: 14px;
}

.follower-section .section-label {
  margin-bottom: 10px;
}

.market-watchlist {
  margin: 14px 0 0;
  padding-left: 18px;
  line-height: 1.7;
  color: #243044;
}

.market-watchlist li {
  margin-bottom: 6px;
}

.market-watchlist span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.futures-link strong {
  display: block;
  margin-bottom: 6px;
  color: #111111;
}

.futures-link span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.list-stack {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 4px;
}

.compact-list {
  max-height: none;
}

.list-item {
  padding: 14px;
  border: 1px solid rgba(93, 104, 123, 0.12);
  border-radius: 14px;
  background: var(--panel);
  cursor: pointer;
}

.list-item.active {
  border-color: rgba(29, 92, 99, 0.45);
  background: linear-gradient(135deg, rgba(29, 92, 99, 0.08), rgba(184, 100, 50, 0.06));
}

.list-item h4 {
  margin: 8px 0 6px;
}

.viewer {
  padding: 22px;
  min-height: 640px;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(93, 104, 123, 0.12);
}

.viewer-body {
  line-height: 1.72;
}

.viewer-body h1,
.viewer-body h2,
.viewer-body h3,
.viewer-body h4 {
  margin-top: 24px;
  margin-bottom: 10px;
}

.viewer-body p,
.viewer-body li {
  color: #243044;
}

.viewer-body code {
  font-family: var(--mono);
  font-size: 0.94em;
  background: #efe8da;
  color: #111111;
  padding: 2px 6px;
  border-radius: 6px;
}

.viewer-body pre {
  background: #f3ede2;
  color: #111111;
  padding: 16px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(93, 104, 123, 0.16);
}

.viewer-body pre code {
  color: #111111;
  background: transparent;
  padding: 0;
}

.viewer-body ul,
.viewer-body ol {
  padding-left: 24px;
}

.table-wrap,
.data-table-wrap {
  overflow: auto;
}

.table-summary {
  margin-bottom: 16px;
  display: grid;
  gap: 10px;
}

.calendar-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-weekday {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 0;
}

.calendar-day {
  min-height: 62px;
  padding: 8px;
  border: 1px solid rgba(93, 104, 123, 0.16);
  border-radius: 12px;
  background: var(--panel);
  display: grid;
  align-content: space-between;
  justify-items: start;
  text-align: left;
}

.calendar-day strong {
  font-size: 15px;
}

.calendar-day.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(29, 92, 99, 0.1), rgba(184, 100, 50, 0.08));
}

.calendar-day.muted {
  opacity: 0.45;
  cursor: not-allowed;
}

.calendar-day.empty {
  background: transparent;
  border: 0;
}

.calendar-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ddecec;
  color: var(--accent);
}

.compare-panel,
.timeline-panel,
.calendar-panel,
.live-briefs-panel {
  margin-bottom: 16px;
}

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

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

.brief-source-panel {
  border: 1px solid rgba(93, 104, 123, 0.12);
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
}

.brief-source-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.brief-source-head h4 {
  margin: 0;
}

.brief-source-head span,
.brief-note {
  color: var(--muted);
  font-size: 12px;
}

.live-briefs-list {
  display: grid;
  gap: 12px;
}

.brief-item {
  border: 1px solid rgba(93, 104, 123, 0.12);
  background: #fffdf9;
  border-radius: 14px;
  padding: 14px;
}

.brief-meta,
.brief-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.brief-item h5 {
  margin: 10px 0 8px;
  font-size: 15px;
}

.brief-item p {
  margin: 0;
  color: #243044;
  line-height: 1.7;
}

.brief-cn-title,
.brief-cn-summary {
  margin-top: 8px;
  color: #243044;
}

.brief-en-title,
.brief-en-summary {
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.brief-footer {
  margin-top: 10px;
}

.brief-link {
  color: var(--accent);
  font-size: 13px;
}

.live-briefs-error {
  margin: 10px 0 0;
}

.compare-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

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

.compare-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.compare-card {
  border: 1px solid rgba(93, 104, 123, 0.12);
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
}

.compare-card h4 {
  margin: 0 0 8px;
}

.compare-date {
  margin: 0 0 12px;
  font-family: var(--mono);
  color: var(--accent-2);
}

.compare-list {
  margin: 0;
  padding-left: 18px;
  color: #243044;
  line-height: 1.7;
}

.score-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #efe8da;
  color: #111111;
  font-size: 13px;
}

.score-chip strong {
  color: var(--accent-2);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(93, 104, 123, 0.12);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: #efe6d9;
  position: sticky;
  top: 0;
}

tbody tr.score-high {
  background: rgba(207, 232, 181, 0.42);
}

tbody tr.score-mid {
  background: rgba(255, 239, 196, 0.45);
}

tbody tr.score-low {
  background: rgba(248, 228, 228, 0.45);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.9);
  border: 1px solid rgba(93, 104, 123, 0.12);
  cursor: pointer;
}

.timeline-date {
  font-family: var(--mono);
  color: var(--accent-2);
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1260px) {
  .grid-cards,
  .split-layout,
  .futures-hub-grid,
  .compare-grid,
  .live-briefs-grid,
  .stock-hub-grid,
  .stock-hero,
  .market-grid,
  .stock-doc-strip,
  .ashare-grid,
  .role-grid,
  .follower-grid {
    grid-template-columns: 1fr;
  }

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(93, 104, 123, 0.12);
  }

  .list-stack {
    max-height: none;
  }
}

@media (max-width: 900px) {
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 253, 249, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(93, 104, 123, 0.12);
  }

  .mobile-topbar-title {
    font-weight: 700;
    color: var(--ink);
  }

  .mobile-icon-btn {
    padding: 10px 12px;
    min-width: 72px;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(23, 32, 51, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
    z-index: 34;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 340px);
    max-width: 340px;
    height: 100vh;
    overflow: auto;
    z-index: 35;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    border-right: 1px solid rgba(93, 104, 123, 0.12);
    border-bottom: 0;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: inline-flex;
    margin-left: auto;
    margin-bottom: 14px;
  }

  .main-content {
    padding-top: 18px;
  }
}

@media (max-width: 720px) {
  .main-content,
  .sidebar {
    padding: 18px;
  }

  .page-header,
  .viewer-header,
  .brief-source-head,
  .theme-board-head,
  .timeline-item {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .viewer,
  .panel,
  .card {
    border-radius: 16px;
  }

  th,
  td {
    padding: 8px 10px;
    font-size: 13px;
  }
}
