/* ═══════════════════════════════════════════════════════════════
   Renvi — Slim MUI-Inspired Theme
   Visually matched to Slim Free React MUI Template v1.0
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. CSS Custom Properties (MUI Palette) ─────────────────── */
:root {
  /* Primary blue gradient */
  --c-primary-light: #96c0f3;
  --c-primary-300: #3a88e9;
  --c-primary-400: #1973e2;
  --c-primary: #3390cc;
  --c-primary-dark: #0f468b;
  /* Secondary gold */
  --c-secondary: #fec604;
  --c-secondary-dark: #c99c01;
  /* Semantic */
  --c-success: #4caf50;
  --c-success-light: #d9eeda;
  --c-warning: #ed6c02;
  --c-error: #d32f2f;
  /* Surfaces */
  --c-bg: #f8faff;
  --c-paper: #fff;
  --c-border: #dee2e6;
  /* Text */
  --c-text-primary: #343a40;
  --c-text-secondary: #868ba1;
  --c-text-tertiary: #6c757d;
  /* Shadows */
  --shadow-paper:
    0px 2px 1px -1px rgba(0, 0, 0, 0.12), 0px 1px 1px 0px rgba(0, 0, 0, 0.08),
    0px 1px 3px 0px rgba(0, 0, 0, 0.06);
  --shadow-card:
    0px 2px 4px -1px rgba(0, 0, 0, 0.08), 0px 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-nav:
    0px 4px 8px -2px rgba(0, 0, 0, 0.1), 0px 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-popup:
    0px 8px 16px -4px rgba(0, 0, 0, 0.12), 0px 4px 8px -4px rgba(0, 0, 0, 0.08);
  /* Radii */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
}

/* ── 1b. Bootstrap variable overrides ───────────────────────── */
:root {
  --bs-primary: #3390cc;
  --bs-heading-color: var(--bs-primary);
  --bs-primary-rgb: 21, 96, 189;
  --bs-link-color: var(--c-primary-400);
  --bs-link-hover-color: var(--c-primary);
  --bs-border-color: var(--c-border);
  --bs-body-bg: var(--c-bg);
  --bs-body-color: var(--c-text-primary);
  --bs-body-font-family: "Rubik", sans-serif;
}

/* ── 1b. Text size: Bootstrap's own font sizes × --ts ────────────────
   Same values as Bootstrap 5.3, multiplied by the text size (see "Text size
   control" near the end). Here, before this file's own rules, so those still
   win exactly as before; at normal size (--ts 1) nothing changes. */
@media print { :root { --ts: 1 !important; } }
/* The top menu bar keeps its size, so it stays on one line; the menus that
   open from it grow with the page (--ts-page is the same value as --ts). */
.site-navbar { --ts: 1; font-size: 14px; }   /* 14px = the page's normal size (body) */
.site-navbar .dropdown-menu { --ts: var(--ts-page, 1); }
body { --bs-body-font-size: calc(1rem * var(--ts, 1)); }
.btn { --bs-btn-font-size: calc(1rem * var(--ts, 1)); }
.btn-sm, .btn-group-sm > .btn { --bs-btn-font-size: calc(.875rem * var(--ts, 1)); }
.btn-lg, .btn-group-lg > .btn { --bs-btn-font-size: calc(1.25rem * var(--ts, 1)); }
.form-control, .form-select, .input-group-text, .accordion-button { font-size: calc(1rem * var(--ts, 1)); }
.form-control-sm, .form-select-sm, .input-group-sm > .form-control, .input-group-sm > .form-select, .input-group-sm > .input-group-text, .input-group-sm > .btn { font-size: calc(.875rem * var(--ts, 1)); }
.form-control-lg, .form-select-lg, .input-group-lg > .form-control, .input-group-lg > .form-select, .input-group-lg > .input-group-text, .input-group-lg > .btn { font-size: calc(1.25rem * var(--ts, 1)); }
.dropdown-menu { --bs-dropdown-font-size: calc(1rem * var(--ts, 1)); }
.pagination { --bs-pagination-font-size: calc(1rem * var(--ts, 1)); }
.pagination-sm { --bs-pagination-font-size: calc(.875rem * var(--ts, 1)); }
.tooltip { --bs-tooltip-font-size: calc(.875rem * var(--ts, 1)); }
.popover { --bs-popover-font-size: calc(.875rem * var(--ts, 1)); --bs-popover-header-font-size: calc(1rem * var(--ts, 1)); }
.toast { --bs-toast-font-size: calc(.875rem * var(--ts, 1)); }
.navbar { --bs-navbar-brand-font-size: calc(1.25rem * var(--ts, 1)); --bs-navbar-toggler-font-size: calc(1.25rem * var(--ts, 1)); }
h1, .h1 { font-size: calc((1.375rem + 1.5vw) * var(--ts, 1)); }
h2, .h2 { font-size: calc((1.325rem + .9vw) * var(--ts, 1)); }
h3, .h3 { font-size: calc((1.3rem + .6vw) * var(--ts, 1)); }
h4, .h4 { font-size: calc((1.275rem + .3vw) * var(--ts, 1)); }
h5, .h5, .lead { font-size: calc(1.25rem * var(--ts, 1)); }
h6, .h6 { font-size: calc(1rem * var(--ts, 1)); }
.fs-1 { font-size: calc((1.375rem + 1.5vw) * var(--ts, 1)) !important; }
.fs-2 { font-size: calc((1.325rem + .9vw) * var(--ts, 1)) !important; }
.fs-3 { font-size: calc((1.3rem + .6vw) * var(--ts, 1)) !important; }
.fs-4 { font-size: calc((1.275rem + .3vw) * var(--ts, 1)) !important; }
.fs-5 { font-size: calc(1.25rem * var(--ts, 1)) !important; }
.fs-6 { font-size: calc(1rem * var(--ts, 1)) !important; }
@media (min-width: 1200px) {
  h1, .h1 { font-size: calc(2.5rem * var(--ts, 1)); }
  h2, .h2 { font-size: calc(2rem * var(--ts, 1)); }
  h3, .h3 { font-size: calc(1.75rem * var(--ts, 1)); }
  h4, .h4 { font-size: calc(1.5rem * var(--ts, 1)); }
  .fs-1 { font-size: calc(2.5rem * var(--ts, 1)) !important; }
  .fs-2 { font-size: calc(2rem * var(--ts, 1)) !important; }
  .fs-3 { font-size: calc(1.75rem * var(--ts, 1)) !important; }
  .fs-4 { font-size: calc(1.5rem * var(--ts, 1)) !important; }
}

