/* ==========================================================================
   EK NOK MONDAL - Admin Design System (design.md §5)
   Palette: saffron #FF9933 / green #1E8E3E / navy #1E3A8A on white canvas
   Mobile-first, fluid, premium. Verified 320px -> 4K.
   ========================================================================== */
:root {
  --saffron-50: #FFF4E8;
  --saffron-100: #FFE4C7;
  --saffron-500: #FF9933;
  --saffron-600: #E97C1A;
  --saffron-700: #C96410;
  --green-50: #E9F7EE;
  --green-600: #1E8E3E;
  --green-700: #157A32;
  --navy-700: #27479B;
  --navy-800: #1E3A8A;
  --navy-900: #16296B;
  --ink: #1F2430;
  --ink-soft: #5B6272;
  --surface: #F6F7FB;
  --card: #FFFFFF;
  --line: #E7EAF0;
  --line-soft: #F1F3F8;
  --info: #2563EB;
  --warn: #F59E0B;
  --danger: #DC2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 2px rgba(22, 41, 107, .06);
  --shadow-sm: 0 1px 2px rgba(22, 41, 107, .05), 0 2px 10px rgba(22, 41, 107, .05);
  --shadow-md: 0 8px 30px rgba(22, 41, 107, .11);
  --shadow-lg: 0 18px 50px rgba(22, 41, 107, .18);
  --sidebar-w: 264px;
  --sidebar-mini: 76px;
  --topbar-h: 60px;
  /* fluid gutter used by page content + topbar */
  --gutter: clamp(14px, 3.2vw, 32px);
}

* { -webkit-tap-highlight-color: transparent; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans Bengali', 'Segoe UI', system-ui, sans-serif;
  background: var(--surface);
  color: var(--ink);
  overflow-x: hidden;
  font-size: clamp(.86rem, .82rem + .2vw, .94rem);
  line-height: 1.55;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6, .fw-bold, .fw-semibold { letter-spacing: -.012em; }
.h4, h4 { font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); }
.h5, h5 { font-size: clamp(1rem, .94rem + .4vw, 1.2rem); }
h6, .h6 { font-size: clamp(.9rem, .86rem + .25vw, 1rem); }
a { text-decoration: none; }

/* refined scrollbars (desktop) */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: #CBD3E4; border-radius: 20px; border: 3px solid var(--surface); }
  ::-webkit-scrollbar-thumb:hover { background: #A9B4CE; }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* ----------------------- premium dropdowns (Choices.js) ------------------ */
.choices { margin-bottom: 0; }
.choices__inner {
  background: #fff; border: 1px solid #DDE2EE; border-radius: var(--radius-sm);
  min-height: 44px; padding: 7px 10px; font-size: .9rem;
  transition: border-color .18s, box-shadow .18s;
}
.is-focused .choices__inner, .is-open .choices__inner {
  border-color: var(--saffron-500);
  box-shadow: 0 0 0 .22rem rgba(255, 153, 51, .16);
}
.choices[data-type*=select-one] .choices__inner { padding-bottom: 7px; }
.choices[data-type*=select-one]::after { border-color: var(--ink-soft) transparent transparent; right: 14px; }
.choices__list--dropdown, .choices__list[aria-expanded] {
  border: 1px solid var(--line); border-radius: 12px; margin-top: 6px;
  box-shadow: var(--shadow-md); overflow: hidden; z-index: 1080;
  animation: dropIn .16s ease-out;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } }
.choices__list--dropdown .choices__item, .choices__list[aria-expanded] .choices__item {
  font-size: .88rem; padding: 11px 14px;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background: var(--saffron-50); color: var(--saffron-700);
}
.choices__input { font-size: .88rem; background: transparent; margin-bottom: 0; }
.choices__list--multiple .choices__item {
  background: var(--saffron-500); border: none; border-radius: 8px; font-size: .76rem; padding: 4px 9px;
}

