:root {
  --green: #1f7a3a;
  --green-2: #155a2b;
  --line: #d6e3da;
  --text: #1a2a20;
  --bg: #f3f8f5;
  --card: #ffffff;
  --danger: #a33232;
  --info-bg: #f2f7ff;
  --info-line: #cdddff;
  --info-text: #1f427c;
  --success-bg: #f5fbf7;
  --success-line: #d5e7da;
  --success-text: #19472a;
  --warning-bg: #fff8e8;
  --warning-line: #f0ddb1;
  --warning-text: #7b5b00;
  --error-bg: #fff3f3;
  --error-line: #efc6c6;
  --error-text: #8a1c1c;
}

* {
  box-sizing: border-box;
}

body.app-colture-page {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1380px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
}

.header,
.sidebar,
.detail,
.map-panel {
  padding: 16px;
}

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

.title {
  margin: 0;
  color: var(--green);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  border: 1px solid #d7e6db;
  background: #f8fcf9;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.btn {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: var(--green-2);
  border-color: var(--green-2);
}

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

.btn.secondary:hover {
  color: #fff;
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.link-btn {
  text-decoration: none;
}

.status {
  border: 1px solid var(--success-line);
  background: var(--success-bg);
  color: var(--success-text);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 0.88rem;
}

.status.info,
.status.loading {
  border-color: var(--info-line);
  background: var(--info-bg);
  color: var(--info-text);
}

.status.warning {
  border-color: var(--warning-line);
  background: var(--warning-bg);
  color: var(--warning-text);
}


.sidebar-alert {
  background: var(--info-bg);
  border: 1px solid var(--info-line);
  border-radius: 8px;
  color: var(--info-text);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 10px;
}

.sidebar-alert.has-warning {
  background: var(--warning-bg);
  border-color: var(--warning-line);
  color: var(--warning-text);
}

.item.needs-attention {
  border-color: var(--warning-line);
  background: #fffdf7;
}

.status.error {
  border-color: var(--error-line);
  background: var(--error-bg);
  color: var(--error-text);
}

.content {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  min-height: 76vh;
  align-items: start;
}

.sidebar {
  padding: 14px;
  padding-bottom: 180px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overflow-x: hidden;
  scroll-padding-bottom: 180px;
}

.sidebar h2,
.detail h2,
.map-panel h2 {
  margin: 0;
  color: #244532;
}

.search,
input,
select,
textarea {
  width: 100%;
  border: 1px solid #c7d7cc;
  border-radius: 9px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}

.field-sort-control,
.field-filter-control {
  display: grid;
  gap: 6px;
}

.field-sort-control label,
.field-filter-control label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #244532;
}

.list-loading {
  border: 1px dashed #cdddff;
  background: #f8fbff;
  color: var(--info-text);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.9rem;
}

.list-loading.hidden,
.hidden {
  display: none;
}

.list {
  border: 1px solid #d8e4db;
  border-radius: 10px;
  overflow-y: visible;
  overflow-x: hidden;
  min-height: 220px;
  background: #fff;
}

.field-groups-panel {
  border: 1px solid #d8e4db;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #fbfdfc;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.field-groups-panel h2 {
  margin: 0;
  font-size: 1.02rem;
}

.selected-group-indicator {
  border: 1px solid #cfe1d4;
  background: #e8f4ec;
  border-radius: 8px;
  color: #244532;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 8px;
}

.item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px;
  border-bottom: 1px solid #eff5f1;
  cursor: pointer;
  display: grid;
  gap: 4px;
  font: inherit;
}

.field-group-heading {
  background: #f1f7f3;
  border-bottom: 1px solid #d8e4db;
  color: #244532;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 8px 10px;
  text-transform: uppercase;
}

.item:hover {
  background: #f6fbf8;
}

.item.active {
  background: #e8f4ec;
}

.item-name {
  font-weight: 700;
}

.item-meta {
  font-size: 0.84rem;
  opacity: 0.8;
}

.item-status {
  font-size: 0.82rem;
  font-weight: 700;
}

.item-status.full {
  color: var(--success-text);
}

.item-status.partial {
  color: var(--warning-text);
}

.item-status.empty {
  color: var(--info-text);
}

.empty-list {
  padding: 12px;
  font-size: 0.92rem;
  opacity: 0.78;
}

.main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.map-panel {
  display: grid;
  gap: 10px;
}

.map-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.field-map {
  border: 1px solid #d8e4db;
  border-radius: 10px;
  height: 360px;
  min-height: 320px;
  overflow: hidden;
  width: 100%;
}

.field-map .leaflet-popup-content {
  margin: 10px 12px;
}

.field-map-label {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #bdd1c4;
  border-radius: 4px;
  box-shadow: none;
  color: #173c25;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 5px;
}

.detail {
  display: grid;
  gap: 12px;
  align-content: start;
}

.detail-head,
.form-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.detail-meta {
  margin-top: 4px;
  font-size: 0.9rem;
  opacity: 0.8;
}

.rows {
  display: grid;
  gap: 8px;
}

.row-card {
  border: 1px solid #d8e4db;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfdfc;
  display: grid;
  gap: 6px;
}

.row-title {
  font-weight: 700;
  color: #244532;
}

.row-note {
  font-size: 0.88rem;
  opacity: 0.82;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form {
  border: 1px solid #d8e4db;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 12px;
  background: #fbfdfc;
}

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

label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.84rem;
  font-weight: 600;
}

.field-label-row {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 5px;
}

.inline-action {
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}

.inline-action:hover {
  color: var(--green-2);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-backdrop {
  align-items: center;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 1000;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  max-width: 520px;
  width: 100%;
}

.modal-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.modal-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.success-modal {
  max-width: 420px;
}

.modal-success-content {
  align-items: center;
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: 22px;
  text-align: center;
}

.modal-success-content strong {
  color: var(--success-text);
  font-size: 1.08rem;
}

@media (max-width: 960px) {
  .content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-bottom: 14px;
  }

  .list {
    max-height: none;
  }

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

  .map-head,
  .detail-head,
  .form-head {
    flex-direction: column;
  }

  .field-map {
    height: 320px;
    min-height: 280px;
  }
}
