*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 1200px;
  min-height: 100vh;
  padding: 1rem;
  font-family: Arial, sans-serif;
  overflow-x: hidden;
}

.container {
  margin: 0;
  padding: 0;
}

.is-hidden {
  display: none;
}

h1 {
  margin: 0 0 1rem;
}

.status {
  margin: 0.6rem 0;
  font-size: 0.9rem;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.1rem 0 0.8rem;
}

.filter-row .form-input {
  max-width: 280px;
  min-height: 2.6rem;
  padding: 0.45rem 0.6rem;
  font-size: 1rem;
}

.table-wrapper {
  margin-top: 1rem;
  overflow-x: auto;
}

.textbausteine-table-block + .textbausteine-table-block {
  margin-top: 1.5rem;
}

.textbausteine-caption {
  caption-side: top;
  text-align: left;
  font-weight: bold;
  font-size: 1.05rem;
  padding: 0 0 0.45rem;
}

#textbausteine-abkuerzungen-table .textbausteine-copy-button {
  padding: 0.25rem 0.45rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

#textbausteine-db-table {
  table-layout: fixed;
  width: 100%;
}

#textbausteine-db-table col.textbausteine-col-action {
  width: 7.5rem;
}

#textbausteine-db-table col.textbausteine-col-nummer {
  width: 5.75rem;
}

#textbausteine-db-table col.textbausteine-col-text {
  width: 42%;
}

#textbausteine-db-table .textbausteine-col-action {
  white-space: nowrap;
  padding-left: 0.5rem;
  padding-right: 0.65rem;
}

#textbausteine-db-table .textbausteine-col-nummer {
  white-space: nowrap;
  text-align: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

#textbausteine-db-table .textbausteine-col-action .edit-button {
  padding: 0.25rem 0.45rem;
  font-size: 0.78rem;
}

.container > .action-button {
  margin: 0.7rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border: 1px solid #ccc;
  padding: 0.5rem;
  text-align: left;
  font-size: 0.9rem;
}

thead th {
  background: #f3f3f3;
}

#scoutliste-table tbody tr.scoutliste-row-admin td {
  background-color: #e8f4fc;
}

.sortable-header {
  cursor: pointer;
}

.edit-button {
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.detail-top {
  margin: 0.5rem 0;
}

.detail-row {
  margin: 0.4rem 0;
  font-size: 0.95rem;
}

.form-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: start;
  column-gap: 0.75rem;
  width: 100%;
  margin: 0.4rem 0;
}

.form-label {
  display: inline-block;
  font-size: 0.95rem;
  padding-top: 0.35rem;
}

.form-input {
  width: 100%;
  min-width: 0;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
}

.status-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.status-controls .form-input {
  flex: 1 1 auto;
}

.status-dev-button {
  flex: 0 0 auto;
  min-height: 2.2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid #999;
  background: #f3f3f3;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
}

#detail-assignment select.form-input,
#detail-result select.form-input {
  min-height: 2.2rem;
  padding: 0.35rem 0.5rem;
}

#detail-assignment input.form-input,
#detail-result input.form-input {
  min-height: 2.2rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ccc;
}

.date-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 14rem;
}

.date-input-wrap .date-input {
  width: 100%;
  padding-right: 2.5rem;
}

.date-input-trigger {
  position: absolute;
  right: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #444;
  cursor: pointer;
}

.date-input-trigger:hover,
.date-input-trigger:focus-visible {
  background: #eee;
  color: #111;
}

.date-input-icon {
  display: block;
}

#detail-description input.form-input {
  min-height: 2.2rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ccc;
}

.detail-textarea {
  width: 100%;
  min-height: 8rem;
  padding: 0.5rem;
  border: 1px solid #ccc;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
  resize: vertical;
}

.detail-map {
  height: 320px;
  border: 1px solid #ccc;
  width: 100%;
}

#gesamtuebersicht-map {
  height: calc(100vh - 220px);
  min-height: 420px;
}

