/*
 * The look of the Front. Bootstrap 5 does the layout and the components; this file sets the palette, the side menu,
 * the sign-in page and the few pieces of its own. Colours are variables, so the dark theme only changes values.
 * No inline style anywhere (Content-Security-Policy): everything the pages need is a class here.
 */

:root,
[data-bs-theme="light"] {
  --rx-bg: #f4f6fb;
  --rx-surface: #ffffff;
  --rx-surface-2: #f8f9fd;
  --rx-border: #e2e7f2;
  --rx-text: #1a2238;
  --rx-muted: #667089;
  --rx-primary: #3558e6;
  --rx-primary-hover: #2a47c2;
  --rx-primary-soft: #e8edff;
  --rx-accent: #0fa38f;
  --rx-accent-soft: #dcf6f1;
  --rx-warn-soft: #fff3d6;
  --rx-shadow: 0 1px 2px rgba(20, 30, 70, .05), 0 8px 24px rgba(20, 30, 70, .06);

  --rx-side-bg: linear-gradient(180deg, #0f1b3d 0%, #111f4b 100%);
  --rx-side-text: #b9c3e3;
  --rx-side-active-bg: rgba(255, 255, 255, .1);

  --bs-body-bg: var(--rx-bg);
  --bs-body-color: var(--rx-text);
  --bs-secondary-color: var(--rx-muted);
  --bs-border-color: var(--rx-border);
  --bs-primary: var(--rx-primary);
  --bs-primary-rgb: 53, 88, 230;
  --bs-link-color: var(--rx-primary);
  --bs-link-hover-color: var(--rx-primary-hover);
  --bs-link-color-rgb: 53, 88, 230;
  --bs-border-radius: .6rem;
  --bs-border-radius-lg: .9rem;
  --bs-font-sans-serif: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

[data-bs-theme="dark"] {
  --rx-bg: #0c1220;
  --rx-surface: #141b2f;
  --rx-surface-2: #182038;
  --rx-border: #263152;
  --rx-text: #e5e9f6;
  --rx-muted: #98a3c1;
  --rx-primary: #7b94ff;
  --rx-primary-hover: #9aafff;
  --rx-primary-soft: #1d2a55;
  --rx-accent: #35d1bb;
  --rx-accent-soft: #123a3a;
  --rx-warn-soft: #3b3014;
  --rx-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);

  --rx-side-bg: linear-gradient(180deg, #0a1020 0%, #0d1530 100%);
  --rx-side-text: #a9b5d8;
  --rx-side-active-bg: rgba(123, 148, 255, .16);

  --bs-body-bg: var(--rx-bg);
  --bs-body-color: var(--rx-text);
  --bs-secondary-color: var(--rx-muted);
  --bs-border-color: var(--rx-border);
  --bs-primary: var(--rx-primary);
  --bs-primary-rgb: 123, 148, 255;
  --bs-link-color: var(--rx-primary);
  --bs-link-hover-color: var(--rx-primary-hover);
  --bs-link-color-rgb: 123, 148, 255;
}

body {
  background: var(--rx-bg);
  color: var(--rx-text);
  -webkit-font-smoothing: antialiased;
}

/* Bootstrap hard-codes the colours of its button variants: set the ones this interface uses. */
.btn-primary {
  --bs-btn-bg: var(--rx-primary);
  --bs-btn-border-color: var(--rx-primary);
  --bs-btn-hover-bg: var(--rx-primary-hover);
  --bs-btn-hover-border-color: var(--rx-primary-hover);
  --bs-btn-active-bg: var(--rx-primary-hover);
  --bs-btn-active-border-color: var(--rx-primary-hover);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--rx-primary);
  --bs-btn-disabled-border-color: var(--rx-primary);
}
[data-bs-theme="dark"] .btn-primary {
  --bs-btn-color: #0c1220;
  --bs-btn-hover-color: #0c1220;
  --bs-btn-active-color: #0c1220;
}
.btn-outline-primary {
  --bs-btn-color: var(--rx-primary);
  --bs-btn-border-color: var(--rx-primary);
  --bs-btn-hover-bg: var(--rx-primary);
  --bs-btn-hover-border-color: var(--rx-primary);
  --bs-btn-active-bg: var(--rx-primary);
  --bs-btn-active-border-color: var(--rx-primary);
}
.btn-outline-secondary {
  --bs-btn-color: var(--rx-muted);
  --bs-btn-border-color: var(--rx-border);
  --bs-btn-hover-bg: var(--rx-surface-2);
  --bs-btn-hover-color: var(--rx-text);
  --bs-btn-hover-border-color: var(--rx-border);
  --bs-btn-active-bg: var(--rx-primary-soft);
  --bs-btn-active-color: var(--rx-primary);
  --bs-btn-active-border-color: var(--rx-primary);
}
.form-control,
.input-group-text {
  background-color: var(--rx-surface);
  border-color: var(--rx-border);
}
.input-group-text {
  color: var(--rx-muted);
}
.form-control:focus {
  border-color: var(--rx-primary);
  box-shadow: 0 0 0 .22rem rgba(var(--bs-primary-rgb), .18);
}
.form-label {
  font-weight: 600;
  font-size: .875rem;
}
.dropdown-menu {
  --bs-dropdown-bg: var(--rx-surface);
  --bs-dropdown-border-color: var(--rx-border);
  --bs-dropdown-link-hover-bg: var(--rx-primary-soft);
  box-shadow: var(--rx-shadow);
  border-radius: .75rem;
}

/* ---------- the brand ---------- */
.rx-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -.01em;
  color: #fff;
  text-decoration: none;
}
.rx-brand:hover { color: #fff; }
.rx-brand-plain { color: var(--rx-text); }
.rx-brand-plain:hover { color: var(--rx-text); }
.rx-brand-light { color: #fff; font-size: 1.5rem; }

/* ---------- the shell of a signed-in user ---------- */
.rx-app {
  display: flex;
  min-height: 100vh;
}
.rx-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  width: 17rem;
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1rem 1rem;
  background: var(--rx-side-bg);
  color: var(--rx-side-text);
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.rx-sidebar .rx-brand { padding: 0 .5rem 1.4rem; }
.rx-nav { display: flex; flex-direction: column; gap: .2rem; }
.rx-nav-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .65rem .8rem;
  border-radius: .65rem;
  color: var(--rx-side-text);
  text-decoration: none;
  font-weight: 500;
}
.rx-nav-link i { width: 1.25rem; text-align: center; opacity: .85; }
.rx-nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rx-nav-link.active { background: var(--rx-side-active-bg); color: #fff; }
.rx-nav-link.active i { color: #8da2ff; opacity: 1; }
.rx-sidebar-foot { margin-top: auto; padding: .8rem .5rem 0; }
.rx-tenant {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: .8rem;
  padding: .35rem .7rem;
  border-radius: 2rem;
  background: rgba(255, 255, 255, .07);
  color: var(--rx-side-text);
}
.rx-scrim {
  position: fixed;
  inset: 0;
  z-index: 1030;
  background: rgba(8, 12, 28, .5);
  display: none;
}
.rx-sidebar-open .rx-sidebar { transform: none; }
.rx-sidebar-open .rx-scrim { display: block; }

.rx-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.rx-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1rem;
  background: color-mix(in srgb, var(--rx-bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rx-border);
}
.rx-topbar-spacer { flex: 1; }
.rx-content {
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

@media (min-width: 992px) {
  .rx-sidebar { transform: none; }
  .rx-scrim { display: none !important; }
  .rx-main { margin-left: 17rem; }
  .rx-menu-button { display: none; }
  .rx-topbar { padding: .8rem 2rem; }
  .rx-content { padding: 2rem 2rem 4rem; }
}

.rx-user-button {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .25rem .6rem .25rem .3rem;
  border: 1px solid var(--rx-border);
  background: var(--rx-surface);
  color: var(--rx-text);
  border-radius: 2rem;
}
.rx-user-button:hover,
.rx-user-button.show { background: var(--rx-surface-2); color: var(--rx-text); border-color: var(--rx-border); }
.rx-avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rx-primary), var(--rx-accent));
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
}
.rx-user-text { display: none; text-align: left; line-height: 1.15; }
.rx-user-email { display: block; font-size: .8rem; font-weight: 600; max-width: 13rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-user-profile { display: block; font-size: .7rem; color: var(--rx-muted); }
@media (min-width: 768px) { .rx-user-text { display: block; } }

.rx-theme-toggle .rx-icon-light { display: none; }
[data-bs-theme="dark"] .rx-theme-toggle .rx-icon-light { display: inline; }
[data-bs-theme="dark"] .rx-theme-toggle .rx-icon-dark { display: none; }

/* ---------- pages ---------- */
.rx-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.rx-page-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }

.rx-card {
  background: var(--rx-surface);
  border: 1px solid var(--rx-border);
  border-radius: 1rem;
  box-shadow: var(--rx-shadow);
}
.rx-card .card-body { padding: 1.5rem; }
.rx-card-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .75rem;
}
.rx-card-title i {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .6rem;
  background: var(--rx-primary-soft);
  color: var(--rx-primary);
  font-size: .9rem;
}

