:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #64717f;
  --line: #dce3e8;
  --green: #19745c;
  --gold: #c38a1f;
  --blue: #2266a8;
  --red: #b94a3f;
  --black: #11171d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
select {
  font: inherit;
}

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(17, 23, 29, 0.52), rgba(17, 23, 29, 0.52)),
    url("https://images.unsplash.com/photo-1614730321146-b6fa6a46bcb4?auto=format&fit=crop&w=1800&q=80")
      center/cover;
}

.login-panel {
  width: min(560px, 100%);
  padding: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 40px;
  line-height: 1.05;
  margin-bottom: 16px;
}

.login-copy,
.auth-note,
.metric small,
.detail-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.login-actions {
  display: grid;
  gap: 12px;
  margin: 28px 0 16px;
}

.auth-button,
.primary-action,
.secondary-action,
.nav-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  cursor: pointer;
}

.auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.auth-button span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: var(--black);
}

.auth-button.google span {
  background: #4285f4;
}

.auth-button.microsoft span {
  background: #00a4ef;
}

.auth-button.demo {
  background: var(--black);
  color: #fff;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  padding: 22px;
  background: var(--black);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  font-weight: 800;
}

.brand span,
.user-card span {
  display: block;
  color: #aeb8c1;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  color: #dce3e8;
  text-align: left;
  padding: 0 14px;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  background: #24313d;
  color: #fff;
}

.user-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid #2f3d49;
  border-radius: 8px;
}

.workspace {
  padding: 22px;
  min-width: 0;
}

.topbar,
.panel-header,
.topbar-actions,
.legend,
.map-tools,
.gauge-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.filter-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.filter-band label {
  display: grid;
  gap: 5px;
}

.filter-band span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.topbar h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.topbar-actions {
  gap: 10px;
}

