/* Shared role chip + dropdown + nav-tab refinements. Loaded by every page. */

/* --- Role chip (sits in the brand bar, top-right) --- */

[data-role-chip] {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.role-chip:hover {
  background: rgba(255, 255, 255, 0.22);
}
.role-chip-icon { font-size: 14px; line-height: 1; }
.role-chip-label { font-weight: 600; }
.role-chip-caret { font-size: 9px; opacity: 0.7; }

/* Dropdown — absolute-positioned panel beneath the chip */
.role-chip-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.18);
  padding: 8px 0;
  display: none;
  z-index: 200;
  border: 1px solid var(--c-border, #e2e8f0);
}
.role-chip-dropdown.open { display: block; }
.role-chip-dropdown-head {
  padding: 8px 14px;
  border-bottom: 1px solid var(--c-border, #e2e8f0);
  margin-bottom: 4px;
}
.role-chip-dropdown-head strong {
  display: block;
  font-size: 12px;
  color: var(--c-text, #0f172a);
  margin-bottom: 2px;
}
.role-chip-dropdown-head p {
  margin: 0;
  font-size: 10px;
  color: var(--c-text-dim, #64748b);
  font-style: italic;
}
.role-chip-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
}
.role-chip-item:hover { background: var(--c-surface-2, #f1f5f9); }
.role-chip-item.active {
  background: var(--c-primary-soft, #e0e7ff);
}
.role-chip-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text, #0f172a);
}
.role-chip-item.active .role-chip-item-label {
  color: var(--c-primary-dark, #4338ca);
}
.role-chip-item-sub {
  font-size: 11px;
  color: var(--c-text-dim, #64748b);
  margin-top: 1px;
}

/* --- Tab strip refinements (the per-role nav) --- */

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.page-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  border-bottom: none;
  transition: background 0.12s;
}
.page-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}
.page-nav a.active {
  background: var(--c-surface, white);
  color: var(--c-primary-dark, #4338ca);
  border-color: rgba(15, 23, 42, 0.08);
}

/* Phone: nav strip becomes a horizontally-scrollable rail. With six-plus
   tabs on the super-admin's nav this prevents the second-row wrap that
   eats vertical space; on a tablet they all fit and the rule is a no-op. */
@media (max-width: 600px) {
  .page-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* hide the scrollbar visually — operator pans by touch */
    scrollbar-width: none;
  }
  .page-nav::-webkit-scrollbar { display: none; }
  .page-nav a {
    flex: 0 0 auto;       /* never shrink; scroll if total > viewport */
    white-space: nowrap;
  }
}

/* Phone: role chip sits in a tight header — drop the long role label
   on phone, keep the icon + caret so the dropdown still works. */
@media (max-width: 600px) {
  .role-chip-label { display: none; }
  .role-chip {
    padding: 6px 10px;
    min-height: var(--touch-min);
  }
}

/* Floor page variant — role chip on dark background */
.floor-header [data-role-chip] .role-chip {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}
.floor-header [data-role-chip] .role-chip-dropdown {
  color: var(--c-text, #0f172a);
}