/* ── 2. Base ─────────────────────────────────────────────────── */
html,
body {
  background-color: var(--c-bg) !important;
  color: var(--c-text-primary);
  font-family: "Rubik", sans-serif;
  font-size: 14px;
  line-height: 1.57;
}
/* Text size (--ts) applies from body down. html stays at 14px: it sets the
   rem unit, which spacing and widths use too. */
body { font-size: calc(14px * var(--ts, 1)); }

/* ── 3. Top Header Bar ───────────────────────────────────────── */
.site-topbar {
  background-color: var(--c-primary);
  border-bottom: 1px solid var(--c-border);
  padding: 10px 0;
}

.site-topbar .topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-topbar .brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.site-topbar .brand-name {
  font-family: "Rubik", sans-serif;
  font-size: calc(1.15rem * var(--ts, 1));
  line-height: 1.2;
  color: var(--c-text-primary);
}

.site-topbar .brand-name strong {
  font-weight: 500;
  color: var(--c-paper);
}

.site-topbar .brand-name .brand-sub {
  font-weight: 400;
  color: var(--c-paper);
  letter-spacing: 0.13em;
  font-size: 0.92em;
}

.site-topbar .topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: calc(0.8125rem * var(--ts, 1));
  color: var(--c-text-secondary);
}

.site-topbar .topbar-user .user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  font-size: calc(0.78rem * var(--ts, 1));
  color: var(--c-text-tertiary);
}

.site-topbar .topbar-user .user-chip .bi {
  color: var(--c-primary-300);
  font-size: calc(14px * var(--ts, 1));
}

/* ── 4. Sticky Navigation Bar ────────────────────────────────── */
.site-navbar {
  background-color: var(--c-paper) !important;
  box-shadow: var(--shadow-nav);
  padding-top: 0;
  padding-bottom: 0;
  z-index: 1020;
}

/* ── 4a. Brand inside navbar (single-bar layout) ────────────── */
.site-navbar .brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.site-navbar .brand-name {
  font-family: "Rubik", sans-serif;
  font-size: calc(1.05rem * var(--ts, 1));
  line-height: 1.2;
}

.site-navbar .brand-name strong {
  font-weight: 600;
  color: var(--c-primary);
}

/* The rental company this installation belongs to, under the product name */
.site-navbar .brand-name .brand-company {
  font-size: calc(0.72rem * var(--ts, 1));
  font-weight: 400;
  color: var(--c-text-tertiary);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-navbar .brand-name .brand-sub {
  font-weight: 300;
  color: var(--c-text-tertiary);
  letter-spacing: 0.12em;
  font-size: 0.9em;
}

.site-navbar .navbar-user {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.site-navbar .navbar-user .user-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: calc(0.78rem * var(--ts, 1));
  color: var(--c-text-tertiary);
  padding: 3px 10px;
  background-color: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 20px;
}

.site-navbar .navbar-user .user-chip .bi {
  color: var(--c-primary-300);
  font-size: calc(14px * var(--ts, 1));
}

/* Nav item row — bordered cells, left border on container */
.site-navbar .navbar-nav {
  border-left: 1px solid var(--c-border);
  flex-wrap: wrap;
  gap: 0;
  width: 100%;
}

.site-navbar .navbar-nav .nav-item {
  display: flex;
  align-items: stretch;
}

.site-navbar .navbar-nav .nav-link {
  color: var(--c-text-tertiary) !important;
  border-right: 1px solid var(--c-border);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  padding: 11px 15px;
  font-size: calc(12px * var(--ts, 1));
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  display: flex;
  align-items: center;
  gap: 7px;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}

.site-navbar .navbar-nav .nav-link .bi {
  font-size: calc(16px * var(--ts, 1));
  color: var(--c-primary-300);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

/* Hover state */
.site-navbar .navbar-nav .nav-link:hover {
  background-color: rgba(150, 192, 243, 0.12);
  color: var(--c-primary-400) !important;
}

.site-navbar .navbar-nav .nav-link:hover .bi {
  color: var(--c-primary);
}

/* Active / selected — gradient fill */
.site-navbar .navbar-nav .nav-link.nav-active,
.site-navbar .navbar-nav .nav-link.active {
  background-color: var(--c-primary);
  color: #fff !important;
  font-weight: 600;
}

.site-navbar .navbar-nav .nav-link.nav-active .bi,
.site-navbar .navbar-nav .nav-link.active .bi {
  color: #fff !important;
}

/* Dropdown toggle active parent */
.site-navbar .navbar-nav .dropdown-toggle.nav-active {
  background-color: var(--c-primary);
  color: #fff !important;
}

.site-navbar .navbar-nav .dropdown-toggle.nav-active .bi {
  color: #fff !important;
}

.site-navbar .navbar-nav .dropdown-toggle.nav-active::after {
  border-top-color: #fff;
}

/* Dropdown menus */
.site-navbar .dropdown-menu {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-popup);
  padding: 6px;
  min-width: 200px;
  margin-top: 1px;
  animation: fadeInDown 0.15s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.site-navbar .dropdown-item {
  border-radius: var(--r-sm);
  padding: 7px 12px;
  font-size: calc(13px * var(--ts, 1));
  color: var(--c-text-secondary);
  transition:
    background-color 0.12s ease,
    color 0.12s ease;
}

.site-navbar .dropdown-item:hover,
.site-navbar .dropdown-item:focus {
  background-color: rgba(150, 192, 243, 0.18);
  color: var(--c-primary-400);
}

.site-navbar .dropdown-item.nav-active {
  background-color: rgba(58, 136, 233, 0.15);
  color: var(--c-primary) !important;
  font-weight: 600;
}

.site-navbar .dropdown-divider {
  margin: 4px 6px;
  border-color: var(--c-border);
  opacity: 1;
}

/* Mobile hamburger */
.site-navbar .navbar-toggler {
  border: 1px solid var(--c-border);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  margin: 6px 0;
}

.site-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2821%2C96%2C189%2C0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Collapsed mobile nav */
@media (max-width: 991.98px) {
  .site-navbar .navbar-collapse {
    border-top: 1px solid var(--c-border);
    margin-top: 4px;
    padding-top: 6px;
    padding-bottom: 6px;
    /* .site-navbar is sticky-top, so once expanded it just grows taller in
       normal flow — if the menu is taller than the viewport, the overflow
       sits below the visible area with no way to reach it: page scroll
       moves the body behind the (still-stuck) nav, not the menu itself.
       Cap it to the remaining viewport height (~64px is the brand row —
       40px logo + its border + a small margin of safety) and let the menu
       scroll on its own instead. */
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }
  .site-navbar .navbar-nav {
    border-left: none;
    flex-direction: column;
    width: 100%;
  }
  .site-navbar .navbar-nav .nav-item {
    display: block;
  }
  .site-navbar .navbar-nav .nav-link {
    border: none;
    border-radius: var(--r-sm);
    padding: 9px 14px;
    margin: 1px 0;
    width: 100%;
    text-transform: uppercase;
    font-size: calc(12.5px * var(--ts, 1));
  }
  .site-navbar .dropdown-menu {
    border: none;
    box-shadow: none;
    border-radius: var(--r-sm);
    padding: 2px 0 2px 16px;
    background-color: rgba(240, 242, 247, 0.6);
    animation: none;
  }
  .site-navbar .dropdown-item {
    font-size: calc(12.5px * var(--ts, 1));
  }
}

/* Icon-only nav labels — the expanded navbar (>=992px) has room for icons but
   the labels start wrapping to a second line before ~1317.6px */
@media (min-width: 992px) and (max-width: 1317.6px) {
  .site-navbar .navbar-nav .nav-link .nav-label {
    display: none;
  }
}
/* …and whenever the bar would otherwise wrap (set by the script under the
   menu in app/layout/header.php), e.g. a long user name on a wide screen */
@media (min-width: 992px) {
  .site-navbar.nav-compact .navbar-nav .nav-link .nav-label { display: none; }
}
/* The menu's names on hover when only its icons show: small and quiet */
.tooltip.nav-tip {
  --bs-tooltip-bg: rgba(33, 37, 41, .82);
  --bs-tooltip-font-size: 12px;
  --bs-tooltip-padding-y: .2rem;
  --bs-tooltip-padding-x: .5rem;
  --bs-tooltip-border-radius: 4px;
  --bs-tooltip-opacity: 1;
  pointer-events: none;
}
/* A long user name is shortened with "…"; the chip's tooltip shows it whole */
.site-navbar .navbar-user .user-chip .user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 5. Main content area ────────────────────────────────────── */
main.container-fluid {
  min-height: calc(100vh - 180px);
}

/* ── 6. Cards ────────────────────────────────────────────────── */
.card {
  background-color: var(--c-paper);
  border: 1px solid var(--c-border) !important;
  border-radius: var(--r-md) !important;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0px 10px 20px -8px rgba(0, 0, 0, 0.18);
}

.card-header {
  background-color: var(--c-paper);
  border-bottom: 1px solid var(--c-border);
  border-radius: calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0 0 !important;
  padding: 13px 20px;
  font-size: calc(0.875rem * var(--ts, 1));
  font-weight: 600;
  color: var(--c-text-primary);
}

.card-body {
  padding: 20px;
}

.card-footer {
  background-color: var(--c-paper);
  border-top: 1px solid var(--c-border);
  border-radius: 0 0 calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) !important;
  padding: 12px 20px;
}

/* ── 7. Buttons ──────────────────────────────────────────────── */
.btn {
  font-family: "Rubik", sans-serif;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: var(--r-sm);
  transition: all 0.2s ease;
}

/* btn-dark → primary filled blue */
.btn-dark {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--c-primary);
  --bs-btn-border-color: var(--c-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--c-primary);
  --bs-btn-hover-border-color: var(--c-primary);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--c-primary-dark);
  --bs-btn-active-border-color: var(--c-primary-dark);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--c-primary-light);
  --bs-btn-disabled-border-color: var(--c-primary-light);
}

