/* Bauherrenportal – Portal-Views CSS (Standalone)
   Farben: Anthrazit (#0f0f0f), Brand Primary (configurable via --brand-primary)
*/

:root {
  --brand-primary: #e8650a;
  --bp-bg: #0f0f0f;
  --bp-surface: #1a1a1a;
  --bp-surface-2: #222;
  --bp-border: #2e2e2e;
  --bp-orange: var(--brand-primary, #e8650a);
  --bp-orange-light: color-mix(in srgb, var(--brand-primary, #e8650a) 80%, #fff);
  --bp-text: #f0f0f0;
  --bp-text-muted: #999;
  --bp-radius: 8px;
  --bp-nav-h: 56px;
  --bp-transition: 0.18s ease;
}

/* Light Mode */
body.portal-page.light-mode {
  --bp-bg: #f5f5f5;
  --bp-surface: #ffffff;
  --bp-surface-2: #f0f0f0;
  --bp-border: #e0e0e0;
  --bp-text: #1a1a1a;
  --bp-text-muted: #666;
}
body.portal-page.light-mode .portal-header {
  background: rgba(255,255,255,.95);
  border-bottom-color: #e0e0e0;
}
body.portal-page.light-mode .portal-nav-link { color: #555; }
body.portal-page.light-mode .portal-nav-link.active { color: var(--bp-orange); }
body.portal-page.light-mode .portal-btn-ghost { color: #555; border-color: #ddd; }
body.portal-page.light-mode .portal-footer { background: #fff; border-top-color: #e0e0e0; }
body.portal-page.light-mode .portal-dashboard-card,
body.portal-page.light-mode .portal-feature-tile,
body.portal-page.light-mode .portal-quick-action,
body.portal-page.light-mode .portal-list-item { background: #fff; border-color: #e0e0e0; }
body.portal-page.light-mode .portal-quick-action--upload { border-color: var(--bp-orange); }

/* Theme select dropdown in header */
#themeSelect { -webkit-appearance:none; appearance:none; padding-right:20px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 6px center; }
#themeSelect:focus { outline:none; border-color:var(--bp-orange); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow-x: hidden; }
body.portal-page {
  background: var(--bp-bg);
  color: var(--bp-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.portal-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 15, 15, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bp-border);
  height: var(--bp-nav-h);
}
.portal-header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  height: 100%; padding: 0 20px;
}
.portal-logo { display: flex; align-items: baseline; gap: 2px; }
.portal-logo-brand { color: var(--bp-text); font-weight: 700; font-size: var(--fs-base); }
.portal-logo-sub { color: var(--bp-orange); font-weight: 700; font-size: var(--fs-base); }
.portal-logo-badge { font-size: var(--fs-xs); color: var(--bp-text-muted); margin-left: 8px; }
.portal-logo-link { text-decoration: none; display: flex; align-items: baseline; gap: 2px; }
.portal-logo-image {
  display: block;
  height: 34px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.portal-nav { display: flex; gap: 4px; margin-left: auto; }
.portal-nav-link {
  color: var(--bp-text-muted); text-decoration: none;
  padding: 6px 12px; border-radius: var(--bp-radius);
  font-size: var(--fs-md); font-weight: 500;
  transition: color var(--bp-transition), background var(--bp-transition);
}
.portal-nav-link:hover { color: var(--bp-text); background: rgba(255, 255, 255, .05); }
.portal-nav-link.active { color: var(--bp-orange); }
.portal-nav-link[aria-disabled="true"] { opacity: .35; pointer-events: none; cursor: default; }

.portal-header-actions { margin-left: 12px; }

.portal-btn {
  padding: 6px 14px; border-radius: var(--bp-radius);
  font-size: var(--fs-md); font-weight: 500; cursor: pointer;
  border: none; transition: all var(--bp-transition);
}
.portal-btn-ghost {
  background: transparent; color: var(--bp-text-muted);
  border: 1px solid var(--bp-border);
}
.portal-btn-ghost:hover { color: var(--bp-text); border-color: var(--bp-text-muted); }
.portal-btn-primary {
  background: var(--bp-orange);
  color: #fff;
  border: 1px solid transparent;
}
.portal-btn-primary:hover {
  background: var(--bp-orange-light);
}

.portal-main {
  flex: 1;
  padding: 40px 0;
}
.portal-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.portal-heading {
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-bottom: 8px;
}
.portal-subtext {
  color: var(--bp-text-muted);
  margin-bottom: 32px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.project-card {
  background: var(--bp-surface); border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius); padding: 24px;
  text-decoration: none; color: inherit;
  transition: border-color var(--bp-transition), transform var(--bp-transition);
  display: block;
}
.project-card:hover { border-color: var(--bp-orange); transform: translateY(-2px); }
.project-card-name { font-size: var(--fs-lg); font-weight: 600; margin-bottom: 6px; }
.project-card-address { font-size: var(--fs-sm); color: var(--bp-text-muted); margin-bottom: 12px; }
.project-card-status {
  display: inline-block; font-size: var(--fs-xs); font-weight: 600;
  padding: 2px 8px; border-radius: 100px;
  background: rgba(232, 101, 10, .15); color: var(--bp-orange);
}
.project-card-status[data-status="completed"] { background: rgba(80, 200, 80, .12); color: #6de06d; }
.project-card-status[data-status="archived"] { background: rgba(255, 255, 255, .06); color: var(--bp-text-muted); }

.phase-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.phase-item {
  background: var(--bp-surface); border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.phase-item-name { font-weight: 600; }
.phase-item-meta { font-size: var(--fs-sm); color: var(--bp-text-muted); }
.phase-item-progress { display:flex; align-items:center; gap:8px; margin-top:6px; }
.phase-item-progress-bar { flex:1; height:6px; background:var(--bp-border); border-radius:3px; overflow:hidden; max-width:180px; }
.phase-item-progress-fill { height:100%; background:var(--bp-orange); border-radius:3px; }
.phase-item-progress-text { font-size: var(--fs-xs); font-weight:600; color:var(--bp-orange); }
.portal-overall-progress { background:var(--bp-surface); border:1px solid var(--bp-border); border-radius:var(--bp-radius); padding:16px 20px; margin-bottom:16px; }
.portal-overall-progress-label { font-size: var(--fs-sm); font-weight:600; color:var(--bp-text-muted); margin-bottom:6px; }
.portal-overall-progress-bar { height:10px; background:var(--bp-border); border-radius:5px; overflow:hidden; }
.portal-overall-progress-fill { height:100%; background:var(--bp-orange); border-radius:5px; }
.portal-overall-progress-text { font-size: var(--fs-md); font-weight:700; color:var(--bp-orange); margin-top:6px; }

.doc-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.doc-filter-btn {
  padding: 6px 14px; border-radius: 100px; font-size: var(--fs-sm);
  background: var(--bp-surface); border: 1px solid var(--bp-border);
  color: var(--bp-text-muted); cursor: pointer;
  transition: all var(--bp-transition);
}
.doc-filter-btn.active,
.doc-filter-btn:hover { border-color: var(--bp-orange); color: var(--bp-orange); }
#roomtourPhaseFilter {
  min-width: 180px;
  background: rgba(255, 255, 255, .03);
}
#roomtourRoomFilter {
  min-width: 180px;
  background: rgba(255, 255, 255, .03);
}
.portal-header-inner--roomtour {
  max-width: none;
  gap: 12px;
}
.portal-header-inner--roomtour .portal-scene-info {
  max-width: 280px;
}
.portal-roomtour-filters {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.portal-scene-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.portal-scene-title {
  font-weight: 600;
  line-height: 1.2;
}
.portal-scene-meta {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
  line-height: 1.3;
}
.portal-scene-description {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-page--roomtour .portal-main {
  flex: 1;
  padding: 0;
}
/* Roomtour Viewer & Scene Navigation */

.roomtour-viewer {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
  margin-left: 200px;
}

.scene-nav {
  position: fixed;
  left: 0;
  top: var(--bp-nav-h);
  bottom: 0;
  width: 200px;
  background: var(--bp-surface);
  border-right: 1px solid var(--bp-border);
  overflow-y: auto;
  z-index: 50;
}

/* Inhalte unterhalb des Viewers */
.roomtour-below {
  margin-left: 200px;
}

.scene-nav-inner {
  padding: 16px 12px;
}

.scene-nav-heading {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bp-text-muted);
  margin: 0 0 12px 0;
}

.scene-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scene-nav-item.active .scene-nav-btn {
  background: rgba(232, 101, 10, .15);
  border-color: var(--bp-orange);
}

.scene-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--bp-radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--bp-text);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm);
  transition: background var(--bp-transition), border-color var(--bp-transition);
}

.scene-nav-btn:hover {
  background: rgba(255, 255, 255, .05);
}

.scene-nav-btn-title {
  font-weight: 600;
  line-height: 1.3;
}

.scene-nav-btn-meta {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
}
/* Hotspot Markers (Pannellum custom CSS classes) */

.roomtour-hotspot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0.75;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}

.roomtour-hotspot:hover,
.roomtour-hotspot:focus,
.roomtour-hotspot:active {
  transform: scale(1.35);
  opacity: 1;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
}

.roomtour-hotspot--scene {
  background: radial-gradient(circle, rgba(255, 159, 105, 0.85) 0%, rgba(240, 90, 40, 0.85) 65%, rgba(216, 78, 33, 0.85) 100%);
}

.roomtour-hotspot--info {
  background: radial-gradient(circle, rgba(130, 181, 255, 0.85) 0%, rgba(63, 123, 255, 0.85) 70%, rgba(45, 88, 200, 0.85) 100%);
}
/* Hotspot Info Panel (Side Drawer) */

.hotspot-panel {
  position: fixed;
  right: 0;
  top: var(--bp-nav-h);
  bottom: 0;
  width: 360px;
  max-width: 90vw;
  background: var(--bp-surface);
  border-left: 1px solid var(--bp-border);
  overflow-y: auto;
  z-index: 60;
  padding: 20px 18px;
  box-shadow: -4px 0 24px rgba(0, 0, 0, .3);
}

.hotspot-panel[hidden] {
  display: none;
}

.hotspot-panel-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--bp-text-muted);
  font-size: var(--fs-lg);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--bp-transition), background var(--bp-transition);
}

.hotspot-panel-close:hover {
  color: var(--bp-text);
  background: rgba(255, 255, 255, .08);
}

.hotspot-panel-head h3 {
  margin: 4px 0 6px;
  font-size: var(--fs-lg);
}

.hotspot-panel-sub {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
  margin-bottom: 8px;
}

.hotspot-panel-section {
  margin-top: 16px;
}

.hotspot-panel-section h4 {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--bp-text-muted);
  margin: 0 0 8px 0;
}

