/* ==========================================================================
   Weihnachtsmarkt LLGym – Gestaltung
   ========================================================================== */

:root {
  --pine-950: #071f17;
  --pine-900: #0b2e23;
  --pine-800: #0f3d2e;
  --pine-700: #155239;
  --pine-600: #1d6b4a;
  --pine-50: #eef7f1;
  --gold: #e9b949;
  --gold-600: #c9962a;
  --gold-soft: #fbf0d3;

  /* grün = mit Strom, rot = ohne Strom */
  --power: #138a52;
  --power-bright: #34d98a;
  --power-soft: #e2f5e9;
  --power-ink: #0b4f2f;
  --nopower: #d42a3c;
  --nopower-bright: #ff5a6a;
  --nopower-soft: #fdeaec;
  --nopower-ink: #7d1220;

  --ok: #1d8a52;
  --ok-soft: #e2f5e9;
  --ok-ink: #0b4f2f;

  --ink: #1b2420;
  --ink-2: #3a4740;
  --muted: #65726b;
  --line: #e7e1d5;
  --line-strong: #d5cdbd;
  --bg: #f6f2ea;
  --card: #ffffff;
  --soft: #faf7f1;

  --danger: #b42318;
  --danger-soft: #fdeceb;
  --warn: #8a5300;
  --warn-soft: #fff3dc;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 24, 0.06), 0 10px 30px rgba(16, 32, 24, 0.08);
  --shadow-lg: 0 30px 80px rgba(4, 20, 14, 0.35);

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --gutter: 16px;

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow-x: clip;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
}

p {
  margin: 0;
}

