/* Betriebsportal – Portalübersicht v13.0.2 */

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

:root {
  --bp-bg: #f3f4f6;
  --bp-card: #ffffff;
  --bp-text: #0f172a;
  --bp-muted: #64748b;
  --bp-line: #e2e8f0;
  --bp-soft: #f8fafc;
  --bp-primary: #0f766e;
  --bp-primary-2: #2563eb;
  --bp-primary-soft: #ecfdf5;
  --bp-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 8%, rgba(20, 184, 166, 0.12), transparent 30%),
    radial-gradient(circle at 84% 0%, rgba(37, 99, 235, 0.10), transparent 32%),
    var(--bp-bg);
  color: var(--bp-text);
}

.page {
  max-width: 1320px;
  margin: 32px auto;
  padding: 0 16px;
}

.card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 22px;
  padding: 24px 26px 28px;
  box-shadow: var(--bp-shadow);
  backdrop-filter: blur(8px);
}

.portal-main-card {
  min-width: 0;
}

/* Header */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.portal-brand-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--bp-line);
}

.portal-brand-block {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.portal-brand-logo {
  width: 78px;
  height: 78px;
  flex: 0 0 auto;
  filter: drop-shadow(0 14px 26px rgba(15, 118, 110, 0.22));
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.portal-brand-subtitle {
  margin: 0 0 10px;
  color: #0f766e;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.page-header small {
  display: block;
  font-size: 13px;
  color: var(--bp-muted);
}

.wt-version {
  margin-top: 2px;
}

/* Buttons */

button {
  border-radius: 10px;
  border: none;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

button.secondary {
  background: #e8eef5;
  color: #0f172a;
  border: 1px solid #dbe4ef;
}

button.primary {
  background: linear-gradient(135deg, var(--bp-primary), var(--bp-primary-2));
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.24);
}

button.secondary:hover,
button.primary:hover {
  transform: translateY(-1px);
}

button.secondary:hover {
  background: #dbe5ef;
}

button.compact {
  padding: 6px 10px;
  font-size: 12px;
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Modulgruppen */

.modules-section {
  margin-top: 18px;
}

.modules-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.modules-section-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.modules-section-head p {
  margin: 0;
  max-width: 740px;
  color: var(--bp-muted);
  line-height: 1.42;
}

.module-group-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.module-total-count {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid var(--bp-line);
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.module-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-group {
  border: 1px solid var(--bp-line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(248, 250, 252, 0.88);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
}

.module-group-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  min-height: 74px;
  user-select: none;
}

.module-group-summary::-webkit-details-marker {
  display: none;
}

.module-group-main {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.module-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.10));
  border: 1px solid rgba(15, 118, 110, 0.16);
  font-size: 21px;
}

.module-group-title {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.module-group-description {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--bp-muted);
}

.module-group-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.module-group-count {
  font-size: 12px;
  font-weight: 750;
  color: #334155;
  background: #ffffff;
  border: 1px solid var(--bp-line);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}

.module-group-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #475569;
  background: #ffffff;
  border: 1px solid var(--bp-line);
  transition: transform 0.16s ease;
}

.module-group[open] .module-group-chevron {
  transform: rotate(180deg);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.module-group-grid {
  padding: 0 16px 16px;
}

.module-card {
  background: #ffffff;
  border-radius: 15px;
  padding: 13px 14px 14px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  min-height: 86px;
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.075);
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    border-color 0.14s ease,
    background-color 0.14s ease;
}

.module-card:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.26);
  outline-offset: 2px;
}

.module-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 5px;
}

.module-desc {
  font-size: 13px;
  color: var(--bp-muted);
  line-height: 1.35;
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.15);
  border-color: rgba(15, 118, 110, 0.34);
  background: linear-gradient(180deg, #ffffff 0%, #f8fffd 100%);
}

.module-card:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14) inset;
  background-color: #f0fdfa;
}

.module-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  color: var(--bp-muted);
  padding: 18px;
  font-size: 14px;
}

/* Layout mit Änderungs-Sidebar */

.portal-page-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.portal-changes-sidebar {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--bp-shadow);
  position: sticky;
  top: 18px;
  backdrop-filter: blur(8px);
}

.portal-changes-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.portal-changes-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.portal-changes-sub {
  font-size: 12px;
  color: var(--bp-muted);
  margin-top: 4px;
}

.portal-changes-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-change-group {
  border: 1px solid var(--bp-line);
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
}

.portal-change-group summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-weight: 700;
  background: #f8fafc;
}

.portal-change-group summary::-webkit-details-marker {
  display: none;
}

.portal-change-count {
  font-size: 12px;
  color: #475569;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 1px 8px;
}

.portal-change-group-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portal-change-module-link-row {
  display: flex;
  justify-content: flex-start;
}

.portal-change-module-link {
  font-size: 13px;
  color: var(--bp-primary-2);
  text-decoration: none;
}

.portal-change-module-link:hover {
  text-decoration: underline;
}

.portal-change-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #f1f5f9;
}

.portal-change-item:first-of-type {
  border-top: none;
}

.portal-change-title {
  font-size: 13px;
  line-height: 1.3;
}

.portal-change-time {
  font-size: 11px;
  color: var(--bp-muted);
  white-space: nowrap;
}

.portal-changes-empty,
.portal-changes-error,
.portal-changes-hint {
  font-size: 13px;
  color: var(--bp-muted);
}

.portal-changes-error {
  color: #b91c1c;
}

.portal-changes-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* Modal */

.portal-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 16px 16px;
  z-index: 100;
}

.portal-modal {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  max-width: 480px;
  width: 100%;
  padding: 18px 20px 20px;
}

.tenant-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--bp-line);
}

.tenant-option:last-child {
  border-bottom: none;
}

.portal-modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Responsiv */

@media (max-width: 1280px) {
  .portal-page-with-sidebar {
    grid-template-columns: 1fr;
  }

  .portal-changes-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .page {
    margin-top: 16px;
  }

  .card,
  .portal-changes-sidebar {
    padding: 18px;
    border-radius: 18px;
  }

  .page-header,
  .modules-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-brand-block {
    gap: 12px;
  }

  .portal-brand-logo {
    width: 58px;
    height: 58px;
  }

  .module-group-summary {
    align-items: flex-start;
    padding: 14px;
  }

  .module-group-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .module-group-description {
    display: none;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }
}
