:root {
  --ink: #203e35;
  --green: #285848;
  --mint: #eaf2e9;
  --paper: #f7f8f3;
  --line: #dde3d9;
  --muted: #6d7e73;
  --white: #fff;
  --amber: #9b681e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    14px/1.5 system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 9px 13px;
  border-radius: 9px;
  transition: background 0.15s;
}
button:hover {
  background: #eef3eb;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #b88436;
  outline-offset: 3px;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover {
  background: #183f31;
}
.quiet {
  background: transparent;
}
.danger {
  color: #a44236;
}
input,
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid #cdd7cb;
  border-radius: 8px;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #87a990;
}
textarea {
  min-height: 70px;
  resize: vertical;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font:
    500 clamp(25px, 3vw, 38px) / 1.15 Georgia,
    serif;
  letter-spacing: -1px;
}
h2 {
  font:
    500 23px Georgia,
    serif;
}
h3 {
  font-size: 14px;
}
small,
.muted {
  color: var(--muted);
}
header {
  height: 83px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
  gap: 15px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.seal {
  width: 40px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 20px 20px 5px 5px;
  background: var(--green);
  color: #d5e7bd;
  font-size: 26px;
}
.brand b {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.1px;
}
.brand small {
  display: block;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.saved {
  font-size: 12px;
  color: var(--muted);
  margin-right: 8px;
}
.workspace {
  max-width: 1700px;
  margin: auto;
  padding: 25px 30px;
}
.heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.heading p {
  color: var(--muted);
  margin-top: 7px;
  font-size: 13px;
}
.switch {
  display: inline-flex;
  padding: 4px;
  background: #e9ede4;
  border-radius: 10px;
  gap: 3px;
}
.switch button {
  border: 0;
  background: transparent;
  padding: 7px 15px;
}
.switch button.active {
  background: white;
  box-shadow: 0 1px 4px #183c2610;
}
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #e5d6b9;
  background: #fcf7eb;
  border-radius: 10px;
  padding: 10px 15px;
  margin-bottom: 18px;
  font-size: 12px;
}
.notice b {
  color: #805c22;
}
.notice button {
  font-size: 12px;
  white-space: nowrap;
  background: #fffaf0;
  border-color: #d9c5a0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-bottom: 20px;
}
.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat strong {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
}
.stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.stat .dot {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 0 6px #f4f6ef;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7e9185;
  margin-right: 5px;
}
.frei {
  background: #d4e8d3;
}
.belegt {
  background: #52796c;
}
.reserviert {
  background: #e0bd77;
}
.ungeklaert {
  background: #d8dcdf;
}
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 325px;
  gap: 18px;
  align-items: start;
}
.map-card,
.panel,
.table-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.map-head h3 {
  font-weight: 600;
}
.map-head small {
  font-size: 11px;
}
.map-tools {
  display: flex;
  gap: 5px;
}
.map-tools button {
  padding: 6px 9px;
  font-size: 12px;
}
.map-tools button.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.map-wrap {
  height: 560px;
  position: relative;
  background: #eef1e7;
  overflow: hidden;
}
.map-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}
.map-wrap[data-tool="add"] svg,
.map-wrap[data-tool="block"] svg {
  cursor: crosshair;
}
.map-wrap[data-tool="pan"] svg {
  cursor: grab;
}
.map-wrap[data-tool="move"] .grave {
  cursor: move;
}
.map-caption {
  position: absolute;
  top: 14px;
  left: 16px;
  background: #ffffffed;
  padding: 7px 10px;
  border: 1px solid #e0e5da;
  border-radius: 8px;
  font-size: 11px;
  pointer-events: none;
}
.zoom {
  position: absolute;
  right: 14px;
  bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.zoom button {
  font-size: 18px;
  padding: 5px 12px;
  box-shadow: 0 2px 10px #23402c0a;
}
.north {
  position: absolute;
  right: 20px;
  top: 18px;
  display: grid;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  pointer-events: none;
}
.north b {
  font-size: 22px;
  font-weight: 400;
}
.map-footer {
  padding: 11px 17px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}
.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.map-label {
  fill: #6d8170;
  font: 11px system-ui;
  letter-spacing: 1px;
}
.grave rect {
  stroke: white;
  stroke-width: 1.1;
}
.grave text {
  font: 5.7px system-ui;
  fill: #fff;
  pointer-events: none;
  paint-order: stroke;
  stroke: #203e3530;
  stroke-width: 0.3;
}
.grave[data-status="frei"] rect {
  fill: #b7d2b5;
}
.grave[data-status="belegt"] rect {
  fill: #52796c;
}
.grave[data-status="reserviert"] rect {
  fill: #d5b16e;
}
.grave[data-status="ungeklaert"] rect {
  fill: #a5b0b4;
}
.grave[data-status="frei"] text,
.grave[data-status="reserviert"] text,
.grave[data-status="ungeklaert"] text {
  fill: #213f34;
}
.grave.selected rect {
  stroke: #f4c86e;
  stroke-width: 3;
}
.grave.faded {
  opacity: 0.13;
}
.grave:hover rect {
  stroke: #244d41;
  stroke-width: 2;
}
.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side.has-selection .detail-panel {
  order: -1;
}
.panel {
  padding: 19px;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.panel-title .badge {
  font-size: 10px;
  background: #eff3e9;
  color: #677b67;
  padding: 3px 7px;
  border-radius: 5px;
}
.search-wrap {
  margin-bottom: 10px;
}
.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.results {
  max-height: 215px;
  overflow: auto;
  margin: 13px -7px -5px;
}
.result {
  display: flex;
  width: 100%;
  justify-content: space-between;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #eef0e9;
  border-radius: 6px;
  padding: 9px 7px;
  gap: 10px;
}
.result.selected {
  background: #eff4eb;
}
.result strong {
  font-size: 12px;
}
.result small {
  display: block;
  font-size: 11px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result .dot {
  margin-top: 5px;
  flex-shrink: 0;
}
.result-id {
  display: flex;
  gap: 7px;
}
.empty {
  padding: 22px 5px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.detail-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
}
.detail-head h2 {
  font-size: 28px;
}
.detail-meta {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
label {
  display: block;
  font-size: 11px;
  color: #647a6b;
  margin-bottom: 10px;
}
label input,
label select,
label textarea {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.actions .primary {
  flex: 1;
}
.hint {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  padding: 10px 0 0;
}
.mini-note {
  padding: 13px 16px;
  background: #edf1e7;
  border-radius: 10px;
  font-size: 11px;
  color: #69806c;
}
.mini-note strong {
  display: block;
  color: #3b5e48;
  margin-bottom: 3px;
}
details {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  margin-top: 10px;
}
summary {
  font-size: 11px;
  cursor: pointer;
  margin-bottom: 9px;
}
.bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 11px;
  padding-top: 18px;
}
.bottom button {
  font-size: 11px;
  padding: 0;
  border: 0;
  background: none;
  text-decoration: underline;
}
.table-card {
  padding: 18px;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}
th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf0e9;
}
tbody tr {
  cursor: pointer;
}
tbody tr:hover {
  background: #f4f7ef;
}
.table-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #234e3e;
  color: white;
  padding: 12px 20px;
  border-radius: 9px;
  box-shadow: 0 5px 35px #16352730;
  z-index: 20;
  max-width: 90vw;
  font-size: 13px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  max-width: 590px;
  width: calc(100% - 30px);
  color: var(--ink);
  box-shadow: 0 20px 80px #193c3625;
}
dialog::backdrop {
  background: #19362a66;
  backdrop-filter: blur(3px);
}
dialog h2 {
  margin-bottom: 15px;
}
dialog p {
  margin: 10px 0;
  font-size: 13px;
  color: #58715f;
}
dialog ul {
  font-size: 13px;
  padding-left: 20px;
}
.pill {
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 5px;
  background: #f6edde;
  color: #8c622c;
}
.hidden {
  display: none !important;
}
.print-title {
  display: none;
}
.due {
  color: #a26423;
  font-size: 10px;
  display: block;
}
.footer-space {
  height: 5px;
}
.gps-panel {
  background: #f0f5ed;
}
.gps-line {
  font-size: 11px;
  color: #557161;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.gps-panel button {
  font-size: 11px;
}
.gps-marker {
  pointer-events: none;
}
.gps-marker circle {
  vector-effect: non-scaling-stroke;
}
.anchor-marker {
  pointer-events: none;
}
#mapWrap[data-tool="anchor"] svg {
  cursor: crosshair;
}
#refForm label {
  font-size: 12px;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.gps-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
@media (min-width: 1450px) {
  .map-wrap {
    height: 650px;
  }
}
@media (max-width: 1050px) {
  .main-grid {
    grid-template-columns: minmax(0, 1fr) 290px;
  }
  .workspace {
    padding: 20px;
  }
  .map-wrap {
    height: 570px;
  }
  .map-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .saved {
    display: none;
  }
}
@media (max-width: 760px) {
  header {
    padding: 12px 16px;
    height: auto;
  }
  .brand b {
    font-size: 15px;
  }
  .brand small {
    font-size: 9px;
  }
  .seal {
    width: 32px;
    height: 38px;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions button {
    font-size: 11px;
    padding: 7px 9px;
  }
  .workspace {
    padding: 20px 13px;
  }
  .heading {
    align-items: flex-start;
    gap: 9px;
  }
  .heading p {
    font-size: 11px;
  }
  .switch button {
    padding: 7px 9px;
    font-size: 12px;
  }
  .notice {
    align-items: flex-start;
    font-size: 11px;
    padding: 10px;
    flex-wrap: wrap;
  }
  .stats {
    gap: 7px;
    margin-bottom: 13px;
  }
  .stat {
    padding: 11px 10px;
  }
  .stat strong {
    font-size: 23px;
  }
  .stat span {
    font-size: 10px;
  }
  .stat .dot {
    display: none;
  }
  .main-grid {
    grid-template-columns: 1fr;
  }
  .map-wrap {
    height: 480px;
  }
  .map-head {
    flex-direction: row;
    align-items: center;
    padding: 12px;
    flex-wrap: wrap;
  }
  .map-head h3 {
    font-size: 12px;
  }
  .map-head small {
    font-size: 10px;
  }
  .map-tools {
    flex-wrap: wrap;
  }
  .map-tools button {
    font-size: 11px;
  }
  .map-caption {
    font-size: 10px;
    max-width: 72%;
    top: 9px;
    left: 9px;
  }
  .side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .panel {
    padding: 14px;
  }
  .side .detail-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .side .mini-note {
    grid-column: 1;
  }
  .filter-row {
    grid-template-columns: 1fr;
  }
  .results {
    max-height: 320px;
  }
  .bottom {
    font-size: 10px;
    flex-direction: column;
    gap: 7px;
  }
  .map-footer {
    font-size: 10px;
    gap: 6px;
  }
  .north {
    right: 13px;
  }
}
@media (max-width: 480px) {
  .side {
    display: flex;
  }
  .results {
    max-height: 170px;
  }
  .map-wrap {
    height: 410px;
  }
  .header-actions .print-btn {
    display: none;
  }
  .heading {
    flex-wrap: wrap;
  }
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
  .stat strong {
    font-size: 21px;
  }
  .legend {
    gap: 8px;
  }
}
@media print {
  @page {
    size: A4 landscape;
    margin: 12mm;
  }
  body {
    background: white;
    font-size: 10px;
  }
  header,
  .heading,
  .notice,
  .stats,
  .side,
  .map-tools,
  .zoom,
  .north,
  .bottom,
  .toast,
  dialog,
  .map-caption {
    display: none !important;
  }
  .workspace {
    padding: 0;
  }
  .main-grid {
    display: block;
  }
  .map-card {
    display: block !important;
    border: 0;
  }
  .map-wrap {
    height: 148mm;
    background: #f5f6ef !important;
    break-inside: avoid;
  }
  .map-head {
    padding: 5px 0;
  }
  .map-footer {
    padding: 5px 0;
  }
  .print-title {
    display: block;
    margin-bottom: 8px;
  }
  .table-card {
    display: block !important;
    margin-top: 12px;
    border: 0;
    padding: 0;
    overflow: visible;
  }
  table {
    font-size: 9px;
  }
  tr {
    break-inside: avoid;
  }
  thead {
    display: table-header-group;
  }
  .table-heading {
    display: none;
  }
  th,
  td {
    padding: 5px;
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.auth-card {
  max-width: 460px;
  margin: 10vh auto;
  padding: 32px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.auth-card p {
  margin: 14px 0;
}
.auth-card label {
  font-size: 13px;
  margin-top: 14px;
}
.auth-card button {
  margin-top: 10px;
}
.header-actions form {
  display: inline;
}
.header-actions a {
  font-size: 11px;
  color: var(--green);
}
#accountName {
  font-size: 11px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.readonly .map-tools button[data-tool="add"],
.readonly .map-tools button[data-tool="block"],
.readonly .map-tools button[data-tool="move"],
.readonly #newFromPanel,
.readonly #importBtn,
.readonly #anchorBtn,
.readonly #clearAnchors {
  display: none;
}
.readonly .detail-panel .actions {
  display: none;
}
.readonly .detail-panel input,
.readonly .detail-panel textarea,
.readonly .detail-panel select {
  background: #f5f7f1;
  color: #4c6556;
}
.server-warning {
  outline: 2px solid #b57527;
}
@media (max-width: 760px) {
  header {
    flex-wrap: wrap;
  }
  .header-actions {
    flex-wrap: wrap;
  }
  #accountName {
    display: none;
  }
  .auth-card {
    margin: 25px 14px;
  }
}
