.app-layout .sidebar {
  z-index: 120;
}

.app-layout .app-header {
  position: sticky;
  top: 0;
  z-index: 110;
}

.main-area {
  min-width: 0;
}

.container {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.bezirke-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.bezirke-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.bezirke-toolbar-left {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bezirke-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  color: #111827;
}

.bezirke-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}

.bezirke-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, 100%);
  min-width: 320px;
}

.bezirke-search-leading-icon {
  width: 22px;
  height: 22px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.bezirke-search-leading-icon svg {
  width: 20px;
  height: 20px;
}

.bezirke-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.bezirke-search input {
  width: 100%;
  min-height: 46px;
  padding: 12px 46px 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #dbe2ea;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.bezirke-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.bezirke-states {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bezirke-section-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 4px;
  padding: 4px 0;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.bezirke-section-divider::before,
.bezirke-section-divider::after {
  content: "";
  height: 2px;
  flex: 1;
  background: linear-gradient(90deg, transparent, #94a3b8, transparent);
}

.bezirk-state-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.bezirk-state-card.is-special .bezirk-state-name {
  color: #b91c1c;
}

.bezirk-state-card.is-default .bezirk-state-name {
  color: #15803d;
}

.bezirk-state-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  cursor: pointer;
  border: 0;
  width: 100%;
  text-align: left;
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.bezirk-state-head:hover {
  background: linear-gradient(180deg, #ffffff, #eef6ff);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.bezirk-state-head:hover .bezirk-state-action {
  background: #dbeafe;
  color: #1d4ed8;
}

.bezirk-state-head-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.bezirk-state-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #eef2ff;
  color: #4f46e5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.bezirk-state-icon svg {
  width: 20px;
  height: 20px;
}

.bezirk-state-name {
  font-size: 18px;
  font-weight: 800;
}

.bezirk-state-sub {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.bezirk-state-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.bezirk-state-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #111827;
  font-weight: 800;
  font-size: 13px;
}

.bezirk-state-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.bezirk-state-chevron {
  width: 18px;
  height: 18px;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.bezirk-state-card.open .bezirk-state-chevron {
  transform: rotate(180deg);
}

.bezirk-state-body {
  padding: 0 18px 18px;
}

.bezirk-state-body.hidden {
  display: none;
}

.bezirke-inline-loader {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 4px 8px;
  color: #64748b;
  font-size: 14px;
}

.bezirke-inline-loader::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  border-top-color: #4f46e5;
  animation: bezirkeSpin 0.8s linear infinite;
}

@keyframes bezirkeSpin {
  to {
    transform: rotate(360deg);
  }
}

.bezirk-table-wrap {
  border: 1px solid #edf2f7;
  border-radius: 16px;
  background: #fff;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.bezirk-table-head-scroll {
  overflow: hidden;
  background: linear-gradient(180deg, #f8fbff 0%, #edf4fb 100%);
  border-bottom: 1px solid #dbe5ef;
  box-sizing: border-box;
  box-shadow:
    inset 0 -1px 0 rgba(148, 163, 184, 0.2),
    0 4px 10px rgba(15, 23, 42, 0.04);
}

.bezirk-table-body-scroll {
  overflow: auto;
  max-height: 62vh;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #64748b #cfd8e3;
}

.bezirk-table-body-scroll::-webkit-scrollbar {
  width: 16px;
  height: 22px;
}

.bezirk-table-body-scroll::-webkit-scrollbar-track {
  background: #cfd8e3;
  border-radius: 999px;
}

.bezirk-table-body-scroll::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 999px;
  border: 3px solid #cfd8e3;
}

.bezirk-table-body-scroll::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.bezirk-table-top-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  margin: 0;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #64748b #cfd8e3;
  position: relative;
  z-index: 3;
  background: #fff;
  border-bottom: 1px solid #e5edf5;
}

.bezirk-table-top-scroll-inner {
  height: 1px;
}

.bezirk-table-top-scroll::-webkit-scrollbar {
  width: 16px;
  height: 22px;
}

.bezirk-table-top-scroll::-webkit-scrollbar-track {
  background: #cfd8e3;
  border-radius: 999px;
}

.bezirk-table-top-scroll::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 999px;
  border: 3px solid #cfd8e3;
}

.bezirk-table-top-scroll::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.bezirk-table-scroll {
  display: none;
}

.bezirk-table {
  width: auto;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 11px;
}

.bezirk-table thead th {
  background: linear-gradient(180deg, #f6faff 0%, #dbeafe 100%);
  color: #0f172a;
  font-size: 11px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  font-weight: 900;
  padding: 12px 8px;
  border-bottom: 1px solid #c5d2e1;
  border-right: 1px solid #d7e3ef;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 -1px 0 rgba(148, 163, 184, 0.28),
    0 1px 0 rgba(148, 163, 184, 0.12);
}

.bezirk-table tbody td {
  padding: 6px 6px;
  border-bottom: 1px solid #e8eef5;
  border-right: 1px solid #eef3f8;
  vertical-align: middle;
  color: #111827;
  background: #ffffff;
  font-size: 13px;
}

.bezirk-th-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 10px;
  min-height: 14px;
  min-width: 0;
}

.bezirk-th-inner > span:first-child {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bezirk-col-resize-handle {
  position: absolute;
  top: -10px;
  right: -8px;
  width: 14px;
  height: calc(100% + 20px);
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  z-index: 4;
}

.bezirk-col-resize-handle::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 20%;
  bottom: 20%;
  width: 2px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.35);
  transition: background 0.14s ease;
}