select,
.primary-action,
.secondary-action {
  padding: 0 14px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.primary-action {
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.secondary-action {
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.report-link {
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}

.report-link:hover {
  text-decoration: underline;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric,
.map-panel,
.detail-panel,
.view-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
}

.map-panel,
.detail-panel,
.view-section {
  padding: 16px;
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.panel-header h3 {
  margin-bottom: 0;
}

.map-tools {
  gap: 8px;
}

.map-tool {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.map-tool.active {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}

.legend {
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 50%;
}

.gold {
  background: var(--gold);
}

.cobalt {
  background: var(--blue);
}

.lithium {
  background: #607d3b;
}

.rare {
  background: #7d5ba6;
}

.diamond {
  background: #59a8c7;
}

.critical,
.copper,
.uranium {
  background: #7d5ba6;
}

.energy,
.oil,
.gas {
  background: #2f3d49;
}

.bio,
.water,
.fisheries,
.agriculture {
  background: #19745c;
}

.bauxite,
.iron,
.phosphate,
.potash {
  background: #9b6b3d;
}

.world-map {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border-radius: 8px;
  background: #d8e2e7;
}

.tile-map {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 430px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  filter: saturate(0.86) contrast(1.02);
}

.tile-grid,
.concession-layer,
.risk-layer,
.marker-layer,
.label-layer {
  position: absolute;
  inset: 0;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.tile-grid img {
  display: block;
  width: 100%;
  height: 100%;
}

.concession-layer,
.risk-layer,
.marker-layer,
.label-layer {
  z-index: 4;
}

.concession-layer,
.risk-layer,
.label-layer {
  pointer-events: none;
}

.map-hud {
  position: absolute;
  left: 16px;
  top: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.map-hud span {
  display: block;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.map-hud strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
}

.world-map .legend {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  width: fit-content;
  max-width: calc(100% - 32px);
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.map-attribution {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  color: #31515d;
  background: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  backdrop-filter: blur(8px);
}

.marker {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  z-index: 6;
}

.marker.selected {
  outline: 3px solid rgba(17, 23, 29, 0.35);
}

.concession-footprint {
  position: absolute;
  border: 2px solid rgba(25, 116, 92, 0.76);
  border-radius: 42% 58% 47% 53%;
  background: rgba(25, 116, 92, 0.14);
  transform: translate(-50%, -50%) rotate(var(--tilt));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.42), 0 8px 28px rgba(17, 23, 29, 0.16);
  cursor: pointer;
  pointer-events: auto;
}

.concession-footprint.selected {
  border-color: rgba(17, 23, 29, 0.86);
  background: rgba(195, 138, 31, 0.22);
}

.risk-bubble {
  position: absolute;
  width: var(--risk-size);
  height: var(--risk-size);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(185, 74, 63, 0.5), rgba(185, 74, 63, 0.08) 62%, transparent 70%);
  border: 1px solid rgba(185, 74, 63, 0.4);
}

.risk-bubble.medium {
  background: radial-gradient(circle, rgba(195, 138, 31, 0.42), rgba(195, 138, 31, 0.08) 62%, transparent 70%);
  border-color: rgba(195, 138, 31, 0.42);
}

.risk-bubble.low {
  background: radial-gradient(circle, rgba(34, 102, 168, 0.32), rgba(34, 102, 168, 0.06) 62%, transparent 70%);
  border-color: rgba(34, 102, 168, 0.3);
}

.asset-label {
  position: absolute;
  max-width: 150px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 7px;
  color: #17212b;
  background: rgba(255, 255, 255, 0.84);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  transform: translate(10px, -50%);
  box-shadow: 0 5px 14px rgba(17, 23, 29, 0.12);
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef5f1;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.gauge-row {
  gap: 16px;
  margin-bottom: 14px;
}

.gauge {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) calc(var(--value) * 1%), #e6ecef 0);
}

.gauge span {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  font-weight: 800;
}

.asset-facts {
  display: grid;
  gap: 9px;
  margin: 0;
}

.evidence-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.evidence-stack .eyebrow {
  flex-basis: 100%;
  margin-bottom: 0;
}

.evidence-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #f8fafb;
  font-size: 12px;
}

.asset-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.view-section {
  margin-top: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.table-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
}

.table-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-left: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}

.table-link:hover {
  background: #eef5f1;
}

.activity-panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-list article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.activity-list strong,
.activity-list span {
  display: block;
}

.activity-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.source-groups {
  display: grid;
  gap: 14px;
}

.source-group {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline article {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #fff;
}

.timeline strong,
.timeline span,
.timeline code {
  display: block;
}

.timeline span,
.timeline p {
  color: var(--muted);
}

.timeline p {
  margin: 8px 0;
}

.timeline code {
  width: fit-content;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  background: #eef2f4;
  overflow-wrap: anywhere;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.split-grid > section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.primary-table-action {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.assessment-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.assessment-header h3 {
  margin-bottom: 6px;
}

.assessment-header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.assessment-score {
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: #eef5f1;
  color: var(--green);
  flex: 0 0 auto;
}

.assessment-score span {
  font-size: 30px;
  font-weight: 800;
}

.assessment-score strong {
  font-size: 12px;
  text-transform: uppercase;
}

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

.assessment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.assessment-card p {
  color: var(--muted);
  line-height: 1.45;
}

.span-2 {
  grid-column: span 2;
}

.big-number {
  display: block;
  font-size: 34px;
  margin-bottom: 4px;
}

.mini-divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.assessment-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.assessment-facts div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.assessment-facts dt {
  margin-bottom: 4px;
  font-size: 12px;
}

.assessment-facts dd {
  text-align: left;
}

.compact-facts {
  grid-template-columns: 1fr;
}

.diligence-list,
.evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.diligence-list span,
.evidence-list span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.workflow-card strong {
  display: block;
  margin-bottom: 8px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e6ecef;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--bar);
  background: var(--green);
}

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

.report-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.report-sections {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.report-sections section {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.report-sections strong {
  display: block;
  margin-bottom: 4px;
}

.report-sections p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.notice {
  margin-bottom: 0;
  padding: 12px;
  border-left: 4px solid var(--gold);
  background: #fff8ea;
  color: #6d5320;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .metrics-grid,
  .main-grid,
  .workflow-grid,
  .report-grid,
  .assessment-grid,
  .filter-band,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .login-panel,
  .workspace,
  .sidebar {
    padding: 16px;
  }

  h1 {
    font-size: 32px;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
