/* =====================================================================
   Nokha Admin – theme
   Warm stone neutrals with a terracotta / saffron accent.
   ===================================================================== */
:root {
  --nk-bg: #f6f4f1;
  --nk-surface: #ffffff;
  --nk-ink: #1c1917;
  --nk-ink-2: #44403c;
  --nk-muted: #78716c;
  --nk-line: #e7e2dc;
  --nk-line-2: #f1ede8;
  --nk-primary: #b4461b;
  --nk-primary-600: #9a3a15;
  --nk-primary-50: #fdf1eb;
  --nk-accent: #e0951f;
  --nk-accent-50: #fdf6e8;
  --nk-success: #15803d;
  --nk-danger: #b91c1c;
  --nk-sidebar: #1c1917;
  --nk-sidebar-2: #292524;
  --nk-radius: 14px;
  --nk-radius-sm: 10px;
  --nk-shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 4px 16px rgba(28, 25, 23, .04);
  --nk-shadow-lg: 0 10px 30px rgba(28, 25, 23, .10);

  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-color: var(--nk-ink);
  --bs-body-bg: var(--nk-bg);
  --bs-border-color: var(--nk-line);
  --bs-primary: var(--nk-primary);
  --bs-primary-rgb: 180, 70, 27;
  --bs-link-color: var(--nk-primary);
  --bs-link-color-rgb: 180, 70, 27;
  --bs-link-hover-color: var(--nk-primary-600);
  --bs-link-hover-color-rgb: 154, 58, 21;
  --bs-secondary-color: var(--nk-muted);
}

