/* RhenQ theme on top of Bootstrap 6 - colours and type follow the Rhenion GmbH logo.
   Unlayered rules win over Bootstrap's cascade layers, so plain selectors are enough here. */

:root {
  --rq-navy: #1e2d3c;
  --rq-navy-2: #26394c;
  --rq-navy-3: #314a61;
  --rq-blue: #0661ac;
  --rq-blue-bright: #3d97e6;
  --rq-sidebar-width: 17rem;

  --bs-body-font-family: 'Outfit Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-font-sans-serif: var(--bs-body-font-family);
  --rq-surface: light-dark(#f3f5f8, #0f161d);
  --rq-card: light-dark(#ffffff, #17212b);

  /* Brand blue as Bootstrap primary */
  --bs-primary-base: var(--rq-blue);
  --bs-primary-bg: var(--rq-blue);
  --bs-primary-fg: light-dark(var(--rq-blue), #6fb3ef);
  --bs-primary-fg-emphasis: light-dark(#04467d, #b4d6f5);
  --bs-primary-bg-subtle: light-dark(#e7f0f8, #0e2638);
  --bs-primary-bg-muted: light-dark(#cfe1f1, #143651);
  --bs-primary-border: light-dark(#9ec4e5, #1f5a8c);
  --bs-primary-focus-ring: color-mix(in oklch, var(--rq-blue) 45%, var(--bs-bg-body));
  --bs-primary-contrast: #fff;

  /* Brand navy as the "inverse" theme */
  --bs-inverse-base: var(--rq-navy);
  --bs-inverse-bg: light-dark(var(--rq-navy), #dfe6ee);
  --bs-inverse-fg: light-dark(var(--rq-navy), #dfe6ee);
  --bs-inverse-contrast: light-dark(#fff, var(--rq-navy));
}

body {
  font-family: var(--bs-body-font-family);
  background-color: var(--rq-surface);
}

h1, h2, h3, h4, h5, h6, .rq-heading { font-weight: 650; letter-spacing: -.01em; color: light-dark(var(--rq-navy), #e9eef3); }

/* ---------- Brand lockup ---------- */
.rq-brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.rq-brand img { height: 1.9rem; width: auto; }
.rq-brand-name { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.rq-brand-name span { color: var(--rq-blue-bright); }
.rq-brand-sub { display: block; font-size: .68rem; font-weight: 400; letter-spacing: .14em; text-transform: lowercase; opacity: .7; margin-top: .2rem; }

/* ---------- App shell ---------- */
.rq-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--rq-sidebar-width); z-index: 1030;
  display: none; flex-direction: column;
  background: var(--rq-navy); color: #c9d4df;
}
@media (min-width: 1024px) {
  .rq-sidebar { display: flex; }
  .rq-main { margin-left: var(--rq-sidebar-width); }
  .rq-mobile-only { display: none !important; }
}
.rq-sidebar-head { padding: 1.25rem 1.25rem 1rem; color: #fff; }
.rq-sidebar-scroll { overflow-y: auto; flex: 1; padding: 0 .75rem 1.5rem; scrollbar-width: thin; scrollbar-color: var(--rq-navy-3) transparent; }
.rq-nav-group { margin-top: 1.1rem; }
.rq-nav-group-title {
  display: flex; align-items: center; gap: .5rem; padding: 0 .6rem .35rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #8094a8;
}
.rq-nav-group-title .rq-clause-no {
  display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.15rem; padding: 0 .25rem;
  border-radius: .3rem; background: var(--rq-navy-3); color: #fff; font-size: .65rem; letter-spacing: 0;
}
.rq-nav-link {
  display: flex; align-items: center; gap: .65rem; padding: .42rem .6rem; border-radius: .5rem;
  color: #c9d4df; text-decoration: none; font-size: .925rem; line-height: 1.25;
}
.rq-nav-link .bi { font-size: 1rem; opacity: .8; width: 1.1rem; text-align: center; }
.rq-nav-link:hover { background: var(--rq-navy-2); color: #fff; }
.rq-nav-link.active { background: var(--rq-blue); color: #fff; box-shadow: inset 3px 0 0 var(--rq-blue-bright); }
.rq-nav-link.active .bi { opacity: 1; }
.rq-sidebar-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--rq-navy-2); font-size: .75rem; color: #8094a8; }
.rq-sidebar-foot a { color: #b7c4d1; }

.rq-drawer { background: var(--rq-navy); color: #c9d4df; }
.rq-drawer .drawer-header { color: #fff; }
.rq-drawer .btn-close { filter: invert(1); }

.rq-topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: .75rem; padding: .65rem 1rem;
  background: color-mix(in oklch, var(--rq-card) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bs-border-color);
}
@media (min-width: 768px) { .rq-topbar { padding: .65rem 1.75rem; } }
.rq-search { max-width: 26rem; flex: 1; position: relative; }
.rq-search .bi { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--bs-fg-3); }
.rq-search input { padding-left: 2.2rem; background-color: var(--rq-surface); }
.rq-content { padding: 1.25rem 1rem 3rem; max-width: 1500px; }
@media (min-width: 768px) { .rq-content { padding: 1.75rem 1.75rem 3rem; } }

.rq-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.rq-page-head h1 { font-size: 1.65rem; margin: 0; }
.rq-page-head .rq-lead { margin: .3rem 0 0; color: var(--bs-fg-3); max-width: 60ch; }
.rq-eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--bs-primary-fg); }

.rq-avatar {
  display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--rq-blue); color: #fff; font-weight: 600; font-size: .85rem;
}

/* ---------- Cards / panels ---------- */
.rq-card { background: var(--rq-card); border: 1px solid var(--bs-border-color); border-radius: .875rem; }
.rq-card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--bs-border-color); }
.rq-card-head h2, .rq-card-head h3 { font-size: 1.05rem; margin: 0; }
.rq-card-body { padding: 1.25rem; }

.rq-stat { display: flex; flex-direction: column; gap: .2rem; padding: 1.1rem 1.25rem; height: 100%; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.rq-stat:hover { border-color: var(--bs-primary-border); transform: translateY(-1px); }
.rq-stat-label { font-size: .82rem; color: var(--bs-fg-3); display: flex; align-items: center; gap: .4rem; }
.rq-stat-value { font-size: 2rem; font-weight: 650; line-height: 1.1; color: light-dark(var(--rq-navy), #f1f4f7); font-variant-numeric: tabular-nums; }
.rq-stat-meta { font-size: .8rem; color: var(--bs-fg-3); }

/* ---------- Tables ---------- */
.rq-table { margin: 0; }
.rq-table th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-fg-3); white-space: nowrap; background: transparent; }
.rq-table td { vertical-align: middle; }
.rq-table td:first-child, .rq-table th:first-child { padding-left: 1.25rem; }
.rq-table td:last-child, .rq-table th:last-child { padding-right: 1.25rem; }
.rq-table tbody tr { cursor: pointer; }
.rq-table tbody tr:hover > * { background-color: var(--bs-primary-bg-subtle); }
.rq-ref { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; color: var(--bs-primary-fg); }
.rq-progress { height: .45rem; min-width: 4rem; }

/* ---------- Detail pages ---------- */
.rq-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.1rem 1.5rem; margin: 0; }
.rq-fields dt { font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--bs-fg-3); margin-bottom: .2rem; }
.rq-fields dd { margin: 0; }
.rq-fields .rq-wide { grid-column: 1 / -1; }
.rq-fields dd p:last-child { margin-bottom: 0; }

.rq-timeline { list-style: none; margin: 0; padding: 0; }
.rq-timeline li { position: relative; padding: 0 0 .9rem 1.25rem; font-size: .875rem; }
.rq-timeline li::before { content: ''; position: absolute; left: .2rem; top: .45rem; width: .45rem; height: .45rem; border-radius: 50%; background: var(--rq-blue); }
.rq-timeline li::after { content: ''; position: absolute; left: .41rem; top: 1rem; bottom: 0; width: 1px; background: var(--bs-border-color); }
.rq-timeline li:last-child::after { display: none; }

/* ---------- Risk heatmap ---------- */
.rq-heatmap { display: grid; grid-template-columns: auto repeat(5, 1fr); gap: 3px; font-size: .8rem; }
.rq-heatmap .rq-hm-axis { display: grid; place-items: center; color: var(--bs-fg-3); font-variant-numeric: tabular-nums; padding: .15rem .35rem; }
.rq-heatmap .rq-hm-cell {
  aspect-ratio: 1.6; min-height: 2.25rem; border-radius: .4rem; display: grid; place-items: center;
  font-weight: 650; font-size: 1rem; font-variant-numeric: tabular-nums; position: relative;
}
.rq-hm-low { background: light-dark(#e3f3ea, #12301f); color: light-dark(#1d6b40, #8fd6ab); }
.rq-hm-medium { background: light-dark(#fdf1d3, #3a2e0d); color: light-dark(#8a5b00, #f0c869); }
.rq-hm-high { background: light-dark(#fbdccb, #46220f); color: light-dark(#a03c08, #f6a77a); }
.rq-hm-critical { background: light-dark(#f6c4c4, #4d1414); color: light-dark(#a01818, #ff9d9d); }
.rq-hm-cell.rq-hm-empty { font-weight: 400; opacity: .55; font-size: .8rem; }
.rq-hm-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .78rem; color: var(--bs-fg-3); }
.rq-hm-legend span::before { content: ''; display: inline-block; width: .7rem; height: .7rem; border-radius: .2rem; margin-right: .35rem; vertical-align: -.05rem; }
.rq-hm-legend .l-low::before { background: #5fb784; } .rq-hm-legend .l-medium::before { background: #e5b13a; }
.rq-hm-legend .l-high::before { background: #e57b3e; } .rq-hm-legend .l-critical::before { background: #d23c3c; }

/* ---------- Compliance ---------- */
.rq-chapter-bar { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: center; gap: .75rem; padding: .45rem 0; text-decoration: none; color: inherit; }
.rq-chapter-bar .rq-clause-no { display: grid; place-items: center; height: 1.8rem; border-radius: .45rem; background: var(--rq-navy); color: #fff; font-weight: 600; font-size: .85rem; }
.rq-chapter-bar .progress { height: .55rem; }
.rq-status-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .35rem; }
.rq-ring { --p: 0; width: 7.5rem; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--rq-blue) calc(var(--p) * 1%), light-dark(#e3e9ef, #24313e) 0); }
.rq-ring > div { width: 76%; aspect-ratio: 1; border-radius: 50%; background: var(--rq-card); display: grid; place-items: center; text-align: center; }
.rq-ring strong { font-size: 1.6rem; line-height: 1; color: light-dark(var(--rq-navy), #fff); }

/* ---------- Process map ---------- */
.rq-lane { border-radius: .875rem; padding: 1rem; border: 1px dashed var(--bs-border-color); }
.rq-lane-management { background: light-dark(#eef3f8, #16212c); }
.rq-lane-core { background: light-dark(#e7f0f8, #0e2638); border-style: solid; border-color: var(--bs-primary-border); }
.rq-lane-support { background: light-dark(#f4f4f6, #1a1d22); }
.rq-process-chip {
  display: block; padding: .75rem .9rem; border-radius: .6rem; background: var(--rq-card);
  border: 1px solid var(--bs-border-color); text-decoration: none; color: inherit; height: 100%;
}
.rq-process-chip:hover { border-color: var(--rq-blue); }
.rq-lane-core .rq-process-chip { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); padding-right: 1.6rem; }

/* ---------- Forms ---------- */
.rq-form .form-label { font-weight: 550; font-size: .9rem; }
.rq-form .form-text { font-size: .8rem; }
.rq-form textarea { min-height: 5.5rem; }
.rq-form-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.25rem; background: var(--rq-card); border-top: 1px solid var(--bs-border-color); border-radius: 0 0 .875rem .875rem; }
.errorlist { list-style: none; padding: 0; margin: .25rem 0 0; color: var(--bs-danger-fg); font-size: .85rem; }

/* ---------- Public pages ---------- */
.rq-public-nav { background: var(--rq-navy); color: #fff; }
.rq-public-nav a { color: #dbe4ec; text-decoration: none; }
.rq-public-nav a:hover { color: #fff; }
.rq-hero { background: var(--rq-navy); color: #dbe4ec; position: relative; overflow: hidden; }
.rq-hero::after {
  content: ''; position: absolute; right: -6rem; bottom: -9rem; width: 34rem; height: 34rem;
  background: url('../img/rhenq-mark-light.svg') no-repeat center / contain; opacity: .06; pointer-events: none;
}
.rq-hero h1 { color: #fff; font-size: clamp(2.1rem, 4.5vw, 3.4rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.08; }
.rq-hero h1 em { font-style: normal; color: var(--rq-blue-bright); }
.rq-hero .lead { color: #b9c6d3; font-size: 1.15rem; max-width: 40rem; }
.rq-stripe { height: 6px; background: linear-gradient(90deg, var(--rq-blue) 0 30%, var(--rq-navy) 30%); }
.rq-feature-icon { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .65rem; background: var(--bs-primary-bg-subtle); color: var(--rq-blue); font-size: 1.3rem; }
.rq-auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .rq-auth-wrap { grid-template-columns: 5fr 6fr; } }
.rq-auth-side { background: var(--rq-navy); color: #c9d4df; padding: 3rem; display: none; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
@media (min-width: 1024px) { .rq-auth-side { display: flex; } }
.rq-auth-side h2 { color: #fff; font-size: 2rem; }
.rq-auth-main { display: grid; place-items: center; padding: 2rem 1rem; }
.rq-auth-card { width: 100%; max-width: 28rem; }

/* ---------- Print (management review report, audit report ...) ---------- */
@media print {
  .rq-sidebar, .rq-topbar, .rq-no-print, .rq-form-actions { display: none !important; }
  .rq-main { margin: 0 !important; }
  body { background: #fff; }
  .rq-card { border: 0; }
  .rq-print-only { display: block !important; }
}
.rq-print-only { display: none; }
