:root {
  --ads-ink: #17212f;
  --ads-muted: #5d6676;
  --ads-blue: #315ba7;
  --ads-teal: #159e9c;
  --ads-teal-dark: #0c6f70;
  --ads-leaf: #45a66a;
  --ads-border: #d8deea;
  --ads-danger: #c1121f;
  --ads-warning: #b65f00;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0b1220;
  color: #e6edf7;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

.loginPage {
  flex-direction: column !important;
  min-height: 100vh;
  height: auto !important;
  box-sizing: border-box;
  padding: 24px 0;
}

.loginPage .ads-footer {
  width: min(100% - 32px, 760px);
  box-sizing: border-box;
  flex: 0 0 auto;
  margin: 20px 16px 0;
}

header {
  background: #111a2e;
  border-bottom: 1px solid rgba(21, 158, 156, .45) !important;
  border-bottom-color: rgba(21, 158, 156, .45) !important;
  position: sticky !important;
  top: 0;
  z-index: 1000;
}

button,
input,
select,
textarea {
  border-radius: 6px !important;
}

select {
  padding: 8px 10px;
  border: 1px solid #2a3a63;
  background: #0b1220;
  color: #e6edf7;
}

button {
  border-color: rgba(21, 158, 156, .48) !important;
}

button:hover:not([disabled]) {
  border-color: var(--ads-teal) !important;
  box-shadow: 0 0 0 1px rgba(21, 158, 156, .16);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ads-teal);
  outline-offset: 2px;
}

a {
  color: #82c9ca;
}

.ads-brand-mark {
  display: inline-flex;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  vertical-align: middle;
}

.homeHeader .ads-header-logo {
  display: block;
  width: 168px;
  height: 42px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

.mobileMenuToggle {
  display: none;
}

.ads-login-logo,
.ads-invitation-logo {
  display: block;
  width: min(100%, 360px);
  height: auto;
  margin: 0 auto 20px;
}

.loginPage .ads-login-logo {
  width: min(100%, 520px);
  padding: 10px 14px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 18px;
}

.ads-invitation-logo {
  width: min(100%, 420px);
  margin-bottom: 24px;
}

.ads-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 28px 16px 18px;
  color: #8190aa;
  font-size: 11px;
  text-align: center;
}

.ads-footer span + span::before {
  content: "|";
  margin-right: 12px;
  color: #51617d;
}

.err,
.error,
[style*="color:red"],
[style*="color: red"] {
  color: #ff8b8b !important;
}

@media (max-width: 600px) {
  .homeHeader {
    position: relative;
    min-height: 56px;
    padding: 8px 12px !important;
  }

  .homeHeader .ads-header-logo {
    width: 152px;
    height: 38px;
  }

  .homeHeader .homeNav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1100;
    padding: 10px 12px 12px;
    background: #111a2e;
    border-top: 1px solid rgba(21, 158, 156, .35);
    box-shadow: 0 14px 24px rgba(0, 0, 0, .3);
  }

  .homeHeader .homeNav.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .homeHeader .homeNav > * {
    width: 100%;
    box-sizing: border-box;
  }

  .homeHeader .mobileMenuToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 74px;
    padding: 8px 12px;
  }

  .ads-footer {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
  }

  .ads-footer span + span::before {
    display: none;
  }
}

/* Shared compact navigation for every authenticated page. */
.appHeader {
  gap: 12px;
}

.appHeader .ads-header-logo {
  display: block;
  width: 160px;
  height: auto;
  padding: 4px 6px;
  box-sizing: border-box;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
  flex: 0 0 auto;
}

