/* HRIS design system (WP17, docs/UI.md). One first-party stylesheet: tokens, base elements, app shell, components,
   dark theme, print. No web fonts, no third-party CSS. Colours are custom properties; every text pair is >= 4.5:1
   (table in docs/UI.md). Old page markup (.card, .msg, bare <table>, form.as_p) is styled by the base layer. */

/* ------------------------------------------------------------------ 1. tokens (light, the default) */
:root {
  color-scheme: light;
  --c-bg: #f4f6f8;
  --c-surface: #ffffff;
  --c-surface-2: #f0f3f6;
  --c-surface-hover: #f6f8fa;
  --c-border: #dfe4ea;
  --c-border-strong: #c3cbd4;
  --c-input-border: #7d8896;
  --c-text: #16202b;
  --c-text-muted: #56616f;
  --c-text-subtle: #69737f;
  --c-accent: #0d6b52;
  --c-accent-hover: #0a5743;
  --c-accent-soft: #e2f1eb;
  --c-accent-text: #0a5743;
  --c-on-accent: #ffffff;
  --c-focus: #0d6b52;
  --c-success: #11693f;
  --c-success-soft: #e3f3e9;
  --c-warning: #8a4b00;
  --c-warning-soft: #fdf0d5;
  --c-danger: #b3261e;
  --c-danger-hover: #93201a;
  --c-danger-soft: #fcebe9;
  --c-info: #1c58a0;
  --c-info-soft: #e7effa;
  --c-neutral: #4a5563;
  --c-neutral-soft: #edf0f3;
  --c-backdrop: rgba(14, 19, 24, 0.45);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Bengali",
    "Hind Siliguri", "Kohinoor Bangla", "Nirmala UI", sans-serif;
  --font-bn: "Noto Sans Bengali", "Hind Siliguri", "Kohinoor Bangla", "Nirmala UI", "Vrinda", system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  /* type scale: 12 / 13 / 15 (base) / 17 / 20 / 24 / 30 */
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --lh-base: 1.55;
  --lh-tight: 1.25;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* spacing (4px grid) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.06);

  --z-sticky: 10;
  --z-topbar: 30;
  --z-dropdown: 40;
  --z-drawer: 50;
  --z-skip: 100;

  --topbar-h: 60px;
  --sidebar-w: 256px;
  --content-max: 1240px;
  --touch: 44px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ------------------------------------------------------------------ 1b. dark theme: OS preference, or the manual toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --c-bg: #0e1318;
    --c-surface: #151b22;
    --c-surface-2: #1b232c;
    --c-surface-hover: #1a2129;
    --c-border: #2a333d;
    --c-border-strong: #3a4450;
    --c-input-border: #6b7683;
    --c-text: #e5e9ee;
    --c-text-muted: #a1acb8;
    --c-text-subtle: #8d98a5;
    --c-accent: #4cc59a;
    --c-accent-hover: #6fd3ae;
    --c-accent-soft: #12352b;
    --c-accent-text: #6fd3ae;
    --c-on-accent: #04241a;
    --c-focus: #6fd3ae;
    --c-success: #5fd08f;
    --c-success-soft: #123222;
    --c-warning: #f0b55a;
    --c-warning-soft: #3a2a0e;
    --c-danger: #ff8a80;
    --c-danger-hover: #ffaaa2;
    --c-danger-soft: #3d1715;
    --c-info: #86b6f5;
    --c-info-soft: #132a47;
    --c-neutral: #b4bec9;
    --c-neutral-soft: #232c36;
    --c-backdrop: rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #0e1318;
  --c-surface: #151b22;
  --c-surface-2: #1b232c;
  --c-surface-hover: #1a2129;
  --c-border: #2a333d;
  --c-border-strong: #3a4450;
  --c-input-border: #6b7683;
  --c-text: #e5e9ee;
  --c-text-muted: #a1acb8;
  --c-text-subtle: #8d98a5;
  --c-accent: #4cc59a;
  --c-accent-hover: #6fd3ae;
  --c-accent-soft: #12352b;
  --c-accent-text: #6fd3ae;
  --c-on-accent: #04241a;
  --c-focus: #6fd3ae;
  --c-success: #5fd08f;
  --c-success-soft: #123222;
  --c-warning: #f0b55a;
  --c-warning-soft: #3a2a0e;
  --c-danger: #ff8a80;
  --c-danger-hover: #ffaaa2;
  --c-danger-soft: #3d1715;
  --c-info: #86b6f5;
  --c-info-soft: #132a47;
  --c-neutral: #b4bec9;
  --c-neutral-soft: #232c36;
  --c-backdrop: rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* Bangla: Bengali fonts first, a slightly larger size and a taller line (conjuncts and vowel signs), never letter-spacing */
html:lang(bn) {
  --font-sans: var(--font-bn);
  --fs-xs: 0.875rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --lh-base: 1.75;
  --lh-tight: 1.4;
  /* thin Bengali strokes need more contrast than Latin at the same size (FIN-030); the dark theme keeps its own token */
  --c-text-muted: #47515d;
}
:lang(bn) * {
  letter-spacing: normal !important;
}

/* ------------------------------------------------------------------ 2. base elements */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1,
h2,
h3,
h4 {
  line-height: var(--lh-tight);
  margin: 0 0 var(--sp-3);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
}
h1 {
  font-size: var(--fs-xl);
}
h2 {
  font-size: var(--fs-lg);
}
h3 {
  font-size: var(--fs-md);
}
h4 {
  font-size: var(--fs-base);
}
p {
  margin: 0 0 var(--sp-3);
}
small,
.text-sm {
  font-size: var(--fs-sm);
}
a {
  color: var(--c-accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--c-accent-hover);
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) {
  outline: none;
}
hr {
  border: 0;
  border-top: 1px solid var(--c-border);
  margin: var(--sp-6) 0;
}
code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
code {
  background: var(--c-surface-2);
  border-radius: 4px;
  padding: 1px 5px;
}
pre {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  overflow-x: auto;
}
img,
svg,
video {
  max-width: 100%;
}
ul,
ol {
  padding-left: 1.4em;
  margin: 0 0 var(--sp-3);
}
dl {
  margin: 0 0 var(--sp-3);
}
b,
strong {
  font-weight: var(--fw-semibold);
}
::selection {
  background: var(--c-accent-soft);
  color: var(--c-text);
}

/* Tables: the base element looks finished on its own (old pages use bare <table> without <thead>). */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-surface);
  font-variant-numeric: tabular-nums;
  margin: 0 0 var(--sp-4);
}
th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
  font-size: var(--fs-sm);
}
html:lang(bn) th,
html:lang(bn) td {
  font-size: var(--fs-sm);
}
th {
  font-weight: var(--fw-semibold);
  color: var(--c-text-muted);
  background: var(--c-surface-2);
  white-space: nowrap;
}
tbody tr:hover > td,
table > tr:hover > td {
  background: var(--c-surface-hover);
}
caption {
  text-align: left;
  font-weight: var(--fw-semibold);
  padding: 0 0 var(--sp-2);
  color: var(--c-text);
}
td:first-child > a:only-child {
  white-space: nowrap;
}
td.num,
th.num,
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Form controls */
input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
  max-width: 100%;
}
:where(
    input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"], [type="button"], [type="file"], [type="range"], [type="color"]),
    select,
    textarea
  ) {
  min-height: 40px;
  padding: 8px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-input-border);
  border-radius: var(--radius-sm);
  line-height: 1.4;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
