:root {
  --platform-nav-height: 54px;
  --platform-ink: #111714;
  --platform-muted: #66706a;
  --platform-line: #d9dfdb;
  --platform-paper: #ffffff;
  --platform-green: #176b4d;
}

.platform-bar,
.platform-bar * { box-sizing: border-box; }

.platform-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3000;
  flex: 0 0 var(--platform-nav-height);
  width: 100%;
  height: var(--platform-nav-height);
  border-bottom: 1px solid var(--platform-line);
  background: rgba(255, 255, 255, .97);
  color: var(--platform-ink);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

body.has-platform-nav { padding-top: var(--platform-nav-height) !important; }

/* The platform bar is the single global header. Legacy page headers remain in
   the markup for compatibility, but must not create a second navigation layer. */
body.has-platform-nav .app-header,
body.has-platform-nav .agent-header,
body.has-platform-nav #navbar { display: none !important; }

.platform-bar-inner {
  width: min(1280px, calc(100% - 32px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.platform-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: none;
  color: inherit;
  text-decoration: none;
}

.platform-brand-mark {
  width: 30px;
  height: 30px;
  display: block;
  flex: none;
}

.platform-brand-copy strong { display: block; font-size: 13px; line-height: 1.1; letter-spacing: 0; white-space: nowrap; }
.platform-brand-copy b { font-weight: 800; }

.platform-module {
  min-width: 0;
  max-width: 160px;
  overflow: hidden;
  padding-left: 16px;
  border-left: 1px solid var(--platform-line);
  color: var(--platform-muted);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-products {
  min-width: 0;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.platform-products a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 15px;
  color: var(--platform-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.platform-products a::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 3px;
  background: transparent;
}

.platform-products a:hover,
.platform-products a[aria-current="page"] { color: var(--platform-ink); }
.platform-products a[aria-current="page"]::after { background: var(--product-color, var(--platform-green)); }
.platform-products a[data-product="trace"] { --product-color: #ef6a4c; }
.platform-products a[data-product="kmap"] { --product-color: #2f68df; }
.platform-products a[data-product="aihub"] { --product-color: #176b4d; }
.platform-products a[data-product="pulse"] { --product-color: #d9a514; }
.platform-products a[data-product="app"] { --product-color: #7357c7; }

.platform-account {
  flex: none;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--platform-line);
  border-radius: 5px;
  background: #fff;
  color: var(--platform-ink);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
}

.platform-agent-link {
  flex: none;
  color: var(--platform-muted);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.platform-agent-link:hover { color: var(--platform-ink); }

.platform-menu-button {
  display: none;
  width: 36px;
  height: 36px;
  margin-left: auto;
  border: 1px solid var(--platform-line);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.platform-menu-button span {
  display: block;
  width: 16px;
  height: 1px;
  margin: 4px auto;
  background: var(--platform-ink);
}

body.has-platform-nav #navbar { top: var(--platform-nav-height); }
body.has-platform-nav .app-header,
body.has-platform-nav .agent-header { top: var(--platform-nav-height); }

@media (max-width: 940px) {
  .platform-bar-inner { width: min(100% - 24px, 1280px); gap: 12px; }
  .platform-menu-button { display: block; }
  .platform-account { display: none; }
  .platform-agent-link { margin-left: auto; }
  .platform-products {
    position: absolute;
    top: calc(var(--platform-nav-height) - 1px);
    right: 0;
    left: 0;
    height: auto;
    display: none;
    padding: 8px 12px 12px;
    border-bottom: 1px solid var(--platform-line);
    background: #fff;
    box-shadow: 0 12px 30px rgba(17, 23, 20, .1);
  }
  .platform-bar.menu-open .platform-products { display: grid; grid-template-columns: 1fr 1fr; }
  .platform-products a { min-height: 46px; padding: 0 12px; border-bottom: 1px solid #edf0ee; }
  .platform-products a::after { right: auto; bottom: 10px; left: 0; width: 3px; height: 26px; }
}

@media (max-width: 520px) {
  .platform-brand-copy strong { max-width: 116px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
  .platform-module { max-width: 82px; padding-left: 10px; font-size: 9px; }
  .platform-agent-link { display: none; }
  .platform-bar.menu-open .platform-products { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .platform-bar *, .platform-bar *::before, .platform-bar *::after { scroll-behavior: auto !important; transition: none !important; }
}
