/* RASP Vault admin interface.
   Bootstrap does the heavy lifting; this adds only what the product needs. */

/* The palette is the one CRM Certifications uses, so the two products read as
   one family: navy chrome, a blue that carries 6:1 on white, teal for quiet
   accents, amber reserved for focus. */
:root {
  --rv-navy: #0f2a55;
  --rv-navy-2: #16396f;
  --rv-blue: #1f5eb8;
  --rv-blue-hover: #174a92;
  --rv-blue-active: #123c78;
  --rv-teal: #0e7c6b;
  --rv-amber: #fbbf24;
  --rv-focus: #f59e0b;
  --rv-ink: #1b2536;
  --rv-muted: #56627a;
  --rv-surface: #f5f7fb;
  --rv-border: #dde3ee;
  --rv-radius: 0.75rem;
  /* The brand mark's own colour, which is not part of the interface palette:
     the deep orange reads on white, the light one on the navy bar. */
  --rv-brand: #d4541a;
  --rv-brand-on-dark: #ff9d5c;

  --bs-primary: var(--rv-blue);
  --bs-primary-rgb: 31, 94, 184;
  --bs-link-color: var(--rv-blue);
  --bs-link-color-rgb: 31, 94, 184;
  --bs-link-hover-color: var(--rv-blue-hover);
  --bs-body-color: var(--rv-ink);
  --bs-secondary-color: var(--rv-muted);
  --bs-border-radius: 0.5rem;
}

body {
  background: var(--rv-surface);
  color: var(--rv-ink);
  min-height: 100vh;
}

.text-muted, .text-body-secondary, .text-secondary { color: var(--rv-muted) !important; }

/* One visible focus treatment everywhere, amber against every surface here. */
:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--rv-focus) !important;
  outline-offset: 2px;
  box-shadow: none;
}

.btn-primary {
  --bs-btn-bg: var(--rv-blue);
  --bs-btn-border-color: var(--rv-blue);
  --bs-btn-hover-bg: var(--rv-blue-hover);
  --bs-btn-hover-border-color: var(--rv-blue-hover);
  --bs-btn-active-bg: var(--rv-blue-active);
  --bs-btn-active-border-color: var(--rv-blue-active);
  --bs-btn-disabled-bg: #6f8fc2;
  --bs-btn-disabled-border-color: #6f8fc2;
}
.btn-outline-primary {
  --bs-btn-color: var(--rv-blue);
  --bs-btn-border-color: var(--rv-blue);
  --bs-btn-hover-bg: var(--rv-blue);
  --bs-btn-hover-border-color: var(--rv-blue);
  --bs-btn-active-bg: var(--rv-blue-hover);
}
/* Bootstrap's own #6c757d is only about 4.4:1 on this surface. */
.btn-outline-secondary {
  --bs-btn-color: #4a5568;
  --bs-btn-border-color: #8a94a6;
  --bs-btn-hover-bg: #4a5568;
  --bs-btn-hover-border-color: #4a5568;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #3b4452;
  --bs-btn-active-border-color: #3b4452;
}

/* A card is a bordered sheet with a thin accent along its top edge. */
.card {
  border: 1px solid var(--rv-border);
  border-top: 3px solid var(--rv-blue);
  border-radius: var(--rv-radius);
  box-shadow: 0 1px 2px rgba(15, 42, 85, 0.04);
}
.modal-content { border: 1px solid var(--rv-border); border-radius: var(--rv-radius); }
.form-label { font-weight: 600; }
.form-text { color: var(--rv-muted); }

main.rv-main { padding: 1.75rem 0 4rem; }

/* Sign-in and set-password sit alone on the page, without the app chrome. */
.rv-centred {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}
.rv-card-narrow { width: 100%; max-width: 25rem; }

.rv-page-title { font-weight: 600; letter-spacing: -0.01em; }

/* Figures line up in columns; proportional digits make them hard to compare. */
.rv-num { font-variant-numeric: tabular-nums; }

.rv-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
}

/* A wide table scrolls inside its own container rather than the page. */
.rv-scroll { overflow-x: auto; }
/* Long lists scroll inside their card rather than stretching the page. */
.rv-scroll-mid { max-height: 28rem; overflow-y: auto; }
.rv-scroll-tall { max-height: 36rem; overflow-y: auto; }
/* Error text in a table cell wraps inside a readable width. */
.rv-wrap-narrow { max-width: 18rem; white-space: normal; }
.rv-wrap-wide { max-width: 36rem; white-space: normal; }

