:root {
  --bg: #eef4ef;
  --panel: #ffffff;
  --ink: #142119;
  --muted: #657467;
  --line: #d9e4dc;
  --green: #0b6b45;
  --green-2: #12935f;
  --lime: #b8e986;
  --blue: #1e6f9f;
  --amber: #c99025;
  --red: #c84b4b;
  --shadow: 0 18px 45px rgba(22, 48, 33, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover { background: #085636; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  padding: 22px;
  background: #102118;
  color: #eef8ef;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 20;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--green-2), var(--lime));
  color: #092014;
  font-weight: 950;
}

.brand strong { display: block; }
.brand small, .side-card small { color: #a8bdae; }

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  color: #d9eadc;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 750;
}

.nav a:hover, .nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.side-card {
  margin-top: auto;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255,255,255,.06);
}

.side-card span, .panel-label, .eyebrow {
  display: block;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--green-2);
  font-weight: 900;
}

.app {
  margin-left: 280px;
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  min-height: 128px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}

.topbar h1 {
  max-width: 980px;
  margin: 6px 0 0;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions input {
  min-width: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}

.mobile-menu { display: none; }

.module {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  margin: 0 0 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,.8);
}

.hero-module {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 22px;
  background:
    linear-gradient(135deg, rgba(11,107,69,.94), rgba(8,46,31,.92)),
    radial-gradient(circle at 80% 10%, rgba(184,233,134,.45), transparent 30%);
  color: #f5fff7;
}

.hero-copy h2 {
  max-width: 780px;
  margin: 16px 0 12px;
  font-size: clamp(26px, 3vw, 44px);
  line-height: 1.04;
}

.hero-copy p {
  max-width: 780px;
  color: #dceee1;
  font-size: 17px;
  line-height: 1.55;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  font-weight: 850;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.hero-actions button {
  background: #fff;
  color: #0b4d32;
}

.hero-panel {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  padding: 14px;
}

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

.kpi-card {
  min-height: 118px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.15);
}

.kpi-card span, .kpi-card small { color: #d7eadb; }
.kpi-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 28px;
}

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

.section-head h2 {
  margin: 5px 0 0;
  font-size: 26px;
}

.segmented, .tabs, .prompt-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button, .tabs button, .prompt-bank button {
  background: #edf5ef;
  color: var(--green);
  border: 1px solid var(--line);
}

.segmented button.active, .tabs button.active {
  background: var(--green);
  color: #fff;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.map-shell {
  min-height: 560px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #dfe9e0;
  position: relative;
}

#map, .map-fallback {
  position: absolute;
  inset: 0;
}

.map-fallback {
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,.08) 1px, transparent 1px),
    #1b3326;
  background-size: 46px 46px;
  color: #effff2;
  overflow: auto;
}

.fallback-lot {
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
}

.details-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfdfb;
}

.details-panel h3 {
  margin: 7px 0 8px;
}

.details-panel ul {
  padding-left: 18px;
  line-height: 1.65;
}

.earth-link {
  display: inline-flex;
  margin-top: 12px;
  color: var(--green);
  font-weight: 850;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f1f7f2;
  color: #314638;
  font-size: 13px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  background: #e9f5ee;
  color: var(--green);
}

.badge.medium { background: #fff3d7; color: #875d0c; }
.badge.high { background: #ffe2e2; color: #9b2424; }

.docs-grid {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
}

.upload-card, .ai-console, .files-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfb;
}

.drop-zone {
  min-height: 190px;
  border: 2px dashed #a8c8b4;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  cursor: pointer;
  background: #f2f8f4;
}

.drop-zone span {
  display: block;
  max-width: 310px;
  margin-top: 7px;
  color: var(--muted);
}

#fileInput { display: none; }

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

select, input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

.form-help {
  margin: 10px 0 0;
  color: var(--muted);
}

.files-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.file-item small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.ai-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.prompt-bank {
  align-content: start;
}

.prompt-bank button {
  width: 100%;
  text-align: left;
}

.console-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.console-actions span {
  color: var(--muted);
  font-size: 14px;
}

.ai-result {
  margin-top: 14px;
  min-height: 180px;
  border-radius: 8px;
  padding: 16px;
  background: #102118;
  color: #e9f8ec;
  line-height: 1.55;
  white-space: pre-wrap;
}

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

.workflow-card, .object-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfb;
}

.workflow-card h3, .object-card h3 {
  margin: 0 0 8px;
}

.workflow-card p, .object-card p {
  color: var(--muted);
  line-height: 1.5;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 22, 14, .62);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.modal-card label {
  display: grid;
  gap: 6px;
  font-weight: 750;
}

.close-modal {
  justify-self: end;
  background: #edf3ef;
  color: var(--green);
}

.hidden { display: none !important; }

@media (max-width: 1080px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .app { margin-left: 0; }
  .mobile-menu { display: inline-flex; width: max-content; }
  .topbar { grid-template-columns: 1fr; }
  .top-actions { flex-wrap: wrap; }
  .hero-module, .map-layout, .docs-grid, .ai-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app { padding: 14px; }
  .module { padding: 16px; }
  .metric-grid, .workflow-grid, .data-model {
    grid-template-columns: 1fr;
  }
  .section-head {
    align-items: start;
    flex-direction: column;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .map-shell { min-height: 460px; }
}

@media print {
  .sidebar, .top-actions, .mobile-menu, .hero-actions, .upload-card, .prompt-bank, .console-actions { display: none !important; }
  .app { margin: 0; padding: 0; }
  .module { break-inside: avoid; box-shadow: none; }
}