.hotspot-media-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hotspot-media-list li {
  font-size: var(--fs-sm);
}

.hotspot-media-list a {
  color: var(--bp-orange-light);
  text-decoration: none;
}

.hotspot-media-list a:hover {
  text-decoration: underline;
}
/* Hotspot Type Badges */

.hotspot-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.hotspot-type-badge--scene {
  background: rgba(232, 101, 10, .18);
  color: var(--bp-orange-light);
}

.hotspot-type-badge--info {
  background: rgba(63, 123, 255, .18);
  color: #82b5ff;
}
/* Quick-Actions Kundenzentrale */

.portal-quick-actions-section {
  margin-bottom: 24px;
}
.portal-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.portal-quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  text-decoration: none;
  color: var(--bp-text);
  transition: border-color var(--bp-transition), background var(--bp-transition);
}
.portal-quick-action:hover {
  border-color: var(--bp-orange);
  background: var(--bp-surface-2);
}
.portal-quick-action-icon {
  font-size: var(--fs-xl);
  flex-shrink: 0;
}
.portal-quick-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.portal-quick-action-text strong {
  font-size: var(--fs-md);
  font-weight: 600;
}
.portal-quick-action-text span {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
}
/* Document Cards (Dokumentenbereich) */

.doc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  margin-bottom: 8px;
  transition: border-color var(--bp-transition);
}
.doc-card:hover {
  border-color: var(--bp-orange);
}
.doc-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.doc-card-info {
  min-width: 0;
}
.doc-card-download {
  flex-shrink: 0;
  text-decoration: none;
  font-size: var(--fs-sm);
  padding: 6px 14px;
}

