:root {
  --ink: #17211b;
  --muted: #657069;
  --paper: #f7f8f4;
  --panel: #ffffff;
  --line: #dce3dc;
  --green: #1f7a4d;
  --blue: #2f6fb1;
  --red: #c9493f;
  --shadow: 0 18px 45px rgba(28, 42, 34, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

button,
select,
input {
  font: inherit;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 56px);
  color: white;
  background: linear-gradient(90deg, rgba(19, 31, 24, 0.96), rgba(31, 122, 77, 0.86));
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
}

.mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.38);
  font-size: 0.85rem;
}

.status {
  font-size: 0.92rem;
  font-weight: 700;
  opacity: 0.92;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topnav a {
  color: white;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  opacity: 0.92;
}

.topnav a:hover {
  opacity: 1;
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 14px 0 30px;
}

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

.intro h1 {
  max-width: 820px;
  margin: 0 0 4px;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.02;
}

.intro p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 1.03rem;
}

.eyebrow {
  color: var(--green) !important;
  font-weight: 850;
  text-transform: uppercase;
  font-size: 0.82rem !important;
  letter-spacing: 0.08em;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.left-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.panel,
.result-panel,
.chart-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.section-title {
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

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

label {
  display: grid;
  gap: 6px;
  color: #28362d;
  font-weight: 750;
  font-size: 0.92rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfa;
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.scope-box {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfa;
}

.scope-box span {
  color: var(--muted);
  font-weight: 760;
  font-size: 0.86rem;
}

.scope-box strong {
  font-size: 1rem;
}

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

select:disabled {
  color: #9aa39d;
  background: #f1f4f1;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: white;
  background: var(--green);
  font-weight: 850;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.94);
}

#retrain-button {
  white-space: nowrap;
  background: var(--blue);
}

#form-message {
  color: var(--muted);
  font-size: 0.92rem;
}

.metric {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  background: #fbfcfa;
}

.metric span {
  color: var(--muted);
  font-weight: 760;
}

.metric strong {
  font-size: 2rem;
}

.metric small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.metric.accent {
  border-color: rgba(31, 122, 77, 0.35);
  background: #eef7f1;
}

.side-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fbfcfa;
}

.mini-title,
.mini-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.mini-title {
  margin-bottom: 8px;
}

.mini-title strong {
  font-size: 0.95rem;
}

.mini-title span,
.mini-date,
.mini-note {
  color: var(--muted);
  font-size: 0.72rem;
}

.mini-list {
  display: grid;
  gap: 7px;
}

.mini-row {
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.mini-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.mini-row span:first-child {
  min-width: 0;
  font-weight: 720;
}

.mini-price {
  font-weight: 850;
  white-space: nowrap;
}

.mini-note {
  margin: -2px 0 8px;
}

.details {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-weight: 760;
}

dd {
  margin: 0;
  text-align: right;
}

.hidden {
  display: none !important;
}

.error {
  color: var(--red) !important;
}

.chart-panel {
  margin-top: 0;
}

.chart-wrap {
  position: relative;
  height: 340px;
}

.monitor-layout {
  display: grid;
  gap: 16px;
}

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

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

.monitor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.monitor-table th,
.monitor-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}

.monitor-table th:first-child,
.monitor-table td:first-child {
  text-align: left;
}

.monitor-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.monitor-table tr.high td {
  color: var(--red);
  font-weight: 850;
}

.monitor-thresholds {
  padding: 18px 22px;
}

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

.threshold-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfa;
}

.threshold-item span {
  color: var(--muted);
  font-weight: 760;
  font-size: 0.88rem;
}

.threshold-item strong {
  color: var(--red);
  font-size: 1rem;
}

@media (max-width: 860px) {
  .intro,
  .workspace {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .monitor-summary,
  .monitor-grid,
  .threshold-list {
    grid-template-columns: 1fr;
  }
}
