/* ── RBAC / Settings (Components/Pages/Administration) ──────────────────
   Global on purpose, like onboarding.css: these classes are shared by
   every Settings screen and by the Telerik windows those screens open,
   and scoped .razor.css cannot reach into a TelerikWindow's markup.
   Bump the ?v= on the link in App.razor after editing. */

.rb-note { display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--surface-border); background: color-mix(in srgb, var(--brand-pink) 6%, var(--surface-card-bg)); color: var(--surface-text-muted); font-size: .84rem; line-height: 1.5; }
.rb-note i { color: var(--brand-pink); margin-top: 2px; }
.rb-note b { color: var(--surface-text); }
.rb-sub { font-size: .76rem; }

.rb-callout { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--surface-border); border-left: 3px solid var(--brand-pink); background: var(--surface-card-bg); font-size: .88rem; }
.rb-callout i { font-size: 1.1rem; color: var(--brand-pink); }
.rb-callout > span { flex: 1; }
.rb-callout-key { border-left-color: #e0a800; }
.rb-callout-key i { color: #e0a800; }

.rb-identity { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-radius: 14px; border: 1px solid var(--surface-border); background: var(--surface-card-bg); flex-wrap: wrap; }
.rb-identity-avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--brand-pink); color: #fff; font-family: "Space Grotesk", sans-serif; font-size: 1.15rem; font-weight: 700; }
.rb-identity-body { display: flex; flex-direction: column; gap: 5px; }
.rb-identity-name { font-weight: 700; font-size: 1rem; color: var(--surface-text); }
.rb-identity-meta { display: flex; align-items: center; gap: 8px; font-size: .8rem; flex-wrap: wrap; }
.rb-identity-scope { margin-left: auto; font-size: .83rem; color: var(--surface-text-muted); display: flex; align-items: center; gap: 8px; }
.rb-identity-scope i { color: var(--brand-pink); }

/* Tier, capacity, risk and status pills — all built on .ob-pill. */
.ob-pill.rb-tier-super { background: color-mix(in srgb, #7b1fa2 20%, transparent); color: #ba68c8; }
.ob-pill.rb-tier-group { background: color-mix(in srgb, #1565c0 20%, transparent); color: #64b5f6; }
.ob-pill.rb-tier-user { background: color-mix(in srgb, var(--surface-text) 12%, transparent); color: var(--surface-text-muted); }
.ob-pill.rb-pill-maker { background: color-mix(in srgb, #1565c0 20%, transparent); color: #64b5f6; }
.ob-pill.rb-pill-check1 { background: color-mix(in srgb, #2e7d32 20%, transparent); color: #66bb6a; }
.ob-pill.rb-pill-check2 { background: color-mix(in srgb, #6a1b9a 20%, transparent); color: #ba68c8; }
.ob-pill.rb-pill-viewer { background: color-mix(in srgb, var(--surface-text) 12%, transparent); color: var(--surface-text-muted); }
.ob-pill.rb-risk-low { background: color-mix(in srgb, #2e7d32 18%, transparent); color: #66bb6a; }
.ob-pill.rb-risk-medium { background: color-mix(in srgb, #f9a825 20%, transparent); color: #ffca28; }
.ob-pill.rb-risk-high { background: color-mix(in srgb, #ef6c00 22%, transparent); color: #ffa726; }
.ob-pill.rb-risk-critical { background: color-mix(in srgb, #c62828 22%, transparent); color: #ef5350; }
.ob-pill.rb-status-ok { background: color-mix(in srgb, #2e7d32 22%, transparent); color: #66bb6a; }
.ob-pill.rb-status-bad { background: color-mix(in srgb, #c62828 22%, transparent); color: #ef5350; }
.ob-pill.rb-status-pending { background: color-mix(in srgb, #f9a825 22%, transparent); color: #ffca28; }

.rb-filter { min-width: 230px; }
.rb-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .8rem; color: var(--surface-text-muted); padding: 10px 14px; border-radius: 10px; border: 1px dashed var(--surface-border); }
.rb-legend b { color: var(--surface-text); font-family: ui-monospace, monospace; }
.rb-legend-inline { border: none; padding: 0; gap: 6px; }

.rb-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.rb-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 16px; border-radius: 12px; border: 1px solid var(--surface-border); background: var(--surface-card-bg); color: var(--surface-text); text-align: left; cursor: pointer; transition: all .15s ease; }
.rb-tile:hover { border-color: var(--brand-pink); transform: translateY(-1px); }
.rb-tile i { font-size: 1.25rem; color: var(--brand-pink); }
.rb-tile-title { font-weight: 700; font-size: .92rem; }
.rb-tile-text { font-size: .78rem; color: var(--surface-text-muted); line-height: 1.45; }

.rb-split { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
.rb-card { border: 1px solid var(--surface-border); border-radius: 14px; background: var(--surface-card-bg); padding: 16px 18px; display: flex; flex-direction: column; gap: 13px; }
.rb-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rb-card-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.rb-card-head > span { font-size: .78rem; }
.rb-subhead { margin: 6px 0 0; font-size: .9rem; font-weight: 700; color: var(--surface-text); }

.rb-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Telerik 2.24's TextArea has no Rows parameter (it only exposes AutoSize),
   so the visible height is set here — same approach as .chat-textarea. */
.rb-textarea textarea { min-height: 68px; resize: vertical; }

/* Permission picker — role permissions and per-user privileges share it. */
.rb-picker { display: flex; flex-direction: column; gap: 13px; }
.rb-picker-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rb-picker-actions { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.rb-picker-list { max-height: 46vh; overflow: auto; border: 1px solid var(--surface-border); border-radius: 12px; }
.rb-picker-table { min-width: 0; }
.rb-picker-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-card-bg); }
.rb-row-on { background: color-mix(in srgb, var(--brand-pink) 5%, transparent); }
.rb-picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rb-inline-check { display: flex; align-items: center; gap: 9px; font-size: .8rem; color: var(--surface-text-muted); max-width: 480px; line-height: 1.45; }

.rb-capacity { display: inline-flex; gap: 4px; }
.rb-cap { padding: 4px 9px; border-radius: 999px; border: 1px solid var(--surface-border); background: transparent; color: var(--surface-text-muted); font-size: .72rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.rb-cap:hover { color: var(--surface-text); border-color: var(--brand-pink); }
.rb-cap.on { border-color: transparent; }

/* Approval pipeline strip: maker → check 1 → check 2. */
.rb-pipeline { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rb-step { padding: 3px 8px; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.rb-step.on { background: color-mix(in srgb, #1565c0 20%, transparent); color: #64b5f6; }
.rb-step.done { background: color-mix(in srgb, #2e7d32 20%, transparent); color: #66bb6a; }
.rb-step.off { background: color-mix(in srgb, var(--surface-text) 8%, transparent); color: var(--surface-text-muted); }

/* Approval request detail + audit trail */
.rb-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 18px; }
.rb-detail-grid > div { display: flex; flex-direction: column; gap: 3px; }
.rb-detail-label { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--surface-text-muted); }
.rb-detail-grid .ob-pill { align-self: flex-start; }

.rb-timeline { list-style: none; margin: 0; padding: 0 0 0 6px; display: flex; flex-direction: column; gap: 14px; }
.rb-timeline > li { display: flex; gap: 12px; }
.rb-timeline-dot { width: 11px; height: 11px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; background: var(--surface-text-muted); }
.rb-timeline-dot.rb-status-ok { background: #66bb6a; }
.rb-timeline-dot.rb-status-bad { background: #ef5350; }
.rb-timeline-dot.rb-status-pending { background: #ffca28; }
.rb-timeline-body { display: flex; flex-direction: column; gap: 3px; font-size: .82rem; }
.rb-timeline-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.rb-timeline-comment { color: var(--surface-text); font-style: italic; }

/* Matrix — both the header row and the operation column stay put. */
.rb-matrix-wrap { max-height: 68vh; overflow: auto; }
.rb-matrix { min-width: 900px; }
.rb-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-card-bg); }
.rb-matrix-sticky { position: sticky; left: 0; z-index: 1; background: var(--surface-card-bg); }
.rb-matrix thead .rb-matrix-sticky { z-index: 3; }
.rb-matrix-role { min-width: 130px; }
.rb-matrix-role > span { display: block; }
.rb-matrix-role-dept { font-size: .64rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--surface-text-muted); }
.rb-matrix-cell { text-align: center; }
.rb-matrix-none { color: color-mix(in srgb, var(--surface-text) 25%, transparent); }

/* System configuration */
.rb-config-list { display: flex; flex-direction: column; }
.rb-config-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--surface-border); }
.rb-config-row:last-child { border-bottom: none; }
.rb-config-text { display: flex; flex-direction: column; gap: 3px; }
.rb-config-desc { font-size: .87rem; color: var(--surface-text); }
.rb-config-input { display: flex; align-items: center; gap: 8px; }

.rb-switch { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; border: 1px solid var(--surface-border); background: var(--surface-card-bg); color: var(--surface-text-muted); font-size: .78rem; font-weight: 600; cursor: pointer; }
.rb-switch-knob { width: 30px; height: 16px; border-radius: 999px; background: color-mix(in srgb, var(--surface-text) 18%, transparent); position: relative; transition: background .15s ease; }
.rb-switch-knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.rb-switch.on { border-color: var(--brand-pink); color: var(--surface-text); }
.rb-switch.on .rb-switch-knob { background: var(--brand-pink); }
.rb-switch.on .rb-switch-knob::after { transform: translateX(14px); }
.rb-switch:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 1100px) {
    .rb-split { grid-template-columns: 1fr; }
    .rb-field-pair { grid-template-columns: 1fr; }
    .rb-identity-scope { margin-left: 0; }
}

/* ── Change Password (Components/Pages/ChangePassword.razor) ────────────
   One block serves both renderings: the ordinary Settings tab and the
   full-screen first-sign-in gate MainLayout puts up (.pw-page-gate). */

.pw-shell { display: flex; justify-content: center; }
.pw-card { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 16px; padding: 22px 24px; border: 1px solid var(--surface-border); border-radius: 16px; background: var(--surface-card-bg); }

/* .tl-page (onboarding.css) caps this element's width at 1180px but never
   centers it — fine for a left-aligned dashboard tab, wrong for a full-page
   gate with no sidebar, which left the card pinned near the left edge instead
   of centered on the viewport. margin:auto re-centers the capped box itself,
   independent of the flex centering already applied to its own content. */
.pw-page-gate { min-height: 100vh; width: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: center; padding: 40px 24px; box-sizing: border-box; }
.pw-page-gate .pw-card { padding: 32px 36px; gap: 20px; box-shadow: 0 22px 60px rgba(0, 0, 0, .18); }

.pw-gate-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.pw-gate-head h1 { margin: 0; font-size: 1.5rem; font-weight: 700; }
.pw-gate-head p { margin: 0; font-size: .87rem; line-height: 1.55; color: var(--surface-text-muted); max-width: 42ch; }
.pw-gate-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; background: color-mix(in srgb, var(--brand-pink) 16%, transparent); color: var(--brand-pink); }

.pw-identity { padding: 12px 14px; }

.pw-form { gap: 18px; }

/* Plain inputs rather than TelerikTextBox: the eye toggle has to live inside
   the same shell as the field, and the type flips between password/text. */
.pw-input { position: relative; display: flex; align-items: center; border: 1px solid var(--surface-border); border-radius: 10px; background: color-mix(in srgb, var(--surface-text) 3%, var(--surface-card-bg)); transition: border-color .15s ease, box-shadow .15s ease; }
.pw-input > i { flex: none; width: 40px; text-align: center; color: var(--surface-text-muted); font-size: .95rem; }
.pw-input input { flex: 1; min-width: 0; padding: 11px 12px 11px 0; border: 0; outline: 0; background: transparent; color: var(--surface-text); font-size: .92rem; font-family: inherit; }
.pw-input input::placeholder { color: var(--surface-text-muted); opacity: .7; }
.pw-input:focus-within { border-color: var(--brand-pink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-pink) 16%, transparent); }
.pw-input.ok { border-color: #2e7d32; }
.pw-input.bad { border-color: #c62828; }

.pw-eye { flex: none; width: 42px; height: 100%; padding: 0; border: 0; background: transparent; color: var(--surface-text-muted); cursor: pointer; font-size: .95rem; }
.pw-eye:hover { color: var(--brand-pink); }

.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.pw-meter-track { flex: 1; display: flex; gap: 5px; }
.pw-meter-seg { flex: 1; height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--surface-text) 12%, transparent); transition: background-color .18s ease; }
.pw-meter-seg.pw-weak { background: #ef5350; }
.pw-meter-seg.pw-fair { background: #ffa726; }
.pw-meter-seg.pw-good { background: #42a5f5; }
.pw-meter-seg.pw-strong { background: #66bb6a; }
.pw-meter-label { flex: none; min-width: 52px; text-align: right; font-size: .74rem; font-weight: 700; color: var(--surface-text-muted); }
.pw-meter-label.pw-weak { color: #ef5350; }
.pw-meter-label.pw-fair { color: #ffa726; }
.pw-meter-label.pw-good { color: #42a5f5; }
.pw-meter-label.pw-strong { color: #66bb6a; }

.pw-rules { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 16px; }
.pw-rules li { display: flex; align-items: center; gap: 8px; font-size: .79rem; color: var(--surface-text-muted); transition: color .15s ease; }
.pw-rules li i { font-size: .85rem; opacity: .55; }
.pw-rules li.met { color: var(--surface-text); }
.pw-rules li.met i { color: #66bb6a; opacity: 1; }

.pw-hint { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: .78rem; }
.pw-hint.ok { color: #66bb6a; }
.pw-hint.bad { color: #ef5350; }

.pw-actions { justify-content: flex-end; }
.pw-actions .ob-btn-primary { min-width: 200px; justify-content: center; }

.pw-spinner { width: .95rem; height: .95rem; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: pw-spin .7s linear infinite; }

@keyframes pw-spin { to { transform: rotate(360deg); } }

.pw-done { display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; padding: 12px 0 4px; }
.pw-done-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: color-mix(in srgb, #2e7d32 22%, transparent); color: #66bb6a; font-size: 1.6rem; }
.pw-done h3 { margin: 0; font-size: 1.12rem; font-weight: 700; }
.pw-done p { margin: 0; font-size: .86rem; line-height: 1.55; color: var(--surface-text-muted); max-width: 44ch; }
.pw-done-actions { justify-content: center; margin-top: 6px; }

.pw-foot { display: flex; align-items: flex-start; gap: 8px; padding-top: 14px; border-top: 1px solid var(--surface-border); font-size: .76rem; line-height: 1.5; color: var(--surface-text-muted); }
.pw-foot i { color: var(--brand-pink); margin-top: 2px; }

/* ── Cashier till (User Accounts + Posting Manager) ─────────────────── */
.ob-pill.rb-till-on { background: color-mix(in srgb, #00838f 22%, transparent); color: #4dd0e1; }
.ob-pill.rb-till-off { background: color-mix(in srgb, var(--surface-text) 12%, transparent); color: var(--surface-text-muted); }

/* ── Per-user approval limits (User Accounts > Limits) ───────────────────
   Each mode is styled twice on purpose: as a pill in the "In effect"
   column, and as the selected .rb-cap button that sets it, which does not
   carry .ob-pill. Red for "Always checked" is not a warning — it is the
   strictest setting, and the colours run loose→strict left to right. */
.ob-pill.rb-limit-default, .rb-cap.on.rb-limit-default { background: color-mix(in srgb, var(--surface-text) 12%, transparent); color: var(--surface-text-muted); }
.ob-pill.rb-limit-exempt, .rb-cap.on.rb-limit-exempt { background: color-mix(in srgb, #2e7d32 20%, transparent); color: #66bb6a; }
.ob-pill.rb-limit-own, .rb-cap.on.rb-limit-own { background: color-mix(in srgb, #1565c0 20%, transparent); color: #64b5f6; }
.ob-pill.rb-limit-always, .rb-cap.on.rb-limit-always { background: color-mix(in srgb, #c62828 20%, transparent); color: #ef5350; }

.rb-limit-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-limit-fields label { font-size: .72rem; font-weight: 600; color: var(--surface-text-muted); white-space: nowrap; }
