:root {
  --bg: #f2f5ee;
  --panel: rgba(255, 255, 255, 0.92);
  --line: #d8e2d0;
  --ink: #1f3024;
  --muted: #66756a;
  --green: #2e6a3c;
  --green-soft: #dfece0;
  --amber: #c68c28;
  --amber-soft: #f7e8c8;
  --blue-soft: #e5edf4;
  --shadow: 0 22px 44px rgba(24, 50, 30, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

body {
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 147, 40, 0.14), transparent 24%),
    radial-gradient(circle at top right, rgba(72, 120, 86, 0.14), transparent 25%),
    linear-gradient(180deg, #fbfcf8 0%, var(--bg) 100%);
}

.grameee-shell-mount {
  width: min(1540px, calc(100vw - 56px));
  max-width: none;
  margin: 24px auto 0;
}

.needs-page {
  max-width: 1540px;
  margin: 0 auto;
  padding: 22px 28px 28px;
}

.panel,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.needs-summary {
  padding: 32px 34px;
  display: grid;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: var(--green);
  font-weight: 700;
}

h1, h2, h3, h4, p { margin: 0; }

.needs-summary h1,
.hero-strip h1 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 2.35rem;
  line-height: 1.05;
}

.lede,
.helper-text,
.need-brief,
.detail-status,
.summary-status,
.summary-note {
  color: var(--muted);
  line-height: 1.6;
}

.summary-note {
  color: var(--green);
  font-weight: 700;
}

.summary-status {
  min-height: 24px;
  font-size: 0.94rem;
}

.summary-status.error,
.detail-status.error {
  color: #8d2f21;
}

.hidden { display: none !important; }

.needs-app {
  display: grid;
  gap: 18px;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding: 22px 24px;
  background: linear-gradient(180deg, #377c4b 0%, #2f6f45 100%);
  border-color: rgba(47, 111, 69, 0.18);
  box-shadow: 0 20px 48px rgba(31, 63, 43, 0.14);
}

.hero-strip .eyebrow,
.hero-strip h1,
.hero-strip .lede {
  color: #f7fbf5;
}

.hero-strip .eyebrow {
  opacity: 0.92;
}

.hero-meta {
  display: grid;
  grid-template-columns: minmax(220px, 280px);
  gap: 12px;
  min-width: 220px;
}

.hero-chip {
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f7faf4);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 20px 30px rgba(16, 37, 24, 0.14);
  text-align: center;
  align-self: center;
}

.hero-chip strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.hero-chip-label {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.signal-row {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.signal-panel,
.cases-panel {
  padding: 18px;
}

.panel-head,
.pipeline-drilldown-head,
.case-map-location-panel-head,
.case-map-location-panel-actions,
.need-card-actions,
.detail-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-head,
.pipeline-drilldown-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-head h2,
.pipeline-drilldown-head h2 {
  margin-top: 6px;
  font-size: 1.35rem;
}

.text-button {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.signal-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 42px;
  gap: 10px;
  align-items: center;
}

.bar-row-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  font: inherit;
  display: grid;
  grid-template-columns: 150px 1fr 42px;
  gap: 12px;
  align-items: center;
}

.signal-pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bar-row-button:hover,
.signal-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(24, 50, 30, 0.08);
}

.bar-row-button.active,
.signal-pill.active {
  border-color: #244f2f;
  background: linear-gradient(180deg, #2f6840, #254f31);
  box-shadow: 0 12px 24px rgba(36, 79, 47, 0.18);
  color: #fff;
}

.signal-pill strong {
  color: inherit;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--green-soft);
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #7e9e74);
}

.signal-section {
  display: grid;
  gap: 10px;
}

.signal-section + .signal-section {
  margin-top: 14px;
}

.signal-heading {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tag-cloud {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tag-cloud button {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
}

.tag-cloud button.active {
  border-color: #244f2f;
  background: #2f6840;
  color: #fff;
}

.cases-panel {
  overflow: visible;
}

.pipeline-drilldown-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.pipeline-drilldown-sidebar {
  display: grid;
  gap: 14px;
  min-height: 760px;
  order: 2;
}

.pipeline-drilldown-map {
  position: relative;
  min-height: 760px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, #f7faf4, #eef4ea);
  order: 1;
}

.case-map-canvas {
  width: 100%;
  min-height: 760px;
}

.case-map-empty {
  min-height: 760px;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.case-map-location-panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  display: grid;
  justify-items: end;
}

.case-map-location-panel-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f4f8f1);
  padding: 14px;
  display: grid;
  gap: 12px;
  width: min(100%, 460px);
  max-height: 340px;
  overflow: auto;
  box-shadow: 0 22px 40px rgba(18, 38, 24, 0.2);
}

