/* ==========================================================================
   INSEE Ilakkaya – design system (on top of Bootstrap 5.3)

   Look: soft layered shadows, hairline borders, generous radii and frosted
   ("glass") chrome for the floating layers only – top bar, menus, dialogs,
   toasts, sticky action bars. Content surfaces stay solid so tables remain
   crisp and fast to scroll.

   Do not put transform / filter / backdrop-filter on .card or .app-main:
   Bootstrap modals rendered inside them are position:fixed and would be
   trapped by the new containing block.
   ========================================================================== */
:root {
  /* brand (unchanged) */
  --il-primary: #c8102e;          /* INSEE red */
  --il-primary-dark: #9c0c24;
  --il-primary-soft: #fbe9ec;
  --il-primary-rgb: 200, 16, 46;

  /* neutrals */
  --il-ink: #1f2933;
  --il-ink-strong: #111a23;
  --il-muted: #6b7280;
  --il-surface: #ffffff;
  --il-surface-2: #f8fafc;
  --il-bg: #f3f5f8;
  --il-border: #e3e7ee;
  --il-hairline: rgba(17, 26, 35, .08);

  /* sidebar (unchanged palette) */
  --il-sidebar-bg: #15202b;
  --il-sidebar-ink: #c9d1d9;
  --il-sidebar-active: #c8102e;

  /* shape */
  --il-radius: .9rem;
  --il-radius-sm: .65rem;
  --il-radius-lg: 1.25rem;

  /* elevation */
  --il-shadow-xs: 0 1px 2px rgba(17, 26, 35, .05);
  --il-shadow: 0 1px 2px rgba(17, 26, 35, .04), 0 4px 16px -6px rgba(17, 26, 35, .10);
  --il-shadow-md: 0 2px 4px rgba(17, 26, 35, .04), 0 12px 28px -10px rgba(17, 26, 35, .18);
  --il-shadow-lg: 0 4px 8px rgba(17, 26, 35, .04), 0 24px 56px -16px rgba(17, 26, 35, .28);
  --il-shadow-primary: 0 1px 2px rgba(var(--il-primary-rgb), .25), 0 8px 18px -8px rgba(var(--il-primary-rgb), .55);
  --il-ring: 0 0 0 .22rem rgba(var(--il-primary-rgb), .16);

  /* glass */
  --il-glass-bg: rgba(255, 255, 255, .72);
  --il-glass-bg-strong: rgba(255, 255, 255, .86);
  --il-glass-border: rgba(255, 255, 255, .7);
  --il-glass-blur: saturate(1.7) blur(18px);

  --il-ease: cubic-bezier(.2, .7, .2, 1);
  --il-sidebar-width: 260px;
  --il-topbar-height: 60px;

  --bs-body-font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-bg: var(--il-bg);
  --bs-body-color: var(--il-ink);
  --bs-primary: var(--il-primary);
  --bs-primary-rgb: 200, 16, 46;
  --bs-link-color: var(--il-primary);
  --bs-link-color-rgb: 200, 16, 46;
  --bs-link-hover-color: var(--il-primary-dark);
  --bs-link-hover-color-rgb: 156, 12, 36;
  --bs-border-color: var(--il-border);
  --bs-border-radius: var(--il-radius-sm);
  --bs-border-radius-sm: .5rem;
  --bs-border-radius-lg: var(--il-radius);
  --bs-box-shadow: var(--il-shadow-md);
  --bs-box-shadow-sm: var(--il-shadow);
  --bs-box-shadow-lg: var(--il-shadow-lg);
  --bs-focus-ring-color: rgba(var(--il-primary-rgb), .16);
}

/* min-height, not height: a fixed-height body ends after one screen, and the sticky top bar and
   sidebar would scroll away with it once the page is longer than the viewport */
html { height: 100%; }
body {
  min-height: 100%;
  font-size: .925rem; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  /* two very faint tints behind the neutral page colour give the glass layers something to blur */
  background:
    radial-gradient(900px 520px at -8% -12%, rgba(var(--il-primary-rgb), .07), transparent 62%),
    radial-gradient(900px 560px at 108% -8%, rgba(37, 99, 235, .05), transparent 60%),
    var(--il-bg);
  background-attachment: fixed;
}
h1, h2, h3, h4, h5, h6 { font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; letter-spacing: -.01em; color: var(--il-ink-strong); }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .18em; }
::selection { background: rgba(var(--il-primary-rgb), .18); }
:focus-visible { outline: 2px solid rgba(var(--il-primary-rgb), .55); outline-offset: 2px; }
hr { border-color: var(--il-hairline); opacity: 1; }

