:root {
  --sek-topbar-height: 72px;
  --sek-topbar-mobile-height: 64px;
  --sek-topbar-content-width: 1440px;
  --sek-topbar-inline-space: max(22px, calc((100vw - var(--sek-topbar-content-width)) / 2 + 22px));
}

.sek-topbar {
  box-sizing: border-box;
  min-width: 0;
  min-height: var(--sek-topbar-height);
  color: #ede7d8;
  background: var(--sek-ink, #171512);
  border: 0;
  border-bottom: 1px solid #302c27;
  border-radius: 0;
  box-shadow: none;
  font-family: "PT Sans", "Segoe UI", Arial, sans-serif;
}

.sek-topbar *,
.sek-topbar *::before,
.sek-topbar *::after {
  box-sizing: border-box;
}

.sek-topbar a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.sek-topbar__brand {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 15px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.sek-topbar__wordmark {
  color: #ffffff;
  font-family: "Old Standard TT", Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.sek-topbar__wordmark span {
  color: var(--sek-brand-red, #b7352b);
}

.sek-topbar__note {
  overflow: hidden;
  color: #aaa69e;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sek-topbar__nav,
.sek-topbar__actions {
  display: flex;
  align-items: center;
  min-width: 0;
}

.sek-topbar__context {
  display: flex;
  justify-content: center;
  flex-direction: column;
  min-width: 0;
}

.sek-topbar__context-kicker {
  overflow: hidden;
  color: var(--sek-gold, #b99342);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.sek-topbar__context-title {
  overflow: hidden;
  margin: 2px 0 0;
  color: #fffefa;
  font-family: "Old Standard TT", Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 400;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sek-topbar__action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: #e9e1d4;
  background: #27231e;
  border: 1px solid #514b42;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.sek-topbar__action:hover {
  color: #ffffff;
  background: #373129;
  border-color: #b7a777;
}

.public-auth-label-mobile {
  display: none;
}

/* Public pages: one stable brand / navigation / account layout. */
.sek-topbar.sek-topbar--public {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: stretch;
  gap: 24px;
  padding: 0 var(--sek-topbar-inline-space);
}

#product,
#workflow,
#security {
  scroll-margin-top: calc(var(--sek-topbar-height) + 18px);
}

.sek-topbar--public .sek-topbar__nav {
  align-self: stretch;
  justify-content: center;
  gap: 28px;
  margin: 0;
  color: #bbb7af;
  font-size: 13px;
}

.sek-topbar--public .sek-topbar__nav a {
  position: relative;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}

.sek-topbar--public .sek-topbar__nav a:hover,
.sek-topbar--public .sek-topbar__nav a.is-active {
  color: #ffffff;
}

.sek-topbar--public .sek-topbar__nav a.is-active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  content: "";
  background: var(--sek-gold, #b99342);
}

.pricing-page .sek-topbar--public .sek-topbar__nav a.is-active {
  box-shadow: none;
}

.sek-topbar--public .sek-topbar__actions {
  justify-content: flex-end;
  gap: 9px;
  padding-left: 24px;
  border-left: 1px solid rgba(237, 231, 216, 0.18);
}

/* Authenticated workspace. */
.sek-topbar.sek-topbar--workspace {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: stretch;
  gap: 24px;
  padding: 0 var(--sek-topbar-inline-space);
}

.sek-topbar--workspace .sek-topbar__actions {
  justify-content: flex-end;
}

.sek-topbar--workspace .shell-nav {
  justify-content: center;
  gap: 28px;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
}

.sek-topbar.sek-topbar--workspace .shell-nav-link {
  position: relative;
  min-width: 0;
  padding: 0;
  color: #bbb7af;
  background: transparent;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}

.sek-topbar.sek-topbar--workspace .shell-nav-link:hover,
.sek-topbar.sek-topbar--workspace .shell-nav-link.is-active {
  color: #ffffff;
  background: transparent;
}

.sek-topbar.sek-topbar--workspace .shell-nav-link.is-active::after {
  right: 0;
  left: 0;
  height: 2px;
  background: var(--sek-gold, #b99342);
}

.sek-topbar--workspace .header-actions {
  align-self: center;
  gap: 9px;
  padding: 0;
}

.sek-topbar--workspace .runtime-badge {
  display: none;
}

.sek-topbar--workspace .user-chip {
  min-width: 220px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 0 16px;
  color: #ffffff;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--sek-line-dark, #48443d);
  border-radius: 0;
  box-shadow: none;
}

.sek-topbar--workspace .user-chip:hover {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.sek-topbar--workspace .user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  color: #ffffff;
  background: var(--sek-success, #3f7257);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.sek-topbar--workspace .user-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.sek-topbar--workspace .user-name-row {
  width: 100%;
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sek-topbar--workspace .user-name {
  max-width: 138px;
  overflow: hidden;
  color: #f4f0e8;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sek-topbar--workspace .user-role {
  max-width: 170px;
  margin-top: 3px;
  overflow: hidden;
  color: #958f84;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sek-topbar--workspace .header-billing-label {
  flex: none;
  color: #bbb5aa;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.sek-topbar--workspace .header-billing-compact {
  width: 100%;
  display: block;
  margin-top: 5px;
}

.sek-topbar--workspace .header-billing-track {
  position: relative;
  width: 100%;
  height: 3px;
  display: block;
  overflow: hidden;
  background: #3b3731;
  border-radius: 999px;
}

.sek-topbar--workspace .header-billing-bar {
  width: 0;
  height: 100%;
  display: block;
  background: var(--sek-gold, #b99342);
  border-radius: inherit;
}

.sek-topbar--workspace .legacy-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: #d8d4cc;
  background: transparent;
  border: 1px solid var(--sek-line-dark, #48443d);
  border-radius: 2px;
  font-size: 11px;
  white-space: nowrap;
}

.sek-topbar--workspace .legacy-link:hover {
  color: #ffffff;
  background: #28241f;
}

/* Administration and internal tools share the same shell. */
.sek-topbar.sek-topbar--admin {
  display: grid;
  grid-template-columns: 230px minmax(240px, 1fr) auto;
  align-items: stretch;
  gap: 0;
  padding: 0 var(--sek-topbar-inline-space);
}

.sek-topbar--admin .admin-brand {
  align-items: center;
  justify-content: flex-start;
  flex-direction: row;
  padding: 0 22px 0 0;
  border-right: 1px solid #454038;
}

.sek-topbar--admin .admin-brand-note {
  margin-top: 0;
  color: #aaa69e;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.sek-topbar--admin .admin-header-context {
  padding: 0 24px;
}

.sek-topbar--admin .admin-nav {
  align-content: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 0 0 0 18px;
  border-left: 1px solid #454038;
}

.sek-topbar--admin .admin-header-context h1 {
  margin: 2px 0 1px;
  color: #fffefa;
  font-size: 19px;
}

.sek-topbar.sek-topbar--tool {
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) minmax(280px, 1.15fr) auto;
  align-items: stretch;
  gap: 24px;
  padding: 0 var(--sek-topbar-inline-space);
}

.sek-topbar--tool .sek-topbar__actions {
  justify-content: flex-end;
}

.page.developer-page,
.page.diag-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.developer-page .developer-grid,
.diag-page .diag-layout,
.sek-tool-intro {
  width: min(1500px, calc(100% - 48px));
  margin-right: auto;
  margin-left: auto;
}

.sek-tool-intro {
  margin-top: 22px;
  margin-bottom: 18px;
  color: var(--muted, #665f54);
  font-size: 13px;
  line-height: 1.55;
}

.sek-topbar.diag-header {
  margin-bottom: 0;
}

.developer-page .developer-grid {
  margin-bottom: 48px;
}

.diag-page .diag-layout {
  margin-bottom: 48px;
}

/* The editor retains its controls, but now uses the same top bar identity. */
body[data-editor-job-id] .editor-ribbon.sek-topbar--editor {
  grid-template-columns: 210px minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: var(--sek-topbar-height);
  padding: 8px var(--sek-topbar-inline-space);
  color: #f4efe3;
  background: rgba(23, 21, 18, 0.985);
  border-bottom: 1px solid #302c27;
}

.sek-topbar--editor .sek-topbar__brand {
  padding-right: 18px;
  border-right: 1px solid #454038;
}

.sek-topbar--editor .title-edit-row {
  margin-top: 0;
}

@media (max-width: 1240px) {
  .sek-topbar__note {
    display: none;
  }

  .sek-topbar--public .sek-topbar__nav {
    gap: 19px;
  }

  .sek-topbar.sek-topbar--admin {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .sek-topbar--admin .admin-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    min-height: 44px;
    overflow-x: auto;
    padding: 0 var(--sek-topbar-inline-space);
    border-top: 1px solid #454038;
    border-left: 0;
  }

  body[data-editor-job-id] .editor-ribbon.sek-topbar--editor {
    grid-template-columns: 170px minmax(260px, 1fr) auto auto;
  }
}

@media (max-width: 980px) {
  .sek-topbar.sek-topbar--public,
  .sek-topbar.sek-topbar--workspace {
    grid-template-columns: minmax(200px, 1fr) auto;
  }

  .sek-topbar--public .sek-topbar__nav,
  .sek-topbar--workspace .sek-topbar__nav {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 44px;
    justify-content: flex-start;
    gap: 26px;
    overflow-x: auto;
    padding: 0 var(--sek-topbar-inline-space);
    border-top: 1px solid #302c27;
    scrollbar-width: none;
  }

  .sek-topbar--public .sek-topbar__nav::-webkit-scrollbar,
  .sek-topbar--workspace .sek-topbar__nav::-webkit-scrollbar {
    display: none;
  }

  .sek-topbar.sek-topbar--tool {
    grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr) auto;
    gap: 16px;
  }

  body[data-editor-job-id] .editor-ribbon.sek-topbar--editor {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sek-topbar--editor .sek-topbar__brand {
    grid-column: 1;
    grid-row: 1;
    min-height: 44px;
  }

  .sek-topbar--editor .ribbon-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .sek-topbar--editor .ribbon-title {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sek-topbar--editor .ribbon-tools {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .sek-topbar--public .sek-topbar__nav {
    display: flex;
  }

  .sek-topbar--public .sek-topbar__actions {
    margin-left: 0;
  }

  .sek-topbar.sek-topbar--tool {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sek-topbar--tool .sek-topbar__context {
    grid-column: 1 / -1;
    min-height: 42px;
    padding-bottom: 8px;
    border-top: 1px solid #302c27;
  }
}

@media (max-width: 680px) {
  :root {
    --sek-topbar-height: var(--sek-topbar-mobile-height);
    --sek-topbar-inline-space: 14px;
  }

  .sek-topbar.sek-topbar--public {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .sek-topbar--public .sek-topbar__actions {
    gap: 6px;
    padding-left: 10px;
  }

  .sek-topbar.sek-topbar--workspace {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 12px;
  }

  .sek-topbar--public .sek-topbar__nav,
  .sek-topbar--workspace .sek-topbar__nav {
    width: calc(100% + 28px);
    margin-right: -14px;
    margin-left: -14px;
    gap: 22px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .sek-topbar.sek-topbar--workspace .shell-nav-link,
  .sek-topbar--public .sek-topbar__nav a {
    flex: 0 0 auto;
    font-size: 11px;
  }

  .sek-topbar--workspace .user-chip {
    min-width: 42px;
    padding-left: 8px;
    border-left: 0;
  }

  .sek-topbar--workspace .user-copy {
    display: none;
  }

  .sek-topbar.sek-topbar--admin {
    grid-template-columns: minmax(0, 1fr);
  }

  .sek-topbar--admin .admin-brand {
    min-height: var(--sek-topbar-mobile-height);
    padding: 0;
    border-right: 0;
  }

  .sek-topbar--admin .admin-header-context {
    min-height: 48px;
    padding: 8px 0;
    border-top: 1px solid #454038;
  }

  .sek-topbar--admin .admin-nav {
    width: calc(100% + 28px);
    margin: 0 -14px;
    padding: 0 14px;
  }

  .sek-topbar__context-title,
  .sek-topbar--admin .admin-header-context h1 {
    font-size: 17px;
  }

  .sek-topbar__wordmark {
    font-size: 17px;
  }

  .sek-topbar--tool .sek-topbar__context {
    min-height: 44px;
  }

  .developer-page .developer-grid,
  .diag-page .diag-layout,
  .sek-tool-intro {
    width: calc(100% - 24px);
  }

  body[data-editor-job-id] .editor-ribbon.sek-topbar--editor {
    padding: 8px 12px;
  }

  .sek-topbar--editor .ribbon-actions {
    flex-wrap: nowrap;
  }
}

@media (max-width: 440px) {
  .sek-topbar--public .public-home-login {
    display: inline-flex;
  }

  .sek-topbar--public .sek-topbar__actions {
    gap: 4px;
    padding-left: 0;
    border-left: 0;
  }

  .sek-topbar--public .sek-topbar__wordmark {
    font-size: 15px;
  }

  .sek-topbar--public .public-home-login,
  .sek-topbar--public .public-home-start {
    min-height: 32px;
    padding: 0 8px;
    font-size: 10.5px;
  }

  .public-auth-label-full {
    display: none;
  }

  .public-auth-label-mobile {
    display: inline;
  }

  .sek-topbar--editor .ribbon-actions {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sek-topbar--editor .ribbon-title {
    grid-row: 3;
  }

  .sek-topbar--editor .ribbon-tools {
    grid-row: 4;
  }
}
