:root {
  --bg: #f7f4ef;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --text: #24323d;
  --muted: #5f6f79;
  --accent: #b32035;
  --accent-dark: #8f182a;
  --accent-soft: #fdecef;
  --line: #e6ddd3;
  --line-strong: #d9cec1;
  --shadow: 0 18px 40px rgba(36, 50, 61, 0.10);
  --radius-lg: 24px;
  --max: 1180px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #fff7e8 0, transparent 28%),
    radial-gradient(circle at top right, #f8e8eb 0, transparent 26%),
    linear-gradient(180deg, #fbf8f3 0%, #f5f1ea 100%);
}
a { color: var(--accent); }
.page { width: min(calc(100% - 32px), var(--max)); margin: 0 auto; padding: 24px 0 56px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 8px 4px 18px; margin-bottom: 18px; border-bottom: 1px solid rgba(36, 50, 61, 0.10);
}
.brand h1 { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.social {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 999px; background: var(--surface); border: 1px solid rgba(36, 50, 61, 0.08);
  box-shadow: var(--shadow); text-decoration: none; font-weight: 700; color: var(--text);
}
.hero {
  display: flex; flex-wrap: wrap; gap: 28px; align-items: stretch; padding: 30px; border-radius: 32px;
  background: linear-gradient(135deg, rgba(255,255,255,0.90), rgba(255,255,255,0.72));
  border: 1px solid rgba(255,255,255,0.65); box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.hero-visual, .hero-copy { flex: 1 1 320px; min-width: 0; }
.hero-visual { display: flex; align-items: center; justify-content: center; padding: 12px; }
.illustration-card {
  width: 100%; max-width: 400px; aspect-ratio: 1 / 1; border-radius: 28px;
  background: linear-gradient(180deg, #fff7ef 0%, #fff 100%); border: 1px solid #f0e2d2;
  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.illustration-card::before, .illustration-card::after {
  content: ""; position: absolute; border-radius: 999px; filter: blur(2px);
}
.illustration-card::before { width: 180px; height: 180px; background: #fff0c7; top: -20px; left: -24px; }
.illustration-card::after { width: 220px; height: 220px; background: #fde5ea; bottom: -60px; right: -50px; }
.hero-image { width: 100%; height: 100%; object-fit: contain; position: relative; z-index: 1; padding: 18px; }
.hero-copy { display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.hero-copy h3 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.1; letter-spacing: -0.03em; }
.hero-copy p { margin: 0; font-size: 1.05rem; line-height: 1.7; color: var(--muted); max-width: 62ch; }

.content-stack { display: flex; flex-direction: column; gap: 24px; margin-top: 28px; }
.panel {
  width: 100%; background: var(--surface-strong); border: 1px solid rgba(36, 50, 61, 0.08);
  border-radius: var(--radius-lg); box-shadow: 0 12px 30px rgba(36, 50, 61, 0.07); padding: 24px;
}
.panel h3 { margin: 0 0 8px; font-size: 1.35rem; letter-spacing: -0.02em; }
.panel h4 { margin: 0 0 12px; font-size: 1rem; letter-spacing: -0.01em; }
.panel p, .panel li, .panel label, .panel .helper { color: var(--muted); }

.form-shell, .upload-form { display: flex; flex-direction: column; gap: 20px; }
.location-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 18px; border-radius: 18px; background: linear-gradient(135deg, #fff4f5, #fff); border: 1px solid #f2d9de;
}
.location-title { display: block; margin-bottom: 4px; }
.fields { display: flex; flex-wrap: wrap; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 8px; flex: 1 1 220px; min-width: 0; }
.field-full { flex-basis: 100%; }
label { font-size: 0.95rem; font-weight: 700; color: var(--text); }
input, select {
  width: 100%; min-height: 52px; padding: 0 14px; border-radius: 14px; border: 1px solid #d8dfe3;
  background: #fbfcfd; font: inherit; color: var(--text); outline: none;
}
input:focus, select:focus { border-color: rgba(179, 32, 53, 0.55); box-shadow: 0 0 0 4px rgba(179, 32, 53, 0.10); background: #fff; }
.form-actions, .quick-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 4px; }

.btn {
  appearance: none; border: none; cursor: pointer; text-decoration: none; display: inline-flex;
  justify-content: center; align-items: center; min-height: 48px; padding: 0 18px; border-radius: 14px;
  font-weight: 700; font-size: 0.95rem;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 10px 22px rgba(179, 32, 53, 0.22); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }

.data-note { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.92rem; color: var(--muted); }
.results-panel { display: none; }
.results-shell { display: flex; flex-direction: column; gap: 20px; }
.results-header h3 { margin-bottom: 6px; }
.result-block {
  border: 1px solid rgba(36, 50, 61, 0.08); border-radius: 20px; background: linear-gradient(180deg, #fffdfa 0%, #fcf8f2 100%); overflow: hidden;
}
.result-block-header { padding: 16px 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.7); }
.status-banner { padding: 24px 18px; text-align: center; font-size: clamp(1.3rem, 2.8vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; }
.status-pending { background: #f3efe8; color: var(--muted); }
.status-yes { background: #0d8704; color: #fff; }
.status-no { background: #751602; color: #fff; }

.table-wrap { width: 100%; overflow-x: auto; }
.styled-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.styled-table thead th {
  background: linear-gradient(180deg, #f8efe4 0%, #f3e6d6 100%);
  color: var(--text); font-size: 0.92rem; font-weight: 800; letter-spacing: 0.02em; text-align: center;
  padding: 16px 14px; border-bottom: 1px solid var(--line-strong);
}
.styled-table tbody td, .styled-table tfoot td {
  padding: 14px; text-align: center; vertical-align: middle; color: var(--muted);
  border-bottom: 1px solid #eee5da; background: rgba(255,255,255,0.75);
}
.styled-table tbody tr:nth-child(even) td { background: rgba(250,245,238,0.95); }
.compact-table { min-width: 100%; }
.empty-state-cell { text-align: center; color: var(--muted); padding: 24px !important; }

.weight-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 0; }
.weight-tile {
  padding: 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px;
  text-align: center; background: #f7f2ea;
}
.weight-tile:last-child { border-right: none; }
.weight-label { font-weight: 700; color: var(--text); }
.weight-value { font-size: 1.35rem; font-weight: 800; color: var(--muted); }
.weight-value.is-good { color: #0d8704; }
.weight-value.is-bad { color: #751602; }
.map-block { padding-bottom: 0; }
.leaflet-modern { width: 100%; height: 440px; background: #f2eee7; }
.leaflet-modern .legend {
  background: rgba(255,255,255,0.94); padding: 12px 14px; border-radius: 14px; box-shadow: 0 10px 24px rgba(36,50,61,0.12);
  border: 1px solid rgba(36,50,61,0.08); line-height: 1.5;
}
.leaflet-modern .legend h4 { margin: 0 0 8px; font-size: 0.95rem; color: var(--text); }
.leaflet-modern .legend i {
  width: 12px; height: 12px; float: left; margin-right: 8px; margin-top: 5px; opacity: 0.95; border-radius: 2px;
}

.table-card {
  margin-top: 18px; border: 1px solid rgba(36, 50, 61, 0.08); border-radius: 20px; overflow: hidden;
  background: linear-gradient(180deg, #fffdfa 0%, #fcf8f2 100%);
}
.table-footer-cell { border-top: 1px solid var(--line-strong); text-align: center; }
.text-link { font-weight: 700; text-decoration: none; }
.upload-card {
  margin-top: 20px; padding: 20px; border-radius: 20px; background: linear-gradient(135deg, #fff4f5, #fff); border: 1px solid #f2d9de;
}
.upload-row { display: flex; flex-direction: column; gap: 10px; }
.file-label { display: inline-block; width: fit-content; color: var(--text); }
.file-input { padding: 14px; border: 1px dashed #d7b7bf; background: #fff; cursor: pointer; }
.file-input::file-selector-button {
  margin-right: 14px; border: none; border-radius: 12px; padding: 10px 16px; font: inherit; font-weight: 700;
  background: var(--accent); color: #fff; cursor: pointer;
}
.feature-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 18px; }
.feature { padding: 16px; border-radius: 18px; background: #faf7f2; border: 1px solid #efe7de; }
.feature strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 0.98rem; }

@media (max-width: 760px) {
  .page { width: min(calc(100% - 20px), var(--max)); padding-top: 14px; }
  .hero, .panel { padding: 20px; }
  .hero-copy h3 { font-size: 1.8rem; }
  .weight-grid { grid-template-columns: 1fr; }
  .weight-tile { border-right: none; border-bottom: 1px solid var(--line); }
  .weight-tile:last-child { border-bottom: none; }
  .leaflet-modern { height: 340px; }
  .styled-table { min-width: 640px; }
}


/* Modern batch upload status */
.btn-with-spinner {
  gap: 10px;
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.btn-with-spinner[disabled] {
  opacity: 0.85;
  cursor: wait;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  display: none;
  animation: spin 0.8s linear infinite;
}

.btn-with-spinner.is-loading .btn-spinner {
  display: inline-block;
}

.upload-status {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 4px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.upload-status-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 999px;
  margin-top: 2px;
  position: relative;
}

.upload-status-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-status-title {
  color: var(--text);
  font-size: 0.96rem;
}

.upload-status-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

.upload-status-idle {
  background: linear-gradient(180deg, #fffdfa 0%, #fcf8f2 100%);
}

.upload-status-idle .upload-status-icon {
  background: #eadfce;
}

.upload-status-loading {
  background: linear-gradient(135deg, #fff4f5, #fff);
  border-color: #f2d9de;
  box-shadow: 0 10px 22px rgba(179, 32, 53, 0.08);
}

.upload-status-loading .upload-status-icon {
  border: 2px solid rgba(179, 32, 53, 0.22);
  border-top-color: var(--accent);
  background: transparent;
  animation: spin 0.8s linear infinite;
}

.upload-status-success {
  background: linear-gradient(135deg, #f2fbf4, #fff);
  border-color: #cfe8d5;
}

.upload-status-success .upload-status-icon {
  background: #0d8704;
}

.upload-status-success .upload-status-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.upload-status-error {
  background: linear-gradient(135deg, #fff4f2, #fff);
  border-color: #efcfc8;
}

.upload-status-error .upload-status-icon {
  background: #751602;
}

.upload-status-error .upload-status-icon::before,
.upload-status-error .upload-status-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 2px;
  height: 12px;
  background: #fff;
  border-radius: 2px;
}

.upload-status-error .upload-status-icon::before {
  transform: rotate(45deg);
}

.upload-status-error .upload-status-icon::after {
  transform: rotate(-45deg);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
