/* Finprov Finance — app theme on top of Bootstrap 5.3.
   Brand colours come from the logo: navy #2F3A81 and sky #3CA5DC.
   Styling only: no page logic depends on anything here. */

/* ---------- Tokens ---------- */
:root {
  --brand-navy: #2F3A81;
  --brand-sky: #3CA5DC;
  --brand-grad: linear-gradient(135deg, #2F3A81 0%, #3D4FC4 55%, #3CA5DC 100%);

  --app-page-bg: #F5F6FA;
  --app-surface: #FFFFFF;
  --app-muted-surface: #F8F9FC;
  --app-line: #E5E7EF;
  --app-line-strong: #D5D9E4;
  --app-hover: #F1F3F9;
  --app-shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --app-shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --app-shadow-md: 0 8px 24px -6px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
  --app-radius: .75rem;
  --app-radius-sm: .5rem;
  --app-radius-lg: 1rem;

  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-color: #1B1F2A;
  --bs-body-color-rgb: 27, 31, 42;
  --bs-emphasis-color: #0F121A;
  --bs-secondary-color: #667085;
  --bs-tertiary-bg: #F4F5F9;
  --bs-secondary-bg: #ECEEF4;
  --bs-border-color: var(--app-line);
  --bs-border-radius: var(--app-radius-sm);
  --bs-border-radius-lg: var(--app-radius);

  --bs-primary: #3D4FC4;
  --bs-primary-rgb: 61, 79, 196;
  --bs-primary-text-emphasis: #27348A;
  --bs-primary-bg-subtle: #ECEEFB;
  --bs-primary-border-subtle: #C9CFF2;
  --bs-link-color: #3D4FC4;
  --bs-link-color-rgb: 61, 79, 196;
  --bs-link-hover-color: #2F3A81;
  --bs-link-hover-color-rgb: 47, 58, 129;
  --bs-focus-ring-color: rgba(61, 79, 196, .25);
  --app-focus: 0 0 0 .2rem rgba(61, 79, 196, .22);
}

[data-bs-theme="dark"] {
  --app-page-bg: #0E1016;
  --app-surface: #161922;
  --app-muted-surface: #1B1F2A;
  --app-line: #262B37;
  --app-line-strong: #333949;
  --app-hover: #1E2230;
  --app-shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --app-shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --app-shadow-md: 0 10px 28px -8px rgba(0, 0, 0, .6);

  --bs-body-bg: #161922;
  --bs-body-bg-rgb: 22, 25, 34;
  --bs-body-color: #DCE0EA;
  --bs-body-color-rgb: 220, 224, 234;
  --bs-emphasis-color: #F4F6FB;
  --bs-secondary-color: #98A1B3;
  --bs-tertiary-bg: #1B1F2A;
  --bs-secondary-bg: #222736;
  --bs-border-color: var(--app-line);

  --bs-primary: #6474E8;
  --bs-primary-rgb: 100, 116, 232;
  --bs-primary-text-emphasis: #AEB8F7;
  --bs-primary-bg-subtle: rgba(100, 116, 232, .14);
  --bs-primary-border-subtle: rgba(100, 116, 232, .4);
  --bs-link-color: #9AA6F7;
  --bs-link-color-rgb: 154, 166, 247;
  --bs-link-hover-color: #C2C9FA;
  --bs-link-hover-color-rgb: 194, 201, 250;
  --bs-focus-ring-color: rgba(100, 116, 232, .35);
  --app-focus: 0 0 0 .2rem rgba(100, 116, 232, .35);
}

/* ---------- Base ---------- */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background-color: var(--app-page-bg); font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--bs-emphasis-color); letter-spacing: -.015em; font-weight: 650; }
.h6.text-uppercase, h2.text-uppercase { font-size: .72rem; letter-spacing: .07em; font-weight: 600; }
::selection { background: rgba(var(--bs-primary-rgb), .2); }
@media (min-width: 1200px) { .container { max-width: 1200px; } }
main.container { padding-top: 1.75rem; padding-bottom: 3rem; }
.text-muted { color: var(--bs-secondary-color) !important; }

