:root {
  --brand-primary: #1b5e20;
  --brand-primary-hover: #2e7d32;
  --brand-primary-soft: #e8f5e9;

  --brand-accent: #d97706;
  --brand-accent-hover: #b45309;
  --brand-accent-soft: #fef3c7;

  --brand-danger: #dc2626;
  --brand-danger-hover: #b91c1c;
  --brand-danger-soft: #fee2e2;

  --brand-neutral-btn: #f1f5f9;
  --brand-neutral-btn-hover: #e2e8f0;

  --surface-page: #f4f7f4;
  --surface-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #558b2f;
  --border-subtle: #d0e8d0;
  --border-focus: #1b5e20;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus,
a:focus {
  outline: none;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  overflow-y: scroll;
  background-color: var(--surface-page);
}

.is-mobile html {
  overflow-y: auto;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--surface-page);
  color: var(--text-main);
  line-height: 1.45;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 10px 8px calc(80px + env(safe-area-inset-bottom, 0px)) 8px;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.page-wrapper {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  position: relative;
}

/* --- APP KOPFZEILE --- */
.app-header {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}
.app-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.app-header-brand {
  min-width: 0;
  flex: 1;
}
.app-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.app-header-actions button,
.app-header-actions a {
  margin: 0 !important;
  white-space: nowrap;
}
.app-header-sub {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f8f1;
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.is-mobile .app-header {
  padding: 12px !important;
  margin-bottom: 12px !important;
}
.is-mobile .app-header-top {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px !important;
}
.is-mobile .app-header-actions {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
}
.is-mobile .app-header-actions button,
.is-mobile .app-header-actions a {
  width: 100% !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 6px 8px !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* --- KARTEN & CONTAINER --- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  padding: 14px;
  margin-bottom: 12px;
}

.abw-box {
  border-left: 4px solid var(--brand-primary);
}
.admin-box {
  border-left: 4px solid #6a1b9a;
  background: #faf5fc;
}

.club-logo {
  max-height: 42px;
  max-width: 140px;
  height: auto;
  width: auto;
  object-fit: contain;
  display: inline-block;
}

/* --- DIENST-KACHELN --- */
.dienst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.dienst-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--brand-primary);
  border-radius: 10px;
  padding: 14px 14px 12px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  height: 100%;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dienst-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}
.dienst-card.tausch-card {
  border-left: 4px solid var(--brand-accent);
}

.datum-gross {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-primary);
}
.tausch-card .datum-gross {
  color: var(--brand-accent);
}
.dienst-zeile {
  font-size: 0.9rem;
  margin-bottom: 2px;
  color: #1b5e20;
}

.dienst-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 10px;
  margin-top: 6px;
  gap: 4px;
  min-height: 42px;
  flex-wrap: nowrap;
}
.dienst-card-footer .badge {
  padding: 4px 6px !important;
  font-size: 0.7rem !important;
  letter-spacing: 0 !important;
}
.dienst-card-footer .btn-xs {
  padding: 0 8px !important;
  font-size: 12px !important;
}

/* --- BUTTONS --- */
.btn,
.chevron-btn {
  will-change: transform, opacity;
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.1s ease, background-color 0.15s ease;
}
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
.btn:active {
  transform: scale(0.985);
}
.btn[disabled] {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff !important;
}
.btn-primary:hover {
  background-color: var(--brand-primary-hover);
}

.btn-accent {
  background-color: var(--brand-accent);
  color: #ffffff !important;
}
.btn-accent:hover {
  background-color: var(--brand-accent-hover);
}

.btn-purple {
  background-color: #6a1b9a;
  color: #ffffff !important;
}
.btn-purple:hover {
  background-color: #4a148c;
}

.btn-secondary {
  background-color: var(--brand-neutral-btn);
  color: var(--text-main) !important;
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
  background-color: var(--brand-neutral-btn-hover);
}

.btn-danger {
  background-color: var(--brand-danger);
  color: #ffffff !important;
}
.btn-danger:hover {
  background-color: var(--brand-danger-hover);
}

.btn-sm {
  height: 40px !important;
  min-height: 40px !important;
  padding: 6px 14px !important;
  font-size: 14px !important;
  border-radius: 8px !important;
}
.btn-xs {
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  width: auto !important;
  min-width: fit-content !important;
  border-radius: 7px !important;
  line-height: 1.2 !important;
}

