.header-actions .inbox-badge {
  flex-shrink: 0;
}

.inbox-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--sky);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  text-decoration: none;
  transition: opacity 0.2s;
}

.inbox-badge:hover {
  opacity: 0.85;
}

.inbox-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
}

.inbox-badge[data-count="0"] {
  display: none;
}

.inbox-widget {
  margin-bottom: 24px;
}

.inbox-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.inbox-widget-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.inbox-widget-counter {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.inbox-widget-list {
  display: grid;
  gap: 8px;
}

.inbox-widget-empty,
.inbox-widget-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 12px;
  justify-content: center;
}

.inbox-widget-empty {
  color: var(--text-muted);
}

.inbox-widget-error {
  color: var(--danger);
}

.inbox-widget-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
  border-left: 2px solid transparent;
}

.inbox-widget-item:hover {
  background: color-mix(in srgb, var(--teal) 4%, transparent);
}

.inbox-widget-item[data-prioritaet="dringend"] {
  border-left-color: var(--danger);
}

.inbox-widget-item[data-prioritaet="hoch"] {
  border-left-color: var(--warning);
}

.inbox-widget-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.inbox-widget-item-body {
  flex: 1;
  min-width: 0;
}

.inbox-widget-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-widget-item-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-widget-item-prio {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 12px;
}

.prio-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.prio-dot.prio-dringend {
  background: var(--danger);
}

.prio-dot.prio-hoch {
  background: var(--warning);
}

.inbox-widget-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: right;
}

.inbox-widget-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--teal);
  text-decoration: none;
}

.inbox-widget-link:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .inbox-widget {
    margin-bottom: 20px;
  }

  .inbox-widget-title {
    flex-wrap: wrap;
  }

  .inbox-widget-item {
    align-items: flex-start;
  }

  .inbox-widget-item-title,
  .inbox-widget-item-meta {
    white-space: normal;
  }
}

.inbox-page-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 48px;
  box-sizing: border-box;
}

.inbox-filter-bar {
  display: grid;
  grid-template-columns: minmax(360px, 40%) 1fr;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.inbox-filter-bar > * {
  min-width: 0;
}

.inbox-filter-tabs {
  grid-column: 1;
  display: inline-flex;
  gap: 2px;
  background: var(--bg-3);
  padding: 4px;
  border-radius: 10px;
}

.inbox-tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}

.inbox-tab.active {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.inbox-tab:hover:not(.active) {
  color: var(--text);
}

.inbox-filter-pills {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: 0;
}

.inbox-filter-pill {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  max-width: 100%;
}

.inbox-filter-pill:focus {
  outline: none;
  border-color: var(--teal);
}

.inbox-master-detail {
  display: grid;
  grid-template-columns: minmax(360px, 40%) 1fr;
  gap: 16px;
  align-items: start;
}

.inbox-list-pane {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  min-height: 400px;
  box-shadow: var(--shadow-sm);
}

.inbox-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--button-secondary-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--button-secondary-bg-hover);
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inbox-list-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
}

.inbox-list-item:hover {
  background: color-mix(in srgb, var(--teal) 4%, transparent);
}

.inbox-list-item.selected {
  background: color-mix(in srgb, var(--teal) 8%, transparent);
  border-color: color-mix(in srgb, var(--teal) 25%, transparent);
}

.inbox-list-item[data-prioritaet="dringend"] {
  border-left-color: var(--danger);
}

.inbox-list-item[data-prioritaet="hoch"] {
  border-left-color: var(--warning);
}

.inbox-list-item-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.inbox-list-item-body {
  flex: 1;
  min-width: 0;
}

.inbox-list-item-typ {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.inbox-list-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
}

.inbox-list-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-list-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 16px;
}

.inbox-detail-pane {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-height: 400px;
  box-shadow: var(--shadow-sm);
}

.inbox-detail-empty {
  display: block;
}

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

.inbox-detail-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.inbox-detail-content {
  padding: 24px;
}

.inbox-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.inbox-detail-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 6px;
}

.inbox-detail-meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.inbox-detail-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 20px;
  line-height: 1;
}

.inbox-detail-close:hover {
  color: var(--text);
}

.inbox-detail-section {
  margin-bottom: 20px;
}

.inbox-detail-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.inbox-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 16px;
}

.inbox-data-row {
  display: flex;
  flex-direction: column;
}

.inbox-data-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.inbox-data-value {
  font-size: 13.5px;
  color: var(--text);
  word-break: break-word;
}

.inbox-data-value--warning {
  color: var(--warning);
}

.inbox-actions-bar {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.inbox-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s;
}

