/* =====================================================================
   Avinyasai Business Suite - visual theme
   Loaded after Bootstrap 5.3's compiled CSS, so everything below is a
   deliberate override layer rather than a full rebuild - this keeps every
   existing template (which only uses stock Bootstrap classes like .card,
   .btn, .table, .badge, .form-control) working unchanged while giving the
   whole app a consistent, modern look from one file.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Blue/indigo primary accent - per your reference screenshot. The logo
     stays maroon on its own white header block; the rest of the UI (links,
     buttons, active states, charts) uses this blue family instead. */
  --brand-primary: #3D5FEE;
  --brand-primary-dark: #2A46C4;
  --brand-primary-bright: #6C89FF;
  --brand-primary-light: #EEF1FF;
  --brand-gradient: linear-gradient(135deg, var(--brand-primary-bright) 0%, var(--brand-primary-dark) 100%);
  --brand-success: #22A06B;
  --brand-warning: #FF8A3D;
  --brand-danger: #E5484D;
  --brand-ink: #1A1D29;
  --brand-muted: #6B7280;
  --brand-body-bg: #F4F6FB;
  --brand-border: #E7E9F2;
  --brand-radius: 12px;
  --doc-accent: #1f3d7a;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  background-color: var(--brand-body-bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--brand-ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-ink);
}

a {
  color: var(--brand-primary-dark);
}

a:hover {
  color: var(--brand-primary);
}

.text-muted {
  color: var(--brand-muted) !important;
}

/* --- Buttons --------------------------------------------------------- */
.btn {
  font-weight: 600;
  border-radius: 8px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn-sm {
  border-radius: 7px;
}

.btn-primary {
  background: var(--brand-gradient);
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  box-shadow: 0 3px 10px rgba(61,95,238,0.32);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  filter: brightness(1.06);
  background: var(--brand-gradient) !important;
  border-color: var(--brand-primary-dark) !important;
}

.btn-outline-primary {
  color: var(--brand-primary-dark);
  border-color: var(--brand-primary);
}

.btn-outline-primary:hover {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.btn:active {
  transform: translateY(1px);
}

.btn-link {
  color: var(--brand-primary-dark);
  font-weight: 600;
  text-decoration: none;
}

.btn-link:hover {
  color: var(--brand-primary);
}

/* --- Cards ------------------------------------------------------------ */
.card {
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: 0 1px 3px rgba(16,24,64,0.05);
}

.card.shadow-sm {
  box-shadow: 0 2px 10px rgba(16,24,64,0.06) !important;
}

.card-body {
  padding: 1.25rem 1.4rem;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--brand-border);
  font-weight: 600;
  border-top-left-radius: var(--brand-radius) !important;
  border-top-right-radius: var(--brand-radius) !important;
}

/* --- Tables ------------------------------------------------------------ */
.table {
  --bs-table-bg: transparent;
  color: var(--brand-ink);
}

.table thead th {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--brand-muted);
  border-bottom-width: 1px;
  border-bottom-color: var(--brand-border);
  background: #fafbfe;
  white-space: nowrap;
}

.table td, .table th {
  border-color: var(--brand-border);
  vertical-align: middle;
  padding: 0.7rem 0.9rem;
}

.table-hover tbody tr:hover {
  background-color: var(--brand-primary-light);
}

/* --- Forms -------------------------------------------------------------- */
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--brand-border);
  padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 0.2rem rgba(61,95,238,0.15);
}

label, .form-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--brand-ink);
}

/* Label/value metadata panels - the <dl class="row"><dt class="col-sm-6">
   label</dt><dd class="col-sm-6">value</dd> pattern used by every detail
   page's right-hand sidebar card (Ticket, Incident, Change Request, KB
   Article, ...). In a narrow card, a two-word label like "Assigned To" or
   "Logged By" needs to be free to wrap onto its own second line - this
   just makes sure that wrap always happens at a word boundary, never
   mid-word. */
dl.row dt {
  overflow-wrap: normal;
  word-break: normal;
}

