:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1f2623;
  --muted: #66706b;
  --line: #dfe5dd;
  --green: #207a5a;
  --teal: #155e63;
  --gold: #b7791f;
  --red: #b94343;
  --shadow: 0 18px 50px rgba(25, 34, 30, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #fbfcf8;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.brand small,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list a {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav-list a:hover {
  background: #edf4ee;
}

.status-panel {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.content {
  padding: 28px 36px 64px;
  max-width: 1380px;
  width: 100%;
}

.topbar,
.section-heading,
.top-actions,
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 34px;
  margin-bottom: 0;
}

h2 {
  font-size: 22px;
  margin-bottom: 0;
}

.section-band {
  margin-top: 22px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lead {
  margin: 18px 0;
  font-size: 18px;
  line-height: 1.7;
}

.metric-grid,
.sentiment-grid,
.basket-list,
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.metric,
.sentiment-card,
.basket-card,
.news-item,
.layer-card,
.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.span-card {
  grid-column: 1 / -1;
}

.muted-cell {
  color: var(--muted);
  font-size: 13px;
}

.market-board {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.up {
  color: var(--red);
  font-weight: 800;
}

.down {
  color: var(--green);
  font-weight: 800;
}

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

.metric strong {
  display: block;
  font-size: 15px;
  margin-bottom: 10px;
}

.score {
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
}

.donkey-stance {
  margin: 20px 0 0;
  padding: 18px;
  border-left: 5px solid var(--green);
  background: #edf7ef;
  line-height: 1.7;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal);
  background: #eef8f7;
  font-size: 13px;
}

.bar-list {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 52px;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e5e9e4;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: #f2f5f0;
  color: var(--muted);
  font-size: 13px;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tag {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf6;
}

.news-list {
  display: grid;
  gap: 14px;
}

.news-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 74px;
  gap: 12px;
  align-items: start;
}

.news-index {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #edf4ee;
  color: var(--green);
  font-weight: 800;
}

.news-controls {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 110px 150px 1fr 120px;
  gap: 12px;
  align-items: end;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

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

.span-2 {
  grid-column: span 2;
}

.layer-feedback {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.final-form,
.dialogue-panel {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
}

.primary-btn {
  background: var(--green);
  color: white;
}

.secondary-btn {
  background: #e9efe9;
  color: var(--ink);
}

.ghost-btn {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 420px;
}

dialog pre {
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.8;
}

.saved-feedback {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .content {
    padding: 20px;
  }

  .topbar,
  .section-heading,
  .form-row {
    align-items: stretch;
    flex-direction: column;
  }

  .news-controls,
  .form-grid,
  .market-board {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}