/* Settings "Save" button: the default blue written in, never the accent
   colour, so a poor accent choice can't make the button unreadable. Matches
   .btn-dark with the default palette. */
.btn-settings-save {
  --bs-btn-color: #fff;
  --bs-btn-bg: #3390cc;
  --bs-btn-border-color: #3390cc;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #3390cc;
  --bs-btn-hover-border-color: #3390cc;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #0f468b;
  --bs-btn-active-border-color: #0f468b;
  --bs-btn-focus-shadow-rgb: 51, 144, 204;
}

/* btn-outline-dark → outlined primary blue */
.btn-outline-dark {
  --bs-btn-color: var(--c-primary);
  --bs-btn-border-color: var(--c-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--c-primary);
  --bs-btn-hover-border-color: var(--c-primary);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--c-primary-dark);
  --bs-btn-active-border-color: var(--c-primary-dark);
  --bs-btn-focus-shadow-rgb: 21, 96, 189;
}

.btn-outline-secondary {
  --bs-btn-color: var(--c-text-secondary);
  --bs-btn-border-color: var(--c-border);
  --bs-btn-hover-color: var(--c-text-primary);
  --bs-btn-hover-bg: var(--c-bg);
  --bs-btn-hover-border-color: var(--c-text-secondary);
  --bs-btn-active-bg: var(--c-bg);
  --bs-btn-active-border-color: var(--c-text-secondary);
}

/* ── 8. Forms ────────────────────────────────────────────────── */
.form-label {
  font-weight: 600;
  font-size: calc(0.8125rem * var(--ts, 1));
  color: var(--c-text-primary);
  margin-bottom: 5px;
}

.form-control,
.form-select {
  background-color: var(--c-paper);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text-primary);
  font-family: "Rubik", sans-serif;
  font-size: calc(13.5px * var(--ts, 1));
  padding: 8px 12px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

/* Keep Bootstrap's small sizing and the select arrow gutter, which the
   padding above would otherwise override. */
.form-select {
  padding-right: 2.25rem;
}
.form-control-sm,
.form-select-sm {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  padding-left: 0.5rem;
}
.form-control-sm {
  padding-right: 0.5rem;
}
.form-select-sm {
  padding-right: 2rem;
}

.form-control:hover,
.form-select:hover {
  border-color: var(--c-primary-400);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--c-primary-400);
  box-shadow: 0 0 0 3px rgba(25, 115, 226, 0.15);
  background-color: var(--c-paper);
  color: var(--c-text-primary);
}

.form-text {
  color: var(--c-text-secondary);
  font-size: calc(0.77rem * var(--ts, 1));
}