/* --- Badges & alerts ----------------------------------------------------- */
.badge {
  font-weight: 600;
  padding: 0.4em 0.7em;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.alert {
  border: none;
  border-left: 4px solid transparent;
  border-radius: 10px;
}

.alert-info { border-left-color: var(--brand-primary); background: var(--brand-primary-light); color: #24346b; }
.alert-success { border-left-color: var(--brand-success); background: #E9F8F0; color: #135a3e; }
.alert-warning { border-left-color: var(--brand-warning); background: #FFF2E6; color: #7a4210; }
.alert-danger { border-left-color: var(--brand-danger); background: #FDEDEE; color: #7d1d20; }

/* --- Pagination ----------------------------------------------------------- */
.page-link {
  color: var(--brand-primary-dark);
  border-color: var(--brand-border);
}

.page-item.active .page-link {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

/* --- Left sidebar navigation ----------------------------------------
   On desktop (>= md) the sidebar sits as a fixed-width column alongside
   the page content; below that breakpoint Bootstrap's responsive
   offcanvas classes (offcanvas-md) turn it into a slide-in drawer
   triggered by the hamburger button in .mobile-topbar. */
.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: linear-gradient(180deg, #171B2B 0%, #12141F 100%) !important;
  border-right: 1px solid rgba(255,255,255,0.06);
}

@media (min-width: 768px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

/* Below md: the sidebar becomes a slide-in drawer (custom, not Bootstrap's
   offcanvas component - see base.html for why), opened by #sidebarToggleBtn
   and closed via the backdrop, the X button, or clicking a nav link. */
@media (max-width: 767.98px) {
  /* .sidebar and .sidebar-backdrop go position: fixed below (out of normal
     flow entirely), so the only two *actual* flex items .app-shell has left
     at this width are .mobile-topbar and .main-content. Left in .app-shell's
     default row direction, that put the topbar in a narrow column on the
     left - stretched by align-items: stretch to the full height of
     .main-content's content (thousands of px) instead of staying a normal
     short bar above it. Stacking them in a column instead puts the topbar
     where it visually belongs (a full-width bar on top) and lets each size
     to its own content height along the new main axis, rather than being
     stretched to match the other. */
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* Most list screens put a wide <table> straight inside a .card without
     Bootstrap's .table-responsive wrapper div. On a phone that used to
     force the whole page to scroll sideways; this scopes the scrolling to
     just the card instead, so the rest of the page (nav, headings, filter
     row) stays put. :has() is supported on every current mobile browser;
     on the rare one that lacks it, this simply has no effect - no
     regression either way. */
  .card:has(> table.table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.sidebar-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-body {
  height: 100%;
}

/* White header block at the top of the (otherwise dark) sidebar, so the
   company logo - which comes on its own white background - sits on a
   matching surface instead of a dark one. */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: #fff;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

.sidebar-brand:hover {
  color: inherit;
}

.sidebar-brand-logo {
  height: 34px;
  width: auto;
  flex: 0 0 auto;
  display: block;
}

.sidebar-brand-text {
  line-height: 1.2;
}

.sidebar-brand-name {
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.sidebar-brand-tagline {
  color: var(--brand-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Global search box - sits just below the brand header, above the nav
   list (see templates/base.html + static/search/global_search.js). Input
   styled to sit on the dark sidebar; the results dropdown itself is a
   normal light card so record/page rows stay easy to read. */
.sidebar-search {
  position: relative;
  padding: 0.85rem 0.9rem 0.35rem;
}

.sidebar-search-input-wrap {
  position: relative;
}

.sidebar-search-input-wrap .bi-search {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.45);
  pointer-events: none;
}

.sidebar-search input[type="search"] {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.6rem 0.5rem 2.1rem;
  font-size: 0.88rem;
}

.sidebar-search input[type="search"]::placeholder {
  color: rgba(255,255,255,0.45);
}

.sidebar-search input[type="search"]:focus {
  outline: none;
  background: rgba(255,255,255,0.14);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(61,95,238,0.35);
}

.sidebar-search-dropdown {
  display: none;
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  top: 100%;
  margin-top: 0.3rem;
  background: #fff;
  color: var(--brand-ink);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
  max-height: 70vh;
  overflow-y: auto;
  z-index: 1050;
}

.sidebar-search-dropdown.show {
  display: block;
}

.sidebar-search-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-muted);
  padding: 0.6rem 0.9rem 0.2rem;
}

.sidebar-search-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  color: var(--brand-ink);
  text-decoration: none;
  font-size: 0.86rem;
}

.sidebar-search-item:hover,
.sidebar-search-item.active {
  background: var(--brand-primary-light);
  color: var(--brand-ink);
}

.sidebar-search-empty {
  padding: 0.75rem 0.9rem;
  color: var(--brand-muted);
  font-size: 0.85rem;
}

.sidebar-search-seeall {
  display: block;
  text-align: center;
  padding: 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-top: 1px solid #eef0f6;
  color: var(--brand-primary);
  text-decoration: none;
}

.sidebar-nav {
  padding: 0.75rem 0.6rem;
  /* Bootstrap's .nav sets flex-wrap: wrap by default; combined with
     .flex-column and a height-constrained parent (the sidebar scrolls, it
     doesn't grow), that wraps overflowing items into a second column
     instead of just scrolling - force a single column and let .sidebar's
     own overflow-y: auto handle anything that doesn't fit on screen. */
  flex-wrap: nowrap;
  width: 100%;
}

.sidebar-submenu {
  flex-wrap: nowrap;
}

.sidebar-nav .nav-item {
  margin-bottom: 2px;
}

.sidebar-nav .nav-link {
  color: rgba(255,255,255,0.68);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus {
  color: #fff;
  background: rgba(255,255,255,0.07);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: var(--brand-gradient);
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(61,95,238,0.35);
}

.sidebar-link .caret {
  font-size: 0.7rem;
  transition: transform 0.15s ease;
  opacity: 0.6;
}

.sidebar-link[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

/* Sidebar drag-to-reorder handles (templates/base.html) - one per
   top-level menu item only, never on a submenu link, so "moving an app up
   or down" always drags the whole section as a unit. Faint until hovered
   so the sidebar doesn't look cluttered with grip icons by default.
   Reordering the sidebar is Admin/superuser-only and applies to everyone
   at the company (see tenants.models.Tenant.sidebar_menu_order) - for
   anyone else, base.html adds .sidebar-nav-locked to the <ul> itself
   (can_reorder_sidebar_menu is false), which hides these entirely rather
   than just disabling them, since base.html also skips Sortable.create()
   for that same case - a visible-but-inert grip icon would be misleading. */
.menu-drag-handle {
  cursor: grab;
  opacity: 0.35;
  padding: 0 0.4rem;
  color: rgba(255,255,255,0.75);
  flex-shrink: 0;
  touch-action: none;
}

.menu-drag-handle:hover {
  opacity: 0.9;
}

.sidebar-nav-locked .menu-drag-handle {
  display: none;
}

.sidebar-nav > .nav-item.sortable-chosen {
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
}

.sidebar-nav > .nav-item.sortable-chosen .menu-drag-handle {
  cursor: grabbing;
  opacity: 0.9;
}

.sidebar-nav > .nav-item.sortable-ghost {
  opacity: 0.35;
}

.sidebar-submenu {
  background: rgba(0,0,0,0.18);
  border-radius: 8px;
  margin: 2px 0 6px;
  padding: 2px 0;
}

.sidebar-submenu .nav-link {
  padding-left: 1.9rem;
  font-size: 0.87rem;
  border-radius: 6px;
}

.sidebar-divider {
  border-color: rgba(255,255,255,0.1);
  margin: 0.25rem 1rem;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08) !important;
}

.sidebar-user {
  color: rgba(255,255,255,0.75) !important;
}

.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #171B2B;
  padding: 0.6rem 1rem;
}

.mobile-brand {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The hamburger button used to rely on Bootstrap's .navbar-toggler-icon,
   whose hamburger-lines graphic is a background-image driven entirely by
   the --bs-navbar-toggler-icon-bg CSS variable - but Bootstrap only ever
   sets that variable on an element with the .navbar class. This button
   lives in .mobile-topbar, not inside a .navbar, so the variable was never
   set and the icon rendered as a blank dark square (it still worked when
   tapped - .js listens on #sidebarToggleBtn's id, not its icon - it just
   wasn't visible). Using a Bootstrap Icons glyph instead sidesteps that
   entirely, since the icon font is loaded independently in <head>. */
.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-toggle-btn i {
  font-size: 1.25rem;
}

.mobile-brand-logo {
  height: 22px;
  width: auto;
  background: #fff;
  padding: 2px 5px;
  border-radius: 5px;
  display: block;
}

.main-content {
  flex: 1 1 auto;
  min-width: 0;
}

@media print {
  /* .app-copyright-footer (templates/base.html, every page) was never
     given the .no-print treatment the sidebar/topbar get here - it
     printed on every single document (invoices, POs, payslips, ...),
     wasting space below the real printed content for no reason. Found
     2026-10-22 while fixing a payslip spilling onto an unwanted 2nd
     page - this footer alone was eating a chunk of that overflow. */
  .sidebar, .mobile-topbar, .app-copyright-footer { display: none !important; }
  .main-content { flex: 1 1 100%; }
}

/* --- Login page ---------------------------------------------------------- */
.login-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow: hidden;
  /* A soft tint of the brand blue rather than a flat grey page - the plain
     .brand-body-bg background is fine once there's an app shell around it,
     but on its own (nothing else on screen but one card) it read as blank/
     unfinished. */
  background: radial-gradient(120% 120% at 50% -10%, var(--brand-primary-light) 0%, var(--brand-body-bg) 55%);
}

/* Purely decorative fill for the empty space around the card - approved in
   login_preview.html before landing here. All low-opacity so nothing here
   competes with the card itself. */
.login-bg-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(61, 95, 238, 0.14) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 78%);
  pointer-events: none;
}

.login-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  pointer-events: none;
}

.login-bg-blob-1 {
  width: 460px;
  height: 460px;
  top: -180px;
  left: -140px;
  background: radial-gradient(circle at 35% 35%, rgba(108, 137, 255, 0.55), rgba(108, 137, 255, 0) 70%);
}

.login-bg-blob-2 {
  width: 520px;
  height: 520px;
  bottom: -220px;
  right: -180px;
  background: radial-gradient(circle at 60% 40%, rgba(124, 58, 237, 0.30), rgba(124, 58, 237, 0) 70%);
}

.login-bg-blob-3 {
  width: 280px;
  height: 280px;
  bottom: 8%;
  left: 6%;
  background: radial-gradient(circle at 50% 50%, rgba(34, 160, 107, 0.18), rgba(34, 160, 107, 0) 70%);
}

.login-bg-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(61, 95, 238, 0.16);
  pointer-events: none;
}

.login-bg-ring-1 { width: 620px; height: 620px; top: -260px; left: -200px; }
.login-bg-ring-2 { width: 340px; height: 340px; bottom: -120px; right: 8%; border-color: rgba(124, 58, 237, 0.16); }

.login-bg-shape {
  position: absolute;
  opacity: 0.10;
  pointer-events: none;
}

.login-bg-shape-1 { top: 12%; right: 12%; width: 46px; height: 46px; border-radius: 12px; background: var(--brand-primary); transform: rotate(18deg); }
.login-bg-shape-2 { bottom: 16%; right: 22%; width: 26px; height: 26px; border-radius: 8px; background: #7C3AED; transform: rotate(-12deg); }
.login-bg-shape-3 { top: 20%; left: 10%; width: 18px; height: 18px; border-radius: 50%; background: var(--brand-success); }

.login-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  background: #fff;
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(16, 24, 64, 0.12);
}

.login-brand {
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.01em;
  color: var(--brand-ink);
}

.login-tagline {
  color: var(--brand-muted);
  font-size: 1rem;
  line-height: 1.4;
}

.login-card {
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: none;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(16, 24, 64, 0.16);
}

.login-card::before {
  content: '';
  display: block;
  height: 4px;
  background: var(--brand-gradient);
}

.login-card .card-body {
  padding: 2.25rem 2rem 2rem;
}

/* --- Dashboard stat tiles -------------------------------------------------- */
.stat-tile {
  position: relative;
  overflow: hidden;
  border-top: 4px solid var(--brand-primary);
}

.stat-tile .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(61,95,238,0.32);
}

.stat-tile.stat-success { border-top-color: var(--brand-success); }
.stat-tile.stat-success .stat-icon { background: linear-gradient(135deg, #22C58B, #0F9D6D); box-shadow: 0 4px 10px rgba(34,197,139,0.32); }
.stat-tile.stat-warning { border-top-color: var(--brand-warning); }
.stat-tile.stat-warning .stat-icon { background: linear-gradient(135deg, #FF9A3D, #E86A12); box-shadow: 0 4px 10px rgba(255,154,61,0.32); }

.stat-tile.stat-tile-link {
  color: inherit;
  text-decoration: none;
  display: block;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.stat-tile.stat-tile-link:hover {
  color: inherit;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(20,25,40,0.1);
}

/* --- Dashboard card drag-and-drop reordering ("Reorder Dashboard") -------- */
.dashboard-card {
  position: relative;
}
.dashboard-card-handle {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  z-index: 2;
  cursor: grab;
  opacity: 0.3;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  color: var(--brand-muted);
  background: rgba(255,255,255,0.7);
  touch-action: none;
  display: none;
}
.dashboard-cards-editing .dashboard-card-handle {
  display: inline-flex;
}
.dashboard-card-handle:hover {
  opacity: 1;
  background: #fff;
}
.dashboard-card.sortable-chosen {
  box-shadow: 0 10px 24px rgba(20,25,40,0.16);
}
.dashboard-card.sortable-chosen .dashboard-card-handle {
  cursor: grabbing;
  opacity: 1;
}
.dashboard-card.sortable-ghost {
  opacity: 0.4;
}

/* --- Dashboard hero banner -------------------------------------------------- */
.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--brand-radius);
  background: linear-gradient(120deg, var(--brand-primary) 0%, #6D5EF5 55%, #7C3AED 100%);
  padding: 1.35rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-banner-blob {
  position: absolute;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  pointer-events: none;
}

.hero-banner-blob-1 { width: 180px; height: 180px; top: -70px; right: 60px; }
.hero-banner-blob-2 { width: 140px; height: 140px; bottom: -80px; right: 220px; background: rgba(255,255,255,0.08); }

.hero-banner-text { position: relative; z-index: 1; }

.hero-banner-title {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.hero-banner-subtitle {
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.15rem;
}

.hero-banner-cta {
  position: relative;
  z-index: 1;
  background: #fff;
  color: var(--brand-primary-dark);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.55rem 1rem;
  border-radius: 9px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  white-space: nowrap;
}

.hero-banner-cta:hover {
  color: var(--brand-primary-dark);
  filter: brightness(0.97);
}

/* --- Employee photo / initials avatar --------------------------------------
   Three sizes, each an <img> (hrms.models.Employee.photo, already
   downscaled server-side - see Employee.save()) or a same-sized
   "-fallback" span showing initials, for anyone who hasn't uploaded a
   photo. Used on Employees list (avatar-thumb), an employee's own
   profile page (avatar-profile), Org Chart (avatar-thumb), and the
   Dashboard's "Welcome back" banner (hero-banner-avatar, styled
   separately below since it sits on the banner's own gradient, not a
   plain card background). */
.avatar-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-thumb-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.avatar-profile {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-profile-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
}

.hero-banner-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.6);
}

.hero-banner-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.6);
}

/* --- Kanban boards (Pipeline / Ticket / Incident / Task) ------------------- */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-column {
  background: #EEF0F7;
  border-radius: var(--brand-radius);
  min-width: 270px;
  max-width: 270px;
  padding: 0.85rem;
}

.kanban-column-header {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-muted);
  margin-bottom: 0.6rem;
  display: flex;
  justify-content: space-between;
}

.kanban-card {
  background: #fff;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 1px 3px rgba(16,24,64,0.08);
  cursor: grab;
  border: 1px solid var(--brand-border);
}

.kanban-card:hover {
  box-shadow: 0 4px 10px rgba(16,24,64,0.12);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-column.drag-over {
  outline: 2px dashed var(--brand-primary);
}

.kanban-card small {
  color: var(--brand-muted);
}

/* =====================================================================
   Printable documents (Vendor PO / Sales Order / Delivery Challan /
   Proforma Invoice / Invoice / Credit Note) - a shared branded letterhead
   driven by transactions.OrgProfile (name, logo, GSTIN, bank details), so
   every document type in the suite looks like it came from the same
   company. Layout mirrors the reference Delivery Challan format supplied
   2026-09-25: flat bordered sheet, logo+name beside a large plain-text
   doc title, a bordered "meta" strip (doc no/date/etc.), a shaded party
   label bar, a right-aligned totals block with a signature box under it,
   and a thank-you footer. Deliberately kept on its own navy accent
   (--doc-accent) rather than the app's blue brand color, since these are
   printed/official documents, not screen UI. Override --doc-accent per
   tenant later if per-company branding colors are ever needed.
   Structural note: nothing here uses display:flex - the logo-overlap bugs
   fixed earlier (both on-screen and in the emailed PDF, see
   templates/print_pdf_base.html's own comment) both traced back to flex
   not reliably clamping content to its box, so every multi-column block
   below uses a plain float (brand/title) or a real <table> (meta/parties/
   summary) instead - both render identically and predictably in browsers
   and in weasyprint (the emailed-PDF engine, which has no flex support
   worth trusting).
   ===================================================================== */
.doc-sheet {
  background: #fff;
  padding: 2rem;
  max-width: 850px;
  margin: 0 auto;
  border: 1px solid #495057;
  border-radius: 0;
}

.doc-header {
  border-bottom: 1px solid #495057;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}
.doc-header::after {
  content: '';
  display: table;
  clear: both;
}

.doc-header h2 {
  margin: 0 0 4px;
  color: var(--doc-accent);
  font-size: 1.15rem;
}

/* .doc-brand is deliberately NOT floated - it's a normal block given its
   own block-formatting context (overflow:hidden) so it sits beside the
   floated .doc-title instead of running under/over it. Proven pattern:
   this is the exact technique already used (and confirmed working, both
   on-screen and in emailed PDFs) for the logo sitting beside the address
   text one level down - see .doc-brand > div below. */
.doc-brand {
  overflow: hidden;
}

.doc-logo-box {
  float: left;
  margin-right: 1rem;
  /* Both width AND height pinned, with overflow:hidden on this wrapper
     rather than trusting the <img>'s own sizing - pinning size directly on
     a floated <img> wasn't reliably honored by the emailed-PDF engine even
     with object-fit set, so the box itself now clips whatever paints
     inside it. See templates/print_pdf_base.html's own comment for the
     full history. */
  width: 84px;
  height: 68px;
  overflow: hidden;
}

.doc-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.doc-brand > div {
  /* the un-classed text block next to the logo - overflow:hidden gives it
     its own block-formatting context so it sits beside the float instead
     of wrapping under it */
  overflow: hidden;
}

.doc-title {
  float: right;
  max-width: 42%;
  margin-top: 4px;
  text-align: right;
  font-weight: 500;
  font-size: 1.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #343a40;
}

/* "Original For Recipient" (GST Rule 48(6) multi-copy labelling) - only
   used on the Invoice (see _invoice_print_body.html); every other printed
   document type (PO/DC/CN/Sales Order/Proforma) has no such requirement,
   so none of their own _*_print_body.html templates add this. Sits as its
   own block ABOVE the whole .doc-sheet - matching the reference sample
   invoice the customer supplied 2026-10-18, where this label sits above
   the letterhead, not inside it - right-aligned and capped to the same
   max-width as .doc-sheet so it lines up with the sheet's own right edge. */
.doc-copy-label {
  max-width: 850px;
  margin: 0 auto 6px;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #6c757d;
}

/* Bordered "document number / date / place of supply / status" strip,
   directly under the letterhead - a real <table> (not flex/grid) so the
   outer border + single divider between the two columns render exactly
   the same in a browser and in the emailed PDF. */
.doc-meta {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #ced4da;
  margin-bottom: 1rem;
}

.doc-meta td {
  width: 50%;
  vertical-align: top;
  padding: 10px 14px;
  border: none;
}

.doc-meta td + td {
  border-left: 1px solid #ced4da;
}

.doc-meta-row {
  margin-bottom: 3px;
}

.doc-meta-row:last-child {
  margin-bottom: 0;
}

.doc-meta-label {
  display: inline-block;
  min-width: 150px;
  color: #6c757d;
}

.doc-meta-label::after {
  content: ':';
}

.doc-meta-value {
  font-weight: 700;
}

/* Party block(s) - e.g. "Deliver To" / "Billed To" / "Vendor" - each with
   its own shaded label bar, side by side via a real <table> rather than
   flex (same reasoning as .doc-meta above). */
.doc-parties {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.doc-parties td {
  width: 50%;
  vertical-align: top;
  padding: 0;
  border: none;
}

.doc-parties td + td {
  padding-left: 1rem;
}

.doc-parties-label {
  background: #f1f3f5;
  color: #495057;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  margin-bottom: 6px;
}

/* A single party block (e.g. just "Billed To", no second column) - same
   label-bar look as .doc-parties-label but without the two-column table
   wrapper, capped to a reasonable width instead of running full-page. */
.doc-party-single {
  margin-bottom: 1rem;
  max-width: 60%;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.doc-table th, .doc-table td {
  border: 1px solid #adb5bd;
  padding: 6px 8px;
  font-size: 0.9rem;
  /* A long, unbroken description used to push the whole table wider than
     the printed sheet instead of wrapping - reported 2026-10-18
     ("description box going out"). overflow-wrap is the modern name,
     word-wrap the older alias weasyprint (the emailed-PDF engine, see
     templates/print_pdf_base.html) understands; word-break is the
     fallback for an engine honouring neither. */
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.doc-table th {
  background: #f1f3f5;
}

.doc-table th.text-end, .doc-table td.text-end {
  text-align: right;
}

/* Payslip only (hrms/payslip_detail.html) - a currency figure here is a
   single unbroken "word" with no spaces (e.g. "₹10339.91"), so the
   word-break:break-word set above - needed for long item descriptions on
   other printed documents - would wrap it one character per line the
   moment its column gets at all tight. The payslip's own tables are full
   width (not squeezed into a half-width .doc-summary column, which was
   the actual cause of that - see payslip_detail.html's own comment), so
   this is a defensive floor, not the primary fix. Scoped to this one
   class so invoice/PO/DC/etc. descriptions keep wrapping normally. */
.payslip-table td.text-end, .payslip-table th.text-end {
  white-space: nowrap;
}

/* Notes (left) beside Totals + Signature (right), below the item table -
   again a real <table> rather than flex. */
.doc-summary {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.doc-summary td {
  width: 50%;
  vertical-align: top;
  padding: 0;
  border: none;
}

.doc-summary td + td {
  padding-left: 1rem;
}

.doc-totals {
  width: 100%;
}

.doc-totals table {
  width: 100%;
}

.doc-totals td {
  padding: 3px 6px;
}

.doc-totals tr.grand-total td {
  font-weight: 700;
  border-top: 2px solid #212529;
}

.doc-signature {
  border: 1px solid #ced4da;
  margin-top: 1rem;
  padding: 10px 14px 14px;
  text-align: center;
}

.doc-signature-space {
  height: 46px;
}

.doc-footer {
  border-top: 1px solid #ced4da;
  margin-top: 1.5rem;
  padding-top: 10px;
  text-align: center;
  font-size: 0.78rem;
  color: #6c757d;
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .doc-sheet { padding: 0; max-width: 100%; border-width: 0; }
  .doc-sheet, .doc-title {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Payslip only (hrms/payslip_detail.html, via the .payslip-sheet class on
   its .doc-sheet) - reported 2026-10-22: a payslip with a fairly ordinary
   amount of content (6-row meta block, Earnings + Deductions + Net Salary
   tables, a few summary lines, the signature box) was spilling a small
   tail onto an unwanted 2nd page when printed/saved as PDF. The on-screen
   .doc-meta/.doc-table/.doc-signature/.doc-footer spacing above is sized
   for comfortable viewing in a browser tab, not for fitting a full payslip
   on one sheet of A4 - this tightens ONLY the payslip's own print output
   (scoped to .payslip-sheet, so Invoices/POs/Delivery Challans/etc, which
   share these same .doc-* classes, are completely unaffected).

   2026-10-22 follow-up: the first pass at this (0.93em, more generous
   paddings) fit a payslip with NO ESIC row with room to spare, but an
   otherwise-identical payslip for an ESIC-enrolled employee - one extra
   "ESIC No" meta row and one extra "ESIC" deductions row, ~2 row-heights
   of extra content - was still enough to push just the trailing doc-footer
   sentence onto a 2nd page in real-world browser PDF export (margins a
   real browser's print/Save-as-PDF applies aren't fully reproducible from
   this environment's headless-Chrome testing, so the safety margin here is
   deliberately generous rather than cut exactly to the one measured case).
   Tightened further (0.87em, smaller paddings/margins throughout) and
   re-verified via Playwright-driven Chromium print-to-PDF (displayHeaderFooter
   off, 0.4in margins, matching a plain browser "Save as PDF") against: the
   no-ESIC case, the ESIC case that previously failed, and a worst-case
   payslip with every optional line at once (ESIC, TDS, Other Deductions,
   Remarks, Absence without Pay, leave-days-absorbed, late marks) - all three
   now fit on one A4 page with comfortable margin left over. The
   page-break-inside rules below just keep any still-unanticipated overflow
   from landing mid-table or mid-signature-box rather than at a clean
   boundary. */
@media print {
  .payslip-sheet { font-size: 0.87em; }
  .payslip-sheet .doc-header { padding-bottom: .35rem; margin-bottom: .35rem; }
  .payslip-sheet .doc-meta { margin-bottom: .35rem; }
  .payslip-sheet .doc-meta td { padding: 3px 10px; }
  .payslip-sheet .doc-table { margin-bottom: .35rem; }
  .payslip-sheet .doc-table th, .payslip-sheet .doc-table td { padding: 2px 6px; }
  .payslip-sheet p.text-center.mb-3 { margin-bottom: .35rem; }
  .payslip-sheet p.mb-1 { margin-bottom: 1px; }
  .payslip-sheet p.mb-3 { margin-bottom: 4px; }
  .payslip-sheet .doc-signature { margin-top: .35rem; padding: 4px 10px 5px; }
  .payslip-sheet .doc-signature-space { height: 20px; }
  .payslip-sheet .doc-footer { margin-top: .35rem; padding-top: 4px; }
  .payslip-sheet .doc-table, .payslip-sheet .doc-signature {
    page-break-inside: avoid;
  }
}

/* Sales Follow-ups & Reminders calendar (crm:followup_list)
   table-layout: fixed is what makes this work: without it, a <td>'s
   percentage width is only a hint and the browser's auto table-layout
   algorithm expands a column to fit any nowrap content instead of
   respecting the width - which is exactly what broke the 28 Sep column
   (it stretched to fit long, unwrapped follow-up text and squeezed every
   other day off screen). Fixed layout forces every column to the width
   given below, so .text-truncate on the items inside can actually clip. */
.calendar-table {
  table-layout: fixed;
  width: 100%;
}

.calendar-table td {
  padding: 4px 6px;
  vertical-align: top;
  width: 14.28%;
  overflow: hidden;
}

.calendar-table td > div {
  line-height: 1.3;
}

.calendar-table .day-number {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--brand-muted);
}

.calendar-table .followup-item {
  display: block;
  color: inherit;
  text-decoration: none;
}

.calendar-table .followup-item:hover {
  text-decoration: underline;
}
