/* Topbar -see docs/strategy/design-system/23-topbar.md
 *
 * Four production variants, all 48–52px high, all anchored to
 * --surface with a --divider bottom border:
 *
 *   .shell-topbar         App-shell topbar for Standard/Pro (wordmark
 *                         + tenant chip + breadcrumb + search + pills
 *                         + bell + avatar). 52px.
 *   .pos-topbar           POS service topbar (back + breadcrumb +
 *                         status pill + employee chip + checkout). 52px.
 *   .auth-topbar          Sign-in / sign-up / OTP shell (wordmark +
 *                         locale pill). 48px.
 *   .onboarding-topbar    Wizard shell (back icon + title + skip /
 *                         finish actions). Auto-height via padding.
 *
 * Each variant owns its atoms (-brand, -wordmark, -title, -actions,
 * -back, etc). Desktop additions for shell + pos live in the single
 * @media block at the bottom.
 *
 * Legacy `.topbar` / `.topbar-logo` are kept for pre-revamp screens
 * that still reference them -do not extend.
 */

/* ────────────────────────────────────────────────────────────────
   Legacy topbar (pre-revamp screens). Do not extend.
   ──────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  height: 52px;
}

.topbar-logo {
  font-size: var(--font-size-logo);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: var(--letter-spacing-page-title);
}

.topbar-logo .dot {
  color: var(--brand-green);
  font-weight: 700;
}

.topbar-logo .core {
  color: var(--muted);
  font-weight: 400;
}

.tenant-chip {
  font-size: var(--font-size-small);
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tenant-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.currency {
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--muted);
}

.topbar-spacer {
  flex: 1;
}

/* ────────────────────────────────────────────────────────────────
   Shell topbar -Standard / Pro app shell.
   Default-hidden atoms (.shell-topbar-search / -bell) are revealed
   inside the desktop @media block below.
   ──────────────────────────────────────────────────────────────── */
.shell-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 52px;
  padding: 0 var(--space-3);
  flex-shrink: 0;
  position: relative;
  z-index: 250;
}

.bc.shell-topbar-breadcrumb,
.shell-topbar-breadcrumb,
.shell-topbar-search,
.shell-topbar-bell {
  display: none;
}

/* Topbar always wraps its main-row children in .shell-topbar-row so the
   two-row breadcrumb variant has something to anchor to. In the default
   single-row mode the wrapper is `display: contents` (transparent to
   layout · children become direct flex items of .shell-topbar, original
   spacing and desktop @media overrides hit them exactly as before). */
.shell-topbar-row {
  display: contents;
}

/* Two-row topbar variant · main row (tenant chip + bell + avatar) +
   second row docked breadcrumb. Activated by the `has-breadcrumb`
   modifier (set in _topbar.html when `topbar_breadcrumb_chain` is in
   context). Mirrors the atlas spec in
   wireframes/shell_mobile/settings_atlas.html. */
.shell-topbar.has-breadcrumb {
  height: auto;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
}

.shell-topbar.has-breadcrumb .shell-topbar-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  height: 52px;
  padding: 0 var(--space-3);
  box-sizing: border-box;
}

/* Docked breadcrumb strip used by BOTH shells:
   - app shell · sibling of .shell-topbar inside .shell-stage (rendered
     by _topbar.html when topbar_breadcrumb_chain is in context, gated
     by the .has-breadcrumb modifier).
   - focused shell · sibling of .shell-focused-topbar (rendered by
     _focused_base.html when the chain is set; no modifier needed
     since the strip itself is only emitted then).
   The class wins over `.bc { display: inline-flex }` from
   components/24-breadcrumbs.css because of higher specificity here. */
.shell-topbar.has-breadcrumb .shell-topbar-breadcrumb-strip,
.bc.shell-topbar-breadcrumb-strip {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 6px var(--space-3);
  border-top: 1px solid var(--divider);
  border-radius: 0;
  background: var(--surface-soft);
  font-size: var(--font-size-small);
  min-width: 0;
}

.shell-topbar-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.shell-topbar-wordmark {
  width: auto;
  display: block;
}

.shell-tenant-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-0) var(--space-2);
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
  font-size: var(--font-size-small);
  font-weight: 700;
  /* Framework/currency pills moved out of the mobile topbar into the
     profile menu (2026-09-30) freed up room here - was 120px, cramped
     enough to barely show the name before the two pills' own width
     was accounted for. */
  max-width: 180px;
  flex-shrink: 1;
  min-width: 0;
}

.shell-tenant-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.shell-tenant-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.shell-topbar-spacer {
  flex: 1;
}

.shell-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────────
   POS topbar -back + breadcrumb + employee + status + checkout.
   The breadcrumb's typography comes from .bc; this owns layout only.
   ──────────────────────────────────────────────────────────────── */
.pos-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  height: 52px;
  flex-shrink: 0;
}

