/* ClimateProof — eco design system */
:root {
  --bg: #F5F7F4;
  --card: #FFFFFF;
  --ink: #1A2B22;
  --muted: #5E7168;
  --line: #E1E7DF;
  --brand: #1B7A4E;
  --brand-strong: #0F5C39;
  --brand-soft: #E4F2EA;
  --accent: #1B7A4E;
  --danger: #C22F2F;
  --danger-soft: #FBECEC;
  --warn: #B45309;
  --warn-soft: #FDF3E3;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(26,43,34,.05), 0 10px 28px -14px rgba(26,43,34,.22);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55; font-size: 16.5px; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.015em; }
h1 { font-size: 2.1rem; } h3 { font-size: 1.12rem; }
p { margin: .4rem 0; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.grad { background: linear-gradient(100deg, var(--brand), #2E7D5B); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1.1rem;
  padding: .6rem clamp(1rem, 4vw, 2.4rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-size: 1.15rem; color: var(--ink); text-decoration: none; font-weight: 400; }
.brand b { font-weight: 800; }
.logo { font-size: 1.3rem; }
.nav { display: flex; gap: .2rem; flex: 1; }
.nav a { padding: .42rem .8rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .93rem; cursor: pointer; }
.nav a:hover { color: var(--ink); background: var(--brand-soft); }
.nav a.active { color: var(--brand-strong); background: var(--brand-soft); }
.pill { font-size: .78rem; font-weight: 700; color: var(--brand-strong); background: var(--brand-soft); border-radius: 999px; padding: .3rem .7rem; white-space: nowrap; }

/* Buttons / inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 0; border-radius: 12px; padding: .6rem 1.15rem; font-weight: 700; font-size: .95rem;
  cursor: pointer; font-family: inherit; color: var(--ink); background: var(--line);
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(27,122,78,.6); }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.big { padding: .8rem 1.5rem; font-size: 1.02rem; border-radius: 14px; }
.btn.tiny { padding: .22rem .55rem; font-size: .78rem; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.sel, .inp {
  border: 1.5px solid var(--line); border-radius: 11px; padding: .55rem .7rem; font-family: inherit;
  font-size: .95rem; color: var(--ink); background: var(--card); min-width: 0;
}
.sel:focus, .inp:focus { outline: 2px solid var(--brand); border-color: var(--brand); }

/* Layout */
main { max-width: 1080px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem; }
.page { display: none; }
.page.active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pagehead { margin: .6rem 0 1.2rem; max-width: 46rem; }
.pagehead p { color: var(--muted); font-size: 1.02rem; }

/* Hero + stats */
.hero { padding: 1.6rem 0 .8rem; }
.hero-badge { display: inline-block; background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: .86rem; padding: .32rem .8rem; border-radius: 999px; margin-bottom: .9rem; }
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); max-width: 24ch; }
.hero-sub { font-size: 1.08rem; color: var(--muted); max-width: 44rem; }
.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin: 1.4rem 0; }
.statcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.05rem; box-shadow: var(--shadow); }
.stat-num { font-size: 1.7rem; font-weight: 800; color: var(--brand-strong); }
.stat-label { color: var(--muted); font-size: .84rem; font-weight: 600; }

/* Chart cards */
.chartcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin: 1.2rem 0; }
.bigchart { width: 100%; height: 340px; }
.losschart { width: 100%; height: 180px; }

/* Live feed + ledger mini */
.livegrid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; margin: 1.2rem 0; }
@media (max-width: 860px) { .livegrid { grid-template-columns: 1fr; } }
.livefeed, .ledgermini { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; box-shadow: var(--shadow); }
.livehead { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.feedrow { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: 11px; margin-top: .45rem; background: var(--bg); border: 1px solid var(--line); }
.feedrow.flagged { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.feed-icon { font-size: 1.05rem; }
.feed-body { flex: 1; min-width: 0; }
.feed-title { font-weight: 700; font-size: .92rem; }
.feed-id { color: var(--muted); font-weight: 600; font-size: .8rem; }
.feed-sub { color: var(--muted); font-size: .8rem; }
.feed-sig { font-family: Consolas, monospace; font-size: .74rem; color: var(--muted); }
.minirow { display: flex; justify-content: space-between; gap: .8rem; padding: .42rem 0; border-bottom: 1px dashed var(--line); font-size: .92rem; color: var(--muted); }
.minirow b { color: var(--ink); }
.hash { font-family: Consolas, monospace; font-size: .8rem; }
.ledgermini .btn { width: 100%; margin-top: .9rem; }

/* Ledger blocks */
.trainrow { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1rem 0 1.2rem; }
.blockcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: .9rem; }
.block-head { display: flex; align-items: baseline; gap: .8rem; justify-content: space-between; }
.block-h { font-weight: 800; font-size: 1.02rem; color: var(--brand-strong); }
.block-meta { color: var(--muted); font-size: .84rem; }
.block-hash { font-family: Consolas, monospace; font-size: .78rem; color: var(--muted); margin: .25rem 0; }
.block-hash b { color: var(--ink); font-weight: 600; }
.block-entries { margin-top: .6rem; display: grid; gap: .35rem; }
.entryrow { display: flex; align-items: center; gap: .7rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .42rem .65rem; font-size: .88rem; }
.entry-idx { color: var(--muted); font-family: Consolas, monospace; }
.entry-name { flex: 1; font-weight: 600; }
.entry-val { font-family: Consolas, monospace; }
.entry-sig { font-family: Consolas, monospace; color: var(--muted); font-size: .76rem; }

/* Feedback */
.feedback { display: none; }
.feedback.show { display: block; animation: fadein .2s ease; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.1rem; }
.feedback.good { border-left: 5px solid var(--brand); }
.feedback.bad { border-left: 5px solid var(--danger); }
.fb-title { font-weight: 800; font-size: 1.05rem; margin-bottom: .3rem; }
.feedback p { color: var(--muted); }

/* Tamper lab */
.tamperrow { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.scanbox { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.tamperrow .inp { width: 150px; }
.flagcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; margin-top: .6rem; }
.flagcard { display: flex; gap: .75rem; background: var(--bg); border: 1px solid var(--line); border-radius: 13px; padding: .9rem; }
.flag-icon { font-size: 1.4rem; }
.flagcard h4 { margin-bottom: .15rem; }
.flagcard p { color: var(--muted); font-size: .9rem; margin: 0; }
.explainbox { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin: 1.1rem 0; }

/* AI lab */
.datasetcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.3rem; box-shadow: var(--shadow); }
.metricgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin: 1.1rem 0; }
.metriccard { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: .85rem .95rem; text-align: center; box-shadow: var(--shadow); }
.metric-num { font-size: 1.5rem; font-weight: 800; color: var(--brand-strong); }
.metric-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.labcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.3rem; box-shadow: var(--shadow); margin: 1.1rem 0; }

/* Loading / footer */
.loadingbox { text-align: center; color: var(--muted); font-weight: 600; padding: 2rem; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
footer { border-top: 1px solid var(--line); padding: 1.5rem clamp(1rem, 4vw, 2.4rem); color: var(--muted); font-size: .88rem; }
.footwrap { max-width: 1080px; margin: 0 auto; }

@media (max-width: 720px) {
  .pill { display: none; }
  .nav { overflow-x: auto; }
  .tamperrow .btn { width: 100%; }
}
