/* public/assets/css/app.css f8f9fa */
body { background-color: #fffafa; }

/* Amber color utilities (used for reminder icons/timestamps) */
.text-amber { color: #b76e00 !important; }
.icon-amber { color: #b76e00 !important; }

/* Brand colour utility (for icons/text using primary brand colour) */
.text-brand-primary { color: var(--brand-primary, #660708) !important; }

/* Fixed-width numeric badges for counts */
.badge-count {
  width: 2.8ch; /* more breathing room for 2 digits */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  line-height: 1.1;
  font-variant-numeric: tabular-nums; /* align digits evenly */
  box-sizing: content-box; /* padding won't change width */
  font-size: .8rem; /* slightly larger for readability */
  font-weight: 600;
}

/* Normalize action button groups across lists (anchors + forms together) */
.actions-group {
  display: inline-flex;
  gap: 0; /* rely on borders to separate */
}
/* Allow buttons inside forms to behave like direct children of the group */
.actions-group form {
  display: contents; /* so the button becomes a direct child for rounded corners */
  margin: 0 !important;
}
/* Ensure contiguous borders and correct rounding regardless of whitespace/text nodes */
/* Base: make all action buttons square by default */
.actions-group a.btn,
.actions-group button.btn { border-radius: 0 !important; }

/* Apply overlap to all except the very first button */
.actions-group a.btn,
.actions-group button.btn { margin-left: -1px; }
.actions-group > a.btn:first-child { margin-left: 0; }
.actions-group > button.btn:first-child { margin-left: 0; }
.actions-group > form:first-child > .btn { margin-left: 0; }

/* Left rounding for the first button (anchor or form>button) */
.actions-group > a.btn:first-child,
.actions-group > button.btn:first-child {
  border-top-left-radius: .375rem !important;
  border-bottom-left-radius: .375rem !important;
}
.actions-group > form:first-child > .btn {
  border-top-left-radius: .375rem !important;
  border-bottom-left-radius: .375rem !important;
}

/* Right rounding for the last button (anchor or form>button) */
.actions-group > a.btn:last-child,
.actions-group > button.btn:last-child {
  border-top-right-radius: .375rem !important;
  border-bottom-right-radius: .375rem !important;
}
.actions-group > form:last-child > .btn {
  border-top-right-radius: .375rem !important;
  border-bottom-right-radius: .375rem !important;
}

/* --- Login page enhancements --- */
.full-bleed { /* let a section extend edge-to-edge inside a centered container */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}
.login-hero {
  /* Let global blobs (body.blobs-bg) be visible */
  background: transparent !important;
  position: relative;
  overflow: visible;
}

/* Remove any background/shadow from wrappers inside the hero */
.login-hero > .container,
.login-hero > .container > .row,
.login-hero > .container > .row > [class^="col-"],
.login-hero > .container > .row > [class*=" col-"] {
  background: transparent !important;
  box-shadow: none !important;
}

.auth-card {
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(102,7,8,.08), 0 2px 10px rgba(0,0,0,.04);
  transform: translateY(8px);
  opacity: 0;
  animation: floatIn .7s ease forwards;
}

/* Full logo on the sign-in pages: the logo tile with the business name beside it (2.20.0). */
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .75rem; }
.auth-brand img { height: 56px; width: auto; border-radius: 22%; }
.auth-brand-name { font-size: 2rem; font-weight: 700; letter-spacing: .02em; color: var(--brand-primary, #660708); line-height: 1; }
@media (max-width: 575.98px) {
  .auth-brand img { height: 44px; }
  .auth-brand-name { font-size: 1.6rem; }
}
.login-icon {
  font-size: 3rem; /* requires bootstrap-icons in layout */
  line-height: 1;
  display: inline-block;
  background: linear-gradient(135deg, var(--brand-primary, #660708), var(--brand-accent, #a4161a));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 12px rgba(102,7,8,.25));
}

.btn-glow {
  position: relative;
  box-shadow: 0 8px 18px rgba(102,7,8,.25);
  transition: transform .15s ease, box-shadow .2s ease;
}
.btn-glow:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(102,7,8,.35); }
.btn-glow:active { transform: translateY(0); box-shadow: 0 6px 14px rgba(102,7,8,.2); }

@keyframes floatIn {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .auth-card { animation: none; opacity: 1; transform: none; }
  .btn-glow { transition: none; }
}

/* Decorative blobs inspired by marketing pages (global) */
.blobs-bg::before,
.blobs-bg::after {
  content: '';
  position: fixed;
  width: 432px; /* +20% */
  height: 432px; /* +20% */
  border-radius: 50%;
  filter: blur(30px);
  opacity: .35;
  z-index: 0;
  pointer-events: none;
}
.blobs-bg::before {
  left: -144px;   /* -120 * 1.2 */
  bottom: -72px;  /* -60 * 1.2 */
  background: radial-gradient(circle at 30% 30%, var(--brand-primary, #660708), rgba(102,7,8,0) 60%),
              radial-gradient(circle at 70% 70%, var(--brand-accent, #a4161a), rgba(164,22,26,0) 60%),
              linear-gradient(135deg, var(--brand-primary, #660708), var(--brand-accent, #a4161a));
}
.blobs-bg::after {
  right: -120px;  /* -100 * 1.2 */
  top: 12px;      /* 10 * 1.2 */
  background: radial-gradient(circle at 30% 30%, var(--brand-accent, #a4161a), rgba(164,22,26,0) 60%),
              radial-gradient(circle at 70% 70%, var(--brand-primary, #660708), rgba(102,7,8,0) 60%),
              linear-gradient(135deg, var(--brand-accent, #a4161a), var(--brand-primary, #660708));
}

/* Ensure content renders above global blobs */
main { position: relative; z-index: 1; }
/* Navbar and dropdowns should be above main content */
/* Do not force a position on .navbar so Bootstrap's .sticky-top can work */
.navbar { z-index: 1040; }
/* Ensure sticky navbar actually stays sticky even if other rules try to override */
.navbar.sticky-top { position: sticky; top: 0; }
.dropdown-menu { z-index: 1050; }

/* Brand-styled button and pill shape */
.btn-brand {
  color: #fff;
  background-image: linear-gradient(135deg, var(--brand-primary, #660708) 0%, var(--brand-accent, #a4161a) 100%);
  border: 0;
}
.btn-brand:hover { color:#fff; background-image: linear-gradient(135deg, color-mix(in oklab, var(--brand-primary, #660708), #000 10%) 0%, color-mix(in oklab, var(--brand-accent, #a4161a), #000 10%) 100%); }
.btn-brand:active { color:#fff; background-image: linear-gradient(135deg, color-mix(in oklab, var(--brand-primary, #660708), #000 18%) 0%, color-mix(in oklab, var(--brand-accent, #a4161a), #000 18%) 100%); }
.btn-brand:focus { box-shadow: 0 0 0 .25rem color-mix(in oklab, var(--brand-primary, #660708), transparent 70%); }

.btn-pill { border-radius: 999px; }

/* Every action button follows the Branding colours (owner rule, 2.19.2). Bootstrap colours buttons per
   class through --bs-btn-* variables, so they are set here. Red (danger) and amber (warning) keep their
   colours so destructive and risky actions stand out; grey (secondary) stays for neutral actions such as
   Cancel and Back. */
.btn-primary, .btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--brand-primary, #660708);
  --bs-btn-border-color: var(--brand-primary, #660708);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: color-mix(in oklab, var(--brand-primary, #660708), #000 12%);
  --bs-btn-hover-border-color: color-mix(in oklab, var(--brand-primary, #660708), #000 14%);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: color-mix(in oklab, var(--brand-primary, #660708), #000 18%);
  --bs-btn-active-border-color: color-mix(in oklab, var(--brand-primary, #660708), #000 20%);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--brand-primary, #660708);
  --bs-btn-disabled-border-color: var(--brand-primary, #660708);
  --bs-btn-focus-shadow-rgb: var(--brand-primary-rgb, 102, 7, 8);
}
.btn-outline-primary, .btn-outline-success, .btn-outline-dark {
  --bs-btn-color: var(--brand-primary, #660708);
  --bs-btn-border-color: var(--brand-primary, #660708);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--brand-primary, #660708);
  --bs-btn-hover-border-color: var(--brand-primary, #660708);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: color-mix(in oklab, var(--brand-primary, #660708), #000 12%);
  --bs-btn-active-border-color: color-mix(in oklab, var(--brand-primary, #660708), #000 12%);
  --bs-btn-disabled-color: var(--brand-primary, #660708);
  --bs-btn-disabled-border-color: var(--brand-primary, #660708);
  --bs-btn-focus-shadow-rgb: var(--brand-primary-rgb, 102, 7, 8);
}
/* Bootstrap 5.3 writes its blue straight into these components instead of reading --bs-primary, so the
   brand colour is set on each (2.19.3): selected tabs (pills), the current page, selected list items,
   ticked boxes and switches, focus rings, progress bars and the selected dropdown item. */
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand-primary, #660708); }
.pagination {
  --bs-pagination-active-bg: var(--brand-primary, #660708);
  --bs-pagination-active-border-color: var(--brand-primary, #660708);
  --bs-pagination-focus-box-shadow: 0 0 0 .25rem rgba(var(--brand-primary-rgb, 102, 7, 8), .25);
}
.list-group {
  --bs-list-group-active-bg: var(--brand-primary, #660708);
  --bs-list-group-active-border-color: var(--brand-primary, #660708);
}
.dropdown-menu { --bs-dropdown-link-active-bg: var(--brand-primary, #660708); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--brand-primary, #660708); }
.form-check-input:checked {
  background-color: var(--brand-primary, #660708);
  border-color: var(--brand-primary, #660708);
}
.form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--brand-primary, #660708);
  border-color: var(--brand-primary, #660708);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: color-mix(in oklab, var(--brand-primary, #660708), #fff 50%);
  box-shadow: 0 0 0 .25rem rgba(var(--brand-primary-rgb, 102, 7, 8), .25);
}
/* 2.19.4, the rest of Bootstrap's built-in blue: the switch knob while focused (Bootstrap draws it light
   blue; the normal grey knob is used instead), keyboard focus on menu links, close buttons and
   accordions, highlighted table rows and range sliders. */
.form-switch .form-check-input:focus:not(:checked) {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
}
.nav-link:focus-visible { box-shadow: 0 0 0 .25rem rgba(var(--brand-primary-rgb, 102, 7, 8), .25); }
.btn-close { --bs-btn-close-focus-shadow: 0 0 0 .25rem rgba(var(--brand-primary-rgb, 102, 7, 8), .25); }
.accordion { --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem rgba(var(--brand-primary-rgb, 102, 7, 8), .25); }
.table-primary { --bs-table-bg: var(--bs-primary-bg-subtle); }
.form-range::-webkit-slider-thumb { background-color: var(--brand-primary, #660708); }
.form-range::-moz-range-thumb { background-color: var(--brand-primary, #660708); }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 1px #fff, 0 0 0 .25rem rgba(var(--brand-primary-rgb, 102, 7, 8), .25); }
.form-range:focus::-moz-range-thumb { box-shadow: 0 0 0 1px #fff, 0 0 0 .25rem rgba(var(--brand-primary-rgb, 102, 7, 8), .25); }
.btn-link {
  --bs-btn-color: var(--brand-primary, #660708);
  --bs-btn-hover-color: color-mix(in oklab, var(--brand-primary, #660708), #000 15%);
  --bs-btn-active-color: color-mix(in oklab, var(--brand-primary, #660708), #000 15%);
  --bs-btn-focus-shadow-rgb: var(--brand-primary-rgb, 102, 7, 8);
}

/* --- Operations page: collapse toggle arrow icons --- */
/* --- Also used in permissions page --- */
.inv-toggle .icon-collapse::before { content: "▼"; display: inline-block; }
.inv-toggle[aria-expanded="true"] .icon-collapse::before { content: "▲"; }

/* --- App shell and sidebar layout (moved from layout inline styles) --- */
.app-shell { display: flex; min-height: 100vh; width: 100%; }
.app-sidebar {
  width: 260px; flex: 0 0 260px;
  background: linear-gradient(180deg, var(--brand-primary, #660708) 0%, color-mix(in oklab, var(--brand-primary, #660708), #000 35%) 100%);
  color: #fff; position: sticky; top: 0; height: 100vh;
  box-shadow: 0 0 30px rgba(0,0,0,.15);
  display: flex; flex-direction: column; /* allow footer to push to bottom */
  z-index: 1051; /* ensure flyout submenus overlay main content */
}
.app-sidebar.collapsed { width: 72px; flex-basis: 72px; }
.app-sidebar .brand { height: 56px; display:flex; align-items:center; gap:.5rem; padding: 0 1rem; border-bottom: 1px solid rgba(255,255,255,.15); }
/* The logo tile is maroon like the sidebar, so a light outline keeps its edge visible.
   The radius matches the tile's corners (112 of 512). */
.app-sidebar .brand img { height: 28px; width: auto; border-radius: 22%; box-shadow: 0 0 0 1.5px rgba(255,255,255,.6); }
.app-sidebar .brand-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-sidebar .nav-section {
  padding: .75rem .5rem;
  flex: 1 1 auto;           /* take remaining space between brand and footer */
  min-height: 0;            /* allow flex child to shrink for overflow */
  overflow-y: auto;         /* scroll instead of pushing past viewport */
  -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
}
.app-sidebar .menu { list-style: none; margin: 0; padding: 0; }
.app-sidebar .menu > li > a { color: rgba(255,255,255,.95); display:flex; align-items:center; gap:.5rem; padding: .5rem .75rem; border-radius: .375rem; text-decoration:none; }
.app-sidebar .menu > li > a:hover { background: rgba(255,255,255,.12); }
.app-sidebar .menu > li > a.active {
  background: var(--brand-accent, #a4161a);
  color: #fff;
}
.app-sidebar .menu .submenu { list-style:none; padding-left: .5rem; margin: .25rem 0 .5rem; }
.app-sidebar .menu .submenu a { color: rgba(255,255,255,.85); display:block; padding:.375rem .75rem; border-radius:.375rem; text-decoration:none; }
.app-sidebar .menu .submenu a:hover { background: rgba(255,255,255,.1); }
.app-sidebar .menu .submenu li.emp-sub { margin-left: 16px; }
/* Financials submenu indentation (Reports/Settings subitems) */
.app-sidebar .menu .submenu li.fin-sub { margin-left: 16px; }
/* Reports submenu indentation (grouped report subitems) */
.app-sidebar .menu .submenu li.rep-sub { margin-left: 16px; }
.app-sidebar .menu .submenu a.active {
  background: color-mix(in oklab, var(--brand-accent, #a4161a), #000 10%);
  color: #fff;
}
.app-sidebar .section-title { font-size: .75rem; letter-spacing:.08em; opacity:.7; padding:.25rem .75rem; text-transform: uppercase; }
.app-sidebar .footer { margin-top:auto; padding: .75rem; border-top: 1px solid rgba(255,255,255,.15); }
.app-sidebar .version { font-size: .75rem; opacity: .8; }
.app-sidebar .version .ver-full { display: none; }
.app-sidebar:not(.collapsed) .version .ver-full { display: inline; }
.app-sidebar:not(.collapsed) .version .ver-short { display: none; }
.sidebar-toggle { border: 0; color:#fff; background: transparent; width: 36px; height:36px; display:inline-flex; align-items:center; justify-content:center; border-radius: .5rem; }
.sidebar-toggle:hover { background: rgba(255,255,255,.12); }
.content-wrap { flex: 1 1 auto; min-width: 0; }

/* Top navbar: same colour as the top of the sidebar, holding the menu toggle, page title,
   business name and user menu. Page titles move here from the page body (PageTitle helper). */
.app-topbar {
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center; gap: .75rem;
  min-height: 56px; padding: .5rem 1rem;
  background: var(--brand-primary, #660708); color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.app-topbar-title {
  flex: 1 1 auto; min-width: 0; margin: 0;
  font-size: 1.125rem; font-weight: 600; line-height: 1.3; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-topbar-end { flex: 0 0 auto; display: flex; align-items: center; gap: .75rem; }
.app-topbar-btn {
  display: inline-flex; align-items: center;
  padding: .25rem .6rem; border: 1px solid rgba(255,255,255,.4); border-radius: .375rem;
  background: transparent; color: #fff; text-decoration: none; font-size: 1rem; line-height: 1.5;
  transition: background-color .15s ease;
}
.app-topbar-btn:hover, .app-topbar-btn:focus { background: rgba(255,255,255,.14); color: #fff; }
.app-topbar-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.app-topbar-btn .bi-list { font-size: 1.35rem; line-height: 1; }
/* Right side (2.25.4, owner's choice "one profile block"): a rounded block with initials, the user's
   name and the business underneath, opening one menu. A superadmin in another business gets an amber
   dot on the avatar and an amber business line. */
.app-topbar-profile {
  display: inline-flex; align-items: center; gap: .6rem; max-width: 320px;
  padding: .3rem .75rem .3rem .3rem; border: 0; border-radius: 999px;
  background: rgba(0,0,0,.18); color: #fff; text-align: left; line-height: 1.15;
  transition: background-color .15s ease;
}
.app-topbar-profile:hover, .app-topbar-profile:focus, .app-topbar-profile[aria-expanded="true"] { background: rgba(0,0,0,.3); color: #fff; }
.app-topbar-profile:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.app-topbar-avatar {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: #fff; color: var(--brand-primary, #660708); font-size: .8rem; font-weight: 700; letter-spacing: .03em;
}
.app-topbar-avatar-dot {
  position: absolute; right: -1px; bottom: -1px; width: .7rem; height: .7rem; border-radius: 50%;
  background: #f5b301; border: 2px solid var(--brand-primary, #660708);
}
.app-topbar-profile-text { display: grid; min-width: 0; }
.app-topbar-user { font-size: .875rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar-business { display: flex; align-items: center; gap: .3rem; min-width: 0; font-size: .75rem; color: rgba(255,255,255,.72); }
.app-topbar-business .bi { font-size: .7rem; }
.app-topbar-business-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar-profile.is-switched .app-topbar-business { color: #ffd76a; }
/* Superadmin state (2.25.6). Another business: a solid amber border, amber tint and a strong breathing
   glow, with the dot beating like a heart. Own business: a calm green border and dot with a slow ring.
   Still (rings only) for people who turn off motion. */
.app-topbar-profile.is-switched {
  background: rgba(245,179,1,.2); box-shadow: 0 0 0 2px #f5b301;
  animation: topbar-switched-breathe 2s ease-in-out infinite;
}
.app-topbar-profile.is-switched:hover, .app-topbar-profile.is-switched[aria-expanded="true"] { background: rgba(245,179,1,.32); }
.app-topbar-profile.is-switched .app-topbar-avatar-dot { background: #f5b301; animation: topbar-switched-heartbeat 1.4s ease-in-out infinite; }
.app-topbar-profile.is-home { box-shadow: 0 0 0 2px rgba(61,220,132,.8); animation: topbar-home-breathe 3s ease-in-out infinite; }
.app-topbar-profile.is-home .app-topbar-avatar-dot { background: #3ddc84; animation: topbar-home-ring 2s ease-out infinite; }
@keyframes topbar-switched-heartbeat {
  0%, 45%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245,179,1,.9); }
  12% { transform: scale(1.45); }
  24% { transform: scale(1); box-shadow: 0 0 0 .45rem rgba(245,179,1,0); }
  34% { transform: scale(1.3); }
}
@keyframes topbar-switched-breathe {
  0%, 100% { box-shadow: 0 0 0 2px #f5b301, 0 0 .2rem 0 rgba(245,179,1,.35); }
  50% { box-shadow: 0 0 0 2px #ffd34d, 0 0 1.4rem .35rem rgba(245,179,1,.7); }
}
@keyframes topbar-home-ring {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(61,220,132,.85); }
  30% { transform: scale(1.25); }
  60%, 100% { transform: scale(1); box-shadow: 0 0 0 .5rem rgba(61,220,132,0); }
}
@keyframes topbar-home-breathe {
  0%, 100% { box-shadow: 0 0 0 2px rgba(61,220,132,.7), 0 0 .15rem 0 rgba(61,220,132,.25); }
  50% { box-shadow: 0 0 0 2px #3ddc84, 0 0 1rem .2rem rgba(61,220,132,.5); }
}.app-topbar-caret { font-size: .7rem; opacity: .75; }
.app-topbar-dropdown { min-width: 16rem; }
.app-topbar-dropdown-head { padding: .5rem 1rem .35rem; max-width: 21rem; }
.app-topbar-eyebrow { font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-secondary-color, #6c757d); }
.app-topbar-switched-note { color: #8a5d00; margin-top: .25rem; }
/* Invoice Timeline and Email delivery card: a send's statuses sit framed under it, indented to line up
   with its text, and every time (sends and statuses) ends on the same right-hand edge. */
.timeline-statuses { margin-left: 2.25rem; }
.timeline-time { padding-right: .5rem; text-align: right; }

/* Left where a page title used to be, so title-and-buttons headers keep their buttons on the right.
   It takes no space: as an inline-block it left a blank line at the top of cards whose title stood alone. */
.page-title-moved { display: block; width: 0; height: 0; }
@media (max-width: 767.98px) {
  .app-topbar { gap: .5rem; padding: .5rem .75rem; }
  .app-topbar-title { font-size: 1rem; }
  .app-topbar-profile { padding: .25rem; }
  .app-topbar-profile-text, .app-topbar-caret { display: none; }
}
/* Button groups (for example Edit, Disable, Delete in list rows) wrap onto a second line on phones
   instead of running off the screen (2.20.0). Each button gets its own rounded corners there, because
   Bootstrap joins grouped buttons edge to edge. */
@media (max-width: 767.98px) {
  .btn-group { flex-wrap: wrap; gap: .25rem; }
  .btn-group > .btn,
  .btn-group > form > .btn,
  .btn-group > .btn-group > .btn {
    margin-left: 0 !important;
    border-radius: var(--bs-btn-border-radius) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .app-topbar-btn, .app-topbar-profile { transition: none; }
  /* No heartbeat, glow or ring: the steady amber (another business) or green (own) border still shows. */
  .app-topbar-profile.is-switched, .app-topbar-profile.is-switched .app-topbar-avatar-dot, .app-topbar-profile.is-home, .app-topbar-profile.is-home .app-topbar-avatar-dot { animation: none; }
}
@media print {
  /* Printed pages keep their title but not the controls. */
  .app-topbar { position: static; background: none; color: #000; box-shadow: none; padding: 0 0 .5rem; }
  .app-topbar-title { color: #000; white-space: normal; }
  .app-topbar-btn, .app-topbar-end { display: none !important; }
}
.content-wrap main { width: 100%; }

/* Footer cache indicator dot (hidden by default, shown in collapsed mode) */
.app-sidebar .footer .status-dot {
  display: none; /* hidden by default */
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-left: 4px;
}

/* Center the cache badge when sidebar is expanded */
.app-sidebar:not(.collapsed) .footer .cache-badge {
  display: inline-block;
  margin-left: auto;
  margin-right: auto;
  display: block;            /* allow auto margins to center */
  width: fit-content;        /* shrink to content width */
  margin-bottom: 6px;        /* small gap above buttons */
}

/* Force full-width containers when sidebar is present */
body.has-sidebar .container,
body.has-sidebar .container-sm,
body.has-sidebar .container-md,
body.has-sidebar .container-lg,
body.has-sidebar .container-xl,
body.has-sidebar .container-xxl { max-width: 100% !important; }
.content-wrap .container,
.content-wrap .container-sm,
.content-wrap .container-md,
.content-wrap .container-lg,
.content-wrap .container-xl,
.content-wrap .container-xxl { max-width: 100% !important; }

/* Hide decorative blobs on app pages with sidebar */
body.has-sidebar.blobs-bg::before,
body.has-sidebar.blobs-bg::after { display: none !important; content: none !important; }

/* Responsive sidebar behavior */
@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; left: -260px; z-index: 1040; transition: left .2s ease; }
  .app-sidebar.toggled { left: 0; }
  .app-sidebar.collapsed { left: -72px; }
  /* The navbar's menu button opens the sidebar on phones, even when it is collapsed to icons. */
  .app-sidebar.collapsed.toggled { left: 0; }
  .content-wrap { width: 100%; }
  .sidebar-overlay { display:none; position:fixed; inset:0; background: rgba(0,0,0,.35); z-index:1039; }
  .sidebar-overlay.show { display:block; }
}

/* --- Collapsed sidebar behavior (icons only with hover flyout) --- */
.app-sidebar.collapsed .brand-name { display: none; }
.app-sidebar.collapsed .brand { justify-content: center; }
.app-sidebar.collapsed .menu > li > a span { display: none; }
.app-sidebar.collapsed .menu > li > a { justify-content: center; padding: .5rem; }
/* sidebar menu icons while collapsed size */
.app-sidebar.collapsed .menu > li > a i { font-size: 1.5rem; line-height: 1; }
.app-sidebar.collapsed .nav-section { overflow: visible; }
.app-sidebar.collapsed .menu > li { position: relative; }
.app-sidebar.collapsed .menu > li::after {
  content: '';
  position: absolute; top: 0; right: -10px; width: 10px; height: 100%;
  /* invisible hover bridge so pointer stays within the li while moving to submenu */
}
.app-sidebar.collapsed .menu > li > .submenu {
  position: absolute; left: 64px; top: 0; /* overlap by 8px to avoid hover gap */
  min-width: 220px; margin: 0; padding: .5rem;
  background: rgba(8, 32, 54, 0.98);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: .5rem; box-shadow: 0 10px 30px rgba(0,0,0,.3);
  display: none; z-index: 1050;
  max-height: calc(100vh - 32px); overflow: auto;
}
.app-sidebar.collapsed .menu > li:hover > .submenu,
.app-sidebar.collapsed .menu > li > .submenu:hover { display: block !important; }

/* Collapsed footer: icon-only buttons and cache dot */
.app-sidebar.collapsed .footer .cache-badge { display: none !important; }
.app-sidebar.collapsed .footer .status-dot {
  display: block !important;
  margin: 0 auto 8px !important; /* center horizontally with a small bottom gap */
}
.app-sidebar.collapsed .footer .btn { display: inline-flex; align-items: center; justify-content: center; }
.app-sidebar.collapsed .footer .btn .btn-text { display: none; }
/* Lists that stack on phones (2.47.28): each row becomes a card, each cell a label and value. Add class
   table-stack to the table and data-label to each cell; the actions cell takes table-stack-actions. */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { border: 1px solid var(--bs-border-color); border-radius: .5rem; margin-bottom: .75rem; padding: .25rem .75rem; }
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .35rem 0; text-align: right; }
  .table-stack td[data-label]::before { content: attr(data-label); font-weight: 600; text-align: left; }
  .table-stack td.table-stack-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .25rem; border-top: 1px solid var(--bs-border-color); padding-top: .5rem; margin-top: .25rem; }
  .table-stack td.table-stack-actions > * { margin: 0 !important; }
  .table-stack td[colspan] { justify-content: center; }
}

/* The shared demo (2.47.35): a SAMPLE watermark across invoices and bills in the demo business. */
.demo-sample { position: relative; }
.demo-sample::before { content: 'SAMPLE'; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-30deg); font-size: clamp(4rem, 14vw, 12rem); font-weight: 800; letter-spacing: .1em; color: rgba(220, 53, 69, .13); pointer-events: none; z-index: 5; white-space: nowrap; }
@media print { .demo-sample::before { color: rgba(220, 53, 69, .35); } }
/* Nothing leaves the demo, so its download, PDF, print and email buttons are hidden (the router refuses them too). */
.demo-sample a[href*="download"], .demo-sample a[href*="/email"], .demo-sample a[href*="/pdf"], .demo-sample a[href*="/print"], .demo-sample form[action*="/email"], .demo-sample #btn-print { display: none !important; }

/* Demo reset notice (2.47.36; a pulsing border in the brand colour, owner's request, 2.47.37): pulses gently (one slow cycle every 2 seconds, far below the 3-flashes-a-second
   limit), and stays still for people who ask for reduced motion. */
.demo-reset-notice { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .75rem; padding: .6rem .9rem; border-radius: .5rem; background: #fff3cd; color: #664d03; border: 2px solid var(--brand-primary, #660708); animation: demo-reset-pulse 2s ease-in-out infinite; }
@keyframes demo-reset-pulse { 0%, 100% { border-color: var(--brand-primary, #660708); box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-primary, #660708) 55%, transparent); } 50% { border-color: color-mix(in srgb, var(--brand-primary, #660708) 35%, #fff); box-shadow: 0 0 0 .4rem color-mix(in srgb, var(--brand-primary, #660708) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .demo-reset-notice { animation: none; } }
