:root {
  --portal-bg: #061d13;
  --portal-bg-deep: #03140d;
  --portal-surface: #0a281c;
  --portal-surface-2: #0d3324;
  --portal-border: rgba(119, 218, 166, 0.2);
  --portal-border-strong: rgba(115, 230, 173, 0.46);
  --portal-text: #f4fff8;
  --portal-muted: #9ab7a7;
  --portal-mint: #73e6ad;
  --portal-mint-strong: #91f3bd;
  --portal-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

html,
body {
  background: var(--portal-bg);
}

body {
  background:
    radial-gradient(circle at 72% -10%, rgba(63, 179, 118, 0.13), transparent 34%),
    var(--portal-bg);
  color: var(--portal-text);
}

/* Sichtbarer Lichtsaum wie im Partnerportal, ohne Klicks zu blockieren. */
body::after {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  height: clamp(76px, 12vh, 132px);
  pointer-events: none;
  content: "";
  background:
    radial-gradient(
      ellipse at 50% 126%,
      rgba(145, 243, 189, 0.34) 0%,
      rgba(73, 190, 127, 0.18) 34%,
      rgba(73, 190, 127, 0.06) 54%,
      transparent 74%
    ),
    linear-gradient(
      90deg,
      transparent 2%,
      rgba(115, 230, 173, 0.12) 18%,
      rgba(145, 243, 189, 0.82) 50%,
      rgba(115, 230, 173, 0.12) 82%,
      transparent 98%
    ) bottom / 100% 2px no-repeat;
  filter: drop-shadow(0 -8px 22px rgba(73, 190, 127, 0.16));
  opacity: 0.96;
}

/* Standalone customer login */
.login-page {
  background:
    radial-gradient(circle at 74% 4%, rgba(115, 230, 173, 0.13), transparent 34%),
    linear-gradient(145deg, var(--portal-bg-deep), var(--portal-bg));
}

.login-card {
  position: relative;
  overflow: hidden;
  width: min(460px, 100%);
  border-color: var(--portal-border);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(13, 51, 36, 0.98), rgba(6, 29, 19, 0.99));
  box-shadow: var(--portal-shadow);
}

.login-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--portal-mint), transparent);
  content: "";
  opacity: 0.72;
}

.login-brand img {
  border-color: var(--portal-border-strong);
  border-radius: 12px;
  box-shadow: 0 0 22px rgba(115, 230, 173, 0.15);
}

.login-head .login-kicker,
.login-message,
.login-footer a:hover {
  color: var(--portal-mint);
}

.login-tab,
.login-secondary,
.login-form input:not([type="checkbox"]) {
  border-color: var(--portal-border);
  border-radius: 11px;
}

.login-form input:not([type="checkbox"]) {
  background: rgba(3, 20, 13, 0.72);
}

.login-tab.is-active {
  border-color: var(--portal-border-strong);
  background: rgba(115, 230, 173, 0.12);
  color: var(--portal-mint-strong);
  box-shadow:
    inset 0 -3px 0 var(--portal-mint),
    0 9px 22px rgba(73, 190, 127, 0.13);
}

.login-primary {
  border-radius: 10px;
  background: var(--portal-mint);
  box-shadow: 0 12px 28px rgba(49, 154, 98, 0.15);
}

.login-primary:hover {
  background: var(--portal-mint-strong);
}

/* Authenticated app and public customer surface */
.app-shell.is-authenticated,
.app-shell.is-public {
  background: var(--portal-bg);
}

.app-shell.is-authenticated {
  grid-template-columns: 230px minmax(0, 1fr);
}

.app-shell.is-authenticated .sidebar,
.app-shell.is-public .sidebar {
  border-color: var(--portal-border);
  background: rgba(3, 20, 13, 0.96);
  box-shadow: none;
  backdrop-filter: none;
}

.app-shell.is-authenticated .sidebar {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 18px;
  padding: 24px 14px 18px;
}

.app-shell.is-authenticated .brand,
.app-shell.is-public .brand {
  padding-inline: 10px;
}

.app-shell.is-authenticated .brand-mark,
.app-shell.is-public .brand-mark {
  border-color: var(--portal-border-strong);
  border-radius: 12px;
  box-shadow: 0 0 22px rgba(115, 230, 173, 0.12);
}

