/* =====================================================================
   Intechronix ProspectIQ — application theme
   Purple / raspberry brand, Inter type, lavender surfaces, pill actions.
   Loaded after Bootstrap; restyles shared components for every page.
   ===================================================================== */

:root {
  --brand-900: #2e1065;
  --brand-700: #4c1d95;
  --brand-600: #5b21b6;
  --brand-500: #6d28d9;
  --brand-300: #c4b5fd;
  --brand-100: #ede9fe;
  --brand-50:  #f6f3ff;
  --accent-700: #9d174d;
  --accent-600: #be185d;
  --accent-50:  #fdf2f8;

  --surface:    #f6f5fa;
  --panel:      #ffffff;
  --panel-tint: #f8f5ff;
  --line:       #e6e2ef;
  --line-strong:#d6d0e4;
  --ink:        #1d1a2b;
  --ink-2:      #3f3b52;
  --ink-muted:  #6e6a82;

  --good: #15803d;
  --good-bg: #e9f7ee;
  --warn: #a16207;
  --warn-bg: #fff6e0;
  --bad: #be123c;
  --bad-bg: #fdecef;

  --radius-sm: .5rem;
  --radius: .75rem;
  --radius-lg: 1rem;
  --shadow-1: 0 1px 2px rgba(29, 26, 43, .05);
  --shadow-2: 0 6px 20px rgba(46, 16, 101, .08);

  /* Bootstrap variable overrides */
  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--surface);
  --bs-secondary-color: var(--ink-muted);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-primary: #5b21b6;
  --bs-primary-rgb: 91, 33, 182;
  --bs-link-color: #5b21b6;
  --bs-link-color-rgb: 91, 33, 182;
  --bs-link-hover-color: #4c1d95;
  --bs-link-hover-color-rgb: 76, 29, 149;
  --bs-focus-ring-color: rgba(91, 33, 182, .22);
  --bs-primary-bg-subtle: var(--brand-50);
  --bs-primary-border-subtle: var(--brand-300);
  --bs-primary-text-emphasis: var(--brand-700);
}

html { font-size: 15px; }
body { font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; background: var(--surface) !important; }
.bg-light { background-color: var(--surface) !important; }
.text-muted, .text-secondary { color: var(--ink-muted) !important; }
h1, .h1, h2, .h2, h3, .h3, h4, .h4 { color: var(--ink); letter-spacing: -.015em; font-weight: 700; }
.h3, h3 { font-size: 1.45rem; }
.small, small { font-size: .84rem; }
code { color: var(--accent-600); }

.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 2000; background: #fff; padding: .5rem .75rem; border-radius: var(--radius-sm); }

