:root {
  --pm-green-950: #062d1d;
  --pm-green-900: #0b3d28;
  --pm-green-800: #145b3a;
  --pm-green-700: #1d7549;
  --pm-green-600: #2b8e59;
  --pm-mint: #e8f4eb;
  --pm-cream: #f4f6f1;
  --pm-paper: #fffefb;
  --pm-ink: #13291d;
  --pm-muted: #66766d;
  --pm-line: rgba(12, 61, 39, .13);
  --pm-shadow-sm: 0 8px 24px rgba(7, 45, 28, .07);
  --pm-shadow: 0 24px 70px rgba(7, 45, 28, .12);
}

/* Sichtbare Scrollleiste im Anfrage-Posteingang */
html body .portal-view[data-view="inquiries"] .inquiry-inbox-panel {
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr) !important;
  align-self: start;
  max-height: calc(100svh - 112px) !important;
  overflow: hidden !important;
}

html body .portal-view[data-view="inquiries"] .inquiry-inbox-list {
  min-height: 0 !important;
  max-height: min(640px, calc(100svh - 330px)) !important;
  padding-right: 8px !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #2b8e59 #e4eee6;
}

html body .portal-view[data-view="inquiries"] .inquiry-inbox-list::-webkit-scrollbar {
  width: 11px;
}

html body .portal-view[data-view="inquiries"] .inquiry-inbox-list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #e4eee6;
}

html body .portal-view[data-view="inquiries"] .inquiry-inbox-list::-webkit-scrollbar-thumb {
  min-height: 42px;
  border: 2px solid #e4eee6;
  border-radius: 999px;
  background: #2b8e59;
}

html body .portal-view[data-view="inquiries"] .inquiry-inbox-list::-webkit-scrollbar-thumb:hover {
  background: #176f43;
}

@media (max-width: 1180px) {
  html body .portal-view[data-view="inquiries"] .inquiry-inbox-panel {
    position: static !important;
    max-height: none !important;
  }

  html body .portal-view[data-view="inquiries"] .inquiry-inbox-list {
    height: clamp(360px, 58svh, 620px) !important;
    max-height: none !important;
  }
}

html body {
  background:
    radial-gradient(circle at 100% 0, rgba(215, 232, 124, .1), transparent 30rem),
    var(--pm-cream) !important;
  color: var(--pm-ink) !important;
}

html body :focus-visible {
  outline: 3px solid rgba(232, 191, 85, .9) !important;
  outline-offset: 3px;
}

/* Login */
html body .login-screen {
  background:
    radial-gradient(circle at 14% 12%, rgba(43, 142, 89, .16), transparent 30rem),
    radial-gradient(circle at 88% 82%, rgba(215, 232, 124, .13), transparent 26rem),
    var(--pm-cream) !important;
}

html body .login-shell {
  width: min(calc(100% - 30px), 980px) !important;
  overflow: hidden;
  border: 1px solid var(--pm-line) !important;
  border-radius: 30px !important;
  background: white !important;
  box-shadow: var(--pm-shadow) !important;
}

html body .login-brand-panel {
  background:
    radial-gradient(circle at 85% 10%, rgba(215, 232, 124, .14), transparent 20rem),
    linear-gradient(145deg, var(--pm-green-950), var(--pm-green-800)) !important;
}

html body .login-form-panel {
  background: #fff !important;
}

html body .login-form-panel h1,
html body .login-form-panel h2 {
  color: var(--pm-green-950) !important;
  letter-spacing: -.035em;
}

html body .login-form-panel input {
  min-height: 50px !important;
  border: 1px solid var(--pm-line) !important;
  border-radius: 13px !important;
  background: #fbfcf9 !important;
  color: var(--pm-ink) !important;
}

/* Portalrahmen */
html body .portal-shell {
  min-height: 100vh;
  background: transparent !important;
}

