/* Shell theme defaults — single source of truth for portal colors */
:root {
    --shell-default-primary: #095ADB;

    --shell-light-bg: #FFFFFF;
    --shell-light-text: #140802;
    --shell-light-muted: #64748b;
    --shell-light-surface: #f9fafb;

    --shell-dark-bg: #111214;
    --shell-dark-text: #ecedee;
    --shell-dark-muted: #94a3b8;

    /* Left side nav (Luigi strip) background. Leave empty to use the tenant/page background. */
    --shell-light-sidenav-bg: #0B1220;
    --shell-dark-sidenav-bg: #0A0A0B;

    /* Left side nav text + icon color. Leave empty to use the tenant/page text color. */
    --shell-light-sidenav-text: #ecedee;
    --shell-dark-sidenav-text: #9AA0A6;

    /* Selected side nav item pill. Leave empty: background = tenant primary, text/icon = white. */
    --shell-light-sidenav-selected-bg: ;
    --shell-dark-sidenav-selected-bg: ;
    --shell-light-sidenav-selected-text: ;
    --shell-dark-sidenav-selected-text: ;

    /* Image (png/svg) nav icons such as TeamsBoss: 1 inverts black artwork to white, 0 leaves it as is. */
    --shell-light-sidenav-icon-invert: 1;
    --shell-dark-sidenav-icon-invert: 1;

    /* Side nav logo (expanded) and icon (collapsed) */
    --shell-sidenav-logo-height: 1.5rem;
    --shell-sidenav-icon-size: 1.75rem;

    --luigi__shellbar--height: 3.5rem;
    /* Collapsed side nav width: 2 x item inset (0.75rem) + item size (2.5rem) */
    --luigi__leftnav_collapsed--width: 4rem;

    font-family: 'Inter, sans-serif';

    --card-light-border:#E5E7EB;
    --card-dark-border: #24262B;

}

/* ── Left side nav ──
   Colors come from --shell-sidenav-* (bg, text, selected-bg, selected-text, icon-invert), which
   luigi-config.js applyShellTheme picks from the light/dark tokens above. The --sap* overrides are
   scoped to the sidebar so Luigi's list items pick them up without touching popovers etc.
   Layout, top to bottom: brand (logo / icon) → nav items → additional menu options → divider → Collapse. */
.fd-app__sidebar {
    --shell-sidenav-inset: 0.75rem;        /* strip edge → item pill */
    --shell-sidenav-item-size: 2.5rem;     /* item height, and icon column width */
    --shell-sidenav-radius: 0.5rem;
    --shell-sidenav-divider: color-mix(in srgb, var(--shell-sidenav-text) 15%, transparent);

    --sapList_Background: var(--shell-sidenav-bg);
    --sapBackgroundColor: var(--shell-sidenav-bg);
    --sapGroup_ContentBackground: var(--shell-sidenav-bg);
    --sapList_TextColor: var(--shell-sidenav-text);
    --sapTextColor: var(--shell-sidenav-text);
    --sapContent_IconColor: var(--shell-sidenav-text);
    --sapList_Hover_Background: transparent;
    --sapList_Active_Background: transparent;
    --sapList_SelectionBackgroundColor: var(--shell-sidenav-selected-bg);
    --sapList_Hover_SelectionBackground: var(--shell-sidenav-selected-bg);
    --sapList_BorderColor: transparent;
    --sapGroup_ContentBorderColor: transparent;
    background-color: var(--shell-sidenav-bg) !important;
    color: var(--shell-sidenav-text);
}

/* Column layout: brand and footer keep their size, the item list scrolls in between */
.fd-app__sidebar .fd-side-nav {
    display: flex !important;
    flex-direction: column;
    background-color: var(--shell-sidenav-bg) !important;
    border-right: none !important;
}
.fd-app__sidebar .fd-side-nav__main-navigation {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
}
.fd-app__sidebar .lui-fd-side-nav-wrapper { flex: 1 1 auto; min-height: 0; height: auto !important; }
.fd-app__sidebar .fd-side-nav__utility {
    flex: none;
    margin: 0 !important;
    padding: 0 0 0.75rem !important;
    border: none !important;
    background-color: var(--shell-sidenav-bg) !important;
}
.fd-app__sidebar .fd-side-nav__utility::before { display: none !important; }

/* Brand — injected by luigi-config.js setupSideNavBrand. Logo when expanded, icon when collapsed;
   same height as the shellbar so it lines up with the page title. */