/* One accent per card: the summary tiles wear theirs on the left, so they
   drop the top edge the other cards carry. */
.rv-stat { border-top: 1px solid var(--rv-border); border-left: 3px solid var(--rv-teal); }
.rv-stat .rv-stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1.1; }
.rv-stat .rv-stat-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* A secret is shown once. The styling should make that feel deliberate. */
.rv-secret {
  word-break: break-all;
  background: #fff8e1;
  border: 1px solid #ffe08a;
}

/* Log severity reads at a glance without depending on colour alone. */
.rv-log-error { border-left: 3px solid #dc3545; }
.rv-log-warn  { border-left: 3px solid #fd7e14; }
.rv-log-info  { border-left: 3px solid #6c757d; }
.rv-log-debug { border-left: 3px solid #adb5bd; }

.rv-empty { color: #6c757d; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── App chrome: a blue top bar, and a vertical menu down the left ───── */
.rv-app {
  --rv-topbar-h: 3.5rem;
  --rv-sidebar-w: 14rem;
  /* Room for the fixed top bar, which is out of the page's flow. */
  padding-top: var(--rv-topbar-h);
}

/* Reachable by keyboard from the first Tab, and out of the way otherwise. */
.rv-skip {
  position: fixed;
  top: -4rem;
  left: 0.75rem;
  z-index: 2100;
  padding: 0.6rem 1rem;
  border-radius: 0.375rem;
  background: #fff;
  color: #212529;
  font-weight: 600;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
  transition: top 0.15s ease;
}
.rv-skip:focus { top: 0.75rem; }

.rv-topbar {
  /* Fixed, not sticky: the bar's wrapper is only as tall as the bar, and a
     sticky element cannot travel further than its own parent's box — so it
     scrolled away with the page. */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--rv-topbar-h);
  padding: 0 1rem 0 0.5rem;
  background-color: var(--rv-navy);
  color: #fff;
}
.rv-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: #fff;
}
.rv-nav-toggle:hover { background: rgba(255, 255, 255, 0.15); }
.rv-nav-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rv-brand { color: var(--rv-brand-on-dark); font-weight: 700; font-size: 1.125rem; text-decoration: none; }
.rv-brand:hover { color: var(--rv-brand-on-dark); }
.rv-topbar-end { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.rv-navbar-user { color: rgba(255, 255, 255, 0.85); }

.rv-sidebar {
  position: fixed;
  top: var(--rv-topbar-h);
  bottom: 0;
  left: 0;
  z-index: 1020;
  width: var(--rv-sidebar-w);
  /* The full height of the window below the top bar, whatever the page's
     length; the menu scrolls inside it when the window is short. */
  height: calc(100vh - var(--rv-topbar-h));
  height: calc(100dvh - var(--rv-topbar-h));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  background: #fff;
  border-right: 1px solid var(--rv-border);
  transition: transform 0.2s ease;
}
/* Pushed to the bottom when there is room; after the menu when there is not. */
.rv-sidebar-foot {
  margin: auto 0 0;
  padding: 1rem 0.75rem 0.25rem;
  border-top: 1px solid var(--rv-border);
  font-size: 0.8125rem;
  color: var(--rv-muted);
}
.rv-sidebar-foot a { color: var(--rv-blue); text-decoration: none; font-weight: 600; }
.rv-sidebar-foot a:hover { text-decoration: underline; }
.rv-sidenav { flex: 0 0 auto; gap: 0.125rem; }
.rv-sidenav .nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--rv-ink);
}
.rv-sidenav .nav-link:hover { background: #eef2f8; color: var(--rv-navy); }
.rv-sidenav .nav-link.active { background: var(--rv-navy); color: #fff; font-weight: 600; }
.rv-external { font-size: 0.8em; opacity: 0.7; }

.rv-app main.rv-main { margin-left: var(--rv-sidebar-w); transition: margin-left 0.2s ease; }

/* Collapsed on a wide screen: the menu slides away and the page takes its room. */
.rv-nav-collapsed .rv-sidebar { transform: translateX(-100%); }
.rv-nav-collapsed main.rv-main { margin-left: 0; }

.rv-nav-scrim { display: none; }

/* Narrow screens: the menu is hidden until asked for, and slides over the page. */
@media (max-width: 991.98px) {
  .rv-app main.rv-main { margin-left: 0; }
  .rv-sidebar { transform: translateX(-100%); }
  .rv-nav-open .rv-sidebar { transform: none; box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15); }
  .rv-nav-open .rv-nav-scrim {
    display: block;
    position: fixed;
    inset: var(--rv-topbar-h) 0 0 0;
    z-index: 1010;
    background: rgba(0, 0, 0, 0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-sidebar, .rv-app main.rv-main { transition: none; }
}

/* ── Page-loading overlay ───────────────────────────────────────────── */
/* Shown from first paint, and again when a menu link is followed; hidden once
   the page has loaded. The delayed animation is a backstop: if a script fails
   to load, the page is uncovered after a few seconds rather than never. */
.rv-loading {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(246, 247, 249, 0.85);
  animation: rv-loading-backstop 0s linear 8s forwards;
  transition: opacity 0.15s ease, visibility 0.15s;
}
.rv-loading .spinner-border { width: 3rem; height: 3rem; }
.rv-loading.is-done { opacity: 0; visibility: hidden; pointer-events: none; animation: none; }
@keyframes rv-loading-backstop { to { opacity: 0; visibility: hidden; pointer-events: none; } }

/* ── Sign-in: a form column beside a promotional panel ───────────────── */
.rv-login-body { background: #fff; }
.rv-login { display: flex; min-height: 100vh; }
.rv-login-side {
  flex: 1 1 100%;
  /* Equal space above and below the form keeps it in the vertical middle;
     the footer sits in the lower space, at the bottom edge. */
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  padding: 1.5rem 1.25rem;
  background: #fff;
}
.rv-login-inner { grid-row: 2; width: 100%; max-width: 24rem; }
.rv-login-logo {
  display: flex; align-items: center; justify-content: center; gap: 0.65rem;
  margin-bottom: 1.75rem;
  font-size: 1.65rem; font-weight: 700; letter-spacing: -0.015em; color: var(--rv-brand);
}
.rv-login-mark { width: 2.6rem; height: 2.6rem; }
.rv-login-box {
  border: 1px solid var(--rv-border);
  border-radius: var(--rv-radius);
  padding: 1.5rem 1.5rem 1.1rem;
  background: #fff;
  box-shadow: 0 6px 24px rgba(15, 42, 85, 0.08);
}
.rv-login-label { display: block; margin: 0 0 0.3rem; font-size: 0.8125rem; font-weight: 600; color: var(--rv-ink); }
.rv-login-input { height: 2.5rem; margin-bottom: 1rem; border-color: var(--rv-border); border-radius: 0.5rem; }
.rv-login-input:focus { border-color: var(--rv-blue); box-shadow: 0 0 0 0.2rem rgba(31, 94, 184, 0.2); }
.rv-login-button { width: 100%; height: 2.75rem; margin-top: 0.25rem; border-radius: 0.5rem; font-size: 0.9375rem; font-weight: 600; }
.rv-login-remember { margin-top: 1rem; font-size: 0.8125rem; color: var(--rv-muted); }
/* Comfortable to hit on a phone: a 13px box and a one-line link are both
   under the 24px a finger needs. */
.rv-login-remember .form-check-input { width: 1.5rem; height: 1.5rem; margin-top: 0; }
.rv-login-remember .form-check-label { padding: 0.25rem 0; }
.rv-login-links { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--rv-border); font-size: 0.8125rem; }
.rv-login-links a { display: inline-block; padding: 0.3rem 0; color: var(--rv-blue); text-decoration: none; font-weight: 600; }
.rv-login-links a:hover, .rv-login-links a:focus-visible { text-decoration: underline; }
.rv-login-footer { grid-row: 3; align-self: end; margin: 0; padding-top: 2rem; text-align: center; font-size: 0.75rem; color: var(--rv-muted); }
.rv-login-footer a { display: inline-block; padding: 0.35rem 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.rv-login-footer a:hover, .rv-login-footer a:focus-visible { color: var(--rv-navy); }

.rv-login-promo {
  display: none;
  position: relative;
  overflow: hidden;
  color: #fff;
  background: radial-gradient(120% 90% at 10% 0%, #1b5a8c 0%, var(--rv-navy-2) 45%, var(--rv-navy) 100%);
}
.rv-login-promo-inner { position: relative; z-index: 1; max-width: 34rem; padding: 3rem 4rem; }
.rv-login-promo .rv-login-eyebrow { margin-bottom: 0.75rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #7fd8c8; }
.rv-login-promo h2 { margin-bottom: 1rem; font-size: 2.35rem; font-weight: 700; line-height: 1.15; text-wrap: balance; }
.rv-login-promo p { max-width: 28rem; font-size: 1.0625rem; line-height: 1.55; color: #d6e0f0; }
/* What the product does, each line ticked off, as on the other product's
   sign-in. The tick is drawn in CSS: no icon font travels with this page. */
.rv-login-points { max-width: 30rem; margin: 0 0 1.25rem; padding: 0; list-style: none; color: #e6edf8; }
.rv-login-points li { position: relative; margin-bottom: 0.7rem; padding-left: 1.9rem; line-height: 1.5; }
.rv-login-points li:before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.45rem;
  width: 0.85rem;
  height: 0.45rem;
  border-left: 2px solid #5eead4;
  border-bottom: 2px solid #5eead4;
  transform: rotate(-45deg);
}
.rv-login-more { margin-top: 0.75rem; padding: 0.55rem 1.4rem; }
.rv-login-art { position: absolute; right: -2.5rem; bottom: -2.5rem; width: 24rem; max-width: 60%; opacity: 0.16; }

@media (min-width: 992px) {
  /* Promotional panel on the left, sign-in on the right. The form stays first
     in the markup, so keyboard and screen-reader order still starts with it. */
  .rv-login { flex-direction: row-reverse; }
  .rv-login-side { flex: 0 0 42%; }
  .rv-login-promo { flex: 1 1 58%; display: flex; align-items: center; }
}

/* Every popup sits in the vertical middle of the window — including any added
   later, so nobody has to remember a class. This is what Bootstrap's
   .modal-dialog-centered does; a popup taller than the window still starts at
   the top margin and scrolls. */
.modal-dialog{display:flex;align-items:center;min-height:calc(100% - var(--bs-modal-margin) * 2)}

/* ── Card and dialog headers ────────────────────────────────────────── */
/* The quiet surface tone of the palette, with a hairline below it, on cards
   and dialogs alike — the colour belongs to the accent edge and the buttons,
   not to every bar on the page. */
.card-header.rv-card-head,
.modal-header.rv-modal-head {
  background-color: var(--rv-surface);
  border-bottom: 1px solid var(--rv-border);
  color: var(--rv-ink);
}
.rv-modal-head .modal-title { color: var(--rv-navy); font-weight: 600; }

/* ── Restore ────────────────────────────────────────────────────────── */
.rv-select-wide { max-width: 28rem; }
/* The four choices wear the same tile as an object in the picker: a bordered
   sheet that brightens under the pointer and turns blue when it is the one
   chosen. */
.rv-kind {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  height: 100%;
  padding: 0.875rem 1rem;
  text-align: left;
  color: var(--rv-ink);
  background: #fff;
  border: 1px solid var(--rv-border);
  border-radius: 0.5rem;
}
.rv-kind:hover { color: var(--rv-ink); background: #fff; border-color: #9db6de; }
.btn-check:checked + .rv-kind,
.btn-check:checked + .rv-kind:hover,
.btn-check:active + .rv-kind {
  background-color: #f0f5fd;
  border-color: var(--rv-blue);
  color: var(--rv-ink);
}
.btn-check:checked + .rv-kind .rv-kind-title { color: var(--rv-navy); }
.btn-check:focus-visible + .rv-kind { outline: 3px solid var(--rv-focus); outline-offset: 2px; box-shadow: none; }
.rv-kind-title { font-weight: 600; }
.rv-kind-text { font-size: 0.8125rem; color: var(--rv-muted); }
/* The panels the wizard opens below the choice share the tile's surface. */
.rv-children { background: var(--rv-surface) !important; border-color: var(--rv-border) !important; border-radius: 0.5rem !important; }
.rv-pick-cell { width: 2.25rem; }
.rv-chip { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 500; color: #212529; }
.rv-chip-close { width: 0.5rem; height: 0.5rem; padding: 0.25rem; }
.rv-children { padding: 0.75rem 1rem; border: 1px solid #dee2e6; border-radius: 0.375rem; background: #f8fafc; }
.rv-w-0 { width: 0; }
#progress-bar-wrap { height: 1.25rem; }
.rv-count { padding: 0.5rem 0.75rem; border: 1px solid #e9ecef; border-radius: 0.375rem; background: #fff; }
.rv-count-value { font-size: 1.375rem; font-weight: 600; line-height: 1.2; }


/* The object picker: three columns of checkboxes that stay readable on a
   phone, in a list tall enough to scroll inside the modal rather than
   stretching it past the screen. */
/* Three columns as a grid rather than as multi-column text: an org with
   hundreds of objects has to scroll down, and a multi-column box given a
   height grows sideways instead, which is the one direction a list must never
   go. Bounding the list here — rather than letting the modal's own body
   scroll — also keeps the search box, the note and the buttons in place while
   the names move. */
.rv-objects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 1.5rem;
  align-content: start;
  /* What is left of the window once the dialog's own furniture is accounted
     for — header, search row, note, tabs, footer and margins, about 29rem of
     it. A flex chain would be tidier, but a modal whose height comes from
     max-height does not re-shrink its children, so the measurement is made
     here instead. */
  min-height: 8rem;
  max-height: calc(100vh - 34rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.5rem;
}
/* Select all and Deselect all sit over the list they act on, as links at the
   right: they are quick actions, not the dialog's main buttons. */
.rv-pick-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}
.rv-pick-actions .btn-link { font-weight: 600; text-decoration: none; }
.rv-pick-actions .btn-link:hover, .rv-pick-actions .btn-link:focus-visible { text-decoration: underline; }

/* Each object is its own bordered tile, so the name, what it is and its
   checkbox read as one thing to click rather than as a column of ticks. */
.rv-objects .form-check {
  margin-bottom: 0;
  min-width: 0;
}
.rv-object {
  padding: 0.6rem 0.75rem 0.6rem 2.25rem;
  border: 1px solid var(--rv-border);
  border-radius: 0.5rem;
  background: #fff;
}
.rv-object .form-check-input { margin-left: -1.5rem; margin-top: 0.3rem; }
.rv-object:hover { border-color: #9db6de; }
.rv-object.selected { border-color: var(--rv-blue); background: var(--rv-surface); }
.rv-object-blocked { background: var(--rv-surface); }
.rv-object-blocked:hover { border-color: var(--rv-border); }
.rv-object .form-check-label { cursor: pointer; }
.rv-object-blocked .form-check-label { cursor: default; }
.rv-objects .rv-object-name {
  display: block;
  overflow-wrap: anywhere;
}
@media (max-width: 991px) { .rv-objects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) {
  /* One column, and the note takes more lines on a narrow screen. */
  .rv-objects { grid-template-columns: 1fr; max-height: calc(100vh - 44rem); min-height: 8rem; }
}

/* Health check: the name and the verdict keep their own columns so the
   detail, which varies most in length, takes the space that is left. */
.rv-health-name { width: 16rem; font-weight: 600; }
.rv-health-status { width: 6rem; }
@media (max-width: 767px) { .rv-health-name { width: auto; } }

/* The connected org's details: three columns of label/value pairs, the label
   narrow and quiet, the value taking the rest, each pair on one line so forty
   facts read as a reference card rather than a form. */
.rv-org-list {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr);
  column-gap: 0.75rem;
  row-gap: 0.3rem;
  font-size: 0.875rem;
}
.rv-org-list dt { color: var(--rv-muted); font-weight: 500; }
.rv-org-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* A small button with an icon before its word: the two line up on the text's
   middle, and keep a hair of space between them. */
.rv-icon-btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.rv-icon-btn svg { flex: 0 0 auto; }

/* The three groups of org facts are cards within the card: a plain hairline
   all round, no second accent edge, and a quieter header than the outer one. */
.rv-org-card { border-top-width: 1px; border-top-color: var(--rv-border); border-radius: 0.5rem; box-shadow: none; }
.rv-org-card .card-header { padding: 0.6rem 1rem; }
.rv-org-card .card-header h3 { color: var(--rv-navy); font-size: 0.9rem; }
.rv-org-card .card-body { padding: 0.9rem 1rem; }

/* Tabs set into a card header, as Bootstrap's card-header-tabs intends: the
   active tab joins the body below it. */
.rv-card-head .card-header-tabs .nav-link { color: var(--rv-ink); }
.rv-card-head .card-header-tabs .nav-link.active { color: var(--rv-navy); background: #fff; border-bottom-color: #fff; }