.detail-photo {
  display: block;
  max-width: 100%;
  max-height: 500px;
  border: 1px solid #ccc;
  object-fit: contain;
}

.photo-info {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #444;
}

.map-info {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #444;
}

#detail-actions {
  margin-top: 0.8rem;
}

.action-button {
  display: block;
  width: 100%;
  padding: 0.65rem 0.8rem;
  margin: 0.4rem 0;
  font-family: Arial, sans-serif;
  font-size: 1rem;
  border: 1px solid #999;
  cursor: pointer;
}

.action-button-save {
  background: #e8f3ff;
}

.action-button-cancel {
  background: #f3f3f3;
}

.action-button-delete {
  background: #fde8e8;
  border-color: #c62828;
  color: #1a1a1a;
}

.nzu1-page .container {
  max-width: 980px;
}

.nzu1-page .container > * {
  margin-bottom: 1rem;
}

.nzu1-page .status {
  margin: 0.9rem 0 1.1rem;
}

.nzu1-page .form-row {
  margin: 0.9rem 0;
}

.nzu1-page .action-button {
  margin: 0.7rem 0;
}

.nzu1-page .table-wrapper {
  margin-top: 0.9rem;
}

.ueberfaellig-page .container > .action-button {
  margin: 0.9rem 0;
}

.ueberfaellig-page .form-row {
  margin: 0.9rem 0;
}

.ueberfaellig-page #field-status-filter.form-input {
  min-height: 2.6rem;
  padding: 0.45rem 0.6rem;
  font-size: 1rem;
}

.ueberfaellig-page #field-anzahl-tage.form-input {
  min-height: 2.6rem;
  padding: 0.45rem 0.6rem;
  font-size: 1rem;
}

.ueberfaellig-page .table-wrapper {
  margin-top: 1.2rem;
}

.polygon-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0 0.2rem;
  font-size: 0.95rem;
}

.polygon-toggle-text {
  font-weight: 900 !important;
}

/* Polygon-Beschriftung (wie im Polygone-Projekt) */
.name-label {
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 12px;
  font-weight: bold;
  color: #1f4d1f;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff;
}

.popup-edit-button {
  margin-top: 0.5rem;
  padding: 0.4rem 0.7rem;
  min-height: 2rem;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
}

#edit-dialog .form-input {
  min-height: 2.4rem;
  padding: 0.4rem 0.55rem;
}

#edit-dialog .action-button {
  margin-top: 0.85rem;
}

#edit-dialog {
  border: 1px solid #b9b9b9;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  width: min(96vw, 520px);
  max-width: 100%;
  box-sizing: border-box;
}

.scoutliste-edit-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: min(70vh, 28rem);
  overflow-y: auto;
  margin-bottom: 0.35rem;
}

#textbausteine-edit-dialog,
#autoaktionen-edit-dialog {
  border: 1px solid #b9b9b9;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  width: min(96vw, 1100px);
  max-width: 1200px;
  min-width: min(96vw, 320px);
  box-sizing: border-box;
  padding: 0.35rem 0.15rem 0.5rem;
}

#textbausteine-edit-form,
#autoaktionen-edit-form {
  padding: 0.35rem 0.85rem 0.85rem;
}

#textbausteine-edit-form > h2,
#autoaktionen-edit-form > h2 {
  margin: 0.35rem 0 1.1rem;
}

#textbausteine-edit-dialog .form-row,
#autoaktionen-edit-dialog .form-row {
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
  row-gap: 0.45rem;
  margin: 0;
}

#textbausteine-edit-dialog .form-label,
#autoaktionen-edit-dialog .form-label {
  padding-top: 0.55rem;
}

#textbausteine-edit-dialog .form-input,
#autoaktionen-edit-dialog .form-input {
  padding: 0.5rem 0.65rem;
}

#textbausteine-edit-dialog .action-button,
#autoaktionen-edit-dialog .action-button {
  margin-top: 1.15rem;
}