textarea {
  min-height: 88px;
  width: 100%;
  resize: vertical;
}
select {
  padding-right: 32px;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select[multiple] {
  background-image: none;
  padding-right: 12px;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--c-text-muted);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 1px;
  border-color: var(--c-accent);
}
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--c-accent);
  vertical-align: middle;
  flex: 0 0 auto;
}
input[type="file"] {
  padding: 6px 0;
}
input[type="file"]::file-selector-button {
  font: inherit;
  margin-right: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
}
::placeholder {
  color: var(--c-text-subtle);
  opacity: 1;
}
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  cursor: not-allowed;
}
input[readonly] {
  background: var(--c-surface-2);
}
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--c-danger);
}
label {
  font-weight: var(--fw-medium);
}
fieldset {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin: 0 0 var(--sp-4);
  min-width: 0;
}
legend {
  font-weight: var(--fw-semibold);
  padding: 0 var(--sp-1);
}

/* Old forms rendered with form.as_p: label above control, help text muted, errors red. */
form > p > label {
  display: block;
  margin-bottom: var(--sp-1);
}
form > p {
  margin-bottom: var(--sp-4);
}
form > p > :where(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea) {
  width: 100%;
  max-width: 34rem;
}
form > p:has(> input[type="checkbox"]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
}
form > p:has(> input[type="checkbox"]) > label {
  display: inline;
  margin: 0;
  order: 2;
}
form > p:has(> input[type="checkbox"]) > input {
  order: 1;
}
form > p:has(> input[type="checkbox"]) > .helptext {
  order: 3;
  flex-basis: 100%;
}
.helptext,
.field__help {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin-top: var(--sp-1);
}
.errorlist {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-2);
  color: var(--c-danger);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.errorlist.nonfield,
.errorlist.nonform {
  background: var(--c-danger-soft);
  border-left: 4px solid var(--c-danger);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}

/* Buttons. A bare <button> is a calm secondary button; the first submit of an old entry form is primary. */
button,
.btn,
input[type="submit"],
input[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: var(--fw-medium);
  font-size: var(--fs-base);
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  white-space: normal;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
  vertical-align: middle;
}
button:hover,
.btn:hover {
  background: var(--c-surface-2);
  border-color: var(--c-text-muted);
  color: var(--c-text);
  text-decoration: none;
}
.btn--primary,
form:has(> p) > button[type="submit"]:first-of-type,
form:has(> p) > button:not([type]):first-of-type {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-on-accent);
}
.btn--primary:hover,
form:has(> p) > button[type="submit"]:first-of-type:hover,
form:has(> p) > button:not([type]):first-of-type:hover {
  background: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
  color: var(--c-on-accent);
}
.btn--secondary {
  background: var(--c-surface);
  border-color: var(--c-border-strong);
  color: var(--c-text);
}
.btn--danger {
  background: var(--c-danger);
  border-color: var(--c-danger);
  color: #fff;
}
:root[data-theme="dark"] .btn--danger {
  color: #2a0906;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn--danger {
    color: #2a0906;
  }
}
.btn--danger:hover {
  background: var(--c-danger-hover);
  border-color: var(--c-danger-hover);
  color: #fff;
}
:root[data-theme="dark"] .btn--danger:hover {
  color: #2a0906;
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--c-text);
}
.btn--ghost:hover {
  background: var(--c-surface-2);
  border-color: transparent;
}
.btn--link {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 0;
  color: var(--c-accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn--link:hover {
  background: none;
  color: var(--c-accent-hover);
}
.btn--sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: var(--fs-sm);
}
.btn--lg {
  min-height: 48px;
  padding: 12px 22px;
  font-size: var(--fs-md);
}
.btn--block {
  width: 100%;
}
.btn--icon {
  padding: 0;
  width: 40px;
}
button:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.is-loading,
button.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading::after,
button.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--c-on-accent);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn--secondary.is-loading::after,
.btn--ghost.is-loading::after {
  border-color: var(--c-text);
  border-right-color: transparent;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.btn-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
}
.btn-row form,
.actions form {
  margin: 0;
}

/* ------------------------------------------------------------------ 3. utilities */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.muted {
  color: var(--c-text-muted);
}
.nowrap {
  white-space: nowrap;
}
.tabular {
  font-variant-numeric: tabular-nums;
}
.stack > * + * {
  margin-top: var(--sp-4);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}
.mt-0 {
  margin-top: 0;
}
.mb-0 {
  margin-bottom: 0;
}
[hidden] {
  display: none !important;
}
.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
}
.icon--sm {
  width: 16px;
  height: 16px;
}
.icon--lg {
  width: 28px;
  height: 28px;
}

/* ------------------------------------------------------------------ 4. app shell */
.skip {
  position: absolute;
  left: var(--sp-2);
  top: -200px;
  z-index: var(--z-skip);
  background: var(--c-surface);
  color: var(--c-accent-text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-weight: var(--fw-semibold);
}
.skip:focus {
  top: var(--sp-2);
}
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) 1fr auto;
  grid-template-areas: "top top" "side main" "side foot";
}

/* top bar */
.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-5) 0 var(--sp-4);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
  color: var(--c-text);
  text-decoration: none;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  width: calc(var(--sidebar-w) - var(--sp-6));
  flex: 0 1 auto;
}
.brand:hover {
  color: var(--c-text);
  text-decoration: none;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--c-accent);
  color: var(--c-on-accent);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}
.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn.menu-toggle {
  display: none;
}
.topbar-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 420px;
  margin: 0;
}
.topbar-search .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-muted);
  pointer-events: none;
}
.topbar-search input[type="search"] {
  width: 100%;
  padding-left: 38px;
  background: var(--c-surface-2);
  border-color: transparent;
  border-radius: var(--radius-pill);
}
.topbar-search input[type="search"]:hover {
  border-color: var(--c-border-strong);
}
.topbar-search input[type="search"]:focus-visible {
  background: var(--c-surface);
  border-color: var(--c-accent);
}
.topbar-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  flex: 0 0 auto;
}
.topbar-tools form {
  margin: 0;
}
.icon-btn {
  position: relative;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  color: var(--c-text-muted);
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
  border-color: transparent;
}
.count-badge {
  position: absolute;
  top: 1px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--c-danger);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 2px solid var(--c-surface);
  box-sizing: content-box;
}
:root[data-theme="dark"] .count-badge {
  color: #2a0906;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .count-badge {
    color: #2a0906;
  }
}

/* language switch: a two-button segmented control, the current language pressed */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
}
.lang-switch button {
  min-height: 32px;
  padding: 2px 12px;
  font-family: var(--font-sans);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  box-shadow: none;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.lang-switch button[lang="bn"] {
  font-family: var(--font-bn);
  font-size: var(--fs-base);
  line-height: 1.2;
}
.lang-switch button:hover {
  background: var(--c-surface);
  color: var(--c-text);
}
.lang-switch button[aria-current="true"] {
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm);
  cursor: default;
}

