/* =====================================================================
   IPC Productivity Analysis — Custom UI theme
   Built on Bootstrap 5.3 (uses native [data-bs-theme] for dark mode).
   Brand: Industrial Psychology Consultants — Primary blue #1B5EA9
   ===================================================================== */

/* ----------------------------- Design tokens ----------------------- */
:root {
  /* Brand */
  --ipc-blue: #1b5ea9;
  --ipc-blue-dark: #0d3b6e;
  --ipc-blue-600: #17538f;
  --ipc-blue-soft: #e8f0fa;
  --ipc-sky: #6a95c8;
  --ipc-medium: #2e86ab;

  /* Semantic */
  --pos: #1a8a4f;
  --pos-soft: #e4f5ec;
  --neg: #d63447;
  --neg-soft: #fbe6e9;
  --warn: #d98b0a;
  --warn-soft: #fdf1dc;

  /* Surfaces (light) */
  --app-bg: #eef2f8;
  --app-surface: #ffffff;
  --app-surface-2: #f7f9fc;
  --app-surface-3: #eff3f9;
  --app-border: #e2e8f2;
  --app-border-strong: #d3dceb;
  --app-text: #1f2a37;
  --app-text-muted: #66768c;
  --app-heading: #10233b;
  --app-shadow: 0 1px 2px rgba(16, 35, 59, .04), 0 8px 24px rgba(16, 35, 59, .06);
  --app-shadow-sm: 0 1px 2px rgba(16, 35, 59, .06);

  /* Sidebar (dark on both themes for a premium branded look) */
  --side-bg: linear-gradient(185deg, #103a68 0%, #0c2b4d 100%);
  --side-text: rgba(255, 255, 255, .74);
  --side-text-active: #ffffff;
  --side-active-bg: rgba(255, 255, 255, .14);
  --side-hover-bg: rgba(255, 255, 255, .07);
  --side-accent: #7fb0e6;
  --side-border: rgba(255, 255, 255, .08);
  --side-heading: rgba(255, 255, 255, .45);

  --sidebar-w: 264px;
  --topbar-h: 66px;
  --radius: 14px;
  --radius-sm: 10px;

  /* Bootstrap primary override */
  --bs-primary: var(--ipc-blue);
  --bs-primary-rgb: 27, 94, 169;
  --bs-link-color: var(--ipc-blue);
  --bs-link-color-rgb: 27, 94, 169;
  --bs-link-hover-color: var(--ipc-blue-dark);
  --bs-body-font-family: 'Inter', 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-bs-theme="dark"] {
  --ipc-blue: #4f9be8;
  --ipc-blue-soft: rgba(79, 155, 232, .14);
  --pos: #3fce8b;
  --pos-soft: rgba(63, 206, 139, .13);
  --neg: #ff6b7d;
  --neg-soft: rgba(255, 107, 125, .13);
  --warn: #f0ad4e;
  --warn-soft: rgba(240, 173, 78, .13);

  --app-bg: #0b1220;
  --app-surface: #131d30;
  --app-surface-2: #0f1728;
  --app-surface-3: #1a273e;
  --app-border: #24314b;
  --app-border-strong: #30405f;
  --app-text: #dbe4f0;
  --app-text-muted: #8ea0bb;
  --app-heading: #f1f5fb;
  --app-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .35);
  --app-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);

  --side-bg: linear-gradient(185deg, #0d1626 0%, #0a1120 100%);
  --side-border: rgba(255, 255, 255, .06);

  --bs-primary: #4f9be8;
  --bs-primary-rgb: 79, 155, 232;
  --bs-link-color: #7fb0e6;
  --bs-link-color-rgb: 127, 176, 230;
  --bs-link-hover-color: #a9caf0;
}

/* ------------------------------- Base ------------------------------ */
* { scrollbar-color: var(--app-border-strong) transparent; }
body {
  font-family: var(--bs-body-font-family);
  background: var(--app-bg);
  color: var(--app-text);
  font-size: .925rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6 { color: var(--app-heading); font-weight: 700; letter-spacing: -.01em; }
a { text-decoration: none; }
::selection { background: var(--ipc-blue-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--app-border-strong); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ipc-sky); background-clip: content-box; }