/* thin, quiet scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(17, 26, 35, .22) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(17, 26, 35, .2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(17, 26, 35, .35); }

/* Buttons --------------------------------------------------------------- */
.btn {
  --bs-btn-border-radius: var(--il-radius-sm); --bs-btn-font-weight: 500; --bs-btn-focus-box-shadow: var(--il-ring);
  font-weight: 500; letter-spacing: .005em;
  transition: background-color .15s var(--il-ease), border-color .15s var(--il-ease), color .15s var(--il-ease), box-shadow .2s var(--il-ease), transform .15s var(--il-ease);
}
.btn-sm { --bs-btn-border-radius: .55rem; }
.btn-lg { --bs-btn-border-radius: var(--il-radius); }
.btn:active:not(:disabled):not(.disabled) { transform: translateY(1px); }
.btn-primary {
  --bs-btn-bg: var(--il-primary); --bs-btn-border-color: var(--il-primary);
  --bs-btn-hover-bg: var(--il-primary-dark); --bs-btn-hover-border-color: var(--il-primary-dark);
  --bs-btn-active-bg: var(--il-primary-dark); --bs-btn-active-border-color: var(--il-primary-dark);
  --bs-btn-disabled-bg: #e39aa6; --bs-btn-disabled-border-color: #e39aa6;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 60%);
  box-shadow: var(--il-shadow-primary), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { box-shadow: 0 2px 4px rgba(var(--il-primary-rgb), .3), 0 12px 24px -8px rgba(var(--il-primary-rgb), .6), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-primary:disabled, .btn-primary.disabled { box-shadow: none; background-image: none; }
.btn-outline-primary {
  --bs-btn-color: var(--il-primary); --bs-btn-border-color: rgba(var(--il-primary-rgb), .45);
  --bs-btn-hover-bg: var(--il-primary); --bs-btn-hover-border-color: var(--il-primary);
  --bs-btn-active-bg: var(--il-primary-dark); --bs-btn-active-border-color: var(--il-primary-dark);
}
.btn-outline-secondary {
  --bs-btn-color: #374151; --bs-btn-border-color: #d5dbe3; --bs-btn-bg: var(--il-surface);
  --bs-btn-hover-color: var(--il-ink-strong); --bs-btn-hover-bg: var(--il-surface-2); --bs-btn-hover-border-color: #c3cbd6;
  box-shadow: var(--il-shadow-xs); /* active / checked keep Bootstrap's solid state so toggles stay obvious */
}
.btn-outline-danger { --bs-btn-border-color: rgba(220, 53, 69, .4); }
.btn-outline-success { --bs-btn-border-color: rgba(25, 135, 84, .4); }
.btn-light {
  --bs-btn-bg: rgba(17, 26, 35, .05); --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: rgba(17, 26, 35, .09); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: rgba(17, 26, 35, .13); --bs-btn-active-border-color: transparent;
}
.btn-icon { width: 2.1rem; height: 2.1rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-close:focus { box-shadow: var(--il-ring); }

/* Forms ----------------------------------------------------------------- */
.form-control, .form-select {
  border-radius: var(--il-radius-sm); border-color: #d5dbe3; background-color: var(--il-surface);
  box-shadow: var(--il-shadow-xs);
  transition: border-color .15s var(--il-ease), box-shadow .2s var(--il-ease), background-color .15s var(--il-ease);
}
.form-control:hover:not(:disabled):not([readonly]):not(:focus), .form-select:hover:not(:disabled):not(:focus) { border-color: #bcc5d1; }
.form-control:focus, .form-select:focus { border-color: var(--il-primary); box-shadow: var(--il-ring); }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--il-surface-2); box-shadow: none; }
.form-control::placeholder { color: #9aa3af; }
.form-control-sm, .form-select-sm { border-radius: .55rem; }
.form-label { font-weight: 600; color: #374151; margin-bottom: .3rem; }
.required > .form-label::after, label.required::after { content: " *"; color: var(--il-primary); }
.form-text { color: var(--il-muted); }
.input-group-text { background: var(--il-surface-2); border-color: #d5dbe3; color: var(--il-muted); border-radius: var(--il-radius-sm); }
.input-group > .form-control, .input-group > .form-select { box-shadow: none; }
.form-check-input { border-color: #c3cbd6; }
.form-check-input:checked { background-color: var(--il-primary); border-color: var(--il-primary); }
.form-check-input:focus { border-color: var(--il-primary); box-shadow: var(--il-ring); }
.form-check-input[type="checkbox"] { border-radius: .3em; }
.form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28200,16,46,.45%29'/%3e%3c/svg%3e"); }
.form-range::-webkit-slider-thumb { background: var(--il-primary); }
.form-range::-moz-range-thumb { background: var(--il-primary); }
.invalid-feedback { font-size: .8rem; }

/* Cards ----------------------------------------------------------------- */
.card {
  --bs-card-bg: var(--il-surface); --bs-card-border-color: var(--il-hairline); --bs-card-border-radius: var(--il-radius);
  --bs-card-inner-border-radius: calc(var(--il-radius) - 1px); --bs-card-cap-bg: transparent; --bs-card-spacer-x: 1.25rem;
  border: 1px solid var(--il-hairline); border-radius: var(--il-radius); box-shadow: var(--il-shadow);
}
.card-header { background: transparent; border-bottom: 1px solid var(--il-hairline); font-weight: 600; padding: .9rem 1.25rem; }
.card-header .card-title { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -.005em; color: var(--il-ink-strong); }
.card-footer { background: var(--il-surface-2); border-top: 1px solid var(--il-hairline); }
.card > .list-group { border-color: var(--il-hairline); }
.list-group { --bs-list-group-border-color: var(--il-hairline); --bs-list-group-bg: transparent; --bs-list-group-active-bg: var(--il-primary); --bs-list-group-active-border-color: var(--il-primary); }

/* Tables ---------------------------------------------------------------- */
.table {
  --bs-table-bg: transparent; --bs-table-striped-bg: rgba(17, 26, 35, .022); --bs-table-hover-bg: rgba(var(--il-primary-rgb), .045);
  --bs-table-border-color: #edf0f4; margin-bottom: 0; font-variant-numeric: tabular-nums;
}
.table > :not(caption) > * > * { padding: .7rem .9rem; }
.table-sm > :not(caption) > * > * { padding: .45rem .75rem; }
.table > thead th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--il-muted); font-weight: 600; background: var(--il-surface-2); border-bottom-width: 1px; white-space: nowrap; }
.table > tbody > tr:last-child > * { border-bottom-width: 0; }
.table > tbody > tr { transition: background-color .12s var(--il-ease); }
.table td { vertical-align: middle; }
.table-card .table-responsive { border-radius: 0 0 var(--il-radius) var(--il-radius); }
.table-card .table > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.table-card .table > :not(caption) > * > *:last-child { padding-right: 1.25rem; }
.table .actions { white-space: nowrap; text-align: right; width: 1%; }
.table .actions .btn + .btn { margin-left: .25rem; }

/* Badges / status pills ------------------------------------------------- */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: .5rem; }
.badge.rounded-pill { border-radius: 999px; }
.badge-status { display: inline-flex; align-items: center; gap: .4em; padding: .3em .7em; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(17, 26, 35, .05); }
.badge-status::before { content: ""; width: .45em; height: .45em; border-radius: 50%; background: currentColor; opacity: .75; }
.badge-status.active, .badge-status.delivered, .badge-status.approved, .badge-status.success { background: #e6f7ee; color: #15803d; }
.badge-status.inactive, .badge-status.pending, .badge-status.warning { background: #fff4e0; color: #b45309; }
.badge-status.deleted, .badge-status.cancelled, .badge-status.rejected, .badge-status.danger { background: #fde8ea; color: #b91c1c; }
.badge-status.neutral, .badge-status.unknown { background: #eef2f7; color: #475569; }

/* Floating layers: menus, dialogs, popovers ------------------------------ */
.dropdown-menu {
  --bs-dropdown-bg: var(--il-glass-bg-strong); --bs-dropdown-border-color: var(--il-hairline); --bs-dropdown-border-radius: var(--il-radius);
  --bs-dropdown-padding-x: .35rem; --bs-dropdown-padding-y: .35rem; --bs-dropdown-item-padding-x: .7rem; --bs-dropdown-item-padding-y: .45rem;
  --bs-dropdown-link-hover-bg: rgba(17, 26, 35, .06); --bs-dropdown-link-active-bg: var(--il-primary); --bs-dropdown-font-size: .9rem;
  -webkit-backdrop-filter: var(--il-glass-blur); backdrop-filter: var(--il-glass-blur); box-shadow: var(--il-shadow-lg);
}
.dropdown-item { border-radius: .55rem; }
.dropdown-item:hover { text-decoration: none; }
.dropdown-header { font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--il-muted); }
.modal { --bs-modal-border-radius: var(--il-radius-lg); --bs-modal-inner-border-radius: calc(var(--il-radius-lg) - 1px); --bs-modal-border-color: var(--il-hairline); --bs-modal-header-border-color: var(--il-hairline); --bs-modal-footer-border-color: var(--il-hairline); --bs-modal-box-shadow: var(--il-shadow-lg); }
.modal-content { box-shadow: var(--il-shadow-lg); }
.modal-title { font-weight: 600; font-size: 1.05rem; }
.modal-footer { background: var(--il-surface-2); border-radius: 0 0 var(--bs-modal-inner-border-radius) var(--bs-modal-inner-border-radius); }
.modal-backdrop { --bs-backdrop-bg: #111a23; --bs-backdrop-opacity: .45; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.offcanvas { box-shadow: var(--il-shadow-lg); }
.popover { --bs-popover-border-radius: var(--il-radius); --bs-popover-border-color: var(--il-hairline); box-shadow: var(--il-shadow-md); }
.tooltip { --bs-tooltip-bg: #111a23; --bs-tooltip-border-radius: .5rem; --bs-tooltip-font-size: .78rem; --bs-tooltip-opacity: .96; }

/* Tabs / pills ------------------------------------------------------------ */
.nav-tabs { --bs-nav-tabs-border-color: var(--il-hairline); --bs-nav-tabs-link-active-color: var(--il-primary); --bs-nav-tabs-link-active-bg: transparent; --bs-nav-tabs-link-hover-border-color: transparent; --bs-nav-tabs-link-active-border-color: transparent; }
.nav-tabs .nav-link { color: var(--il-muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; transition: color .15s var(--il-ease), border-color .15s var(--il-ease); }
.nav-tabs .nav-link:hover { color: var(--il-primary); text-decoration: none; }
.nav-tabs .nav-link.active { border-bottom-color: var(--il-primary); }
.card-header-tabs { margin-bottom: -.9rem; }
.card-header-tabs .nav-link { padding-bottom: .8rem; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--il-primary); --bs-nav-pills-border-radius: 999px; }
.nav-pills .nav-link:not(.active) { color: var(--il-ink); }
.nav-pills .nav-link.active { box-shadow: var(--il-shadow-primary); }
.nav-link:hover { text-decoration: none; }
.accordion { --bs-accordion-border-color: var(--il-hairline); --bs-accordion-border-radius: var(--il-radius); --bs-accordion-inner-border-radius: calc(var(--il-radius) - 1px); --bs-accordion-btn-focus-box-shadow: var(--il-ring); --bs-accordion-active-bg: var(--il-primary-soft); --bs-accordion-active-color: var(--il-primary-dark); }
.progress { --bs-progress-bar-bg: var(--il-primary); --bs-progress-border-radius: 999px; --bs-progress-bg: rgba(17, 26, 35, .07); }

/* App shell ------------------------------------------------------------- */
.app-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--il-topbar-height);
  background: var(--il-glass-bg); -webkit-backdrop-filter: var(--il-glass-blur); backdrop-filter: var(--il-glass-blur);
  border-bottom: 1px solid var(--il-hairline); box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 6px 20px -14px rgba(17, 26, 35, .35);
  display: flex; align-items: center; padding: 0 1.25rem; gap: .75rem;
}
.app-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--il-ink-strong); font-size: 1.05rem; letter-spacing: -.01em; }
.app-brand img { height: 32px; width: auto; }
.app-brand:hover { text-decoration: none; color: var(--il-primary); }
.app-topbar .user-menu .dropdown-toggle { padding: .3rem .6rem .3rem .3rem; border-radius: 999px; transition: background-color .15s var(--il-ease); }
.app-topbar .user-menu .dropdown-toggle:hover, .app-topbar .user-menu .dropdown-toggle.show { background: rgba(17, 26, 35, .06); text-decoration: none; }
.app-topbar .user-menu .dropdown-toggle::after { display: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px;
  background: linear-gradient(135deg, #e5343e, var(--il-primary) 55%, var(--il-primary-dark)); color: #fff; font-weight: 700;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 4px 10px -4px rgba(var(--il-primary-rgb), .7);
}

.app-layout { display: flex; min-height: calc(100vh - var(--il-topbar-height)); }
.app-sidebar {
  width: var(--il-sidebar-width); flex: 0 0 var(--il-sidebar-width);
  background:
    radial-gradient(420px 260px at 0 0, rgba(var(--il-primary-rgb), .16), transparent 70%),
    linear-gradient(180deg, #172330, var(--il-sidebar-bg) 40%, #111a23);
  color: var(--il-sidebar-ink); border-right: 1px solid rgba(255, 255, 255, .04);
  position: sticky; top: var(--il-topbar-height); height: calc(100vh - var(--il-topbar-height)); overflow-y: auto;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.app-sidebar::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, .16); }
.app-main { flex: 1 1 auto; min-width: 0; padding: 1.75rem; }
@media (max-width: 991.98px) {
  .app-main { padding: 1rem; }
}
.sidebar-nav { list-style: none; margin: 0; padding: .75rem .7rem 2rem; }
.sidebar-nav > li + li { margin-top: 2px; }
.sidebar-nav .nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #8b98a5; padding: .9rem .75rem .35rem; }
.sidebar-nav a { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: var(--il-radius-sm); color: var(--il-sidebar-ink); transition: background-color .15s var(--il-ease), color .15s var(--il-ease); }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: linear-gradient(135deg, #db1f3d, var(--il-sidebar-active) 60%, #a90d27); color: #fff; box-shadow: 0 8px 18px -8px rgba(var(--il-primary-rgb), .8), inset 0 1px 0 rgba(255, 255, 255, .16); }
.sidebar-nav a .bi { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: .9; }
.sidebar-nav .group-toggle { width: 100%; background: none; border: 0; text-align: left; font-weight: 600; border-radius: var(--il-radius-sm) !important; transition: background-color .15s var(--il-ease), color .15s var(--il-ease); }
.sidebar-nav .group-toggle:hover { background: rgba(255, 255, 255, .07); color: #fff !important; }
.sidebar-nav .group-toggle[aria-expanded="true"] { color: #fff !important; }
.sidebar-nav .group-toggle:focus-visible, .sidebar-nav a:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: -2px; }
.sidebar-nav .group-toggle .bi:first-child { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: .9; }
.sidebar-nav .group-toggle .chevron { margin-left: auto; transition: transform .2s var(--il-ease); font-size: .8rem; opacity: .7; }
.sidebar-nav .group-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.sidebar-nav .submenu { list-style: none; padding-left: 1.15rem; margin: .15rem 0 .35rem 1.3rem; border-left: 1px solid rgba(255, 255, 255, .1); }
.sidebar-nav .submenu a { padding: .4rem .65rem; font-size: .875rem; }
.sidebar-nav .submenu a .bi { display: none; }
.sidebar-user { margin: .8rem .7rem .25rem; padding: .75rem .8rem; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); border-radius: var(--il-radius); display: flex; gap: .7rem; align-items: center; }
.sidebar-user .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .14), 0 4px 10px -4px rgba(var(--il-primary-rgb), .9); }
.sidebar-user .name { color: #fff; font-weight: 600; line-height: 1.2; }
.sidebar-user .role { font-size: .75rem; color: #8b98a5; }

/* Offcanvas sidebar on small screens */
@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; left: 0; top: var(--il-topbar-height); transform: translateX(-100%); transition: transform .25s var(--il-ease); z-index: 1040; box-shadow: var(--il-shadow-lg); }
  .app-sidebar.show { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: var(--il-topbar-height) 0 0 0; background: rgba(17, 26, 35, .4); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); z-index: 1035; display: none; }
  .sidebar-backdrop.show { display: block; }
}

/* Page header ----------------------------------------------------------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-header .subtitle { color: var(--il-muted); margin: .2rem 0 0; }
.page-header .toolbar { display: flex; flex-wrap: wrap; gap: .5rem; }
.breadcrumb { font-size: .8rem; margin-bottom: .6rem; --bs-breadcrumb-item-active-color: var(--il-muted); }
.breadcrumb a { color: var(--il-muted); }
.breadcrumb a:hover { color: var(--il-primary); text-decoration: none; }
.breadcrumb-item + .breadcrumb-item::before { content: "›"; color: #b4bcc8; }

/* Stats / KPI tiles ----------------------------------------------------- */
.stat-tile {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.15rem; background: var(--il-surface);
  border: 1px solid var(--il-hairline); border-radius: var(--il-radius); box-shadow: var(--il-shadow); height: 100%;
  transition: box-shadow .2s var(--il-ease), transform .2s var(--il-ease);
}
.stat-tile:hover { box-shadow: var(--il-shadow-md); transform: translateY(-2px); }
.stat-tile .icon { width: 46px; height: 46px; border-radius: .85rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--il-primary-soft); color: var(--il-primary); flex: 0 0 46px; box-shadow: inset 0 0 0 1px rgba(17, 26, 35, .04); }
.stat-tile { flex-wrap: wrap; gap: .6rem 1rem; }
.stat-tile > div { flex: 1 1 5.5rem; min-width: 0; } /* drops below the icon when the tile is narrow */
.stat-tile .value { font-size: clamp(1.1rem, .7rem + .7vw, 1.45rem); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; color: var(--il-ink-strong); font-variant-numeric: tabular-nums; }
.stat-tile .label { color: var(--il-muted); font-size: .8rem; margin-top: .15rem; }
.stat-tile.tone-green .icon { background: #e6f7ee; color: #15803d; }
.stat-tile.tone-blue .icon { background: #e8f1fd; color: #1d4ed8; }
.stat-tile.tone-amber .icon { background: #fff4e0; color: #b45309; }
.stat-tile.tone-purple .icon { background: #f1e9fd; color: #6d28d9; }

/* Filters toolbar -------------------------------------------------------- */
.filter-bar { background: var(--il-surface); border: 1px solid var(--il-hairline); border-radius: var(--il-radius); box-shadow: var(--il-shadow); padding: 1rem 1.15rem; margin-bottom: 1.15rem; }
.card .filter-bar { box-shadow: none; background: var(--il-surface-2); }
.filter-bar .form-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--il-muted); }

/* Points history tabs: sit on the card header, wrap on desktop, one scrolling row on phones */
.history-tabs-header { padding-bottom: 0; }
.history-tabs { --bs-nav-underline-gap: .15rem 1.5rem; --bs-nav-underline-link-active-color: var(--il-primary); --bs-nav-link-color: var(--il-muted); --bs-nav-link-hover-color: var(--il-primary); --bs-nav-link-padding-y: .55rem; margin-bottom: -1px; }
.history-tabs .nav-link, .history-tabs .nav-link.active { display: inline-flex; align-items: center; gap: .45rem; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.history-tabs .nav-link:hover { text-decoration: none; }
.history-tabs .nav-link:focus-visible { outline: 2px solid var(--il-primary); outline-offset: 2px; box-shadow: none; }
.history-tab-sum { padding: .05rem .5rem; background: #eef2f7; border-radius: 999px; color: #475569; font-size: .78rem; font-variant-numeric: tabular-nums; }
.history-tabs .nav-link.active .history-tab-sum { background: var(--il-primary-soft); color: var(--il-primary); }
.table-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--il-hairline); }
.table-toolbar .card-title { margin: 0; font-size: 1rem; font-weight: 600; }
@media (max-width: 767.98px) {
  .history-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
}

/* Empty state ------------------------------------------------------------ */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--il-muted); }
.empty-state .bi { font-size: 1.6rem; display: inline-flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; margin-bottom: .85rem; border-radius: 1.1rem; background: rgba(17, 26, 35, .05); color: #8b95a3; }
.empty-state h3 { font-size: 1.05rem; color: var(--il-ink); }

/* Pagination ------------------------------------------------------------- */
.pagination {
  --bs-pagination-active-bg: var(--il-primary); --bs-pagination-active-border-color: var(--il-primary); --bs-pagination-color: var(--il-ink);
  --bs-pagination-hover-color: var(--il-primary); --bs-pagination-hover-bg: var(--il-primary-soft); --bs-pagination-hover-border-color: transparent;
  --bs-pagination-border-color: transparent; --bs-pagination-bg: transparent; --bs-pagination-disabled-bg: transparent; --bs-pagination-disabled-border-color: transparent;
  --bs-pagination-focus-box-shadow: var(--il-ring); --bs-pagination-focus-bg: var(--il-primary-soft); --bs-pagination-focus-color: var(--il-primary);
  margin: 0; gap: .2rem;
}
.pagination .page-link { border-radius: .55rem !important; min-width: 2rem; text-align: center; font-weight: 500; transition: background-color .15s var(--il-ease), color .15s var(--il-ease); }
.pagination .page-link:hover { text-decoration: none; }
.pagination .page-item.active .page-link { box-shadow: var(--il-shadow-primary); }
.pagination-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .75rem 1.25rem; border-top: 1px solid var(--il-hairline); font-size: .85rem; color: var(--il-muted); }

/* Alerts / toasts -------------------------------------------------------- */
.alert { border-radius: var(--il-radius); border: 1px solid transparent; box-shadow: var(--il-shadow-xs); }
.alert-success { --bs-alert-bg: #ecf9f1; --bs-alert-color: #14693a; --bs-alert-border-color: rgba(21, 128, 61, .18); }
.alert-danger { --bs-alert-bg: #fdecee; --bs-alert-color: #9f1626; --bs-alert-border-color: rgba(185, 28, 28, .18); }
.alert-warning { --bs-alert-bg: #fff6e5; --bs-alert-color: #8a4b06; --bs-alert-border-color: rgba(180, 83, 9, .2); }
.alert-info { --bs-alert-bg: #eaf3fe; --bs-alert-color: #1c4f9c; --bs-alert-border-color: rgba(29, 78, 216, .16); }
.toast-container { z-index: 1090; }
.toast { --bs-toast-border-radius: var(--il-radius); --bs-toast-border-color: transparent; --bs-toast-box-shadow: var(--il-shadow-lg); -webkit-backdrop-filter: var(--il-glass-blur); backdrop-filter: var(--il-glass-blur); }

/* Auth pages ------------------------------------------------------------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(700px 480px at 12% 8%, rgba(var(--il-primary-rgb), .22), transparent 62%),
    radial-gradient(640px 460px at 92% 96%, rgba(var(--il-primary-rgb), .12), transparent 60%),
    radial-gradient(760px 520px at 88% 4%, rgba(37, 99, 235, .10), transparent 60%),
    var(--il-bg);
}
.auth-card {
  width: 100%; max-width: 420px; padding: 2.25rem 2rem;
  background: var(--il-glass-bg); -webkit-backdrop-filter: saturate(1.8) blur(24px); backdrop-filter: saturate(1.8) blur(24px);
  border: 1px solid var(--il-glass-border); border-radius: var(--il-radius-lg);
  box-shadow: var(--il-shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.auth-card .brand { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin-bottom: 1.5rem; text-align: center; }
.auth-card .brand img { height: 64px; }
.auth-card h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.auth-card .mode { font-size: .8rem; color: var(--il-muted); }
.auth-card .form-control { background-color: rgba(255, 255, 255, .85); }
.auth-footer { text-align: center; color: var(--il-muted); font-size: .8rem; margin-top: 1.25rem; }

/* Loading ---------------------------------------------------------------- */
.is-loading { position: relative; pointer-events: none; opacity: .6; }
.is-loading::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 50 50'><circle cx='25' cy='25' r='20' fill='none' stroke='%23c8102e' stroke-width='5' stroke-dasharray='90 150' stroke-linecap='round'><animateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='.9s' repeatCount='indefinite'/></circle></svg>") center no-repeat; }
.btn.is-loading { opacity: .8; }

/* Front office ----------------------------------------------------------- */
.front-header { background: var(--il-glass-bg-strong); -webkit-backdrop-filter: var(--il-glass-blur); backdrop-filter: var(--il-glass-blur); border-bottom: 1px solid var(--il-hairline); box-shadow: 0 6px 20px -16px rgba(17, 26, 35, .4); position: relative; z-index: 1020; }
.front-header .brand img { height: 56px; }
.front-topstrip { background: linear-gradient(90deg, var(--il-primary-dark), var(--il-primary) 55%, #db1f3d); color: #fff; font-size: .8rem; }
.front-topstrip a { color: #fff; }
.front-nav .nav-link { font-weight: 600; color: var(--il-ink); border-radius: 999px; padding-left: .85rem; padding-right: .85rem; transition: background-color .15s var(--il-ease), color .15s var(--il-ease); }
.front-nav .nav-link.active, .front-nav .nav-link:hover { color: var(--il-primary); }
.front-nav .nav-link.active { background: var(--il-primary-soft); }
.front-footer { background: linear-gradient(180deg, #172330, var(--il-sidebar-bg) 45%, #111a23); color: #aab4c0; padding: 2.5rem 0 2rem; margin-top: 3rem; font-size: .85rem; }
.front-footer a { color: #dfe6ee; }
.product-card .card-img-top { height: 180px; object-fit: contain; padding: 1rem; background: #fff; }
.product-card .points { color: var(--il-primary); font-weight: 700; }

/* Rich-text editor (Quill) ------------------------------------------------ */
.ql-toolbar.ql-snow { border-color: #d5dbe3; border-radius: var(--il-radius-sm) var(--il-radius-sm) 0 0; background: var(--il-surface-2); }
.ql-container.ql-snow { border-color: #d5dbe3; border-radius: 0 0 var(--il-radius-sm) var(--il-radius-sm); background: var(--il-surface); font-family: inherit; }

/* Utilities -------------------------------------------------------------- */
.text-muted-sm { color: var(--il-muted); font-size: .8rem; }
.w-1 { width: 1%; }
.cursor-pointer { cursor: pointer; }
.mono { font-family: ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.sticky-actions { position: sticky; bottom: 0; background: var(--il-glass-bg-strong); -webkit-backdrop-filter: var(--il-glass-blur); backdrop-filter: var(--il-glass-blur); border-top: 1px solid var(--il-hairline); padding: .75rem 1.25rem; }
.shadow-sm { box-shadow: var(--il-shadow) !important; }
.shadow { box-shadow: var(--il-shadow-md) !important; }
.shadow-lg { box-shadow: var(--il-shadow-lg) !important; }

/* --- dashboard charts ------------------------------------------------------------------ */
.chart-box { position: relative; height: 380px; }
.chart-table { max-height: 300px; overflow-y: auto; }
.chart-table thead th { position: sticky; top: 0; }
.chart-totals { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: 0 0 1rem; }
.chart-totals dt { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--il-muted); display: flex; align-items: center; gap: .4rem; }
.chart-totals dd { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; color: var(--il-ink-strong); font-variant-numeric: tabular-nums; }
.chart-swatch { width: .7rem; height: .7rem; border-radius: 3px; display: inline-block; }
.chart-swatch-earned { background: #2a78d6; }
.chart-swatch-deducted { background: #eb6834; }
.chart-swatch-balance { background: #1baf7a; }

/* Fallbacks / preferences ------------------------------------------------ */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-topbar, .front-header, .sticky-actions, .auth-card { background: var(--il-surface); }
  .dropdown-menu { --bs-dropdown-bg: var(--il-surface); }
}
@media (prefers-reduced-transparency: reduce) {
  .app-topbar, .front-header, .sticky-actions, .auth-card { background: var(--il-surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .dropdown-menu { --bs-dropdown-bg: var(--il-surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
  .stat-tile:hover, .btn:active { transform: none !important; }
}
@media print {
  body { background: #fff; }
  .app-topbar, .app-sidebar, .page-header .toolbar, .no-print { display: none !important; }
  .app-main { padding: 0; }
  .card { box-shadow: none; border: 0; }
}
