:root {
  --olive-950: #283311;
  --olive-900: #344317;
  --olive-800: #46591e;
  --olive-700: #5d7130;
  --olive-600: #748548;
  --sage-300: #cbd2b7;
  --sage-200: #dde2cf;
  --sage-100: #eef0e7;
  --cream: #f8f6ef;
  --brown: #60351e;
  --ink: #283019;
  --muted: #69705e;
  --line: #d9ddcb;
  --white: #fff;
  --shadow: 0 9px 28px rgba(41, 51, 17, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: #dadfce;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}

.dashboard {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(180deg, #f5f3eb 0%, #fbfaf6 58%, #eef0e6 100%);
  display: grid;
  grid-template-rows: 34vh 13vh 29vh 1fr 3.5vh;
  overflow: hidden;
}

.hero {
  position: relative;
  overflow: hidden;
  background-color: #f8f6ef;
  border-bottom: none;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -4px;
  background: url('/assets/springford-hero.jpg') center 48% / cover no-repeat;
  opacity: .16;
  filter: blur(1.5px);
}
.hero-shade {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: url('/assets/springford-hero.jpg') center 50% / auto 108% no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 27%, #000 38%, #000 62%, transparent 73%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, transparent 27%, #000 38%, #000 62%, transparent 73%, transparent 100%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.hero::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(249,248,242,.82) 0%, rgba(249,248,242,.28) 27%, transparent 38%, transparent 64%, rgba(249,248,242,.38) 76%, rgba(249,248,242,.94) 100%),
    linear-gradient(0deg, rgba(249,248,242,.86) 0%, rgba(249,248,242,.24) 30%, transparent 56%);
  pointer-events: none;
}
.hero-brand { position: absolute; z-index: 2; }
.hero-brand--farm {
  left: clamp(28px, 3vw, 58px);
  top: clamp(7px, 1vh, 12px);
  display: block;
}
.hero-brand--farm img {
  display: block;
  width: clamp(220px, 14.5vw, 278px);
  max-height: 23vh;
  object-fit: contain;
  filter: contrast(1.08) drop-shadow(0 4px 8px rgba(52, 40, 20, .12));
}
.hero-copy { margin-top: 12px; padding: 0; }
.hero-copy h1 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: clamp(1rem, 2.35vh, 1.4rem);
  line-height: 1.1;
  color: var(--olive-900);
  white-space: nowrap;
}
.hero-copy h1::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 6px;
  width: 100%;
  background: linear-gradient(90deg,var(--olive-700),transparent);
}
.hero-copy p {
  margin: 6px 0 0;
  font-size: clamp(.82rem, 1.85vh, 1.05rem);
  line-height: 1.2;
  letter-spacing: .035em;
  color: #363b2d;
}
.hero-brand--osprey {
  right: clamp(56px, 7vw, 136px);
  top: 50%;
  transform: translateY(-50%);
}
.hero-brand--osprey img {
  width: clamp(290px, 36vh, 350px);
  max-height: 23vh;
  object-fit: contain;
  filter: brightness(.72) contrast(1.55) saturate(1.55) drop-shadow(0 3px 8px rgba(255,255,255,.98));
}
.system-notice {
  position: absolute;
  z-index: 4;
  right: clamp(28px, 3.2vw, 64px);
  bottom: 12px;
  left: auto;
  transform: none;
  width: auto;
  max-width: min(32vw, 520px);
  max-height: none;
  overflow: hidden;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(102, 63, 17, .92);
  color: white;
  font-size: clamp(.67rem, .72vw, .82rem);
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: var(--shadow);
}

.kpi-strip {
  z-index: 3;
  margin: 0 clamp(18px,2.3vw,46px);
  border-radius: clamp(15px,1.4vw,26px);
  background: linear-gradient(115deg, var(--olive-900), #5c6d2b 58%, #43551d);
  display: grid;
  grid-template-columns: repeat(4,1fr);
  align-items: center;
  color: white;
  box-shadow: 0 12px 28px rgba(43,56,16,.26), inset 0 1px rgba(255,255,255,.2);
}
.kpi { text-align: center; position: relative; padding: .6rem 1rem; line-height: 1; }
.kpi:not(:last-child)::after { content: ""; position: absolute; top: 17%; bottom: 17%; right: 0; width: 1px; background: rgba(255,255,255,.52); }
.kpi-label { display: block; margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .055em; font-size: clamp(.72rem,1.9vh,1.05rem); font-weight: 760; }
.kpi strong { font-size: clamp(2.8rem,6.6vh,4.15rem); letter-spacing: -.045em; text-shadow: 0 5px 10px rgba(0,0,0,.22); }
.kpi-unit { margin-left: .34em; font-size: clamp(1rem,2.8vh,1.8rem); font-weight: 650; }

.site-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(14px,1.4vw,28px);
  padding: clamp(9px,1.15vh,15px) clamp(18px,2.3vw,46px);
}
.site-card {
  min-width: 0;
  display: grid;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(94,111,51,.18);
  border-radius: clamp(15px,1.3vw,24px);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.site-card:first-child { grid-template-columns: 46% 54%; }
.site-card:last-child { grid-template-columns: 40% 60%; }
.site-photo { min-width: 0; overflow: hidden; background: var(--sage-200); }
.site-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
.site-card:first-child .site-photo img { object-position: center center; }
.site-card:last-child .site-photo img { object-position: center 48%; }
.site-details {
  padding: clamp(10px,.75vw,15px) clamp(12px,.9vw,18px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.site-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: .2rem; }
.site-heading h2 { margin: 0; font-size: clamp(1.4rem,3.25vh,2rem); line-height: 1.08; letter-spacing: -.025em; color: var(--olive-900); }
.status-badge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .58rem; border: 1.5px solid #4b8a25; color: #337515; border-radius: 9px; text-transform: uppercase; font-weight: 780; font-size: clamp(.62rem,.75vw,.9rem); background: #fbfff8; }
.status-dot { width: .72rem; height: .72rem; border-radius: 50%; background: #55a72d; box-shadow: inset 0 0 0 3px rgba(255,255,255,.9); outline: 2px solid #55a72d; }
.status-badge.offline, .status-badge.error { color: #a04331; border-color: #bc5845; background: #fff8f6; }
.status-badge.offline .status-dot, .status-badge.error .status-dot { background: #bd5947; outline-color: #bd5947; }
.status-badge.stale { color: #86661d; border-color: #b69643; background: #fffced; }
.status-badge.stale .status-dot { background: #c1a048; outline-color: #c1a048; }
.status-badge.warning { color: #86661d; border-color: #b69643; background: #fffced; }
.status-badge.warning .status-dot { background: #c1a048; outline-color: #c1a048; }
.metrics { margin: 0; }
.metrics > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: clamp(.2rem,.4vh,.32rem) 0; border-bottom: 1px solid var(--line); }
.metrics > div:last-child { border-bottom: none; }
.metrics dt { text-transform: uppercase; color: #53613b; font-weight: 760; letter-spacing: .035em; font-size: clamp(.62rem,.7vw,.88rem); }
.metrics dd { margin: 0; font-size: clamp(1rem,2.6vh,1.45rem); font-weight: 790; color: #263016; white-space: nowrap; }
.metrics dd small { font-size: .55em; }
.metric-icon { display: inline-grid; place-items: center; width: clamp(22px,1.4vw,28px); height: clamp(22px,1.4vw,28px); margin-right: clamp(6px,.5vw,10px); border: 1.5px solid #78884b; border-radius: 50%; color: var(--olive-800); font-size: 1em; }

.go-live {
  margin: clamp(.18rem,.35vh,.3rem) 0 0;
  padding-top: clamp(.22rem,.4vh,.34rem);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #586344;
  font-size: clamp(.6rem,.66vw,.8rem);
  line-height: 1.15;
}
.go-live span { text-transform: uppercase; letter-spacing: .045em; font-weight: 760; }
.go-live time { color: var(--olive-900); font-weight: 750; white-space: nowrap; }

.impact { padding: 0 clamp(18px,2.3vw,46px) clamp(10px,1.3vh,18px); }
.impact-title { height: clamp(30px,3.5vh,34px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; color: var(--olive-800); }
.impact-title span { height: 1px; background: linear-gradient(90deg,transparent,var(--olive-600)); }
.impact-title span:last-child { background: linear-gradient(90deg,var(--olive-600),transparent); }
.impact-title h2 { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: clamp(.9rem,2vh,1.28rem); }
.impact-grid { height: calc(100% - clamp(30px,3.5vh,34px)); display: grid; grid-template-columns: repeat(4,1fr); gap: clamp(10px,1vw,20px); align-items: stretch; padding: 3px 0 5px; }
.impact-grid.three { grid-template-columns: repeat(3,1fr); }
.impact-card { position: relative; min-width: 0; display: grid; grid-template-columns: minmax(60px,27%) 1fr; align-items: center; gap: clamp(8px,.8vw,15px); background: rgba(255,255,255,.88); border: 1px solid #d8ddc5; border-radius: 16px; padding: clamp(8px,.65vw,12px); box-shadow: 0 5px 16px rgba(47,60,19,.08); }
.impact-card--economics { background: linear-gradient(145deg,rgba(250,252,245,.98),rgba(238,243,225,.95)); border-color: #bdc99d; grid-template-columns: minmax(54px,23%) 1fr; }
.impact-icon { width: clamp(52px,3.9vw,72px); aspect-ratio: 1; border-radius: 50%; background: linear-gradient(145deg,#f0f4e6,#dce5c7); display: grid; place-items: center; overflow: hidden; color: var(--olive-800); border: 1px solid rgba(108,127,58,.2); }
.impact-icon svg { width: 82%; height: 82%; overflow: visible; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.impact-icon svg text { fill: currentColor; stroke: none; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 13px; font-weight: 850; }
.impact-icon .icon-accent { color: #88a140; stroke: currentColor; }
.impact-icon--trees svg { width: 86%; height: 86%; }
.impact-icon--gas { color: #53652a; background: linear-gradient(145deg,#f0f4e6,#dce5c7); }
.impact-icon--gas svg { width: 82%; height: 82%; }
.impact-icon--gas .icon-accent { color: #8ba348; }
.impact-icon--money svg { width: 84%; height: 84%; }
.impact-icon--money svg text { font-size: 14px; }
.impact-card > div:last-child { min-width: 0; }
.impact-label { display: block; text-transform: uppercase; letter-spacing: .04em; color: #48552f; font-weight: 760; font-size: clamp(.62rem,1.5vh,.9rem); }
.impact-card strong { display: block; margin-top: .18rem; color: var(--olive-900); font-size: clamp(1.65rem,4vh,2.65rem); line-height: 1; white-space: nowrap; letter-spacing: -.035em; }
.impact-card small { display: block; margin-top: .35rem; color: #515848; font-size: clamp(.62rem,1.45vh,.85rem); }
.economics-content { align-self: stretch; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.economics-total { display: flex; align-items: baseline; gap: clamp(6px,.45vw,9px); min-width: 0; }
.economics-total strong { font-size: clamp(1.35rem,3.1vh,2.15rem); }
.economics-total small { margin: 0; text-transform: uppercase; letter-spacing: .05em; font-size: clamp(.5rem,1.08vh,.7rem); font-weight: 730; }
.economics-breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(7px,.6vw,12px); margin: clamp(4px,.55vh,7px) 0 0; padding-top: clamp(4px,.55vh,7px); border-top: 1px solid rgba(116,133,72,.28); }
.economics-breakdown div { min-width: 0; }
.economics-breakdown div + div { padding-left: clamp(7px,.6vw,12px); border-left: 1px solid rgba(116,133,72,.25); }
.economics-breakdown dt { color: #667050; text-transform: uppercase; letter-spacing: .045em; font-size: clamp(.49rem,1.02vh,.66rem); font-weight: 760; line-height: 1; }
.economics-breakdown dd { margin: 2px 0 0; color: var(--olive-900); font-size: clamp(.72rem,1.55vh,1rem); font-weight: 820; line-height: 1.05; white-space: nowrap; }

.footer { background: linear-gradient(90deg,var(--olive-900),#56692a,var(--olive-900)); color: white; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 clamp(20px,3vw,60px); font-size: clamp(.58rem,.72vw,.86rem); }
.footer-item { display: flex; align-items: center; gap: 10px; }
.footer-item--right { justify-content: flex-end; text-align: right; }
.refresh-symbol, .cloud-symbol { color: #d3dda8; font-size: 1.35em; line-height: 1; }
.footer-status { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: #edf0e3; }
.fullscreen-button {
  width: clamp(26px, 1.8vw, 34px);
  height: clamp(26px, 1.8vw, 34px);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.48);
  border-radius: 7px;
  background: rgba(255,255,255,.08);
  color: #edf0e3;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.fullscreen-button:hover { background: rgba(255,255,255,.17); border-color: rgba(255,255,255,.75); }
.fullscreen-button:active { transform: scale(.94); }
.fullscreen-button:focus-visible { outline: 2px solid #f4f7e9; outline-offset: 2px; }
.fullscreen-button svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mode-pill { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px; background: #4f9b2b; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; font-size: .7em; }
.mode-pill.demo { background: #a37828; }
.mode-pill.stale { background: #936d28; }

@media (max-width: 1100px), (max-aspect-ratio: 4/3) {
  .dashboard { overflow: auto; grid-template-rows: 220px auto auto auto 64px; }
  .hero-brand--farm { align-items: center; }
  .hero-copy { display: none; }
  .kpi-strip { grid-template-columns: repeat(2,1fr); padding: 12px 0; }
  .kpi:nth-child(2)::after { display:none; }
  .site-grid { grid-template-columns: 1fr; }
  .site-card { min-height: 310px; grid-template-columns: 46% 54%; }
  .site-card:last-child { grid-template-columns: 40% 60%; }
  .impact-grid { grid-template-columns: repeat(2,1fr); height: auto; }
  .impact { padding-bottom: 20px; }
  .impact-card { min-height: 126px; }
  .footer { grid-template-columns: 1fr; padding: 14px 22px; text-align:center; }
  .footer-item, .footer-item--right, .footer-status { justify-content:center; }
}

@media (max-width: 650px) {
  body { background: #eef0e7; }
  .dashboard {
    display: block;
    min-height: 100dvh;
    overflow: visible;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .hero { height: 128px; }
  .hero::before { opacity: .12; }
  .hero-shade { background-size: auto 115%; }
  .hero-brand--farm { left: 16px; top: 10px; }
  .hero-brand--farm img { width: 142px; max-height: 78px; }
  .hero-brand--osprey { display: block; right: 14px; top: 48%; }
  .hero-brand--osprey img { width: 126px; max-height: 64px; }
  .system-notice {
    right: 12px;
    bottom: 7px;
    left: 12px;
    max-width: none;
    font-size: .65rem;
    text-align: center;
  }

  .kpi-strip {
    margin: 10px;
    border-radius: 16px;
    grid-template-columns: repeat(2, 1fr);
    padding: 6px 0;
  }
  .kpi { padding: 10px 7px; }
  .kpi::after { display: none; }
  .kpi:nth-child(odd) { border-right: 1px solid rgba(255,255,255,.35); }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,.25); }
  .kpi-label { margin-bottom: .32rem; font-size: .61rem; }
  .kpi strong { font-size: clamp(1.75rem, 9vw, 2.35rem); }
  .kpi-unit { font-size: .78rem; }

  .site-grid {
    display: grid;
    gap: 10px;
    padding: 0 10px 10px;
  }
  .site-card,
  .site-card:first-child,
  .site-card:last-child {
    min-height: 0;
    grid-template-columns: 88px minmax(0, 1fr);
    border-radius: 15px;
  }
  .site-photo { height: auto; min-height: 164px; }
  .site-photo img { object-position: center; }
  .site-details { padding: 10px 11px; }
  .site-heading { margin-bottom: 5px; }
  .site-heading h2 { font-size: 1.12rem; }
  .status-badge { gap: .28rem; padding: .25rem .38rem; font-size: .54rem; border-radius: 7px; }
  .status-dot { width: .48rem; height: .48rem; outline-width: 1px; box-shadow: none; }
  .metrics { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
  .metrics > div { display: block; padding: 5px 0; }
  .metrics > div:nth-child(3) { border-bottom: none; }
  .metrics dt { font-size: .52rem; white-space: nowrap; }
  .metrics dd { margin-top: 2px; font-size: .94rem; }
  .metric-icon { display: none; }
  .go-live { margin-top: 4px; padding-top: 5px; font-size: .52rem; }

  .impact { padding: 0 10px 10px; }
  .impact-title { height: 32px; grid-template-columns: 1fr; text-align: center; }
  .impact-title span { display: none; }
  .impact-title h2 { font-size: 0; }
  .impact-title h2::after { content: "Solar Economics"; font-size: .76rem; }
  .impact-grid,
  .impact-grid.three { display: block; height: auto; padding: 0; }
  .impact-card:not(.impact-card--economics) { display: none; }
  .impact-card--economics {
    min-height: 118px;
    grid-template-columns: 68px minmax(0, 1fr);
    border-radius: 15px;
    padding: 12px 14px;
  }
  .impact-icon { width: 58px; }
  .impact-label { font-size: .67rem; }
  .economics-total strong { font-size: 1.7rem; }
  .economics-breakdown dt { font-size: .54rem; }
  .economics-breakdown dd { font-size: .88rem; }

  .footer {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 9px 12px;
    min-height: 46px;
  }
  .footer > .footer-item { display: none; }
  .footer-status { justify-content: flex-start; gap: 7px; font-size: .64rem; }
  .footer-item--right { display: none; }
  .fullscreen-button { width: 30px; height: 30px; }
}
