/* ========================================================================
 *  KX-PAY V2 dashboard  ·  03-account.css
 * -----------------------------------------------------------------------
 *  Avatar pill, account menu, wallet badge, realtime dot — the block at the
 *  bottom of the sidebar. Plus .logo, which sits at the top of it.
 *
 *  WAS 03-header.css, AND THE HEADER IS GONE
 *    It held the logo, the nav, the wallet badge and the account menu. The
 *    logo and nav moved to the sidebar; then these moved down there too, and
 *    an empty white strip was all that was left of the bar, so it went.
 *
 *    The `header { ... }` rule is deleted rather than left unused: a stale
 *    rule for an element that no longer exists is a trap for whoever adds a
 *    <header> back one day for something else entirely.
 *
 *  Load order matters — see the numeric prefix.
 * =======================================================================
 */

  .logo {
    font-size: 28px; font-weight: 900; letter-spacing: -1px;
    background: linear-gradient(135deg, #1d4ed8, #06b6d4);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    flex-shrink: 0;
  }
  .logo .dot { color: #06b6d4; }
  /* The nav used to live here, as a row of <a> filling the header. It is now
     the left rail -- see 03-sidebar.css. The old rules were bare `nav a`
     selectors, so leaving them would have laid the sidebar out horizontally.
     They are deleted rather than overridden for that reason. */

  /* --------------------------------------------------- SIDEBAR FOOT BLOCK */
  /* Pinned to the bottom of the rail, above the browser chrome, below the
     nav -- which scrolls independently, so a long menu never pushes the
     account block off the screen. */
  /* No top rule: the rail is transparent, so a hairline across it is the
     edge of nothing. The account pill is a white card like the nav links,
     which is what separates it from them.

     THE DEEP BOTTOM PADDING IS LOAD-BEARING.
     The rail is 100dvh tall, and viewport units do not subtract a horizontal
     scrollbar -- the spec has them measured as though scrollbars were not
     there. So the moment anything makes the page scroll sideways, the rail
     runs 15-17px BELOW the visible area and takes the account block with it:
     measured 15px of rail below the fold and the pill clipped by 5, which is
     the cropped "superadmin / SUPER ADMIN" that was reported.
     22px keeps the pill clear of even a chunky Windows scrollbar. The rail's
     background still passes underneath, which is fine -- nothing readable is
     down there. */
  .sb-foot {
    position: relative;      /* the anchor for .user-menu, which opens UPWARD */
    flex-shrink: 0;
    padding: 10px 10px 22px;
  }

  .user-info {
    display: flex; flex-direction: column; gap: 8px;
    align-items: stretch; font-size: 13px;
  }
  /* --- Avatar pill (header user menu) ----------------------------- */
  /* Layout: [avatar+dot] [stacked name + role] [caret], wrapped in a
     rounded pill button. The realtime dot (#ws-status) is positioned as
     a small status indicator at the bottom-right of the avatar. */
  #user-name {
    font-weight: 600; color: #0f172a; font-size: 13px;
    line-height: 1.2; white-space: nowrap;
  }
  .user-info .role {
    font-size: 10px; color: #64748b; font-weight: 500;
    text-transform: uppercase; letter-spacing: .5px;
    line-height: 1.2; white-space: nowrap;
    /* No more pill background — quieter, like Slack/GitHub user labels */
    padding: 0; background: transparent; border-radius: 0;
  }
  .user-info-stack {
    display: inline-flex; flex-direction: column; gap: 1px;
    align-items: flex-start; line-height: 1.2;
  }
  .user-avatar {
    position: relative;
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    color: white; font-weight: 700; font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .user-avatar-text { line-height: 1; }

  /* DELETED: `.user-info button { background:transparent; border:1px solid
     #cbd5e1; border-radius:8px; ... }`
     A leftover from V1, where .user-info held two plain buttons side by side.
     Those became the avatar pill and its dropdown long ago, and the rule has
     been quietly beating both ever since -- `.user-info button` is (0,1,1)
     and `.user-menu-btn` / `.user-menu-item` are (0,1,0), so it won on
     border, padding and radius no matter what they asked for. That is why
     the pill was square-cornered rather than the round it specifies, and why
     each item in the dropdown had a grey box drawn around it.
     It only ever matched those three elements, and all three style
     themselves, so there is nothing left for it to do. */

  /* --------------------------------------------- USER MENU pill + dropdown */
  /* Click the pill (username + role + caret) to open a small dropdown with
     Change password and Logout. Replaces the previous wide cluster of two
     separate buttons that pushed everything to the right side of the header. */
  .user-menu-btn {
    display: flex; align-items: center; gap: 8px;
    width: 100%;             /* fills the rail rather than hugging its text */
    /* White, matching the nav cards. It used to be grey against a white
       header; against the page backdrop the grey read as disabled. */
    background: #ffffff; border: 1px solid rgba(148,163,184,0.16);
    box-shadow: 0 1px 2px rgba(15,23,42,0.05);
    /* Tighter left padding so the avatar nests flush against the pill edge */
    padding: 4px 12px 4px 4px; border-radius: 999px;
    font-size: 13px; font-family: inherit; color: #0f172a;
    cursor: pointer; transition: background .15s, border-color .15s;
  }
  .user-menu-btn:hover { background: #eff6ff; border-color: #bfdbfe; }
  .user-menu-btn[aria-expanded="true"] {
    background: #eff6ff; border-color: #bfdbfe;
  }
  .user-menu-btn #user-name { font-weight: 600; color: #0f172a; }
  .user-menu-caret { font-size: 10px; color: #64748b; margin-left: 2px; }

  /* Opens UPWARD. It used to hang below a top bar; anchored to the bottom of
     the sidebar, a downward menu would open past the bottom of the window.
     .sb-foot is position:relative, so `bottom:100%` puts this directly above
     it, over the nav. */
  .user-menu {
    position: absolute; bottom: 100%; left: 10px; right: 10px; top: auto;
    margin-bottom: 6px; z-index: 1000;
    background: white; border: 1px solid #cbd5e1; border-radius: 10px;
    padding: 6px; box-shadow: 0 6px 20px rgba(15,23,42,0.18);
    min-width: 0; display: flex; flex-direction: column; gap: 2px;
  }
  .user-menu.hidden { display: none; }
  .user-menu-item {
    display: flex; align-items: center; gap: 10px;
    background: transparent; border: none;
    padding: 9px 12px; border-radius: 6px;
    font-size: 14px; font-family: inherit; color: #0f172a;
    cursor: pointer; text-align: left; width: 100%;
  }
  .user-menu-item:hover { background: #f1f5f9; }
  .user-menu-item:focus { background: #e2e8f0; outline: none; }
  .user-menu-item-logout { color: #b91c1c; }
  .user-menu-item-logout:hover { background: #fef2f2; }

  /* ----------------------------------------------------------- WALLET BADGE (brand roles) */
  /* Green pill, readable against the page backdrop. Hidden entirely when
     the rail is collapsed -- see 03-sidebar.css. */
  #wallet-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: #d1fae5; color: #047857;
    padding: 4px 10px; border-radius: 8px; font-size: 12px;
    cursor: pointer; transition: background .15s;
    border: 1px solid rgba(16,185,129,0.35);
  }
  #wallet-badge:hover { background: #a7f3d0; }
  #wallet-badge .wb-label { color: #047857; font-size: 11px; font-weight: 600; }
  #wallet-badge .wb-amount { color: #065f46; font-weight: 700; font-size: 13px; }
  #wallet-badge select.wb-select {
    background: transparent; color: #047857; border: 0; outline: none;
    font-size: 11px; cursor: pointer; padding: 0; font-weight: 600;
  }
  #wallet-badge select.wb-select option { color: #0f172a; background: white; }

  /* ---------------------------------------------------------------- WS DOT */
  /* Now positioned as a small status indicator at the bottom-right of the
     avatar inside the user pill. Green when realtime websocket is connected,
     gray when polling. The label text is kept in the DOM (04-realtime.js
     writes "realtime"/"polling" into .ws-label) but visually hidden — its
     content is still useful for accessibility tools and as a hover tooltip. */
  .ws-status {
    position: absolute; bottom: -1px; right: -1px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #94a3b8; border: 2px solid white;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s;
  }
  .ws-status .ws-dot { display: none; }   /* dot becomes the whole circle */
  .ws-status .ws-label {
    /* Visually hidden but accessible — see realtime.js text update */
    position: absolute; width: 1px; height: 1px; padding: 0;
    margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
    border: 0;
  }
  .ws-status.online { background: #10b981; box-shadow: 0 0 0 2px white, 0 0 6px rgba(16,185,129,0.55); }