/* Neu-Badge */
.portal-doc-new-badge {
  display: inline-block;
  background: var(--bp-orange);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .03em;
  vertical-align: middle;
  margin-left: 6px;
}
/* Upload Quick-Action (button statt <a>) */

button.portal-quick-action--upload {
  cursor: pointer;
  border: 2px dashed var(--bp-orange);
  background: transparent;
  font: inherit;
  text-align: left;
}
button.portal-quick-action--upload:hover {
  background: rgba(226,120,37,.08);
  border-style: solid;
}

/* ====================================================
   Upload Dialog
   ==================================================== */

.portal-upload-dialog {
  border: none;
  border-radius: var(--bp-radius);
  background: var(--bp-bg);
  color: var(--bp-text);
  padding: 0;
  max-width: 480px;
  width: 92vw;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.portal-upload-dialog::backdrop {
  background: rgba(0,0,0,.55);
}
.portal-upload-dialog-inner {
  padding: 24px;
}
.portal-upload-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.portal-upload-dialog-header h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin: 0;
}
.portal-upload-dialog-close {
  background: none;
  border: none;
  color: var(--bp-text-muted);
  font-size: var(--fs-xl);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.portal-upload-dialog-close:hover {
  color: var(--bp-text);
}

/* Dropzone */
.portal-upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  border: 2px dashed var(--bp-border);
  border-radius: var(--bp-radius);
  cursor: pointer;
  transition: border-color var(--bp-transition), background var(--bp-transition);
  text-align: center;
  margin-bottom: 16px;
}
.portal-upload-dropzone:hover,
.portal-upload-dropzone--hover {
  border-color: var(--bp-orange);
  background: rgba(226,120,37,.06);
}
.portal-upload-dropzone-icon {
  font-size: var(--fs-2xl);
}
.portal-upload-dropzone p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--bp-text-muted);
}
.portal-upload-file-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Filename display */
.portal-upload-filename {
  font-size: var(--fs-sm);
  padding: 8px 12px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  margin-bottom: 12px;
  word-break: break-all;
}

