:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --line: #d7dfeb;
  --text: #0f172a;
  --muted: #64748b;
  --green: #10a37f;
  --blue: #2563eb;
  --orange: #f59e0b;
  --red: #dc2626;
  --shadow: 0 14px 42px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem 1.4rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: #0f766e;
  font-weight: 900;
}

h1 {
  margin: 0.1rem 0 0.25rem 0;
  font-size: 2rem;
  line-height: 2.15rem;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
}

.subtitle,
.muted {
  color: var(--muted);
  margin: 0.25rem 0 0 0;
}

.header-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.layout {
  display: grid;
  grid-template-columns: minmax(620px, 1.5fr) minmax(360px, 0.7fr);
  grid-template-areas:
    "map side"
    "detail detail";
  gap: 1rem;
  padding: 1rem;
  max-width: 1740px;
  margin: 0 auto;
}

.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.map-card {
  grid-area: map;
  padding: 1rem;
}

.stack {
  grid-area: side;
  display: grid;
  gap: 1rem;
}

.detail-card {
  grid-area: detail;
  padding: 1rem;
  min-height: 560px;
}

.panel {
  padding: 1rem;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

#map {
  height: 710px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.map-note,
.message {
  margin-top: 0.75rem;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 0.92rem;
}

.status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 800;
  background: #fff;
  color: #334155;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0.42rem 0.82rem;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: #f8fafc;
}

.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn.ghost {
  background: #f8fafc;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.form-grid label {
  display: grid;
  gap: 0.25rem;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 850;
}

.form-grid label.wide,
.form-grid .wide {
  grid-column: 1 / -1;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  background: #fff;
}

.list {
  display: grid;
  gap: 0.55rem;
  max-height: 340px;
  overflow: auto;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: #f8fafc;
  cursor: pointer;
}

.list-item:hover {
  background: #eef2ff;
}

.list-title {
  font-weight: 900;
}

.list-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

.qa-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.8rem 0;
}

.qa-card {
  border: 1px solid var(--line);
  border-left: 6px solid var(--green);
  border-radius: 14px;
  padding: 0.8rem;
  background: #fff;
}

.qa-card.warn {
  border-left-color: var(--orange);
}

.qa-card.bad {
  border-left-color: var(--red);
}

.qa-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
}

.qa-value {
  font-size: 1.35rem;
  line-height: 1.4rem;
  font-weight: 950;
  margin-top: 0.2rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 0.85rem;
}

table.idf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.idf-table th {
  background: #f8fafc;
  border-bottom: 2px solid #111827;
  padding: 0.5rem 0.65rem;
  text-align: right;
  white-space: nowrap;
}

.idf-table th:first-child,
.idf-table td:first-child {
  text-align: left;
  font-weight: 900;
}

.idf-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.42rem 0.65rem;
  text-align: right;
}

.chart-shell {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem;
  background: #fff;
  margin-top: 0.85rem;
}

.chart-title {
  font-weight: 950;
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

svg.idf-chart {
  width: 100%;
  height: 560px;
  display: block;
}

.chart-axis {
  stroke: #111827;
  stroke-width: 1.2;
}

.chart-grid {
  stroke: #cbd5e1;
  stroke-width: 0.8;
  opacity: 0.55;
}

.chart-label {
  font-size: 12px;
  fill: #334155;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.4rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.legend-line {
  width: 28px;
  height: 0;
  border-top: 3px dashed currentColor;
}

.chatgpt-return-link {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: white;
  font-weight: 950;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0,0,0,0.25);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "side"
      "detail";
  }

  .qa-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.rank-marker {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.94);
  color: white;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 950;
}

/* IDF_STEP11_PROJECT_LAYER_STYLE_MARKER */
.project-idf-note {
  border: 1px solid #ddd6fe;
  background: #f5f3ff;
  color: #4c1d95;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-size: 0.92rem;
}

/* IDF_STEP13_GRAPH_STYLE_MARKER */
.chart-shell.idf-step13-chart-shell {
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 1rem 1rem 0.85rem 1rem;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  margin-top: 0.85rem;
}

.chart-shell.idf-step13-chart-shell .chart-title {
  font-size: 1.28rem;
  line-height: 1.45rem;
  font-weight: 950;
  color: #0f172a;
  text-align: center;
  margin-bottom: 0.1rem;
}

.chart-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 0.45rem;
}

svg.idf-chart {
  width: 100%;
  height: min(64vh, 650px);
  min-height: 520px;
  display: block;
  background: #ffffff;
}

.chart-bg {
  fill: #ffffff;
}

.chart-axis {
  stroke: #111827;
  stroke-width: 1.7;
  shape-rendering: crispEdges;
}

.chart-tick {
  stroke: #111827;
  stroke-width: 1.2;
  shape-rendering: crispEdges;
}

.chart-grid {
  shape-rendering: crispEdges;
}

.chart-grid.major {
  stroke: #94a3b8;
  stroke-width: 0.95;
  opacity: 0.58;
}

.chart-grid.minor {
  stroke: #cbd5e1;
  stroke-width: 0.65;
  opacity: 0.34;
}

