/* Palette from Dynetrack's frontend/app/globals.css. */
:root {
  color-scheme: dark;
  --bg: #0d0e12;
  --group: #101216;
  --surface: #1a1c22;
  --active: #303440;
  --border: #22252e;
  --outline: #6f7d87;
  --ink: #dddddd;
  --muted: #a1a5af;
  --subtext: #888888;
  --blue: #2c97de;
  --green: #84b547;
  --orange: #e76d3b;
  --red: #dc3545;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-synthesis: none;
  background: var(--bg);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; line-height: 1.5; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
main { width: 100%; max-width: 820px; margin: 64px auto 40px; padding: 0 28px; flex: 1; }
.intro { margin-bottom: 28px; }
h1 { margin: 0 0 12px; font-size: clamp(1.5rem, 3.8vw, 2.125rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.25; text-wrap: balance; }
.intro p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.6; text-wrap: pretty; }
.repair-card { padding: 30px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 235px; padding: 28px 16px; border: 1px dashed var(--outline); border-radius: 8px; background: var(--group); text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone.dragover, .dropzone:focus-within { border-color: var(--blue); background: #14202b; }
.dropzone:focus-within { outline: 2px solid var(--blue); outline-offset: 3px; }
.file-icon { display: grid; place-items: center; width: 44px; height: 48px; margin-bottom: 10px; color: var(--blue); }
.file-icon svg { width: 37px; height: 37px; }
.dropzone strong { color: var(--blue); font-size: 1.125rem; font-weight: 600; }
.dropzone > span:not(.file-icon) { color: var(--muted); font-size: .875rem; }
.dropzone .file-types { margin-top: 12px; font-size: .8125rem !important; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; bottom: 8px; }
.dropzone.busy { pointer-events: none; opacity: .6; }
.status { margin: 18px 0 0; color: var(--muted); text-align: center; font-size: .875rem; text-wrap: pretty; }
.error { margin: 18px 0 0; padding: 14px 16px; border: 1px solid #673239; border-radius: 6px; color: #f1b1b7; background: #301c20; font-size: .9375rem; overflow-wrap: break-word; }
.file-state { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.file-tag { padding: 12px 8px; border-radius: 5px; background: var(--active); color: var(--ink); font-size: .75rem; font-weight: 600; }
.file-state > div { min-width: 0; }
.file-state strong { display: block; font-size: .9375rem; font-weight: 600; overflow-wrap: anywhere; }
.file-state span:not(.file-tag) { display: block; margin-top: 3px; color: var(--muted); font-size: .8125rem; }
.text-button { padding: 4px 0; min-height: 36px; border: 0; background: none; color: var(--blue); font-size: .875rem; line-height: 1.4; text-decoration: underline; text-underline-offset: 3px; }
.file-state .text-button { text-align: left; }
.result { margin-top: 24px; }
.result-heading { display: flex; align-items: center; gap: 12px; }
.result-heading > div { min-width: 0; }
.check-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 50%; color: var(--green); background: #28321e; font-size: 1.25rem; }
h2 { margin: 0; font-size: 1.125rem; line-height: 1.4; font-weight: 600; }
.result-heading p { margin: 4px 0 0; color: var(--muted); font-size: .9375rem; }
.recovery-note { margin: 20px 0 0; padding: 12px 15px; border-radius: 6px; background: #35291e; color: #e8be8c; font-size: .9375rem; line-height: 1.6; text-wrap: pretty; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 54px; margin-top: 24px; padding: 15px 16px; border: 0; border-radius: 6px; background: var(--blue); color: #08141d; font-weight: 650; line-height: 1.4; }
.primary-button:hover:enabled { background: #51adeb; }
.primary-button:disabled { background: #24425a; color: #b2c2cf; }
.primary-button svg { flex: 0 0 20px; width: 20px; height: 20px; }
.import-help { margin: 15px 0 24px; color: var(--muted); font-size: .875rem; line-height: 1.7; text-wrap: pretty; }
.import-help strong { font-weight: 500; color: var(--ink); }
.import-help strong span { display: inline-block; max-width: 100%; vertical-align: bottom; }
.file-details { padding-top: 18px; border-top: 1px solid var(--border); }
.file-details summary, .help summary { margin-left: 16px; padding: 4px 0; color: var(--ink); font-size: .9375rem; font-weight: 500; list-style-position: outside; }
.details-content { margin-top: 21px; }
.field-label { display: block; margin-bottom: 8px; font-size: .875rem; }
input[type=text] { width: 100%; min-height: 44px; padding: 11px 12px; border: 1px solid var(--outline); border-radius: 5px; color: var(--ink); background: var(--group); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 25px 0; }
.stats > div { padding-left: 18px; border-left: 1px solid var(--active); }
.stats > div:first-child { padding-left: 0; border: 0; }
.stats strong { display: block; font-size: 1.5rem; line-height: 1.25; font-weight: 550; font-variant-numeric: tabular-nums; }
.stats span { display: block; margin-top: 5px; color: var(--muted); font-size: .875rem; }
.plot-shell { position: relative; height: 260px; border-radius: 6px; overflow: hidden; background: var(--group); background-image: linear-gradient(#ffffff07 1px, transparent 1px), linear-gradient(90deg, #ffffff07 1px, transparent 1px); background-size: 40px 40px; }
.plot-shell canvas { display: block; width: 100%; height: 100%; }
.plot-caption { position: absolute; right: 12px; bottom: 10px; left: 12px; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.review { margin-top: 23px; }
.review h3 { margin: 0; font-size: .9375rem; font-weight: 600; }
.review p, .review li { color: var(--muted); font-size: .875rem; line-height: 1.65; text-wrap: pretty; }
.review p { margin: 8px 0; }
.review ul { padding-left: 20px; margin: 10px 0 12px; }
.review li { margin: 6px 0; }
.review li.attention { color: #e8be8c; }
.help { margin-top: 25px; padding: 17px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.help p { margin: 15px 0 0; color: var(--muted); font-size: .9375rem; line-height: 1.65; text-wrap: pretty; }
.help > div { padding-bottom: 4px; }
footer { padding: 0 24px 28px; color: var(--subtext); font-size: .8125rem; text-align: center; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  main { margin: 30px auto; padding: 0 20px; }
  .intro { margin-bottom: 23px; }
  .repair-card { padding: 20px; }
  .dropzone { min-height: 215px; padding: 24px 12px; }
  .file-state { grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; }
  .file-state .text-button { grid-column: 1 / -1; justify-self: start; }
  .stats { gap: 10px; }
  .stats > div { padding-left: 10px; }
  .plot-shell { height: 230px; }
}
@media (max-width: 480px) {
  main { padding: 0 16px; }
  .repair-card { padding: 16px; }
  .stats { grid-template-columns: 1fr; gap: 10px; }
  .stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 0 9px; border: 0; border-bottom: 1px solid var(--border); }
  .stats > div:first-child { padding-bottom: 9px; border-bottom: 1px solid var(--border); }
  .stats span { margin: 0; }
  .primary-button { gap: 8px; padding-inline: 10px; font-size: .9375rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.map-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:24px 0 10px; }
.map-heading h3 { margin:0; font-size:.9375rem; font-weight:600; }
.map-heading .text-button { white-space:nowrap; }
.plot-shell { height:380px; isolation:isolate; }
#map { position:absolute; inset:0; width:100%; height:100%; color-scheme:light; background:var(--group); z-index:1; }
#map .leaflet-control-attribution { font-size:12px; }
.map-status { margin:0 0 12px; font-size:.875rem; color:var(--muted); }
.map-note { margin:9px 0 0; font-size:.75rem; color:var(--muted); }
@media(max-width:480px) { .plot-shell { height:320px; } .map-heading { flex-wrap:wrap; gap:4px 12px; } }

.map-preview { margin-bottom:24px; }
/* Style only the raster background; source colors and attribution stay intact. */
#map .leaflet-tile-pane { filter:invert(1) hue-rotate(180deg) saturate(.55) brightness(.85) contrast(.95); }
#map .leaflet-bar { border-color:var(--border); }
#map .leaflet-bar a { background:var(--surface); color:var(--ink); border-bottom-color:var(--border); }
#map .leaflet-bar a:hover { background:var(--active); }
#map .leaflet-bar a.leaflet-disabled { background:var(--group); color:var(--subtext); }
