:root {
  --bg: #edf1e8;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: #f6f7f2;
  --line: #d7ddd2;
  --text: #1f2a21;
  --muted: #5f6b61;
  --green: #295b37;
  --green-dark: #183722;
  --warm: #bc9766;
  --danger: #9f2828;
  --success: #226a38;
  --shadow: 0 24px 56px rgba(26, 36, 28, 0.1);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shell: min(1380px, calc(100% - 32px));
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 18%, rgba(203, 220, 196, 0.8), transparent 26%),
    radial-gradient(circle at 78% 10%, rgba(194, 211, 196, 0.42), transparent 20%),
    linear-gradient(180deg, #f7f5ef 0%, #edf2eb 48%, #e8eee5 100%);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
input, textarea, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
}
textarea { min-height: 110px; padding: 12px 14px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0; }
legend { padding: 0 6px; color: var(--muted); }
.shell { width: var(--shell); margin: 0 auto; }
.portal-body { padding: 24px 0 36px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card, .project-card, .panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.login-card { width: min(540px, 100%); padding: 32px; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 800;
}
h1, h2 { margin: 0; font-family: "Fraunces", Georgia, serif; }
h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.03; }
h2 { font-size: 1.4rem; }
.copy, .note, .status { color: var(--muted); line-height: 1.6; }
.upload-note {
  margin: -4px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.92rem;
}
.upload-progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8ede3;
  overflow: hidden;
  border: 1px solid var(--line);
}
.upload-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #295b37 0%, #5fa06e 100%);
  transition: width 160ms ease;
}
.stack { display: grid; gap: 14px; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer;
}
.button:disabled {
  opacity: 0.7;
  cursor: wait;
}
.button-primary { background: var(--green); color: #fff; }
.button-secondary { background: #fff; border-color: var(--line); }
.button-danger { background: #fff; border-color: color-mix(in srgb, var(--danger) 38%, white); color: var(--danger); }
.button-danger:hover, .button-danger:focus { background: color-mix(in srgb, var(--danger) 8%, white); }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  margin-bottom: 24px;
}
.topbar-title { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.topbar-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px;
  border-radius: 999px; background: rgba(41, 91, 55, 0.1); color: var(--green-dark); font-weight: 700;
}
.card-grid, .form-grid, .admin-table-grid, .viewer-layout {
  display: grid; gap: 24px;
}
.card-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.project-card, .panel-card { padding: 24px; }
.panel-card-full { grid-column: 1 / -1; }
.card-actions { margin-top: 18px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-table-grid, .viewer-layout { grid-template-columns: 380px minmax(0, 1fr); }
.table-list, .checkbox-list { display: grid; gap: 14px; }
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; width: 100%; }
.checkbox-row input { width: 18px; min-height: auto; margin-top: 2px; }
.layer-filter {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--layer-color) 28%, white);
  background: color-mix(in srgb, var(--layer-color) 10%, white);
}
.layer-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--layer-color);
  border: 1px solid rgba(31, 42, 33, 0.18);
}
.layer-filter-name {
  font-weight: 600;
  line-height: 1.35;
}
.user-access-card, .project-list-card {
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-soft);
}
.project-list-card form { margin-top: 14px; }
.svg-admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.svg-admin-actions,
.svg-admin-library {
  min-width: 0;
}
.svg-admin-buttons {
  display: grid;
  gap: 12px;
}
.svg-library-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  overflow: hidden;
}
.svg-library-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
  color: var(--green-dark);
}
.svg-library-panel summary::-webkit-details-marker {
  display: none;
}
.svg-library-panel[open] summary {
  border-bottom: 1px solid var(--line);
}
.svg-library-list {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
}
.user-access-header { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 8px; }
#map { width: 100%; min-height: calc(100vh - 180px); border-radius: 22px; border: 1px solid var(--line); overflow: hidden; }
.qgis2web-layout {
  display: block;
}
.qgis2web-map-card {
  padding: 0;
  overflow: hidden;
}
.qgis2web-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 132px);
  border: 0;
}
.status-error { color: var(--danger); }
.status-success { color: var(--success); }
.hidden-status { display: none; }
.identify-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.identify-results {
  display: grid;
  gap: 10px;
}
.identify-popup-title,
.identify-results-title {
  font-weight: 800;
  margin-bottom: 10px;
}
.identify-popup-body,
.identify-detail-body {
  margin-top: 10px;
}
.identify-group {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}
.identify-group:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.identify-group-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.identify-group-list {
  display: grid;
  gap: 6px;
}
.identify-item,
.identify-detail-back {
  width: 100%;
  text-align: left;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  cursor: pointer;
}
.identify-item:hover,
.identify-detail-back:hover {
  background: #ecefe7;
}
@media (max-width: 980px) {
  .form-grid, .admin-table-grid, .viewer-layout { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .svg-admin-layout { grid-template-columns: 1fr; }
}