body { font-size: .925rem; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.text-muted { color: var(--nk-muted) !important; }
.fw-semi { font-weight: 600; }
.small-caps { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--nk-muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------------- Buttons & forms ---------------- */
.btn { border-radius: 10px; font-weight: 500; padding: .5rem .95rem; }
.btn-sm { border-radius: 8px; padding: .3rem .65rem; }
.btn-primary { --bs-btn-bg: var(--nk-primary); --bs-btn-border-color: var(--nk-primary); --bs-btn-hover-bg: var(--nk-primary-600); --bs-btn-hover-border-color: var(--nk-primary-600); --bs-btn-active-bg: var(--nk-primary-600); --bs-btn-active-border-color: var(--nk-primary-600); --bs-btn-disabled-bg: var(--nk-primary); --bs-btn-disabled-border-color: var(--nk-primary); }
.btn-outline-primary { --bs-btn-color: var(--nk-primary); --bs-btn-border-color: #e8c3b2; --bs-btn-hover-bg: var(--nk-primary); --bs-btn-hover-border-color: var(--nk-primary); --bs-btn-active-bg: var(--nk-primary-600); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--nk-line); --bs-btn-hover-bg: var(--nk-line-2); --bs-btn-hover-border-color: var(--nk-line); }
.btn-soft { background: var(--nk-primary-50); color: var(--nk-primary); border: 1px solid transparent; }
.btn-soft:hover { background: #fae2d6; color: var(--nk-primary-600); }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.form-control, .form-select { border-radius: 10px; border-color: var(--nk-line); padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: #e2a387; box-shadow: 0 0 0 .2rem rgba(180, 70, 27, .12); }
.form-label { font-weight: 500; font-size: .84rem; color: var(--nk-ink-2); margin-bottom: .3rem; }
.form-label .req { color: var(--nk-danger); margin-left: 2px; }
.form-text { font-size: .78rem; }
.input-group-text { border-color: var(--nk-line); background: var(--nk-line-2); border-radius: 10px; }
.form-check-input:checked { background-color: var(--nk-primary); border-color: var(--nk-primary); }

/* ---------------- Layout ---------------- */
.nk-shell { display: flex; min-height: 100vh; }
.nk-sidebar {
  --nk-sidebar-text: #e7e5e4;
  --nk-sidebar-muted: #a8a29e;
  --nk-sidebar-highlight: #fbbf5c;
  width: 256px; flex: 0 0 256px;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(180, 70, 27, .22), transparent 36%),
    linear-gradient(180deg, #211a17 0%, #1c1917 46%, #171412 100%);
  color: var(--nk-sidebar-text);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 1040;
  border-right: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 8px 0 28px rgba(28, 25, 23, .08);
}
.nk-brand {
  position: relative; display: flex; align-items: center; gap: .8rem;
  padding: 1.25rem 1.2rem 1.15rem; color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.nk-brand::after {
  content: ''; position: absolute; left: 1.2rem; right: 1.2rem; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, rgba(224, 149, 31, .45), transparent 85%);
}
.nk-brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, var(--nk-accent), var(--nk-primary)); color: #fff; font-size: 1.05rem;
}
/* the logo is shown whole (no crop or tint), with rounded corners */
.nk-brand-logo {
  display: block; flex: 0 0 auto; object-fit: cover; background: none; border-radius: 11px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .08), 0 5px 16px rgba(0, 0, 0, .22);
}
.nk-brand-name { font-weight: 700; letter-spacing: .015em; line-height: 1.15; }
.nk-brand-sub { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; color: var(--nk-sidebar-muted); margin-top: .18rem; }
.nk-nav {
  padding: .75rem .7rem 1rem; flex: 1; overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.nk-nav::-webkit-scrollbar { width: 5px; }
.nk-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 99px; }
.nk-nav-label {
  display: flex; align-items: center; gap: .6rem; font-size: .64rem; text-transform: uppercase;
  letter-spacing: .12em; color: #8b817b; padding: 1.05rem .7rem .5rem; font-weight: 700;
}
.nk-nav-label::after { content: ''; height: 1px; flex: 1; background: rgba(255, 255, 255, .08); }
.nk-nav a {
  position: relative; display: flex; align-items: center; gap: .75rem; color: #c9c3bf;
  padding: .62rem .7rem; border: 1px solid transparent; border-radius: 11px;
  font-size: .875rem; font-weight: 500; margin-bottom: 3px;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.nk-nav a::before {
  content: ''; position: absolute; left: -1px; top: 50%; width: 3px; height: 0;
  border-radius: 0 4px 4px 0; background: var(--nk-sidebar-highlight); transform: translateY(-50%);
  transition: height .18s ease;
}
.nk-nav a i {
  width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center;
  border-radius: 9px; background: rgba(255, 255, 255, .055); color: #c9c3bf;
  font-size: 1rem; transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nk-nav a:hover {
  background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .055);
  color: #fff; transform: translateX(2px);
}
.nk-nav a:hover i { background: rgba(255, 255, 255, .1); color: #fff; }
.nk-nav a.active {
  background: linear-gradient(100deg, rgba(224, 149, 31, .19), rgba(180, 70, 27, .11));
  border-color: rgba(251, 191, 92, .15); color: #ffd27b;
  box-shadow: inset 0 1px rgba(255, 255, 255, .045), 0 5px 16px rgba(0, 0, 0, .12);
}
.nk-nav a.active::before { height: 20px; }
.nk-nav a.active i {
  background: linear-gradient(145deg, rgba(224, 149, 31, .28), rgba(180, 70, 27, .2));
  color: #ffd27b;
}
.nk-nav a:focus-visible { outline: 2px solid rgba(251, 191, 92, .8); outline-offset: 2px; }
.nk-sidebar-foot {
  display: flex; align-items: center; gap: .75rem; padding: .9rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, .08); font-size: .75rem; color: var(--nk-sidebar-muted);
  background: rgba(0, 0, 0, .12);
}
.nk-sidebar-foot > .bi {
  width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center;
  border-radius: 10px; background: rgba(21, 128, 61, .16); color: #86efac; font-size: .95rem;
}
.nk-sidebar-foot > span { display: grid; min-width: 0; gap: .12rem; }
.nk-sidebar-foot-label { color: #b8b0aa; font-weight: 500; }
.nk-sidebar-foot-time { color: #e7e5e4; font-size: .72rem; font-variant-numeric: tabular-nums; }

.nk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nk-topbar {
  position: sticky; top: 0; z-index: 1030; background: rgba(246, 244, 241, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--nk-line); padding: .7rem 1.6rem; display: flex; align-items: center; gap: 1rem;
}
.nk-topbar h1 { font-size: 1.12rem; font-weight: 650; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nk-search { position: relative; max-width: 340px; width: 100%; }
.nk-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--nk-muted); }
.nk-search input { padding-left: 2.2rem; background: #fff; }
.nk-content { padding: 1.6rem; flex: 1; }
.nk-user-btn { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--nk-line); background: #fff; border-radius: 999px; padding: .25rem .8rem .25rem .3rem; transition: border-color .15s, box-shadow .15s; }
.nk-user-btn:hover, .nk-user-btn[aria-expanded="true"] { border-color: #e8c3b2; box-shadow: 0 0 0 .2rem rgba(180, 70, 27, .08); }
.nk-user-btn .bi-chevron-down { transition: transform .15s; }
.nk-user-btn[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }

/* profile menu */
.nk-user-menu {
  --bs-dropdown-bg: #fff; --bs-dropdown-link-active-bg: var(--nk-primary-50); --bs-dropdown-link-active-color: var(--nk-primary);
  min-width: 250px; max-width: calc(100vw - 2rem); padding: .4rem; margin-top: .5rem !important;
  border: 1px solid var(--nk-line); border-radius: 14px; box-shadow: var(--nk-shadow-lg);
}
.nk-user-head { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem .5rem; }
.nk-user-name { font-weight: 600; color: var(--nk-ink); line-height: 1.25; }
.nk-user-sub { font-size: .76rem; color: var(--nk-muted); }
.nk-user-menu .dropdown-divider { margin: .35rem .2rem; border-color: var(--nk-line-2); opacity: 1; }
.nk-user-menu .dropdown-item { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: 9px; font-size: .88rem; font-weight: 500; color: var(--nk-ink-2); }
.nk-user-menu .dropdown-item i { font-size: 1rem; width: 1.1rem; text-align: center; color: var(--nk-muted); transition: color .15s; }
.nk-user-menu .dropdown-item:hover, .nk-user-menu .dropdown-item:focus { background: var(--nk-line-2); color: var(--nk-ink); }
.nk-user-menu .dropdown-item:hover i, .nk-user-menu .dropdown-item:focus i { color: var(--nk-primary); }
.nk-user-menu .dropdown-item:focus-visible { outline: 2px solid #e8c3b2; outline-offset: -2px; }
.nk-user-menu .nk-signout, .nk-user-menu .nk-signout i { color: var(--nk-danger); }
.nk-user-menu .nk-signout:hover, .nk-user-menu .nk-signout:focus { background: #fef2f2; color: var(--nk-danger); }
.nk-user-menu .nk-signout:hover i, .nk-user-menu .nk-signout:focus i { color: var(--nk-danger); }

/* collapsed sidebar: html.nk-sb-collapsed is rendered by PHP from the nk_sidebar cookie, so pages never flash the full sidebar */
@media (min-width: 768px) {
  .nk-sb-collapsed .nk-sidebar { width: 76px; flex-basis: 76px; }
  .nk-sb-collapsed .nk-sidebar .nk-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .nk-sb-collapsed .nk-sidebar .nk-brand > span:not(.nk-brand-mark),
  .nk-sb-collapsed .nk-sidebar .nk-nav-label,
  .nk-sb-collapsed .nk-sidebar .nk-sidebar-foot { display: none; }
  .nk-sb-collapsed .nk-sidebar .nk-nav { padding-left: .55rem; padding-right: .55rem; }
  .nk-sb-collapsed .nk-sidebar .nk-nav a { justify-content: center; gap: 0; padding: .55rem .35rem; font-size: 0; }
  .nk-sb-collapsed .nk-sidebar .nk-nav a span { display: none; }
  .nk-sb-collapsed .nk-sidebar .nk-nav a i { width: 36px; height: 36px; flex-basis: 36px; font-size: 1.05rem; }
  .nk-sb-collapsed .nk-sidebar .nk-nav a:hover { transform: none; }
}

@media (max-width: 991.98px) {
  .nk-sidebar { position: fixed; left: 0; height: 100dvh; transform: translateX(-100%); transition: transform .24s ease; box-shadow: 14px 0 40px rgba(0, 0, 0, .25); }
  .nk-sidebar.open { transform: translateX(0); }
  .nk-brand { padding-right: 3.6rem; }
  .nk-sidebar-close { position: absolute; top: 1.3rem; right: .85rem; color: #d6d3d1; background: transparent; border: 0; }
  .nk-sidebar-close:hover, .nk-sidebar-close:focus-visible { background: var(--nk-sidebar-2); color: #fff; }
  .nk-backdrop { position: fixed; inset: 0; background: rgba(28, 25, 23, .4); z-index: 1035; display: none; }
  .nk-backdrop.show { display: block; }
  .nk-topbar { padding: .65rem 1rem; }
  .nk-content { padding: 1rem; }
}

/* ---------------- Cards ---------------- */
.card { border: 1px solid var(--nk-line); border-radius: var(--nk-radius); box-shadow: var(--nk-shadow); background: var(--nk-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--nk-line-2); padding: .95rem 1.2rem; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.card-header .bi { color: var(--nk-primary); }
.card-header .btn .bi { color: inherit; }
@media (max-width: 575.98px) {
  /* header with a title + action buttons: title on its own line, buttons share the next line evenly */
  .card-header > span:first-child:has(~ .btn.ms-auto) { flex-basis: 100%; }
  .card-header:has(> span:first-child ~ .btn.ms-auto) > .btn { flex: 1 1 0; margin-left: 0 !important; white-space: nowrap; }
  .card-header:has(> span:first-child ~ .btn.ms-auto) > .badge-soft { margin-left: 0 !important; }
}
.card-body { padding: 1.2rem; }
.card-title-sm { font-size: .95rem; font-weight: 600; margin: 0; }

/* KPI tiles */
.kpi { padding: 1.1rem 1.2rem; display: flex; gap: 1rem; align-items: flex-start; height: 100%; }
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex: 0 0 44px; }
.kpi-value { font-size: 1.65rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--nk-muted); font-size: .82rem; font-weight: 500; }
.kpi-sub { font-size: .76rem; color: var(--nk-muted); margin-top: .25rem; }
.tone-1 { background: var(--nk-primary-50); color: var(--nk-primary); }
.tone-2 { background: var(--nk-accent-50); color: #b26d06; }
.tone-3 { background: #ecfdf3; color: #15803d; }
.tone-4 { background: #eef2ff; color: #4338ca; }

.progress { height: 6px; border-radius: 99px; background: var(--nk-line-2); }
.progress-bar { background: var(--nk-primary); border-radius: 99px; }

/* ---------------- Avatars ---------------- */
.avatar {
  --hue: 20; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 50%; overflow: hidden; font-weight: 600;
  background: hsl(var(--hue) 55% 92%); color: hsl(var(--hue) 45% 32%); letter-spacing: .02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 28px; height: 28px; font-size: .68rem; }
.avatar-sm { width: 36px; height: 36px; font-size: .78rem; }
.avatar-md { width: 44px; height: 44px; font-size: .9rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar-xl { width: 112px; height: 112px; font-size: 2.1rem; border: 4px solid #fff; box-shadow: var(--nk-shadow-lg); }

/* ---------------- Tables ---------------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .75rem 1rem; border-bottom-color: var(--nk-line-2); }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--nk-muted); font-weight: 600; background: #faf8f6; border-bottom: 1px solid var(--nk-line); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #fbf7f4; }
.row-link { cursor: pointer; }
.person { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.person-name { font-weight: 600; color: var(--nk-ink); }
.person-sub { font-size: .78rem; color: var(--nk-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge-soft { background: var(--nk-line-2); color: var(--nk-ink-2); font-weight: 500; border-radius: 999px; padding: .3em .65em; font-size: .72rem; white-space: nowrap; }
.badge-primary { background: var(--nk-primary-50); color: var(--nk-primary); }
.badge-accent { background: var(--nk-accent-50); color: #9a5b04; }
.badge-success { background: #ecfdf3; color: #15803d; }
.badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-blood { background: #fef2f2; color: #b91c1c; font-weight: 600; }

/* Filters bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filter-bar .form-select, .filter-bar .form-control { width: auto; min-width: 140px; }
.filter-bar .nk-search { width: 220px; min-width: 220px; }
.filter-bar .nk-search .form-control { width: 100%; }
.filter-bar > :not(.nk-search) { flex-shrink: 0; max-width: 100%; }
/* one-line filter bar (search + selects + date pickers + buttons); wraps again on small screens */
@media (min-width: 768px) {
  .filter-bar-row { flex-wrap: nowrap; }
  .filter-bar-row .nk-search { flex: 1 1 200px; min-width: 160px; }
  .filter-bar-row .input-group { width: 200px; flex: 0 0 200px; flex-wrap: nowrap; }
  .filter-bar-row .input-group > .form-control { width: 1%; min-width: 0; flex: 1 1 auto; }
  .filter-bar-row .form-select, .filter-bar-row .ts-wrapper { width: 150px; min-width: 150px; flex: 0 0 150px; }
  .filter-bar-row .btn { white-space: nowrap; }
}
@media (max-width: 767.98px) { .filter-bar-row .input-group { width: 175px; flex: 1 1 175px; } }
@media (max-width: 575.98px) {
  .filter-bar > * { flex: 1 1 auto; }
  .filter-bar .nk-search { min-width: 100%; }
}
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 999px; background: var(--nk-primary-50); color: var(--nk-primary); font-size: .78rem; font-weight: 500; }
.chip a { color: inherit; }

/* Pagination */
.pagination { --bs-pagination-color: var(--nk-ink-2); --bs-pagination-active-bg: var(--nk-primary); --bs-pagination-active-border-color: var(--nk-primary); --bs-pagination-border-color: var(--nk-line); --bs-pagination-hover-bg: var(--nk-line-2); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(180,70,27,.12); margin: 0; }
.page-link { border-radius: 8px !important; margin: 0 2px; }
.pagination { flex-wrap: wrap; row-gap: 4px; }

/* ---------------- Member profile ---------------- */
.profile-hero { position: relative; overflow: hidden; }
.profile-cover { height: 110px; background:
  radial-gradient(circle at 15% 120%, rgba(224,149,31,.55), transparent 55%),
  radial-gradient(circle at 85% -20%, rgba(180,70,27,.65), transparent 55%),
  linear-gradient(120deg, #2a211c, #4a2c1d); }
.profile-head { display: flex; gap: 1.25rem; align-items: flex-end; padding: 0 1.4rem 1.2rem; margin-top: -56px; flex-wrap: wrap; }
.profile-head h2 { font-size: 1.45rem; font-weight: 700; margin: 0; }
.profile-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.meta-row { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; color: var(--nk-muted); font-size: .85rem; margin-top: .3rem; }
.meta-row i { margin-right: .3rem; }
.profile-head .meta-row { gap: .4rem; margin-top: .55rem; }
.profile-head .meta-row span { display: inline-flex; align-items: center; background: var(--nk-line-2); color: var(--nk-ink-2); border-radius: 999px; padding: .22rem .65rem; font-size: .8rem; }
.profile-head .meta-row i { color: var(--nk-primary); }
.profile-hero .alert { border-radius: 10px; flex-wrap: wrap; }
@media (min-width: 576px) {
  /* only the photo overlaps the cover; name and details start just below it */
  .profile-head { margin-top: 0; padding-top: .9rem; align-items: flex-start; }
  .profile-head .avatar-xl { margin-top: calc(-56px - .9rem); }
  .profile-head > .flex-fill { flex-basis: 0 !important; }
  .profile-actions { align-self: flex-start; }
}
@media (min-width: 992px) and (max-width: 1279.98px) {
  /* narrow side-by-side columns: stack KPI icon over text, and labels over values */
  .col-lg-8 .card.kpi { flex-direction: column; gap: .6rem; }
  .col-lg-8 .kpi .kpi-value.fs-5 { font-size: 1.05rem !important; }
  .col-lg-4 .dl-grid { grid-template-columns: 1fr; gap: .1rem; }
  .col-lg-4 .dl-grid dd { margin-bottom: .55rem; }
}
@media (max-width: 575.98px) {
  /* profile hero on phones: centred avatar, name, details and actions */
  .profile-head { flex-direction: column; align-items: center; text-align: center; gap: .8rem; padding: 0 1rem 1.1rem; margin-top: -50px; }
  .profile-head .avatar-xl { width: 96px; height: 96px; font-size: 1.8rem; }
  .profile-head > .flex-fill { min-width: 0 !important; width: 100%; }
  .profile-head > .flex-fill > .d-flex { justify-content: center; }
  .profile-head h2 { font-size: 1.25rem; width: 100%; }
  .profile-head .meta-row { justify-content: center; }
  .profile-actions { margin-left: 0; width: 100%; justify-content: center; gap: .4rem; }
  .profile-actions .btn { padding-left: .55rem; padding-right: .55rem; }
  .dl-grid { grid-template-columns: 118px 1fr; }
}

.dl-grid { display: grid; grid-template-columns: 140px 1fr; gap: .55rem 1rem; font-size: .88rem; margin: 0; }
.dl-grid dt { color: var(--nk-muted); font-weight: 500; }
.dl-grid dd { margin: 0; word-break: break-word; }

.lineage { list-style: none; padding: 0; margin: 0; position: relative; }
.lineage li { position: relative; padding: 0 0 1rem 2.1rem; }
.lineage li::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: -2px; width: 2px; background: var(--nk-line); }
.lineage li:last-child::before { display: none; }
.lineage .dot { position: absolute; left: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--nk-line); display: grid; place-items: center; font-size: .6rem; color: var(--nk-muted); }
.lineage li.linked .dot { border-color: var(--nk-accent); color: var(--nk-accent); }
.lineage li.self .dot { background: var(--nk-primary); border-color: var(--nk-primary); color: #fff; }
.lineage .gen { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nk-muted); font-weight: 600; }
.lineage .who { font-weight: 600; }

.family-card { border: 1px solid var(--nk-line); border-radius: 12px; padding: .85rem; display: flex; gap: .75rem; align-items: center; background: #fff; height: 100%; transition: border-color .15s, box-shadow .15s; }
a.family-card:hover { border-color: #e8c3b2; box-shadow: var(--nk-shadow); }
.family-card .rel { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--nk-primary); font-weight: 600; }
.family-card.late { opacity: .7; }

.section-title { display: flex; align-items: center; gap: .5rem; font-weight: 650; font-size: 1rem; margin-bottom: .9rem; }
.section-title .count { background: var(--nk-line-2); color: var(--nk-ink-2); border-radius: 99px; font-size: .72rem; padding: .1rem .5rem; font-weight: 600; }
.section-title > a { white-space: nowrap; }
@media (max-width: 575.98px) {
  /* titles flow like text so the count badge stays right after the last word; the action drops to its own line */
  .section-title, .card-header:has(> i:first-child ~ .ms-auto) { display: block; }
  .section-title > i:first-child, .card-header:has(> i:first-child ~ .ms-auto) > i:first-child { margin-right: .4rem; }
  .section-title > .count, .card-header:has(> i:first-child ~ .ms-auto) > .badge-soft { display: inline-block; margin-left: .3rem !important; vertical-align: .08em; }
  .section-title > .ms-auto, .card-header:has(> i:first-child ~ .ms-auto) > .ms-auto { display: flex; align-items: center; gap: .3rem; width: fit-content; margin: .55rem 0 0 auto !important; }
  .card-header:has(> i:first-child ~ .ms-auto) > .ms-auto .me-1 { margin-right: 0 !important; }
}

.empty { text-align: center; padding: 2rem 1rem; color: var(--nk-muted); }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #d6d3d1; }

/* ---------------- Form page ---------------- */
.form-section { scroll-margin-top: 80px; }
html:has(.form-nav) { scroll-behavior: smooth; }
.form-nav { position: sticky; top: 84px; background: var(--nk-surface); border: 1px solid var(--nk-line); border-radius: var(--nk-radius); box-shadow: var(--nk-shadow); padding: .5rem; }
.form-nav a { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; border-radius: 10px; color: var(--nk-ink-2); font-weight: 500; font-size: .88rem; line-height: 1.35; margin-bottom: 2px; transition: background .15s, color .15s; }
.form-nav a:last-child { margin-bottom: 0; }
.form-nav a:hover { background: var(--nk-line-2); }
.form-nav a .n { flex: 0 0 22px; width: 22px; height: 22px; align-self: flex-start; margin-top: 1px; border-radius: 50%; background: var(--nk-line-2); display: grid; place-items: center; font-size: .72rem; font-weight: 600; transition: background .15s, color .15s; }
.form-nav a:hover .n { background: var(--nk-primary-50); color: var(--nk-primary); }
.form-nav a.active { background: var(--nk-primary-50); color: var(--nk-primary); font-weight: 600; }
.form-nav hr { margin: .4rem .5rem; border-color: var(--nk-line-2); opacity: 1; }
.form-nav a.active .n { background: var(--nk-primary); color: #fff; }
.form-nav a.has-error .n { background: #fee2e2; color: var(--nk-danger); }
.sticky-actions { position: sticky; bottom: 0; z-index: 20; background: rgba(246,244,241,.92); backdrop-filter: blur(8px); border-top: 1px solid var(--nk-line); padding: .8rem 0; margin-top: 1rem; }

.photo-drop { display: flex; align-items: center; gap: 1rem; }
.photo-drop .preview { width: 84px; height: 84px; border-radius: 16px; overflow: hidden; background: var(--nk-line-2); display: grid; place-items: center; color: var(--nk-muted); font-size: 1.6rem; flex: 0 0 84px; border: 1px dashed #d6d3d1; }
.photo-drop .preview { position: relative; }
.photo-drop .preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* father picker */
.father-box { border: 1.5px dashed #e8c3b2; border-radius: var(--nk-radius); background: linear-gradient(180deg, #fffaf7, #fff); padding: 1.1rem; }
.father-box.is-invalid { border-color: var(--nk-danger); background: #fffafa; }
.father-card { margin-top: .9rem; border: 1px solid var(--nk-line); border-radius: 12px; background: #fff; padding: 1rem; display: flex; gap: 1rem; animation: fadeIn .2s ease; }
.father-card .facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: .35rem 1rem; font-size: .82rem; margin-top: .45rem; }
.father-card .facts span { color: var(--nk-muted); }
.ts-wrapper.single .ts-control { border-radius: 10px; padding: .55rem .8rem; border-color: var(--nk-line); }
.ts-dropdown { border-radius: 12px; border-color: var(--nk-line); box-shadow: var(--nk-shadow-lg); overflow: hidden; }
.ts-dropdown .option { padding: .55rem .8rem; }
.ts-dropdown .active { background: var(--nk-primary-50); color: var(--nk-ink); }
.ts-wrapper.single .ts-control { flex-wrap: nowrap; padding-right: 2.25rem !important; }
.ts-wrapper.form-select-sm.single .ts-control { padding: .25rem .6rem; padding-right: 2rem !important; font-size: .875rem; }
.ts-wrapper.single .ts-control > .item { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-dropdown .dropdown-input { padding: .55rem .8rem; border-color: var(--nk-line); }
.plugin-dropdown_input.focus .ts-dropdown .dropdown-input { border-color: var(--nk-line); box-shadow: none; }
/* date fields: keep room for DD-MM-YYYY plus the calendar button */
.row > [class*="col"]:has(input[data-date]) { min-width: 11.5rem; }
.input-group > input[data-date] + .btn { padding-left: .65rem; padding-right: .65rem; }
.dep-row .row > .col-md { min-width: 9rem; }
@media (max-width: 575.98px) {
  .row:has(input[data-date]) > .col-6 { width: 100%; }
}

/* datepicker – match the app theme */
.datepicker-dropdown { z-index: 1060; padding-top: 6px; }
.datepicker-picker { border-radius: 14px; border: 1px solid var(--nk-line); overflow: hidden; background: #fff; }
.datepicker-dropdown .datepicker-picker { box-shadow: var(--nk-shadow-lg); }
.datepicker-main { padding: .1rem .55rem .5rem; }
.datepicker-view { width: 16.25rem; }
/* header: month / year switch with round arrows */
.datepicker-header .datepicker-controls { padding: .55rem .55rem .25rem; align-items: center; }
.datepicker-controls .btn { background: #fff; border-color: transparent; border-radius: 9px; padding: .35rem .6rem; color: var(--nk-ink); }
.datepicker-controls .btn:hover, .datepicker-controls .btn:focus { background: var(--nk-line-2); border-color: transparent; color: var(--nk-ink); box-shadow: none; }
.datepicker-controls .view-switch { font-size: .95rem; font-weight: 700; }
.datepicker-controls .prev-button, .datepicker-controls .next-button { flex: 0 0 2.1rem; height: 2.1rem; padding: 0; border-radius: 50%; color: var(--nk-muted); }
.datepicker-controls .btn:disabled { background: transparent; border-color: transparent; color: var(--nk-muted); opacity: .3; }
/* weekday row */
.datepicker .days-of-week { border-bottom: 1px solid var(--nk-line-2); margin-bottom: .3rem; }
.datepicker .days-of-week .dow { height: 1.9rem; font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; color: var(--nk-muted); font-weight: 600; }
.datepicker .days-of-week .dow:first-child, .datepicker .days-of-week .dow:last-child { color: #dc2626; }
/* day cells */
.datepicker-cell { height: 2.15rem; border-radius: 9px; font-size: .875rem; font-weight: 500; color: var(--nk-ink); transition: background .12s, color .12s; }
.datepicker-cell:not(.disabled):hover { background: var(--nk-primary-50); color: var(--nk-primary); }
.datepicker-cell.focused:not(.selected) { background: var(--nk-line-2); }
.datepicker-cell.next:not(.disabled), .datepicker-cell.prev:not(.disabled) { color: #c4bdb6; }
.datepicker-cell.disabled { color: #d6d3d1; cursor: not-allowed; }
/* Saturday & Sunday in red */
.datepicker-cell.day.highlighted:not(.selected):not(.range):not(.today) { background: transparent; border-radius: 9px; color: #dc2626; }
.datepicker-cell.day.highlighted:not(.selected):not(.range):not(.today):not(.disabled):hover { background: #fef2f2; color: #b91c1c; }
.datepicker-cell.day.highlighted.focused:not(.selected):not(.range):not(.today) { background: #fef2f2; }
.datepicker-cell.day.highlighted.prev:not(.selected):not(.range):not(.today), .datepicker-cell.day.highlighted.next:not(.selected):not(.range):not(.today) { color: #f1a7a7; }
.datepicker-cell.day.highlighted.disabled:not(.selected):not(.range):not(.today) { color: #f5caca; }
/* today: outlined ring; selected: filled */
.datepicker-cell.today:not(.selected), .datepicker-cell.today:not(.selected):not(.disabled) { background: transparent; color: var(--nk-primary); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--nk-primary); }
.datepicker-cell.today.focused:not(.selected), .datepicker-cell.today:not(.selected):not(.disabled):hover { background: var(--nk-primary-50); }
.datepicker-cell.selected, .datepicker-cell.selected:hover, .datepicker-cell.selected.focused { background: var(--nk-primary); color: #fff; font-weight: 700; box-shadow: 0 2px 6px rgba(180, 70, 27, .3); }
/* month / year / decade views */
.datepicker-view .months .datepicker-cell, .datepicker-view .years .datepicker-cell, .datepicker-view .decades .datepicker-cell { height: 3.3rem; }
/* footer: Today / Clear */
.datepicker-footer { background: #faf8f6; box-shadow: none; border-top: 1px solid var(--nk-line-2); }
.datepicker-footer .datepicker-controls { padding: .2rem .3rem; }
.datepicker-footer .datepicker-controls .btn { margin: .4rem .25rem; border: 1px solid var(--nk-line); border-radius: 9px; font-size: .8rem; font-weight: 600; padding: .35rem .5rem; }
.datepicker-footer .today-button { color: var(--nk-primary); }
.datepicker-footer .clear-button { color: var(--nk-muted); }
.datepicker-input.in-edit { border-color: #e2a387; }
.datepicker-input.in-edit:focus { box-shadow: 0 0 0 .2rem rgba(180, 70, 27, .12); }
.fopt { display: flex; gap: .7rem; align-items: center; }
.fopt-name { font-weight: 600; }
.fopt-sub { font-size: .76rem; color: var(--nk-muted); }
.fopt-tag { font-size: .7rem; background: var(--nk-line-2); border-radius: 6px; padding: 0 .35rem; margin-left: .3rem; color: var(--nk-ink-2); font-weight: 500; }

/* dependents repeater */
.dep-row { border: 1px solid var(--nk-line); border-radius: 12px; padding: .9rem; background: #fff; position: relative; }
.dep-row + .dep-row { margin-top: .75rem; }
.dep-row .remove { position: absolute; top: .55rem; right: .55rem; }
.dep-row .thumb { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--nk-line-2); display: grid; place-items: center; color: var(--nk-muted); }
.dep-row .thumb { position: relative; }
.dep-row .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 575.98px) {
  /* only the first line (photo + name) sits beside the remove button; the fields below use the full width */
  .dep-row { padding: .8rem; }
  .dep-row .row { padding-right: 0 !important; }
  .dep-row .row > .col-md-4 { padding-right: 2.6rem; }
  .dep-row .row > .col-8 { flex: 1 1 0; }
}

/* ---------------- Dashboard ---------------- */
.event { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--nk-line-2); }
.event:last-child { border-bottom: 0; }
.event-date { width: 46px; text-align: center; border-radius: 10px; background: var(--nk-line-2); padding: .25rem 0; flex: 0 0 46px; }
.event-date .d { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.event-date .m { font-size: .64rem; text-transform: uppercase; color: var(--nk-muted); font-weight: 600; }
.event.today .event-date { background: var(--nk-primary); color: #fff; }
.event.today .event-date .m { color: #fde4d6; }
.scroll-y { max-height: 420px; overflow-y: auto; }
.quality-item { display: flex; align-items: center; justify-content: space-between; padding: .55rem .2rem; border-bottom: 1px solid var(--nk-line-2); color: var(--nk-ink); }
.quality-item:last-child { border-bottom: 0; }
a.quality-item:hover { color: var(--nk-primary); }
.chart-box { position: relative; height: 240px; }
.bar-list .row-item { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; margin-bottom: .7rem; font-size: .85rem; }
.bar-list .row-item .progress { grid-column: 1 / -1; }
.timeline-item { display: flex; gap: .7rem; padding: .55rem 0; font-size: .85rem; }
.timeline-item .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 30px; }

/* ---------------- Auth ---------------- */
/* the sign-in screen always fits the window: fixed to the viewport, spacing scales with its height */
.auth-wrap { height: 100vh; height: 100dvh; overflow: hidden; display: grid; grid-template-columns: 1.05fr 1fr; }

/* left: the Nokha monument photo under a warm overlay */
.auth-art { position: relative; overflow: hidden; color: #fff; padding: clamp(1.5rem, 5vh, 3rem); display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem;
  background:
    linear-gradient(180deg, rgba(28,25,23,.30) 0%, rgba(28,25,23,.55) 45%, rgba(42,26,18,.94) 100%),
    url(../img/nokha_bg.jpg) center 30% / cover no-repeat, #1c1917; }
.auth-brand { display: flex; align-items: center; gap: .65rem; position: relative; font-size: 1.02rem; }
.auth-pitch { position: relative; max-width: 460px; }
.auth-art h2 { font-size: clamp(1.5rem, min(2.6vw, 4.5vh), 2.5rem); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.auth-art p { color: #e7e5e4; position: relative; }
.auth-pitch p { font-size: 1rem; line-height: 1.6; margin: clamp(.5rem, 2vh, 1rem) 0 0; }
.auth-note { font-size: .8rem; color: #d6d3d1 !important; margin: 0; }

/* right: soft warm ground with a raised sign-in card */
.auth-form { position: relative; display: flex; align-items: center; justify-content: center; padding: clamp(.75rem, 3vh, 2.5rem) 1.5rem; overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(224,149,31,.14), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(180,70,27,.10), transparent 45%),
    var(--nk-bg); }
.auth-form::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(120,113,108,.18) 1px, transparent 1px); background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%); mask-image: linear-gradient(180deg, #000, transparent 70%); }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 410px; max-height: 100%; background: var(--nk-surface); border: 1px solid var(--nk-line);
  border-radius: 22px; padding: clamp(1rem, 4.5vh, 2.25rem) 2rem clamp(.9rem, 3.5vh, 1.75rem);
  box-shadow: 0 1px 2px rgba(28,25,23,.04), 0 24px 48px -12px rgba(28,25,23,.18); }
.auth-card::before { content: ''; position: absolute; left: 2rem; right: 2rem; top: -1px; height: 3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--nk-accent), var(--nk-primary)); }
.auth-logo { text-align: center; margin-bottom: clamp(.75rem, 3vh, 1.6rem); }
.auth-logo img { display: block; width: clamp(56px, 15vh, 120px); height: auto; margin: 0 auto clamp(.4rem, 1.6vh, 1rem); border-radius: 18px; }
.auth-card .mb-3 { margin-bottom: clamp(.6rem, 2vh, 1rem) !important; }
.auth-card .mb-4 { margin-bottom: clamp(.8rem, 3vh, 1.5rem) !important; }
.auth-alert { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem .8rem; margin-bottom: clamp(.6rem, 2vh, 1rem); font-size: .85rem; border-radius: 12px; }
.auth-alert .bi { margin-top: 1px; }
.auth-card .form-control { padding-top: clamp(.5rem, 1.3vh, .68rem); padding-bottom: clamp(.5rem, 1.3vh, .68rem); }
.auth-submit { border-radius: 12px; font-size: 1rem; padding: clamp(.55rem, 1.5vh, .72rem) 1rem; font-weight: 600;
  box-shadow: 0 8px 18px -8px rgba(180,70,27,.6); transition: transform .12s ease, box-shadow .12s ease; }
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -8px rgba(180,70,27,.6); }
.auth-submit:active { transform: none; }
.auth-secure { display: flex; gap: .55rem; align-items: flex-start; margin-top: clamp(.75rem, 2.8vh, 1.4rem); padding-top: clamp(.6rem, 2.2vh, 1.1rem);
  border-top: 1px solid var(--nk-line-2); font-size: .78rem; color: var(--nk-muted); line-height: 1.45; }
.auth-secure .bi { color: var(--nk-primary); font-size: .95rem; }

/* tablet & phone: photo becomes a banner behind the top of the card */
@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-form::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 38%;
    background: linear-gradient(180deg, rgba(28,25,23,.25), rgba(42,26,18,.85)), url(../img/nokha_bg.jpg) center 30% / cover no-repeat; }
  .auth-form::after { display: none; }
}
@media (max-width: 575.98px) {
  .auth-form { padding-left: 1rem; padding-right: 1rem; }
  .auth-card { padding-left: 1.25rem; padding-right: 1.25rem; border-radius: 18px; }
  .auth-card::before { left: 1.25rem; right: 1.25rem; }
  .auth-card .form-control { font-size: 16px; } /* stops iOS zooming into the field */
}
/* very short windows (landscape phones): drop the secondary lines so the form still fits */
@media (max-height: 540px) {
  .auth-logo p, .auth-secure, .auth-art .auth-pitch p { display: none; }
  .auth-card .form-label { margin-bottom: .15rem; }
}

/* input group with a leading icon, used on auth + account forms */
.nk-field { border-radius: 10px; transition: box-shadow .15s; }
.nk-field > .input-group-text { background: #fff; color: var(--nk-muted); border-right: 0; padding-right: .35rem; }
.nk-field > .input-group-text + .form-control { border-left: 0; }
.nk-field > .form-control:has(+ .btn) { border-right: 0; }
.nk-field > .btn { border-left: 0; color: var(--nk-muted); background: #fff; }
.nk-field > .btn:hover { color: var(--nk-ink); background: #fff; }
.nk-field > .form-control:focus { box-shadow: none; }
.nk-field:focus-within { box-shadow: 0 0 0 .2rem rgba(180,70,27,.12); }
.nk-field:focus-within > * { border-color: #e2a387; }
.nk-field:focus-within > .input-group-text { color: var(--nk-primary); }
.nk-field.is-invalid > * { border-color: var(--nk-danger) !important; }
.nk-field.is-invalid > .form-control { background-image: none; }

/* ---------------- Account: change password ---------------- */
/* one card split in two: emblem panel on the left (monument photo under a warm overlay), form on the right */
.pw-page { max-width: 920px; margin: 0 auto; }
.pw-split { display: grid; grid-template-columns: 300px 1fr; overflow: hidden; }
.pw-side { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1rem;
  padding: 2rem 1.5rem; color: #fff;
  background:
    linear-gradient(180deg, rgba(28,25,23,.55) 0%, rgba(42,26,18,.93) 100%),
    url(../img/nokha_bg.jpg) center 30% / cover no-repeat, #2a1a12; }
.pw-side-logo { width: 150px; height: auto; display: block; border-radius: 18px; }
.pw-title { font-size: 1.3rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.pw-account { display: flex; align-items: flex-start; gap: .7rem; text-align: left; font-size: .8rem; line-height: 1.5; color: #e7e5e4;
  margin-top: .5rem; padding: .8rem .9rem; border-radius: 12px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.pw-account strong { color: #fff; }
.pw-account .avatar { flex: 0 0 auto; }
.pw-main { padding: 2rem 2rem 1.6rem; }
.pw-page .progress { height: 6px; }
.pw-actions { display: flex; justify-content: flex-end; padding-top: 1.1rem; border-top: 1px solid var(--nk-line-2); }
@media (max-width: 767.98px) {
  .pw-split { grid-template-columns: 1fr; }
  .pw-side { padding: 1.5rem 1.25rem; gap: .75rem; }
  .pw-side-logo { width: 110px; }
  .pw-main { padding: 1.4rem 1.25rem 1.25rem; }
}
@media (max-width: 575.98px) {
  .pw-actions .btn { width: 100%; }
  .pw-page .form-control { font-size: 16px; } /* stops iOS zooming into the field */
}

/* ---------------- Misc ---------------- */
.toast-container { z-index: 1090; }
.toast { border-radius: 12px; border: 0; box-shadow: var(--nk-shadow-lg); }
pre.json { background: #1c1917; color: #e7e5e4; border-radius: 12px; padding: 1rem; font-size: .78rem; max-height: 520px; overflow: auto; }
.invalid-feedback { font-size: .78rem; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- Print (keeps the screen colours) ---------------- */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  @page { margin: 12mm; }
  .nk-sidebar, .nk-topbar, .nk-backdrop, .profile-actions, .no-print, .toast-container, .sticky-actions, .tooltip { display: none !important; }
  body, .nk-content { background: #fff !important; padding: 0 !important; }
  .nk-shell { display: block; min-height: 0; }
  .card { box-shadow: none !important; border-color: var(--nk-line) !important; break-inside: avoid; }
  .avatar-xl { box-shadow: none; }
  .col-lg-4, .col-lg-8 { width: 100% !important; }
  .col-md-6 { width: 50% !important; }
  /* stat cards: plain grid with real gaps (no negative gutter margins), never split across pages */
  .row:has(> [class*="col"] > .card.kpi) { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 0 0 1rem !important; break-inside: avoid; }
  .row:has(> [class*="col"] > .card.kpi) > [class*="col"] { width: auto !important; max-width: none; padding: 0 !important; margin: 0 !important; }
  .card.kpi { flex-direction: row !important; align-items: center; gap: .7rem; padding: .8rem .9rem; height: 100%; }
  .kpi > div:last-child { min-width: 0; }
  .kpi-icon { width: 36px; height: 36px; flex: 0 0 36px; font-size: 1.05rem; }
  .kpi-value { font-size: 1.35rem; }
  .kpi .kpi-value.fs-5 { font-size: 1rem !important; padding-top: 0 !important; }
  .kpi-label { font-size: .76rem; }
}

.min-w-0 { min-width: 0; }
/* two-column pages: when the right column has nothing in it, the left card takes the full width */
.row > .col-lg-8:not(:has(*)) { display: none; }
@media (min-width: 992px) { .row > .col-lg-4:nth-last-child(2) { flex-grow: 1; } }
.form-control, .form-select, .ts-wrapper.single .ts-control { background-color: #fff; }
.card.kpi { flex-direction: row; }
.ts-control .item .text-muted { margin-left: .35rem; }

/* ---------- photo lightbox ---------- */
.avatar img.zoomable { cursor: zoom-in; transition: transform .15s ease; }
.avatar img.zoomable:hover { transform: scale(1.04); }
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(20, 17, 15, .82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .18s ease; cursor: zoom-out;
}
.lightbox.show { opacity: 1; }
.lb-figure { margin: 0; max-width: min(94vw, 760px); text-align: center; transform: scale(.94); transition: transform .18s ease; }
.lightbox.show .lb-figure { transform: scale(1); }
.lb-frame { display: inline-block; cursor: default; background: #fff; padding: 8px; border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
.lb-img { display: block; width: min(88vw, 560px); height: min(72vh, 560px); object-fit: contain; border-radius: 12px; background: #f1ede8; }
.lb-cap { margin-top: 14px; color: #fff; font-weight: 600; font-size: 1.05rem; letter-spacing: .01em; text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
.lb-close {
  position: absolute; top: 16px; right: 16px; width: 42px; height: 42px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s ease;
}
.lb-close:hover, .lb-close:focus-visible { background: rgba(255, 255, 255, .3); outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .lightbox, .lb-figure, .avatar img.zoomable { transition: none; } }