.bezirk-col-resize-handle:hover::after {
  background: rgba(37, 99, 235, 0.82);
}

body.bezirk-col-resizing,
body.bezirk-col-resizing * {
  user-select: none !important;
  cursor: col-resize !important;
}

.bezirk-table tbody tr:nth-child(even) td {
  background: #f2f7fc;
}

.bezirk-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}

.bezirk-table th:last-child,
.bezirk-table td:last-child {
  border-right: none;
}

.bezirk-table tbody tr:hover td {
  background: #dbeafe !important;
  box-shadow:
    inset 0 1px 0 rgba(59, 130, 246, 0.35),
    inset 0 -1px 0 rgba(59, 130, 246, 0.35);
}

.bezirk-table th,
.bezirk-table td {
  box-sizing: border-box;
  overflow: hidden;
}

.bezirk-table.default thead th:nth-child(2),
.bezirk-table.special thead th:nth-child(2) {
  color: #0f172a;
  background: linear-gradient(180deg, #eef4ff 0%, #cfe0ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 -1px 0 rgba(59, 130, 246, 0.22),
    0 1px 0 rgba(148, 163, 184, 0.12);
}

.bezirk-table.default tbody td:nth-child(2),
.bezirk-table.special tbody td:nth-child(2) {
  background-image: linear-gradient(180deg, rgba(37, 99, 235, 0.03), rgba(37, 99, 235, 0.01));
}

.bezirk-table.default tbody td:nth-child(2) .bezirk-cell-text,
.bezirk-table.special tbody td:nth-child(2) .bezirk-cell-text {
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.01em;
}

.bezirk-table.default tbody tr:hover td:nth-child(2),
.bezirk-table.special tbody tr:hover td:nth-child(2) {
  background: #cfe3ff !important;
  box-shadow:
    inset 3px 0 0 #2563eb,
    inset 0 1px 0 rgba(59, 130, 246, 0.35),
    inset 0 -1px 0 rgba(59, 130, 246, 0.35);
}

.bezirk-table.default tbody tr:hover td:nth-child(2) .bezirk-cell-text,
.bezirk-table.special tbody tr:hover td:nth-child(2) .bezirk-cell-text {
  color: #0b1220;
}

.bezirk-separator-row td {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 12px;
  border-top: 1px solid #cfd8e3;
  border-bottom: 1px solid #cfd8e3;
}

.bezirk-separator-row.is-with td {
  background: #fef2f2 !important;
  color: #b91c1c;
}

.bezirk-separator-row.is-without td {
  background: #ecfdf5 !important;
  color: #15803d;
}

.bezirk-separator-spacer td {
  background: #ffffff !important;
  border: 0 !important;
  padding: 12px 0 !important;
  height: 12px;
}

.bezirk-cell-clickable {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.bezirk-cell-clickable:hover {
  background: #bfdbfe !important;
}

.bezirk-cell-clickable:hover::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 6px;
  z-index: 0;
  box-shadow:
    inset 0 0 0 2px rgba(29, 78, 216, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.65);
  pointer-events: none;
}

.bezirk-cell-clickable:hover .bezirk-cell-text,
.bezirk-cell-clickable:hover .bezirk-status-pill,
.bezirk-cell-clickable:hover .bezirk-flag,
.bezirk-cell-clickable:hover .bezirk-note-btn,
.bezirk-cell-clickable:hover .bezirk-message-btn,
.bezirk-cell-clickable:hover .bezirk-person-btn {
  position: relative;
  z-index: 1;
}

.bezirk-cell-clickable:hover .bezirk-cell-text {
  color: #0f172a;
}

.bezirk-cell-text {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bezirk-cell-text.wrap {
  white-space: normal;
  line-height: 1.4;
}

.bezirk-status-center {
  text-align: center;
}

.bezirk-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 11px;
}

.bezirk-flag.ok {
  background: #dcfce7;
  color: #15803d;
}

.bezirk-flag.bad {
  background: #fee2e2;
  color: #b91c1c;
}

.bezirk-flag.warn {
  background: #fff7ed;
  color: #c2410c;
}

.bezirk-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.bezirk-status-pill.ok {
  background: #ecfdf5;
  color: #047857;
}

.bezirk-status-pill.warn {
  background: #fff7ed;
  color: #c2410c;
}

.bezirk-status-pill.bad {
  background: #fef2f2;
  color: #b91c1c;
}

.bezirk-status-pill.info {
  background: #eff6ff;
  color: #2563eb;
}

.bezirk-status-pill.purple {
  background: #f5f3ff;
  color: #7c3aed;
}

.bezirk-status-pill.muted {
  background: #f3f4f6;
  color: #4b5563;
}

.bezirk-note-btn,
.bezirk-message-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.bezirk-note-btn {
  background: #eff6ff;
  color: #2563eb;
}

.bezirk-note-btn svg {
  width: 15px;
  height: 15px;
}

.bezirk-note-btn.empty {
  background: #f3f4f6;
  color: #6b7280;
}

.bezirk-message-btn {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #d7e1ec;
  font-size: 11px;
  font-weight: 700;
}

.bezirk-message-btn.has-value {
  background: #eef6ff;
  color: #1d4ed8;
  border-color: #bfd8ff;
}

.bezirk-person-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #d7e1ec;
}

