:root {
  color-scheme: light;
  --ink: #172124;
  --muted: #657173;
  --line: #d8dfdd;
  --soft: #f4f7f6;
  --panel: #ffffff;
  --accent: #2f6f73;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--soft);
}

button,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(460px, 0.95fr);
  height: 100vh;
  overflow: hidden;
}

.map-pane {
  position: relative;
  height: 100vh;
  min-height: 0;
  border-right: 1px solid var(--line);
}

#map {
  position: absolute;
  inset: 0;
}

.map-toolbar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 18px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(23, 33, 36, 0.13);
}

.map-toolbar button,
.map-toolbar select,
.export-tools button,
.export-tools a {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 7px 10px;
  text-decoration: none;
}

.map-toolbar button,
.export-tools button {
  cursor: pointer;
}

.map-toolbar label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  margin-left: auto;
}

.panel {
  height: 100vh;
  min-height: 0;
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.panel-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0 0 5px;
}

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

h1 {
  font-size: 27px;
  line-height: 1.1;
  margin-bottom: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  margin: 18px 0 9px;
}

h3 {
  font-size: 15px;
  line-height: 1.25;
  margin-bottom: 0;
}

.status {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}

.status.busy {
  color: var(--accent);
  border-color: rgba(47, 111, 115, 0.4);
}

.tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 12px 8px;
  color: var(--muted);
  cursor: pointer;
}

.tab:last-child {
  border-right: 0;
}

.tab.active {
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.tab-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 22px 28px;
  overflow: auto;
}

.tab-panel.active {
  display: block;
}

.stack {
  display: grid;
  gap: 10px;
}

.empty,
.notice {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 15px;
  color: var(--muted);
  background: var(--soft);
}

.notice {
  margin-bottom: 10px;
}

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

#corrosionSummary,
#provider,
#reportPreview {
  margin-bottom: 12px;
}

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

.rating-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.rating-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.rating-grid strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.rating-high {
  color: #9f2f2f;
}

.rating-moderate {
  color: #8a5d10;
}

.rating-low {
  color: #2f6f73;
}

.rating-empty {
  color: var(--muted);
}

.summary-grid div,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-grid div {
  padding: 12px;
  background: var(--soft);
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.summary-grid strong {
  display: block;
  font-size: 14px;
  line-height: 1.3;
}

.card {
  padding: 12px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 8px;
}

.card-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.card-body p {
  line-height: 1.45;
  margin-bottom: 8px;
}

.card-body p:last-child {
  margin-bottom: 0;
}

.export-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.hidden {
  display: none;
}

.muted,
.link-row {
  color: var(--muted);
  font-size: 13px;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 620px;
  font-size: 13px;
}

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

th {
  color: var(--ink);
  font-weight: 650;
  background: var(--soft);
}

td {
  color: #263235;
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 46vh 54vh;
  }

  .map-pane,
  .panel {
    height: auto;
    min-height: 0;
  }

  .map-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}