.input-group-text {
  background-color: var(--c-bg);
  border-color: var(--c-border);
  color: var(--c-text-secondary);
  font-size: calc(13.5px * var(--ts, 1));
}

/* ── 9. Tables ───────────────────────────────────────────────── */
.table {
  font-size: calc(13.5px * var(--ts, 1));
  color: var(--c-text-primary);
  margin-bottom: 0;
}

.table thead th {
  background-color: var(--c-bg);
  color: var(--c-text-secondary);
  font-size: calc(11px * var(--ts, 1));
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border) !important;
  padding: 10px 16px;
  white-space: nowrap;
}

.table > tbody > tr:hover > * {
  background-color: rgba(240, 242, 247, 0.55);
}

.table > tbody > tr > td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(222, 226, 230, 0.55);
  vertical-align: middle;
}

/* DataTables — length menu select arrow spacing */
.dt-length select {
  padding-right: 2.25rem;
}

/* DataTables 2.x column header layout fix */
table.dataTable thead th .dt-column-header {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center;
  width: 100%;
}

table.dataTable thead th.dt-type-numeric .dt-column-header {
  flex-direction: row !important;
}

/* scrollX (added so a table's search/length/pagination controls stay put
   while only the table itself scrolls sideways on narrow screens) wraps the
   table head/body in fixed-height, overflow:auto containers via inline
   styles DataTables sets at runtime. That overflow clips content when
   printed, so undo it for print — several report pages already rely on
   window.print() showing every row/column. */
@media print {
  .dt-scroll-body {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }
}

/* ── 9b. DataTables: card look ───────────────────────────────
   Every DataTable is drawn as a rounded card: accent-coloured header
   with white uppercase titles (like the main menu), borderless rows with a hover tint and an
   accent bar, pill badges, square pagination. Colours derive from the
   theme accent (--c-primary), so a tenant's accent carries through.
   Below 576px each row becomes a stacked card (labels come from the
   column headers via the draw.dt handler in app/layout/footer.php). */