.pos-topbar-back {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--divider);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
}

.pos-topbar-back:hover {
  background: var(--surface-soft);
}

.pos-topbar-title {
  flex: 1;
  font-size: var(--font-size-prominent);
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-topbar-quickadd-form {
  display: none;
  margin: 0;
}

.pos-topbar-quickadd-btn {
  white-space: nowrap;
}

.pos-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.pos-topbar-emp {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--admin-accent-bg);
  color: var(--admin-accent);
  border: 1px solid var(--admin-accent-border);
  font-size: var(--font-size-micro);
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

/* Form wrapper around the Switch button -kept layout-transparent so
   it slots into the topbar flex row as if it were a plain element. */
.pos-topbar-form {
  margin: 0;
  display: inline-flex;
}

.pos-topbar-pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-0) var(--space-2);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--divider);
  font-family: var(--font);
  font-size: var(--font-size-small);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.pos-topbar-pill:hover {
  background: var(--surface);
  color: var(--text);
}

.pos-topbar-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-0) var(--space-2);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--divider);
  font-size: var(--font-size-small);
  font-weight: 700;
}

.pos-topbar-status.is-open {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.pos-topbar-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

/* ────────────────────────────────────────────────────────────────
   Auth topbar -sign-in / sign-up / OTP shell. 48px, wordmark left,
   locale pill right.
   ──────────────────────────────────────────────────────────────── */
.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.auth-topbar-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.auth-topbar-wordmark {
  display: block;
  width: 96px;
  height: 32px;
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────────
   Onboarding topbar -wizard shell. Auto-height via padding so the
   title can wrap if needed; back icon left, skip/finish actions right.
   ──────────────────────────────────────────────────────────────── */
.onboarding-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.onboarding-topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--divider);
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.onboarding-topbar-icon-btn:hover {
  color: var(--text);
  border-color: var(--border);
}

.onboarding-topbar-title {
  flex: 1;
  font-weight: 700;
  font-size: var(--font-size-body);
  color: var(--text);
  padding-left: var(--space-1);
}

.onboarding-topbar-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.onboarding-topbar-wordmark {
  display: block;
  width: 96px;
  height: 32px;
}

.onboarding-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ────────────────────────────────────────────────────────────────
   Profile menu -anchored popover under the shell topbar avatar.
   Kept in this file because it's only ever rendered from a topbar.
   ──────────────────────────────────────────────────────────────── */
.menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  width: 220px;
  overflow: hidden;
}

.menu-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-soft);
}

.menu-name {
  font-size: var(--font-size-body);
  font-weight: 700;
  color: var(--text);
}

.menu-sub {
  margin-top: 2px;
  font-size: var(--font-size-small);
  color: var(--muted);
}

.menu-link {
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
  font-size: var(--font-size-caption);
  font-weight: 600;
  color: var(--text);
  display: block;
  text-decoration: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  cursor: pointer;
}

.menu-link:last-child {
  border-bottom: 0;
}

.menu-link:hover {
  background: var(--surface-soft);
}

.menu-link.danger {
  color: var(--error);
}

/* ════════════════════════════════════════════════════════════════
   Desktop additions (≥1024px) -shell breadcrumb + search + bell,
   POS quickadd reveal, and pos-topbar-actions push-to-right.
   ════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {

  .shell-topbar {
    height: 56px;
    padding: 0 var(--space-5);
    gap: var(--space-3);
  }

  /* Desktop hides the tenant chip in the topbar -the sidebar shows it. */
  .shell-tenant-chip {
    display: none !important;
  }

  /* No flex-1 spacer at desktop -breadcrumb sits left, search middle. */
  .shell-topbar-spacer {
    display: none;
  }

  .bc.shell-topbar-breadcrumb,
  .shell-topbar-breadcrumb {
    display: inline-flex;
    min-width: 0;
  }

  .shell-topbar-search {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex: 0 1 360px;
    min-width: 0;
    padding: 6px 10px;
    background: var(--surface-soft);
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    margin-left: var(--space-4);
  }

  .shell-topbar-search:focus-within {
    border-color: var(--primary);
  }

  .shell-topbar-search-icon {
    color: var(--muted);
    display: inline-flex;
  }

  .shell-topbar-search-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: var(--font);
    font-size: var(--font-size-caption);
    color: var(--text);
    min-width: 0;
  }

  .shell-topbar-search-input::placeholder {
    color: var(--muted);
  }

  .shell-topbar-actions {
    margin-left: auto;
  }

  .shell-topbar-bell {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
  }

  .shell-topbar-bell:hover {
    background: var(--surface-soft);
  }

  .shell-topbar-bell-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--error);
    border: 2px solid var(--surface);
  }

  .pos-topbar-quickadd-form {
    display: inline-block;
  }

  .pos-topbar-quickadd-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
  }
}
