/* The UFSO One top bar: one stylesheet for every surface.
 *
 * The portal's own pages draw the bar on the server (base.html); Spend
 * Analysis, Meeting Intelligence and Meridian get the same bar from shell.js,
 * which builds the same markup from /api/me. Both use this file and nothing
 * else, so the bar cannot drift between apps. It carries its own colours
 * (the brand's chrome set, light and dark) because the other apps name their
 * tokens differently; the values are the ones in portal.css. */

.ufb {
  --ufb-bg: #ffffff; --ufb-ink: #101016; --ufb-muted: #5a5750; --ufb-line: #e5e8e2;
  --ufb-hover: #eceeea; --ufb-active: rgba(142, 23, 26, 0.08); --ufb-active-ink: #8e171a;
  --ufb-brand: #8e171a; --ufb-brand-soft: rgba(142, 23, 26, 0.08);
  --ufb-shadow: 0 12px 32px -12px rgba(16, 16, 22, 0.18);
  box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 0 24px; height: 60px; background: var(--ufb-bg); color: var(--ufb-ink);
  border-bottom: 1px solid var(--ufb-line); position: sticky; top: 0; z-index: 45;
  font: 15px/1.55 "Geist", "Aptos", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased;
}
html.dark .ufb {
  --ufb-bg: #0b0b0f; --ufb-ink: #f2eee6; --ufb-muted: #b8b4ac; --ufb-line: #2b2b35;
  --ufb-hover: #1f1f28; --ufb-active: rgba(210, 74, 78, 0.22); --ufb-active-ink: #feedaa;
  --ufb-brand: #d24a4e; --ufb-brand-soft: rgba(210, 74, 78, 0.14);
  --ufb-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.55);
}
.ufb *, .ufb *::before, .ufb *::after { box-sizing: border-box; }
.ufb a { text-decoration: none; }
.ufb-left { display: flex; align-items: center; gap: 24px; min-width: 0; }
.ufb-right { display: flex; align-items: center; gap: 12px; flex: none; }

.ufb-brand {
  display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.2rem; line-height: 1;
  color: var(--ufb-ink); padding: 8px 10px; margin-left: -10px; border-radius: 9px; flex: none;
  transition: background 140ms ease;
}
.ufb-brand:hover { background: var(--ufb-hover); color: var(--ufb-ink); }
.ufb-brand img { height: 17px; width: auto; display: block; max-width: none; }
.ufb-brand img.ufb-wm-dark { display: none; }
html.dark .ufb-brand img.ufb-wm-light { display: none; }
html.dark .ufb-brand img.ufb-wm-dark { display: block; }
.ufb-brand span { color: var(--ufb-brand); }

.ufb-tabs { display: flex; gap: 4px; align-items: center; min-width: 0; }
.ufb-tab {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; cursor: pointer;
  padding: 7px 13px; border-radius: 8px; border: 0; background: none; margin: 0;
  font: inherit; font-size: 0.86rem; font-weight: 500; line-height: 1.55; color: var(--ufb-muted);
  transition: background 140ms ease, color 140ms ease;
}
.ufb-tab:hover { background: var(--ufb-hover); color: var(--ufb-ink); }
.ufb-tab.active { background: var(--ufb-active); color: var(--ufb-active-ink); font-weight: 600; }
.ufb-tab svg { flex: none; opacity: 0.7; transition: transform 140ms ease; }

/* A group of tabs behind one name (the tools). */
.ufb-menu { position: relative; display: flex; }
.ufb-menu.open > .ufb-tab { background: var(--ufb-hover); color: var(--ufb-ink); }
.ufb-menu.open > .ufb-tab.active { background: var(--ufb-active); color: var(--ufb-active-ink); }
.ufb-menu.open > .ufb-tab svg { transform: rotate(180deg); }
.ufb-menu-list {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 46; min-width: 230px;
  background: var(--ufb-bg); border: 1px solid var(--ufb-line); border-radius: 12px; padding: 6px;
  box-shadow: var(--ufb-shadow);
}
.ufb-menu.open .ufb-menu-list { display: block; }
.ufb-menu-list a {
  display: block; padding: 9px 12px; border-radius: 8px; font-size: 0.88rem; font-weight: 500;
  color: var(--ufb-ink); white-space: nowrap;
}
.ufb-menu-list a:hover { background: var(--ufb-hover); color: var(--ufb-ink); }
.ufb-menu-list a.active { background: var(--ufb-active); color: var(--ufb-active-ink); font-weight: 600; }