/* dropdowns (user menu, row actions): <details>, closed by ui.js on outside click / Escape */
.dropdown {
  position: relative;
}
.dropdown > summary {
  list-style: none;
  cursor: pointer;
}
.dropdown > summary::-webkit-details-marker {
  display: none;
}
.dropdown-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: var(--z-dropdown);
  min-width: 240px;
  max-width: min(92vw, 320px);
  padding: var(--sp-2);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.dropdown-panel a,
.dropdown-panel button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-3);
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  box-shadow: none;
  color: var(--c-text);
  text-decoration: none;
  font-weight: var(--fw-medium);
  text-align: left;
}
.dropdown-panel a:hover,
.dropdown-panel button:hover {
  background: var(--c-surface-2);
}
.dropdown-panel form {
  margin: 0;
}
.dropdown-panel hr {
  margin: var(--sp-2) 0;
}
.dropdown-panel .icon {
  color: var(--c-text-muted);
}
.dropdown-panel .is-danger,
.dropdown-panel .is-danger .icon {
  color: var(--c-danger);
}
.user-menu > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-pill);
}
.user-menu > summary:hover,
.user-menu[open] > summary {
  background: var(--c-surface-2);
}
.user-menu .user-name {
  font-weight: var(--fw-medium);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-card {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
}
.user-card strong {
  display: block;
}
.user-card .chips {
  margin-top: var(--sp-2);
}

/* sidebar navigation (desktop) / drawer (mobile) */
.sidebar {
  grid-area: side;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sp-4) var(--sp-3) var(--sp-8);
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
}
.sidebar-head {
  display: none;
}
.nav-list,
.nav-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list > li + li {
  margin-top: 2px;
}
.nav-list a,
.nav-list summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 40px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  text-decoration: none;
  font-weight: var(--fw-medium);
  cursor: pointer;
}
.nav-list summary {
  list-style: none;
}
.nav-list summary::-webkit-details-marker {
  display: none;
}
.nav-list a:hover,
.nav-list summary:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}
.nav-list .chev {
  margin-left: auto;
  transition: transform 0.15s var(--ease);
}
.nav-list details[open] > summary .chev {
  transform: rotate(180deg);
}
.nav-list details ul {
  margin: 2px 0 var(--sp-2);
  padding-left: 22px;
}
.nav-list details ul a {
  position: relative;
  min-height: 36px;
  padding: 6px 10px 6px 20px;
  font-weight: 400;
}
.nav-list details ul a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--c-border);
}
.nav-list a[aria-current="page"] {
  background: var(--c-accent-soft);
  color: var(--c-accent-text);
  font-weight: var(--fw-semibold);
}
.nav-list details ul a[aria-current="page"]::before {
  background: var(--c-accent);
}
.nav-list .nav-group.is-active > details > summary {
  color: var(--c-text);
}
.nav-count {
  margin-left: auto;
  min-width: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--c-danger);
  color: #fff;
  font-size: 12px;
  font-weight: var(--fw-bold);
  line-height: 20px;
  text-align: center;
}
:root[data-theme="dark"] .nav-count {
  color: #2a0906;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-count {
    color: #2a0906;
  }
}
.drawer-backdrop {
  display: none;
}

/* main column */
.main {
  grid-area: main;
  min-width: 0;
}
.main:focus {
  outline: none;
}
.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-8) var(--sp-12);
}
.content--narrow {
  max-width: 760px;
}
.content--wide {
  max-width: none;
}
.footer {
  grid-area: foot;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-6);
  padding: var(--sp-4) var(--sp-8) var(--sp-6);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  border-top: 1px solid var(--c-border);
}
.footer p {
  margin: 0;
}

/* page header */
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px var(--sp-1);
  list-style: none;
  margin: 0 0 var(--sp-2);
  padding: 0;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}
.breadcrumbs li + li::before {
  content: "/";
  color: var(--c-border-strong);
  margin-right: var(--sp-1);
}
.breadcrumbs a {
  color: var(--c-text-muted);
  text-decoration: none;
}
.breadcrumbs a:hover {
  color: var(--c-accent-text);
  text-decoration: underline;
}
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4) var(--sp-6);
  margin-bottom: var(--sp-6);
}
.page-header__text {
  min-width: 0;
  flex: 1 1 320px;
}
.page-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  margin: 0;
}
.page-subtitle {
  margin: var(--sp-1) 0 0;
  color: var(--c-text-muted);
  font-size: var(--fs-md);
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.page-actions form {
  margin: 0;
}
/* an old page's own first <h2> reads as the page title */
.page-body--legacy > h2:first-child,
.page-body--legacy > h2:first-of-type {
  font-size: var(--fs-2xl);
  margin: 0 0 var(--sp-5);
}
.page-body--legacy > h3 {
  margin-top: var(--sp-6);
}

/* ------------------------------------------------------------------ 5. components */
/* card / panel (`.card` is the old class and stays) */
.card,
.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
  margin: 0 0 var(--sp-5);
  min-width: 0;
}
.card > :last-child,
.panel__body > :last-child {
  margin-bottom: 0;
}
.card > table:last-child {
  margin-bottom: 0;
}
.card > h2,
.card > h3 {
  font-size: var(--fs-md);
}
.panel {
  padding: 0;
}
.panel__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
}
.panel__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
  margin: 0;
}
.panel__title .icon {
  color: var(--c-text-muted);
}
.panel__body {
  padding: var(--sp-5);
}
.panel__body--flush {
  padding: 0;
}
.panel__body--flush table {
  margin: 0;
}
.panel__footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: var(--fs-sm);
}
.panel--muted {
  background: var(--c-surface-2);
  box-shadow: none;
}

/* stat tile: label, value (proportional figures), hint / delta, optional link */
.stat-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  margin-bottom: var(--sp-5);
}
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-5);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat__label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  font-weight: var(--fw-medium);
}
.stat__value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  line-height: 1.15;
  font-variant-numeric: proportional-nums;
  color: var(--c-text);
}
/* an amount with its currency ("BDT 1637000.00") is longer than a count: a size smaller, and it may wrap instead of leaving the tile */
.stat__value .amount {
  font-size: var(--fs-xl);
  white-space: normal;
  overflow-wrap: anywhere;
}
.stat__hint {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.stat__delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: var(--fw-semibold);
}
.stat__delta--up {
  color: var(--c-success);
}
.stat__delta--down {
  color: var(--c-danger);
}
.stat__link {
  color: inherit;
  text-decoration: none;
}
.stat__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.stat:has(.stat__link:hover) {
  border-color: var(--c-accent);
}
.stat:has(.stat__link:focus-visible) {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}
.stat__link:focus-visible {
  outline: none;
}
.stat--accent {
  border-top: 3px solid var(--c-accent);
}
.stat--warning {
  border-top: 3px solid var(--c-warning);
}
.stat--danger {
  border-top: 3px solid var(--c-danger);
}