.shell-sidenav-brand {
    flex: none;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    height: var(--luigi__shellbar--height);
    margin-bottom: 1rem;
    padding: 0 calc(var(--shell-sidenav-inset) + 0.5rem);
    overflow: hidden;
}
.shell-sidenav-brand img { display: block; flex: none; }
.shell-sidenav-brand__logo { height: var(--shell-sidenav-logo-height); width: auto; max-width: 100%; object-fit: contain; object-position: left center; }
.shell-sidenav-brand__icon { display: none !important; width: var(--shell-sidenav-icon-size); height: var(--shell-sidenav-icon-size); }
body.semiCollapsed .shell-sidenav-brand { justify-content: center; padding: 0; }
body.semiCollapsed .shell-sidenav-brand__logo { display: none !important; }
body.semiCollapsed .shell-sidenav-brand__icon { display: block !important; }

/* Items — inset rounded pills: icon column + label */
.fd-app__sidebar .fd-nested-list,
.fd-app__sidebar .lui-category,
.fd-app__sidebar .fd-nested-list__group-header,
.fd-app__sidebar .fd-nested-list__content { border-top: none !important; border-bottom: none !important; }
.fd-app__sidebar .fd-side-nav__separator { display: none !important; }
.fd-app__sidebar .fd-nested-list {
    box-sizing: border-box;
    padding: 0 var(--shell-sidenav-inset) !important;
    background: transparent !important;
}
.fd-app__sidebar .fd-nested-list__item { background: transparent !important; margin-bottom: 0.25rem; }
.fd-app__sidebar .fd-nested-list__link {
    box-sizing: border-box;
    height: var(--shell-sidenav-item-size) !important;
    padding: 0 !important;
    border: none !important;
    border-radius: var(--shell-sidenav-radius);
    background: transparent !important;
    color: var(--shell-sidenav-text) !important;
    text-decoration: none;
    overflow: hidden;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}
.fd-app__sidebar .fd-nested-list__icon,
.fd-app__sidebar .fd-nested-list__icon[class*=sap-icon] {
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex: none;
    width: var(--shell-sidenav-item-size);
    min-width: var(--shell-sidenav-item-size) !important;
    height: 100%;
    font-size: 1rem !important;
    color: inherit !important;
    background: transparent !important;
}
.fd-app__sidebar .fd-nested-list__icon img { filter: invert(var(--shell-sidenav-icon-invert, 0)); }
.fd-app__sidebar .fd-nested-list__title {
    min-width: 0;
    padding-inline: 0 0.75rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: inherit !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fd-app__sidebar .fd-nested-list__title:first-child { padding-inline-start: 0.75rem !important; } /* item without an icon */
body.semiCollapsed .fd-app__sidebar .fd-nested-list__title { display: none !important; }

/* Hover: background stays, icon takes the primary color */
.fd-app__sidebar .fd-nested-list__link:hover .fd-nested-list__icon { color: var(--shell-primary) !important; }
/* Press: no flash of Fundamental's active background / text color */
.fd-app__sidebar .fd-nested-list__link:active { background: transparent !important; color: var(--shell-sidenav-text) !important; }
/* Selected: filled pill (declared after hover/press so it wins over both) */
.fd-app__sidebar .fd-nested-list__link.is-selected,
.fd-app__sidebar .is-selected .fd-nested-list__link {
    background: var(--shell-sidenav-selected-bg) !important;
    color: var(--shell-sidenav-selected-text) !important;
}
.fd-app__sidebar .fd-nested-list__link.is-selected .fd-nested-list__icon,
.fd-app__sidebar .is-selected .fd-nested-list__link .fd-nested-list__icon { color: var(--shell-sidenav-selected-text) !important; }
.fd-app__sidebar .fd-nested-list__link:focus,
.fd-app__sidebar .fd-nested-list__link:focus-visible {
    outline: 2px solid var(--shell-sidenav-text) !important;
    outline-offset: -2px;
    box-shadow: none !important;
}

/* Additional menu options (Privacy Policy, Support, Log Out… from the backend) — injected by
   luigi-config.js setupAdditionalMenuOptions above the footer; they reuse the item styles above. */
.additional-menu-options { border-top: none !important; overflow: hidden; }

/* Footer: divider, then the Collapse toggle styled as an item ("Collapse" label added by luigi-config.js) */
.fd-app__sidebar .lui-side-nav__footer {
    justify-content: flex-start !important;
    margin: 0.5rem var(--shell-sidenav-inset) 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--shell-sidenav-divider) !important;
    background-color: var(--shell-sidenav-bg) !important;
}
.fd-app__sidebar .lui-side-nav__footer--text { display: none !important; }
.fd-app__sidebar .lui-side-nav__footer .lui-semi-btn {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    width: 100% !important;
    min-width: 0 !important;
    height: var(--shell-sidenav-item-size) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: var(--shell-sidenav-radius) !important;
    background: transparent !important;
    color: var(--shell-sidenav-text) !important;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
}
.fd-app__sidebar .lui-semi-btn > i {
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex: none;
    width: var(--shell-sidenav-item-size);
    padding: 0 !important;
    font-size: 1rem;
    color: inherit !important;
}
.fd-app__sidebar .lui-semi-btn:hover > i { color: var(--shell-primary) !important; }
.fd-app__sidebar .lui-semi-btn:focus,
.fd-app__sidebar .lui-semi-btn:focus-visible {
    outline: 2px solid var(--shell-sidenav-text) !important;
    outline-offset: -2px;
    box-shadow: none !important;
}
.shell-semi-btn__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.semiCollapsed .shell-semi-btn__label { display: none; }