/* Form fields */
.portal-upload-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--bp-text-muted);
  margin-bottom: 4px;
  margin-top: 10px;
}
.portal-upload-select,
.portal-upload-input {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  background: var(--bp-surface);
  color: var(--bp-text);
  font: inherit;
  font-size: var(--fs-md);
  box-sizing: border-box;
}
.portal-upload-select:focus,
.portal-upload-input:focus {
  outline: none;
  border-color: var(--bp-orange);
}
.portal-upload-textarea {
  resize: vertical;
  min-height: 48px;
}

/* Actions */
.portal-upload-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* Status message */
.portal-upload-status {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: var(--bp-radius);
  font-size: var(--fs-sm);
}
.portal-upload-status--error {
  background: rgba(220,53,69,.12);
  color: #f87171;
  border: 1px solid rgba(220,53,69,.25);
}
.portal-upload-status--success {
  background: rgba(40,167,69,.12);
  color: #4ade80;
  border: 1px solid rgba(40,167,69,.25);
}

/* ====================================================
   Additional portal component styles
   ==================================================== */

.portal-footer {
  padding: 20px 0;
  border-top: 1px solid var(--bp-border);
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
  text-align: center;
}

.portal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 0;
  color: var(--bp-text-muted);
}

.portal-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bp-border);
  border-top-color: var(--bp-orange);
  border-radius: 50%;
  animation: bp-spin .6s linear infinite;
}
@keyframes bp-spin { to { transform: rotate(360deg); } }