a {
  color: var(--pine-600);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.ico {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico--fill {
  fill: currentColor;
  stroke: none;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Schnee
   -------------------------------------------------------------------------- */
.snow {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.flake {
  position: absolute;
  top: 0;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  opacity: var(--o);
  animation: flake-fall var(--d) linear var(--delay) infinite;
  will-change: transform;
}

.flake::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-12 -12 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg id='a'%3E%3Cpath d='M0-11V11M-3.2-8.6 0-5.8 3.2-8.6M-3.2 8.6 0 5.8 3.2 8.6'/%3E%3C/g%3E%3Cg transform='rotate(60)'%3E%3Cpath d='M0-11V11M-3.2-8.6 0-5.8 3.2-8.6M-3.2 8.6 0 5.8 3.2 8.6'/%3E%3C/g%3E%3Cg transform='rotate(120)'%3E%3Cpath d='M0-11V11M-3.2-8.6 0-5.8 3.2-8.6M-3.2 8.6 0 5.8 3.2 8.6'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  animation: flake-sway var(--sw) ease-in-out var(--delay) infinite alternate;
}

.flake--b::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-12 -12 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0-10.5V10.5M-2.4-4.6 0-2.6 2.4-4.6M-2.4 4.6 0 2.6 2.4 4.6'/%3E%3Cg transform='rotate(60)'%3E%3Cpath d='M0-10.5V10.5M-2.4-4.6 0-2.6 2.4-4.6M-2.4 4.6 0 2.6 2.4 4.6'/%3E%3C/g%3E%3Cg transform='rotate(120)'%3E%3Cpath d='M0-10.5V10.5M-2.4-4.6 0-2.6 2.4-4.6M-2.4 4.6 0 2.6 2.4 4.6'/%3E%3C/g%3E%3Ccircle r='1.6' fill='white' stroke='none'/%3E%3C/svg%3E");
}

@keyframes flake-fall {
  from {
    transform: translate3d(0, calc(-1 * var(--s) - 10px), 0);
  }
  to {
    transform: translate3d(0, var(--fall, 600px), 0);
  }
}

@keyframes flake-sway {
  from {
    transform: translateX(calc(-1 * var(--drift))) rotate(0deg);
  }
  to {
    transform: translateX(var(--drift)) rotate(var(--rot));
  }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-weight: 650;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.05s;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.preset:focus-visible,
.tab:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--pine-600);
  color: #fff;
  box-shadow: 0 2px 0 var(--pine-800), 0 6px 16px rgba(21, 82, 57, 0.25);
}

.btn-primary:hover {
  background: var(--pine-700);
}

.btn-gold {
  background: var(--gold);
  color: var(--pine-950);
  box-shadow: 0 2px 0 var(--gold-600);
}

.btn-gold:hover {
  background: #f0c55f;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ink-2);
}

.btn-soft {
  background: var(--pine-50);
  color: var(--pine-700);
  border-color: #cfe6d8;
}

.btn-soft:hover {
  background: #e1f0e7;
}

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

.btn-danger:hover {
  background: var(--danger-soft);
}

.btn-danger-solid {
  background: var(--danger);
  color: #fff;
}

.btn-light {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.btn-light:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-sm {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 0.92rem;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

.btn .ico {
  width: 18px;
  height: 18px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.icon-btn--plain {
  border-color: transparent;
  background: transparent;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--pine-600);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Formulare
   -------------------------------------------------------------------------- */
.field {
  display: grid;
  gap: 6px;
  margin: 0 0 18px;
  min-width: 0;
}

.field > label,
.field-label,
fieldset > legend {
  font-weight: 650;
  font-size: 0.98rem;
  color: var(--ink);
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 18px;
  min-width: 0;
}

fieldset > legend {
  padding: 0;
  margin-bottom: 8px;
}

.req {
  color: var(--danger);
}

input[type='text'],
input[type='password'],
input[type='number'],
input[type='search'],
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 16px; /* verhindert Auto-Zoom auf dem iPhone */
  line-height: 1.35;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2365726b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

input::placeholder,
textarea::placeholder {
  color: #9aa49f;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--pine-600);
  box-shadow: 0 0 0 4px rgba(29, 107, 74, 0.16);
}

.is-invalid input,
.is-invalid select,
.is-invalid textarea,
input.is-invalid {
  border-color: var(--danger);
}

.field-error {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}

.help {
  font-size: 0.88rem;
  color: var(--muted);
}

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

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.choice input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--pine-600);
}

.choice:has(input:checked) {
  border-color: var(--pine-600);
  background: var(--pine-50);
}

.choice:has(input:focus-visible) {
  box-shadow: 0 0 0 4px rgba(29, 107, 74, 0.16);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 600;
  cursor: pointer;
}

.check input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex: none;
  accent-color: var(--pine-600);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  cursor: pointer;
}

.switch input {
  appearance: none;
  position: relative;
  width: 48px;
  height: 28px;
  margin: 0;
  flex: none;
  border-radius: 99px;
  background: #cbc4b5;
  cursor: pointer;
  transition: background-color 0.2s;
}

.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}

.switch input:checked {
  background: var(--pine-600);
}

.switch input:checked::after {
  transform: translateX(20px);
}

.switch input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Hinweise
   -------------------------------------------------------------------------- */
.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  line-height: 1.45;
}

.note > .ico {
  margin-top: 1px;
}

.note strong {
  font-weight: 700;
}

.note--info {
  background: #edf3fb;
  color: #1c3a66;
}

.note--nopower {
  background: var(--nopower-soft);
  color: var(--nopower-ink);
}

.note--power {
  background: var(--power-soft);
  color: var(--power-ink);
}

.note--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.note--error {
  background: var(--danger-soft);
  color: var(--danger);
}

.note--gold {
  background: var(--gold-soft);
  color: #5b4100;
}

