/* users.css — the الحسابات screen. Same dark theme variables as style.css
   (--bg/--panel/--card/--line/--text/--dim/--accent/--amber/--green/--red);
   nothing here is defined twice, and no rule outside #view-users / .u-must so
   this file can never restyle the review UI. */

#view-users {
  padding: 18px 22px 60px;
  overflow: auto;
  display: block;
}

.u-head h2 { margin: 0; font-size: 19px; font-weight: 600; }
.u-head .u-sub { margin: 4px 0 0; font-size: 13px; color: var(--dim); max-width: 70ch; }
.u-bar { display: flex; align-items: center; gap: 12px; margin: 12px 0 6px; }
.u-count { font-size: 13px; color: var(--dim); }

.u-btn {
  font: inherit; font-size: 13px; cursor: pointer;
  color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 14px;
}
.u-btn:hover { border-color: var(--accent); }
.u-btn[disabled] { opacity: .5; cursor: default; }
.u-btn.u-small { font-size: 12px; padding: 3px 10px; }
.u-btn.u-primary { background: #1d2c40; border-color: var(--accent); }
.u-btn.danger { color: var(--red); border-color: rgba(229, 72, 77, .5); }
.u-btn.danger:hover { border-color: var(--red); background: rgba(229, 72, 77, .1); }

.u-note {
  margin: 10px 0; padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--dim);
}
.u-note.bad { color: var(--red); border-color: rgba(229, 72, 77, .5); }
.u-empty { color: var(--dim); padding: 28px; text-align: center; }

/* ---- the table ---- */
.u-tablewrap { margin-top: 8px; overflow-x: auto; }
.u-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.u-table th {
  text-align: start; font-size: 12px; font-weight: 600; color: var(--dim);
  padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.u-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.u-row.off { opacity: .55; }
.u-row.me td { background: rgba(77, 171, 247, .06); }
.u-name { font-weight: 600; }
.u-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.u-dim { color: var(--dim); font-size: 13px; white-space: nowrap; }
.u-on { color: var(--green); font-size: 13px; }
.u-offtxt { color: var(--red); font-size: 13px; }

.u-chip {
  display: inline-block; margin-inline-end: 5px;
  font-size: 11px; padding: 1px 8px; border-radius: 8px; white-space: nowrap;
  color: var(--accent); background: rgba(77, 171, 247, .12);
  border: 1px solid rgba(77, 171, 247, .45);
}
.u-chip.admin {
  color: var(--amber); background: rgba(240, 180, 41, .12);
  border-color: rgba(240, 180, 41, .5);
}
.u-you {
  margin-inline-start: 6px; font-size: 11px; padding: 1px 7px; border-radius: 8px;
  color: var(--green); border: 1px solid rgba(47, 191, 113, .5);
}
.u-flag {
  margin-inline-start: 6px; font-size: 11px; color: var(--amber);
}
.u-actions { white-space: nowrap; }
.u-actions .u-btn { margin-inline-start: 5px; }

/* ---- inline editors (roles / password / confirm) ---- */
.u-editrow td { background: var(--panel); }
.u-editor { padding: 4px 2px 8px; }
.u-editform, .u-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.u-editform h4 { margin: 0; width: 100%; font-size: 13px; font-weight: 600; }
.u-confirm span { font-size: 13px; }
.u-hint { margin: 0; width: 100%; font-size: 12px; color: var(--dim); }
.u-err { margin: 0; width: 100%; font-size: 12px; color: var(--red); }
.u-ok { margin: 0; width: 100%; font-size: 12px; color: var(--green); }

/* the gap BETWEEN pickers is wider than the gap inside one, so a tick can
   never look like it belongs to the neighbouring label */
.u-roles-pick { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.u-rolebox, .u-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.u-rolebox.u-locked { color: var(--dim); cursor: default; }
.u-check { margin-top: 4px; }
.u-card > .u-check { display: flex; margin-top: 16px; }
/* a definite width is what lets the auto margin push it to the RTL start;
   with width:auto a block-level button resolves both margins to zero */
.u-card > .u-btn { display: block; width: fit-content; margin-inline-end: auto; }

/* text boxes only — a checkbox must not inherit the 180px min-width, or the
   role pickers spread across the whole card */
.u-pwinput,
.u-field input[type="text"],
.u-field input[type="password"] {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; min-width: 180px;
}
.u-pwinput:focus, .u-field input:focus { outline: none; border-color: var(--accent); }
.u-rolebox input[type="checkbox"], .u-check input[type="checkbox"] {
  min-width: 0; width: auto; margin: 0; accent-color: var(--accent);
}

/* ---- new-user card ---- */
.u-card {
  margin-top: 22px; max-width: 760px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px;
}
.u-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
/* two columns at the card's width, so the password and its confirmation sit
   side by side on their own row instead of orphaning the confirm box */
.u-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px 16px;
}
.u-field { display: flex; flex-direction: column; gap: 4px; }
.u-field > label { font-size: 12px; color: var(--dim); }
.u-field-wide { margin-top: 14px; }
.u-card .u-err, .u-card .u-ok { margin-top: 10px; }
.u-card .u-btn { margin-top: 14px; }

/* ---- must-change-password banner (every role, not only admins) ---- */
.u-must {
  position: fixed; inset-block-end: 14px; inset-inline-start: 14px; z-index: 55;
  max-width: min(92vw, 460px);
  background: var(--panel); border: 1px solid rgba(240, 180, 41, .55);
  border-radius: 12px; padding: 10px 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .5);
  font-size: 13px;
}
.u-must-line { display: flex; align-items: center; gap: 10px; }
.u-must-line span { color: var(--amber); }
.u-must-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.u-must-form .u-pwinput { min-width: 140px; flex: 1 1 140px; }
