:root {
  --dispo-shell-sidebar: 212px;
  --dispo-shell-compact: 72px;
}

/* Gemeinsame Shell-Baseline fuer Dashboard, Kalender, Fahrer, Stammdaten und Einstellungen. */
.app-shell,
.calendar-app,
.driver-app,
.pf-app,
.settings-app {
  --vr-sidebar: var(--dispo-shell-sidebar);
  --pf-sidebar: var(--dispo-shell-sidebar);
}

/* Die Einstellungsseite wurde urspruenglich fuer eine fixed Sidebar gebaut.
   In der gemeinsamen Shell bleibt die Sidebar absichtlich Teil des Layouts;
   deshalb bekommt nur diese Seite ein explizites Zwei-Spalten-Raster. */
.settings-app {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: var(--vr-sidebar) minmax(0, 1fr);
  padding-left: 0 !important;
}

.settings-app > .sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
}

.settings-app > .workspace {
  min-width: 0;
}

.sidebar .tenant-card { display: none !important; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  height: 100dvh;
  min-height: 100dvh;
  align-self: start;
  flex-direction: column;
  width: var(--dispo-shell-sidebar) !important;
  padding: 16px 12px 14px !important;
  color: #fff;
  background: linear-gradient(180deg, #0b2346 0%, #071a35 54%, #06162d 100%) !important;
  box-shadow: 8px 0 28px rgba(5, 22, 48, .08);
}

.sidebar .brand {
  min-height: 44px;
  margin: 0 0 14px;
  padding: 0 8px;
}

.sidebar .dispo-shell-brand {
  display: flex;
  height: 78px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(0,20,53,.2);
  text-decoration: none;
}

.sidebar .dispo-shell-brand img {
  display: block;
  width: 150px;
  height: 70px;
  object-fit: contain;
  object-position: center;
}

.sidebar .side-nav {
  display: grid;
  gap: 4px;
}

.sidebar .side-nav .nav-item {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  gap: 11px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(255,255,255,.76);
  background: transparent;
  font-size: var(--vr-type-ui-size);
  font-weight: var(--vr-weight-semibold);
  line-height: var(--vr-type-ui-line);
  text-align: left;
  text-decoration: none;
}

.sidebar .side-nav .nav-item > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.sidebar .side-nav .nav-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 1px;
}

.sidebar .side-nav .nav-label {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
}

.provider-app { --provider-sidebar: var(--dispo-shell-sidebar); }

.sidebar .side-nav .nav-availability {
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,.52);
  font-size: var(--vr-type-meta-size);
  font-weight: var(--vr-weight-ui);
  line-height: var(--vr-type-meta-line);
}
.sidebar .side-nav .nav-availability .nav-lock-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

