.staff-root{ max-width: 1400px; margin: 0 auto; padding: 28px 20px 80px; }

/* base.css locks body to height:100vh + overflow:hidden for the main
   CAD app, which manages its own internal-scrolling panels. The staff
   page is a plain scrolling page, so undo that here -- otherwise
   anything past one screen height (Board Backup, the footer) is
   clipped and unreachable, with no way to scroll down to it. Applies
   at every width -- this used to be gated to >=901px, which left
   narrower/mobile views stuck with the clipped, non-scrolling body. */
body.staff-page{ height: auto; min-height: 100vh; overflow: auto; }
  .staff-header{ display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
  .staff-header h1{ font-size: 20px; margin: 0 0 4px; color: var(--text); }
  .staff-sub{ color: var(--text-dim); font-size: 12.5px; margin: 0; }
  .staff-card{ background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
  .staff-card h2{ font-size: 14px; margin: 0 0 12px; color: var(--text); }
  .staff-denied{ text-align: center; padding: 60px 20px; color: var(--text-dim); font-size: 14px; }
  .staff-empty{ color: var(--text-faint); font-size: 12.5px; padding: 8px 0; }

  /* ---------- Two-column layout on wide screens: Chat Moderation as
     a tall main pane on the left, everything else stacked in a
     narrower sidebar on the right. Falls back to a single stacked
     column (original layout) below 1000px. ---------- */
  .staff-layout{ display: flex; flex-direction: column; }
  .staff-main{ display: flex; flex-direction: column; min-height: 0; }
  .staff-main .staff-card{
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    /* Gives the flexed chat list real room to grow into on the
       single-column (narrow) layout below, instead of shrink-wrapping
       to whatever height its rows happen to add up to. */
    min-height: 420px;
  }
  @media (min-width: 1000px){
    .staff-layout{
      display: grid;
      grid-template-columns: 1fr 360px;
      align-items: stretch;
      gap: 16px;
    }
    .staff-sidebar{ display: flex; flex-direction: column; }
    .staff-sidebar .staff-card:last-child{ margin-bottom: 0; }
  }

  .staff-online-list, .staff-chat-list{ display: flex; flex-direction: column; gap: 6px; }
  .staff-chat-list{
    /* Fills whatever height its flex-column parent card has, at every
       width, rather than being capped at a fixed 360px that left a
       gap under the last row on tall/stretched cards. */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
  }

  /* ---------- Custom scrollbars (matches the panel-body style used
     elsewhere in the app) ---------- */
  .staff-chat-list,
  body.staff-page{
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .staff-chat-list::-webkit-scrollbar,
  body.staff-page::-webkit-scrollbar{
    width: 9px;
  }
  .staff-chat-list::-webkit-scrollbar-track,
  body.staff-page::-webkit-scrollbar-track{
    background: transparent;
  }
  .staff-chat-list::-webkit-scrollbar-thumb{
    background-color: var(--border);
    border-radius: 20px;
    border: 2px solid var(--panel);
  }
  body.staff-page::-webkit-scrollbar-thumb{
    background-color: var(--border);
    border-radius: 20px;
    border: 2px solid var(--bg);
  }
  .staff-chat-list::-webkit-scrollbar-thumb:hover,
  body.staff-page::-webkit-scrollbar-thumb:hover{
    background-color: var(--text-faint);
  }
  .staff-online-row, .staff-chat-row{
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px; border: 1px solid var(--border-soft); border-radius: 7px; font-size: 12.5px;
  }
  .staff-avatar{ width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
  .staff-online-name{ flex: 1; color: var(--text); }
  .staff-badge{
    font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--st-onscene); border: 1px solid var(--st-onscene); border-radius: 4px; padding: 1px 4px; margin-left: 4px;
  }
  .dev-badge{ color: var(--priority5, #a78bfa); border-color: var(--priority5, #a78bfa); }
  .staff-kick-btn, .staff-delete-btn{
    background: transparent; border: 1px solid var(--priority1); color: var(--priority1);
    border-radius: 6px; padding: 3px 9px; font-size: 11.5px; cursor: pointer;
  }
  .staff-kick-btn:hover, .staff-delete-btn:hover{ background: rgba(229,72,77,0.1); }

  .staff-chat-meta{ font-weight: 700; color: var(--st-enroute); flex-shrink: 0; }
  .staff-chat-text{ flex: 1 1 auto; min-width: 0; color: var(--text); word-break: break-word; }

  .staff-status-grid{ display: flex; flex-direction: column; gap: 6px; }
  .staff-status-row{
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    padding: 7px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    background: var(--panel-alt);
  }
  .staff-status-row.status-ok{ border-color: var(--st-available); }
  .staff-status-row.status-bad{ border-color: var(--priority1); }

  /* ---------- ERLC rate limit ---------- */
  .staff-ratelimit-row{
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12.5px;
    margin-bottom: 8px;
  }
  .staff-ratelimit-updated{ color: var(--text-faint); font-size: 11px; }
  .staff-ratelimit-bar{
    height: 8px;
    border-radius: 4px;
    background: var(--border-soft);
    overflow: hidden;
  }
  .staff-ratelimit-fill{
    height: 100%;
    border-radius: 4px;
    transition: width .2s ease;
  }
  .staff-ratelimit-fill.level-ok{ background: var(--st-available); }
  .staff-ratelimit-fill.level-warn{ background: var(--priority3); }
  .staff-ratelimit-fill.level-bad{ background: var(--priority1); }

  /* ---------- Footer ---------- */
  .staff-footer{
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    text-align: center;
  }
  .staff-footer-credits{
    font-size: 11.5px;
    color: var(--text-faint);
  }

  .staff-quick-actions{ display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
  .staff-quick-actions .btn-ghost, .staff-quick-actions .staff-kick-btn{ width: 100%; text-align: center; }
  .staff-quick-actions .staff-kick-btn{ padding: 8px 14px; font-size: 12.5px; }