.textbausteine-edit-fields,
.autoaktionen-edit-fields {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  max-height: min(72vh, 42rem);
  overflow-y: auto;
  padding: 0.15rem 0.5rem 0.35rem 0;
}

#textbausteine-edit-dialog textarea.form-input.detail-textarea,
#autoaktionen-edit-dialog textarea.form-input.detail-textarea {
  min-height: 14rem;
  line-height: 1.45;
  resize: vertical;
}

.autoaktionen-hinweis {
  margin: 0.75rem 0 1rem;
  line-height: 1.45;
}

.menue-counter-hint {
  margin: 1.25rem 0 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid #c9a227;
  border-radius: 6px;
  background: #fff8dc;
  line-height: 1.45;
  max-width: 36rem;
}

.kommunikation-section {
  margin: 0;
  width: 100%;
  max-width: 52rem;
}

.kommunikation-section-divider {
  margin: 1.25rem 0 0.75rem;
  border: 0;
  border-top: 1px solid #ccc;
}

.kommunikation-section-heading {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.kommunikation-page .form-row {
  width: 100%;
}

.kommunikation-page .form-input {
  min-height: 2.2rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ccc;
}

.kommunikation-page textarea.form-input.detail-textarea {
  min-height: 6rem;
  resize: vertical;
}

.kommunikation-page > .action-button,
#kommunikation-actions .action-button {
  width: 100%;
  box-sizing: border-box;
}

.kommunikation-page > .action-button {
  margin-bottom: 0.25rem;
}

#kommunikation-actions {
  margin-top: 1.25rem;
}

#kommunikation-actions .action-button + .action-button {
  margin-top: 0.25rem;
}

.datenimport-link-hint {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}

.datenimport-subheading {
  margin: 1rem 0 0.35rem;
  font-size: 1.05rem;
}

.datenimport-mappings-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
}

.datenimport-mappings-table th,
.datenimport-mappings-table td {
  border: 1px solid #ccc;
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.datenimport-mappings-table th {
  background: #f3f3f3;
}

.datenimport-mappings {
  margin-bottom: 0.5rem;
}

.datenimport-hint {
  margin: 0.75rem 0 0.5rem;
  line-height: 1.45;
}

.datenimport-page .action-button-save {
  width: 100%;
  box-sizing: border-box;
  margin: 0.5rem 0 1rem;
}

.datenimport-log {
  min-height: 18rem;
}

  cursor: help;
}

.autoaktionen-floating-tooltip {
  position: fixed;
  z-index: 1000;
  width: max-content;
  max-width: min(22rem, 90vw);
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #1a1a1a;
  background: #fff9e6;
  border: 1px solid #c9b458;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  white-space: normal;
  pointer-events: none;
}

.aktionslog-label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.9rem;
}

.aktionslog-view {
  min-height: min(70vh, 48rem);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: pre;
  overflow-x: auto;
}

.autoaktionen-info-value {
  margin: 0;
  padding: 0.35rem 0;
  line-height: 1.45;
  align-self: center;
  font-family: inherit;
  font-size: 1rem;
  border: none;
  background: transparent;
  box-shadow: none;
}

.delete-confirm-dialog {
  border: 1px solid #b9b9b9;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  padding: 1rem 1.1rem;
  max-width: 22rem;
}

.delete-confirm-dialog__text {
  margin: 0 0 1rem;
  font-family: Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.35;
}

.delete-confirm-dialog__buttons {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.delete-confirm-dialog__buttons .action-button {
  margin: 0;
}

@media (max-width: 640px) {
  body {
    padding: 0.75rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    row-gap: 0.35rem;
  }

  .form-label {
    padding-top: 0;
  }

  #gesamtuebersicht-map {
    height: calc(100vh - 190px);
    min-height: 360px;
  }

  .kommunikation-page h1 {
    font-size: 1.35rem;
  }

  .kommunikation-section-divider {
    margin: 1rem 0 0.65rem;
  }

  .kommunikation-page > .action-button,
  #kommunikation-actions .action-button {
    width: 100%;
    max-width: none;
  }
}