.chart-label {
  font-size: 13px;
  fill: #334155;
  font-weight: 700;
}

.chart-x-label {
  font-size: 13px;
}

.chart-axis-title {
  font-size: 15px;
  fill: #111827;
  font-weight: 850;
}

.idf-curve-line {
  stroke-width: 2.2;
  stroke-dasharray: 8 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.idf-source-marker line {
  stroke-width: 2.6;
  stroke-linecap: round;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 0.65rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.86rem;
  font-weight: 850;
  white-space: nowrap;
}

.legend-line {
  width: 34px;
  height: 0;
  border-top: 3px dashed currentColor;
}

.chart-note {
  margin-top: 0.55rem;
  color: #475569;
  font-size: 0.9rem;
  text-align: center;
}

.chart-note.small {
  color: #64748b;
  font-size: 0.82rem;
}

/* IDF_STEP15_FRONTEND_CACHE_BUST_MARKER */
.map-note.bad,
.message.bad {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* IDF_STEP17_ECCC_REPORT_STYLE_MARKER */
.idf-card {
  border: 1px solid #d9dde7;
  border-radius: 12px;
  padding: 18px 20px;
  background: #ffffff;
  font-family: Arial, sans-serif;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin: 10px 0 20px 0;
}

.idf-card h3 {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 20px;
}

.idf-subtitle {
  color: #555;
  margin-bottom: 14px;
}

.idf-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  font-size: 14px;
}

.idf-meta-label {
  color: #555;
  font-weight: 700;
}

.idf-table-wrap {
  font-family: Arial, sans-serif;
  margin: 10px 0 20px 0;
}

.idf-table-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 2px;
  font-size: 18px;
}

.idf-table-subtitle {
  text-align: center;
  color: #555;
  margin-bottom: 10px;
  font-size: 14px;
}

table.idf-eccc {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.idf-eccc th {
  border-bottom: 2px solid #222;
  padding: 6px 8px;
  text-align: right;
  background: #f7f7f7;
}

table.idf-eccc th:first-child {
  text-align: left;
}

table.idf-eccc td {
  border-bottom: 1px solid #ddd;
  padding: 5px 8px;
  text-align: right;
}

table.idf-eccc td:first-child {
  text-align: left;
  font-weight: 600;
}

table.idf-eccc tr.ci-row td {
  color: #555;
  font-size: 12px;
  border-bottom: 1px solid #eee;
}

table.idf-eccc tfoot td {
  text-align: left;
  color: #555;
  font-size: 12px;
  border-bottom: none;
  padding-top: 8px;
}

.lineage-box {
  background: #f7f9fc;
  border: 1px solid #d9dde7;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 10px 0 20px 0;
}

.lineage-provided {
  color: #1f6f43;
  font-weight: 700;
}

.lineage-constructed {
  color: #8a5600;
  font-weight: 700;
}

.report-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.clean-report-table {
  border-radius: 0;
  box-shadow: none;
}

.diagnostic-grid {
  display: grid;
  gap: 1rem;
}

.small-diag-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 0.5rem;
}

.small-diag {
  border: 1px solid #d9dde7;
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.75rem;
}

.small-diag h4 {
  margin: 0 0 0.35rem 0;
}

.small-diag p {
  margin: 0.15rem 0;
  color: #475569;
}

@media (max-width: 1100px) {
  .report-two-col {
    grid-template-columns: 1fr;
  }
  .small-diag-grid {
    grid-template-columns: 1fr;
  }
}

/* IDF_STEP18_FULL_DIAGNOSTIC_GRAPH_STYLE_MARKER */
.tall-table {
  max-height: 520px;
  overflow: auto;
}

.diag-chart {
  width: 100%;
  min-height: 860px;
  display: block;
  background: #ffffff;
}

.idf-step18-diag-shell {
  margin-bottom: 1rem;
}

.diag-bg {
  fill: #ffffff;
  stroke: #d9dde7;
  stroke-width: 1;
}

.diag-grid {
  stroke: #cbd5e1;
  stroke-width: 0.7;
  opacity: 0.55;
  shape-rendering: crispEdges;
}

.diag-label {
  font-size: 11px;
  fill: #334155;
  font-weight: 650;
}

.diag-title {
  font-size: 13px;
  fill: #0f172a;
  font-weight: 850;
}

.diag-note {
  font-size: 11px;
  fill: #475569;
  font-weight: 700;
}

.diag-point.hollow {
  fill: #ffffff;
  stroke: #111827;
  stroke-width: 1.4;
}

.diag-fit-line {
  stroke: #2563eb;
  stroke-width: 1.5;
  fill: none;
}

.diag-ci-line {
  stroke: #64748b;
  stroke-width: 1.1;
  stroke-dasharray: 5 4;
  fill: none;
}

/* IDF_STEP19_MATPLOTLIB_PLOT_STYLE_MARKER */
.mpl-plot-shell {
  background: #ffffff;
  border: 1px solid #d9dde7;
  border-radius: 14px;
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.mpl-plot-img {
  display: block;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}