.bezirk-person-btn.has-value {
  background: #eef6ff;
  color: #1d4ed8;
  border-color: #bfd8ff;
}

.bezirk-person-btn svg {
  width: 16px;
  height: 16px;
}

.bezirk-note-btn:hover,
.bezirk-message-btn:hover {
  transform: translateY(-1px);
}

.bezirk-empty {
  padding: 16px;
  color: #6b7280;
  font-size: 14px;
}

.bezirke-modal-box {
  width: min(920px, 92vw);
}

.bezirke-modal-meta {
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
}

.bezirke-modal-body {
  padding-top: 18px;
}

.bezirke-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  gap: 18px;
}

.bezirke-edit-main,
.bezirke-comments-panel {
  min-width: 0;
}

.bezirke-comments-panel {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.bezirke-comments-head {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.bezirke-comments-head h4 {
  margin: 0;
  font-size: 15px;
  color: #111827;
}

.bezirke-comments-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.bezirke-comments-list::-webkit-scrollbar {
  width: 12px;
}

.bezirke-comments-list::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 999px;
}

.bezirke-comments-list::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
  border: 2px solid #e5e7eb;
}

.bezirke-comments-empty {
  color: #6b7280;
  font-size: 13px;
}

.bezirke-comment-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px 13px;
}

.bezirke-comment-item.is-confirming {
  border-color: #fecaca;
  background: #fffafa;
}

.bezirke-comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #6b7280;
  flex-wrap: wrap;
}

.bezirke-comment-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bezirke-comment-author {
  font-weight: 700;
  color: #111827;
}

.bezirke-comment-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
  color: #1f2937;
}

.bezirke-comment-delete {
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
  border: 0;
}

.bezirke-comment-delete:hover {
  opacity: 0.92;
}

.bezirke-comment-confirm-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
}

.bezirke-comment-confirm-text {
  font-size: 12px;
  font-weight: 700;
  color: #9f1239;
}

.bezirke-comment-confirm-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.bezirke-comment-confirm-yes,
.bezirke-comment-confirm-no {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 0;
}

.bezirke-comment-confirm-yes {
  background: #e11d48;
  color: #fff;
}

.bezirke-comment-confirm-no {
  background: #e5e7eb;
  color: #374151;
}

.bezirk-cell-compact {
  text-align: center;
}

.bezirk-column-prio {
  min-width: 92px;
}

.bezirk-column-ort {
  min-width: 82px;
}

.bezirk-column-koordinator {
  min-width: 80px;
}

.bezirk-column-bundesland {
  min-width: 108px;
}

.bezirk-column-landkreis {
  min-width: 108px;
}

.bezirk-column-short {
  min-width: 58px;
}

.bezirk-column-medium {
  min-width: 96px;
}

.bezirk-column-wide {
  min-width: 120px;
}

.bezirk-column-note {
  min-width: 58px;
}

.bezirk-column-icon {
  min-width: 50px;
}

.bezirke-date-input {
  min-height: 46px;
}

.bezirke-date-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  transform: scale(1.55);
  transform-origin: center;
  padding: 7px;
}

#bezirkeCellSelectInput.tone-bad {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

#bezirkeCellSelectInput.tone-warn {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

#bezirkeCellSelectInput.tone-ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

#bezirkeCellSelectInput.tone-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

#bezirkeCellSelectInput.tone-purple {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #7c3aed;
}

#bezirkeNewComment {
  min-height: 130px;
  resize: vertical;
}

.bezirke-comment-compose-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.bezirke-comments-panel {
  min-height: 430px;
}

@media (max-width: 980px) {
  .bezirke-edit-layout {
    grid-template-columns: 1fr;
  }

  .bezirke-search {
    min-width: 100%;
  }

  .bezirke-search-row {
    min-width: 100%;
  }
}