.portal-error-banner {
  background: rgba(220,53,69,.12);
  color: #f87171;
  border: 1px solid rgba(220,53,69,.25);
  border-radius: var(--bp-radius);
  padding: 16px 20px;
  font-size: var(--fs-md);
}

.portal-empty-state {
  text-align: center;
  padding: 48px 24px;
}
.portal-empty-icon {
  font-size: var(--fs-2xl);
  margin-bottom: 12px;
}
.portal-empty-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: 8px;
}
.portal-empty-text {
  color: var(--bp-text-muted);
  font-size: var(--fs-md);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

.portal-link-more {
  display: inline-block;
  margin-top: 12px;
  color: var(--bp-orange);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
}
.portal-link-more:hover {
  text-decoration: underline;
}

.portal-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--bp-text-muted);
  margin-bottom: 16px;
}
.portal-breadcrumb a {
  color: var(--bp-text-muted);
  text-decoration: none;
}
.portal-breadcrumb a:hover {
  color: var(--bp-orange);
}
.portal-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--bp-border, #ddd);
  border-radius: 6px;
  text-decoration: none !important;
  color: inherit !important;
  font-size: var(--fs-md);
  transition: background .15s, border-color .15s;
}
.portal-back-btn:hover {
  background: var(--bp-orange);
  border-color: var(--bp-orange);
  color: #fff !important;
}

.portal-section {
  margin-top: 32px;
}
.portal-section-heading {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: 16px;
}

.portal-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.portal-dashboard-card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 20px;
}
.portal-dashboard-card h3 {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--bp-text-muted);
  margin-bottom: 8px;
}
.portal-dashboard-value {
  font-size: var(--fs-base);
  font-weight: 600;
  margin-bottom: 4px;
}
.portal-dashboard-meta {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
}

.portal-progress-track {
  height: 6px;
  background: var(--bp-border);
  border-radius: 3px;
  margin-bottom: 8px;
  overflow: hidden;
}
.portal-progress-bar {
  height: 100%;
  background: var(--bp-orange);
  border-radius: 3px;
  transition: width .4s ease;
}

.portal-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.portal-badge-pill {
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid var(--bp-border);
}
.portal-badge-pill.is-on {
  background: rgba(80, 200, 80, .1);
  color: #6de06d;
  border-color: rgba(80, 200, 80, .3);
}
.portal-badge-pill.is-off {
  color: var(--bp-text-muted);
}

.portal-mini-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.portal-mini-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-sm);
}
.portal-mini-list li a {
  color: var(--bp-orange);
  text-decoration: none;
}
.portal-mini-list li a:hover {
  text-decoration: underline;
}
.portal-mini-list li span:last-child {
  color: var(--bp-text-muted);
  flex-shrink: 0;
}
.portal-mini-list-empty {
  color: var(--bp-text-muted);
  font-size: var(--fs-sm);
}

.portal-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.portal-feature-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  text-decoration: none;
  color: var(--bp-text);
  text-align: center;
  transition: border-color var(--bp-transition), background var(--bp-transition);
}
.portal-feature-tile:hover {
  border-color: var(--bp-orange);
  background: var(--bp-surface-2);
}
.portal-feature-icon {
  font-size: var(--fs-xl);
}
.portal-feature-name {
  font-size: var(--fs-sm);
  font-weight: 500;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.project-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.project-meta-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--bp-text-muted);
}
.project-meta-value {
  font-size: var(--fs-md);
}

.portal-list-item {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 20px 24px;
  margin-bottom: 12px;
}
.portal-list-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.portal-list-item-head h2 {
  font-size: var(--fs-lg);
  font-weight: 600;
}
.portal-list-item-text {
  color: var(--bp-text-muted);
  font-size: var(--fs-md);
  margin-bottom: 8px;
}
.portal-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
}
.portal-inline-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.portal-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.portal-media-card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .15s;
}
.portal-media-card:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
  border-color: var(--bp-orange);
}
.portal-media-thumb {
  display: block;
}
.portal-media-thumb img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}
.portal-media-content {
  padding: 14px 16px;
}
.portal-media-content h3 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin-bottom: 4px;
}
.portal-media-content p {
  font-size: var(--fs-sm);
  color: var(--bp-text-muted);
  margin-bottom: 4px;
}
.portal-list-meta-line {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  text-decoration: none;
  color: var(--bp-text);
  margin-bottom: 6px;
  transition: border-color var(--bp-transition);
}
.doc-item:hover {
  border-color: var(--bp-orange);
}
.doc-item-icon {
  font-size: var(--fs-lg);
  flex-shrink: 0;
}
.doc-item-name {
  font-weight: 500;
  font-size: var(--fs-md);
}
.doc-item-meta {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
}

