/* Account chip + menu (ui/account-menu.mjs). Self-contained: the app's
   styles.css and the admin console's inline sheet both link this file, so the
   control reads identically on both pages. Colours are the host page's
   variables (the console's palette), each with the NexiAxs token written out
   as its fallback for a page that has no such variable. */

.nxs-acct {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  max-width: 320px;
  padding: 4px 10px 4px 5px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink, #0f172a);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 8px -4px rgba(15, 23, 42, 0.25);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nxs-acct:hover { border-color: #cbd5e1; box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.3); }
.nxs-acct:focus-visible { outline: 2px solid #5b5bd6; outline-offset: 2px; }
.nxs-acct[aria-expanded="true"] { border-color: #cbd5e1; }

.nxs-acct-avatar {
  width: 28px; height: 28px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand1, #667eea) 0%, var(--brand2, #764ba2) 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.nxs-acct-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.nxs-acct-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nxs-acct-sub {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted, #64748b);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nxs-acct-pill {
  flex: none;
  background: #ede9fe; color: #5b21b6;
  border-radius: 6px; padding: 0 5px;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
}
.nxs-acct-chevron { color: #94a3b8; flex: none; }

/* Staff acting as a customer: the whole chip goes amber, like Nexiway. */
.nxs-acct.is-acting { border-color: #f6c56b; background: #fffaf0; }
.nxs-acct.is-acting .nxs-acct-sub { color: var(--warn, #b45309); }

/* ---- menu ---- */
.nxs-acct-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 272px;
  max-width: 340px;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(23, 26, 38, 0.08), 0 20px 44px -16px rgba(30, 27, 57, 0.4);
  color: var(--ink, #0f172a);
  font-size: 13px;
  text-align: left;
}
.nxs-acct-head { padding: 10px 10px 8px; }
.nxs-acct-head-name { font-size: 14px; font-weight: 650; }
.nxs-acct-head-name { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.nxs-acct-edit {
  border: 0; background: transparent; padding: 0; margin: 0;
  font: inherit; font-size: 12px; font-weight: 500; color: #5b5bd6; cursor: pointer; white-space: nowrap;
}
.nxs-acct-edit:hover { text-decoration: underline; }
.nxs-acct-edit-form { display: grid; gap: 6px; margin: 2px 0 6px; }
.nxs-acct-edit-label { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted, #64748b); }
.nxs-acct-edit-form input {
  width: 100%; min-height: 36px; padding: 6px 10px;
  border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; font-size: 14px; color: var(--ink, #0f172a); background: #fff;
}
.nxs-acct-edit-form input:focus { outline: 2px solid #5b5bd6; outline-offset: 1px; border-color: #5b5bd6; }
.nxs-acct-edit-hint { font-size: 11.5px; color: var(--muted, #64748b); }
.nxs-acct-edit-actions { display: flex; gap: 8px; }
.nxs-acct-edit-actions button {
  min-height: 32px; padding: 4px 12px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink, #0f172a); cursor: pointer;
}
.nxs-acct-edit-save { background: #5b5bd6 !important; border-color: #5b5bd6 !important; color: #fff !important; }
.nxs-acct-edit-save[disabled] { opacity: 0.6; cursor: wait; }
.nxs-acct-edit-err { font-size: 12px; color: var(--bad, #dc2626); }
.nxs-acct-head-email { font-size: 12px; color: var(--muted, #64748b); word-break: break-all; }
.nxs-acct-head-meta { font-size: 12px; color: var(--muted, #64748b); margin-top: 4px; }
.nxs-acct-head-staff { font-size: 12px; color: #5b21b6; margin-top: 2px; }
.nxs-acct-notice {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 8px; padding: 6px 8px;
  background: #fffaf0; border: 1px solid #fde8c4; border-radius: 8px;
  color: var(--warn, #b45309); font-size: 11.5px; line-height: 1.35;
}
.nxs-acct-notice svg { flex: none; margin-top: 2px; }
.nxs-acct-divider { border-top: 1px solid #eef0f6; margin: 4px 0; }
.nxs-acct-heading {
  padding: 8px 10px 2px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  color: #94a3b8;
}
.nxs-acct-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--ink, #0f172a);
  font: inherit; font-size: 13px;
  text-align: left; text-decoration: none;
  cursor: pointer;
}
.nxs-acct-item:hover, .nxs-acct-item:focus-visible { background: var(--surface, #f6f7fb); text-decoration: none; outline: none; }
.nxs-acct-item:focus-visible { box-shadow: inset 0 0 0 2px #5b5bd6; }
.nxs-acct-item.is-danger { color: var(--bad, #dc2626); }
.nxs-acct-item.is-current { font-weight: 600; }
.nxs-acct-lead { width: 14px; flex: none; display: inline-flex; color: var(--super, #7c3aed); }
.nxs-acct-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nxs-acct-tag { color: #94a3b8; font-size: 11px; font-weight: 500; }
.nxs-acct-mono { font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, Menlo, monospace; font-size: 12.5px; }

/* Narrow screens: avatar and chevron only; the menu header carries the rest. */
@media (max-width: 640px) {
  .nxs-acct { padding: 4px 8px 4px 4px; gap: 6px; }
  .nxs-acct-who { display: none; }
  .nxs-acct-menu { max-width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .nxs-acct { transition: none; }
}

/* The act-as switch (account-menu.mjs actAsSection): pinned current company, search, folded groups. */
.nxs-acct-cur { display: flex; align-items: center; gap: 8px; margin: 2px 8px 6px; padding: 6px 6px 6px 10px; background: #fffaf0; border: 1px solid #fde8c4; border-radius: 9px; font-size: 12.5px; color: #92400e; }
.nxs-acct-cur > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nxs-acct-stop { flex: 0 0 auto; padding: 4px 8px; border: 1px solid #f6c56b; border-radius: 7px; background: #fff; color: #92400e; font: inherit; font-size: 12px; cursor: pointer; }
.nxs-acct-find { box-sizing: border-box; width: calc(100% - 16px); margin: 2px 8px 4px; padding: 7px 10px; border: 1px solid #e6e8ef; border-radius: 8px; font: inherit; font-size: 12.5px; }
.nxs-acct-grp .nxs-acct-label { display: flex; align-items: center; width: 100%; font-size: 12px; font-weight: 650; }
.nxs-acct-count { margin-left: auto; color: #94a3b8; font-weight: 500; }
.nxs-acct-sub { padding: 6px 14px 2px; font-size: 11px; color: #94a3b8; font-weight: 650; }
.nxs-acct-none { padding: 8px 14px; font-size: 12.5px; color: #64748b; }
.nxs-acct-act.is-busy .nxs-acct-act-list, .nxs-acct-act.is-busy .nxs-acct-find { pointer-events: none; opacity: .55; }
.nxs-acct-act .is-going { color: #5b21b6; font-weight: 600; }