/* Shellbar — the module apps' app bar look: page surface (light or dark), bordered bottom,
   bold site name, no logo. */
.fd-shellbar {
    background-color: var(--shell-background, var(--shell-light-bg)) !important;
    border-bottom: 1px solid color-mix(in srgb, var(--shell-text, var(--shell-light-text)) 12%, transparent) !important;
    box-shadow: none !important;
    padding-inline: 1rem !important;
}
.fd-shellbar .fd-shellbar__title {
    color: var(--shell-text, var(--shell-light-text)) !important;
    font-weight: 700 !important;
    font-size: 1.5rem !important;
    line-height: 100%;
}
.fd-shellbar .fd-shellbar__logo { display: none !important; }
.fd-shellbar .fd-shellbar__branding,
.fd-shellbar .fd-shellbar__branding:hover,
.fd-shellbar .fd-shellbar__branding:active {
    background: transparent !important;
    border-color: transparent !important;
}
.fd-shellbar .fd-shellbar__action .fd-button { color: var(--shell-text) !important; border-color: transparent !important; }
.fd-shellbar .fd-shellbar__action .fd-button:hover { background-color: color-mix(in srgb, var(--shell-text) 6%, transparent) !important; }

/* Side nav runs the full height of the window; the shellbar starts to its right.
   Luigi pins the side nav below the shellbar (top: --luigi__shellbar--height), so lift it to
   the top over the shellbar, and pad the shellbar's left edge by the nav's width (expanded or
   collapsed) so the title isn't hidden under it. */
.fd-app__sidebar {
    top: 0 !important;
    z-index: 2 !important;
}
.fd-shellbar {
    padding-left: calc(var(--luigi__left-sidenav--width) + 1rem) !important;
    transition: padding-left 0.1s linear;
}
body.semiCollapsed .fd-shellbar {
    padding-left: calc(var(--luigi__leftnav_collapsed--width, 2.75rem) + 1rem) !important;
}

/* Tenant switcher — native select styled to sit on the shellbar */
.tenant-switcher { display: flex; align-items: center; }
.tenant-switcher select {
    max-width: 16rem; height: 2.25rem; padding: 0 0.5rem; cursor: pointer;
    font: inherit; font-size: 0.875rem; text-overflow: ellipsis;
    color: var(--shell-text);
    background-color: var(--shell-background);
    border: 1px solid color-mix(in srgb, var(--shell-text) 12%, var(--shell-background));
    border-radius: 0.5rem;
}
.tenant-switcher select:hover { background-color: color-mix(in srgb, var(--shell-text) 5%, var(--shell-background)); }
.tenant-switcher select:focus-visible { outline: 2px solid var(--shell-primary); outline-offset: 2px; }
.tenant-switcher option { color: var(--shell-text); background-color: var(--shell-background); }

/* Luigi alert / message strip, always dark text so it's readable on light strip backgrounds */
.fd-message-strip,
.fd-message-strip__text { color: var(--shell-light-text) !important; }

/* Luigi popovers (e.g. the shellbar overflow menu) */
.fd-popover,
.fd-popover__body {
    max-width: min(24rem, calc(100vw - 2rem));
}
.fd-popover__body .fd-menu__link { color: var(--shell-text) !important; }
/* Reset Fundamental's :active text-color var so .fd-menu__title (which reads --fdMenu_Text_Color) doesn't flash white */
.fd-popover__body .fd-menu__link:active { --fdMenu_Text_Color: var(--shell-text); color: var(--shell-text) !important; }
.fd-popover__body .fd-menu__item:hover { background-color: var(--shell-hover-bg) !important; }