@media (min-width: 1101px) {
  html body .portal-shell {
    grid-template-columns: 264px minmax(0, 1fr) !important;
  }

  html body .portal-sidebar {
    position: sticky !important;
    top: 0;
    width: 264px !important;
    height: 100vh !important;
    transform: none !important;
  }
}

html body .portal-sidebar {
  padding: 18px 14px !important;
  border-right: 1px solid rgba(255, 255, 255, .09) !important;
  background:
    radial-gradient(circle at 60% 0, rgba(215, 232, 124, .1), transparent 18rem),
    var(--pm-green-950) !important;
  color: white !important;
  box-shadow: 12px 0 40px rgba(6, 45, 29, .09) !important;
}

html body .portal-brand {
  padding: 10px !important;
  border: 1px solid rgba(255, 255, 255, .12) !important;
  border-radius: 17px !important;
  background: rgba(255, 255, 255, .07) !important;
}

html body .portal-brand strong,
html body .portal-brand small {
  color: white !important;
}

html body .portal-nav {
  gap: 5px !important;
  margin-top: 20px !important;
}

html body .portal-nav-label {
  margin: 15px 10px 5px !important;
  color: rgba(255, 255, 255, .46) !important;
  font-size: .62rem !important;
  letter-spacing: .12em !important;
}

html body .portal-nav button {
  min-height: 42px !important;
  padding: 9px 12px !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, .72) !important;
  font-weight: 750 !important;
}

html body .portal-nav button:hover,
html body .portal-nav button:focus-visible {
  border-color: rgba(255, 255, 255, .1) !important;
  background: rgba(255, 255, 255, .07) !important;
  color: white !important;
}

html body .portal-nav button.is-active {
  border-color: rgba(255, 255, 255, .15) !important;
  background: linear-gradient(135deg, var(--pm-green-700), var(--pm-green-600)) !important;
  color: white !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18) !important;
}

html body .portal-sidebar-footer {
  border-top-color: rgba(255, 255, 255, .1) !important;
}

html body .portal-sidebar-footer a,
html body .portal-sidebar-footer button {
  border-color: rgba(255, 255, 255, .12) !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, .06) !important;
  color: rgba(255, 255, 255, .78) !important;
}

html body .portal-main {
  min-width: 0;
  padding: 0 clamp(12px, 2vw, 28px) 34px !important;
}

html body .portal-topbar {
  position: sticky !important;
  z-index: 40;
  top: 0;
  min-height: 76px !important;
  margin-bottom: 18px !important;
  padding: 12px 4px 12px 8px !important;
  border-bottom: 1px solid var(--pm-line) !important;
  background: rgba(244, 246, 241, .9) !important;
  backdrop-filter: blur(18px);
}

html body .portal-topbar h1 {
  color: var(--pm-green-950) !important;
  font-size: clamp(1.65rem, 2.3vw, 2.35rem) !important;
  letter-spacing: -.035em;
}

html body .portal-kicker {
  color: var(--pm-green-700) !important;
  letter-spacing: .09em !important;
}

html body .demo-badge,
html body .user-pill,
html body .portal-link {
  border: 1px solid var(--pm-line) !important;
  border-radius: 999px !important;
  background: white !important;
  color: var(--pm-green-900) !important;
  box-shadow: var(--pm-shadow-sm) !important;
}

/* Gemeinsame Flaechen */
html body .portal-view {
  max-width: 1680px !important;
  margin-inline: auto !important;
}

html body .portal-welcome,
html body .section-head,
html body .panel,
html body .settings-card,
html body .editor-section,
html body .mail-card,
html body .dashboard-grid article {
  border: 1px solid var(--pm-line) !important;
  border-radius: 20px !important;
  background: rgba(255, 255, 255, .94) !important;
  color: var(--pm-ink) !important;
  box-shadow: var(--pm-shadow-sm) !important;
}