/* Light-only Bootstrap utilities follow the theme surfaces. */
.bg-white { background-color: var(--app-surface) !important; }
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .text-bg-light { background-color: var(--bs-tertiary-bg) !important; }
[data-bs-theme="dark"] .bg-light.text-dark,
[data-bs-theme="dark"] .text-bg-light { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .btn-outline-dark {
  --bs-btn-color: #f8f9fa; --bs-btn-border-color: #f8f9fa;
  --bs-btn-hover-color: #000; --bs-btn-hover-bg: #f8f9fa; --bs-btn-hover-border-color: #f8f9fa;
  --bs-btn-active-color: #000; --bs-btn-active-bg: #f8f9fa; --bs-btn-active-border-color: #f8f9fa;
}
.border, .border-bottom, .border-top { border-color: var(--app-line) !important; }
.rounded-3 { border-radius: var(--app-radius) !important; }
.shadow-sm { box-shadow: var(--app-shadow-sm) !important; }

/* ---------- Buttons ---------- */
.btn {
  --bs-btn-font-weight: 550;
  --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .5rem; --bs-btn-font-size: .875rem;
  --bs-btn-border-radius: .625rem;
  --bs-btn-focus-box-shadow: var(--app-focus);
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  letter-spacing: -.005em;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s;
}
.btn-sm { --bs-btn-padding-x: .7rem; --bs-btn-padding-y: .3rem; --bs-btn-border-radius: .5rem; --bs-btn-font-size: .8125rem; }
.btn-lg { --bs-btn-border-radius: .75rem; }
.btn:active { transform: translateY(1px); }
.btn-link { display: inline; }
.btn svg { width: 1em; height: 1em; flex: none; }

.btn-primary {
  --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: #3343AE; --bs-btn-hover-border-color: #3343AE;
  --bs-btn-active-bg: #2B3A99; --bs-btn-active-border-color: #2B3A99;
  --bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
  box-shadow: var(--app-shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn-primary:hover { box-shadow: 0 4px 12px -2px rgba(var(--bs-primary-rgb), .4), inset 0 1px 0 rgba(255, 255, 255, .14); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #5566DD; --bs-btn-border-color: #5566DD; --bs-btn-hover-bg: #6474E8; --bs-btn-hover-border-color: #6474E8; --bs-btn-active-bg: #4B5BCC; }

.btn-success { box-shadow: var(--app-shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .14);
  --bs-btn-bg: #12996B; --bs-btn-border-color: #12996B; --bs-btn-hover-bg: #0F855D; --bs-btn-hover-border-color: #0F855D; }
.btn-warning { --bs-btn-bg: #F5B301; --bs-btn-border-color: #F5B301; --bs-btn-color: #3D2C00; --bs-btn-hover-bg: #E3A600; --bs-btn-hover-border-color: #E3A600; --bs-btn-hover-color: #2A1E00; box-shadow: var(--app-shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-danger { --bs-btn-bg: #D92D41; --bs-btn-border-color: #D92D41; --bs-btn-hover-bg: #C02437; --bs-btn-hover-border-color: #C02437; }

.btn-outline-primary {
  --bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary-border-subtle);
  --bs-btn-bg: var(--app-surface);
  --bs-btn-hover-color: var(--bs-primary-text-emphasis); --bs-btn-hover-bg: var(--bs-primary-bg-subtle); --bs-btn-hover-border-color: var(--bs-primary);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
}
/* Neutral "outline" buttons read as quiet secondary actions. */
.btn-outline-secondary, .btn-secondary, .btn-light {
  --bs-btn-color: var(--bs-body-color); --bs-btn-bg: var(--app-surface); --bs-btn-border-color: var(--app-line-strong);
  --bs-btn-hover-color: var(--bs-emphasis-color); --bs-btn-hover-bg: var(--app-hover); --bs-btn-hover-border-color: var(--app-line-strong);
  --bs-btn-active-color: var(--bs-emphasis-color); --bs-btn-active-bg: var(--bs-secondary-bg); --bs-btn-active-border-color: var(--app-line-strong);
  --bs-btn-disabled-color: var(--bs-secondary-color); --bs-btn-disabled-bg: var(--app-surface); --bs-btn-disabled-border-color: var(--app-line);
  box-shadow: var(--app-shadow-xs);
}
.btn-outline-danger {
  --bs-btn-color: #D92D41; --bs-btn-border-color: rgba(217, 45, 65, .35); --bs-btn-bg: var(--app-surface);
  --bs-btn-hover-bg: rgba(217, 45, 65, .08); --bs-btn-hover-color: #B4232F; --bs-btn-hover-border-color: #D92D41;
  --bs-btn-active-bg: #D92D41; --bs-btn-active-border-color: #D92D41;
}
[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color: #F47C89; --bs-btn-hover-color: #F9A3AD; }

/* ---------- Cards, accordions, alerts ---------- */
.card {
  --bs-card-border-color: var(--app-line); --bs-card-border-radius: var(--app-radius-lg);
  --bs-card-inner-border-radius: calc(var(--app-radius-lg) - 1px);
  --bs-card-bg: var(--app-surface); --bs-card-cap-bg: var(--app-muted-surface);
  --bs-card-spacer-y: 1.25rem; --bs-card-spacer-x: 1.25rem;
  box-shadow: var(--app-shadow-sm);
}
.accordion {
  --bs-accordion-bg: var(--app-surface); --bs-accordion-border-color: var(--app-line);
  --bs-accordion-border-radius: var(--app-radius); --bs-accordion-inner-border-radius: calc(var(--app-radius) - 1px);
  --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis);
  --bs-accordion-btn-focus-box-shadow: var(--app-focus);
}
.accordion-button { font-weight: 600; }
.accordion-item { box-shadow: none; }
.accordion { box-shadow: var(--app-shadow-xs); border-radius: var(--app-radius); }

.alert {
  --bs-alert-border-radius: var(--app-radius); --bs-alert-padding-y: .8rem; --bs-alert-padding-x: 1rem;
  border-width: 1px; border-left-width: 3px; font-size: .9rem;
}
.alert-primary { --bs-alert-bg: var(--bs-primary-bg-subtle); --bs-alert-border-color: var(--bs-primary-border-subtle); --bs-alert-color: var(--bs-primary-text-emphasis); border-left-color: var(--bs-primary); }
.alert-info    { border-left-color: var(--bs-info); }
.alert-success { border-left-color: var(--bs-success); }
.alert-warning { border-left-color: var(--bs-warning); }
.alert-danger  { border-left-color: var(--bs-danger); }
.alert-secondary, .alert-light { --bs-alert-bg: var(--app-surface); --bs-alert-border-color: var(--app-line); --bs-alert-color: var(--bs-body-color); border-left-color: var(--bs-secondary-color); }

/* ---------- Badges: soft tinted pills ---------- */
.badge { --bs-badge-font-weight: 600; --bs-badge-padding-x: .6em; --bs-badge-padding-y: .38em;
         --bs-badge-border-radius: 999px; letter-spacing: .01em; }
.badge.bg-success, .badge.text-bg-success { background-color: rgba(18, 153, 107, .13) !important; color: #0B7A55 !important; }
.badge.bg-danger,  .badge.text-bg-danger  { background-color: rgba(217, 45, 65, .12) !important; color: #B4232F !important; }
.badge.bg-warning, .badge.text-bg-warning { background-color: rgba(230, 160, 0, .18) !important; color: #8A5B00 !important; }
.badge.bg-info,    .badge.text-bg-info    { background-color: rgba(60, 165, 220, .16) !important; color: #146A96 !important; }
.badge.bg-primary, .badge.text-bg-primary { background-color: var(--bs-primary-bg-subtle) !important; color: var(--bs-primary-text-emphasis) !important; }
.badge.bg-secondary, .badge.text-bg-secondary { background-color: var(--bs-secondary-bg) !important; color: var(--bs-secondary-color) !important; }
.badge.text-bg-light, .badge.bg-light { background-color: var(--bs-tertiary-bg) !important; color: var(--bs-body-color) !important; border: 1px solid var(--app-line); }
[data-bs-theme="dark"] .badge.bg-success, [data-bs-theme="dark"] .badge.text-bg-success { background-color: rgba(52, 211, 153, .14) !important; color: #6EE7B7 !important; }
[data-bs-theme="dark"] .badge.bg-danger,  [data-bs-theme="dark"] .badge.text-bg-danger  { background-color: rgba(244, 124, 137, .15) !important; color: #F9A3AD !important; }
[data-bs-theme="dark"] .badge.bg-warning, [data-bs-theme="dark"] .badge.text-bg-warning { background-color: rgba(251, 191, 36, .15) !important; color: #FCD34D !important; }
[data-bs-theme="dark"] .badge.bg-info,    [data-bs-theme="dark"] .badge.text-bg-info    { background-color: rgba(60, 165, 220, .16) !important; color: #7CC8EE !important; }
/* A count inside a tab stays solid so it still catches the eye. */
.nav-link .badge.bg-danger { background-color: #D92D41 !important; color: #fff !important; }

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: var(--app-surface);
  --bs-table-border-color: var(--app-line);
  --bs-table-hover-bg: var(--app-hover);
  --bs-table-striped-bg: var(--app-muted-surface);
  font-variant-numeric: tabular-nums; font-size: .875rem;
  border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--app-line); border-radius: var(--app-radius); overflow: hidden;
  box-shadow: var(--app-shadow-xs);
}
.table > :not(caption) > * > * { padding: .7rem .9rem; border-bottom-width: 1px; border-color: var(--app-line); }
.table-sm > :not(caption) > * > * { padding: .45rem .65rem; }
.table > thead > tr > th, .table > thead > tr > td, .table thead.table-light th {
  background: var(--app-muted-surface); color: var(--bs-secondary-color);
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--app-line); white-space: nowrap; vertical-align: middle;
}
.table > tbody > tr:last-child > *, .table > tfoot > tr:last-child > * { border-bottom-width: 0; }
.table > tbody > tr { transition: background-color .12s; }
.table > tbody > tr:hover > * { --bs-table-bg-state: var(--app-hover); }
.table > tfoot > tr > * { background: var(--app-muted-surface); font-weight: 600; border-top: 1px solid var(--app-line-strong); }
/* Bordered tables: keep only faint column lines. */
.table-bordered > :not(caption) > * { border-width: 0; }
.table-bordered > :not(caption) > * > * { border-width: 0 0 1px 0; }
.table-bordered > :not(caption) > * > * + * { border-left: 1px solid var(--app-line); }
.table-borderless { border: 0; box-shadow: none; }
.table-borderless > :not(caption) > * > * { border: 0; }
.table thead.table-light { --bs-table-bg: var(--app-muted-surface); --bs-table-color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .table-light { --bs-table-bg: var(--app-muted-surface); --bs-table-color: var(--bs-secondary-color); --bs-table-border-color: var(--app-line); }
.table-responsive { border-radius: var(--app-radius); }
.table-responsive > .table { margin-bottom: 0; }
.table-responsive.border > .table { border: 0; box-shadow: none; border-radius: 0; }
.table-responsive.border { box-shadow: var(--app-shadow-xs); }
.table td a:not(.btn) { font-weight: 550; text-decoration: none; }
.table td a:not(.btn):hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.form-label { font-size: .8125rem; font-weight: 600; color: var(--bs-emphasis-color); margin-bottom: .35rem; }
.form-control, .form-select {
  border-color: var(--app-line-strong); border-radius: .625rem; background-color: var(--app-surface);
  padding: .55rem .8rem; font-size: .875rem; box-shadow: var(--app-shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
.form-select { padding-right: 2.25rem; }
.form-control-sm, .form-select-sm { border-radius: .5rem; padding: .32rem .65rem; font-size: .8125rem; }
.form-select-sm { padding-right: 2rem; }
.form-control:hover, .form-select:hover { border-color: #BCC2D1; }
[data-bs-theme="dark"] .form-control:hover, [data-bs-theme="dark"] .form-select:hover { border-color: #434A5C; }
.form-control:focus, .form-select:focus { border-color: var(--bs-primary); box-shadow: var(--app-focus); }
.form-control::placeholder { color: #98A1B3; }
.form-control[type="file"] { padding: .4rem; }
.form-control::file-selector-button {
  margin: -.4rem .75rem -.4rem -.4rem; padding: .55rem .9rem; border: 0; border-right: 1px solid var(--app-line);
  background: var(--bs-tertiary-bg); color: var(--bs-emphasis-color); font-weight: 600;
}
.form-check-input { border-color: var(--app-line-strong); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.form-check-input:focus { border-color: var(--bs-primary); box-shadow: var(--app-focus); }
.form-text { color: var(--bs-secondary-color); font-size: .8rem; }
.input-group > .btn { box-shadow: none; }

/* ---------- Breadcrumb, tabs, dropdowns ---------- */
.breadcrumb { --bs-breadcrumb-divider-color: var(--bs-secondary-color); --bs-breadcrumb-item-padding-x: .45rem; font-size: .8rem; }
.breadcrumb-item + .breadcrumb-item::before { content: "›"; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--bs-primary) !important; }

.nav-tabs {
  --bs-nav-tabs-border-color: var(--app-line); --bs-nav-tabs-border-width: 1px;
  --bs-nav-tabs-link-active-bg: transparent; --bs-nav-tabs-link-active-color: var(--bs-emphasis-color);
  --bs-nav-tabs-link-active-border-color: transparent; --bs-nav-tabs-link-hover-border-color: transparent;
  gap: .25rem;
}
.nav-tabs .nav-link {
  color: var(--bs-secondary-color); font-weight: 550; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; padding: .6rem .9rem; margin-bottom: -1px; display: inline-flex; align-items: center; gap: .35rem;
}
.nav-tabs .nav-link:hover { color: var(--bs-emphasis-color); border-bottom-color: var(--app-line-strong); }
.nav-tabs .nav-link.active { color: var(--bs-primary); border-bottom-color: var(--bs-primary); background: transparent; }

.dropdown-menu {
  --bs-dropdown-border-color: var(--app-line); --bs-dropdown-border-radius: var(--app-radius);
  --bs-dropdown-link-active-bg: var(--bs-primary); --bs-dropdown-link-hover-bg: var(--app-hover);
  --bs-dropdown-bg: var(--app-surface); --bs-dropdown-padding-y: .35rem; --bs-dropdown-item-padding-x: .75rem;
  box-shadow: var(--app-shadow-md); padding-left: .35rem; padding-right: .35rem; min-width: 14rem;
}
.dropdown-item { border-radius: .45rem; font-size: .875rem; padding-top: .45rem; padding-bottom: .45rem;
                 display: flex; align-items: center; gap: .55rem; }
.dropdown-item svg { width: 1rem; height: 1rem; color: var(--bs-secondary-color); }
.dropdown-item.text-danger svg { color: currentColor; }
.dropdown-header { font-size: .8rem; }

.spinner-border-sm { --bs-spinner-border-width: .15em; }
.progress { --bs-progress-bar-bg: var(--bs-primary); --bs-progress-border-radius: 999px; }
code { color: var(--bs-primary-text-emphasis); }

/* ---------- App header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 1030;
  background: color-mix(in srgb, var(--app-surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--app-line);
}
.app-header .navbar { padding: .55rem 0; }
.app-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--bs-emphasis-color); margin-right: 1.25rem; }
.app-brand img { height: 2.6rem; width: auto; }
.app-brand-tag { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
                 color: var(--bs-secondary-color); padding-left: .6rem; border-left: 1px solid var(--app-line-strong); }
[data-bs-theme="dark"] .app-brand img { background: #fff; border-radius: .5rem; padding: .15rem .35rem; }

.app-topnav { gap: .15rem; }
.app-topnav .nav-link {
  padding: .4rem .75rem !important; border-radius: .55rem; font-weight: 550; font-size: .875rem;
  color: var(--bs-secondary-color); display: inline-flex; align-items: center; gap: .45rem;
}
.app-topnav .nav-link svg { width: 1rem; height: 1rem; }
.app-topnav .nav-link:hover { color: var(--bs-emphasis-color); background: var(--app-hover); }
.app-topnav .nav-link.active { color: var(--bs-emphasis-color); background: var(--bs-secondary-bg); }

.icon-btn {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 1px solid var(--app-line); border-radius: .65rem; background: var(--app-surface);
  color: var(--bs-emphasis-color); box-shadow: var(--app-shadow-xs);
  transition: background-color .2s, border-color .2s, transform .15s;
}
.icon-btn:hover { background: var(--app-hover); border-color: var(--app-line-strong); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:focus-visible { outline: 0; box-shadow: var(--app-focus); }

.theme-toggle svg { grid-area: 1 / 1; width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor;
                    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
                    transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .25s; }
.theme-toggle .icon-moon { fill: currentColor; }
.theme-toggle .icon-sun { color: #F5B301; opacity: 0; transform: rotate(-90deg) scale(.4); }
[data-bs-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.4); }
[data-bs-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: none; }

.user-chip {
  display: inline-flex; align-items: center; gap: .55rem; padding: .25rem .6rem .25rem .25rem;
  border: 1px solid var(--app-line); border-radius: 999px; background: var(--app-surface);
  color: var(--bs-emphasis-color); box-shadow: var(--app-shadow-xs); font-size: .85rem; line-height: 1.1;
  transition: background-color .15s, border-color .15s;
}
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--app-hover); border-color: var(--app-line-strong); }
.user-chip:focus-visible { outline: 0; box-shadow: var(--app-focus); }
.user-chip .avatar {
  width: 1.85rem; height: 1.85rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-grad); color: #fff; font-weight: 700; font-size: .78rem; text-transform: uppercase;
}
.user-chip .who { text-align: left; }
.user-chip .who b { display: block; font-weight: 600; }
.user-chip .who small { display: block; color: var(--bs-secondary-color); font-size: .7rem; }
.user-chip .chev { width: .85rem; height: .85rem; color: var(--bs-secondary-color); }
.app-header .navbar-toggler { border: 1px solid var(--app-line); border-radius: .65rem; padding: .35rem .55rem; }
.app-header .navbar-toggler:focus { box-shadow: var(--app-focus); }
@media (max-width: 767.98px) {
  .app-header .navbar-collapse { padding: .75rem 0 .25rem; }
  .app-header .user-menu { margin-top: .5rem; }
}

/* ---------- Module bar ---------- */
.module-bar { background: var(--app-surface); border-bottom: 1px solid var(--app-line); }
.module-bar .container { display: flex; align-items: center; gap: 1rem; min-height: 3.25rem; }
.module-title { display: flex; align-items: center; gap: .55rem; font-weight: 650; font-size: .9rem;
                color: var(--bs-emphasis-color); white-space: nowrap; letter-spacing: -.01em; }
.module-title .module-icon { width: 1.75rem; height: 1.75rem; border-radius: .5rem; display: grid; place-items: center;
                              background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.module-title .module-icon svg { width: 1rem; height: 1rem; }
.module-links { display: flex; align-items: center; gap: .15rem; flex: 1 1 auto; overflow-x: auto;
                scrollbar-width: none; padding: .5rem 0; }
.module-links::-webkit-scrollbar { display: none; }
.module-sep { width: 1px; height: 1.25rem; background: var(--app-line-strong); margin: 0 .35rem; flex: none; }
.module-link {
  display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .7rem; border-radius: .55rem;
  font-size: .85rem; font-weight: 550; color: var(--bs-secondary-color); text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.module-link svg { width: .95rem; height: .95rem; opacity: .85; }
.module-link:hover { color: var(--bs-emphasis-color); background: var(--app-hover); }
.module-link.active { color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.module-link.active svg { opacity: 1; }

/* Assistant: the standout entry in the module bar. */
.assistant-link {
  position: relative; display: inline-flex; align-items: center; gap: .45rem; flex: none; margin-left: auto;
  padding: .42rem .85rem .42rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
  color: #fff; text-decoration: none; white-space: nowrap; background: var(--brand-grad);
  box-shadow: 0 4px 14px -4px rgba(61, 79, 196, .55), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.assistant-link:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.06);
                        box-shadow: 0 8px 20px -6px rgba(61, 79, 196, .65), inset 0 1px 0 rgba(255, 255, 255, .2); }
.assistant-link:focus-visible { outline: 0; box-shadow: var(--app-focus), 0 4px 14px -4px rgba(61, 79, 196, .55); }
.assistant-link svg { width: 1rem; height: 1rem; }
.assistant-link .spark { animation: app-twinkle 2.8s ease-in-out infinite; transform-origin: center; }
.assistant-link.active { box-shadow: 0 0 0 2px var(--app-surface), 0 0 0 4px rgba(var(--bs-primary-rgb), .45); }
.assistant-link .tag { font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
                       background: rgba(255, 255, 255, .22); padding: .1rem .4rem; border-radius: 999px; }
@keyframes app-twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.78) rotate(18deg); opacity: .75; } }
@media (max-width: 767.98px) {
  .module-bar .container { flex-wrap: wrap; gap: .25rem .75rem; padding-top: .5rem; }
  .module-links { order: 3; flex-basis: 100%; padding-top: .1rem; }
}

/* ---------- Page pieces ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; color: var(--bs-secondary-color); }

.hero {
  position: relative; overflow: hidden; border-radius: var(--app-radius-lg); padding: 2rem;
  background: var(--brand-grad); color: #fff; box-shadow: var(--app-shadow-md); margin-bottom: 1.75rem;
}
.hero::after { content: ""; position: absolute; right: -4rem; top: -4rem; width: 18rem; height: 18rem; border-radius: 50%;
               background: radial-gradient(closest-side, rgba(255, 255, 255, .22), transparent); pointer-events: none; }
.hero h1 { color: #fff; margin-bottom: .35rem; }
.hero p { color: rgba(255, 255, 255, .82); margin: 0; }
.hero .eyebrow { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: rgba(255, 255, 255, .7); margin-bottom: .5rem; }

.module-card {
  position: relative; display: flex; flex-direction: column; height: 100%; padding: 1.4rem;
  background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--app-shadow-md); border-color: var(--bs-primary-border-subtle); }
.module-card .mc-icon { width: 2.75rem; height: 2.75rem; border-radius: .8rem; display: grid; place-items: center;
                        background: var(--bs-primary-bg-subtle); color: var(--bs-primary); margin-bottom: 1rem; }
.module-card .mc-icon svg { width: 1.35rem; height: 1.35rem; }
.module-card h2 { font-size: 1.05rem; margin-bottom: .35rem; }
.module-card h2 a { color: inherit; text-decoration: none; }
.module-card p { color: var(--bs-secondary-color); font-size: .875rem; flex-grow: 1; margin-bottom: 1.1rem; }
.module-card .mc-actions { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: .5rem; }
.module-card .stretched-link::after { z-index: 1; }
.mc-assist {
  display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px;
  font-size: .8125rem; font-weight: 600; text-decoration: none; color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle); border: 1px solid var(--bs-primary-border-subtle); transition: background-color .15s;
}
.mc-assist:hover { background: rgba(var(--bs-primary-rgb), .18); color: var(--bs-primary-text-emphasis); }
.mc-assist svg { width: .9rem; height: .9rem; }

/* Generic SVG icon defaults used in templates. */
.i { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

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

/* Django's "error" message tag has no Bootstrap alert class of its own. */
.alert-error { --bs-alert-color: var(--bs-danger-text-emphasis); --bs-alert-bg: var(--bs-danger-bg-subtle);
               --bs-alert-border-color: var(--bs-danger-border-subtle); --bs-alert-link-color: var(--bs-danger-text-emphasis);
               border-left-color: var(--bs-danger); }

/* Assistant page header. */
.assist-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.assist-head-icon { flex: none; width: 3rem; height: 3rem; border-radius: .9rem; display: grid; place-items: center;
                    background: var(--brand-grad); color: #fff; box-shadow: 0 8px 20px -6px rgba(61, 79, 196, .6); }
.assist-head-icon svg { width: 1.4rem; height: 1.4rem; fill: currentColor; }
