/* ==========================================================================
   Base: reset, typography, grid & utility classes (design system §4, §8, §10, §11)
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--rv-page-bg);
  color: var(--rv-text-primary);
  font: 400 var(--rv-fs-body)/var(--rv-lh-body) var(--rv-font-family);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img, svg { display: inline-block; max-width: 100%; vertical-align: middle; }
svg { flex-shrink: 0; }
a { color: var(--rv-link); text-decoration: none; }
a:hover { color: var(--rv-link-hover); text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 500; }
p { margin: 0 0 8px; } p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding-left: 20px; }
hr { border: 0; border-top: 1px solid var(--rv-divider); margin: var(--rv-space-4) 0; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
::selection { background: rgba(0, 194, 214, .22); }
:focus-visible { outline: 2px solid var(--rv-focus); outline-offset: 2px; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--rv-neutral-100); padding: 1px 4px; border-radius: 3px; }

/* ---------- typography helpers ---------- */
.rv-h1 { font-size: var(--rv-fs-page-title); line-height: var(--rv-lh-page-title); font-weight: 500; }
.rv-h2 { font-size: var(--rv-fs-section); line-height: var(--rv-lh-section); font-weight: 500; }
.rv-h3 { font-size: var(--rv-fs-card-title); line-height: var(--rv-lh-card-title); font-weight: 500; }
.rv-small { font-size: var(--rv-fs-small); line-height: var(--rv-lh-small); }
.rv-muted { color: var(--rv-text-muted); }
.rv-secondary { color: var(--rv-text-secondary); }
.rv-strong { font-weight: 600; }
.rv-num { font-variant-numeric: tabular-nums; }
.rv-nowrap { white-space: nowrap; }
.rv-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rv-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rv-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rv-break { overflow-wrap: anywhere; }
.rv-text-success { color: var(--rv-success); }
.rv-text-warning { color: var(--rv-warning); }
.rv-text-danger { color: var(--rv-danger); }
.rv-text-info { color: var(--rv-info); }
.rv-text-primary { color: var(--rv-primary-700); }
.rv-text-right { text-align: right; }
.rv-text-center { text-align: center; }
.rv-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- layout primitives (§4 grid) ---------- */
.rv-stack { display: flex; flex-direction: column; gap: var(--rv-space-4); min-width: 0; }
.rv-stack-sm { display: flex; flex-direction: column; gap: var(--rv-space-2); min-width: 0; }
.rv-stack-xs { display: flex; flex-direction: column; gap: var(--rv-space-1); min-width: 0; }
.rv-stack-lg { display: flex; flex-direction: column; gap: var(--rv-space-6); min-width: 0; }
.rv-row { display: flex; align-items: center; gap: var(--rv-space-2); flex-wrap: wrap; min-width: 0; }
.rv-row-nowrap { display: flex; align-items: center; gap: var(--rv-space-2); min-width: 0; }
.rv-row--top { align-items: flex-start; }
.rv-row--between { justify-content: space-between; }
.rv-row--end { justify-content: flex-end; }
.rv-spacer { flex: 1 1 auto; }
.rv-grid-2, .rv-grid-3, .rv-grid-4, .rv-grid-5, .rv-grid-form, .rv-grid-aside, .rv-grid-report, .rv-grid-kpi { display: grid; gap: var(--rv-space-4); min-width: 0; }
.rv-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rv-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rv-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rv-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rv-grid-kpi { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--rv-space-3); }
.rv-grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--rv-space-3) var(--rv-space-4); }
.rv-grid-form > .is-full, .rv-grid-2 > .is-full, .rv-grid-report > .is-wide { grid-column: 1 / -1; }
.rv-grid-aside { grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); align-items: start; }
.rv-grid-report { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rv-grid-2 > *, .rv-grid-3 > *, .rv-grid-4 > *, .rv-grid-5 > *, .rv-grid-aside > *, .rv-grid-report > *, .rv-grid-form > * { min-width: 0; }
.rv-mt-0 { margin-top: 0; } .rv-mt-2 { margin-top: var(--rv-space-2); } .rv-mt-3 { margin-top: var(--rv-space-3); } .rv-mt-4 { margin-top: var(--rv-space-4); } .rv-mt-6 { margin-top: var(--rv-space-6); }
.rv-mb-2 { margin-bottom: var(--rv-space-2); } .rv-mb-3 { margin-bottom: var(--rv-space-3); } .rv-mb-4 { margin-bottom: var(--rv-space-4); }
.rv-w-full { width: 100%; }

@media (min-width: 768px) and (max-width: 1199px) {
  .rv-grid-3, .rv-grid-4, .rv-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-grid-aside { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .rv-grid-2, .rv-grid-3, .rv-grid-4, .rv-grid-5, .rv-grid-form, .rv-grid-aside, .rv-grid-report { grid-template-columns: minmax(0, 1fr); }
  .rv-grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--rv-space-2); }
  .rv-hide-mobile { display: none !important; }
}
@media (min-width: 768px) { .rv-show-mobile { display: none !important; } }

/* boot placeholder — every screen is its own HTML file now, so only show it when a page load is slow */
.rv-boot { padding: var(--rv-space-6); color: var(--rv-text-muted); }
@media (prefers-reduced-motion: no-preference) {
  .rv-boot { animation: rv-boot-in .2s ease-out .4s both; }
  @keyframes rv-boot-in { from { opacity: 0; } to { opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- pre-rendered markup (templates) — states set by boot/early.js, core/router.js, shell/layout.js ---- */
/* menu items, bottom-nav shortcuts and the signed-in user wait for the role (no flash of items a role cannot see) */
.rv-js:not(.rv-caps-ready) #rv-nav [data-cap],
.rv-js:not(.rv-caps-ready) .rv-mobile-nav [data-roles],
.rv-js:not(.rv-caps-ready) [data-rv-user] { visibility: hidden; }
/* this file is handing the hash over to another file → keep the page area blank */
[data-rva-state="handover"] #rv-main { visibility: hidden; }
.rv-boot--error { color: var(--rv-danger, #b42318); }
.rv-noscript { margin: 0; padding: 12px 16px; background: var(--rv-surface-muted, #f2f4f7); color: var(--rv-text-muted); font-size: 14px; }

