/* WorkNexa admin theme — Bootstrap 5.3 + design tokens. Themes via <html data-theme="..."> */
:root {
  --wn-primary: #4f46e5;
  --wn-primary-rgb: 79, 70, 229;
  --wn-primary-hover: #4338ca;
  --wn-ink: #172033;
  --wn-muted: #667085;
  --wn-label: #475467;
  --wn-bg: #f3f5f9;
  --wn-surface: #ffffff;
  --wn-surface-2: #f8f9fc;
  --wn-hover: #f6f7fe;
  --wn-soft: #eef0ff;
  --wn-line: #e3e7ef;
  --wn-input-line: #d5dbe6;
  --wn-top-bg: rgba(255,255,255,.92);
  --wn-side: #111827;
  --wn-side-ink: #b7c1d6;
  --wn-side-sec: #6b7a99;
  --wn-success: #0f9d58;
  --wn-danger: #d93025;
  --wn-warn: #f29900;
  --wn-radius: .85rem;
  --wn-shadow: 0 1px 2px rgba(16,24,40,.04);
  --wn-brand-logo: linear-gradient(135deg, #6366f1, #22c1a4);
  --wn-kbd-bg: #e9edf5; --wn-kbd-ink: #34405a; --wn-kbd-line: #d3d9e6;
  --wn-tabbar-h: 60px;

  --bs-primary: var(--wn-primary);
  --bs-primary-rgb: var(--wn-primary-rgb);
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-font-size: .875rem;
  --bs-body-color: var(--wn-ink);
  --bs-body-bg: var(--wn-bg);
  --bs-border-color: var(--wn-line);
  --bs-link-color: var(--wn-primary); --bs-link-color-rgb: var(--wn-primary-rgb);
  --bs-link-hover-color: var(--wn-primary-hover); --bs-link-hover-color-rgb: var(--wn-primary-rgb);
}

body { background: var(--wn-bg); }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--wn-primary); --bs-btn-border-color: var(--wn-primary); --bs-btn-hover-bg: var(--wn-primary-hover); --bs-btn-hover-border-color: var(--wn-primary-hover); --bs-btn-active-bg: var(--wn-primary-hover); --bs-btn-active-border-color: var(--wn-primary-hover); --bs-btn-disabled-bg: var(--wn-primary); --bs-btn-disabled-border-color: var(--wn-primary); }
.btn-outline-primary { --bs-btn-color: var(--wn-primary); --bs-btn-border-color: var(--wn-primary); --bs-btn-hover-bg: var(--wn-primary); --bs-btn-hover-border-color: var(--wn-primary); --bs-btn-active-bg: var(--wn-primary); --bs-btn-active-border-color: var(--wn-primary); }
.text-primary { color: var(--wn-primary) !important; }
.bg-primary { background: var(--wn-primary) !important; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fw-600 { font-weight: 600; }
.small-muted { color: var(--wn-muted); font-size: .78rem; }
.min-w-0 { min-width: 0; }
kbd { background: var(--wn-kbd-bg); color: var(--wn-kbd-ink); border: 1px solid var(--wn-kbd-line); box-shadow: none; font-size: .7rem; padding: .05rem .3rem; }

/* ---- Shell */
.wn-shell { display: flex; min-height: 100vh; }
.wn-side {
  width: 240px; flex: 0 0 240px; background: var(--wn-side); color: var(--wn-side-ink);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; transition: margin-left .2s ease;
}
.wn-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem .8rem; color: #fff; font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; }
.wn-brand:hover { color: #fff; }
.wn-brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--wn-brand-logo); display: grid; place-items: center; font-size: 1rem; color: #fff; }
.wn-company { margin: 0 .8rem .6rem; padding: .55rem .7rem; border-radius: .6rem; background: rgba(255,255,255,.06); font-size: .76rem; line-height: 1.35; }
.wn-company b { color: #fff; display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wn-nav { list-style: none; margin: 0; padding: 0 .6rem 1.5rem; }
.wn-nav .sec { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--wn-side-sec); padding: .9rem .6rem .35rem; }
.wn-nav a { display: flex; align-items: center; gap: .6rem; padding: .42rem .6rem; border-radius: .5rem; color: var(--wn-side-ink); font-size: .83rem; }
.wn-nav a i { font-size: 1rem; opacity: .85; width: 1.1rem; text-align: center; }
.wn-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.wn-nav a.active { background: var(--wn-primary); color: #fff; }
.wn-nav a kbd, .wn-nav a .count { margin-left: auto; background: rgba(255,255,255,.08); color: #9aa7c2; border: 0; }
.wn-nav a .count { font-size: .68rem; padding: .05rem .4rem; border-radius: 1rem; background: var(--wn-warn); color: #fff; font-weight: 700; }
.wn-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wn-top {
  position: sticky; top: 0; z-index: 1020; background: var(--wn-top-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--wn-line); display: flex; align-items: center; gap: .75rem; padding: .55rem 1.25rem; min-height: 56px;
}
.wn-top h1 { font-size: 1.05rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wn-content { padding: 1.25rem; flex: 1; }
.wn-foot { padding: .6rem 1.25rem; color: var(--wn-muted); font-size: .75rem; border-top: 1px solid var(--wn-line); background: var(--wn-surface); }
body.side-collapsed .wn-side { margin-left: -240px; }
.wn-side-close { position: absolute; top: 1.2rem; right: 1rem; opacity: .75; }

/* Phone tab bar (hidden from lg up by .d-lg-none) */
.wn-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex;
  background: var(--wn-surface); border-top: 1px solid var(--wn-line); box-shadow: 0 -4px 16px rgba(16,24,40,.06);
  padding-bottom: env(safe-area-inset-bottom);
}
.wn-tabbar > a, .wn-tabbar > button {
  flex: 1 1 0; min-width: 0; height: var(--wn-tabbar-h); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--wn-muted); font-size: .7rem; font-weight: 600;
}
.wn-tabbar i { font-size: 1.3rem; line-height: 1; }
.wn-tabbar > a.active { color: var(--wn-primary); }
.wn-tabbar > a.active::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--wn-primary); }
.wn-tabbar .count { position: absolute; top: 6px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--wn-danger); color: #fff; font-size: .65rem; line-height: 18px; text-align: center; }
.wn-tabbar .count.dot { min-width: 9px; width: 9px; height: 9px; padding: 0; top: 9px; left: calc(50% + 8px); }

@media (max-width: 991.98px) {
  .wn-side {
    position: fixed; z-index: 1045; left: 0; top: 0; width: min(290px, 86vw); flex-basis: auto; margin-left: 0;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  body.side-collapsed .wn-side { margin-left: 0; }
  body.side-open .wn-side { transform: none; }
  body.side-open { overflow: hidden; }
  body.side-open::before { content: ''; position: fixed; inset: 0; z-index: 1044; background: rgba(15, 23, 42, .5); }
  .wn-nav a { padding: .62rem .7rem; font-size: .92rem; }
  .wn-nav a kbd, .wn-top kbd, .quick-tile kbd, .modal-footer .hint { display: none; }
  /* Room for the tab bar and the floating add button */
  .wn-content { padding: .85rem .85rem calc(var(--wn-tabbar-h) + 5.5rem + env(safe-area-inset-bottom)); }
  /* No backdrop-filter here: it would trap the fixed add button inside the header */
  .wn-top { padding: .5rem .85rem; backdrop-filter: none; background: var(--wn-surface); }
}

/* ---- Cards & stats */
.card { --bs-card-bg: var(--wn-surface); border: 1px solid var(--wn-line); border-radius: var(--wn-radius); box-shadow: var(--wn-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--wn-line); font-weight: 600; padding: .75rem 1rem; }
.stat { padding: 1rem 1.1rem; display: flex; flex-direction: row; gap: .9rem; align-items: center; transition: .15s; }
a.stat:hover { border-color: var(--wn-primary); box-shadow: 0 4px 14px rgba(var(--wn-primary-rgb), .1); }
.stat .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex: 0 0 44px; }
.stat .v { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat .l { color: var(--wn-muted); font-size: .78rem; }
.ic-blue { background: #e8edff; color: #4f46e5; } .ic-green { background: #e3f6ec; color: #0f9d58; }
.ic-amber { background: #fff3dc; color: #c77700; } .ic-red { background: #fde7e5; color: #c5221f; }
.ic-violet { background: #efe9ff; color: #6d28d9; } .ic-teal { background: #dff7f3; color: #0f766e; }
.ic-slate { background: #eef1f6; color: #475569; }
.quick-tile { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .9rem .5rem; border-radius: .75rem; border: 1px solid var(--wn-line); background: var(--wn-surface); color: var(--wn-ink); font-weight: 600; font-size: .8rem; transition: .15s; text-align: center; height: 100%; }
.quick-tile i { font-size: 1.35rem; color: var(--wn-primary); }
.quick-tile kbd { font-weight: 500; }
.quick-tile:hover { border-color: var(--wn-primary); box-shadow: 0 4px 14px rgba(var(--wn-primary-rgb), .12); transform: translateY(-1px); color: var(--wn-ink); }
.bar-track { height: 8px; border-radius: 6px; background: var(--wn-surface-2); overflow: hidden; display: flex; }
.bar-track span { display: block; height: 100%; }

/* ---- Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .55rem .7rem; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--wn-muted); font-weight: 600; background: var(--wn-surface-2); border-bottom: 1px solid var(--wn-line); white-space: nowrap; }
.table-hover tbody tr:hover { background: var(--wn-hover); }
.table tr.grp td { background: var(--wn-surface-2); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--wn-muted); }
tr[data-href], tr[data-edit-row] { cursor: pointer; }
.table tr.row-focus > td { background: var(--wn-soft) !important; }
.table tr.row-focus > td:first-child { box-shadow: inset 3px 0 0 var(--wn-primary); }

/* DataTables blended into the card + filter bar */
div.dt-container { font-size: .86rem; }
div.dt-container .dt-layout-row.dt-layout-table { margin: 0; }
div.dt-container .dt-layout-row:not(.dt-layout-table) { padding: .6rem .9rem; border-top: 1px solid var(--wn-line); margin: 0; }
div.dt-container .dt-info { color: var(--wn-muted); font-size: .78rem; }
div.dt-container .dt-paging .page-link { border-radius: .4rem; margin: 0 2px; font-size: .78rem; }
div.dt-container .dt-paging .page-item.active .page-link { background: var(--wn-primary); border-color: var(--wn-primary); }
div.dt-container table.dataTable { margin: 0 !important; }
div.dt-processing { border-radius: .6rem; box-shadow: 0 8px 24px rgba(16,24,40,.12); }
table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order, table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order { opacity: .5; }

/* ---- Forms */
.form-control, .form-select { border-color: var(--wn-input-line); border-radius: .5rem; font-size: .86rem; }
.form-control:focus, .form-select:focus, .btn:focus-visible { border-color: var(--wn-primary); box-shadow: 0 0 0 .2rem rgba(var(--wn-primary-rgb), .18); }
.form-check-input:checked { background-color: var(--wn-primary); border-color: var(--wn-primary); }
.form-label { font-weight: 600; font-size: .76rem; color: var(--wn-label); margin-bottom: .25rem; }
.form-control-sm, .form-select-sm { font-size: .82rem; }
.req::after { content: ' *'; color: var(--wn-danger); }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filter-bar .form-control, .filter-bar .form-select, .filter-bar .wn-combo { width: auto; min-width: 150px; }
.filter-bar .grow { flex: 1 1 220px; }
.filter-bar .grow .form-control { width: 100%; }
.form-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--wn-muted); font-weight: 700; margin: .25rem 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--wn-line); }
.modal-content { border: 0; border-radius: var(--wn-radius); box-shadow: 0 20px 60px rgba(16,24,40,.18); }
.modal-header { border-bottom: 1px solid var(--wn-line); padding: .85rem 1.1rem; }
.modal-footer { border-top: 1px solid var(--wn-line); background: var(--wn-surface-2); border-radius: 0 0 var(--wn-radius) var(--wn-radius); }
.modal-footer .hint { margin-right: auto; color: var(--wn-muted); font-size: .74rem; }

/* ---- Searchable select (combobox) with inline create */
.wn-combo { position: relative; }
.wn-combo .form-control { padding-right: 2rem; cursor: text; }
.wn-combo::after { content: '\F282'; font-family: 'bootstrap-icons'; position: absolute; right: .65rem; top: 50%; transform: translateY(-50%); color: var(--wn-muted); font-size: .7rem; pointer-events: none; }
.wn-combo .form-control.is-picked { background: var(--wn-soft); }
.ac-list {
  position: fixed; z-index: 1080; width: max-content; max-width: min(520px, 92vw);
  max-height: 300px; overflow-y: auto; background: var(--wn-surface); border: 1px solid var(--wn-input-line); border-radius: .6rem;
  box-shadow: 0 12px 32px rgba(16,24,40,.16); padding: .25rem;
}
.ac-item { padding: .42rem .6rem; border-radius: .4rem; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; font-size: .84rem; }
.ac-item .sub { color: var(--wn-muted); font-size: .74rem; white-space: nowrap; }
.ac-item mark { background: transparent; color: var(--wn-primary); padding: 0; font-weight: 700; }
.ac-item.active, .ac-item:hover { background: var(--wn-soft); }
.ac-item.selected::before { content: '\F26E'; font-family: 'bootstrap-icons'; color: var(--wn-primary); margin-right: .2rem; }
.ac-item.create { color: var(--wn-primary); font-weight: 600; border-top: 1px dashed var(--wn-line); margin-top: .2rem; }
.ac-empty { padding: .5rem .6rem; color: var(--wn-muted); font-size: .8rem; }

/* ---- Badges & misc */
.badge-soft { font-weight: 600; padding: .3em .55em; border-radius: .4rem; font-size: .74rem; background: var(--wn-soft); color: var(--wn-ink); }
.badge-soft.success { background: #e3f6ec; color: #0b7a44; }
.badge-soft.warning { background: #fff3dc; color: #a55f00; }
.badge-soft.danger  { background: #fde7e5; color: #b3261e; }
.badge-soft.primary { background: var(--wn-soft); color: var(--wn-primary); }
.badge-soft.muted   { background: #eef1f6; color: #475569; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.toast-container { z-index: 1090; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--wn-muted); }
.empty-state i { font-size: 2.4rem; color: #c3cad8; display: block; margin-bottom: .5rem; }
.wn-log { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: .9rem 1rem; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; max-height: 260px; overflow: auto; }
.perm-matrix th, .perm-matrix td { text-align: center; vertical-align: middle; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--wn-soft); color: var(--wn-primary); display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; flex: 0 0 32px; }

/* ---- Password field with show / hide eye (WN.passwordToggles) */
.wn-pass { position: relative; }
.wn-pass > .form-control { padding-right: 2.9rem; }
.wn-pass > .form-control.is-invalid { padding-right: 5rem; background-position: right 2.9rem center; }
.wn-pass > .pass-eye {
  position: absolute; top: 0; right: 0; width: 2.9rem; height: 100%; display: grid; place-items: center;
  border: 0; background: none; color: var(--wn-muted); font-size: 1.1rem; border-radius: 0 .5rem .5rem 0;
}
.wn-pass > .pass-eye:hover, .wn-pass > .pass-eye[aria-pressed=true] { color: var(--wn-primary); }
.wn-pass > .pass-eye:focus-visible { outline: 2px solid var(--wn-primary); outline-offset: -2px; }
.wn-pass input::-ms-reveal, .wn-pass input::-ms-clear { display: none; } /* Edge's own eye, so there is only one */

/* ---- Auth */
.auth-bg { min-height: 100vh; background: radial-gradient(1000px 500px at 10% -10%, #d9dcff 0, transparent 60%), radial-gradient(800px 500px at 110% 110%, #c9f3ea 0, transparent 60%), #f3f6fb; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 430px; border-radius: 1.2rem; box-shadow: 0 20px 60px rgba(16,24,40,.12); border: 0; }
.auth-card .logo { width: 44px; height: 44px; border-radius: 12px; background: var(--wn-brand-logo); display: grid; place-items: center; color: #fff; font-size: 1.3rem; }

/* ---- Theme picker */
.theme-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem; }
.theme-pick label { cursor: pointer; border: 2px solid var(--wn-line); border-radius: .8rem; padding: .5rem; background: var(--wn-surface); transition: .15s; display: block; }
.theme-pick input { position: absolute; opacity: 0; }
.theme-pick input:checked + label { border-color: var(--wn-primary); box-shadow: 0 0 0 .2rem rgba(var(--wn-primary-rgb), .18); }
.theme-pick input:focus-visible + label { outline: 2px solid var(--wn-primary); outline-offset: 2px; }
.theme-pick .sw { display: flex; height: 86px; border-radius: .5rem; overflow: hidden; border: 1px solid rgba(0,0,0,.08); }
.theme-pick .sw .s { width: 30%; }
.theme-pick .sw .m { flex: 1; padding: .45rem; display: flex; flex-direction: column; gap: .3rem; }
.theme-pick .sw .m i { display: block; height: 10px; border-radius: 3px; }
.theme-pick .sw .m b { display: block; height: 22px; border-radius: 4px; }
.theme-pick .nm { font-weight: 700; margin-top: .45rem; font-size: .88rem; }
.theme-pick .ds { color: var(--wn-muted); font-size: .74rem; }

/* ---- Dashboard "needs your attention" */
.todo-list a { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; color: var(--wn-ink); border-top: 1px solid var(--wn-line); }
.todo-list a:first-child { border-top: 0; }
.todo-list a:hover { background: var(--wn-hover); }
.todo-list .n { min-width: 2.1rem; height: 2.1rem; padding: 0 .45rem; border-radius: .6rem; display: grid; place-items: center; font-weight: 700; }
.todo-list .t { flex: 1; min-width: 0; line-height: 1.3; }
.todo-list .t small { display: block; color: var(--wn-muted); }
.todo-list .go { color: var(--wn-primary); font-weight: 600; font-size: .8rem; white-space: nowrap; }

/* Wide DataTables scroll inside their card (tablets, small laptops) */
div.dt-container .dt-layout-table > div { overflow-x: auto; }

/* ---- Tables become cards on phones (WN.cards labels the cells) */
@media (max-width: 767.98px) {
  table.wn-cards, table.wn-cards > tbody { display: block; width: 100% !important; }
  table.wn-cards > thead { display: none; }
  table.wn-cards > tbody > tr { display: block; padding: .75rem .9rem; border-bottom: 1px solid var(--wn-line); }
  table.wn-cards > tbody > tr:last-child { border-bottom: 0; }
  table.wn-cards > tbody > tr > td { display: block; border: 0; padding: .18rem 0 !important; text-align: right; white-space: normal; }
  table.wn-cards > tbody > tr > td::after { content: ''; display: table; clear: both; }
  table.wn-cards > tbody > tr > td[data-label]:not([data-label=""])::before {
    content: attr(data-label); float: left; margin-right: .75rem; color: var(--wn-muted);
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; line-height: 1.9;
  }
  table.wn-cards > tbody > tr > td.cell-title { text-align: left; padding-bottom: .45rem !important; }
  table.wn-cards > tbody > tr > td.cell-title::before, table.wn-cards > tbody > tr > td.cell-actions::before { display: none; }
  table.wn-cards > tbody > tr > td.cell-actions { margin-top: .35rem; padding-top: .55rem !important; border-top: 1px dashed var(--wn-line); }
  table.wn-cards > tbody > tr > td.is-empty { display: none; }
  table.wn-cards > tbody > tr > td.dt-empty { text-align: center; }
}

/* ---- Phones */
@media (max-width: 575.98px) {
  .wn-top { gap: .5rem; min-height: 54px; }
  .wn-top h1 { font-size: 1rem; }
  .wn-top .ms-auto { gap: .35rem !important; }
  /* Header actions become icon buttons … */
  .wn-top .ms-auto > .btn:not([data-hotkey-add]) { font-size: 0; gap: 0; width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
  .wn-top .ms-auto > .btn:not([data-hotkey-add]) i { font-size: 1.05rem; }
  .wn-top .ms-auto > .dropdown > .btn { height: 38px; }
  /* … and the page's main "New …" action floats above the tab bar, under the thumb */
  .wn-top [data-hotkey-add] {
    position: fixed; right: 1rem; bottom: calc(var(--wn-tabbar-h) + 1rem + env(safe-area-inset-bottom)); z-index: 1031;
    display: inline-flex; align-items: center; gap: .4rem; padding: .7rem 1.15rem; border-radius: 2rem;
    font-size: .92rem; font-weight: 600; box-shadow: 0 8px 22px rgba(var(--wn-primary-rgb), .38);
  }
  .wn-top [data-hotkey-add] i { font-size: 1.1rem; }

  /* 16 px stops phones zooming into a field on focus; taller controls are easier to tap */
  .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px; }
  .form-control-sm, .form-select-sm { min-height: 38px; }
  .btn-sm { min-height: 34px; }

  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-bar > * { min-width: 0; }
  .filter-bar > .grow, .filter-bar > :only-child, .filter-bar > :has(.btn-group) { grid-column: 1 / -1; }
  .filter-bar .btn-group { display: flex; width: 100%; }
  .filter-bar .btn-group > .btn { flex: 1 1 0; }
  .filter-bar .form-control, .filter-bar .form-select, .filter-bar .wn-combo { width: 100%; min-width: 0; }

  .stat { padding: .75rem .8rem; gap: .65rem; }
  .stat .ic { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; font-size: 1.05rem; }
  .stat .v { font-size: 1.12rem; }
  .stat .l { font-size: .74rem; line-height: 1.25; }
  .stat-compact .stat { flex-direction: column; align-items: flex-start; gap: .4rem; padding: .65rem .7rem; }
  .stat-compact .stat .ic { width: 30px; height: 30px; flex-basis: auto; font-size: .95rem; }

  /* Big forms open full screen */
  .modal-dialog.modal-lg, .modal-dialog.modal-xl { width: 100%; max-width: none; height: 100%; min-height: 100%; margin: 0; }
  .modal-dialog.modal-lg > .modal-content, .modal-dialog.modal-xl > .modal-content { min-height: 100%; border-radius: 0; }
  .modal-dialog.modal-lg .modal-footer, .modal-dialog.modal-xl .modal-footer { position: sticky; bottom: 0; border-radius: 0; }
  .card-header { padding: .65rem .85rem; }
}

@media print {
  .wn-side, .wn-top, .wn-foot, .no-print { display: none !important; }
  .wn-content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; }
}

/* =====================================================================
   Themes (Settings → Appearance). "modern" = :root defaults above.
   ===================================================================== */
html[data-theme=classic] {
  --wn-primary: #1a6e75; --wn-primary-rgb: 26, 110, 117; --wn-primary-hover: #135459;
  --wn-ink: #1f2a2e; --wn-muted: #6b6a5f; --wn-label: #4b4a40;
  --wn-bg: #f4f1e8; --wn-surface: #fffdf7; --wn-surface-2: #efe9d8; --wn-hover: #f7f1de; --wn-soft: #fde9a4;
  --wn-line: #ddd5bf; --wn-input-line: #cbbf9f; --wn-top-bg: rgba(255,253,247,.96);
  --wn-side: #16474d; --wn-side-ink: #cfe3e2; --wn-side-sec: #8fb3b1;
  --wn-radius: .3rem; --wn-shadow: none;
  --wn-kbd-bg: #f1ead3; --wn-kbd-ink: #4b4a40; --wn-kbd-line: #d8cca8;
  --wn-brand-logo: linear-gradient(135deg, #f5b700, #1a6e75);
}
html[data-theme=classic] .form-control, html[data-theme=classic] .form-select, html[data-theme=classic] .btn { border-radius: .2rem; }
html[data-theme=classic] .wn-top h1 { color: var(--wn-primary); }

html[data-theme=stunning] {
  --wn-primary: #6d28d9; --wn-primary-rgb: 109, 40, 217; --wn-primary-hover: #5b21b6;
  --wn-ink: #1e1537; --wn-muted: #6f6790; --wn-label: #4c4470;
  --wn-bg: #f6f4fe; --wn-surface-2: #f7f5ff; --wn-hover: #f8f5ff; --wn-soft: #efe9ff;
  --wn-line: #e7e3f8; --wn-input-line: #d8d1f3; --wn-top-bg: rgba(255,255,255,.8);
  --wn-side: linear-gradient(180deg, #1e1b4b 0%, #3b0764 65%, #581c87 100%); --wn-side-ink: #d7cffc; --wn-side-sec: #a597e0;
  --wn-radius: 1.1rem; --wn-shadow: 0 8px 24px rgba(109,40,217,.07);
  --wn-kbd-bg: #efe9ff; --wn-kbd-ink: #4c1d95; --wn-kbd-line: #ddd0fb;
  --wn-brand-logo: linear-gradient(135deg, #f472b6, #8b5cf6);
}
html[data-theme=stunning] body { background: radial-gradient(900px 420px at 100% -10%, #f3e8ff 0, transparent 60%), radial-gradient(700px 400px at -10% 110%, #fce7f3 0, transparent 60%), var(--wn-bg) fixed; }
html[data-theme=stunning] .btn-primary { background-image: linear-gradient(135deg, #7c3aed, #db2777); border-color: transparent; box-shadow: 0 6px 16px rgba(124,58,237,.25); }
html[data-theme=stunning] .wn-nav a.active { background: linear-gradient(135deg, #7c3aed, #db2777); box-shadow: 0 6px 16px rgba(219,39,119,.25); }
html[data-theme=stunning] .card:hover { box-shadow: 0 12px 32px rgba(109,40,217,.1); }

html[data-theme=emerald] {
  --wn-primary: #0f8a5f; --wn-primary-rgb: 15, 138, 95; --wn-primary-hover: #0b6e4b;
  --wn-bg: #f1f7f4; --wn-surface-2: #f5faf7; --wn-hover: #f3faf6; --wn-soft: #dff5ea;
  --wn-line: #dde9e3; --wn-input-line: #cbdcd3;
  --wn-side: #0b2e24; --wn-side-ink: #b9d8cc; --wn-side-sec: #6f9f8e;
  --wn-kbd-bg: #e3f1ea; --wn-kbd-ink: #24473a; --wn-kbd-line: #c9dfd4;
  --wn-brand-logo: linear-gradient(135deg, #34d399, #0ea5e9);
}

html[data-theme=dark] {
  color-scheme: dark;
  --wn-primary: #7c83ff; --wn-primary-rgb: 124, 131, 255; --wn-primary-hover: #6970f0;
  --wn-ink: #e6e9ef; --wn-muted: #8b93a4; --wn-label: #aab2c2;
  --wn-bg: #050506; --wn-surface: #121317; --wn-surface-2: #191b21; --wn-hover: #1a1c23; --wn-soft: #1f2347;
  --wn-line: #24272f; --wn-input-line: #333845; --wn-top-bg: rgba(10,10,12,.88);
  --wn-side: #000000; --wn-side-ink: #a3abbb; --wn-side-sec: #5d6576;
  --wn-success: #34c77b; --wn-danger: #f26b61; --wn-warn: #f5b340;
  --wn-shadow: none;
  --wn-kbd-bg: #22252d; --wn-kbd-ink: #c8cfdb; --wn-kbd-line: #333845;
  --bs-body-bg: var(--wn-surface); --bs-secondary-bg: #1b1d22; --bs-tertiary-bg: #16181d; --bs-emphasis-color: #f4f6fa;
  --bs-secondary-color: var(--wn-muted);
}
html[data-theme=dark] body { background: var(--wn-bg); }
html[data-theme=dark] .btn-light { --bs-btn-bg: #1b1d23; --bs-btn-color: var(--wn-ink); --bs-btn-border-color: var(--wn-input-line); --bs-btn-hover-bg: #23262e; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #3a3f4c; --bs-btn-active-bg: #2a2e38; --bs-btn-active-color: #fff; }
html[data-theme=dark] .ic-blue { background: rgba(124,131,255,.16); color: #a5abff; } html[data-theme=dark] .ic-green { background: rgba(52,199,123,.15); color: #5fd699; }
html[data-theme=dark] .ic-amber { background: rgba(245,179,64,.15); color: #f5b340; } html[data-theme=dark] .ic-red { background: rgba(242,107,97,.15); color: #f58a82; }
html[data-theme=dark] .ic-violet { background: rgba(167,139,250,.15); color: #b9a4fb; } html[data-theme=dark] .ic-teal { background: rgba(45,212,191,.14); color: #5eead4; }
html[data-theme=dark] .ic-slate { background: rgba(148,163,184,.14); color: #cbd5e1; }
html[data-theme=dark] .badge-soft.success { background: rgba(52,199,123,.15); color: #5fd699; }
html[data-theme=dark] .badge-soft.warning { background: rgba(245,179,64,.15); color: #f5b340; }
html[data-theme=dark] .badge-soft.danger { background: rgba(242,107,97,.15); color: #f58a82; }
html[data-theme=dark] .badge-soft.muted { background: #22252d; color: #aab2c2; }
html[data-theme=dark] .empty-state i { color: #4a505e; }
html[data-theme=dark] .form-control::placeholder { color: #5d6576; }
html[data-theme=dark] .wn-company { background: rgba(255,255,255,.05); }

/* Admin panel opened inside the WorkNexa app: no "download the app" or print buttons. */
body.in-app .no-app { display: none !important; }