.sidebar .side-nav .nav-item:hover:not([aria-disabled="true"]) {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.sidebar .side-nav .nav-item.is-active,
.sidebar .side-nav .nav-item[aria-current="page"] {
  border-color: rgba(104,159,255,.3);
  color: #fff;
  background: linear-gradient(90deg, rgba(45,114,232,.44), rgba(45,114,232,.2));
  box-shadow: inset 3px 0 #69a2ff;
}

.sidebar .side-nav .nav-item.is-unavailable,
.sidebar .side-nav .nav-item[aria-disabled="true"] {
  cursor: not-allowed;
  color: rgba(255,255,255,.58);
}

.sidebar .side-nav .nav-item.is-unavailable > svg { opacity: .68; }

.sidebar .sidebar-footer {
  display: grid;
  margin-top: auto;
  gap: 8px;
}

.dispo-shell-account { position: relative; }

.dispo-shell-account-toggle {
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: 34px minmax(0,1fr) 20px;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 11px;
  color: #fff;
  background: rgba(255,255,255,.055);
  text-align: left;
}

.dispo-shell-account-toggle:hover,
.dispo-shell-account-toggle[aria-expanded="true"] {
  border-color: rgba(105,162,255,.45);
  background: rgba(255,255,255,.1);
}

.dispo-shell-account-toggle .avatar {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  color: #164b9d;
  background: #e4eeff;
  font-size: var(--vr-type-meta-size);
  font-weight: var(--vr-weight-bold);
}

.dispo-shell-account-toggle .avatar-fallback,
.dispo-account-head .avatar-fallback { display: grid; width: 100%; height: 100%; place-items: center; }
.dispo-shell-account-toggle .avatar.has-logo,
.dispo-account-head .avatar.has-logo { border: 1px solid rgba(255,255,255,.28); background: #fff; }
.dispo-shell-account-toggle .avatar img,
.dispo-account-head .avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; background: #fff; }
.dispo-account-head .avatar { position: relative; overflow: hidden; }

.dispo-shell-account-toggle strong,
.dispo-shell-account-toggle small { display: block; }
.dispo-shell-account-toggle strong { font-size: var(--vr-type-ui-size); font-weight: var(--vr-weight-semibold); }
.dispo-shell-account-toggle small { margin-top: 1px; color: #c0d0eb; font-size: var(--vr-type-meta-size); line-height: var(--vr-type-meta-line); }
.dispo-shell-account-toggle svg { width: 18px; height: 18px; }

.dispo-shell-popover {
  position: fixed;
  z-index: 180;
  width: min(330px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid #d5dfec;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 56px rgba(10,32,68,.2);
}

.dispo-shell-popover[hidden] { display: none !important; }

.dispo-account-head,
.dispo-popover-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid #e2e8f1;
  background: #f8faff;
}

.dispo-account-head .avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #164b9d;
  background: #e4eeff;
  font-weight: 850;
}

.dispo-account-head strong,
.dispo-account-head small { display: block; }
.dispo-account-head small { margin-top: 2px; color: #68768b; font-size: 10px; }

.dispo-account-menu { display: grid; padding: 7px; }
.dispo-account-menu a,
.dispo-account-menu button {
  display: grid;
  min-height: 48px;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  color: #13233c;
  background: transparent;
  text-align: left;
  text-decoration: none;
}

.dispo-account-menu a:hover,
.dispo-account-menu button:hover { background: #eef4ff; }
.dispo-account-menu svg { width: 18px; height: 18px; color: #286bd5; }
.dispo-account-menu strong,
.dispo-account-menu small { display: block; }
.dispo-account-menu strong { font-size: var(--vr-type-ui-size); font-weight: var(--vr-weight-semibold); }
.dispo-account-menu small { margin-top: 2px; color: var(--vr-text-secondary); font-size: var(--vr-type-meta-size); line-height: var(--vr-type-meta-line); }
.dispo-account-menu .is-danger { color: #b52b35; }
.dispo-account-menu .is-danger svg { color: #c83b45; }
.dispo-account-separator { height: 1px; margin: 5px 8px; background: #e2e8f1; }

.dispo-shell-notification-button {
  position: relative;
  width: 40px;
  min-width: 40px;
  height: 40px;
  border: 1px solid #d5dfec;
  border-radius: 10px;
  color: #1c3150;
  background: #fff;
}
.dispo-shell-notification-button svg { width: 18px; height: 18px; }
.dispo-shell-notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #dc3545;
  font-size: 9px;
  font-weight: 850;
}

.dispo-notification-popover { width: min(390px, calc(100vw - 24px)); }
.dispo-popover-head { justify-content: space-between; }
.dispo-popover-head h2 { margin: 0; font-size: 16px; }
.dispo-popover-head button { min-height: var(--vr-control-sm); border: 0; color: var(--vr-primary-700); background: transparent; font-size: var(--vr-type-label-size); font-weight: var(--vr-weight-semibold); }
.dispo-notification-list { display: grid; max-height: 380px; overflow: auto; padding: 7px; }
.dispo-notification-item {
  display: grid;
  grid-template-columns: 9px minmax(0,1fr) auto;
  gap: 9px;
  padding: 11px 9px;
  border-radius: 9px;
  color: #142641;
  text-decoration: none;
}
.dispo-notification-item:hover { background: #f3f7fd; }
.dispo-notification-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #2d72e8; }
.dispo-notification-item.is-urgent .dispo-notification-dot { background: #d83a47; }
.dispo-notification-item.is-support .dispo-notification-dot { background: #7653d6; }
.dispo-notification-item strong,
.dispo-notification-item small { display: block; }
.dispo-notification-item strong { font-size: var(--vr-type-label-size); font-weight: var(--vr-weight-semibold); }
.dispo-notification-item small { margin-top: 3px; color: var(--vr-text-secondary); font-size: var(--vr-type-meta-size); line-height: var(--vr-type-meta-line); }
.dispo-notification-item time { color: var(--vr-text-muted); font-size: var(--vr-type-meta-size); }
.dispo-notification-empty { padding: 24px 16px; color: #6e7b8f; text-align: center; }
.dispo-notification-state { display: grid; justify-items: center; gap: 7px; padding: 24px 16px; color: var(--vr-text-secondary); text-align: center; }
.dispo-notification-state strong { color: var(--vr-text-primary); font-size: var(--vr-type-label-size); }
.dispo-notification-state small { max-width: 280px; font-size: var(--vr-type-meta-size); line-height: var(--vr-type-meta-line); }
.dispo-notification-state button { min-height: 44px; padding: 8px 13px; border: 1px solid var(--vr-border-strong); border-radius: 10px; background: #fff; color: var(--vr-primary-700); font-weight: var(--vr-weight-semibold); }
.dispo-notification-state.is-error { color: #8b3038; }
.dispo-notification-spinner { width: 24px; height: 24px; border: 3px solid #dbe6f6; border-top-color: var(--vr-primary-600); border-radius: 50%; animation: dispo-notification-spin .7s linear infinite; }
.dispo-notification-stale { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px; padding: 9px 10px; border-radius: 9px; background: #fff4dc; color: #765000; font-size: var(--vr-type-meta-size); font-weight: var(--vr-weight-semibold); }
.dispo-notification-stale button { min-height: 40px; padding: 6px 9px; border: 1px solid #dfbd73; border-radius: 8px; background: #fff; color: #765000; font-weight: inherit; }
@keyframes dispo-notification-spin { to { transform: rotate(360deg); } }

.dispo-shell-dialog-backdrop {
  position: fixed;
  z-index: 190;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(7,20,42,.42);
  backdrop-filter: blur(2px);
}
.dispo-shell-dialog-backdrop[hidden] { display: none !important; }
.dispo-shell-dialog {
  width: min(460px,100%);
  padding: 18px;
  border: 1px solid #d5dfec;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(7,25,55,.25);
}
.dispo-shell-dialog h2 { margin: 0; font-size: 19px; }
.dispo-shell-dialog p { margin: 9px 0 0; color: #5c6b80; line-height: 1.55; }
.dispo-shell-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dispo-shell-dialog-actions button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #d3ddea;
  border-radius: 9px;
  color: #172942;
  background: #fff;
  font-weight: 760;
}
.dispo-shell-dialog-actions .is-primary { border-color: #1e62cf; color: #fff; background: #246edf; }
.dispo-shell-dialog-actions .is-danger { border-color: #c83b45; color: #fff; background: #c83b45; }

.dispo-shell-toast-region {
  position: fixed;
  z-index: 210;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(390px,calc(100vw - 24px));
  gap: 8px;
  pointer-events: none;
}
.dispo-shell-toast {
  padding: 12px 14px;
  border: 1px solid #c9d8ec;
  border-left: 4px solid #2d72e8;
  border-radius: 10px;
  color: #142641;
  background: #fff;
  box-shadow: 0 14px 36px rgba(11,34,70,.17);
  font-size: var(--vr-type-ui-size);
  font-weight: var(--vr-weight-ui);
  line-height: var(--vr-type-ui-line);
}

.topbar .user-trigger { display: none !important; }

@media (max-width: 1120px) and (min-width: 761px) {
  .app-shell,
  .calendar-app,
  .driver-app,
  .pf-app,
  .settings-app {
    --vr-sidebar: var(--dispo-shell-compact);
    --pf-sidebar: var(--dispo-shell-compact);
  }
  .sidebar { width: var(--dispo-shell-compact) !important; padding-inline: 9px !important; }
  .provider-app { --provider-sidebar: var(--dispo-shell-compact); }
  .sidebar .brand { justify-content: center; padding: 0; }
  .sidebar .dispo-shell-brand { display: flex; width: 52px; height: 58px; padding: 2px; }
  .sidebar .dispo-shell-brand img { width: 58px; height: 54px; object-position: center; }
  .sidebar .brand > span:last-child,
  .sidebar .side-nav .nav-copy,
  .dispo-shell-account-toggle > span:nth-child(2),
  .dispo-shell-account-toggle > svg,
  .sidebar-footer > :not(.dispo-shell-account) span:last-child { display: none !important; }
  .sidebar .side-nav .nav-item,
  .dispo-shell-account-toggle { justify-content: center; }
  .dispo-shell-account-toggle { display: flex; padding-inline: 6px; }
}

@media (max-width: 760px) {
  .settings-app {
    display: block;
  }

  .sidebar {
    display: none !important;
  }

  .dispo-shell-popover {
    inset: auto 8px calc(68px + env(safe-area-inset-bottom)) 8px !important;
    width: auto;
  }
  .dispo-notification-popover {
    top: 64px !important;
    bottom: auto !important;
  }
  .dispo-shell-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dispo-shell-dialog-actions button { min-height: 46px; }
  .dispo-shell-toast-region { right: 10px; bottom: calc(74px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .dispo-shell-popover,
  .dispo-shell-dialog { scroll-behavior: auto; }
}
html[data-auth-gate="pending"] body { visibility: hidden; }