/* badges / status pills: always text, colour is a second cue */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 10px 1px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.6;
  white-space: nowrap;
  background: var(--c-neutral-soft);
  color: var(--c-neutral);
  border: 1px solid transparent;
  vertical-align: middle;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.badge--plain::before {
  display: none;
}
.badge--success {
  background: var(--c-success-soft);
  color: var(--c-success);
}
.badge--warning {
  background: var(--c-warning-soft);
  color: var(--c-warning);
}
.badge--danger {
  background: var(--c-danger-soft);
  color: var(--c-danger);
}
.badge--info {
  background: var(--c-info-soft);
  color: var(--c-info);
}
.badge--accent {
  background: var(--c-accent-soft);
  color: var(--c-accent-text);
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.8;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

/* alerts / callouts and Django messages (`.msg` is the old class) */
.alerts {
  display: grid;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.alert,
.msg,
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  border-left-width: 4px;
  background: var(--c-info-soft);
  border-left-color: var(--c-info);
  color: var(--c-text);
  margin: 0 0 var(--sp-3);
}
.notice {
  display: block;
}
.alert > .icon {
  margin-top: 2px;
  color: var(--c-info);
}
.alert__body {
  flex: 1 1 auto;
  min-width: 0;
}
.alert__body > :last-child {
  margin-bottom: 0;
}
.alert__title {
  display: block;
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
}
.alert__close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  min-height: 32px;
  margin: -4px -6px -4px 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--c-text-muted);
}
.alert__close:hover {
  background: rgba(0, 0, 0, 0.06);
}
.alert--success,
.msg.success {
  background: var(--c-success-soft);
  border-left-color: var(--c-success);
}
.alert--success > .icon {
  color: var(--c-success);
}
.alert--warning,
.msg.warning {
  background: var(--c-warning-soft);
  border-left-color: var(--c-warning);
}
.alert--warning > .icon {
  color: var(--c-warning);
}
.alert--danger,
.msg.error {
  background: var(--c-danger-soft);
  border-left-color: var(--c-danger);
}
.alert--danger > .icon {
  color: var(--c-danger);
}

/* data table (`.table`) inside a scrolling wrapper; restacks into cards on phones with `.table--stack` */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  margin-bottom: var(--sp-4);
}
.panel .table-wrap,
.table-wrap--flush {
  border: 0;
  border-radius: 0;
  margin: 0;
}
.table-wrap > table {
  margin: 0;
}
/* a wrapper that can scroll sideways is reachable by keyboard (tabindex, role and label come from the markup or ui.js) */
.table-wrap:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: -3px;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.table td.actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.table tr:last-child > td {
  border-bottom: 0;
}
.table a.row-link {
  font-weight: var(--fw-medium);
}
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}
.th-sort:hover {
  color: var(--c-text);
}
.th-sort .icon {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}
th[aria-sort] .th-sort {
  color: var(--c-text);
}
th[aria-sort="ascending"] .th-sort .icon {
  transform: rotate(180deg);
  opacity: 1;
}
th[aria-sort="descending"] .th-sort .icon {
  opacity: 1;
}
.row-actions > summary {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
}
.row-actions > summary:hover,
.row-actions[open] > summary {
  background: var(--c-surface-2);
  color: var(--c-text);
}
.row-actions .dropdown-panel {
  min-width: 200px;
}

/* amounts: right-aligned, tabular; a negative amount is red with a real minus sign, never "-0.00" */
.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.amount--neg {
  color: var(--c-danger);
  font-weight: var(--fw-semibold);
}
.amount--zero {
  color: var(--c-text-muted);
}

/* empty state */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-5);
  color: var(--c-text-muted);
}
.empty__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  margin-bottom: var(--sp-1);
}
.empty__icon .icon {
  width: 26px;
  height: 26px;
}
.empty__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  margin: 0;
}
.empty__hint {
  max-width: 44ch;
  margin: 0;
}
.empty .btn {
  margin-top: var(--sp-2);
}
.empty--compact {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  text-align: left;
  gap: var(--sp-1) var(--sp-4);
  padding: var(--sp-5);
}
.empty--compact .empty__icon {
  width: 40px;
  height: 40px;
  margin: 0;
  grid-row: span 2;
}
.empty--compact .empty__icon .icon {
  width: 20px;
  height: 20px;
}
.empty--compact .empty__text {
  flex: 1 1 200px;
  min-width: 0;
}
.empty--compact .empty__title {
  font-size: var(--fs-base);
}
.empty--compact .empty__hint {
  font-size: var(--fs-sm);
}

/* forms: field wrapper, layout grid, sticky action bar */
.form-grid {
  display: grid;
  gap: 0 var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}
.form-grid > .field--full,
.form-grid > fieldset,
.form-grid > .form-section {
  grid-column: 1 / -1;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 var(--sp-5);
  min-width: 0;
}
.field > label,
.field__label {
  font-weight: var(--fw-medium);
}
.field :where(input:not([type="checkbox"], [type="radio"]), select, textarea) {
  width: 100%;
}
.field__help {
  margin: 0;
}
.field__help ul {
  margin: 0;
  padding-left: 1.2em;
}
.req {
  color: var(--c-danger);
  margin-left: 2px;
}
.field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  color: var(--c-danger);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.field__error .icon {
  width: 16px;
  height: 16px;
  margin-top: 3px;
}
.field--check {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--sp-2) var(--sp-3);
}
.field--check > input {
  margin-top: 3px;
}
.field--check > label {
  flex: 1 1 0;
  min-width: 0;
}
.field--check > .field__help,
.field--check > .field__error,
.field--check > [id$="_error"] {
  flex-basis: 100%;
  padding-left: 30px;
}
.field--choices {
  border: 0;
  padding: 0;
}
.field--choices legend {
  font-weight: var(--fw-medium);
  padding: 0;
  margin-bottom: 6px;
}
.field--choices div > div,
.field--choices ul > li {
  margin: 0 0 6px;
}
.field--choices label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 32px;
  font-weight: 400;
}
.field--choices ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.field--error input,
.field--error select,
.field--error textarea {
  border-color: var(--c-danger);
}
.form-section {
  padding-top: var(--sp-2);
}
.form-section + .form-section {
  border-top: 1px solid var(--c-border);
  padding-top: var(--sp-6);
}
.form-section__title {
  font-size: var(--fs-md);
  margin-bottom: var(--sp-1);
}
.form-section__hint {
  color: var(--c-text-muted);
  margin-bottom: var(--sp-4);
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
  padding-top: var(--sp-2);
}
.form-actions--sticky {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  margin: var(--sp-4) calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5));
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 -6px 16px rgba(16, 24, 40, 0.06);
}
/* error summary: first thing after the page title of a form that failed validation (FIN-012) */
.error-summary {
  margin: 0 0 var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  background: var(--c-danger-soft);
  border: 1px solid var(--c-danger);
  border-left-width: 4px;
  border-radius: var(--radius);
  color: var(--c-text);
  overflow-wrap: anywhere;
}
.error-summary:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}
.error-summary__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-md);
  color: var(--c-danger);
}
.error-summary__list {
  margin: 0;
  padding-left: var(--sp-5);
}
.error-summary__list li + li {
  margin-top: var(--sp-1);
}
.error-summary__list a {
  font-weight: var(--fw-semibold);
}
/* a sticky bar that follows panels (not inside a padded card) lines up with them instead of bleeding out (FIN-026) */
form:not(.card) > .form-actions--sticky,
.stack > .form-actions--sticky,
.panel__body > .form-actions--sticky {
  margin: var(--sp-4) 0 0;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.password-wrap {
  position: relative;
  display: flex;
}
.password-wrap input {
  flex: 1 1 auto;
  padding-right: 48px !important;
}
.password-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--c-text-muted);
}
.password-toggle:hover {
  background: transparent;
  color: var(--c-text);
}

/* filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.filter-bar .field {
  margin: 0;
  flex: 1 1 180px;
  min-width: 0;
}
.filter-bar .field--grow {
  flex: 3 1 260px;
}
.filter-bar__actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.pagination ul {
  display: flex;
  gap: var(--sp-1);
  list-style: none;
  margin: 0;
  padding: 0;
}
.pagination a,
.pagination span.current {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  text-decoration: none;
}
.pagination a:hover {
  border-color: var(--c-text-muted);
}
.pagination span.current {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-on-accent);
  font-weight: var(--fw-semibold);
}

/* tabs (links) */
.tabs {
  display: flex;
  gap: var(--sp-1);
  overflow-x: auto;
  border-bottom: 1px solid var(--c-border);
  margin: 0 0 var(--sp-5);
  padding: 0;
  list-style: none;
  scrollbar-width: thin;
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 8px 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--c-text-muted);
  text-decoration: none;
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.tabs a:hover {
  color: var(--c-text);
  border-bottom-color: var(--c-border-strong);
}
.tabs a[aria-current="page"] {
  color: var(--c-accent-text);
  border-bottom-color: var(--c-accent);
  font-weight: var(--fw-semibold);
}
.tabs .badge {
  font-size: 11px;
}

/* definition list (profile data) and key-value summary */
.dl {
  display: grid;
  grid-template-columns: minmax(120px, 38%) 1fr;
  gap: 0;
  margin: 0;
}
.dl dt,
.dl dd {
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
  margin: 0;
}
.dl dt {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  padding-right: var(--sp-4);
}
.dl dd {
  font-weight: var(--fw-medium);
  min-width: 0;
}
.dl > :nth-last-child(-n + 2) {
  border-bottom: 0;
}
.kv {
  display: grid;
  gap: var(--sp-3) var(--sp-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  margin: 0;
}
.kv > div {
  min-width: 0;
}
.kv dt {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.kv dd {
  margin: 2px 0 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.kv--total dd {
  font-size: var(--fs-lg);
}

/* timeline (history) */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  position: relative;
  padding: 0 0 var(--sp-5) var(--sp-8);
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: var(--c-border);
}
.timeline li:last-child {
  padding-bottom: 0;
}
.timeline li:last-child::before {
  display: none;
}
.timeline__dot {
  position: absolute;
  left: 2px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 3px solid var(--c-accent);
}
.timeline__dot--neutral {
  border-color: var(--c-border-strong);
}
.timeline__dot--warning {
  border-color: var(--c-warning);
}
.timeline__dot--danger {
  border-color: var(--c-danger);
}
.timeline__meta {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.timeline__title {
  font-weight: var(--fw-semibold);
}

/* stepper (approval chain, onboarding) */
.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) 0;
  list-style: none;
  margin: 0 0 var(--sp-4);
  padding: 0;
  counter-reset: step;
}
.stepper li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1 1 140px;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.stepper li:not(:last-child)::after {
  content: "";
  flex: 1 1 auto;
  height: 2px;
  min-width: 16px;
  margin: 0 var(--sp-2);
  background: var(--c-border);
}
.stepper li.is-done:not(:last-child)::after {
  background: var(--c-accent);
}
.step__marker {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--c-border-strong);
  background: var(--c-surface);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xs);
  flex: 0 0 auto;
}
.step__marker .icon {
  width: 16px;
  height: 16px;
}
.stepper li.is-done .step__marker {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-on-accent);
}
.stepper li.is-current {
  color: var(--c-text);
  font-weight: var(--fw-semibold);
}
.stepper li.is-current .step__marker {
  border-color: var(--c-accent);
  color: var(--c-accent-text);
  box-shadow: 0 0 0 4px var(--c-accent-soft);
}
.stepper li.is-rejected .step__marker {
  border-color: var(--c-danger);
  color: var(--c-danger);
}
.step__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.step__sub {
  font-weight: 400;
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
}
.stepper--vertical {
  flex-direction: column;
}
.stepper--vertical li {
  flex: none;
}
.stepper--vertical li::after {
  display: none;
}

/* avatar with initials */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-accent-soft);
  color: var(--c-accent-text);
  font-weight: var(--fw-semibold);
  font-size: 0.8125rem;
  flex: 0 0 auto;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 0.6875rem;
}
.avatar--lg {
  width: 56px;
  height: 56px;
  font-size: 1.125rem;
}
.person {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}
.person {
  white-space: normal; /* a name never keeps the no-wrap of the ID link around it */
}
.person > span {
  min-width: 0;
}
.person > .avatar {
  flex: 0 0 auto;
}
.person__name {
  font-weight: var(--fw-medium);
  overflow-wrap: anywhere;
}
.person__meta {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  overflow-wrap: anywhere;
}
/* titles, list rows and descriptions in flex or grid parents wrap long words instead of pushing the card wider (FIN-013) */
.page-title,
.page-subtitle,
.panel__title,
.list__main,
.list__title,
.list__meta,
.dl dd,
.field__help,
.alert__body,
.stat__label,
.stat__hint {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* progress bar */
.progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.progress__head {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.progress__value {
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
  white-space: nowrap;
}
.progress__track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--c-accent-soft);
  overflow: hidden;
}
.progress__bar {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--c-accent);
}
.progress--warning .progress__track {
  background: var(--c-warning-soft);
}
.progress--warning .progress__bar {
  background: var(--c-warning);
}
.progress--danger .progress__track {
  background: var(--c-danger-soft);
}
.progress--danger .progress__bar {
  background: var(--c-danger);
}
progress {
  accent-color: var(--c-accent);
}

/* help without tooltips: <details class="help"> */
details.help {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-sm);
}
details.help > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--c-accent-text);
  font-weight: var(--fw-medium);
  list-style: none;
  min-height: 32px;
}
details.help > summary::-webkit-details-marker {
  display: none;
}
details.help > div {
  margin-top: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  background: var(--c-surface-2);
  color: var(--c-text);
}