/* ------------------------------ Layout ----------------------------- */
.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--side-bg);
  border-right: 1px solid var(--side-border);
  display: flex;
  flex-direction: column;
  z-index: 1045;
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}
.app-sidebar__brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--side-border);
  flex-shrink: 0;
}
.app-sidebar__brand-logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2e86ab, #1b5ea9);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(27, 94, 169, .5);
  flex-shrink: 0;
}
.app-sidebar__brand-text { color: #fff; line-height: 1.1; }
.app-sidebar__brand-text strong { font-size: 1rem; font-weight: 700; letter-spacing: .01em; }
.app-sidebar__brand-text span { display: block; font-size: .68rem; color: var(--side-heading); font-weight: 500; }

.app-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: .85rem .75rem 1.5rem;
  list-style: none;
  margin: 0;
}
.app-sidebar__nav::-webkit-scrollbar { width: 6px; }
.app-sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); }

.app-nav-heading {
  color: var(--side-heading);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 1rem .85rem .4rem;
}
.app-nav-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .62rem .85rem;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--side-text);
  font-weight: 500;
  font-size: .9rem;
  transition: background .16s, color .16s;
  cursor: pointer;
  white-space: nowrap;
}
.app-nav-link i { font-size: 1.1rem; flex-shrink: 0; width: 1.2rem; text-align: center; }
.app-nav-link .chev { margin-left: auto; font-size: .8rem; transition: transform .2s; }
.app-nav-link:hover { background: var(--side-hover-bg); color: var(--side-text-active); }
/* Active = top-level link rendered WITHOUT the legacy `.collapsed` marker.
   This preserves the existing per-page block overrides across all templates. */
.app-nav-link.active,
.app-nav-link.nav-top:not(.collapsed) {
  background: var(--side-active-bg);
  color: var(--side-text-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--side-accent);
}
.app-nav-link[aria-expanded="true"] .chev { transform: rotate(180deg); }

.app-nav-sub { list-style: none; margin: 2px 0 4px; padding: 0 0 0 .5rem; }
.app-nav-sub .app-nav-link { font-size: .855rem; padding: .5rem .85rem .5rem 2.2rem; position: relative; }
.app-nav-sub .app-nav-link::before {
  content: ""; position: absolute; left: 1.35rem; top: 50%;
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .45; transform: translateY(-50%);
}
.app-nav-sub .app-nav-link.active::before { opacity: 1; background: var(--side-accent); }

/* Topbar */
.app-topbar {
  position: fixed;
  top: 0; right: 0;
  left: var(--sidebar-w);
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--app-surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 1.25rem;
  z-index: 1030;
  transition: left .28s cubic-bezier(.4, 0, .2, 1);
}
.app-topbar__title { font-size: 1.02rem; font-weight: 700; color: var(--app-heading); margin: 0; }
.app-topbar__sub { font-size: .75rem; color: var(--app-text-muted); }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text-muted);
  display: grid; place-items: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all .15s;
}
.icon-btn:hover { color: var(--ipc-blue); border-color: var(--ipc-blue); background: var(--ipc-blue-soft); }
.sidebar-toggle { display: none; }

.app-profile {
  display: flex; align-items: center; gap: .6rem;
  padding: .3rem .3rem;
  border-radius: 30px;
  cursor: pointer;
}
.app-profile__avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ipc-medium), var(--ipc-blue));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.app-profile__name { font-weight: 600; font-size: .875rem; color: var(--app-heading); line-height: 1.1; }
.app-profile__role { font-size: .72rem; color: var(--app-text-muted); }

/* Content */
.app-content,
main.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 1.5rem) 1.75rem 3rem;
  min-height: 100vh;
  transition: margin-left .28s cubic-bezier(.4, 0, .2, 1);
}