.note .btn {
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.badge .ico {
  width: 14px;
  height: 14px;
}

.badge--power {
  background: var(--power-soft);
  color: var(--power-ink);
}

.badge--nopower {
  background: var(--nopower-soft);
  color: var(--nopower-ink);
}

.badge--active {
  background: var(--pine-600);
  color: #fff;
}

.badge--neutral {
  background: #efeae0;
  color: var(--ink-2);
}

.badge--open {
  background: var(--ok-soft);
  color: var(--ok-ink);
}

.badge--closed {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-page {
  position: relative;
  display: grid;
  place-items: center;
  padding: 56px var(--gutter) 32px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(233, 185, 73, 0.28), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(212, 42, 60, 0.22), transparent 60%),
    linear-gradient(160deg, var(--pine-700), var(--pine-950));
  overflow: hidden;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 44px 28px 28px;
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

.login-badge {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 22px;
  background: linear-gradient(145deg, #f5cd6c, var(--gold-600));
  color: var(--pine-950);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.login-badge .ico {
  width: 34px;
  height: 34px;
}

.login-card header {
  text-align: center;
  margin-bottom: 24px;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 2.2rem);
  margin-top: 6px;
  color: var(--pine-800);
}

.login-card .lead {
  margin-top: 10px;
  color: var(--muted);
}

.pw-field {
  position: relative;
}

.pw-field input {
  padding-right: 54px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.login-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.92rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Kopfbereich (Startseite)
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 16px 0 76px;
  background:
    radial-gradient(900px 380px at 88% -20%, rgba(233, 185, 73, 0.3), transparent 60%),
    radial-gradient(600px 300px at 0% 120%, rgba(212, 42, 60, 0.25), transparent 60%),
    linear-gradient(160deg, var(--pine-700), var(--pine-950));
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  letter-spacing: 0.02em;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(145deg, #f5cd6c, var(--gold-600));
  color: var(--pine-950);
}

.brand-mark .ico {
  width: 20px;
  height: 20px;
}

.brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero h1 {
  margin-top: 34px;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 7.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero h1 .year {
  color: var(--gold);
}

.hero .lead {
  margin-top: 10px;
  max-width: 54ch;
  font-size: 1.08rem;
  color: rgba(255, 255, 255, 0.86);
}

.event-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
  font-size: 0.98rem;
}

.event-info .item {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: rgba(255, 255, 255, 0.92);
  white-space: pre-line;
  min-width: 0;
  overflow-wrap: anywhere;
}

.event-info .ico {
  color: var(--gold);
  margin-top: 2px;
}

.event-info .item--deadline strong {
  color: var(--gold);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 660px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.93rem;
  line-height: 1.25;
}

.steps .num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--gold);
  color: var(--pine-950);
  font-weight: 800;
  font-size: 0.9rem;
}

@media (max-width: 560px) {
  .hero h1 {
    margin-top: 26px;
  }

  .hero .lead {
    font-size: 1rem;
  }

  .steps {
    gap: 6px;
    margin-top: 18px;
  }

  .steps li {
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    padding: 10px 6px;
    text-align: center;
    font-size: 0.8rem;
    hyphens: auto;
  }

  .steps .num {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }
}

/* --------------------------------------------------------------------------
   Hauptbereich & Karten
   -------------------------------------------------------------------------- */
.main {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 18px;
  margin-top: -48px;
  padding-bottom: 32px;
}

.card {
  min-width: 0;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--pine-800);
}

.card-head .sub {
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .card {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .card-head h2 {
    font-size: 1.35rem;
  }
}

.counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #5b4100;
  font-weight: 700;
  font-size: 0.92rem;
}

/* Legende */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 14px;
  font-size: 0.93rem;
  color: var(--ink-2);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 22px;
  flex: none;
  border-radius: 6px;
  border: 2px solid;
}

.swatch .ico {
  width: 13px;
  height: 13px;
}

.swatch--power {
  border-color: var(--power);
  background: var(--power-soft);
  color: var(--power);
}

.swatch--nopower {
  border-color: var(--nopower);
  background: var(--nopower-soft);
  color: var(--nopower);
}