/* Messages */
.portal-message-form {
  margin-bottom: 24px;
}
.portal-form-row {
  margin-bottom: 12px;
}
.portal-form-row label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--bp-text-muted);
  margin-bottom: 4px;
}
.portal-form-row input,
.portal-form-row textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  background: var(--bp-surface);
  color: var(--bp-text);
  font: inherit;
  font-size: var(--fs-md);
}
.portal-form-row input:focus,
.portal-form-row textarea:focus {
  outline: none;
  border-color: var(--bp-orange);
}
.portal-form-actions {
  margin-top: 12px;
}
.portal-form-hint {
  font-size: var(--fs-sm);
  margin-top: 8px;
  color: var(--bp-text-muted);
}
.portal-form-hint.is-error {
  color: #f87171;
}

.portal-message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.portal-message-bubble {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 14px 18px;
}
.portal-message-bubble.is-user {
  border-left: 3px solid var(--bp-orange);
}
.portal-message-bubble.is-team {
  border-left: 3px solid #3f7bff;
}
.portal-message-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
}
.portal-message-head span {
  color: var(--bp-text-muted);
  font-size: var(--fs-xs);
}
.portal-message-bubble p {
  font-size: var(--fs-md);
  line-height: 1.5;
  margin-bottom: 6px;
}
.portal-message-meta {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
}

/* Contact card */
.portal-contact-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
}
.portal-contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bp-orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.portal-contact-name {
  font-weight: 600;
  font-size: var(--fs-md);
}
.portal-contact-role {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
}

/* Back link */
.portal-back-link {
  color: var(--bp-text-muted);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  flex-shrink: 0;
}
.portal-back-link:hover {
  color: var(--bp-text);
}

/* ====================================================
   Hamburger Button (hidden on desktop)
   ==================================================== */
.portal-hamburger { display: none; }

/* ====================================================
   Bottom Tab Bar (hidden on desktop)
   ==================================================== */
.bp-bottom-nav { display: none; }

/* ====================================================
   MOBILE  (max-width: 768px)
   ==================================================== */