/* item lists inside panels (dashboard rows) */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  min-width: 0;
}
.list > li:last-child {
  border-bottom: 0;
}
.list__main {
  min-width: 0;
  flex: 1 1 200px;
}
.list__title {
  display: block;
  font-weight: var(--fw-medium);
}
.list__meta {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.list__side {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* dashboard */
.dash-section {
  margin: 0 0 var(--sp-8);
}
.dash-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.dash-section__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}
html:lang(bn) .dash-section__title {
  text-transform: none;
  font-size: var(--fs-base);
}
.widget-grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(12, minmax(0, 1fr));
}
.widget-grid > * {
  grid-column: span 6;
  margin: 0;
}
.widget-grid > .w-full {
  grid-column: 1 / -1;
}
.widget-grid > .w-third {
  grid-column: span 4;
}
.widget-grid > .w-two-thirds {
  grid-column: span 8;
}
.punch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.punch__times {
  display: flex;
  gap: var(--sp-6);
}
.punch__time dt {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.punch__time dd {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: var(--sp-2) 0 0;
  margin: 0;
  list-style: none;
}
.bars li {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}
.bars__bar {
  display: block;
  width: 100%;
  max-width: 36px;
  border-radius: 4px 4px 0 0;
  background: var(--c-border-strong);
  min-height: 2px;
}
.bars li:last-child .bars__bar {
  background: var(--c-accent);
}
.bars__value {
  color: var(--c-text);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.quick-actions {
  display: grid;
  gap: var(--sp-2);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}
.quick-actions .btn {
  justify-content: flex-start;
}

/* style guide swatches */
.swatches {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  list-style: none;
  padding: 0;
}
.swatch {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: var(--fs-sm);
  background: var(--c-surface);
}
.swatch__chip {
  height: 52px;
  border-bottom: 1px solid var(--c-border);
}
.swatch__label {
  padding: var(--sp-2) var(--sp-3);
}
.swatch code {
  background: none;
  padding: 0;
  font-size: var(--fs-xs);
}

/* ------------------------------------------------------------------ 6. auth layout (sign in, passwords, MFA) */
.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 500px at 50% -10%, var(--c-accent-soft), transparent 70%), var(--c-bg);
}
.auth__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
}
.auth__top .brand {
  width: auto;
}
.auth__main {
  flex: 1 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-8) var(--sp-4) var(--sp-12);
}
.auth__main:focus {
  outline: none;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: var(--sp-8);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.auth-card--wide {
  max-width: 560px;
}
.auth-card__icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--c-accent-soft);
  color: var(--c-accent-text);
  margin-bottom: var(--sp-4);
}
.auth-card__icon .icon {
  width: 24px;
  height: 24px;
}
.auth-card h1 {
  font-size: var(--fs-xl);
  margin-bottom: var(--sp-2);
}
.auth-card .lead {
  color: var(--c-text-muted);
  margin-bottom: var(--sp-6);
}
.auth-card .btn--block {
  margin-top: var(--sp-2);
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-5);
  font-size: var(--fs-sm);
}
.auth__foot {
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
  text-align: center;
}
.qr {
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  margin: 0 0 var(--sp-4);
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.qr svg {
  width: 200px;
  height: auto;
}
.secret {
  display: block;
  word-break: break-all;
  font-size: var(--fs-md);
  letter-spacing: 0.06em;
  padding: var(--sp-2) var(--sp-3);
}

/* error pages */
.error-page {
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
}
.error-page__code {
  font-size: 4rem;
  font-weight: var(--fw-bold);
  line-height: 1;
  color: var(--c-accent);
  margin-bottom: var(--sp-3);
  font-variant-numeric: proportional-nums;
}
.error-page__body {
  max-width: 520px;
}
.error-page .empty__icon {
  margin: 0 auto var(--sp-3);
}
.error-page .btn-row {
  justify-content: center;
  margin-top: var(--sp-5);
}

/* ------------------------------------------------------------------ 7. responsive */
@media (max-width: 1199px) {
  .widget-grid > .w-third {
    grid-column: span 6;
  }
}
@media (max-width: 1023px) {
  :root {
    --topbar-h: 56px;
  }
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "main" "foot";
  }
  .icon-btn.menu-toggle {
    display: inline-grid;
  }
  .brand {
    width: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: var(--z-drawer);
    width: min(86vw, 320px);
    height: 100%;
    padding-top: 0;
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.2s var(--ease), visibility 0.2s;
    box-shadow: var(--shadow-lg);
    border-right: 0;
  }
  .sidebar:target,
  .sidebar.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.2s var(--ease), visibility 0s; /* visible at once, so ui.js can move focus into it (FIN-024) */
  }
  .sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    position: sticky;
    top: 0;
    z-index: 1;
    min-height: var(--topbar-h);
    margin: 0 calc(-1 * var(--sp-3)) var(--sp-3);
    padding: 0 var(--sp-3) 0 var(--sp-4);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
  }
  .sidebar:target ~ .drawer-backdrop,
  .sidebar.is-open ~ .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-drawer) - 1);
    background: var(--c-backdrop);
  }
  .nav-list a,
  .nav-list summary,
  .nav-list details ul a {
    min-height: var(--touch);
  }
  .content {
    padding: var(--sp-5) var(--sp-5) var(--sp-10);
  }
  .footer {
    padding: var(--sp-4) var(--sp-5) var(--sp-6);
  }
  .widget-grid > *,
  .widget-grid > .w-third,
  .widget-grid > .w-two-thirds {
    grid-column: 1 / -1;
  }
}
@media (max-width: 767px) {
  .topbar {
    gap: var(--sp-1);
    padding: 0 var(--sp-2);
  }
  .topbar-search,
  .user-menu .user-name,
  .user-menu > summary > .chev,
  .theme-toggle--bar {
    display: none;
  }
  .brand-name {
    max-width: 38vw;
    font-size: var(--fs-base);
  }
  .lang-switch button {
    padding: 2px 9px;
  }
  .content {
    padding: var(--sp-4) var(--sp-4) var(--sp-10);
  }
  .page-title {
    font-size: var(--fs-xl);
  }
  .page-body--legacy > h2:first-child,
  .page-body--legacy > h2:first-of-type {
    font-size: var(--fs-xl);
  }
  .page-actions {
    width: 100%;
  }
  .card,
  .panel__body {
    padding: var(--sp-4);
  }
  .panel__header,
  .list > li {
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }
  .form-actions--sticky {
    margin: var(--sp-4) calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4));
    padding: var(--sp-3) var(--sp-4);
  }
  .form-actions .btn,
  .form-actions button {
    flex: 1 1 auto;
  }
  /* 44px targets on phones */
  :where(button, .btn, input:not([type="checkbox"], [type="radio"], [type="hidden"]), select) {
    min-height: var(--touch);
  }
  .btn--sm {
    min-height: 40px;
  }
  .icon-btn {
    width: var(--touch);
    height: var(--touch);
  }
  .lang-switch button {
    min-height: 38px;
  }
  /* old bare tables scroll inside themselves instead of widening the page */
  .page-body table:not(.table) {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }
  /* `.table--stack`: each row becomes a card; cells carry data-label */
  .table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .table--stack,
  .table--stack tbody,
  .table--stack tr,
  .table--stack td {
    display: block;
    width: 100%;
  }
  .table--stack tr {
    padding: var(--sp-2) var(--sp-4);
    border-bottom: 1px solid var(--c-border);
  }
  .table--stack td {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: 6px 0;
    border: 0;
    text-align: right;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere; /* a long name or an unbroken string wraps inside the card (FIN-013) */
    white-space: normal;
  }
  .table--stack td {
    flex-wrap: wrap;
  }
  .table--stack td > * {
    min-width: 0;
    max-width: 100%;
  }
  .table--stack td:first-child > a:only-child {
    white-space: normal;
  }
  /* a cell holding several blocks (a title and its description) stacks them under the label, full width */
  .table--stack td > :not(:only-child):not(.badge):not(.btn):not(.chip) {
    flex: 1 1 100%;
    text-align: left;
  }
  .table--stack td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    color: var(--c-text-muted);
    font-weight: var(--fw-medium);
    text-align: left;
    overflow-wrap: break-word;
  }
  .table--stack .person {
    justify-content: flex-end;
    text-align: left;
  }
  .table--stack td.num {
    text-align: right;
  }
  .table--stack td.actions-cell {
    width: 100%;
    justify-content: flex-end;
  }
  .table--stack td.actions-cell::before {
    content: none;
  }
  .dl {
    grid-template-columns: 1fr;
  }
  .dl dt {
    border-bottom: 0;
    padding-bottom: 0;
  }
  .dl dd {
    padding-top: 2px;
  }
  .auth__top {
    padding: var(--sp-3) var(--sp-4);
  }
  .auth__main {
    padding: var(--sp-4) var(--sp-3) var(--sp-8);
  }
  .auth-card {
    padding: var(--sp-6) var(--sp-5);
  }
  .stepper li {
    flex-basis: 100%;
  }
  .stepper li::after {
    display: none;
  }
  .punch__times {
    gap: var(--sp-5);
  }
}