.ads-header-link {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.helpPage { max-width: 1200px; margin: 0 auto; padding: 24px 18px 48px; }
.helpIntro { margin-bottom: 16px; }
.helpIntro h2, .helpGrid h2 { margin-top: 0; }
.helpGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.helpGrid p { margin-bottom: 0; color: #9fb0d6; line-height: 1.55; }

.appHeaderTitle {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: #e6edf7;
  font-size: 18px;
  font-weight: 700;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appHeaderNav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.deviceMenu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.deviceActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.deviceActionBar {
  margin-top: 12px;
  justify-content: flex-end;
}

.deviceActionBar > * {
  min-width: 120px;
}

.appHeader .mobileMenuToggle {
  display: none;
}

@media (max-width: 700px) {
  .appHeader {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 56px;
    padding: 8px 12px !important;
    position: relative;
  }

  .appHeader .ads-header-logo {
    width: 132px;
    padding: 3px 4px;
  }

  .appHeaderTitle {
    font-size: 15px;
  }

  .appHeader .mobileMenuToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding: 8px 10px;
  }

  .appHeader .appHeaderNav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1100;
    padding: 10px 12px 12px;
    background: #111a2e;
    border-top: 1px solid rgba(21, 158, 156, .35);
    box-shadow: 0 14px 24px rgba(0, 0, 0, .3);
  }

  .appHeader .appHeaderNav.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .appHeader .appHeaderNav > * {
    width: 100%;
    box-sizing: border-box;
  }

  .deviceHeader {
    grid-template-rows: auto auto;
  }

  .deviceHeader .devicePageTitle {
    grid-column: 2;
    grid-row: 1;
  }

  .deviceHeader .mobileMenuToggle {
    grid-column: 3;
    grid-row: 1;
  }

  .deviceHeader > .row:first-of-type {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
  }

  .deviceHeader .deviceMenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1100;
    padding: 10px 12px 12px;
    background: #111a2e;
    border-top: 1px solid rgba(21, 158, 156, .35);
    box-shadow: 0 14px 24px rgba(0, 0, 0, .3);
  }

  .deviceHeader .deviceMenu.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .deviceHeader .deviceMenu > * {
    width: 100%;
    box-sizing: border-box;
  }

  .deviceActionBar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .deviceActionBar > * {
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
  }
}

/* Unified application navigation and its Admin/System submenus. */
.globalAppNav .globalNavLink,
.globalAppNav summary,
.globalAppNav .globalNavRefresh,
.globalAppNav .globalNavLogout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(21, 158, 156, .48);
  border-radius: 6px;
  color: #e6edf7;
  background: transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}

.globalAppNav .globalNavLink:hover,
.globalAppNav summary:hover,
.globalAppNav .globalNavRefresh:hover,
.globalAppNav .globalNavLogout:hover {
  border-color: var(--ads-teal);
  color: #fff;
}

.globalNavGroup {
  position: relative;
}

.globalNavGroup summary {
  list-style: none;
}

.globalNavGroup summary::-webkit-details-marker {
  display: none;
}

.globalNavGroup summary::after {
  content: "▾";
  margin-left: 7px;
  font-size: 11px;
}

.globalNavSubmenu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1200;
  min-width: 190px;
  padding: 6px;
  border: 1px solid rgba(21, 158, 156, .48);
  border-radius: 6px;
  background: #111a2e;
  box-shadow: 0 14px 24px rgba(0, 0, 0, .3);
}

.globalNavGroup[open] .globalNavSubmenu {
  display: grid;
  gap: 6px;
}

.globalNavLanguage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9fb1d2;
  white-space: nowrap;
}

.globalNavLanguage select {
  max-width: 150px;
}

/* Keep navigation controls visually consistent across every page. */
.globalAppNav > .globalNavLink,
.globalAppNav > .globalNavGroup,
.globalAppNav > .globalNavRefresh,
.globalAppNav > .globalNavLogout,
.globalAppNav > .globalNavLanguage {
  box-sizing: border-box;
  width: 112px;
  min-width: 112px;
}

.globalAppNav > .globalNavGroup > summary {
  width: 100%;
  box-sizing: border-box;
}

.globalAppNav .globalNavSubmenu .globalNavLink {
  width: 100%;
  box-sizing: border-box;
}

.globalAppNav .sessionUser {
  color: #9fb1d2;
  font-size: 13px;
  white-space: nowrap;
}

.globalHeaderMenuArea {
  display: flex;
  align-items: center;
  gap: 8px;
}

