/* App shell: the company menu and main menu in the sidebar, the bell and account menu in the top bar,
   and on phones a tab bar at the bottom. Pages fill the space between. */
:root {
  --bottom-bar: 0px;
}

/* Top bar: notifications and the person's own account. */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
}
.bell-link {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  border-radius: 10px;
  color: var(--color-ink);
}
.bell-link:hover,
.bell-link.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.bell-link .icon {
  width: 22px;
  height: 22px;
}
.bell-count {
  position: absolute;
  inset-block-start: 3px;
  inset-inline-end: 1px;
  min-inline-size: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--status-action);
  color: var(--color-surface);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.account-menu,
.company-menu {
  position: relative;
}
.account-button {
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 16px;
  font-weight: 700;
}
.account-button:hover,
.account-button[aria-expanded='true'] {
  background: var(--color-accent);
  color: var(--color-surface);
}

/* Menu panels: a short list of links and commands that opens below its button. */
.menu-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow:
    0 0 0 1px var(--color-line),
    0 16px 40px -12px rgb(32 36 60 / 0.35);
}
.menu-panel[hidden] {
  display: none;
}
.account-panel {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 60;
  inline-size: max-content;
  min-inline-size: 250px;
  max-inline-size: min(340px, calc(100vw - 32px));
}
.account-who {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 10px 12px 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.account-who small {
  color: var(--color-muted);
  font-size: 12px;
}
.menu-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-group + .menu-group {
  margin-block-start: 2px;
  padding-block-start: 6px;
  border-block-start: 1px solid var(--color-line);
}
.menu-label {
  margin: 6px 12px 2px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}
.menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  inline-size: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-align: start;
  text-decoration: none;
}
.menu-item:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.menu-item[aria-current='page'] {
  font-weight: 650;
}
.menu-item > .icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--color-muted);
}
.menu-item:hover > .icon {
  color: inherit;
}
.menu-item-text {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
.menu-item-text small {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 500;
}

/* The company menu tops the dark sidebar and opens in place, pushing the main menu down. */
.company-button {
  display: flex;
  align-items: center;
  gap: 10px;
  inline-size: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.06);
  color: var(--sidebar-ink);
  font-weight: 400;
  text-align: start;
}
button.company-button:hover,
.company-button[aria-expanded='true'] {
  background: var(--sidebar-active);
}
.company-button.static {
  margin: 0;
}
.company-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-inline-size: 0;
  line-height: 1.3;
}
.company-text strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.company-text small {
  color: var(--sidebar-muted);
  font-size: 12px;
}
.company-button > .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--sidebar-muted);
  transition: rotate 0.15s;
}
.company-button[aria-expanded='true'] > .icon {
  rotate: 180deg;
}
.company-mark {
  display: grid;
  place-items: center;
  inline-size: 32px;
  block-size: 32px;
  flex: none;
  border-radius: 8px;
  background: var(--color-accent-soft);
  color: var(--color-accent-hover);
  font-size: 12px;
  font-weight: 700;
}
.menu-item .company-mark {
  inline-size: 28px;
  block-size: 28px;
  font-size: 11px;
}
.company-panel {
  margin-block-start: 8px;
}
/* The sidebar's spacing above the main menu does not apply inside the company menu. */
.app-sidebar .menu-panel nav {
  margin: 0;
}
/* The sidebar's light focus ring is for the dark rail; white surfaces use the accent. */
.app-sidebar .menu-panel :focus-visible {
  outline-color: var(--color-accent);
}

/* Ny bokning: the supplier's main action, first in the main menu. */
.app-sidebar a.nav.nav-cta {
  justify-content: center;
  margin-block-end: 10px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
}
.app-sidebar a.nav.nav-cta:is(:hover, .active) {
  background: var(--color-accent-hover);
}