/* bootstrap dropdown menus (row actions, profile) */
.dropdown-menu {
  border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow-md);
  animation: dropIn .16s ease-out; font-size: .88rem;
}
.dropdown-item { border-radius: 8px; padding: 9px 12px; font-weight: 500; }
.dropdown-item:hover { background: var(--saffron-50); color: var(--saffron-700); }
.dropdown-item.text-danger:hover { background: #FDECEA; color: #B3261E !important; }

/* password field with eye toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px !important; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center;
  border: none; background: transparent; color: var(--ink-soft);
  border-radius: 8px; cursor: pointer; transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--saffron-600); background: var(--saffron-50); }
.input-group .pw-wrap { flex: 1 1 auto; display: flex; }
.input-group .pw-wrap input { width: 100%; border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ------------------------------- layout -------------------------------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  transition: margin-left .28s cubic-bezier(.4, 0, .2, 1);
}
.app-content { padding: clamp(16px, 2.4vw, 26px) var(--gutter) 56px; max-width: 1680px; }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-mini); }

/* ------------------------------- sidebar -------------------------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 1045;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  color: #E7ECFF;
  transition: width .28s cubic-bezier(.4, 0, .2, 1), transform .3s cubic-bezier(.4, 0, .2, 1);
}
body.sidebar-collapsed .sidebar { width: var(--sidebar-mini); }
body.sidebar-collapsed .sidebar .nav-label,
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .sidebar-foot { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
body.sidebar-collapsed .side-link { justify-content: center; padding-left: 0; padding-right: 0; }

.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); min-height: var(--topbar-h); padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-badge {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--saffron-500), #F25C05);
  color: #fff; font-size: 19px;
  box-shadow: 0 4px 14px rgba(242, 92, 5, .45);
}
.brand-text { min-width: 0; }
.brand-text .t1 { font-weight: 800; font-size: .95rem; letter-spacing: .3px; line-height: 1.1; white-space: nowrap; }
.brand-text .t2 { font-size: .66rem; color: #9DB0E8; letter-spacing: .8px; text-transform: uppercase; white-space: nowrap; }

.sidebar nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px; }
.sidebar nav::-webkit-scrollbar { width: 0; }
.side-link {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 14px; margin: 2px 0;
  border-radius: 11px;
  color: #C6D2F5; text-decoration: none;
  font-size: .9rem; font-weight: 500;
  position: relative; white-space: nowrap;
  transition: background .18s, color .18s, transform .18s;
}
.side-link i { font-size: 1.1rem; width: 22px; text-align: center; flex: 0 0 22px; }
.side-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-link.active {
  background: linear-gradient(90deg, rgba(255, 153, 51, .22), rgba(255, 153, 51, .05));
  color: #FFD9AE;
}
.side-link.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 4px; background: var(--saffron-500);
  box-shadow: 0 0 12px rgba(255, 153, 51, .8);
}
.sidebar-foot { padding: 14px 18px; font-size: .66rem; color: #8FA3DE; border-top: 1px solid rgba(255,255,255,.08); white-space: nowrap; }

/* ------------------------------- topbar --------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 1035;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--gutter);
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .page-title {
  font-weight: 700; font-size: clamp(.98rem, .9rem + .3vw, 1.12rem); margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.icon-btn {
  width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  color: var(--ink-soft); transition: all .18s;
}
.icon-btn:hover { color: var(--saffron-600); border-color: var(--saffron-100); background: var(--saffron-50); }
.icon-btn:active { transform: scale(.94); }
.sidebar-toggle { flex: 0 0 42px; }
.avatar-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); cursor: pointer;
  transition: box-shadow .18s;
}
.avatar-chip:hover { box-shadow: var(--shadow-sm); }
.avatar-chip .av {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-900));
}

/* -------------------------------- cards --------------------------------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--card); }
.card-body { padding: clamp(14px, 2vw, 20px); }
.card-elevate { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s; }
@media (hover: hover) {
  .card-elevate:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
}

/* responsive auto-grid for stat tiles (complements Bootstrap cols) */
.stat-grid {
  display: grid; gap: clamp(10px, 1.5vw, 16px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 576px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 992px) { .stat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.stat-tile {
  position: relative; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); padding: clamp(14px, 1.6vw, 18px) clamp(14px, 1.8vw, 20px);
  transform-style: preserve-3d; will-change: transform;
  transition: box-shadow .25s;
}
@media (hover: hover) { .stat-tile:hover { box-shadow: var(--shadow-md); } }
.stat-tile .glow {
  position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; opacity: .12; filter: blur(2px);
}
.stat-tile .label { font-size: .72rem; font-weight: 600; letter-spacing: .3px; color: var(--ink-soft); text-transform: uppercase; }
.stat-tile .value { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-tile .delta { font-size: .76rem; color: var(--ink-soft); }
.stat-tile .ico {
  width: clamp(38px, 5vw, 44px); height: clamp(38px, 5vw, 44px); border-radius: 12px;
  display: grid; place-items: center; font-size: 1.2rem; color: #fff; flex: 0 0 auto;
}
.tone-saffron .ico, .tone-saffron .glow { background: linear-gradient(135deg, var(--saffron-500), #F25C05); }
.tone-green   .ico, .tone-green   .glow { background: linear-gradient(135deg, #2FB05A, var(--green-700)); }
.tone-navy    .ico, .tone-navy    .glow { background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); }
.tone-red     .ico, .tone-red     .glow { background: linear-gradient(135deg, #F0564B, #C22518); }
.tone-blue    .ico, .tone-blue    .glow { background: linear-gradient(135deg, #4B83F0, #1D4FD7); }

/* ------------------------------- buttons -------------------------------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-saffron {
  color: #fff; border: none;
  background: linear-gradient(135deg, var(--saffron-500), #F25C05);
  box-shadow: 0 4px 14px rgba(242, 92, 5, .32);
  transition: transform .18s, box-shadow .18s, filter .18s;
}
.btn-saffron:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 8px 20px rgba(242, 92, 5, .4); }
.btn-saffron:active { transform: scale(.97); }
.btn-outline-navy { color: var(--navy-800); border: 1px solid #C9D4F2; background: #fff; }
.btn-outline-navy:hover { background: #EEF2FD; color: var(--navy-900); }

/* generous touch targets on touch devices */
@media (pointer: coarse) {
  .btn-sm { padding: .45rem .8rem; font-size: .85rem; }
  .icon-btn { width: 44px; height: 44px; flex-basis: 44px; }
  .dropdown-item { padding: 12px 14px; }
}

/* --------------------------- filter / toolbar --------------------------- */
/* every filter bar wraps gracefully on small screens */
.toolbar, form.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .form-control, .toolbar .form-select { min-width: 0; }

/* -------------------------------- tables -------------------------------- */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--card);
}
.table { margin: 0; font-size: .88rem; }
.table thead th {
  background: #FBFCFE; color: var(--ink-soft);
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--line); padding: 12px 16px; white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.table tbody td { padding: 12px 16px; vertical-align: middle; border-color: var(--line-soft); }
.table tbody tr { transition: background .15s; }
@media (hover: hover) { .table tbody tr:hover { background: #FAFBFF; } }

/* -------------------------------- badges -------------------------------- */
.badge-soft { display: inline-block; font-weight: 600; font-size: .72rem; padding: .38em .7em; border-radius: 999px; white-space: nowrap; }
.bs-saffron { background: var(--saffron-50); color: var(--saffron-700); }
.bs-green { background: var(--green-50); color: var(--green-700); }
.bs-navy { background: #EDF1FC; color: var(--navy-800); }
.bs-red { background: #FDECEA; color: #B3261E; }
.bs-amber { background: #FEF4E0; color: #9A6700; }
.bs-gray { background: #F0F2F6; color: var(--ink-soft); }

/* status dots */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-pulse { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); }
  70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* ------------------------------ org tree -------------------------------- */
.org-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.org-tree ul { list-style: none; padding-left: 26px; position: relative; margin: 0; }
.org-tree > ul { padding-left: 0; }
.org-tree ul::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 12px; border-left: 2px dashed #D7DEF0; }
.org-node {
  display: inline-flex; align-items: flex-start; gap: 10px;
  margin: 5px 0; padding: 8px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow-xs);
  transition: transform .18s, border-color .18s;
}
@media (hover: hover) { .org-node:hover { transform: translateX(4px); border-color: var(--saffron-100); } }
.org-node .type-ico { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: .85rem; }
.org-node .holder { font-size: .72rem; color: var(--ink-soft); }

/* ------------------------------- timeline ------------------------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--saffron-500), var(--navy-700)); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 18px 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -24px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 3px solid var(--saffron-500);
  box-shadow: 0 0 0 3px var(--saffron-50);
}
.tl-item .tl-time { font-size: .72rem; color: var(--ink-soft); }

/* ------------------------------ skeletons ------------------------------- */
.skeleton { background: linear-gradient(90deg, #EEF1F6 25%, #F7F9FC 50%, #EEF1F6 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------ auth page ------------------------------- */
.auth-wrap {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: clamp(16px, 5vw, 24px);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255, 153, 51, .18), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(30, 142, 62, .14), transparent 60%),
    linear-gradient(180deg, #101E4B 0%, var(--navy-900) 100%);
}
.auth-card {
  width: min(430px, 100%);
  background: rgba(255, 255, 255, .98);
  border-radius: 22px; padding: clamp(26px, 6vw, 38px) clamp(22px, 5vw, 34px);
  box-shadow: 0 30px 80px rgba(6, 12, 40, .5);
  animation: rise .6s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes rise { from { opacity: 0; transform: translateY(26px) scale(.97); } }
.auth-logo {
  width: 62px; height: 62px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 30px; color: #fff;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--saffron-500), #F25C05);
  box-shadow: 0 10px 26px rgba(242, 92, 5, .45);
  animation: floaty 3.4s ease-in-out infinite;
}
@keyframes floaty { 50% { transform: translateY(-6px) rotate(-2deg); } }

/* ---------------------------- form elements ----------------------------- */
.form-control, .form-select {
  border-radius: var(--radius-sm); border-color: #DDE2EE; padding: .6rem .9rem; font-size: .9rem;
  transition: border-color .18s, box-shadow .18s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--saffron-500);
  box-shadow: 0 0 0 .22rem rgba(255, 153, 51, .16);
}
/* premium native select arrow (for data-plain selects) */
.form-select { background-position: right .85rem center; }
.form-label { font-size: .74rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; margin-bottom: .3rem; }
.form-control::placeholder { color: #AAB2C4; }
/* keep iOS from zooming on focus: inputs >= 16px on small screens */
@media (max-width: 575.98px) {
  .form-control, .form-select, .choices__inner { font-size: 16px; }
}

/* ------------------------------ pagination ------------------------------ */
.page-link { border-radius: 8px !important; margin: 0 3px; border: 1px solid var(--line); color: var(--ink); font-size: .85rem; }
.page-item.active .page-link { background: var(--saffron-500); border-color: var(--saffron-500); }

/* ----------------------------- empty states ----------------------------- */
.empty-state { text-align: center; padding: clamp(30px, 6vw, 46px) 18px; color: var(--ink-soft); }
.empty-state i { font-size: clamp(34px, 8vw, 42px); opacity: .35; display: block; margin-bottom: 10px; }

/* -------------------------------- modals -------------------------------- */
.modal-content {
  border: none; border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: visible; /* let Choices dropdowns escape the modal body */
}
.modal-header { border-bottom: 1px solid var(--line-soft); border-radius: 18px 18px 0 0; padding: 16px 20px; }
.modal-body { padding: 18px 20px; }
.modal-footer { border-top: 1px solid var(--line-soft); padding: 14px 20px; border-radius: 0 0 18px 18px; }
/* full-height sheet on phones */
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down .modal-content { border-radius: 0; min-height: 100dvh; }
  .modal-fullscreen-sm-down .modal-header,
  .modal-fullscreen-sm-down .modal-footer { border-radius: 0; }
  .modal-footer .btn { flex: 1 1 auto; }
}

/* ------------------------------ responsive ------------------------------ */
/* laptop and below: sidebar becomes an off-canvas drawer */
@media (max-width: 1199.98px) {
  .app-main { margin-left: 0 !important; }
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 30px 0 60px rgba(6, 12, 40, .35); }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 1040;
    background: rgba(10, 16, 40, .5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }
}
/* on wide desktops keep the sidebar pinned and disable the collapse jump */
@media (min-width: 1200px) {
  .sidebar-backdrop { display: none; }
}

/* tablets and phones: dense tables collapse to cards (NFR-01) */
@media (max-width: 991.98px) {
  .table-collapse thead { display: none; }
  .table-collapse tbody, .table-collapse tr, .table-collapse td { display: block; width: 100%; }
  .table-collapse tbody tr {
    border: 1px solid var(--line); border-radius: 14px;
    margin: 0 0 12px; background: #fff; box-shadow: var(--shadow-xs); overflow: hidden;
  }
  .table-collapse tbody td {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 6px 14px; min-width: 0;
    border: none; border-bottom: 1px solid var(--line-soft); padding: 11px 14px; text-align: right;
  }
  .table-collapse tbody td:last-child { border-bottom: none; }
  .table-collapse tbody td::before {
    content: attr(data-th);
    font-size: .68rem; font-weight: 700; color: var(--ink-soft);
    text-transform: uppercase; letter-spacing: .4px; text-align: left; flex: 0 0 auto;
  }
  /* value content must never push the card wider than the screen */
  .table-collapse tbody td > * { max-width: 100%; }
  .table-collapse .badge-soft { white-space: normal; text-align: left; }
  .table-collapse td .text-truncate { max-width: 60vw !important; }
  /* action cells: let buttons sit on the right, wrap if needed */
  .table-collapse tbody td .dropdown,
  .table-collapse tbody td form { display: inline-flex; }
  .table-wrap:has(.table-collapse) { border: none; background: transparent; overflow: visible; }
}

/* small phones: tighten spacing, stack toolbar controls full-width */
@media (max-width: 575.98px) {
  .app-content { padding-bottom: 40px; }
  .toolbar > .form-control, .toolbar > .form-select { flex: 1 1 100%; }
  .toolbar > .btn { flex: 1 1 auto; }
  .card-body { padding: 15px; }
  .badge-soft { font-size: .68rem; }
}

/* --------------------------- reduced motion ----------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
