:root {
  color-scheme: light;
  --bg: #f6f5f0;
  --panel: #ffffff;
  --ink: #141414;
  --muted: #69675f;
  --line: #dedbd2;
  --green: #177245;
  --red: #bb342f;
  --amber: #9a6700;
  --blue: #2456a6;
  --shadow: 0 18px 46px rgba(32, 30, 25, 0.1);
}

* {
  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", sans-serif;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #b9b5aa;
}

.primary {
  border-color: #1e6d4a;
  background: #1e6d4a;
  color: #fff;
}

.danger {
  border-color: #a2322d;
  background: #a2322d;
  color: #fff;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.archive-note {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  text-decoration: none;
  font-weight: 800;
}

.shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #d6c48d;
  border-radius: 999px;
  background: #fff8dc;
  color: #694900;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stats div,
.panel,
.workspace {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats div {
  padding: 14px;
}

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

.stats strong {
  font-size: 22px;
}

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

.panel,
.workspace {
  min-height: 650px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfaf7;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.check input {
  width: 18px;
  height: 18px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.tab.active {
  border-color: #234b7c;
  background: #234b7c;
  color: #fff;
}

.feed {
  display: none;
  padding: 12px;
  max-height: 628px;
  overflow: auto;
}

.feed.active {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

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

.pair {
  font-size: 18px;
  font-weight: 800;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.buy,
.pill.pass {
  background: #e5f5ec;
  color: var(--green);
}

.pill.skip,
.pill.fail {
  background: #fae8e6;
  color: var(--red);
}

.pill.neutral {
  background: #eef2f8;
  color: #234b7c;
}

.pill.risk-low {
  background: #e5f5ec;
  color: var(--green);
}

.pill.risk-watch {
  background: #eef2f8;
  color: #234b7c;
}

.pill.risk-medium {
  background: #fff1cc;
  color: var(--amber);
}

.pill.risk-high {
  background: #fae8e6;
  color: var(--red);
}

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

.verdict {
  display: grid;
  gap: 3px;
  border-left: 4px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  margin: 10px 0;
  background: #fbfaf7;
}

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

.verdict span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.verdict.low {
  border-left-color: var(--green);
  background: #f1faf5;
}

.verdict.watch {
  border-left-color: var(--blue);
  background: #f2f6fc;
}

.verdict.medium {
  border-left-color: var(--amber);
  background: #fff8e8;
}

.verdict.high {
  border-left-color: var(--red);
  background: #fff1ef;
}

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

.metrics.compact {
  margin-bottom: 10px;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #fbfaf7;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metrics strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.report {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfaf7;
}

.pnl-report {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.report div {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 9px;
}

.report span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.report strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.pnl-positive {
  color: var(--green);
}

.pnl-negative {
  color: var(--red);
}

.pnl-flat {
  color: var(--ink);
}

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

.pnl-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.pnl-table th,
.pnl-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
  white-space: nowrap;
}

.pnl-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbfaf7;
  color: var(--muted);
  font-weight: 800;
}

.pnl-table td strong,
.pnl-table td span {
  display: block;
}

.pnl-table td span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.pnl-table tr:last-child td {
  border-bottom: 0;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.empty {
  min-height: 170px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.list-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f7f2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
}

@media (max-width: 920px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding: 14px 0;
  }

  .topbar,
  .layout {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .panel,
  .workspace {
    min-height: auto;
  }

  .field-grid,
  .metrics,
  .report {
    grid-template-columns: 1fr 1fr;
  }
}