.rx-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 2rem;
  margin-bottom: 1.5rem;
  border-radius: 1.2rem;
  color: #fff;
  background:
    radial-gradient(circle at 90% 0%, rgba(31, 200, 176, .35), transparent 45%),
    linear-gradient(135deg, #1f3bb0 0%, #3558e6 55%, #5b7bff 100%);
  box-shadow: var(--rx-shadow);
}
.rx-eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; opacity: .8; margin-bottom: .3rem; }
.rx-hero-title { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .4rem; }
.rx-hero-text { margin: 0; max-width: 38rem; opacity: .9; }
.rx-hero-badge {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .8rem 1.1rem;
  border-radius: .9rem;
  background: rgba(255, 255, 255, .14);
  backdrop-filter: blur(6px);
}
.rx-hero-badge-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; opacity: .8; }
.rx-hero-badge-value { font-weight: 700; font-size: 1.05rem; }

.rx-rights-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.rx-rights-list li {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .55rem .2rem;
  border-bottom: 1px solid var(--rx-border);
}
.rx-rights-list li:last-child { border-bottom: 0; }
.rx-rights-name { flex: 1; font-weight: 500; }
.rx-rights-icon {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: .55rem;
  background: var(--rx-surface-2);
  color: var(--rx-muted);
  font-size: .85rem;
}