.app-shell.is-authenticated .brand small,
.app-shell.is-public .brand small {
  color: var(--portal-muted);
}

.app-shell.is-authenticated .side-nav {
  gap: 7px;
  padding-right: 4px;
}

.app-shell.is-authenticated .nav-item {
  min-height: 42px;
  grid-template-columns: 32px minmax(0, 1fr);
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #c4d8cc;
  font-size: 13px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.app-shell.is-authenticated .nav-item:hover,
.app-shell.is-authenticated .nav-item.is-active {
  border-color: var(--portal-border-strong);
  background: rgba(69, 184, 123, 0.16);
  color: var(--portal-mint);
}

.app-shell.is-authenticated .nav-item.is-active {
  box-shadow:
    inset 0 -3px 0 var(--portal-mint),
    0 9px 22px rgba(73, 190, 127, 0.13);
}

.app-shell.is-authenticated .nav-icon {
  color: var(--portal-mint);
  opacity: 0.94;
}

.app-shell.is-authenticated .sidebar-status,
.app-shell.is-authenticated .sidebar-workspace-button {
  border-color: var(--portal-border);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(13, 51, 36, 0.84), rgba(6, 29, 19, 0.9));
}

.app-shell.is-authenticated .sidebar-status {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-height: 66px;
  padding: 10px;
}

.sidebar-profile-avatar {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid var(--portal-border-strong);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(115, 230, 173, 0.2), rgba(10, 40, 28, 0.9));
  color: var(--portal-mint-strong);
  box-shadow: 0 0 18px rgba(115, 230, 173, 0.12);
  font-size: 12px;
  font-weight: 850;
  overflow: hidden;
}

.sidebar-profile-avatar img,
.settings-profile-photo-preview img,
.settings-user-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-profile-avatar::after {
  position: absolute;
  right: -1px;
  bottom: 1px;
  width: 8px;
  height: 8px;
  border: 2px solid #08251a;
  border-radius: 50%;
  background: var(--portal-mint);
  content: "";
}

.app-shell.is-authenticated .logout-button {
  border-color: var(--portal-border);
  border-radius: 10px;
  color: var(--portal-mint);
}

.app-shell.is-authenticated .workspace,
.app-shell.is-public .workspace {
  background:
    radial-gradient(circle at 78% 0%, rgba(63, 179, 118, 0.1), transparent 34%),
    var(--portal-bg);
}

.app-shell.is-authenticated .workspace {
  padding: 32px clamp(22px, 4vw, 58px) 72px;
}

.app-shell.is-authenticated .view.is-active {
  gap: 18px;
}

.app-shell.is-authenticated .workspace-head {
  padding: 0 0 20px;
  border-bottom-color: var(--portal-border);
}

.app-shell.is-authenticated .workspace-head h1 {
  font-size: clamp(34px, 3.5vw, 46px);
  line-height: 1;
  letter-spacing: 0;
}

.app-shell.is-authenticated .overview-kicker {
  color: var(--portal-mint);
}

.app-shell.is-authenticated .overview-user-card {
  border-color: var(--portal-border);
  background: rgba(10, 40, 28, 0.66);
}

.app-shell.is-authenticated .panel,
.app-shell.is-authenticated .module-card,
.app-shell.is-authenticated .metric-card,
.app-shell.is-authenticated .settings-panel,
.app-shell.is-authenticated .business-panel,
.app-shell.is-authenticated .business-detail-panel,
.app-shell.is-public .customer-explainer,
.app-shell.is-public .customer-care-panel,
.app-shell.is-public .shk-radio-widget {
  border-color: var(--portal-border);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(13, 51, 36, 0.84), rgba(7, 35, 24, 0.84));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.app-shell.is-authenticated .secondary-button,
.app-shell.is-authenticated .icon-button,
.app-shell.is-authenticated .mode-tab,
.app-shell.is-authenticated .quick-actions button,
.app-shell.is-authenticated input,
.app-shell.is-authenticated select,
.app-shell.is-authenticated textarea,
.app-shell.is-public .nav-item,
.app-shell.is-public .contact-form input,
.app-shell.is-public .contact-form select,
.app-shell.is-public .contact-form textarea {
  border-color: var(--portal-border);
  border-radius: 10px;
}