.swatch--taken {
  border-color: #fff;
  background: linear-gradient(90deg, var(--power) 50%, var(--nopower) 50%);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.power-rule {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
}

/* --------------------------------------------------------------------------
   Lageplan
   -------------------------------------------------------------------------- */
.map-card {
  padding-bottom: 18px;
}

.map {
  position: relative;
  margin-inline: -22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #26342d;
}

@media (max-width: 640px) {
  .map {
    margin-inline: -16px;
  }
}

.map-viewport {
  position: relative;
  overflow: auto;
  max-height: min(80vh, 820px);
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.map-viewport:focus {
  outline: none;
}

.map-inner {
  position: relative;
  width: 100%;
  container-type: inline-size;
  user-select: none;
  -webkit-user-select: none;
}

.map-inner img {
  width: 100%;
  height: auto;
  pointer-events: none;
  -webkit-user-drag: none;
}

.map-spots {
  position: absolute;
  inset: 0;
}

.map-tools {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-tools button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.map-tools button:hover {
  background: #fff;
}

.map-tools button[disabled] {
  opacity: 0.45;
  cursor: default;
}

.map-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* Parkplätze */
.spot {
  --c: var(--power);
  --cb: var(--power-bright);
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  padding: 0.2em;
  overflow: hidden;
  border: 2px solid var(--cb);
  border-radius: clamp(4px, 0.75cqw, 12px);
  background: color-mix(in srgb, var(--c) 32%, transparent);
  color: #fff;
  font-size: clamp(9px, 1.05cqw, 20px);
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition: transform 0.15s, background-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

.spot--nopower {
  --c: var(--nopower);
  --cb: var(--nopower-bright);
}

.spot.is-free:hover,
.spot.is-free:focus-visible {
  background: color-mix(in srgb, var(--c) 58%, transparent);
  transform: scale(1.05);
  z-index: 3;
}

.spot:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.spot.is-taken {
  background: color-mix(in srgb, var(--c) 90%, #000 10%);
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.spot.is-taken:hover {
  transform: scale(1.04);
  z-index: 3;
}

.spot.is-selected {
  z-index: 4;
  transform: scale(1.06);
  border-color: #fff;
  box-shadow: 0 0 0 4px var(--gold), 0 10px 24px rgba(0, 0, 0, 0.45);
}

.spot.is-dimmed,
.map.only-power .spot--nopower,
.map.only-power .spot.is-taken {
  opacity: 0.3;
}

.map.only-power .spot--power.is-free {
  box-shadow: 0 0 0 4px var(--gold);
}

.spot-no {
  position: absolute;
  top: 0.3em;
  left: 0.4em;
  font-size: 0.82em;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.spot-ico {
  display: grid;
  place-items: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background: #fff;
  color: var(--c);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.spot-ico .ico {
  width: 62%;
  height: 62%;
}

.spot-name {
  display: -webkit-box;
  max-width: 100%;
  padding: 0 0.25em;
  overflow: hidden;
  font-weight: 800;
  font-size: 1.12em;
  overflow-wrap: break-word;
  hyphens: auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.spot--tall .spot-name {
  -webkit-line-clamp: 4;
}

.spot-name--long {
  font-size: 0.92em;
}

.spot--tall .spot-name--long {
  font-size: 0.8em;
}

.spot-meta {
  font-size: 0.8em;
  font-weight: 700;
  opacity: 0.92;
}

.spot.is-mine::after {
  content: '★';
  position: absolute;
  top: 0.15em;
  right: 0.35em;
  color: var(--gold);
  font-size: 1em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.spot.is-warn::after {
  content: '!';
  position: absolute;
  top: 0.25em;
  right: 0.3em;
  display: grid;
  place-items: center;
  width: 1.35em;
  height: 1.35em;
  border-radius: 50%;
  background: #ffb020;
  color: #1b1200;
  font-weight: 900;
  font-size: 0.85em;
  text-shadow: none;
}

/* Admin: Verschieben */
.map.is-picking .spot.is-source {
  outline: 3px dashed #fff;
  outline-offset: 2px;
  opacity: 0.7;
}

.map.is-picking .spot:not(.is-source):hover {
  transform: scale(1.07);
  box-shadow: 0 0 0 4px var(--gold);
  z-index: 3;
}

.spot.is-drop-target {
  transform: scale(1.07);
  box-shadow: 0 0 0 4px var(--gold) !important;
  z-index: 3;
}

.spot.is-dragging {
  opacity: 0.5;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  white-space: nowrap;
}

/* Platznummer-Kachel (Formular, eigene Anmeldung) */
.spot-card-no {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 13px;
  background: var(--c, var(--power));
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

/* Eigene Anmeldung */
.mine-card {
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, #fffaf0, #fff);
}

.mine-list {
  display: grid;
  gap: 12px;
}

.mine-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 14px;
  align-items: start;
}

.mine-item h3 {
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.mine-item p {
  overflow-wrap: anywhere;
}

.mine-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 720px) {
  .mine-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .mine-actions {
    grid-column: auto;
  }
}

/* Info-Karte Sicherheit */
.safety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}

.safety-box {
  padding: 16px;
  border-radius: 16px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.safety-box h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.safety-box ul {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.safety-box li + li {
  margin-top: 4px;
}

.footer {
  padding: 8px 0 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Dialog / Bottom-Sheet
   -------------------------------------------------------------------------- */
dialog.sheet {
  width: min(660px, calc(100% - 32px));
  max-width: none;
  max-height: min(92dvh, 940px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog.sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.22s ease-out;
}

dialog.sheet::backdrop {
  background: rgba(5, 20, 14, 0.55);
  backdrop-filter: blur(2px);
}

dialog.sheet--narrow {
  width: min(460px, calc(100% - 32px));
}

.sheet-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--pine-800);
  overflow-wrap: anywhere;
}

.sheet-head .icon-btn {
  margin: -6px -8px 0 0;
}

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 20px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
}

.sheet-foot .spacer {
  flex: 1;
}

@media (max-width: 640px) {
  dialog.sheet,
  dialog.sheet--narrow {
    width: 100%;
    max-height: 94dvh;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
  }

  dialog.sheet[open] {
    animation: sheet-up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .sheet-head {
    padding: 16px 16px 12px;
  }

  .sheet-head h2 {
    font-size: 1.35rem;
  }

  .sheet-body {
    padding: 16px 16px 8px;
  }

  .sheet-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .sheet-foot .btn {
    flex: 1 1 auto;
  }

  .sheet-foot .spacer {
    display: none;
  }

  /* Auf dem Handy reicht das ✕ oben zum Schließen */
  .stand-form .sheet-foot .btn-ghost[data-close] {
    display: none;
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(40%);
    opacity: 0.4;
  }
}

.spot-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 14px;
}

.spot-banner .spot-card-no {
  width: 42px;
  height: 42px;
}

.spot-banner--power {
  --c: var(--power);
  background: var(--power-soft);
  color: var(--power-ink);
}

.spot-banner--nopower {
  --c: var(--nopower);
  background: var(--nopower-soft);
  color: var(--nopower-ink);
}

.spot-banner strong {
  display: block;
  font-size: 1.02rem;
}

.spot-banner p {
  font-size: 0.93rem;
}

/* Geräteliste */
.devices {
  margin: 0 0 18px;
}

.devices.is-invalid .device-rows input:not(:focus),
.devices.is-invalid .device-rows select:not(:focus) {
  border-color: var(--line-strong);
}

.quick-label {
  margin: 0 0 8px;
  font-size: 0.86rem;
  color: var(--muted);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.preset:hover {
  border-color: var(--power);
}

.preset.is-added {
  border-color: var(--power);
  background: var(--power-soft);
  color: var(--power-ink);
}

.preset .count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--power);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.device-head {
  display: none;
}

.device-rows {
  display: grid;
  margin-top: 12px;
}

.device-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 44px;
  grid-template-areas:
    'name name name'
    'qty watts del';
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.device-row:last-child {
  border-bottom: 1px solid var(--line);
}

.device-row input,
.device-row select {
  min-height: 44px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.d-qty {
  grid-area: qty;
}

.d-name {
  grid-area: name;
}

.d-watts {
  grid-area: watts;
  position: relative;
}

.d-del {
  grid-area: del;
}

.d-watts input {
  padding-right: 34px;
}

.d-watts::after {
  content: 'W';
  position: absolute;
  top: 50%;
  right: 13px;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}

@media (min-width: 600px) {
  .device-head,
  .device-row {
    grid-template-columns: 112px minmax(0, 1fr) 120px 44px;
    grid-template-areas: 'qty name watts del';
    gap: 8px;
  }

  .device-head:not([hidden]) {
    display: grid;
    margin-top: 14px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
  }

  .device-rows {
    margin-top: 4px;
  }

  .device-row,
  .device-row:last-child {
    padding: 4px 0;
    border: 0;
  }
}

.add-device {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--pine-600);
  font-weight: 650;
  cursor: pointer;
}

.add-device .ico {
  width: 18px;
  height: 18px;
}

.power-total {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
}

.power-total-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
}

.power-total-row strong {
  font-size: 1.05rem;
}

.power-total-row span {
  color: var(--muted);
  font-size: 0.88rem;
}

.meter-bar {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #ebe5d8;
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--ok);
  transition: width 0.25s, background-color 0.25s;
}

.power-total.is-high .meter-fill {
  background: #e59a00;
}

.power-total.is-two .meter-fill {
  background: #e07b00;
}

.power-total.is-over .meter-fill {
  background: var(--danger);
}

.meter-msg {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.socket-alert {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid #f3cf8c;
  background: var(--warn-soft);
  color: #5c3700;
}

.socket-alert.is-error {
  border-color: #f1b5ae;
  background: var(--danger-soft);
  color: var(--danger);
}

.socket-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 800;
  font-size: 1rem;
}

.socket-title .ico {
  margin-top: 1px;
}

.socket-alert p {
  margin-top: 6px;
  font-size: 0.93rem;
}

.socket-plan {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.socket-plan li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
}

.socket-plan .plug {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--power);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.socket-plan .w {
  font-weight: 700;
  white-space: nowrap;
}

.socket-ack {
  margin-top: 12px;
}

.socket-ack .check {
  color: var(--ink);
}

.fire-box {
  margin: 4px 0 18px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff7e6, #fffbf2);
  border: 1.5px solid #f2d9a6;
}

.fire-box h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  color: #6b4300;
}

.fire-box p,
.fire-box li {
  font-size: 0.94rem;
  color: #4d3a14;
}

.fire-box p {
  margin-top: 8px;
}

.fire-box ul {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.fire-box li + li {
  margin-top: 3px;
}

.fire-box .check {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #e8c98a;
  color: var(--ink);
}

.form-alert {
  margin-bottom: 16px;
}

/* Infos zu einem belegten Platz */
.detail-desc {
  font-size: 1.05rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.detail-list dd {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .detail-list {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .detail-list dd {
    margin-bottom: 8px;
  }
}

/* Erfolg */
.success {
  text-align: center;
  padding-top: 10px;
}

.success-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 6px auto 16px;
  border-radius: 50%;
  background: var(--pine-600);
  color: #fff;
  box-shadow: 0 0 0 10px var(--pine-50);
  animation: pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.success-badge .ico {
  width: 40px;
  height: 40px;
  stroke-width: 2.6;
}

.success h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--pine-800);
}

.success p {
  margin-top: 10px;
}

.summary {
  margin: 18px 0 6px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  text-align: left;
}

@keyframes pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 2000;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  border: 0;
  background: transparent;
  overflow: visible;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(520px, 100%);
  padding: 13px 16px;
  border-radius: 14px;
  background: #18211d;
  color: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
  font-weight: 550;
  pointer-events: auto;
  animation: toast-in 0.22s ease-out;
}

.toast--success {
  background: var(--pine-700);
}

.toast--error {
  background: #8f1d14;
}

.toast .ico {
  color: var(--gold);
}

.toast-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast button {
  flex: none;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--gold);
  font-weight: 750;
  cursor: pointer;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* --------------------------------------------------------------------------
   Verwaltung
   -------------------------------------------------------------------------- */
.admin-page {
  background: var(--bg);
}

.admin-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(160deg, var(--pine-800), var(--pine-950));
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.admin-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.admin-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.admin-bar select {
  width: auto;
  min-height: 38px;
  padding: 6px 34px 6px 12px;
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
}

.admin-bar select option {
  color: var(--ink);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding-bottom: 8px;
}

@media (min-width: 720px) {
  .tabs {
    display: flex;
  }
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 650;
  cursor: pointer;
  min-width: 0;
}

.tab .ico {
  width: 18px;
  height: 18px;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.tab[aria-selected='true'] {
  background: #fff;
  color: var(--pine-800);
}

@media (max-width: 420px) {
  .tab {
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px;
    font-size: 0.8rem;
  }
}

.admin-main {
  display: grid;
  gap: 18px;
  padding-top: 20px;
  padding-bottom: 48px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
}

@media (max-width: 520px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stat {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--pine-800);
  line-height: 1.1;
}

.stat-label {
  margin-top: 2px;
  font-size: 0.85rem;
  color: var(--muted);
}

.stat--warn .stat-value {
  color: #b26b00;
}

.pick-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--gold-soft);
  color: #5b4100;
  font-weight: 600;
}

.pick-banner .btn {
  margin-left: auto;
}

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

.toolbar .grow {
  flex: 1 1 220px;
  min-width: 0;
}

.toolbar select {
  width: auto;
  flex: 0 1 auto;
}

.table-wrap {
  min-width: 0;
}

table.stands {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

table.stands th {
  padding: 10px;
  border-bottom: 2px solid var(--line);
  text-align: left;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

table.stands td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: break-word;
  hyphens: auto;
}

table.stands .nowrap {
  white-space: nowrap;
}

table.stands th:nth-child(1) {
  width: 56px;
}

table.stands th:nth-child(5) {
  width: 26%;
}

table.stands th:nth-child(7) {
  width: 140px;
}

table.stands tbody tr {
  cursor: pointer;
  transition: background-color 0.12s;
}

table.stands tbody tr:hover td {
  background: var(--soft);
}

table.stands tr.is-warn td {
  background: #fffaf0;
}

table.stands .no {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
}

table.stands .no--power {
  background: var(--power);
}

table.stands .no--nopower {
  background: var(--nopower);
}

.dev-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dev-list li + li {
  margin-top: 2px;
}

.socket-mini {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  font-size: 0.86rem;
}

.socket-mini .badge {
  justify-self: start;
}

.confirm-text {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.cell-actions {
  white-space: nowrap;
  text-align: right;
}

.cell-actions .icon-btn {
  width: 38px;
  height: 38px;
}

.warn-text {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  color: #a05d00;
  font-size: 0.85rem;
  font-weight: 650;
}

.warn-text .ico {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

@media (max-width: 1080px) {
  table.stands,
  table.stands tbody,
  table.stands tr,
  table.stands td {
    display: block;
  }

  table.stands thead {
    display: none;
  }

  table.stands tbody {
    display: grid;
    gap: 10px;
  }

  table.stands tr {
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: 16px;
    background: #fff;
  }

  table.stands tr.is-warn {
    border-color: #f2d39a;
    background: #fffaf0;
  }

  table.stands td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    border: 0;
    background: none !important;
  }

  table.stands td::before {
    content: attr(data-label);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
  }

  /* Kopfzeile jeder Karte: Nummer · Klasse · Aktionen */
  table.stands tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
  }

  table.stands td {
    grid-column: 1 / -1;
  }

  table.stands td:nth-child(1),
  table.stands td:nth-child(2),
  table.stands td.cell-actions {
    grid-row: 1;
    display: block;
    padding: 0 0 8px;
  }

  table.stands td:nth-child(1) {
    grid-column: 1;
  }

  table.stands td:nth-child(2) {
    grid-column: 2;
    font-size: 1.1rem;
  }

  table.stands td.cell-actions {
    grid-column: 3;
    display: flex;
    gap: 6px;
  }

  table.stands td:nth-child(1)::before,
  table.stands td:nth-child(2)::before,
  table.stands td.cell-actions::before {
    content: none;
  }
}

@media (max-width: 420px) {
  table.stands td.cell-actions .icon-btn {
    width: 34px;
    height: 34px;
  }

  table.stands td {
    grid-template-columns: 96px minmax(0, 1fr);
  }
}

/* Jahre */
.year-list {
  display: grid;
  gap: 12px;
}

.year-card {
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.year-card.is-active {
  border-color: var(--pine-600);
  box-shadow: 0 0 0 4px rgba(29, 107, 74, 0.1);
}

.year-card summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.year-card summary::-webkit-details-marker {
  display: none;
}

.year-card summary .year-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--pine-800);
}

.year-card summary .chev {
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.2s;
}

.year-card[open] summary .chev {
  transform: rotate(180deg);
}

.year-body {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--line);
}

.year-body .row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 0 14px;
  margin-top: 14px;
}

.year-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.share-box {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
}

.share-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.share-head > .ico {
  flex: none;
  margin-top: 2px;
  color: var(--pine-700);
}

.share-head .help {
  margin-top: 2px;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.copy-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}

.copy-row input {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  color: var(--ink-2);
  background: #fff;
}

@media (max-width: 520px) {
  .copy-row {
    flex-direction: column;
  }
}

.code {
  padding: 2px 8px;
  border-radius: 8px;
  background: #f1ece2;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.92em;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 18px;
  align-items: start;
}

/* Verlauf */
.log-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.log-list li {
  display: grid;
  grid-template-columns: 150px 110px minmax(0, 1fr);
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.93rem;
}

.log-list time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.log-list .what {
  font-weight: 700;
}

.log-list .detail {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .log-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .log-list .detail {
    grid-column: 1 / -1;
  }
}

/* --------------------------------------------------------------------------
   Bewegung reduzieren
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .flake {
    display: none;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Druck
   -------------------------------------------------------------------------- */
@media print {
  .no-print,
  .admin-bar,
  .map-tools,
  .toasts,
  .cell-actions,
  .toolbar {
    display: none !important;
  }

  body {
    background: #fff;
  }

  #print-title {
    position: static !important;
    width: auto;
    height: auto;
    margin: 0 0 8px;
    clip: auto;
    overflow: visible;
    white-space: normal;
    font-family: var(--font-display);
    font-size: 24px;
  }

  .card,
  .stat {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  [data-panel] {
    display: block !important;
  }

  [data-panel='years'],
  [data-panel='log'] {
    display: none !important;
  }

  .map-viewport {
    max-height: none;
    overflow: visible;
  }

  .map-inner {
    width: 100% !important;
  }

  .spot {
    animation: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  table.stands,
  table.stands tbody,
  table.stands tr,
  table.stands td {
    display: revert !important;
  }

  table.stands thead {
    display: table-header-group !important;
  }

  table.stands td::before {
    content: none !important;
  }

  table.stands tr {
    break-inside: avoid;
  }
}