.rx-level { font-weight: 600; padding: .4em .7em; border-radius: 2rem; }
.rx-level-write { background: var(--rx-accent-soft); color: var(--rx-accent); }
.rx-level-read { background: var(--rx-primary-soft); color: var(--rx-primary); }
.rx-level-none { background: var(--rx-surface-2); color: var(--rx-muted); border: 1px solid var(--rx-border); }

.rx-table { --bs-table-bg: transparent; }
.rx-table thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--rx-muted);
  border-bottom-color: var(--rx-border);
}
.rx-table tbody th { font-weight: 600; }

.rx-facts { display: grid; grid-template-columns: max-content 1fr; gap: .7rem 1.2rem; margin: 0; }
.rx-facts dt { color: var(--rx-muted); font-weight: 500; }
.rx-facts dd { margin: 0; font-weight: 600; word-break: break-word; }
.rx-slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  padding: .15rem .5rem;
  border-radius: .4rem;
  background: var(--rx-surface-2);
  border: 1px solid var(--rx-border);
}

.rx-error { text-align: center; padding: 3rem 1rem; }
.rx-error-status {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  margin: 0 0 .5rem;
  background: linear-gradient(135deg, var(--rx-primary), var(--rx-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- a page for someone who is not signed in ---------- */
.rx-plain-bar { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.5rem; }
.rx-plain-content { max-width: 40rem; margin: 0 auto; padding: 1rem 1.5rem 4rem; }

/* ---------- the sign-in page ---------- */
.rx-auth { display: flex; min-height: 100vh; }
.rx-auth-aside {
  display: none;
  flex: 0 0 44%;
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 15% 85%, rgba(31, 200, 176, .35), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(123, 148, 255, .35), transparent 45%),
    linear-gradient(160deg, #0f1b3d 0%, #16296b 100%);
}
.rx-auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(180deg, transparent, #000 35%, transparent);
  pointer-events: none;
}
.rx-auth-aside-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 4rem 4rem;
  max-width: 36rem;
}
.rx-auth-headline { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 3rem 0 2rem; }
.rx-auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.2rem; }
.rx-auth-points li { display: flex; gap: 1rem; align-items: flex-start; }
.rx-auth-points i {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
  background: rgba(255, 255, 255, .12);
  color: #8fe9da;
}
.rx-auth-points strong { display: block; margin-bottom: .1rem; }
.rx-auth-points span { opacity: .88; font-size: .95rem; line-height: 1.45; }

.rx-auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 1rem 1.25rem 2rem; min-width: 0; }
.rx-auth-tools { align-self: flex-end; display: flex; gap: .6rem; padding: .5rem 0 1rem; }
.rx-auth-card {
  width: 100%;
  max-width: 26rem;
  margin: auto 0;
  padding: 2.2rem 2rem;
  background: var(--rx-surface);
  border: 1px solid var(--rx-border);
  border-radius: 1.2rem;
  box-shadow: var(--rx-shadow);
}
.rx-auth-brand-small { margin-bottom: 1.4rem; }
.rx-auth-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .3rem; }
.rx-auth-subtitle { color: var(--rx-muted); margin-bottom: 1.5rem; }
.rx-auth-foot { margin: 1.5rem 0 0; font-size: .8rem; color: var(--rx-muted); text-align: center; }
/* The line between the password and the sign-in through the organisation's account. */
.rx-auth-or { display: flex; align-items: center; gap: .8rem; margin: 1.1rem 0; font-size: .8rem; color: var(--rx-muted); text-transform: uppercase; letter-spacing: .06em; }
.rx-auth-or::before, .rx-auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--bs-border-color); }
@media (min-width: 992px) {
  .rx-auth-aside { display: block; }
  .rx-auth-brand-small { display: none; }
  .rx-auth-card { padding: 2.6rem 2.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .rx-sidebar { transition: none; }
}