/* ── Shellbar controls: settings dropdown + user card (luigi-config.js setupShellControls) ──
   Same look as the module apps' design; the --sc-* tokens map it onto the tenant's shell colors. */
.shell-controls {
    --sc-surface: var(--shell-background, var(--shell-light-bg));
    --sc-text: var(--shell-text, var(--shell-light-text));
    --sc-text-secondary: color-mix(in srgb, var(--sc-text) 70%, var(--sc-surface));
    --sc-border: color-mix(in srgb, var(--sc-text) 12%, var(--sc-surface));
    --sc-border-strong: color-mix(in srgb, var(--sc-text) 22%, var(--sc-surface));
    --sc-hover: color-mix(in srgb, var(--sc-text) 5%, var(--sc-surface));
    --sc-primary: var(--shell-primary, var(--shell-default-primary));
    --sc-primary-tint: color-mix(in srgb, var(--sc-primary) 12%, var(--sc-surface));
    --sc-on-primary: var(--shell-dark-text);
    --sc-radius: 0.5rem;
    --sc-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);

    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
}
body[data-theme="dark"] .shell-controls {
    --sc-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.5);
}
.shell-popover-wrap { position: relative; display: inline-flex; }

/* Triggers: the settings button and avatar from the module apps' old app bar */
.shell-icon-button,
.shell-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    font: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}
.shell-icon-button {
    color: var(--sc-text-secondary);
    background-color: var(--sc-surface);
    border: 1px solid var(--sc-border);
    border-radius: var(--sc-radius);
}
.shell-icon-button:hover { background-color: var(--sc-hover); }
.shell-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    background-color: var(--sc-primary-tint);
    color: var(--sc-primary);
    font-size: 0.875rem;
    font-weight: 550;
    user-select: none;
}
.shell-icon-button:focus-visible,
.shell-avatar:focus-visible { outline: 2px solid var(--sc-primary); outline-offset: 2px; }

.shell-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 1100;
    box-sizing: border-box;
    background-color: var(--sc-surface);
    color: var(--sc-text);
    border: 1px solid var(--sc-border);
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
}
.shell-popover[hidden] { display: none; }

/* Settings panel */
.shell-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 15rem;
    padding: 0.75rem 1rem;
}
.shell-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.shell-switch {
    position: relative;
    flex-shrink: 0;
    width: 2.25rem;
    height: 1.25rem;
    padding: 0;
    border: none;
    border-radius: 9999px;
    background-color: var(--sc-border-strong);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}
.shell-switch.active { background-color: var(--sc-primary); }
.shell-switch-thumb {
    position: absolute;
    top: 0.125rem;
    left: 0.125rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease-in-out;
}
.shell-switch.active .shell-switch-thumb { transform: translateX(1rem); }

.shell-segmented {
    display: inline-flex;
    flex-shrink: 0;
    border: 1px solid var(--sc-border);
    border-radius: var(--sc-radius);
    overflow: hidden;
}
.shell-segmented button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    color: var(--sc-text-secondary);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}
.shell-segmented button + button { border-left: 1px solid var(--sc-border); }
.shell-segmented button:hover:not(.active) { background-color: var(--sc-hover); }
.shell-segmented button.active { background-color: var(--sc-primary); color: var(--sc-on-primary); }

.shell-switch:focus-visible,
.shell-segmented button:focus-visible,
.shell-link-button:focus-visible,
.shell-user-links a:focus-visible { outline: 2px solid var(--sc-primary); outline-offset: 2px; }

/* User card */
.shell-user-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    width: 20rem;
    max-width: calc(100vw - 2rem);
    padding: 1rem;
}
.shell-user-photo {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: var(--sc-primary-tint);
    color: var(--sc-primary);
    font-size: 1.75rem;
    font-weight: 600;
    user-select: none;
}
.shell-user-details { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.shell-user-name,
.shell-user-upn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-user-name { font-size: 1rem; font-weight: 600; }
.shell-user-upn { color: var(--sc-text-secondary); }
.shell-user-links { display: flex; flex-direction: column; gap: 0.25rem; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.shell-user-links a { color: var(--sc-primary); text-decoration: none; }
.shell-user-links a:hover { text-decoration: underline; }
.shell-user-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.75rem; }
.shell-link-button {
    padding: 0;
    border: none;
    background: none;
    color: var(--sc-primary);
    font: inherit;
    cursor: pointer;
}
.shell-link-button:hover { text-decoration: underline; }