html body .portal-welcome {
  padding: clamp(22px, 3vw, 36px) !important;
  background:
    radial-gradient(circle at 88% 0, rgba(215, 232, 124, .14), transparent 25rem),
    linear-gradient(135deg, #fff, #f1f7f1) !important;
}

html body .portal-welcome h2,
html body .section-head h2,
html body .panel h2,
html body .panel h3 {
  color: var(--pm-green-950) !important;
  letter-spacing: -.025em;
}

html body .quick-actions button,
html body .dashboard-grid article {
  border: 1px solid var(--pm-line) !important;
  border-radius: 16px !important;
  background: white !important;
  color: var(--pm-ink) !important;
}

html body .quick-actions button:hover {
  border-color: rgba(29, 117, 73, .34) !important;
  background: var(--pm-mint) !important;
  transform: translateY(-2px);
}

html body input,
html body select,
html body textarea {
  min-height: 44px !important;
  border: 1px solid var(--pm-line) !important;
  border-radius: 11px !important;
  background: #fbfcf9 !important;
  color: var(--pm-ink) !important;
  box-shadow: none !important;
}

html body textarea {
  min-height: 100px;
}

html body input:focus,
html body select:focus,
html body textarea:focus {
  border-color: var(--pm-green-600) !important;
  box-shadow: 0 0 0 4px rgba(43, 142, 89, .11) !important;
}

html body label {
  color: #294b39 !important;
}

html body .solid-button {
  border: 0 !important;
  border-radius: 11px !important;
  background: linear-gradient(135deg, var(--pm-green-700), var(--pm-green-800)) !important;
  color: white !important;
  box-shadow: 0 9px 22px rgba(20, 91, 58, .22) !important;
}

html body .ghost-button,
html body .icon-button {
  border: 1px solid var(--pm-line) !important;
  border-radius: 11px !important;
  background: white !important;
  color: var(--pm-green-900) !important;
}

/* Anfragebereich */
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .inquiry-cockpit-hero {
  min-height: auto !important;
  padding: clamp(22px, 3vw, 34px) !important;
  border: 1px solid var(--pm-line) !important;
  border-radius: 20px !important;
  background:
    radial-gradient(circle at 88% 0, rgba(215, 232, 124, .14), transparent 25rem),
    linear-gradient(135deg, white, #f0f6f0) !important;
  box-shadow: var(--pm-shadow-sm) !important;
}

html body .inquiry-cockpit-hero h2 {
  color: var(--pm-green-950) !important;
  font-size: clamp(1.8rem, 3vw, 3rem) !important;
  letter-spacing: -.04em;
}

html body .inquiry-cockpit-stats article,
html body .inquiry-inbox-panel,
html body .inquiry-workbench,
html body .inquiry-data-card,
html body .inquiry-chat-card,
html body .inquiry-notes-card,
html body .inquiry-mail-card {
  border: 1px solid var(--pm-line) !important;
  border-radius: 18px !important;
  background: white !important;
  color: var(--pm-ink) !important;
  box-shadow: var(--pm-shadow-sm) !important;
}

html body .inquiry-cockpit-stats article strong,
html body .inquiry-cockpit-stats article span,
html body .inquiry-cockpit-stats article small {
  color: var(--pm-ink) !important;
}

html body .inquiry-workbench-head,
html body .inquiry-section-head,
html body .inquiry-chat-card > .panel-heading {
  border-color: var(--pm-line) !important;
  background: linear-gradient(135deg, #edf6ef, white) !important;
}

html body .inquiry-workbench-tabs {
  gap: 8px !important;
  padding: 12px !important;
  border-color: var(--pm-line) !important;
  background: #f4f7f2 !important;
}

html body .inquiry-workbench-tab {
  border: 1px solid var(--pm-line) !important;
  border-radius: 14px !important;
  background: white !important;
  color: var(--pm-ink) !important;
}

html body .inquiry-workbench-tab.is-active {
  border-color: var(--pm-green-700) !important;
  background: var(--pm-mint) !important;
  box-shadow: 0 8px 20px rgba(20, 91, 58, .12) !important;
}

html body .inquiry-workbench-tab.is-active > span {
  background: var(--pm-green-700) !important;
  color: white !important;
}

html body .inquiry-workbench-layout.is-tabbed {
  background: #f4f7f2 !important;
}

html body .inquiry-data-group,
html body .inquiry-description-group,
html body .record-row,
html body .message-bubble {
  border-color: var(--pm-line) !important;
  background: #f8faf7 !important;
  color: var(--pm-ink) !important;
}

html body .record-row.is-active {
  border-color: var(--pm-green-600) !important;
  background: var(--pm-mint) !important;
  box-shadow: inset 3px 0 var(--pm-green-700) !important;
}

html body .message-thread {
  background:
    radial-gradient(circle, rgba(29, 117, 73, .08) 1px, transparent 1px),
    #f8fbf8 !important;
  background-size: 24px 24px !important;
}

html body .message-bubble {
  background: white !important;
}

html body .message-bubble.is-customer {
  background: #edf5f0 !important;
}

@media (max-width: 1100px) {
  html body .portal-main {
    padding-inline: 10px !important;
  }

  html body .portal-topbar {
    padding-inline: 8px !important;
  }
}

@media (max-width: 720px) {
  html body .portal-actions .demo-badge,
  html body .portal-actions .user-pill {
    display: none !important;
  }

  html body .inquiry-workbench-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html body .inquiry-data-groups,
  html body .inquiry-main-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body *,
  html body *::before,
  html body *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Letzte Konfliktbereinigung gegen alte Anfrage-Styles */
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-cockpit-hero {
  border: 1px solid var(--pm-line) !important;
  background:
    radial-gradient(circle at 88% 0, rgba(215, 232, 124, .14), transparent 25rem),
    linear-gradient(135deg, #ffffff, #f0f6f0) !important;
  color: var(--pm-ink) !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-cockpit-hero h2 {
  color: var(--pm-green-950) !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-cockpit-hero span {
  color: var(--pm-muted) !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-workbench-head,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-section-head,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-chat-card > .panel-heading {
  border-color: var(--pm-line) !important;
  background: linear-gradient(135deg, #edf6ef, #ffffff) !important;
  color: var(--pm-ink) !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-workbench-head h2,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-section-head h2,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-inbox-head strong,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .record-title {
  color: var(--pm-green-950) !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-workbench-head span,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-section-head > span,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .record-meta,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .record-footer {
  color: var(--pm-muted) !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .customer-id-strip {
  border: 1px solid var(--pm-line) !important;
  background: linear-gradient(90deg, var(--pm-mint), #f8faf7) !important;
  color: var(--pm-green-950) !important;
  box-shadow: none !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .customer-id-strip span,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .customer-id-strip strong {
  color: var(--pm-green-950) !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .record-row,
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .record-row.is-active {
  color: var(--pm-ink) !important;
}

/* Finale Prioritaet: Anfragekarten separat scrollen */
html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-inbox-panel {
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr) !important;
  max-height: calc(100svh - 112px) !important;
  overflow: hidden !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-inbox-list {
  min-height: 0 !important;
  max-height: min(560px, calc(100svh - 330px)) !important;
  padding-right: 8px !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  scrollbar-gutter: stable !important;
  scrollbar-width: auto !important;
  scrollbar-color: #2b8e59 #e4eee6 !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-inbox-list::-webkit-scrollbar {
  width: 12px !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-inbox-list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #e4eee6 !important;
}

html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-inbox-list::-webkit-scrollbar-thumb {
  min-height: 44px;
  border: 2px solid #e4eee6;
  border-radius: 999px;
  background: #2b8e59 !important;
}

@media (max-width: 1180px) {
  html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-inbox-panel {
    position: static !important;
    max-height: none !important;
  }

  html body .portal-view[data-view="inquiries"].inquiry-cockpit-view .inquiry-inbox-list {
    height: clamp(340px, 52svh, 520px) !important;
    max-height: none !important;
  }
}
