/* Kaggriculture dashboard.
   A market-terminal palette: cool slate ground, a single signal green for our
   own farm, amber for the field. Numbers are the content, so everything is
   tabular-lined and the type scale stays out of the way. */

:root {
  --ground: #f4f6f5;
  --panel: #ffffff;
  --edge: #d8ded9;
  --ink: #16201b;
  --ink-dim: #5c6a62;
  --ink-faint: #8b978f;
  --ours: #1f7a4d;
  --ours-soft: #e3f2e9;
  --field: #b4761a;
  --warn: #a63d2f;
  --grid: #e7ebe8;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0f1512;
    --panel: #161d19;
    --edge: #26302a;
    --ink: #e6ede9;
    --ink-dim: #9aa8a0;
    --ink-faint: #6b7776;
    --ours: #4ade80;
    --ours-soft: #12291d;
    --field: #e0a44a;
    --warn: #e0715f;
    --grid: #202a24;
  }
}

:root[data-theme="dark"] {
  --ground: #0f1512;
  --panel: #161d19;
  --edge: #26302a;
  --ink: #e6ede9;
  --ink-dim: #9aa8a0;
  --ink-faint: #6b7776;
  --ours: #4ade80;
  --ours-soft: #12291d;
  --field: #e0a44a;
  --warn: #e0715f;
  --grid: #202a24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 20px 72px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 20px;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 620;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.sub { color: var(--ink-dim); font-size: 0.86rem; }

nav.tabs { display: flex; gap: 4px; }
nav.tabs a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.86rem;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
}
nav.tabs a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--edge);
  background: var(--panel);
}
nav.tabs a:hover { color: var(--ink); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card.ours { border-color: var(--ours); background: var(--ours-soft); }
.card .label {
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.card .value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.card .note { font-size: 0.78rem; color: var(--ink-dim); }

section.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

section.panel > h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
section.panel > h2 small { font-weight: 400; color: var(--ink-faint); font-size: 0.78rem; }

.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
thead th {
  text-align: left;
  font-weight: 560;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}
tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
tbody tr.ours td { background: var(--ours-soft); font-weight: 600; }
tbody tr.ours td:first-child { box-shadow: inset 3px 0 0 var(--ours); }

.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--edge); stroke-width: 1; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart text { fill: var(--ink-faint); font-family: var(--mono); font-size: 10px; }
.chart .line-ours { fill: none; stroke: var(--ours); stroke-width: 2.5; stroke-linejoin: round; }
.chart .line-field { fill: none; stroke: var(--field); stroke-width: 1.25; opacity: 0.5; }
.chart .dot-ours { fill: var(--ours); }

.legend { display: flex; gap: 16px; font-size: 0.78rem; color: var(--ink-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.empty { color: var(--ink-faint); font-size: 0.86rem; padding: 10px 0; }
.err {
  color: var(--warn);
  font-size: 0.86rem;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--panel);
}

button.btn {
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
}
button.btn:hover { border-color: var(--ours); color: var(--ours); }
button.btn:focus-visible { outline: 2px solid var(--ours); outline-offset: 2px; }

footer.foot {
  color: var(--ink-faint);
  font-size: 0.76rem;
  border-top: 1px solid var(--edge);
  padding-top: 14px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