:root {
  --dt-accent: var(--c-primary);
  --dt-accent-text: color-mix(in srgb, var(--c-primary) 85%, #000);
  --dt-head-bg: color-mix(in srgb, var(--c-primary) 12%, #fff);
  --dt-hover: color-mix(in srgb, var(--c-primary) 6%, #fff);
  --dt-border: color-mix(in srgb, var(--c-primary) 13%, #e8edf4);
  --dt-text: #1a2b4a;
  --dt-text-mid: #475569;
  --dt-text-light: #8a97ab;
  --dt-shadow: 0 4px 24px color-mix(in srgb, var(--c-primary) 9%, transparent), 0 1px 4px rgba(0, 0, 0, .04);
}
.dt-container {
  background: #fff;
  border: 1px solid var(--dt-border);
  border-radius: 18px;
  box-shadow: var(--dt-shadow);
  overflow: hidden;
}

/* Before a page's script has set its table up (the moment after the page
   first paints), the plain table would show briefly in Bootstrap's default
   look and then change. Tables marked .dt-table stay hidden until DataTables
   has set them up (it adds .dataTable), while an empty card in the final
   style holds their place. If the script never runs, the table appears
   anyway after 3 seconds. */
table.dt-table:not(.dataTable) {
  visibility: hidden;
  animation: dt-reveal 0s 3s forwards;
}
@keyframes dt-reveal { to { visibility: visible; } }
.card:has(> .p-2 > table.dt-table:not(.dataTable)),
.card:has(> .card-body > table.dt-table:not(.dataTable)) {
  background: transparent;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.card > .p-2:has(> table.dt-table:not(.dataTable)),
.card > .card-body:has(> table.dt-table:not(.dataTable)) {
  padding: 0 !important;
  min-height: 240px;
  max-height: 600px; /* long tables show 25 rows once set up */
  background: #fff;
  border: 1px solid var(--dt-border);
  border-radius: 18px;
  box-shadow: var(--dt-shadow);
  overflow: hidden;
  position: relative;
}
/* While it waits, the placeholder shows the product icon, gently pulsing; the
   table covers it once set up. The icon is app/brand.php's BRAND_ICON: if that
   changes, update this path (or set --brand-icon on :root). It fades out with
   the 3-second fallback so a table that appears anyway isn't drawn over it. */
.card > .p-2:has(> table.dt-table:not(.dataTable))::before,
.card > .card-body:has(> table.dt-table:not(.dataTable))::before {
  content: "";
  position: absolute;
  left: 50%;
  top: min(50%, 300px);
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  background: var(--brand-icon, url("../img/brand/renvi-icon.svg")) center / contain no-repeat;
  opacity: 0;
  animation: dt-wait-in .25s .08s ease-out forwards, dt-wait-pulse 1.4s .33s ease-in-out infinite, dt-wait-out .2s 3s forwards;
  pointer-events: none;
}
@keyframes dt-wait-in { to { opacity: .9; } }
@keyframes dt-wait-pulse { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(.92); opacity: .55; } }
@keyframes dt-wait-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .card > .p-2:has(> table.dt-table:not(.dataTable))::before,
  .card > .card-body:has(> table.dt-table:not(.dataTable))::before {
    animation: dt-wait-in .25s ease-out forwards, dt-wait-out .2s 3s forwards;
  }
}
/* The card a table sits in becomes plain, so there's one card, not two */
.card:has(> .p-2 > .dt-container:only-child),
.card:has(> .card-body > .dt-container:only-child) {
  background: transparent;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.card > .p-2:has(> .dt-container:only-child),
.card > .card-body:has(> .dt-container:only-child) { padding: 0 !important; }

/* Layout rows: controls on top, table edge to edge, info + paging below */
.dt-container > .row { margin: 0; --bs-gutter-x: 0; }
.dt-container > .row:first-child { padding: 14px 18px; gap: 10px; }
.dt-container > .row.dt-layout-table { margin-top: 0 !important; }
.dt-container > .row.dt-layout-table > div { padding: 0; }
.dt-container > .dt-layout-table ~ .row {
  margin-top: 0 !important;
  padding: 12px 18px;
  border-top: 1px solid var(--dt-border);
  gap: 10px;
}
.dt-container > .row > div { padding: 0; }

/* Controls */
.dt-container .dt-length,
.dt-container .dt-info { font-size: calc(12.5px * var(--ts, 1)); color: var(--dt-text-light); }
.dt-container .dt-length label { margin-left: 6px; }
.dt-container .dt-length select,
.dt-container .dt-search input {
  border: 1.5px solid var(--dt-border);
  border-radius: 6px;
  font-size: calc(13.5px * var(--ts, 1));
  color: var(--dt-text);
  box-shadow: none;
}
.dt-container .dt-search input {
  width: 260px;
  max-width: 100%;
  margin-left: 0 !important;
  padding: 7px 12px 7px 34px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='none' stroke='%2394A3B8' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 11px 50%;
}
.dt-container .dt-search label:empty { display: none; }
.dt-container .dt-length select:focus,
.dt-container .dt-search input:focus { border-color: var(--dt-accent); }
.dt-container .dt-search input::placeholder { color: var(--dt-text-light); }

/* Table */
.dt-container table.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: transparent;
  --bs-table-hover-bg: transparent;
  --bs-table-color: var(--dt-text);
  border-color: var(--dt-border);
  margin: 0 !important;
}
.dt-container table.table > :not(caption) > *,
.dt-container table.table > :not(caption) > * > * {
  border-width: 0;
  border-color: var(--dt-border);
}
.dt-container table.table > :not(caption) > * > * {
  --bs-table-bg-type: transparent;
  --bs-table-bg-state: transparent;
  box-shadow: none !important; /* also drops the DataTables stripe/hover shading */
}
.dt-container table.table > thead > tr > th {
  background: var(--c-primary) !important; /* same as the main menu's active item */
  color: #fff;
  font-size: calc(11.5px * var(--ts, 1));
  font-weight: 700;
  letter-spacing: .06em;
  padding: 13px 14px;
  border-top: 0;
  border-bottom: 1px solid var(--c-primary) !important;
}
/* Sort arrows: white, brighter than DataTables' default so they show on the accent */
.dt-container table.dataTable thead > tr > th span.dt-column-order::before,
.dt-container table.dataTable thead > tr > th span.dt-column-order::after { color: #fff; opacity: .45; }
.dt-container table.dataTable thead > tr > th.dt-ordering-asc span.dt-column-order::before,
.dt-container table.dataTable thead > tr > th.dt-ordering-desc span.dt-column-order::after { opacity: 1; }
.dt-container table.dataTable thead > tr > th.dt-orderable-asc:hover,
.dt-container table.dataTable thead > tr > th.dt-orderable-desc:hover {
  outline: 0;
  background: color-mix(in srgb, var(--c-primary) 86%, #000) !important; /* slightly darker on hover */
}
.dt-container table.table > tbody > tr > td {
  background: #fff;
  padding: 12px 14px;
  height: 58px;
  font-size: calc(13.5px * var(--ts, 1));
  border-bottom: 1px solid var(--dt-border);
}
.dt-container table.table > tbody > tr:last-child > td { border-bottom: 0; }
.dt-container table.table > tbody > tr:hover > td { background: var(--dt-hover); }
.dt-container table.table > tbody > tr:hover > td:first-child { box-shadow: inset 3px 0 0 var(--dt-accent) !important; }
/* Rows a page flags for attention (e.g. overdue rentals) keep an orange bar */
.dt-container table.table > tbody > tr.row-overdue > td:first-child { box-shadow: inset 3px 0 0 #fd7e14 !important; }
.dt-container table.table > tbody > tr > td.dt-empty { color: var(--dt-text-light); padding: 28px 18px; }

/* Pill badges inside tables (soft background, strong text, status dot) */
.dt-container .badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 99px;
  padding: 3px 10px;
  font-size: calc(11.5px * var(--ts, 1));
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: middle;
}
.dt-container .badge:not(:has(i, .bi))::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2.5px color-mix(in srgb, currentColor 20%, transparent);
  flex-shrink: 0;
}
.dt-container .badge.bg-success   { background: #dcfce7 !important; color: #15803d !important; }
.dt-container .badge.bg-danger    { background: #fee2e2 !important; color: #dc2626 !important; }
.dt-container .badge.bg-warning   { background: #fef3c7 !important; color: #b45309 !important; }
.dt-container .badge.bg-secondary { background: #f1f5f9 !important; color: #64748b !important; }
.dt-container .badge.bg-info      { background: #e0f2fe !important; color: #0369a1 !important; }
.dt-container .badge.bg-primary   { background: var(--dt-head-bg) !important; color: var(--dt-accent-text) !important; }

/* Pagination: separate square buttons */
.dt-container .dt-paging .pagination { gap: 4px; margin: 0; flex-wrap: wrap; }
.dt-container .dt-paging .page-link {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--dt-border);
  border-radius: 6px !important;
  margin: 0 !important;
  background: #fff;
  color: var(--dt-text-mid);
  font-size: calc(13px * var(--ts, 1));
  font-weight: 500;
  box-shadow: none;
}
.dt-container .dt-paging .page-link:hover { border-color: var(--dt-accent); color: var(--dt-accent); background: #fff; }
.dt-container .dt-paging .page-item.active .page-link { background: var(--dt-accent); border-color: var(--dt-accent); color: #fff; }
.dt-container .dt-paging .page-item.disabled .page-link { opacity: .4; }

/* Phones: each row becomes a stacked card */
@media (max-width: 575.98px) {
  .dt-container { border-radius: 14px; }
  .dt-container > .row:first-child { padding: 12px 14px; }
  .dt-container .dt-search,
  .dt-container .dt-search input { width: 100%; }
  .dt-container .dt-scroll-head,
  .dt-container table.dataTable > thead,
  .dt-container table.dataTable > colgroup { display: none !important; }
  .dt-container .dt-scroll-body { overflow: visible !important; height: auto !important; max-height: none !important; }
  .dt-container table.dataTable,
  .dt-container table.dataTable > tbody { display: block; width: 100% !important; }
  /* Each record is its own card on a pale background, with space between */
  .dt-container table.dataTable { border-collapse: separate !important; border-spacing: 0; }
  .dt-container table.dataTable > tbody { background: var(--dt-head-bg); padding: 10px 10px 2px; }
  .dt-container table.dataTable > tbody > tr {
    display: block;
    margin: 0 0 10px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--dt-border) !important;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
  }
  .dt-container table.dataTable > tbody > tr:last-child { border-bottom: 1px solid var(--dt-border) !important; }
  .dt-container table.dataTable > tbody > tr:hover { background: #fff; border-color: var(--dt-accent) !important; }
  /* Overdue / unpaid: an orange stripe down the card's whole left edge, text set in from it */
  .dt-container table.dataTable > tbody > tr.row-overdue {
    border-left: 5px solid #fd7e14 !important;
    padding-left: 13px;
  }
  .dt-container table.dataTable > tbody > tr.row-overdue > td { border-left: 0 !important; }
  /* the desktop rows' first-cell markers: the card's stripe and border replace them */
  .dt-container table.dataTable > tbody > tr.row-overdue > td:first-child,
  .dt-container table.dataTable > tbody > tr:hover > td:first-child { box-shadow: none !important; }
  .dt-container table.dataTable > tbody > tr > td {
    display: block;
    position: relative;
    height: auto;
    min-height: 25px;
    padding: 3px 0 3px 40% !important;
    border: 0 !important;
    text-align: left !important;
    white-space: normal;
    background: transparent !important;
    box-shadow: none !important;
  }
  .dt-container table.dataTable > tbody > tr > td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 5px;
    width: calc(40% - 10px);
    font-size: calc(10.5px * var(--ts, 1));
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--dt-text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* First column is the card's title; empty labels and button cells get the full width */
  .dt-container table.dataTable > tbody > tr > td:first-child { padding-left: 0 !important; font-weight: 600; font-size: calc(14px * var(--ts, 1)); margin-bottom: 4px; }
  .dt-container table.dataTable > tbody > tr > td:first-child::before,
  .dt-container table.dataTable > tbody > tr > td[data-label=""]::before,
  .dt-container table.dataTable > tbody > tr > td:not([data-label])::before { display: none; }
  .dt-container table.dataTable > tbody > tr > td[data-label=""],
  .dt-container table.dataTable > tbody > tr > td:not([data-label]) { padding-left: 0 !important; }
  .dt-container table.dataTable > tbody > tr > td:has(.btn) { padding-top: 8px !important; }
  .dt-container table.dataTable > tbody > tr > td.dt-empty { padding: 20px 0 !important; text-align: center !important; }
  .dt-container > .dt-layout-table ~ .row { flex-direction: column; align-items: center; }
}
@media print {
  .dt-container { box-shadow: none; border-radius: 0; }
}

/* ── 10. Badges ──────────────────────────────────────────────── */
.badge {
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 4px 8px;
  border-radius: 4px;
}

/* ── 11. Alerts ──────────────────────────────────────────────── */
.alert {
  border-radius: var(--r-md);
  font-size: calc(13.5px * var(--ts, 1));
}

/* ── 12. List group ──────────────────────────────────────────── */
.list-group-item {
  border-color: rgba(222, 226, 230, 0.7);
  font-size: calc(13.5px * var(--ts, 1));
  padding: 10px 16px;
}

.list-group-item:first-child {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.list-group-item:last-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* ── 13. Progress bars ───────────────────────────────────────── */
.progress {
  background-color: #e9ecef;
  border-radius: 4px;
}

.progress-bar {
  border-radius: 4px;
  transition: width 0.6s ease;
}

.progress-bar.bg-success {
  background-color: var(--c-success) !important;
}

/* ── 14. bg-dark override (modal scan button etc) ────────────── */
.bg-dark {
  --bs-bg-opacity: 1;
  background-color: var(--c-primary) !important;
  border: 1px solid var(--c-primary) !important;
}

/* ── 15. Footer ──────────────────────────────────────────────── */
.site-footer {
  background-color: var(--c-paper);
  border-top: 3px solid var(--c-border);
  margin-top: 40px;
  padding-top: 28px;
}

.site-footer .footer-brand strong {
  font-size: calc(1.05rem * var(--ts, 1));
  font-weight: 700;
  color: var(--c-primary);
  font-family: "Rubik", sans-serif;
}

.site-footer .footer-brand .brand-sub {
  font-weight: 400;
  color: var(--c-text-secondary);
  letter-spacing: 0.12em;
  font-size: 0.9em;
}

.site-footer .footer-heading {
  font-size: calc(10.5px * var(--ts, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-text-secondary);
  margin-bottom: 10px;
}

.site-footer .footer-link {
  color: var(--c-text-secondary);
  font-size: calc(12.5px * var(--ts, 1));
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 0;
  transition: color 0.15s ease;
}

.site-footer .footer-link::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--c-primary);
  flex-shrink: 0;
}

.site-footer .footer-link:hover {
  color: var(--c-primary-400);
}

.site-footer .footer-divider {
  border-color: var(--c-primary);
  border-width: 1px;
  opacity: 1;
  margin: 20px 0 0;
}

.site-footer .footer-bottom {
  padding: 12px 0;
  font-size: calc(12px * var(--ts, 1));
  color: var(--c-text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── 16. Modals ──────────────────────────────────────────────── */
.modal-content {
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: 0px 20px 40px -10px rgba(0, 0, 0, 0.15);
}

.modal-header {
  border-bottom: 1px solid var(--c-border);
  padding: 14px 20px;
}

.modal-footer {
  border-top: 1px solid var(--c-border);
  padding: 12px 20px;
}

/* ── 17. Buttons — size */
.btn-group-sm > .btn,
.btn-sm {
  margin: 2px;
  font-size: calc(12px * var(--ts, 1));
  padding: 4px 10px;
  border-radius: var(--r-sm);
}

/* ── 18. Nav tabs (used in DL scanner modal) ─────────────────── */
.nav-tabs {
  border-bottom: 1px solid var(--c-border);
}

.nav-tabs .nav-link {
  color: var(--c-text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 14px;
  font-size: calc(13px * var(--ts, 1));
  font-weight: 500;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.nav-tabs .nav-link:hover {
  color: var(--c-primary);
  border-color: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
  background: none;
}

/* ── 19. Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--c-bg);
}
::-webkit-scrollbar-thumb {
  background: #c1c9d6;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--c-text-secondary);
}

/* Extras table (rental_new / rental_edit): on narrow screens the table would
   squeeze its controls until their values are unreadable. Give them a floor
   so .table-responsive scrolls sideways instead. */
.extras-table select[name$="[pricing_mode]"] { min-width: 6.5rem; }
.extras-table select[name$="[is_taxable]"]   { min-width: 5.5rem; }
.extras-table input[name$="[rate]"]          { min-width: 6.5rem; }
.extras-table input[name$="[quantity]"]      { min-width: 4.5rem; }
.extras-table td:nth-child(3)                { min-width: 8rem; }

/* ── 20. Responsive ──────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .card-body {
    padding: 14px;
  }
  main.container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .site-topbar .topbar-user .user-chip span:not(.bi) {
    display: none;
  }
}

/* Coloured column headings (e.g. Collected in green, Outstanding in red):
   a thin white outline keeps them readable on a dark accent header */
thead th.text-success,
thead th.text-danger,
thead th.text-warning {
  text-shadow:
    -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff,
    0 -1px 0 #fff, 0 1px 0 #fff, -1px 0 0 #fff, 1px 0 0 #fff;
}
@media print {
  thead th.text-success, thead th.text-danger, thead th.text-warning { text-shadow: none; }
}

/* Printing tables: assets/js/print_tables.js swaps each DataTable for a
   plain full-width copy (all matching rows) with a line saying which
   search and filters are applied. */
.rv-print-holder { display: none; }
@media print {
  .rv-print-hide { display: none !important; }
  .rv-print-holder { display: block !important; margin-bottom: 10px; }
  .rv-print-criteria {
    display: block; background: #f3f3f3; border: 1px solid #ccc; border-radius: 3px;
    padding: 4px 10px; font-size: 9pt; margin: 0 0 8px; color: #222;
  }
  .rv-print-criteria .rv-pc-l { color: #555; }
  table.rv-print-table {
    width: 100% !important; max-width: 100% !important; table-layout: auto;
    visibility: visible !important; display: table !important;
    border-collapse: collapse; font-size: 8.5pt; margin: 0;
  }
  table.rv-print-table th, table.rv-print-table td {
    padding: 3px 5px !important; word-break: normal; overflow-wrap: anywhere; white-space: normal !important;
    border-bottom: 1px solid #d9dee6;
  }
  table.rv-print-table thead th {
    background: var(--c-primary, #3390cc) !important; color: #fff !important;
    font-size: 7.5pt; text-transform: uppercase; letter-spacing: .02em;
  }
  table.rv-print-table thead { display: table-header-group; }
  table.rv-print-table tfoot { display: table-row-group; }
  table.rv-print-table tfoot td, table.rv-print-table tfoot th { font-weight: 700; background: #f3f5f8 !important; border-top: 2px solid #c8d0db; }
  table.rv-print-table tr { break-inside: avoid; page-break-inside: avoid; }
  table.rv-print-table .btn, table.rv-print-table .no-print { display: none !important; }
}

/* ── Report drill-downs (app/report_drill.php, assets/js/report_drill.js) ──
   A row with a round chevron opens a panel beneath it; rows inside a panel
   with a small chevron open again, in place. */
tr.drill-row { cursor: pointer; }
tr.drill-row:hover > td { background: color-mix(in srgb, var(--c-primary, #3390cc) 7%, #fff) !important; }
tr.drill-row.drill-open > td { background: color-mix(in srgb, var(--c-primary, #3390cc) 11%, #fff) !important; font-weight: 600; }
.drill-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; padding: 0; margin-right: .45rem; vertical-align: middle;
  border-radius: 50%; border: 1px solid #ced4da; background: #fff;
  color: var(--c-primary, #3390cc); font-size: calc(.7rem * var(--ts, 1));
}
.drill-toggle:focus-visible { outline: 2px solid var(--c-primary, #3390cc); outline-offset: 2px; }
.drill-toggle i, .drill-chev { display: inline-block; transition: transform .15s ease; }
tr.drill-open > td .drill-toggle i, tr.drill-sub.drill-open .drill-chev { transform: rotate(90deg); }
.drill-chev { color: var(--c-primary, #3390cc); font-size: calc(.75rem * var(--ts, 1)); }
td.drill-cell { background: #f8f9fb !important; padding: .5rem .75rem .75rem 2.4rem !important; text-align: left; white-space: normal; }
.drill { border-left: 3px solid color-mix(in srgb, var(--c-primary, #3390cc) 55%, #fff); padding: .35rem 0 .2rem .85rem; }
.drill .drill { border-left-color: #adb5bd; }
.drill-title { font-size: calc(.82rem * var(--ts, 1)); font-weight: 600; margin-bottom: .35rem; }
.drill-note { font-size: calc(.72rem * var(--ts, 1)); color: #6c757d; }
.drill table { background: #fff; font-size: calc(.82rem * var(--ts, 1)); margin-bottom: .25rem; }
.drill table thead th { font-size: calc(.72rem * var(--ts, 1)); text-transform: uppercase; letter-spacing: .03em; color: #6c757d; font-weight: 600; background: #fff !important; }
.drill table tfoot td { background: #fafbfc; }
tr.drill-sub { cursor: pointer; }
tr.drill-sub:hover > td, tr.drill-sub:focus > td { background: color-mix(in srgb, var(--c-primary, #3390cc) 6%, #fff); }
tr.drill-sub.drill-open > td { background: color-mix(in srgb, var(--c-primary, #3390cc) 10%, #fff); font-weight: 600; }
tr.drill-sub:focus { outline: 2px solid var(--c-primary, #3390cc); outline-offset: -2px; }
tr.drill-sub-detail > td { background: #fbfcfd; padding: .4rem .5rem .6rem 1.8rem; }
.drill-loading { font-size: calc(.8rem * var(--ts, 1)); color: #6c757d; padding: .35rem 0; }
.drill-hint { font-size: calc(.8rem * var(--ts, 1)); color: #6c757d; }
.drill-hint .drill-toggle { width: 1.15rem; height: 1.15rem; margin: 0 .15rem; }
@media print {
  .drill-toggle, .drill-hint { display: none !important; }
}
/* Keeps names lined up in rows that have nothing to open */
.drill-spacer { display: inline-block; width: 1.35rem; margin-right: .45rem; vertical-align: middle; }
.drill.drill-pinned { position: sticky; left: 2.4rem; overflow-x: auto; }

/* Branch colours (app/branches.php branch_color()): a stripe on list rows */
tr.branch-striped > td:first-child,
.dt-container table.table > tbody > tr.branch-striped:hover > td:first-child { box-shadow: inset 4px 0 0 var(--branch-color, transparent) !important; }
@media (max-width: 575.98px) {
  .dt-container table.dataTable > tbody > tr.branch-striped { border-left: 4px solid var(--branch-color) !important; }
}
.branch-legend .badge { font-weight: 600; }

/* Pills (e.g. the Company / branch tabs on Settings) follow the accent colour,
   not Bootstrap's fixed blue */
.nav-pills {
  --bs-nav-pills-link-active-bg: var(--c-primary);
  --bs-nav-link-color: var(--c-primary);
  --bs-nav-link-hover-color: var(--c-primary-dark, var(--c-primary));
}
/* Branch badges: a soft tint of the branch's colour with the colour itself as
   text, a hairline border and a dot (or the house icon on your own branch).
   Same size everywhere, including next to page headings. */
.badge.branch-pill {
  --bp: var(--branch-color, #6c757d);
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 7px !important;
  font-size: calc(11.5px * var(--ts, 1)) !important;
  font-weight: 600 !important;
  line-height: 1.5;
  letter-spacing: .01em;
  vertical-align: middle;
  white-space: nowrap;
  border-radius: 99px !important;
  background: color-mix(in srgb, var(--bp) 10%, #fff) !important;
  color: color-mix(in srgb, var(--bp) 88%, #000) !important;
  border: 1px solid color-mix(in srgb, var(--bp) 28%, #fff) !important;
  box-shadow: none !important;
}
.badge.branch-pill::before { display: none; }
.badge.branch-pill:not(:has(i, .bi))::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--bp) !important;
  box-shadow: none !important;
}
.badge.branch-pill > .bi { font-size: calc(10.5px * var(--ts, 1)); margin-right: 0 !important; color: var(--bp); }
h1 .badge.branch-pill, h2 .badge.branch-pill, h3 .badge.branch-pill,
h4 .badge.branch-pill, h5 .badge.branch-pill { margin-left: .4rem; position: relative; top: -2px; }

/* ── Rental terms (app/terms.php): signing page and the Rental Terms editor ── */
.terms-body { font-size: calc(.875rem * var(--ts, 1)); line-height: 1.45; }
.terms-body h3 { font-size: 1em; font-weight: 700; margin: .7rem 0 .15rem; }
.terms-body h3:first-child { margin-top: 0; }
.terms-body p { margin: 0 0 .45rem; }
.terms-body ul, .terms-body ol { margin: 0 0 .45rem; padding-left: 1.4rem; }
.terms-body li { margin: 0 0 .15rem; }
.terms-body .t-small, .terms-body font[size="1"], .terms-body font[size="2"] { font-size: .85em; }
.terms-body .t-large, .terms-body font[size="4"], .terms-body font[size="5"], .terms-body font[size="6"], .terms-body font[size="7"] { font-size: 1.25em; }
.terms-body font[size="3"] { font-size: 1em; }

/* ── "Admin only" / "Owner only" hints (role_badge(), role_mark() in app/helpers.php) ── */
.role-badge { display: inline-flex; align-items: center; gap: .25em; padding: .15em .45em; border-radius: .35rem; font-size: calc(.7rem * var(--ts, 1)); font-weight: 600; line-height: 1.2; vertical-align: middle; white-space: nowrap; cursor: help; }
.role-badge .bi { font-size: .9em; }
.role-badge-admin { color: #fff; background: #dc3545; }
.role-badge-owner { color: #fff; background: #212529; }
.role-mark { font-size: .75em; vertical-align: super; margin-left: .2em; cursor: help; }
.role-mark-admin { color: #dc3545; }
.role-mark-owner { color: #212529; }
/* Icon buttons: a shield in the top-right corner */
.btn-role-admin, .btn-role-owner { position: relative; }
.btn-role-admin::after, .btn-role-owner::after {
  content: "\f537"; font-family: "bootstrap-icons"; position: absolute; top: -.45em; right: -.45em;
  font-size: calc(.62rem * var(--ts, 1)); line-height: 1; padding: .12em; border-radius: 50%; background: #fff; pointer-events: none;
}
.btn-role-admin::after { color: #dc3545; }
.btn-role-owner::after { color: #212529; }
.dropdown-item .role-badge { margin-left: .4rem; font-size: calc(.62rem * var(--ts, 1)); }

/* ── Text size control (app/layout/header.php) ─────────────────────────
   A− / 100% / A+ in the bottom-left corner of every page. Only the text
   grows: --ts multiplies every font size, while widths, spacing and the
   layout stay as they are. The top menu bar's own labels keep their size.
   The header's script stops before the page would scroll sideways (or the
   menu bar would wrap). The size is kept in the
   browser (localStorage); printing always uses normal size.

   Font sizes in this app are written as calc(<size> * var(--ts, 1)), so a
   new one should be too. Sizes in em follow their parent and need nothing.
   Bootstrap's own sizes are scaled at the top of this file ("1b"). */
.text-size-ctl {
  position: fixed; left: 10px; bottom: 10px; z-index: 1030;
  display: flex; align-items: stretch;
  background: rgba(255, 255, 255, .92); border: 1px solid rgba(0, 0, 0, .15);
  border-radius: 999px; box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  opacity: .55; transition: opacity .15s;
  font-family: inherit; font-size: 13px; line-height: 1;
}
.text-size-ctl:hover, .text-size-ctl:focus-within, .text-size-ctl.is-big { opacity: 1; }
.text-size-ctl button {
  border: 0; background: transparent; color: #343a40; cursor: pointer;
  min-width: 34px; height: 30px; padding: 0 8px; font-weight: 600; font-size: 13px;
}
.text-size-ctl button sup { font-size: .7em; top: -.5em; }
.text-size-ctl .ts-big { font-size: 16px; }
.text-size-ctl .ts-now { min-width: 46px; font-weight: 400; font-size: 11px; color: #6c757d; border-left: 1px solid rgba(0,0,0,.1); border-right: 1px solid rgba(0,0,0,.1); }
.text-size-ctl button:first-child { border-radius: 999px 0 0 999px; }
.text-size-ctl button:last-child { border-radius: 0 999px 999px 0; }
.text-size-ctl button:hover:not(:disabled) { background: rgba(13, 110, 253, .1); color: #0d6efd; }
.text-size-ctl button:disabled { opacity: .35; cursor: default; }

/* ── Drag to scroll wide tables (assets/js/drag_scroll.js) ─────────────── */
.drag-scroll-ready { cursor: grab; }
.drag-scroll-ready a, .drag-scroll-ready th.sorting, .drag-scroll-ready th.sorting_asc, .drag-scroll-ready th.sorting_desc { cursor: pointer; }
html.drag-scrolling, html.drag-scrolling * { cursor: grabbing !important; user-select: none !important; }