/* ------------------------------------------------------------------ Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { --bs-offcanvas-width: 272px; }
.sidebar-inner {
  display: flex; flex-direction: column; gap: 0; height: 100%;
  width: 248px; padding: .65rem .6rem; background: var(--panel); border-right: 1px solid var(--line);
  overflow-y: hidden;
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; flex: 0 0 248px; }
}
@media (max-width: 991.98px) {
  .sidebar-inner { width: 100%; border-right: 0; overflow-y: auto; }
}

.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; padding: .15rem .3rem .35rem; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--accent-700), var(--brand-600)); box-shadow: var(--shadow-2);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; color: var(--accent-700); letter-spacing: .02em; font-size: .95rem; }
.brand-sub { font-size: .72rem; color: var(--ink-muted); letter-spacing: .08em; text-transform: uppercase; }

.side-nav { display: flex; flex-direction: column; gap: 1px; margin-top: .15rem; }
.side-section { font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); margin: .55rem .5rem .2rem; }
.side-link {
  display: flex; align-items: center; gap: .6rem; padding: .34rem .52rem; border-radius: .55rem; border: 1px solid transparent;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .82rem; line-height: 1.2;
}
.side-link .bi { font-size: .98rem; color: var(--ink-muted); }
.side-link:hover { background: var(--brand-50); color: var(--brand-700); }
.side-link.active { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); font-weight: 600; }
.side-link.active .bi, .side-link:hover .bi { color: var(--brand-600); }

@media (min-width: 992px) and (max-height: 680px) {
  .sidebar-inner { padding-top: .35rem; padding-bottom: .35rem; }
  .brand { padding-bottom: .15rem; }
  .side-section { margin-top: .32rem; margin-bottom: .1rem; }
  .side-link { padding-top: .25rem; padding-bottom: .25rem; font-size: .79rem; }
}

.sidebar-footer { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .65rem; border-top: 1px solid var(--line); }
.user-card { display: flex; align-items: center; gap: .6rem; padding: .25rem .3rem; min-width: 0; }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-name { font-size: .82rem; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: .72rem; color: var(--ink-muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--brand-100); color: var(--brand-700); font-weight: 700; font-size: .78rem;
}
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }
.profile-menu-button { display: inline-flex; align-items: center; gap: .35rem; border: 0; border-radius: 999px; padding: .15rem .25rem; background: transparent; color: var(--ink-muted); }
.profile-menu-button:hover, .profile-menu-button:focus-visible { background: var(--brand-50); color: var(--brand-700); }
.profile-menu-button > .bi { font-size: .68rem; }
.profile-dropdown { min-width: 220px; border-color: var(--line); border-radius: .8rem; box-shadow: var(--shadow-2); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .85rem;
  padding: .7rem 1.5rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; }
.crumb { font-size: .74rem; color: var(--ink-muted); display: flex; align-items: center; gap: .3rem; }
.crumb .bi { font-size: .62rem; }
.page-name { font-weight: 700; font-size: 1.02rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-chip {
  align-items: center; gap: .45rem; padding: .3rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  color: var(--good); background: var(--good-bg); border: 1px solid #c7ebd3;
}
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; font-size: 1.2rem; }

.page-body { flex: 1; padding: 1.5rem; }
/* Views already wrap content in .container-fluid px-4 — avoid double gutters inside the shell */
.page-body > .container-fluid, .page-body > .container { padding-left: 0 !important; padding-right: 0 !important; padding-top: 0 !important; max-width: none; }
.page-body > .container[style] { max-width: 1100px !important; margin-left: 0; }
.app-footer { padding: 1rem 1.5rem; font-size: .78rem; color: var(--ink-muted); text-align: center; border-top: 1px solid var(--line); background: var(--panel); }

/* Public (signed-out) pages */
.public-body { min-height: 100vh; display: flex; flex-direction: column; }
.public-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 2rem; background: #fff; border-bottom: 1px solid var(--line); }
.public-main { flex: 1; padding: 2rem 1.5rem; }

/* ------------------------------------------------------------------ Cards */
.card { --bs-card-border-color: var(--line); --bs-card-border-radius: var(--radius-lg); --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
        border: 1px solid var(--line) !important; box-shadow: var(--shadow-1) !important; background: var(--panel); }
.card.shadow-sm, .card.shadow { box-shadow: var(--shadow-1) !important; }
.card-header { background: var(--panel) !important; border-bottom: 1px solid var(--line) !important; font-weight: 600; padding: .85rem 1.15rem; }
.card-footer { background: var(--panel-tint) !important; border-top: 1px solid var(--line) !important; }
.card-body { padding: 1.15rem; }
.card.border-primary, .card.border-warning { border-color: var(--brand-300) !important; }

/* ------------------------------------------------------------------ Buttons */
.btn { --bs-btn-font-weight: 600; --bs-btn-border-radius: 999px; --bs-btn-padding-x: 1.15rem; --bs-btn-padding-y: .48rem; --bs-btn-font-size: .9rem;
       letter-spacing: .005em; }