@media (max-width: 768px) {
  :root {
    --bp-bottom-nav-h: 56px;
  }

  body.portal-page {
    padding-bottom: calc(var(--bp-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    font-size: var(--fs-md);
  }

  /* ── Header ── */
  .portal-header { height: auto; min-height: var(--bp-nav-h); }
  .portal-header-inner { padding: 0 12px; gap: 8px; }
  .portal-logo-brand { font-size: var(--fs-md); }
  .portal-logo-image { max-height: 28px; }

  /* Nav ausblenden */
  .portal-nav {
    display: none;
    position: fixed; top: var(--bp-nav-h); left: 0; right: 0; bottom: 0;
    background: var(--bp-bg); z-index: 200;
    flex-direction: column; padding: 16px; gap: 4px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    animation: portalSlideDown .2s ease;
  }
  @keyframes portalSlideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
  .portal-nav.is-open { display: flex; }
  .portal-nav-link { font-size: var(--fs-base); padding: 14px 16px; border-radius: var(--bp-radius); }
  .portal-nav-link:hover, .portal-nav-link.active { background: var(--bp-surface); }

  /* Hamburger oben ausgeblendet — Navigation läuft über Bottom-Nav.
     DOM-Element bleibt, damit "Mehr"-Button unten via hamburger.click() das Menü togglen kann. */
  .portal-hamburger { display: none !important; }
  .portal-hamburger--legacy {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; background: none; border: none;
    cursor: pointer; padding: 10px; margin-left: auto;
  }
  .portal-hamburger span {
    display: block; height: 2px; width: 20px;
    background: var(--bp-text); border-radius: 1px;
    transition: transform .2s, opacity .2s;
  }
  .portal-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .portal-hamburger.is-open span:nth-child(2) { opacity: 0; }
  .portal-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Header-Actions */
  .portal-header-actions { display: none; }

  /* ── Main & Container ── */
  .portal-main { padding: 16px 0; }
  .portal-container { padding: 0 12px; }
  .portal-heading { font-size: var(--fs-lg); }
  .portal-subtext { font-size: var(--fs-sm); margin-bottom: 16px; }

  /* ── Project Grid ── */
  .project-grid { grid-template-columns: 1fr; gap: 12px; }
  .project-card { padding: 16px; }

  /* ── Quick Actions ── */
  .portal-quick-actions { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .portal-quick-action { padding: 12px; }

  /* ── Dashboard Grid ── */
  .portal-dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
  .portal-dashboard-card { padding: 14px; }

  /* ── Card Grid ── */
  .portal-card-grid { grid-template-columns: 1fr; gap: 12px; }

  /* ── Doc Filter ── */
  .doc-filter { gap: 6px; }
  .doc-filter-btn { font-size: var(--fs-xs); padding: 6px 12px; min-height: 38px; }

  /* ── Doc Cards ── */
  .doc-card { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }

  /* ── Phase Items ── */
  .phase-item { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; }

  /* ── Media Cards ── */
  .portal-media-card { padding: 10px; }
  .portal-media-card img { height: 140px; }

  /* ── List Items ── */
  .portal-list-item { padding: 12px; }

  /* ── Roomtour ── */
  .portal-header-inner--roomtour {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 6px;
  }
  .portal-scene-info { display: none; }
  .portal-roomtour-filters {
    order: 10;
    width: 100%;
    gap: 4px;
  }
  .portal-roomtour-filters select {
    flex: 1;
    min-width: 0;
    font-size: var(--fs-xs);
    padding: 5px 8px;
  }
  .scene-nav {
    position: fixed; left: 0; top: var(--bp-nav-h); bottom: var(--bp-bottom-nav-h);
    width: 85vw; max-width: 300px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 150;
  }
  .scene-nav.is-open { transform: translateX(0); }
  .roomtour-viewer { margin-left: 0; }
  .roomtour-below { margin-left: 0; }
  .hotspot-panel {
    position: fixed; right: 0; top: var(--bp-nav-h); bottom: var(--bp-bottom-nav-h);
    width: 100vw; max-width: 100vw;
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 160;
  }
  .hotspot-panel.is-open { transform: translateX(0); }

  /* ── Messages ── */
  .portal-message-bubble { padding: 12px; font-size: var(--fs-sm); }

  /* ── Upload Dialog ── */
  .portal-upload-dialog {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
    border-radius: 0;
  }

  /* ── Breadcrumb ── */
  .portal-breadcrumb { font-size: var(--fs-xs); flex-wrap: wrap; }

  /* ── Forms ── */
  .portal-form-row input,
  .portal-form-row select,
  .portal-form-row textarea {
    font-size: 16px; min-height: 44px;
  }

  /* ── Buttons Touch ── */
  .portal-btn { min-height: 44px; padding: 10px 16px; }

  /* ── Footer ── */
  .portal-footer { margin-bottom: 60px; }

  /* ── Empty State ── */
  .portal-empty-state { padding: 30px 16px; }

  /* ── Bottom Tab Bar ── */
  .bp-bottom-nav {
    display: flex; position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bp-bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bp-surface);
    border-top: 1px solid var(--bp-border);
    z-index: 300;
    justify-content: space-around; align-items: center;
  }
  .bp-bottom-nav-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; text-decoration: none;
    color: var(--bp-text-muted); font-size: var(--fs-xs); font-weight: 500;
    padding: 6px 0; min-width: 56px; min-height: 44px;
    justify-content: center; transition: color .15s;
  }
  .bp-bottom-nav-item.active { color: var(--bp-orange); }
  .bp-bottom-nav-icon { font-size: var(--fs-lg); line-height: 1; }
}

/* Light mode mobile overrides */
@media (max-width: 768px) {
  body.portal-page.light-mode .portal-nav.is-open { background: #fff; }
  body.portal-page.light-mode .bp-bottom-nav { background: #fff; border-top-color: #e0e0e0; }
  body.portal-page.light-mode .portal-hamburger span { background: #333; }
  body.portal-page.light-mode .scene-nav { background: #fff; }
}

/* ═════════════════════════════════════════════════════════════════════════════
   Portal Dashboard Widgets
   ═════════════════════════════════════════════════════════════════════════════ */

/* Two-column grid */
.portal-dashboard-grid--two {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px;
}
@media (max-width: 768px) {
  .portal-dashboard-grid--two { grid-template-columns: 1fr; }
}

/* Photo Carousel */
.portal-carousel {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; padding-bottom: 8px;
  scrollbar-width: thin; scrollbar-color: var(--bp-border) transparent;
}
.portal-carousel::-webkit-scrollbar { height: 4px; }
.portal-carousel::-webkit-scrollbar-thumb { background: var(--bp-border); border-radius: 2px; }
.portal-carousel-item {
  flex: 0 0 220px; scroll-snap-align: start; border-radius: var(--bp-radius);
  overflow: hidden; position: relative; aspect-ratio: 4/3;
  background: var(--bp-surface); border: 1px solid var(--bp-border);
}
.portal-carousel-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.portal-carousel-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  padding: 8px 10px 6px; font-size: var(--fs-xs); color: #fff;
}
@media (max-width: 768px) {
  .portal-carousel-item { flex: 0 0 180px; }
}

/* Next Appointment Card */
.portal-card-appointment {
  border-left: 3px solid var(--bp-orange);
}
.portal-appointment-date {
  font-size: var(--fs-lg); font-weight: 700; color: var(--bp-orange); margin-top: 8px;
}
.portal-appointment-title {
  font-size: var(--fs-sm); color: var(--bp-text-muted); margin-top: 4px;
}

/* Activity Feed */
.portal-activity-feed {
  display: flex; flex-direction: column; gap: 8px; margin-top: 8px;
}
.portal-activity-item {
  display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm);
  padding: 6px 0; border-bottom: 1px solid var(--bp-border);
}
.portal-activity-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); flex-shrink: 0; background: var(--bp-border);
}
.portal-activity-text { color: var(--bp-text); }
.portal-activity-count {
  margin-left: auto; font-weight: 600; color: var(--bp-orange); font-size: var(--fs-sm);
}

/* Enhanced Contact Card */
.portal-contact-card {
  background: var(--bp-surface); border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius); padding: 20px;
}
.portal-contact-name {
  font-size: var(--fs-lg); font-weight: 700; color: var(--bp-text); margin-bottom: 12px;
}
.portal-contact-details {
  display: flex; flex-direction: column; gap: 8px;
}
.portal-contact-row {
  display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm);
}
.portal-contact-icon { font-size: var(--fs-base); width: 20px; text-align: center; flex-shrink: 0; }
.portal-contact-value { color: var(--bp-text-muted); }
.portal-contact-value a { color: var(--bp-orange); text-decoration: none; }
.portal-contact-value a:hover { text-decoration: underline; }

/* Enhanced Progress Bar */
.portal-progress-track {
  height: 10px; background: var(--bp-border); border-radius: 5px; overflow: hidden;
}
.portal-progress-bar {
  height: 100%; background: var(--bp-orange); border-radius: 5px;
  transition: width .8s ease;
}

/* Offline Banner */
.bp-offline-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(234,179,8,.15);
  border: 1px solid rgba(234,179,8,.3);
  color: #facc15;
  font-size: var(--fs-sm);
  border-radius: var(--bp-radius);
  margin: 12px 16px 0;
}
.bp-offline-banner.visible {
  display: flex;
}