.app-shell.is-authenticated .secondary-button,
.app-shell.is-authenticated .icon-button,
.app-shell.is-authenticated .mode-tab,
.app-shell.is-authenticated .quick-actions button {
  background: rgba(3, 20, 13, 0.48);
  color: var(--portal-mint);
}

.app-shell.is-authenticated .secondary-button:hover,
.app-shell.is-authenticated .icon-button:hover,
.app-shell.is-authenticated .mode-tab:hover,
.app-shell.is-authenticated .mode-tab.is-active,
.app-shell.is-authenticated .quick-actions button:hover {
  border-color: var(--portal-border-strong);
  background: rgba(69, 184, 123, 0.16);
  color: var(--portal-mint-strong);
  box-shadow:
    inset 0 -2px 0 var(--portal-mint),
    0 8px 20px rgba(73, 190, 127, 0.12);
}

.app-shell.is-authenticated input,
.app-shell.is-authenticated select,
.app-shell.is-authenticated textarea {
  background: rgba(3, 20, 13, 0.7);
}

.app-shell.is-authenticated .primary-button,
.app-shell.is-authenticated .primary-link,
.app-shell.is-authenticated .composer button[type="submit"] {
  border-color: var(--portal-mint);
  border-radius: 10px;
  background: var(--portal-mint);
}

.app-shell.is-public .sidebar {
  padding: 24px 18px;
}

.app-shell.is-public .nav-item:hover,
.app-shell.is-public .nav-item.is-active {
  border-color: var(--portal-border-strong);
  background: rgba(69, 184, 123, 0.16);
  color: var(--portal-mint);
  box-shadow:
    inset 0 -3px 0 var(--portal-mint),
    0 9px 22px rgba(73, 190, 127, 0.13);
}

.app-shell.is-public .customer-page-view > .workspace-head {
  border-bottom-color: var(--portal-border);
}

.app-shell.is-public .customer-page-view > .workspace-head .secondary-button,
.app-shell.is-public .hero-actions .primary-link,
.app-shell.is-public .contact-form .primary-link {
  border-radius: 10px;
}

@media (min-width: 721px) and (max-width: 1040px) {
  .app-shell.is-authenticated:not(.is-settings-view) {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.is-authenticated:not(.is-settings-view) > .sidebar {
    padding:
      max(12px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      10px
      max(16px, env(safe-area-inset-left));
  }

  .app-shell.is-authenticated:not(.is-settings-view) .nav-item {
    min-height: 44px;
    border-radius: 8px;
    font-size: 12px;
  }
}

@media (max-width: 720px) {
  body::after {
    height: max(58px, calc(46px + env(safe-area-inset-bottom)));
    opacity: 0.78;
  }

  .app-shell.is-authenticated {
    display: block;
  }

  .app-shell.is-authenticated .sidebar {
    position: static;
    display: grid;
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: 12px;
    padding:
      max(14px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      14px
      max(14px, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 1px solid var(--portal-border);
  }

  .app-shell.is-authenticated .brand {
    padding-inline: 0;
  }

  .app-shell.is-authenticated .side-nav {
    grid-row: 2;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 0 0 5px;
    scroll-snap-type: x proximity;
  }

  .app-shell.is-authenticated .nav-item {
    width: auto;
    min-width: max-content;
    padding: 8px 16px 8px 12px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .app-shell.is-authenticated .sidebar-workspace-switch {
    grid-row: 3;
  }

  .app-shell.is-authenticated .sidebar-status {
    display: grid;
    grid-row: 4;
    width: 100%;
    min-width: 0;
  }

  .app-shell.is-authenticated .workspace {
    padding: 22px 14px 58px;
  }

  .app-shell.is-authenticated .workspace-head h1 {
    font-size: clamp(34px, 11vw, 44px);
  }

  .login-card {
    border-radius: 18px;
  }
}

@media (max-width: 420px) {
  .app-shell.is-authenticated .logout-button {
    min-height: 38px;
  }

  .login-page {
    place-items: start center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-primary,
  .app-shell .nav-item,
  .app-shell button,
  .app-shell a {
    transition: none !important;
  }
}