.case-map-location-grid {
  display: grid;
  gap: 10px;
}

.case-map-location-card,
.need-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f7faf4);
  display: grid;
  gap: 10px;
}

.case-map-marker,
.case-map-marker-ring {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  cursor: pointer;
}

.case-map-marker {
  background: #2e6a3c;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 20px rgba(46, 106, 60, 0.3);
}

.case-map-marker-ring {
  position: relative;
  width: 28px;
  height: 28px;
  border: 4px solid #2e6a3c;
  background: rgba(46, 106, 60, 0.08);
  box-shadow: 0 10px 20px rgba(46, 106, 60, 0.22);
}

.case-map-marker-ring::after {
  content: attr(data-count);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #244f2f;
  font-size: 0.72rem;
  font-weight: 800;
}

.pipeline-drilldown-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  overflow: auto;
  min-height: 0;
  max-height: 760px;
  padding-right: 4px;
}

.need-card h3,
.case-map-location-card h4 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.35;
}

.need-meta,
.status-row,
.detail-grid,
.detail-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.meta-chip,
.status-pill.info {
  background: var(--blue-soft);
  color: #27475f;
}

.status-pill.good {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.warn {
  background: var(--amber-soft);
  color: #7a5200;
}

.button,
.btn {
  border: none;
  cursor: pointer;
  border-radius: 14px;
  padding: 11px 15px;
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button.primary,
.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 20px rgba(46, 106, 60, 0.18);
}

.button.secondary,
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-small {
  padding: 8px 12px;
  min-height: 0;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 3000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 44, 29, 0.45);
}

.modal-card {
  position: relative;
  width: min(860px, calc(100vw - 24px));
  padding: 22px;
  margin: 8vh auto 0;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

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

.detail-grid > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.detail-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.detail-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  line-height: 1.45;
}

.detail-problem {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f7faf4);
}

.detail-problem p {
  margin-top: 10px;
  color: var(--ink);
  white-space: pre-wrap;
}

.detail-actions {
  justify-content: flex-start;
  margin-top: 18px;
  flex-wrap: wrap;
}

.need-card-actions .btn-secondary,
.case-map-location-card .btn-secondary {
  background: var(--green);
  color: #fff;
  border: 1px solid var(--green);
  box-shadow: 0 10px 20px rgba(46, 106, 60, 0.18);
}

.need-card-actions .btn-secondary:hover,
.case-map-location-card .btn-secondary:hover {
  background: #275c38;
  color: #fff;
  border-color: #275c38;
}

.cases-count-pill {
  align-self: center;
}

.mail-review-modal-card {
  width: min(920px, calc(100vw - 24px));
}

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

.mail-review-grid > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.mail-review-body-shell {
  margin-top: 16px;
}

.mail-review-body {
  margin: 10px 0 0;
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.6;
  font: inherit;
}

.floating-actions {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
}

.floating-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  background: rgba(23, 57, 38, 0.92);
  color: #fff;
  box-shadow: 0 12px 24px rgba(17, 35, 24, 0.18);
}

@media (max-width: 1280px) {
  .pipeline-drilldown-split,
  .signal-row {
    grid-template-columns: 1fr;
  }

  .pipeline-drilldown-sidebar {
    min-height: auto;
  }

  .pipeline-drilldown-list {
    max-height: none;
  }
}

@media (max-width: 920px) {
  .grameee-shell-mount {
    width: min(1540px, calc(100vw - 32px));
    margin-top: 16px;
  }

  .needs-page {
    padding: 16px;
  }

  .hero-strip,
  .detail-actions,
  .panel-head,
  .pipeline-drilldown-head,
  .case-map-location-panel-head,
  .case-map-location-panel-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-meta,
  .detail-grid,
  .mail-review-grid {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .bar-row {
    grid-template-columns: 110px 1fr 34px;
  }

  .bar-row-button {
    grid-template-columns: 110px 1fr 34px;
  }

  .pipeline-drilldown-list {
    grid-template-columns: 1fr;
  }

  .pipeline-drilldown-map,
  .case-map-canvas,
  .case-map-empty {
    min-height: 460px;
  }

  .case-map-location-panel {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .case-map-location-panel-shell {
    width: 100%;
    max-height: 280px;
  }
}