/* Legacy NiceAdmin wrappers used by not-yet-rewritten pages */
.pagetitle { margin-bottom: 1.4rem; }
.pagetitle h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
.pagetitle .breadcrumb { margin: 0; font-size: .8rem; }
.pagetitle .breadcrumb a { color: var(--app-text-muted); }
.pagetitle .breadcrumb .active { color: var(--ipc-blue); }
.section { margin-bottom: 0; }
.info-card .card-title { color: var(--app-text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.app-footer {
  margin-left: var(--sidebar-w);
  padding: 1.1rem 1.75rem;
  color: var(--app-text-muted);
  font-size: .8rem;
  border-top: 1px solid var(--app-border);
  transition: margin-left .28s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(8, 18, 34, .5);
  backdrop-filter: blur(2px);
  z-index: 1044;
  opacity: 0; visibility: hidden;
  transition: opacity .25s;
}

/* Page header */
.page-head { margin-bottom: 1.4rem; }
.page-head h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
.page-head .breadcrumb { margin: 0; font-size: .8rem; }
.page-head .breadcrumb a { color: var(--app-text-muted); }
.page-head .breadcrumb .active { color: var(--ipc-blue); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--app-text-muted); }

/* ------------------------------ Cards ------------------------------ */
.card {
  --bs-card-bg: var(--app-surface);
  --bs-card-border-color: var(--app-border);
  --bs-card-border-radius: var(--radius);
  --bs-card-inner-border-radius: var(--radius);
  border: 1px solid var(--app-border);
  border-radius: var(--radius);
  box-shadow: var(--app-shadow);
  margin-bottom: 1.4rem;
}
.card-body { padding: 1.35rem 1.4rem; }
.card-title { font-size: 1.02rem; font-weight: 700; color: var(--app-heading); margin: 0 0 1rem; }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--app-border);
  padding: 1.1rem 1.4rem;
  font-weight: 700;
}

.section-title {
  display: flex; align-items: center; gap: .6rem;
  font-size: 1.05rem; font-weight: 700; color: var(--app-heading);
  margin: 0;
}
.section-title i { color: var(--ipc-blue); font-size: 1.15rem; }

/* --------------------------- KPI stat cards ------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.4rem;
}
.stat-card {
  position: relative;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem;
  box-shadow: var(--app-shadow);
  overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(16, 35, 59, .12); }
.stat-card::after {
  content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
  background: var(--accent, var(--ipc-blue));
}
.stat-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .85rem; }
.stat-card__label { font-size: .8rem; font-weight: 600; color: var(--app-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card__icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.25rem;
  background: color-mix(in srgb, var(--accent, var(--ipc-blue)) 14%, transparent);
  color: var(--accent, var(--ipc-blue));
}
.stat-card__value { font-size: 1.7rem; font-weight: 800; color: var(--app-heading); letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-card__meta { display: flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; margin-top: .5rem; }
.stat-card__meta.up { color: var(--pos); }
.stat-card__meta.down { color: var(--neg); }

/* --------------------------- Value coloring ------------------------ */
.text-danger, .val-neg { color: var(--neg) !important; }
.val-pos { color: var(--pos) !important; }
.val-muted { color: var(--app-text-muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: 30px;
  font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pill--pos { background: var(--pos-soft); color: var(--pos); }
.pill--neg { background: var(--neg-soft); color: var(--neg); }
.pill--neutral { background: var(--app-surface-3); color: var(--app-text-muted); }

/* ------------------------------ Tables ----------------------------- */
.table-shell {
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--app-surface);
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--app-text);
  --bs-table-border-color: var(--app-border);
  --bs-table-hover-bg: var(--app-surface-3);
  --bs-table-hover-color: var(--app-text);
  margin: 0;
  font-size: .875rem;
}
.table > :not(caption) > * > * { padding: .72rem .85rem; }
.table thead th {
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--app-border-strong);
  white-space: nowrap;
  vertical-align: middle;
}
.table tbody td { vertical-align: middle; border-color: var(--app-border); }
.table tbody tr:last-child td { border-bottom: 0; }

/* Sticky header for tall data tables */
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }

/* Numeric columns: right-align + tabular figures */
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Collapsible parent rows */
tr.row-toggle { cursor: pointer; }
tr.row-toggle > td:first-child { font-weight: 600; color: var(--app-heading); }
tr.row-toggle .toggle-caret { transition: transform .2s; display: inline-block; color: var(--ipc-blue); margin-right: .35rem; }
tr.row-toggle[aria-expanded="true"] .toggle-caret { transform: rotate(90deg); }
tr.row-toggle:hover { background: var(--app-surface-3); }

/* Nested detail table */
.nested-cell { padding: 0 !important; background: var(--app-surface-2); }
.nested-cell .table { font-size: .82rem; }
.nested-cell .table thead th { background: transparent; }

/* Total / overall row */
.table tr.row-total td, .table tr.row-overall td {
  background: var(--ipc-blue-soft);
  font-weight: 800;
  color: var(--app-heading);
  border-top: 2px solid var(--app-border-strong);
}

/* Group separators (period column groups on data-entry tables) */
.col-divider { border-right: 2px solid var(--app-border-strong) !important; }
.thicker-right-border { border-right: 2px solid var(--app-border-strong) !important; }
.group-head th { font-size: .74rem; letter-spacing: .04em; }
.group-head .g-p1 { color: var(--ipc-medium); }
.group-head .g-p2 { color: var(--ipc-blue); }