/* Search: opens the same search as Cmd/Ctrl K. */
.ufb-search {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin: 0;
  height: 34px; padding: 0 8px 0 11px; border-radius: 9px; border: 1px solid var(--ufb-line);
  background: var(--ufb-bg); color: var(--ufb-muted); font: inherit; font-size: 0.84rem; line-height: 1;
  transition: border-color 140ms ease, color 140ms ease;
}
.ufb-search:hover { border-color: var(--ufb-brand); color: var(--ufb-ink); }
.ufb-search kbd {
  font: 500 0.7rem/1 "Geist Mono", "Aptos Mono", ui-monospace, monospace; color: var(--ufb-muted);
  background: var(--ufb-hover); border-radius: 5px; padding: 4px 6px; margin-left: 14px;
}
.ufb-slot { display: flex; align-items: center; }
.ufb-icon {
  padding: 7px; border-radius: 8px; color: var(--ufb-muted); display: flex; align-items: center;
  transition: background 140ms ease;
}
.ufb-icon:hover { background: var(--ufb-hover); color: var(--ufb-ink); }
.ufb-avatar {
  width: 30px; height: 30px; border-radius: 999px; background: var(--ufb-brand-soft); color: var(--ufb-brand);
  display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 600; flex: none;
}
.ufb-out {
  padding: 5px 11px; border-radius: 9px; border: 1px solid var(--ufb-line); white-space: nowrap;
  font-size: 0.8rem; font-weight: 600; color: var(--ufb-ink); transition: border-color 140ms ease, color 140ms ease;
}
.ufb-out:hover { border-color: var(--ufb-brand); color: var(--ufb-brand); }

/* Not enough room for every tab plus the words in the search box. */
@media (max-width: 1180px) {
  .ufb-search span, .ufb-search kbd { display: none; }
  .ufb-search { padding: 0 9px; border-color: transparent; }
  .ufb-left { gap: 14px; }
  .ufb-tab { padding: 7px 10px; }
}

/* ------------------------------------------------------------- phone
 * The portal is also the installed phone app. Under 720px its bar becomes
 * two rows: brand and icons, then the tabs as a row that scrolls sideways
 * (a group is laid out flat there, since a drop-down would be clipped).
 * Sign out moves to Settings. Inside the other apps the bar stays one 60px
 * row, because their own phone menus sit directly beneath it. */
@media (max-width: 720px) {
  .ufb { padding: 0 16px; }
  .ufb-right { gap: 8px; }
  .ufb-out { display: none; }
  .ufb.ufb-embedded .ufb-tabs { display: none; }
  .ufb:not(.ufb-embedded) { flex-wrap: wrap; height: auto; padding: 8px 16px 0; row-gap: 4px; }
  .ufb:not(.ufb-embedded) .ufb-left { display: contents; }
  .ufb:not(.ufb-embedded) .ufb-brand { order: 1; }
  .ufb:not(.ufb-embedded) .ufb-right { order: 2; }
  .ufb:not(.ufb-embedded) .ufb-tabs {
    order: 3; flex: 0 0 calc(100% + 32px); margin: 0 -16px; padding: 2px 12px 8px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .ufb:not(.ufb-embedded) .ufb-tabs::-webkit-scrollbar { display: none; }
  .ufb:not(.ufb-embedded) .ufb-tab { flex: none; padding: 8px 12px; min-height: 36px; }
  .ufb:not(.ufb-embedded) .ufb-menu { display: contents; }
  .ufb:not(.ufb-embedded) .ufb-menu > .ufb-tab { display: none; }
  .ufb:not(.ufb-embedded) .ufb-menu-list { display: contents; }
  .ufb:not(.ufb-embedded) .ufb-menu-list a {
    flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 8px 12px;
    font-size: 0.86rem; color: var(--ufb-muted);
  }
  .ufb:not(.ufb-embedded) .ufb-menu-list a.active { color: var(--ufb-active-ink); }
}
@media (display-mode: standalone) {
  .ufb:not(.ufb-embedded) { padding-top: max(8px, env(safe-area-inset-top)); }
}