.btn-refresh {
  background: #e8f5e9;
  color: var(--brand-primary);
  border: 1px solid #c8e6c9;
  padding: 7px 12px;
  height: 36px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.btn-refresh:hover {
  background-color: #c8e6c9;
}

/* --- BADGES --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  min-height: 28px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}
.badge-success {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}
.badge-warning {
  background: var(--brand-accent-soft);
  color: var(--brand-accent);
}
.badge-danger {
  background: var(--brand-danger-soft);
  color: var(--brand-danger);
}
.badge-purple {
  background: #f3e5f5;
  color: #4a148c;
}

/* --- FORMULARE --- */
input[type="text"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
  width: 100%;
  height: 42px;
  padding: 8px 10px;
  font-size: 14.5px;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea {
  height: auto;
  font-family: inherit;
}
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="date"],
  input[type="time"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }
}
input:focus,
select:focus,
textarea:focus {
  border-color: #2e7d32;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.input-action-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
@media (max-width: 520px) {
  .input-action-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .input-action-row select,
  .input-action-row button,
  .input-action-row a {
    width: 100% !important;
    justify-content: center !important;
    height: 40px !important;
  }
}

.form-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #2e7d32;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: block;
  margin-bottom: 4px;
}

.abw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
@media (max-width: 480px) {
  .abw-grid {
    grid-template-columns: 1fr;
  }
}

.abw-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 8px 10px;
  border: 1px solid #c8e6c9;
  border-radius: 8px;
  margin-bottom: 6px;
  gap: 6px;
}

/* --- RESPONSIVE HILFSKLASSEN --- */
.support-badge-text,
.btn-word-melden,
.support-text-desktop,
.wday-long,
.tages-name-desktop,
.tages-doppelpunkt,
.admin-zeit-desktop {
  display: inline;
}
.support-text-mobile,
.wday-short,
.tages-name-mobile,
.admin-zeit-mobile,
.diagnose-status-mobile {
  display: none;
}
.diagnose-status-desktop {
  display: inline-flex;
}

@media (max-width: 520px) {
  .support-badge-text,
  .btn-word-melden,
  .support-text-desktop {
    display: none !important;
  }
  .support-text-mobile {
    display: inline !important;
  }
}
@media (max-width: 480px) {
  .wday-short {
    display: inline !important;
  }
  .wday-long {
    display: none !important;
  }
}
@media (max-width: 640px) {
  body {
    font-size: 14.5px !important;
    padding: 8px 6px 70px 6px !important;
  }
  .card {
    padding: 12px 10px !important;
    border-radius: 10px !important;
    margin-bottom: 10px !important;
  }
  .dienst-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .btn:not(.btn-xs):not(.btn-sm) {
    min-height: 44px !important;
    height: 44px !important;
    font-size: 15px !important;
  }
  .diagnose-status-desktop {
    display: none !important;
  }
  .diagnose-status-mobile {
    display: inline-flex !important;
    align-items: center;
  }
}
.is-mobile .tages-name-mobile,
.is-mobile .admin-zeit-mobile {
  display: block !important;
}
.is-mobile .tages-name-desktop,
.is-mobile .tages-doppelpunkt,
.is-mobile .admin-zeit-desktop {
  display: none !important;
}

/* --- AKKORDEONS & CHEVRONS --- */
.section-header,
.cockpit-header-bar {
  user-select: none;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 6px 4px;
  margin-top: 16px;
  margin-bottom: 8px;
  border-radius: 8px;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.cockpit-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.chevron-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  color: inherit;
  flex-shrink: 0;
}
.chevron-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chevron-btn.is-open {
  transform: rotate(0deg);
}
.chevron-btn.is-closed {
  transform: rotate(-90deg);
}