/* Legacy NiceAdmin classes still used in some templates */
.table-dark, tr.table-dark { --bs-table-bg: var(--app-surface-2); --bs-table-color: var(--app-text-muted); }
tr.table-dark th { background: var(--app-surface-2); color: var(--app-text-muted); }

/* simple-datatables */
.dataTable-wrapper .dataTable-top, .dataTable-wrapper .dataTable-bottom { padding: .75rem 0; color: var(--app-text-muted); font-size: .82rem; }
.dataTable-input, .dataTable-selector { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 8px; color: var(--app-text); padding: .35rem .6rem; }
.dataTable-pagination a { color: var(--ipc-blue); }
.dataTable-pagination .active a { background: var(--ipc-blue); color: #fff; border-radius: 8px; }

/* ------------------------------ Buttons ---------------------------- */
.btn { --bs-btn-border-radius: 10px; font-weight: 600; font-size: .875rem; padding: .5rem .95rem; }
.btn-sm { --bs-btn-border-radius: 8px; padding: .35rem .7rem; font-size: .8rem; }
.btn-primary {
  --bs-btn-bg: var(--ipc-blue);
  --bs-btn-border-color: var(--ipc-blue);
  --bs-btn-hover-bg: var(--ipc-blue-600);
  --bs-btn-hover-border-color: var(--ipc-blue-600);
  --bs-btn-active-bg: var(--ipc-blue-dark);
  --bs-btn-active-border-color: var(--ipc-blue-dark);
  --bs-btn-disabled-bg: var(--ipc-blue);
  --bs-btn-disabled-border-color: var(--ipc-blue);
  box-shadow: 0 4px 12px rgba(27, 94, 169, .28);
}
.btn-outline-primary {
  --bs-btn-color: var(--ipc-blue);
  --bs-btn-border-color: var(--ipc-blue);
  --bs-btn-hover-bg: var(--ipc-blue);
  --bs-btn-hover-border-color: var(--ipc-blue);
  --bs-btn-active-bg: var(--ipc-blue);
}
.btn-danger { --bs-btn-bg: var(--neg); --bs-btn-border-color: var(--neg); --bs-btn-hover-bg: #b82a3b; --bs-btn-hover-border-color: #b82a3b; }
.btn-soft {
  background: var(--ipc-blue-soft); color: var(--ipc-blue); border: 1px solid transparent;
}
.btn-soft:hover { background: var(--ipc-blue); color: #fff; }
.btn-icon-danger {
  width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center;
  background: var(--neg-soft); color: var(--neg); border: none; border-radius: 9px;
}
.btn-icon-danger:hover { background: var(--neg); color: #fff; }

/* ------------------------------ Forms ------------------------------ */
.form-label { font-weight: 600; font-size: .82rem; color: var(--app-heading); margin-bottom: .35rem; }
.form-control, .form-select {
  background: var(--app-surface);
  border: 1px solid var(--app-border-strong);
  border-radius: 10px;
  color: var(--app-text);
  padding: .55rem .8rem;
  font-size: .875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ipc-blue);
  box-shadow: 0 0 0 3px var(--ipc-blue-soft);
  background: var(--app-surface);
  color: var(--app-text);
}
.form-control::placeholder { color: var(--app-text-muted); opacity: .7; }
.input-group-text { background: var(--app-surface-2); border-color: var(--app-border-strong); color: var(--app-text-muted); border-radius: 10px; }

/* Table inline inputs: tighter */
.table .form-control, .table .form-select { padding: .4rem .55rem; border-radius: 8px; font-size: .82rem; min-width: 90px; }

/* ------------------------------ Modals ----------------------------- */
.modal-content {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(8, 18, 34, .3);
}
.modal-header, .modal-footer { border-color: var(--app-border); }
.dropdown-menu {
  --bs-dropdown-bg: var(--app-surface);
  --bs-dropdown-border-color: var(--app-border);
  --bs-dropdown-link-hover-bg: var(--app-surface-3);
  --bs-dropdown-link-color: var(--app-text);
  border-radius: 12px;
  box-shadow: var(--app-shadow);
  padding: .4rem;
}
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; font-size: .875rem; }

/* Alerts */
.alert { border-radius: 12px; border: 1px solid transparent; font-size: .875rem; }
.alert-danger { background: var(--neg-soft); color: var(--neg); border-color: color-mix(in srgb, var(--neg) 25%, transparent); }
.alert-success { background: var(--pos-soft); color: var(--pos); border-color: color-mix(in srgb, var(--pos) 25%, transparent); }

/* Badges */
.badge-soft { background: var(--ipc-blue-soft); color: var(--ipc-blue); font-weight: 600; padding: .35em .7em; border-radius: 30px; }

/* ------------------------------ Charts ----------------------------- */
.chart-card .card-body { padding-bottom: .75rem; }
.chart-box { width: 100%; min-height: 320px; }
.chart-box--tall { min-height: 440px; }
.apexcharts-tooltip { border-radius: 10px !important; box-shadow: var(--app-shadow) !important; }
.apexcharts-text, .apexcharts-legend-text { fill: var(--app-text-muted); color: var(--app-text-muted) !important; }

.chart-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .5rem; font-size: .78rem; color: var(--app-text-muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--app-text-muted); }
.empty-state i { font-size: 2.6rem; color: var(--ipc-sky); margin-bottom: .75rem; display: block; }

/* Period selector chip */
.period-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  background: var(--app-surface); border: 1px solid var(--app-border);
  border-radius: var(--radius); padding: 1rem 1.3rem; margin-bottom: 1.4rem; box-shadow: var(--app-shadow-sm);
}
.period-bar__label { font-size: .78rem; color: var(--app-text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.period-bar__value { font-size: 1.05rem; font-weight: 700; color: var(--app-heading); }

/* Theme toggle track */
.theme-toggle i { transition: transform .4s cubic-bezier(.4, 0, .2, 1); }
html[data-bs-theme="dark"] .theme-toggle .bi-sun-fill,
html[data-bs-theme="light"] .theme-toggle .bi-moon-stars-fill { display: none; }

/* Back to top */
.back-to-top {
  position: fixed; bottom: 24px; right: 24px;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--ipc-blue); color: #fff;
  display: grid; place-items: center; font-size: 1.35rem;
  box-shadow: 0 6px 18px rgba(27, 94, 169, .4);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all .25s; z-index: 1020;
}
.back-to-top.active { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--ipc-blue-dark); color: #fff; }

/* --------------------------- Responsive ---------------------------- */
@media (max-width: 991.98px) {
  :root { --sidebar-w: 264px; }
  .app-sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .app-topbar { left: 0; }
  .app-content, main.main, .app-footer { margin-left: 0; }
  .sidebar-toggle { display: grid; }
}

@media (max-width: 575.98px) {
  .app-content, main.main { padding: calc(var(--topbar-h) + 1rem) 1rem 2.5rem; }
  .app-topbar { padding: 0 .85rem; }
  .app-profile__meta { display: none; }
  .stat-card__value { font-size: 1.45rem; }
  .page-head h1 { font-size: 1.25rem; }
  .card-body { padding: 1.1rem; }
  .app-topbar__sub { display: none; }
}

/* Auth pages */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--app-bg);
}
.auth-hero {
  background: linear-gradient(160deg, #0d3b6e 0%, #1b5ea9 55%, #2e86ab 100%);
  color: #fff;
  padding: 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%;
  background: rgba(255, 255, 255, .07); top: -140px; right: -120px;
}
.auth-hero::after {
  content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%;
  background: rgba(255, 255, 255, .05); bottom: -100px; left: -60px;
}
.auth-hero__brand { display: flex; align-items: center; gap: .8rem; position: relative; z-index: 1; }
.auth-hero__brand-logo { width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-weight: 800; font-size: 1.25rem; }
.auth-hero__headline { position: relative; z-index: 1; }
.auth-hero__headline h2 { color: #fff; font-size: 2.1rem; line-height: 1.2; font-weight: 800; }
.auth-hero__headline p { color: rgba(255, 255, 255, .82); font-size: 1.02rem; max-width: 420px; }
.auth-hero__points { list-style: none; padding: 0; margin: 1.5rem 0 0; position: relative; z-index: 1; }
.auth-hero__points li { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; color: rgba(255, 255, 255, .9); font-size: .95rem; }
.auth-hero__points i { font-size: 1.15rem; }
.auth-hero__foot { position: relative; z-index: 1; color: rgba(255, 255, 255, .6); font-size: .8rem; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card__logo-mobile { display: none; }

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card__logo-mobile { display: flex; }
}