.inbox-action-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.inbox-action-btn.secondary {
  background: color-mix(in srgb, var(--text) 3%, white);
  border-color: color-mix(in srgb, var(--border) 75%, var(--text) 25%);
  color: var(--text);
}

.inbox-action-btn.secondary:hover {
  background: color-mix(in srgb, var(--sky) 10%, white);
  border-color: var(--sky);
  color: var(--sky);
}

.inbox-action-btn.primary {
  background: var(--sky);
  color: white;
  border-color: var(--sky);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--sky) 28%, transparent);
}

.inbox-action-btn.primary:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.inbox-action-btn.danger {
  background: color-mix(in srgb, var(--danger) 10%, white);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  color: var(--danger);
}

.inbox-action-btn.danger:hover {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 16%, white);
  color: var(--danger);
}

.inbox-actions-bar .detail-action {
  min-height: 40px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.inbox-actions-bar .detail-action--positive {
  background: #0e97ad;
  border-color: #0e97ad;
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(14, 151, 173, 0.18);
}

.inbox-actions-bar .detail-action--positive:hover {
  background: #13acc4;
  border-color: #13acc4;
  color: #ffffff;
}

.inbox-actions-bar .detail-action--secondary {
  background: #24334a;
  border-color: #3a4b66;
  color: #c8d3e3;
}

.inbox-actions-bar .detail-action--secondary:hover {
  background: #2d3d56;
  border-color: #4a5f81;
  color: #ffffff;
}

.inbox-actions-bar .detail-action--danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.inbox-actions-bar .detail-action--danger:hover {
  background: rgba(239, 68, 68, 0.20);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}


.inbox-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.inbox-history-item {
  display: flex;
  gap: 10px;
  font-size: 13px;
}

.inbox-history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-top: 6px;
  flex-shrink: 0;
}

.inbox-history-item.user .inbox-history-dot {
  background: var(--teal);
}

.inbox-history-item.system .inbox-history-dot {
  background: var(--text-muted);
  opacity: 0.5;
}

.inbox-history-content {
  flex: 1;
}

.inbox-history-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.inbox-history-text {
  color: var(--text);
}

.inbox-comment-form {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.inbox-comment-form textarea {
  flex: 1;
  min-height: 60px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.inbox-comment-form textarea:focus {
  outline: none;
  border-color: var(--teal);
}

.inbox-snapshot-note {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.inbox-inline-toggle {
  margin-left: 8px;
  background: transparent;
  border: 0;
  color: var(--teal);
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.inbox-snapshot-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-3) 84%, transparent);
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  max-width: 360px;
  animation: toast-in 0.2s ease-out;
}

.toast.success {
  border-color: rgba(14, 151, 173, 0.3);
  color: var(--teal);
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

[data-theme="light"] .modal-overlay {
  background: rgba(15, 28, 46, 0.35);
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-width: 380px;
  max-width: 500px;
  width: 90%;
  animation: modalSlideIn 0.25s cubic-bezier(.34, 1.56, .64, 1);
}

.modal-confirm {
  min-width: 380px;
}

.modal-prompt {
  min-width: 480px;
}

.modal-danger {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.modal-header {
  padding: 20px 24px 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 0 24px 16px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  resize: vertical;
  transition: border-color 0.2s;
}

.modal-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 151, 173, 0.12);
}

.modal-footer {
  padding: 12px 24px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 16px;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  opacity: 0.9;
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}

[data-theme="light"] .panel-overlay {
  background: rgba(15, 28, 46, 0.3);
}

.panel {
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  width: 500px;
  max-width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(.34, 1.56, .64, 1);
}

.panel[data-panel-state="open"] {
  transform: translateX(0);
}

.panel[data-panel-state="closing"] {
  transform: translateX(100%);
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.panel-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.panel-close:hover {
  color: var(--text);
}

.panel-body {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

.panel-body .form-group {
  margin-bottom: 16px;
}

.panel-body label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.panel-body input[type="text"],
.panel-body input[type="date"],
.panel-body textarea,
.panel-body select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
}

.panel-body input:focus,
.panel-body textarea:focus,
.panel-body select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 151, 173, 0.12);
}

.panel-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  .inbox-master-detail {
    grid-template-columns: 1fr;
  }

  .inbox-filter-bar {
    grid-template-columns: 1fr;
  }

  .inbox-filter-pills {
    grid-column: 1;
  }

  .inbox-detail-pane.active {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg);
    overflow-y: auto;
    border-radius: 0;
  }
}

@media (max-width: 600px) {
  .panel {
    width: 100%;
  }

  .modal-prompt,
  .modal-confirm,
  .modal {
    min-width: min(92vw, 380px);
  }
}