/* --- LAUFTEXT-TICKER --- */
.ticker-wrap {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}
.seamless-ticker-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
}
.ticker-text-item {
  display: inline-block;
  white-space: nowrap;
}
.ticker-sep {
  color: #d97706;
  padding: 0 14px;
  font-weight: 800;
}
.ticker-wrap.is-animating .seamless-ticker-track {
  animation: ticker-seamless 20s linear infinite;
}
.ticker-wrap.is-animating .seamless-ticker-track:hover {
  animation-play-state: paused;
}
.ticker-wrap:not(.is-animating) .ticker-text-clone,
.ticker-wrap:not(.is-animating) .ticker-sep {
  display: none !important;
}
@keyframes ticker-seamless {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

/* --- LOGIN --- */
.text-center {
  text-align: center;
}
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 75vh;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 30px 26px;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
@media screen and (max-width: 640px) {
  .login-container {
    padding: 12px 2px !important;
  }
  .login-card {
    padding: 20px 14px !important;
  }
}

/* --- ADMIN-BEREICH (TABS, TABELLEN, BERECHTIGUNGS-MATRIX) --- */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.admin-tab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.admin-tab-btn.active {
  background: #1b5e20;
  color: #ffffff;
  border-color: #1b5e20;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d0e8d0;
  border-radius: 10px;
  background: #ffffff;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.admin-table th {
  background: #f1f8f1;
  color: #1b5e20;
  font-weight: 700;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1.5px solid #c8e6c9;
  white-space: nowrap;
}
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}
.admin-table tr:last-child td {
  border-bottom: none;
}
.matrix-scroll {
  max-height: 72vh;
  overflow: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.matrix-scroll.no-x-overflow {
  max-height: none;
  overflow: visible !important;
}
.matrix-table {
  font-size: 13px;
  border-collapse: separate;
  border-spacing: 0;
}
.matrix-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}
.matrix-table thead th {
  background-color: #f1f8f1;
}
.matrix-table tr.mx-group-row th:first-child {
  border-top-left-radius: 9px;
}
.matrix-table tr.mx-group-row th:last-child {
  border-top-right-radius: 9px;
}
.matrix-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 9px;
}
.matrix-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 9px;
}
.matrix-table th {
  padding: 5px 4px;
}
.matrix-table td {
  padding: 4px 5px;
}
.matrix-table tr.mx-group-row th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 4px 5px;
  border-bottom: 1px solid #cbd5e1;
}
.matrix-table th.col-rot {
  text-align: center;
  font-size: 11px;
  padding: 5px 4px;
  vertical-align: top;
  white-space: nowrap;
}
.matrix-table td.col-chk {
  text-align: center;
}
.matrix-table td.sticky-name,
.matrix-table th.sticky-name {
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 2;
  border-right: 2px solid #c8e6c9;
  min-width: 200px;
  white-space: nowrap;
}
.matrix-table thead th.sticky-name {
  background: #f1f8f1;
  z-index: 6;
}
.matrix-table tbody tr:hover td {
  background-color: #f1f8f1 !important;
}
.matrix-table tbody tr:hover td.sticky-name {
  background-color: #e8f5e9 !important;
}
.matrix-table tbody tr.mx-dirty td {
  background-color: #fffbeb !important;
}
.matrix-table tbody tr.mx-dirty td.sticky-name {
  background-color: #fef3c7 !important;
  box-shadow: inset 3px 0 0 #d97706;
}
.matrix-table .mx-grp-start {
  border-left: 2px solid #cbd5e1 !important;
}
.matrix-table input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #1b5e20;
  cursor: pointer;
}
.mx-col-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-top: 3px;
}
.mx-col-cnt {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  padding: 0 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  line-height: 1.5;
}
.mx-col-cnt.is-low {
  background: #fef3c7;
  color: #b45309;
}
.mx-col-cnt.is-zero {
  background: #fee2e2;
  color: #dc2626;
}
.mx-col-cnt.is-ok {
  background: #dcfce7;
  color: #166534;
}
.mx-col-bulk {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.2;
  padding: 1px 4px;
  cursor: pointer;
  color: #334155;
}
.mx-col-bulk:hover {
  background: #1b5e20;
  color: #ffffff;
  border-color: #1b5e20;
}
.mx-filter-btn {
  height: 32px !important;
  min-height: 32px !important;
  font-size: 12px !important;
  background: #ffffff !important;
}
.mx-filter-btn.is-active {
  background: #1b5e20 !important;
  color: #ffffff !important;
  border-color: #1b5e20 !important;
}

/* --- ANIMATIONEN & SPINNER --- */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: btn-spin 0.75s linear infinite;
  margin-right: 6px;
  flex-shrink: 0;
}
.btn-secondary .btn-spinner,
.btn-refresh .btn-spinner {
  border-color: rgba(27, 94, 32, 0.2);
  border-top-color: #1b5e20;
}
@keyframes btn-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pin-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-9px);
  }
  40%,
  80% {
    transform: translateX(9px);
  }
}
.shake-red {
  animation: pin-shake 0.45s ease-in-out !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2) !important;
}
.shake-gold {
  animation: pin-shake 0.45s ease-in-out !important;
  border-color: #f59e0b !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.55), 0 0 0 4px rgba(245, 158, 11, 0.25) !important;
}
@keyframes logo-flip {
  0% {
    transform: scale(1) rotate(0deg);
  }
  35% {
    transform: scale(1.45) rotate(360deg);
  }
  65% {
    transform: scale(1.25) rotate(720deg);
  }
  100% {
    transform: scale(1) rotate(720deg);
  }
}
.logo-acrobatics {
  animation: logo-flip 1.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  display: inline-block !important;
}
@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(-12px);
  }
  60% {
    opacity: 1;
    transform: scale(1.04) translateY(3px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}
.easter-egg-banner {
  animation: bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  background: #fef3c7 !important;
  border: 2px solid #f59e0b !important;
  color: #92400e !important;
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.18) !important;
  text-align: center !important;
  padding: 12px 14px !important;
  border-radius: 8px;
}
.target-particle {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  font-size: 24px;
  will-change: transform, opacity;
  transition: transform 1.4s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 1.4s ease-out;
}
.refresh-spinning {
  animation: btn-spin 0.8s linear infinite !important;
  display: inline-block;
}
.fade-in-content {
  animation: portalFadeIn 0.2s ease-out forwards;
}
@keyframes portalFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}