:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-strong: #f9fbf7;
  --ink: #17201c;
  --muted: #68746d;
  --line: #d9e1d8;
  --green: #1f6a4f;
  --green-dark: #173f35;
  --blue: #236b8e;
  --amber: #d6962c;
  --red: #b44c43;
  --shadow: 0 16px 45px rgba(31, 54, 42, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  padding: 22px;
  overflow: auto;
  color: #edf7f1;
  background: #132f2b;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: #f0b54b;
  color: #14251f;
  font-weight: 850;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-heading h3,
.section-heading p,
.match-card h4 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin-top: 3px;
  color: #b9ccc4;
  font-size: 13px;
}

.pitch-asset {
  display: block;
  width: 100%;
  aspect-ratio: 640 / 260;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  color: var(--green);
  font-size: 13px;
  font-weight: 760;
}

.topbar h2 {
  max-width: 760px;
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-btn,
.secondary-btn,
.icon-text-btn,
.odds-btn,
.tag-btn {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.primary-btn {
  padding: 0 16px;
  background: var(--green);
  color: white;
  font-weight: 760;
}

.secondary-btn {
  padding: 0 14px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 720;
}

.icon-text-btn {
  min-height: 32px;
  padding: 0 10px;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 13px;
}

.icon-text-btn.danger {
  color: #ffe1df;
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-text-btn:hover,
.odds-btn:hover,
.tag-btn:hover {
  transform: translateY(-1px);
}

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

.sidebar .panel {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}

.panel {
  padding: 16px;
}

.panel.compact {
  padding: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 780;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.sidebar .field {
  color: #c8d8d1;
}

.field input,
.field select,
.reason-box textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

.sidebar .field input,
.sidebar .field select {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.95);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d8e6df;
  font-size: 13px;
}

.microcopy {
  margin: -2px 0 12px;
  color: #c3d5cd;
  font-size: 12px;
  line-height: 1.55;
}

.file-input {
  width: 100%;
  margin-bottom: 10px;
  color: #dcebe4;
  font-size: 12px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 82px;
  padding: 14px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  line-height: 1;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.section-heading h3 {
  font-size: 20px;
}

.section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

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

.match-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 390px;
  padding: 16px;
  box-shadow: none;
}

.match-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.match-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.match-card h4 {
  font-size: 18px;
  line-height: 1.25;
}

.result-pill {
  align-self: flex-start;
  min-width: 74px;
  border-radius: 999px;
  padding: 6px 9px;
  background: #eef3ec;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 780;
}

.result-pill.live {
  background: #fff4d8;
  color: #8a5a09;
}

.result-pill.win {
  background: #dff2e8;
  color: #16603f;
}

.result-pill.loss {
  background: #f8e1df;
  color: #9b352c;
}

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

.odds-btn {
  display: grid;
  gap: 4px;
  min-height: 68px;
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 8px;
  text-align: left;
}

.odds-btn b {
  font-size: 14px;
}

.odds-btn span {
  color: var(--muted);
  font-size: 12px;
}

.odds-btn.selected {
  border-color: var(--green);
  background: #e6f1ea;
}

.odds-btn.hit {
  border-color: #48a16f;
}

.odds-btn.miss {
  border-color: #d99a95;
}

.match-details {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.match-details strong {
  color: var(--ink);
  font-weight: 740;
}

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

.decision-grid .field {
  margin-bottom: 0;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--green);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-btn {
  min-height: 30px;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
}

.tag-btn.selected {
  border-color: #c88a24;
  background: #fff4dc;
  color: #7a4c0b;
}

.reason-box {
  display: grid;
  gap: 6px;
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.reason-box textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.45;
}

.ticket-column {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

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

.ticket-list.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
}

.ticket-item {
  display: grid;
  gap: 6px;
  border-left: 3px solid var(--green);
  padding: 9px 0 9px 10px;
}

.ticket-item strong {
  font-size: 14px;
}

.ticket-item span {
  color: var(--muted);
  font-size: 12px;
}

.risk-list,
.review-stats {
  display: grid;
  gap: 9px;
}

.risk-item,
.stat-row,
.postmortem {
  border-radius: 8px;
  background: #f4f7f2;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.risk-item.warn {
  background: #fff4dc;
  color: #77500f;
}

.risk-item.danger {
  background: #f8e1df;
  color: #8e3128;
}

.risk-item.good {
  background: #e5f2ea;
  color: #1d6043;
}

.postmortem {
  display: grid;
  gap: 8px;
  margin-top: -2px;
}

.postmortem select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  border-radius: 8px;
  background: #142b26;
  color: white;
  padding: 12px 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  font-size: 14px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

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

  .ticket-column {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

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

  .workspace {
    padding: 20px;
  }

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

@media (max-width: 760px) {
  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .metrics-grid,
  .matches-list,
  .ticket-column {
    grid-template-columns: 1fr;
  }

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