@media (max-width: 419px) {
  .topbar .brand-name {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  .badge,
  .btn,
  .stat,
  .card,
  .panel {
    border: 1px solid CanvasText;
  }
  .nav-list a[aria-current="page"] {
    outline: 2px solid Highlight;
  }
}

/* ------------------------------------------------------------------ 8. print: payslips, letters, reports without chrome */
@media print {
  :root {
    color-scheme: light;
    --c-bg: #fff;
    --c-surface: #fff;
    --c-surface-2: #f3f3f3;
    --c-text: #000;
    --c-text-muted: #333;
    --c-border: #bbb;
  }
  body {
    background: #fff;
    font-size: 11pt;
  }
  .topbar,
  .sidebar,
  .drawer-backdrop,
  .footer,
  .skip,
  .breadcrumbs,
  .page-actions,
  .alerts,
  .alert__close,
  .lang-switch,
  .no-print,
  form button,
  .form-actions,
  .pagination,
  .filter-bar,
  .row-actions {
    display: none !important;
  }
  .app {
    display: block;
  }
  .content {
    max-width: none;
    padding: 0;
  }
  .card,
  .panel,
  .stat,
  .table-wrap {
    box-shadow: none;
    border-color: #bbb;
    break-inside: avoid;
  }
  a {
    color: #000;
    text-decoration: none;
  }
  table {
    font-size: 10pt;
  }
  th {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  tr,
  img {
    break-inside: avoid;
  }
  .page-title {
    font-size: 18pt;
  }
}

/* ------------------------------------------------------------------ WP19: leave, attendance and lifecycle pages (documented in docs/UI.md section 9) */
.kv--lines {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  max-width: 520px;
}
.kv--lines > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-1) var(--sp-4);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--c-border);
}
.kv--lines > div:last-child {
  border-bottom: 0;
  border-top: 2px solid var(--c-border-strong);
  padding-top: var(--sp-3);
}
.kv--lines dd {
  margin: 0;
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.amount--lg {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
}
.amount--pos {
  color: var(--c-success);
  font-weight: var(--fw-semibold);
}
.settlement-callout {
  align-self: start;
}
.settlement-callout .alert {
  margin-bottom: 0;
}
.settlement-callout .alert__title {
  display: block;
  font-size: var(--fs-lg);
}
.settlement-callout .alert--danger {
  border-left-width: 6px;
}
.settlement-callout .alert--success {
  border-left-width: 6px;
}
.panel__body--divided {
  border-top: 1px solid var(--c-border);
}
.panel__footer--actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-5);
}
.panel__footer--actions .filter-bar {
  flex-wrap: nowrap;
}
.panel__footer--actions .filter-bar .field {
  flex: 0 1 260px;
}
.panel__footer .filter-bar {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
}
.punch--hero {
  gap: var(--sp-5);
}
.punch--hero .punch__time dd {
  font-size: var(--fs-2xl);
}
.punch--hero .btn-row {
  gap: var(--sp-3);
}
.table tbody tr.row--exception > td:first-child {
  box-shadow: inset 4px 0 0 var(--c-warning);
}
.cal-off > td {
  background: var(--c-surface-2);
}
.cal-today > td:first-child {
  font-weight: var(--fw-semibold);
  box-shadow: inset 4px 0 0 var(--c-accent);
}
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.chip.approved,
.chip.pending {
  margin: 2px 4px 2px 0;
  font-weight: var(--fw-medium);
  line-height: 1.7;
  border-radius: var(--radius-pill);
  padding: 0 10px;
  font-size: var(--fs-sm);
}
.chip.approved {
  background: var(--c-success-soft);
  color: var(--c-success);
  border-color: transparent;
}
.chip.pending {
  background: var(--c-surface);
  color: var(--c-warning);
  border: 1px dashed var(--c-warning);
}
.table--roster th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--c-surface);
  text-align: left;
}
.table--roster td {
  min-width: 96px;
}
.panel__body--form {
  max-width: 760px;
}
.stat-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}
.table td.actions-cell .btn {
  white-space: nowrap;
}
@media (min-width: 1280px) {
  .grid--aside {
    grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
    align-items: start;
  }
}
/* ------------------------------------------------------------------ WP18: employees area (docs/UI.md section 9) */
/* a small form laid out in one row: fields (with labels) and the button, wrapping on phones */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
}
.inline-form .field {
  margin: 0;
  flex: 1 1 200px;
  max-width: 20rem;
}
.inline-form__actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}
.inline-form--tight {
  flex-wrap: nowrap;
  gap: var(--sp-2);
}
.inline-form--tight input[type="date"] {
  width: auto;
  min-width: 0;
}
/* spacing between stacked blocks inside a panel body */
.mt-section {
  margin-top: var(--sp-6);
}
/* profile header: avatar, ID chip and status badge, key facts */
.profile-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4) var(--sp-5);
}
.profile-head__main {
  flex: 1 1 280px;
  min-width: 0;
}
.profile-head__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
}
/* a read-only value with its copy button (one-time links, keys) */
.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: stretch;
}
.copy-row input {
  flex: 1 1 260px;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
}
.table--form td input {
  width: 100%;
  min-width: 0;
}
.table--form td.num input {
  text-align: right;
}
/* the one-time link column shrinks with the table instead of pushing it past its card (FIN-022); the copy button wraps under the box */
.table .link-cell {
  min-width: 12rem;
  max-width: 20rem;
}
.table .link-cell .copy-row input {
  flex: 1 1 9rem;
  min-width: 0;
  width: 100%;
  text-overflow: ellipsis;
}
/* org chart: nested list with connector lines; cards print as boxes */
.org-tree,
.org-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.org-tree ul {
  margin-left: var(--sp-4);
  padding-left: var(--sp-6);
}
.org-tree li {
  position: relative;
  padding: var(--sp-1) 0;
}
.org-tree ul > li::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--sp-6));
  top: calc(var(--sp-1) + 24px);
  width: var(--sp-5);
  border-top: 2px solid var(--c-border-strong);
}
.org-tree ul > li::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--sp-6));
  top: 0;
  bottom: 0;
  border-left: 2px solid var(--c-border-strong);
}
.org-tree ul > li:last-child::after {
  bottom: auto;
  height: calc(var(--sp-1) + 24px);
}
.org-node a.org-node__person {
  text-decoration: none;
}
.org-node a.org-node__person:hover .person__name {
  text-decoration: underline;
}
.org-node {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  max-width: 44rem;
  break-inside: avoid;
}
.org-node__person {
  font-weight: var(--fw-semibold);
  min-width: 0;
}
.org-node__meta {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  flex: 1 1 14rem;
  min-width: 0;
}
@media (max-width: 767px) {
  .org-tree ul {
    margin-left: var(--sp-2);
    padding-left: var(--sp-4);
  }
  .org-tree ul > li::before {
    left: calc(-1 * var(--sp-4));
    width: var(--sp-3);
  }
  .org-tree ul > li::after {
    left: calc(-1 * var(--sp-4));
  }
  .inline-form--tight {
    flex-wrap: wrap;
  }
}
@media print {
  .org-node {
    border-color: #999;
  }
  .org-tree ul > li::before,
  .org-tree ul > li::after {
    border-color: #999;
  }
}
/* a person (avatar and name) used as a row link: no underline until hover */
a.row-link:has(.person) {
  text-decoration: none;
}
a.row-link:has(.person):hover .person__name {
  text-decoration: underline;
}
/* ------------------------------------------------------------------ WP20: payroll pages (docs/UI.md, "Payroll") */
/* A denser stat grid for six money tiles in a row; the value is a size smaller so 8-digit totals never clip. */
.stat-grid--dense {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}
.stat--money .stat__value {
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
}
/* "Next step" panel on a payroll run: groups of actions with a small label; the primary button is the next step. */
.action-groups {
  display: grid;
  gap: var(--sp-5) var(--sp-8);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.action-group > :last-child {
  margin-bottom: 0;
}
.action-group__label {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
html:lang(bn) .action-group__label {
  text-transform: none;
  letter-spacing: 0;
}
.action-group__hint {
  margin: 0 0 var(--sp-3);
  color: var(--c-text-muted);
}
/* Totals row of a payroll table and a row that needs attention (negative net pay). */
.table tfoot th,
.table tfoot td {
  background: var(--c-surface-2);
  font-weight: var(--fw-semibold);
  border-top: 2px solid var(--c-border-strong);
  border-bottom: 0;
}
.table tr.is-flagged > td {
  background: var(--c-danger-soft);
}
.table tr.is-flagged:hover > td {
  background: var(--c-danger-soft);
}
.cell-note {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  font-weight: 400;
}
/* The payslip as a statement: a header, two ledgers side by side (earnings, deductions), the net pay band. */
.statement__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-6);
}
.statement__head .kv {
  flex: 1 1 360px;
}
.table td.actions-cell .btn {
  white-space: nowrap;
}
.statement-grid {
  align-items: start;
}
.ledger th[scope="row"] {
  background: transparent;
  color: var(--c-text);
  font-weight: 400;
  white-space: normal;
}
.ledger tr.ledger-total > th,
.ledger tr.ledger-total > td {
  background: var(--c-surface-2);
  font-weight: var(--fw-semibold);
  border-top: 2px solid var(--c-border-strong);
  border-bottom: 0;
}
.ledger tr.ledger-sub > th,
.ledger tr.ledger-sub > td {
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
}
.statement__net {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-accent);
  border-radius: var(--radius);
  background: var(--c-accent-soft);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--sp-5);
}
.statement__net .amount {
  font-size: var(--fs-2xl);
}
@media print {
  .statement__net {
    background: #fff;
    border-color: #000;
  }
  .ledger tr.ledger-total > th,
  .ledger tr.ledger-total > td {
    background: #eee;
  }
  .panel__header {
    break-after: avoid;
  }
}
/* ------------------------------------------------------------------ 9. WP21: approvals, performance, letters, reports pages (documented in docs/UI.md section 9) */
.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* approvals inbox card: who and age on top, summary and chain, then the decision bar */
.approval {
  border-left: 4px solid var(--c-border-strong);
}
.approval--overdue {
  border-left-color: var(--c-warning);
}
.approval .panel__title {
  min-width: 0;
}
.approval__age {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.approval__summary {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-md);
  overflow-wrap: anywhere;
}
.approval__decide {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3) var(--sp-4);
  margin: 0;
}
.approval__decide .field {
  flex: 1 1 260px;
  margin: 0;
}
.approval__decide .btn-row {
  flex: 0 0 auto;
}
/* appraisal header (my appraisal, manager review): person, key facts, workflow stepper */
.appraisal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4) var(--sp-8);
  margin-bottom: var(--sp-5);
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-8);
  margin: 0;
}
.facts dt {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.facts dd {
  margin: 2px 0 0;
}
.quote {
  margin: var(--sp-3) 0 0;
  padding: var(--sp-2) var(--sp-4);
  border-left: 3px solid var(--c-border-strong);
  color: var(--c-text);
  overflow-wrap: anywhere;
}
.live-total {
  margin: var(--sp-3) 0 0;
  font-weight: var(--fw-medium);
}
.cell-wide {
  min-width: 16rem;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
}
.inline-form .field {
  margin: 0;
}
.inline-form .field--grow {
  flex: 1 1 12rem;
}
.input-score {
  width: 5.5rem;
}
/* calibration: a reviewer or score outside the threshold, and report total rows */
.table tr.is-flagged > td,
.table tr.is-flagged > th {
  background: var(--c-warning-soft);
}
.table tr.is-total > td,
.table tr.is-total > th {
  font-weight: var(--fw-semibold);
  background: var(--c-surface-2);
}
/* letters: the text as a sheet of paper, beside the preview or the acknowledgement panel */
.grid--letter {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  align-items: start;
}
.letter-paper {
  max-width: 72ch;
  margin-inline: auto;
  padding: var(--sp-6);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}
.letter-paper p {
  margin: 0 0 var(--sp-4);
}
/* reports index: a card per report */
.grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}
.report-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  height: 100%;
  padding: var(--sp-5);
  margin: 0;
  color: var(--c-text);
  text-decoration: none;
}
.report-card:hover {
  border-color: var(--c-accent);
  box-shadow: var(--shadow);
}
.report-card__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--c-accent-soft);
  color: var(--c-accent-text);
}
.report-card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.report-card__text {
  color: var(--c-text-muted);
  flex: 1 1 auto;
}
.report-card__go {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--c-accent-text);
  font-weight: var(--fw-medium);
}
@media print {
  .letter-paper {
    border: 0;
    padding: 0;
    max-width: none;
  }
}
.panel__body > .progress + p {
  margin-top: var(--sp-3);
}
.panel__body > .chips {
  margin-bottom: var(--sp-3);
}
.actions-cell .btn {
  white-space: nowrap;
}
@media (min-width: 768px) {
  .actions-cell .btn-row {
    flex-wrap: nowrap;
    justify-content: flex-end;
  }
}
@media (max-width: 767px) {
  .table--stack td.cell-wide {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-2);
    min-width: 0;
    text-align: left;
  }
  .table--stack td.cell-wide > .progress,
  .table--stack td.cell-wide > .chips,
  .table--stack td.cell-wide > .inline-form {
    width: 100%;
  }
}