.btn-sm { --bs-btn-padding-x: .85rem; --bs-btn-padding-y: .3rem; --bs-btn-font-size: .8rem; --bs-btn-border-radius: 999px; }
.btn-lg { --bs-btn-border-radius: 999px; }
.btn-primary {
  --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600);
  --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
  --bs-btn-active-bg: var(--brand-900); --bs-btn-active-border-color: var(--brand-900);
  --bs-btn-disabled-bg: #a98ee0; --bs-btn-disabled-border-color: #a98ee0;
  --bs-btn-focus-shadow-rgb: 91, 33, 182;
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-300);
  --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-color: var(--brand-700); --bs-btn-hover-border-color: var(--brand-600);
  --bs-btn-active-bg: var(--brand-100); --bs-btn-active-color: var(--brand-700); --bs-btn-active-border-color: var(--brand-600);
}
.btn-outline-secondary, .btn-light {
  --bs-btn-color: var(--ink-2); --bs-btn-bg: #fff; --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-color: var(--brand-700); --bs-btn-hover-border-color: var(--brand-300);
  --bs-btn-active-bg: var(--brand-100); --bs-btn-active-color: var(--brand-700); --bs-btn-active-border-color: var(--brand-300);
}
.btn-secondary { --bs-btn-bg: var(--ink-2); --bs-btn-border-color: var(--ink-2); --bs-btn-hover-bg: var(--ink); --bs-btn-hover-border-color: var(--ink); }
.btn-success { --bs-btn-bg: #15803d; --bs-btn-border-color: #15803d; --bs-btn-hover-bg: #116a33; --bs-btn-hover-border-color: #116a33; }
.btn-outline-success { --bs-btn-color: #15803d; --bs-btn-border-color: #9fd8b3; --bs-btn-hover-bg: var(--good-bg); --bs-btn-hover-color: #116a33; --bs-btn-hover-border-color: #15803d; }
.btn-danger { --bs-btn-bg: var(--accent-600); --bs-btn-border-color: var(--accent-600); --bs-btn-hover-bg: var(--accent-700); --bs-btn-hover-border-color: var(--accent-700); }
.btn-outline-danger { --bs-btn-color: var(--accent-600); --bs-btn-border-color: #f5b6d0; --bs-btn-hover-bg: var(--accent-50); --bs-btn-hover-color: var(--accent-700); --bs-btn-hover-border-color: var(--accent-600); }
.btn-warning { --bs-btn-bg: #f5b026; --bs-btn-border-color: #f5b026; }
.btn-link { --bs-btn-border-radius: .4rem; }
.btn-gradient {
  color: #fff; border: 0; background: linear-gradient(90deg, var(--accent-700), var(--brand-600));
  box-shadow: 0 4px 14px rgba(157, 23, 77, .25);
}
.btn-gradient:hover, .btn-gradient:focus { color: #fff; filter: brightness(1.07); }

/* ------------------------------------------------------------------ Forms */
.form-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }
.form-control, .form-select {
  border-color: var(--line-strong); border-radius: var(--radius-sm); font-size: .9rem; padding: .5rem .75rem; color: var(--ink);
  background-color: #fff;
}
.form-control-sm, .form-select-sm { font-size: .82rem; padding: .35rem .6rem; border-radius: .45rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 .2rem rgba(91, 33, 182, .14); }
.form-control::placeholder { color: #a3a0b4; }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--panel-tint); }
.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(91, 33, 182, .14); }
.lead-target-form { padding: .85rem; }
.lead-target-form .form-label { margin-bottom: .2rem; }
.lead-target-form .form-check { min-height: 2.25rem; display: flex; align-items: center; gap: .5rem; padding-left: .5rem; margin: 0; }
.lead-target-form .form-check-input { float: none; flex: 0 0 auto; margin: 0; }
.lead-target-form .form-check-label { font-size: .86rem; line-height: 1.25; }
.lead-target-form .form-control, .lead-target-form .form-select { padding-top: .38rem; padding-bottom: .38rem; }
.lead-target-form .alert { line-height: 1.35; }
.industry-choice { border-color: var(--industry-border, var(--line)) !important; background: var(--industry-bg, #fff); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.industry-choice:hover { border-color: var(--industry-color) !important; box-shadow: 0 3px 10px color-mix(in srgb, var(--industry-color) 15%, transparent); transform: translateY(-1px); }
.industry-choice .form-check-input:checked { background-color: var(--industry-color); border-color: var(--industry-color); }
.industry-icon { width: 1.65rem; height: 1.65rem; flex: 0 0 1.65rem; display: inline-grid; place-items: center; border-radius: .48rem; background: var(--industry-icon-bg); color: var(--industry-color); }
.industry-icon .bi { font-size: .95rem; }
.tone-blue { --industry-color:#2563eb; --industry-bg:#f4f8ff; --industry-border:#dbeafe; --industry-icon-bg:#e5efff; }
.tone-teal { --industry-color:#0f766e; --industry-bg:#f0fdfa; --industry-border:#ccfbf1; --industry-icon-bg:#ccfbf1; }
.tone-violet { --industry-color:#7c3aed; --industry-bg:#faf5ff; --industry-border:#ede9fe; --industry-icon-bg:#ede9fe; }
.tone-amber { --industry-color:#b45309; --industry-bg:#fffbeb; --industry-border:#fde68a; --industry-icon-bg:#fef3c7; }
.tone-orange { --industry-color:#c2410c; --industry-bg:#fff7ed; --industry-border:#fed7aa; --industry-icon-bg:#ffedd5; }
.tone-cyan { --industry-color:#0e7490; --industry-bg:#ecfeff; --industry-border:#a5f3fc; --industry-icon-bg:#cffafe; }
.tone-rose { --industry-color:#be123c; --industry-bg:#fff1f2; --industry-border:#fecdd3; --industry-icon-bg:#ffe4e6; }
.tone-green { --industry-color:#15803d; --industry-bg:#f0fdf4; --industry-border:#bbf7d0; --industry-icon-bg:#dcfce7; }
.tone-indigo { --industry-color:#4338ca; --industry-bg:#eef2ff; --industry-border:#c7d2fe; --industry-icon-bg:#e0e7ff; }
.tone-slate { --industry-color:#475569; --industry-bg:#f8fafc; --industry-border:#e2e8f0; --industry-icon-bg:#e2e8f0; }

.ai-chat-launcher { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1030; display: inline-flex; align-items: center; gap: .55rem; padding: .75rem 1rem; border: 0; border-radius: 999px; color: white; background: linear-gradient(135deg, var(--accent-700), var(--brand-600)); box-shadow: 0 8px 24px rgba(76, 29, 149, .28); font-weight: 650; }
.ai-chat-launcher:hover { color: white; filter: brightness(1.08); transform: translateY(-1px); }
.ai-chat-launcher .bi { font-size: 1rem; }
.ai-assistant { --bs-offcanvas-width: min(390px, 100vw); z-index: 1045; border: 0; box-shadow: var(--shadow-2); }
.ai-assistant-header { border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #fdf2f8, #f6f3ff); }
.ai-assistant-header .eyebrow { font-size: .62rem; color: var(--accent-700); letter-spacing: .1em; font-weight: 700; }
.ai-chat-messages { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: .7rem; min-height: 0; padding: 1rem; overflow-y: auto; background: linear-gradient(180deg, #fbfaff, #fff); }
.ai-chat-bubble { max-width: 90%; padding: .65rem .8rem; border-radius: .9rem; font-size: .88rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-chat-bubble.assistant { border: 1px solid var(--line); border-top-left-radius: .25rem; background: white; color: var(--ink-2); }
.ai-chat-bubble.user { align-self: flex-end; border-top-right-radius: .25rem; background: var(--brand-600); color: white; }
.ai-chat-form { display: flex; align-items: end; gap: .55rem; padding: .8rem; border-top: 1px solid var(--line); background: #fff; }
.ai-chat-form textarea { resize: none; min-height: 2.8rem; }
.ai-chat-form .btn { flex: 0 0 auto; width: 2.8rem; height: 2.8rem; padding: 0; }
@media (max-width: 575.98px) { .ai-chat-launcher { right: .8rem; bottom: .8rem; padding: .7rem .85rem; } }
@media (min-width: 1200px) and (min-height: 740px) {
  .page-body:has(.lead-target-form) { padding-top: .85rem; padding-bottom: .85rem; }
  .page-body:has(.lead-target-form) + .app-footer { padding-top: .55rem; padding-bottom: .55rem; }
}
.form-text { color: var(--ink-muted); font-size: .78rem; }
.input-group-text { background: var(--panel-tint); border-color: var(--line-strong); }
.text-danger { color: var(--bad) !important; }

/* ------------------------------------------------------------------ Tables */
.table { --bs-table-color: var(--ink); --bs-table-bg: transparent; --bs-table-border-color: var(--line);
         --bs-table-hover-bg: #faf8ff; --bs-table-striped-bg: #fbfaff; margin-bottom: 0; font-size: .88rem; }
.table > :not(caption) > * > * { padding: .7rem .85rem; border-bottom-color: var(--line); }
.table-sm > :not(caption) > * > * { padding: .5rem .7rem; }
.table thead th, .table > thead.table-light > tr > th, .table-light, .table-light > th, .table-light > td {
  background-color: #f1ecfb !important; color: var(--ink-2); font-weight: 600; font-size: .78rem; letter-spacing: .01em;
  border-bottom: 1px solid #e3dbf6 !important; white-space: nowrap;
}
.table-responsive { border-radius: inherit; }
.card > .table-responsive:first-child .table thead th:first-child,
.card > .table:first-child thead th:first-child { border-top-left-radius: calc(var(--radius-lg) - 1px); }
.card > .table-responsive:first-child .table thead th:last-child,
.card > .table:first-child thead th:last-child { border-top-right-radius: calc(var(--radius-lg) - 1px); }
.table-danger, .table > tbody > tr.table-danger > * { --bs-table-bg: var(--accent-50); --bs-table-color: var(--ink); background-color: var(--accent-50) !important; }
.table-warning, .table > tbody > tr.table-warning > * { background-color: var(--warn-bg) !important; }
.table a { font-weight: 500; }

/* ------------------------------------------------------------------ Badges & pills */
.badge { font-weight: 600; border-radius: 999px; padding: .38em .72em; font-size: .72rem; letter-spacing: .01em; }
.badge.bg-primary, .text-bg-primary { background: var(--brand-100) !important; color: var(--brand-700) !important; }
.badge.bg-success, .text-bg-success { background: var(--good-bg) !important; color: var(--good) !important; }
.badge.bg-danger, .text-bg-danger { background: var(--bad-bg) !important; color: var(--bad) !important; }
.badge.bg-warning, .text-bg-warning { background: var(--warn-bg) !important; color: var(--warn) !important; }
.badge.bg-info, .text-bg-info { background: #e6f2fd !important; color: #1d4f91 !important; }
.badge.bg-secondary, .text-bg-secondary { background: #eeedf3 !important; color: var(--ink-2) !important; }
.badge.bg-dark { background: #2a2738 !important; color: #fff !important; }
.badge.bg-light, .text-bg-light { background: #fff !important; color: var(--ink-2) !important; border: 1px solid var(--line-strong) !important; }

/* ------------------------------------------------------------------ Alerts */
.alert { border-radius: var(--radius); border: 1px solid transparent; border-left-width: 4px; font-size: .88rem; }
.alert-success { background: var(--good-bg); border-color: #c7ebd3; border-left-color: var(--good); color: #14532d; }
.alert-danger { background: var(--bad-bg); border-color: #f8c9d3; border-left-color: var(--bad); color: #7f1d33; }
.alert-warning { background: var(--warn-bg); border-color: #f6dfa7; border-left-color: #e3a008; color: #713f12; }
.alert-info, .alert-light { background: var(--brand-50); border-color: var(--brand-100); border-left-color: var(--brand-500); color: var(--ink-2); }
.alert-secondary { background: #f3f2f7; border-color: var(--line); border-left-color: var(--ink-muted); color: var(--ink-2); }

/* ------------------------------------------------------------------ Navigation widgets */
.nav-tabs { border-bottom: 1px solid var(--line); gap: .25rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--ink-muted); font-weight: 600; font-size: .88rem; padding: .6rem .9rem; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--brand-600); border-bottom-color: var(--brand-300); }
.nav-tabs .nav-link.active { color: var(--brand-700); background: transparent; border-bottom-color: var(--brand-600); }
.pagination { --bs-pagination-color: var(--brand-600); --bs-pagination-hover-bg: var(--brand-50); --bs-pagination-hover-color: var(--brand-700);
              --bs-pagination-active-bg: var(--brand-600); --bs-pagination-active-border-color: var(--brand-600);
              --bs-pagination-border-color: var(--line-strong); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(91,33,182,.14); }
.page-link { font-weight: 500; }
.dropdown-menu { border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: .35rem; }
.dropdown-item { border-radius: .45rem; font-size: .88rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--brand-50); color: var(--brand-700); }
.list-group-item { border-color: var(--line); }
.progress { background-color: #ece8f6; border-radius: 999px; }
.progress-bar { background: linear-gradient(90deg, var(--brand-600), var(--brand-500)); }
.btn-close:focus { box-shadow: 0 0 0 .2rem rgba(91,33,182,.14); }
details > summary { cursor: pointer; }
.border-primary { border-color: var(--brand-300) !important; }
.border-warning { border-color: #f1c35b !important; }


/* ------------------------------------------------------------------ Auth & landing */
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; max-width: 980px; margin: 2rem auto; background: #fff;
             border: 1px solid var(--line); border-radius: 1.25rem; overflow: hidden; box-shadow: var(--shadow-2); }
.auth-hero { position: relative; padding: 2.5rem; color: #fff; background: linear-gradient(140deg, var(--accent-700) 0%, var(--brand-600) 60%, var(--brand-700) 100%); overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 280px; height: 280px; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-hero h1 { color: #fff; font-size: 1.7rem; }
.auth-hero p, .auth-hero li { color: rgba(255,255,255,.88); }
.auth-hero ul { padding-left: 0; list-style: none; margin-top: 1.5rem; }
.auth-hero li { display: flex; gap: .6rem; margin-bottom: .7rem; font-size: .92rem; }
.auth-form { padding: 2.5rem; }
@media (max-width: 767.98px) { .auth-wrap { grid-template-columns: 1fr; margin: 0; } .auth-hero { padding: 1.75rem; } .auth-form { padding: 1.75rem; } }

.hero-band { border-radius: 1.25rem; padding: 2.5rem; color: #fff; background: linear-gradient(120deg, var(--accent-700), var(--brand-600) 55%, var(--brand-700)); box-shadow: var(--shadow-2); }
.hero-band h1 { color: #fff; }
.hero-band p { color: rgba(255,255,255,.88); }
.feature-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); font-size: 1.2rem; }

/* ------------------------------------------------------------------ Home dashboard */
.dash {
  /* Validated categorical palette (fixed slot order) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --prior: #b9b5c8; --track: #eeebf5;
  --status-critical: #d03b3b; --status-serious: #ec835a; --status-warning: #fab219; --status-good: #0ca30c;
}
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.dash-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.search-box { position: relative; }
.search-box .bi { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--ink-muted); font-size: .9rem; }
.search-box .form-control { padding-left: 2.2rem; border-radius: 999px; width: 230px; background: #fff; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; }
.seg-btn { padding: .3rem .8rem; border-radius: 999px; font-size: .8rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.seg-btn:hover { color: var(--brand-700); background: var(--brand-50); }
.seg-btn.active { background: var(--brand-600); color: #fff; }

/* KPI tiles */
.kpi-tile { display: flex; justify-content: space-between; align-items: center; gap: 1rem; height: 100%;
            padding: 1.1rem 1.2rem; border-radius: var(--radius-lg); text-decoration: none; color: var(--ink);
            border: 1px solid transparent; transition: transform .12s ease, box-shadow .12s ease; }
.kpi-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); color: var(--ink); }
.kpi-tile.tone-pink  { background: #fdecf3; border-color: #f8d3e3; }
.kpi-tile.tone-green { background: #e8f7ee; border-color: #cdeedb; }
.kpi-tile.tone-peach { background: #fff0e8; border-color: #fbdccb; }
.kpi-tile.tone-blue  { background: #e9f0fd; border-color: #d3e1fb; }
.kpi-label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.kpi-value { font-size: 1.65rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-vs { font-size: .72rem; color: var(--ink-muted); width: 100%; }
.kpi-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 1.15rem; flex: 0 0 auto;
            background: #db2777; box-shadow: 0 4px 12px rgba(219, 39, 119, .3); }
.delta { display: inline-flex; align-items: center; gap: .15rem; font-size: .72rem; font-weight: 700; padding: .12rem .45rem; border-radius: 999px; border: 1px solid; background: #fff; }
.delta-up { color: #15803d; border-color: #a7e3bd; }
.delta-down { color: #be123c; border-color: #f7b8c6; }
.delta-flat { color: var(--ink-muted); border-color: var(--line-strong); }

/* Chart cards */
.chart-card .card-body { padding: 1.15rem 1.25rem; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .9rem; }
.chart-head > a { font-size: .8rem; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.eyebrow { font-size: .7rem; color: var(--ink-muted); letter-spacing: .02em; }
.chart-title { font-size: 1rem; font-weight: 700; margin: 0; }
.empty { color: var(--ink-muted); font-size: .9rem; margin: 1.5rem 0; text-align: center; }

/* Donut with legends on both sides */
.donut-wrap { display: grid; grid-template-columns: 1fr minmax(170px, 230px) 1fr; align-items: center; gap: 1rem; }
.donut-lg { width: 100%; height: auto; }
.donut-seg { transition: stroke-width .12s ease; }
.donut-seg:hover { stroke-width: 31; }
.donut-total { font-size: 30px; font-weight: 700; fill: var(--ink); }
.donut-cap { font-size: 12px; fill: var(--ink-muted); }
.donut-legend { display: flex; flex-direction: column; gap: .7rem; margin: 0; }
.donut-legend li { display: flex; align-items: center; gap: .55rem; font-size: .82rem; }
.donut-wrap > .donut-legend:first-child li { justify-content: flex-end; text-align: right; }
.donut-legend .name { display: block; color: var(--ink-2); font-weight: 600; }
.donut-legend .pct { display: block; color: var(--ink-muted); font-size: .74rem; }
.donut-legend li.zero { opacity: .45; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }

/* SVG bar charts */
.bar-chart { width: 100%; height: auto; display: block; }
.bar-chart .grid { stroke: #ece9f3; stroke-width: 1; }
.bar-chart .baseline { stroke: #cfcadb; stroke-width: 1; }
.bar-chart .axis { font-size: 10.5px; fill: var(--ink-muted); }
.bar-chart .hit { fill: transparent; }
.bar-chart .bar-group:hover .hit { fill: rgba(91, 33, 182, .05); }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.1rem; font-size: .78rem; color: var(--ink-2); margin-top: .5rem; }
.chart-legend > span { display: inline-flex; align-items: center; gap: .4rem; }

/* Horizontal rows (pending work, industries) */
.hlist { display: flex; flex-direction: column; gap: 2px; }
.hrow { display: grid; grid-template-columns: minmax(0, 11.5rem) 1fr 2.2rem; align-items: center; gap: .7rem; padding: .38rem .35rem;
        border-radius: .5rem; color: var(--ink-2); text-decoration: none; font-size: .82rem; }
.hrow:hover { background: var(--brand-50); color: var(--ink); }
.hrow-label { display: flex; align-items: center; gap: .45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow-track { height: 12px; background: var(--track); border-radius: 0 6px 6px 0; overflow: hidden; }
.hrow-fill { display: block; height: 100%; border-radius: 0 6px 6px 0; background: var(--brand-600); min-width: 0; }
.hrow-value { text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.hrow.zero { opacity: .5; }
.hrow.status-critical .bi { color: var(--status-critical); }
.hrow.status-critical .hrow-fill { background: var(--status-critical); }
.hrow.status-serious .bi { color: var(--status-serious); }
.hrow.status-serious .hrow-fill { background: var(--status-serious); }
.hrow.status-warning .bi { color: #c98500; }
.hrow.status-warning .hrow-fill { background: var(--status-warning); }
.all-clear { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; margin-bottom: .6rem; border-radius: .6rem;
             background: var(--good-bg); color: var(--good); font-weight: 600; font-size: .85rem; }

/* Results */
.found .progress { height: 8px; }
.found .progress-bar { background: var(--brand-600); }
.found-foot { border-top: 1px dashed var(--line-strong); padding-top: .75rem; display: grid; gap: .4rem; font-size: .82rem; }
.found-foot > div { display: flex; justify-content: space-between; color: var(--ink-muted); }
.found-foot strong { color: var(--ink); }

/* Follow-up list */
.task-list li { display: flex; align-items: center; gap: .85rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.task-list li:last-child { border-bottom: 0; }
.task-date { width: 44px; height: 46px; border-radius: .6rem; background: var(--brand-50); color: var(--brand-700); display: flex; flex-direction: column;
             align-items: center; justify-content: center; line-height: 1; flex: 0 0 auto; }
.task-date .d { font-weight: 700; font-size: 1rem; }
.task-date .m { font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; }
.task-date.overdue { background: var(--bad-bg); color: var(--bad); }
.task-body { display: flex; flex-direction: column; min-width: 0; }
.task-body a { font-weight: 600; font-size: .88rem; }
.stage-pill { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 600; color: var(--ink-2);
              padding: .2rem .6rem; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; }

@media (max-width: 767.98px) {
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .donut-wrap > .donut-legend:first-child li { justify-content: flex-start; text-align: left; }
  .donut-lg { max-width: 220px; }
  .search-box .form-control { width: 100%; }
  .hrow { grid-template-columns: minmax(0, 9rem) 1fr 2rem; }
}

/* Info buttons follow the brand (used for research actions) */
.btn-info { --bs-btn-color: #fff; --bs-btn-bg: var(--brand-500); --bs-btn-border-color: var(--brand-500); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); }
.btn-outline-info { --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-300); --bs-btn-hover-color: var(--brand-700); --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-100); --bs-btn-active-color: var(--brand-700); }
.btn-dark { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700); }