.globalNavUser {
  color: #9fb1d2;
  font-size: 13px;
  max-width: 220px;
  overflow: hidden;
  padding: 4px 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacyNavigation[hidden] {
  display: none !important;
}

@media (max-width: 700px) {
  .globalHeaderMenuArea {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    min-width: 0;
  }

  .globalHeaderMenuArea .mobileMenuToggle {
    width: 100%;
  }

  .globalNavUser {
    max-width: 150px;
    text-align: right;
    font-size: 11px;
  }

  .globalAppNav .globalNavGroup {
    width: 100%;
  }

  .globalAppNav > .globalNavLink,
  .globalAppNav > .globalNavGroup,
  .globalAppNav > .globalNavRefresh,
  .globalAppNav > .globalNavLogout,
  .globalAppNav > .globalNavLanguage {
    width: 100%;
    min-width: 0;
  }

  .globalAppNav .globalNavLink,
  .globalAppNav summary,
  .globalAppNav .globalNavRefresh,
  .globalAppNav .globalNavLogout,
  .globalAppNav .globalNavLanguage,
  .globalAppNav .sessionUser {
    width: 100%;
  }

  .globalNavSubmenu {
    position: static;
    min-width: 0;
    margin-top: 6px;
    box-shadow: none;
  }

  .globalNavLanguage {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    padding: 4px 0;
    text-align: left;
  }

  .globalNavLanguage select {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Keep every page header compact and centered on desktop as well as mobile. */
.appHeader {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto;
  min-height: 56px;
  padding: 8px 18px !important;
  position: sticky !important;
  top: 0;
  z-index: 1000;
  align-items: center;
}

.appHeader .appHeaderTitle {
  grid-column: 2;
  grid-row: 1;
  text-align: center;
  font-size: 18px;
}

.appHeader .mobileMenuToggle {
  display: inline-flex;
  grid-column: 3;
  grid-row: 1;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 8px 12px;
}

.appHeader .appHeaderNav,
.deviceHeader .deviceMenu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1100;
  min-width: 240px;
  padding: 10px 12px 12px;
  background: #111a2e;
  border-top: 1px solid rgba(21, 158, 156, .35);
  box-shadow: 0 14px 24px rgba(0, 0, 0, .3);
}

.appHeader .appHeaderNav.open,
.deviceHeader .deviceMenu.open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.appHeader .appHeaderNav > *,
.deviceHeader .deviceMenu > * {
  width: 100%;
  box-sizing: border-box;
}

.appHeader .sessionUser,
.deviceHeader .sessionUser {
  justify-content: flex-start;
  padding-left: 8px;
  padding-right: 8px;
}

.deviceHeader {
  grid-template-rows: auto auto;
}

.deviceHeader .devicePageTitle {
  grid-column: 2;
  grid-row: 1;
}

.deviceHeader .mobileMenuToggle {
  grid-column: 3;
  grid-row: 1;
}

.deviceHeader > .row:first-of-type {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-content: center;
  padding-top: 4px;
}

.deviceHeader .deviceMenu {
  left: auto;
}

@media (max-width: 700px) {
  .appHeader {
    padding: 8px 12px !important;
  }

  .appHeader .appHeaderTitle {
    font-size: 15px;
  }

  .appHeader .ads-header-logo {
    width: 132px;
    padding: 3px 4px;
  }

  .appHeader .appHeaderNav,
  .deviceHeader .deviceMenu {
    left: 0;
    right: 0;
    min-width: 0;
  }
}


@media (min-width: 701px) {
  .globalNavGroup:hover .globalNavSubmenu,
  .globalNavGroup:focus-within .globalNavSubmenu,
  .globalNavGroup[open] .globalNavSubmenu {
    display: grid;
    gap: 6px;
  }
}


/* Shared navigation refinements. */
.globalTopLanguage{display:inline-flex;align-items:center}
.globalTopLanguage select{width:76px;min-width:76px;max-width:76px;padding-left:8px;padding-right:8px}
.globalNavUser{display:block;width:100%;box-sizing:border-box;padding:8px 12px;color:#9fb1d2;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media (max-width:700px){  .helpPage { padding: 18px 12px 32px; }
  .helpGrid { grid-template-columns: 1fr; }.globalHeaderMenuArea{flex-direction:row;align-items:center}.globalTopLanguage select{height:38px}.globalAppNav>.globalNavLink,.globalAppNav>.globalNavRefresh,.globalAppNav>.globalNavLogout,.globalAppNav>.globalNavGroup{width:100%;min-width:0}.globalAppNav .globalNavUser{width:100%;text-align:left;font-size:14px;padding:10px 12px}.globalAppNav{max-height:calc(100vh - 64px);overflow-y:auto}}

.appHeader .ads-header-logo{width:160px;height:auto;padding:4px 6px;border-radius:6px}
.appHeader .globalHeaderMenuArea{grid-column:3;grid-row:1;display:flex;align-items:center;gap:8px}
@media (max-width:700px){.appHeader .globalHeaderMenuArea{grid-column:3;grid-row:1;display:flex;align-items:center;gap:5px}.appHeader .ads-header-logo{width:132px;max-width:100%;height:auto;padding:3px 4px;border-radius:6px}}

/* Keep the dashboard language code fully visible on desktop. */
@media (min-width: 601px) {
  .homeHeader .homeNav #languageSelect {
    width: 76px;
    min-width: 76px;
    max-width: 76px;
    box-sizing: border-box;
    flex: 0 0 76px;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
}
