:root {
  --bg: #f5f6f1;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #6d756f;
  --line: #dfe3dc;
  --accent: #126b55;
  --accent-2: #9f3d35;
  --gold: #b98b2c;
  --shadow: 0 18px 44px rgba(25, 34, 29, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid #174d41;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: 0 16px;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

button:hover {
  background: #0f5b49;
  transform: translateY(-1px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 52px) 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

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

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

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

.status {
  min-width: 168px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 10px 14px;
  text-align: center;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 92px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.task-card,
.stock-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  padding: 22px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

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

.panel {
  padding: 24px;
  margin-bottom: 16px;
}

.row-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.row-panel h2 {
  margin-bottom: 0;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.home-entry-panel {
  max-width: 520px;
  margin: 0 auto 16px;
}

.home-entry-panel h2 {
  font-size: 32px;
  margin-bottom: 20px;
}

.home-entry-panel .quick-actions button {
  min-height: 72px;
  justify-content: flex-start;
  border-color: #f1d7da;
  background: #fff;
  color: var(--ink);
  font-size: 19px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.home-entry-panel .quick-actions button:first-child {
  border-color: transparent;
  background: linear-gradient(135deg, #ff1b2b, #ed0718);
  color: #fff;
}

.form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px 132px;
  align-items: end;
  gap: 14px;
}

.form.compact {
  grid-template-columns: minmax(220px, 320px) 150px;
}

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fcfcfa;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

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

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 107, 85, 0.12);
}

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

.task-card,
.stock-card {
  padding: 18px;
}

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.task-id {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #eef6f3;
  color: var(--accent);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.badge.review {
  background: #fbf2e5;
  color: var(--gold);
}

.badge.danger {
  background: #fbebe9;
  color: var(--accent-2);
}

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

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

.kv {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fcfcfa;
}

.kv span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.kv small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.stock-card .risk-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.stock-card .risk-list span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffafa;
  color: var(--muted);
  padding: 10px 12px;
}

.model-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.model-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fcfcfa;
  padding: 14px;
}

.model-card p {
  margin-bottom: 12px;
  color: var(--muted);
}

pre {
  overflow: auto;
  max-height: 360px;
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #141917;
  color: #eef8f3;
  padding: 14px;
  white-space: pre-wrap;
}

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

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 160px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.link-button {
  border-color: var(--line);
  background: #fff;
  color: var(--accent);
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs,
  .summary-grid,
  .quick-actions,
  .form,
  .form.compact,
  .result-grid,
  .history-item {
    grid-template-columns: 1fr;
  }

  .status {
    width: 100%;
  }
}