/* A menu item with more than one page shows them as tabs, which each page draws after its heading and lead. */
.area-tabs {
  display: flex;
  gap: 24px;
  margin: 0 0 24px;
  border-block-end: 1px solid var(--color-line);
  overflow-x: auto;
  scrollbar-width: none;
}
.area-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-block-end: -1px;
  padding: 0;
  border-block-end: 2px solid transparent;
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.area-tabs a:hover {
  color: var(--color-ink);
}
.area-tabs a[aria-current='page'] {
  border-block-end-color: var(--color-accent);
  color: var(--color-ink);
}

/* Phones: the company menu becomes a row under the top bar and the main menu a tab bar at the bottom. */
@media (max-width: 740px) {
  :root {
    --bottom-bar: calc(65px + env(safe-area-inset-bottom, 0px));
    /* Focus and scrollIntoView keep elements above the tab bar. */
    scroll-padding-block-end: var(--bottom-bar);
  }
  aside.app-sidebar {
    display: block;
    padding: 12px 16px 0;
    background: transparent;
    color: var(--color-ink);
  }
  .app-sidebar :focus-visible {
    outline-color: var(--color-accent);
  }
  .company-button {
    min-height: 52px;
    background: var(--color-surface);
    color: var(--color-ink);
    box-shadow: 0 0 0 1px var(--color-line);
  }
  button.company-button:hover,
  .company-button[aria-expanded='true'] {
    background: var(--color-accent-soft);
  }
  .company-text small,
  .company-button > .icon {
    color: var(--color-muted);
  }
  .app-sidebar nav.main-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
    display: flex;
    margin: 0;
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom, 0px));
    border-block-start: 1px solid var(--color-line);
    background: var(--color-surface);
  }
  .main-nav > :is(a.nav, sv-request-link) {
    flex: 1 1 0;
    min-width: 0;
  }
  .app-sidebar .main-nav a.nav,
  .app-sidebar .main-nav a.nav.nav-cta {
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    margin: 0;
    padding: 4px 0;
    background: transparent;
    color: var(--color-muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    text-align: center;
  }
  .app-sidebar .main-nav a.nav > span:not(.notification-count) {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .app-sidebar .main-nav a.nav .icon {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
    color: inherit;
  }
  .app-sidebar .main-nav a.nav:is(:hover, .active),
  .app-sidebar .main-nav a.nav.nav-cta {
    background: transparent;
    color: var(--color-accent);
  }
  .app-sidebar .main-nav a.nav.active .icon {
    box-sizing: content-box;
    padding: 2px 12px;
    border-radius: 999px;
    background: var(--color-accent-soft);
  }
  .app-sidebar .main-nav .notification-count {
    position: absolute;
    inset-block-start: 2px;
    inset-inline-start: calc(50% + 6px);
    margin: 0;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--status-action);
    color: var(--color-surface);
    font-size: 10px;
    line-height: 16px;
  }
  /* The area's tabs scroll sideways with a fade at the edge instead of wrapping. */
  .area-tabs {
    flex-wrap: nowrap;
    gap: 20px;
    margin-block-start: 0;
    margin-inline: -16px;
    padding-inline: 16px 32px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .area-tabs::-webkit-scrollbar {
    display: none;
  }
  /* Page bars that stick to the bottom stay above the tab bar. */
  .booking-selection-bar {
    inset-block-end: var(--bottom-bar);
  }
  sv-app:has(.app-layout) > footer {
    padding-block-end: calc(var(--bottom-bar) + 18px);
  }
}
@media (max-width: 380px) {
  .app-sidebar .main-nav a.nav,
  .app-sidebar .main-nav a.nav.nav-cta {
    font-size: 10px;
    letter-spacing: -0.02em;
  }
}
@media (forced-colors: active) {
  .area-tabs a[aria-current='page'] {
    border-block-end-color: Highlight;
  }
  .menu-panel {
    border: 1px solid CanvasText;
  }
}
@media print {
  .topbar-actions {
    display: none;
  }
}
