/* =============================================================================
   DHS UI kit — shared building blocks for dashboards and modern pages.
   Implements docs/design/DASHBOARD.md (tokens § 3, blocks § 5, charts § 6.1, states § 9, layout § 10).

   Usage
   - Wrap the page in <main class="kit-page">; every kit-* class works inside it.
   - Column counts: set --kit-cols (and --kit-cols-md at ≤1200px) on .kit-attention / .kit-flow / .kit-kpis
     when a page has a different number of items, e.g. style="--kit-cols: 4".
   - Tones: add tone-blue|amber|green|violet|red|slate|navy|teal to any block that uses --tone.
   - Keep page-specific styles in the component's own stylesheet; do not copy kit rules there.
   Loaded globally from angular.json (after the legacy themes).
   ============================================================================= */
.kit-page { --dash-primary: #32729B; --dash-primary-strong: #285d80; --dash-primary-soft: #e8f0f4; --dash-brand-navy: #1D3F5B; --dash-brand-teal: #0E7177; --dash-hero: linear-gradient(135deg, #255674 40%, #3e9e99); --dash-ink: #172b4d; --dash-label: #344054; --dash-muted: #5f6c7b; --dash-card: #ffffff; --dash-soft: #f5f8fc; --dash-line: #e5eaf0; --dash-track: #edf3f6; --dash-radius-card: 16px; --dash-radius-panel: 14px; --dash-radius-tile: 12px; --dash-radius-control: 10px; --dash-radius-pill: 8px; --dash-radius-hero: 18px; --dash-shadow-card: 0 6px 20px rgba(16,24,40,.045); --dash-shadow-hover: 0 8px 22px rgba(16,24,40,.07); color: var(--dash-ink); display: block; font-family: "Poppins", "Roboto", sans-serif; font-size: 13px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
[dir="rtl"] .kit-page { font-family: "Cairo", "Roboto", sans-serif; }
.kit-page h1, .kit-page h2, .kit-page h3, .kit-page p, .kit-page ul, .kit-page ol, .kit-page dl, .kit-page dd { margin: 0; }
.kit-page ul, .kit-page ol { list-style: none; padding: 0; }
.kit-page :focus-visible { outline: 2px solid var(--dash-primary); outline-offset: 2px; }
[dir="rtl"] .kit-dir, .kit-page[dir="rtl"] .kit-dir { transform: scaleX(-1); }
/* Data-view tone pairs (§ 3) */
.kit-page .tone-blue { --tone: #3F8FD8; --tone-soft: rgba(63,143,216,.12); }
.kit-page .tone-amber { --tone: #B77B1D; --tone-soft: #FFF3D8; }
.kit-page .tone-green { --tone: #31865A; --tone-soft: #E5F4EB; }
.kit-page .tone-violet { --tone: #766790; --tone-soft: #F0ECF5; }
.kit-page .tone-red { --tone: #C4443C; --tone-soft: #FCEFEE; }
.kit-page .tone-slate { --tone: #657784; --tone-soft: #EDF1F4; }
.kit-page .tone-navy { --tone: #1D3F5B; --tone-soft: #E8EEF3; }
.kit-page .tone-teal { --tone: #0E7177; --tone-soft: #E3F2F2; }
/* ── Identity area (§ 4) ──────────────────────────────────────────────── */
/* Light identity area: soft sky-to-lavender tint, two decorative rings, navy text.
   Widgets placed on it use the --hero-* variables (glass = white chip/box on the tint). */
.kit-hero { --hero-ink: var(--dash-brand-navy, #1D3F5B); --hero-glass: #fff; --hero-glass-line: #d3e4f2; --hero-glass-hover: #f3f8fc; --hero-glass-active: var(--dash-primary-soft, #e8f0f4); --hero-focus: rgba(50,114,155,.35);
  align-items: center; background: linear-gradient(115deg, #e2effa 0%, #edf5fc 48%, #f2f0fc 100%); border: 1px solid #d3e4f2; border-radius: var(--dash-radius-hero); box-shadow: 0 6px 20px rgba(29,63,91,.06); color: var(--hero-ink); display: flex; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 14px; overflow: hidden; padding: 22px 26px; position: relative; }
.kit-hero::before, .kit-hero::after { border-radius: 50%; content: ""; pointer-events: none; position: absolute; }
.kit-hero::before { border: 28px solid rgba(50,114,155,.06); height: 260px; inset-block-start: -120px; inset-inline-end: -60px; width: 260px; }
.kit-hero::after { background: rgba(124,108,214,.08); height: 140px; inset-block-end: -70px; inset-inline-end: 220px; width: 140px; }
.kit-hero > * { position: relative; z-index: 1; }
/* Header band (dashboards, Activate Ward): light sky-to-lavender tint so it reads as the page header above the white cards;
   one soft ring at the end edge; title on the start side, inline figures and controls on the end side. */
/* The ring is part of the background (not a pseudo-element), so the header needs no overflow clipping and tooltips can leave it. */
.kit-hero { --hero-ring: radial-gradient(circle at calc(100% + 40px) -60px, transparent 0 86px, rgba(50,114,155,.06) 87px 108px, transparent 109px);
  background: var(--hero-ring), linear-gradient(115deg, #e2effa 0%, #edf5fc 50%, #f1effc 100%); border: 1px solid #d3e4f2; border-radius: var(--dash-radius-card, 16px); box-shadow: 0 6px 18px rgba(29,63,91,.06); gap: 10px 20px; min-height: 0; overflow: visible; padding: 17px 20px; position: relative; }
[dir="rtl"] .kit-hero, .kit-page[dir="rtl"] .kit-hero { --hero-ring: radial-gradient(circle at -40px -60px, transparent 0 86px, rgba(50,114,155,.06) 87px 108px, transparent 109px); }
.kit-hero::after { display: none; }
.kit-hero::before { display: none; }
.kit-hero > * { position: relative; z-index: 1; }
.kit-hero .kit-title-icon { background: #fff; box-shadow: inset 0 0 0 1px #d3e4f2, 0 2px 6px rgba(29,63,91,.06); }
.kit-hero__copy { flex: 1 1 260px; min-width: 0; }
.kit-hero :is(h1, h2) { color: var(--dash-brand-navy, #1D3F5B); font-size: 18px; font-weight: 700; letter-spacing: -.005em; line-height: 1.3; margin: 0; }
.kit-hero__copy > :not(h1) { margin-top: 0px !important; }
.kit-hero__stats { align-items: center; gap: 0; }
.kit-hero__stats > div, .kit-hero__stats > .kit-ring { background: none; border: 0; border-inline-start: 1px solid var(--dash-line, #e5eaf0); border-radius: 0; box-shadow: none; gap: 0; min-width: 0; padding: 0 16px; }
.kit-hero__stats > div:first-child { border-inline-start: 0; }
.kit-hero__stats dt { font-size: 11px; white-space: nowrap; }
.kit-hero__stats dd { font-size: 18px; line-height: 1.2; }
.kit-hero .kit-ring { align-items: center; column-gap: 8px; display: grid; grid-template-areas: "ring dt" "ring dt"; grid-template-columns: auto auto; }
.kit-hero .kit-ring dt { grid-area: dt; }
.kit-hero .kit-ring dd { grid-area: ring; height: 38px; width: 38px; }
.kit-hero .kit-ring dd span { font-size: 10.5px; height: 30px; width: 30px; }
/* Header actions sit side by side at the end; they wrap only when the row has no room. */
.kit-hero__side { align-items: center; display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px 10px; justify-content: flex-end; margin-bottom: 0; }
.kit-hero .kit-refresh { height: 40px; }
.kit-refresh.kit-refresh--icon { justify-content: center; padding: 0; width: 40px; }
.kit-hero .kit-updated { order: -1; }
/* Tooltips in the header open below the control. */
.kit-hero [data-kit-tip]::after { bottom: auto; top: calc(100% + 8px); transform: translateY(-4px); }
.kit-hero [data-kit-tip]::before { border-bottom-color: #1D3F5B; border-top-color: transparent; bottom: auto; top: calc(100% - 4px); transform: translateY(-4px); }
.kit-hero [data-kit-tip]:hover::after, .kit-hero [data-kit-tip]:hover::before, .kit-hero [data-kit-tip]:focus-visible::after, .kit-hero [data-kit-tip]:focus-visible::before { transform: none; }
body.dark-mode .kit-hero [data-kit-tip]::before { border-bottom-color: #0f1117; border-top-color: transparent; }
/* Small white info chip on the header (e.g. file number). */
.kit-hero__chip { align-items: center; background: #fff; border: 1px solid #d3e4f2; border-radius: 10px; color: var(--dash-brand-navy, #1D3F5B); display: inline-flex; font-size: 13px; gap: 6px; height: 40px; padding: 0 12px; }
/* Header buttons: clearly readable on the tint — white, defined border, small lift, brand-coloured icon. */
.kit-hero .kit-button { background: #fff; border-color: #b9cfe1; box-shadow: 0 1px 2px rgba(16,24,40,.08); color: var(--dash-brand-navy, #1D3F5B); }
.kit-hero .kit-button i { color: var(--dash-primary, #32729B); }
.kit-hero .kit-button:hover:not(:disabled) { background: #f3f8fc; border-color: var(--dash-primary, #32729B); color: var(--dash-brand-navy, #1D3F5B); }
body.dark-mode .kit-hero .kit-button { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); box-shadow: none; color: #e2e8f0; }
body.dark-mode .kit-hero .kit-button i { color: #8fc3e6; }
/* Widgets on the tint (date box, ward chip, switchers) are white. */
.kit-hero { --hero-glass: #fff; --hero-glass-line: #b9cfe1; }
.kit-hero__stats > div, .kit-hero__stats > .kit-ring { border-inline-start-color: #cfdeeb; }
body.dark-mode .kit-hero { --hero-glass: rgba(255,255,255,.06); --hero-glass-line: rgba(255,255,255,.12); background: linear-gradient(115deg, #1c2d40 0%, #1d2a3d 50%, #241f3d 100%); border: 1px solid rgba(255,255,255,.08); box-shadow: none; }
body.dark-mode .kit-hero .kit-title-icon { background: rgba(94,155,196,.16); box-shadow: inset 0 0 0 1px rgba(143,195,230,.18); }
body.dark-mode .kit-hero :is(h1, h2) { color: #e2e8f0; }
body.dark-mode .kit-hero__chip { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); color: #e2e8f0; }
/* Page title inside a list card head (worklists): title, tabs, then tools pushed to the end. */
.kit-list__title { color: var(--dash-brand-navy, #1D3F5B); font-size: 18px; font-weight: 700; letter-spacing: -.005em; line-height: 1.3; margin: 0 8px 0 0; white-space: nowrap; }
[dir="rtl"] .kit-list__title, .kit-page[dir="rtl"] .kit-list__title { margin: 0 0 0 8px; }
.kit-list__head > .kit-list__tools { margin-inline-start: auto; }
.kit-list__head:has(> .kit-list__title) { justify-content: flex-start; }
body.dark-mode .kit-list__title { color: #e2e8f0; }
/* Icon tile before a page title (kit-hero h1 / kit-list__title). */
.kit-hero :is(h1, h2), .kit-list__title { align-items: center; display: inline-flex; gap: 10px; }
.kit-title-icon { background: var(--dash-primary-soft, #e8f0f4); border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(50,114,155,.12); color: var(--dash-primary, #32729B); display: grid; flex: none; font-size: 23px;     height: 40px;
    place-items: center;
    width: 40px;
    justify-content: center;
    align-items: center; }
body.dark-mode .kit-title-icon { background: rgba(94,155,196,.16); box-shadow: inset 0 0 0 1px rgba(143,195,230,.18); color: #8fc3e6; }
.kit-hero__copy { flex: 1 1 340px; min-width: 0; }
.kit-eyebrow { align-items: center; display: inline-flex; font-size: 11px; font-weight: 700; gap: 6px; letter-spacing: .08em; margin-bottom: 4px !important; opacity: .85; text-transform: uppercase; }
.kit-hero .kit-eyebrow { background: #fff; border: 1px solid #d3e4f2; border-radius: 999px; color: var(--dash-primary, #32729B); margin-bottom: 6px !important; opacity: 1; padding: 3px 10px; }
.kit-eyebrow i { font-size: 15px; }
.kit-hero h1 { color: var(--hero-ink); font-size: 18px; font-weight: 700; line-height: 1.25; }
/* No width cap: the lead uses the free space beside the stats and wraps only when it has to. */
.kit-hero__lead { color: #4b5d70; font-size: 13.5px; margin-top: 6px !important; max-width: none; }
.kit-hero__stats { align-items: center; display: flex; gap: 10px; }
.kit-hero__stats > div { background: #fff; border: 1px solid #dde9f3; box-shadow: 0 4px 12px rgba(29,63,91,.06); border-radius: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 112px; padding: 10px 14px; }
.kit-hero__stats dt { color: var(--dash-muted, #5f6c7b); font-size: 11.5px; font-weight: 500; }
.kit-hero__stats dd { color: var(--hero-ink); font-size: 22px; font-weight: 700; line-height: 1.1; }
.kit-ring { align-items: center; }
.kit-ring dd { background: conic-gradient(var(--dash-primary, #32729B) var(--ring, 0%), #dbe7f1 0); border-radius: 50%; display: grid; height: 54px; place-items: center; width: 54px; }
.kit-ring dd span { background: #fff; color: var(--hero-ink); border-radius: 50%; display: grid; font-size: 12.5px; font-weight: 700; height: 42px; place-items: center; width: 42px; }
.kit-refresh { align-items: center; background: var(--dash-primary, #32729B); border: 0; border-radius: var(--dash-radius-control); box-sizing: border-box; color: #fff; cursor: pointer; display: inline-flex; font: inherit; font-size: 13px; font-weight: 600; gap: 6px; height: 40px; padding: 0 14px; transition: background-color .15s; white-space: nowrap; }
.kit-refresh:hover:not(:disabled) { background: var(--dash-primary-strong, #285d80); }
.kit-refresh:disabled { cursor: wait; opacity: .75; }
.kit-refresh i { font-size: 18px; }
.kit-updated { align-items: center; color: var(--dash-muted, #5f6c7b); display: inline-flex; font-size: 11.5px; gap: 5px; white-space: nowrap; }
.kit-updated i { font-size: 14px; }
.kit-hero :focus-visible { outline-color: var(--dash-primary, #32729B); }
/* ── Quick actions (§ 5.9) ────────────────────────────────────────────── */
.kit-actions { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 14px; }
.kit-action { align-items: center; background: var(--dash-card); border: 1px solid var(--dash-line); border-radius: var(--dash-radius-tile); box-shadow: var(--dash-shadow-card); color: var(--dash-ink); display: flex; gap: 12px; min-width: 0; padding: 12px 14px; text-decoration: none; transition: transform .2s, box-shadow .2s, border-color .2s; }
.kit-action:hover { border-color: var(--tone); box-shadow: var(--dash-shadow-hover); color: var(--dash-ink); transform: translateY(-2px); }
.kit-action__icon { background: var(--tone-soft); border-radius: 10px; color: var(--tone); display: grid; flex: none; font-size: 20px; height: 40px; place-items: center; width: 40px; }
.kit-action__text { display: grid; flex: 1; min-width: 0; }
.kit-action__text strong { color: var(--dash-brand-navy); font-size: 13.5px; font-weight: 600; }
.kit-action__text small { color: var(--dash-muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-action > .kit-dir { color: var(--dash-muted); flex: none; font-size: 20px; }
/* ── Errors + loading (§ 9) ───────────────────────────────────────────── */
.kit-alert { align-items: center; background: #fff; border: 1px solid var(--line); border-inline-start: 4px solid var(--edge); border-radius: var(--dash-radius-tile); display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; padding: 12px 16px; }
.kit-alert--error { --line: #f0c3bf; --edge: #E04B3F; --icon: #C4443C; --icon-bg: #FCEAE8; --text: #a63b33; }
.kit-alert--warning { --line: #fedf89; --edge: #D99A32; --icon: #b54708; --icon-bg: #fef0c7; --text: #7a5200; }
.kit-alert__icon { background: var(--icon-bg); border-radius: 50%; color: var(--icon); display: grid; flex: none; font-size: 20px; height: 36px; place-items: center; width: 36px; }
.kit-alert__text { color: var(--text); flex: 1; font-weight: 600; }
.kit-btn { align-items: center; background: #fff; border: 1px solid var(--dash-line); border-radius: var(--dash-radius-control); color: var(--dash-primary); cursor: pointer; display: inline-flex; font: inherit; font-weight: 600; gap: 5px; min-height: 36px; padding: 5px 12px; }
.kit-btn:hover { background: var(--dash-soft); }
.kit-skeleton { display: grid; gap: 14px; }
.kit-skeleton__row { display: grid; gap: 12px; }
.kit-skeleton__row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kit-skeleton__row--4 span { height: 116px; }
.kit-skeleton__row--2 { grid-template-columns: 1.7fr 1fr; }
.kit-skeleton__row--2 span { height: 280px; }
.kit-skeleton span { animation: kit-shimmer 1.4s ease-in-out infinite; background: linear-gradient(90deg, #e9eef3 0%, #f5f8fa 50%, #e9eef3 100%); background-size: 200% 100%; border-radius: 14px; display: block; }
@keyframes kit-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.kit-content { transition: opacity .2s; }
.kit-content.is-refreshing { opacity: .55; pointer-events: none; }
/* ── Attention strip (§ 5.4) ──────────────────────────────────────────── */
.kit-attention { background: var(--dash-card); border: 1px solid var(--dash-line); border-radius: var(--dash-radius-tile); box-shadow: var(--dash-shadow-card); display: grid; gap: 10px; grid-template-columns: auto repeat(var(--kit-cols, 3), minmax(0, 1fr)); margin-bottom: 14px; padding: 10px; }
.kit-attention__title { align-items: center; color: var(--dash-brand-navy); display: flex; font-size: 13.5px; font-weight: 700; gap: 8px; padding-inline: 8px 6px; white-space: nowrap; }
.kit-attention__title i { color: #C4443C; font-size: 18px; }
.kit-attention__item { align-items: center; background: var(--tone-soft); border: 1px solid transparent; border-radius: 10px; color: inherit; display: flex; gap: 10px; min-width: 0; padding: 8px 12px; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.kit-attention__item:hover { border-color: var(--tone); box-shadow: var(--dash-shadow-hover); color: inherit; }
.kit-attention__icon { color: var(--tone); flex: none; font-size: 20px; }
.kit-attention__text { display: grid; flex: 1; min-width: 0; }
.kit-attention__text span { font-size: 12.5px; font-weight: 600; }
.kit-attention__text small { color: var(--dash-muted); font-size: 11px; }
.kit-attention__item strong { color: var(--tone); font-size: 20px; font-weight: 700; line-height: 1; }
.kit-attention__item.is-zero, .kit-attention__item.is-failed { background: #f6f8fa; }
.kit-attention__item.is-zero .kit-attention__icon, .kit-attention__item.is-zero strong,
.kit-attention__item.is-failed .kit-attention__icon, .kit-attention__item.is-failed strong { color: #9aa8b2; }
.kit-attention__item.is-failed small { color: #b54708; }
/* ── Headline metrics (§ 5.2) ─────────────────────────────────────────── */
.kit-kpis { display: grid; gap: 14px; grid-template-columns: repeat(var(--kit-cols, 4), minmax(0, 1fr)); margin-bottom: 18px; }
.kit-kpi { background: var(--dash-card); border: 1px solid var(--dash-line); border-inline-start: 4px solid var(--tone); border-radius: 12px; box-shadow: var(--dash-shadow-card); display: flex; flex-direction: column; gap: 8px; min-height: 116px; min-width: 0; padding: 14px 16px; position: relative; transition: box-shadow .15s; }
.kit-kpi:has(.kit-kpi__link):hover { box-shadow: var(--dash-shadow-hover); }
.kit-kpi__header { align-items: center; display: flex; gap: 10px; min-width: 0; }
.kit-kpi__icon { background: var(--tone-soft); border-radius: 9px; color: var(--tone); display: grid; flex: none; font-size: 18px; height: 34px; place-items: center; width: 34px; }
.kit-kpi__label { color: var(--dash-label); font-size: 13px; font-weight: 600; line-height: 1.3; }
.kit-kpi__value { color: var(--dash-brand-navy); font-size: 28px; font-weight: 700; line-height: 1.05; }
.kit-kpi__progress { background: var(--dash-track); border-radius: 999px; height: 6px; overflow: hidden; }
.kit-kpi__progress span { background: var(--tone); border-radius: inherit; display: block; height: 100%; transition: width .4s ease; }
.kit-kpi__helper { color: var(--dash-muted); font-size: 12px; margin-top: auto !important; }
/* Stretched link: the whole card opens its list, without nesting interactive content. */
.kit-kpi__link { border-radius: inherit; inset: 0; position: absolute; }
.kit-kpi__link:focus-visible { outline-offset: -2px; }
/* ── Cards (§ 5.1) ────────────────────────────────────────────────────── */
.kit-layout { align-items: start; display: grid; gap: 18px; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.kit-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.kit-card { background: var(--dash-card); border: 1px solid var(--dash-line); border-radius: var(--dash-radius-card); box-shadow: var(--dash-shadow-card); min-width: 0; padding: 18px 20px; }
.kit-card__header { align-items: center; display: flex; gap: 12px; margin-bottom: 16px; min-width: 0; }
.kit-card__header > div { flex: 1; min-width: 0; }
.kit-card__header h2 { font-size: 15px; font-weight: 600; line-height: 1.35; }
.kit-card__header p { color: var(--dash-muted); font-size: 12px; }
/* Divided card header: compact icon, title with an inline count, actions at the end, thin rule under it.
   <header class="kit-card__header kit-card__header--divided"><span class="kit-tile tone-x"><i/></span><div><h2>Title<span class="kit-card__count">3</span></h2></div>…actions</header> */
.kit-card__header--divided { border-bottom: 1px solid var(--dash-line, #e5eaf0); gap: 10px; margin: -2px -18px 12px; padding: 0 18px 12px; }
.kit-card__header--divided .kit-tile { border-radius: 9px; font-size: 16px; height: 30px; width: 30px; }
.kit-card__header--divided h2 { align-items: center; color: var(--dash-brand-navy, #1D3F5B); display: flex; font-size: 14px; font-weight: 600; gap: 8px; letter-spacing: -.005em; margin: 0; }
.kit-card__header--divided .kit-link { font-size: 12px; padding: 4px 6px; }
.kit-card__count { background: var(--dash-soft, #f5f8fc); border: 1px solid var(--dash-line, #e5eaf0); border-radius: 999px; color: var(--dash-label, #344054); font-size: 11px; font-weight: 700; line-height: 18px; min-width: 22px; padding: 0 7px; text-align: center; }
body.dark-mode .kit-card__count { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: var(--dash-ink); }
.kit-tile { background: var(--tone-soft, var(--dash-primary-soft)); border-radius: 11px; color: var(--tone, var(--dash-primary)); display: grid; flex: none; font-size: 20px; height: 38px; place-items: center; width: 38px; }
.kit-chip { background: #edf4f6; border-radius: 999px; color: var(--dash-brand-navy); flex: none; font-size: 12px; font-weight: 700; padding: 4px 10px; }
.kit-count { background: var(--tone-soft); border-radius: var(--dash-radius-pill); color: var(--tone); font-size: 12px; font-weight: 700; margin-inline-start: auto; padding: 1px 9px; }
.kit-link { align-items: center; background: none; border: 0; border-radius: 8px; cursor: pointer; font: inherit; color: var(--dash-primary); display: inline-flex; font-size: 12.5px; font-weight: 600; gap: 2px; margin-top: 8px; padding: 4px 6px; text-decoration: none; }
.kit-link:hover { background: var(--dash-soft); color: var(--dash-primary-strong); }
.kit-link i { font-size: 18px; }
/* ── Workflow stages (§ 5.7) ──────────────────────────────────────────── */
.kit-flow { display: grid; gap: 12px; grid-template-columns: repeat(var(--kit-cols, 3), minmax(0, 1fr)); }
.kit-flow__stage { align-items: flex-start; background: #f8fafb; border: 1px solid #edf1f4; border-radius: var(--dash-radius-tile); display: flex; gap: 12px; min-width: 0; padding: 14px; position: relative; }
.kit-flow__stage:not(:last-child)::after { background: #fff; border: 1px solid #dbe5ea; border-radius: 50%; color: #8ba0ac; content: "\203A"; display: grid; font-size: 16px; height: 22px; inset-block-start: 50%; inset-inline-end: -17px; line-height: 1; place-items: center; position: absolute; transform: translateY(-50%); width: 22px; z-index: 1; }
[dir="rtl"] .kit-flow__stage:not(:last-child)::after, .kit-page[dir="rtl"] .kit-flow__stage:not(:last-child)::after { transform: translateY(-50%) scaleX(-1); }
.kit-flow__icon { background: var(--tone-soft); border-radius: 10px; color: var(--tone); display: grid; flex: none; font-size: 19px; height: 38px; place-items: center; width: 38px; }
.kit-flow__body { display: grid; flex: 1; gap: 4px; min-width: 0; }
.kit-flow__body small { color: var(--dash-label); font-size: 12px; font-weight: 600; }
.kit-flow__body strong { font-size: 24px; font-weight: 700; line-height: 1.1; }
.kit-flow__bar { background: var(--dash-track); border-radius: 999px; display: block; height: 6px; margin-top: 4px; overflow: hidden; }
.kit-flow__bar span { background: var(--tone); border-radius: inherit; display: block; height: 100%; transition: width .4s ease; }
.kit-flow__pct { color: var(--dash-muted); font-size: 11.5px; }
/* ── Patient queues (§ 5.6) ───────────────────────────────────────────── */
/* Long names must truncate inside the column, never widen it. */
.kit-avatar { background: var(--tone-soft, var(--dash-primary-soft)); border-radius: 50%; color: var(--tone, var(--dash-primary)); display: grid; flex: none; font-size: 15px; height: 30px; place-items: center; width: 30px; }
/* ── Line trend (§ 6.1: fixed-height plot, absolute SVG, HTML dots, LTR) ── */
.kit-trend { display: flex; flex-direction: column; }
.kit-trend__plot { display: grid; gap: 8px; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 190px; }
.kit-trend__y { min-height: 0; position: relative; }
.kit-trend__y span { color: var(--dash-muted); font-size: 11px; inset-inline-end: 0; position: absolute; transform: translateY(-50%); }
.kit-trend__chart { min-height: 0; min-width: 0; position: relative; }
.kit-trend svg { display: block; height: 100%; inset: 0; overflow: visible; position: absolute; width: 100%; }
.kit-trend line { stroke: #e6edf1; stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.kit-trend polygon { fill: rgba(14, 113, 119, .1); }
.kit-trend polyline { fill: none; stroke: var(--dash-brand-teal); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.kit-trend__dot { background: #fff; border: 2px solid var(--dash-brand-teal); border-radius: 50%; height: 9px; position: absolute; transform: translate(-50%, -50%); width: 9px; }
.kit-trend__dot:hover { background: var(--dash-brand-teal); }
.kit-trend__x { color: var(--dash-muted); display: flex; font-size: 11px; font-weight: 600; justify-content: space-between; margin-top: 6px; padding-inline-start: 42px; }
/* ── Donut + bar list (§ 6.1) ─────────────────────────────────────────── */
.kit-donut-wrap { align-items: center; display: grid; gap: 18px; grid-template-columns: 124px minmax(0, 1fr); }
.kit-donut { align-items: center; border-radius: 50%; display: flex; flex-direction: column; height: 124px; justify-content: center; position: relative; width: 124px; }
.kit-donut::after { background: #fff; border-radius: 50%; content: ""; height: 82px; position: absolute; width: 82px; }
.kit-donut strong, .kit-donut small { position: relative; z-index: 1; }
.kit-donut strong { font-size: 22px; line-height: 1.1; }
.kit-donut small { color: var(--dash-muted); font-size: 11px; }
.kit-legend { display: grid; gap: 10px; min-width: 0; }
.kit-legend li { align-items: center; display: grid; gap: 8px; grid-template-columns: 10px minmax(0, 1fr) auto; }
.kit-legend i { border-radius: 3px; height: 10px; width: 10px; }
.kit-legend span { color: var(--dash-label); font-size: 12.5px; }
.kit-legend strong { font-size: 14px; }
.kit-bars { align-content: start; display: grid; gap: 13px; }
.kit-bars li { display: grid; gap: 5px; }
.kit-bars__label { align-items: center; display: flex; gap: 8px; min-width: 0; }
.kit-bars__label i { border-radius: 3px; flex: none; height: 10px; width: 10px; }
.kit-bars__label span { color: var(--dash-label); flex: 1; font-size: 12.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-bars__label strong { font-size: 13px; }
.kit-bars__label small { color: var(--dash-muted); font-size: 11.5px; min-width: 34px; text-align: end; }
.kit-bars__track { background: var(--dash-track); border-radius: 999px; height: 8px; overflow: hidden; }
.kit-bars__track span { border-radius: inherit; display: block; height: 100%; transition: width .4s ease; }
/* ── Empty (§ 9) ──────────────────────────────────────────────────────── */
.kit-empty { align-items: center; background: var(--dash-soft); border: 1px dashed #cdd5df; border-radius: var(--dash-radius-tile); color: var(--dash-muted); display: flex; flex-direction: column; gap: 6px; justify-content: center; min-height: 140px; padding: 16px; text-align: center; }
.kit-empty i { color: #94a3b8; font-size: 26px; }
.kit-empty--good i { color: #399C6A; }
/* ── Responsive (§ 10) ────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kit-layout { grid-template-columns: minmax(0, 1fr); }
  .kit-kpis, .kit-skeleton__row--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kit-attention { grid-template-columns: repeat(var(--kit-cols-md, 3), minmax(0, 1fr)); }
  .kit-attention__title { grid-column: 1 / -1; padding: 2px 4px; }
}
@media (max-width: 768px) {
  .kit-hero { border-radius: 14px; padding: 15px 16px; }
  .kit-hero :is(h1, h2) { font-size: 17px; }
  .kit-hero__side { justify-content: flex-start; }
  .kit-hero__stats { width: 100%; }
  .kit-hero__stats > div { flex: 1 1 110px; }
  .kit-hero__side { width: 100%; }
  .kit-refresh { justify-content: center; width: 100%; }
  .kit-attention, .kit-kpis, .kit-flow, .kit-skeleton__row--2 { grid-template-columns: minmax(0, 1fr); }
  .kit-flow__stage:not(:last-child)::after { inset-block-end: -17px; inset-block-start: auto; inset-inline-end: 50%; transform: translateX(50%) rotate(90deg); }
  [dir="rtl"] .kit-flow__stage:not(:last-child)::after { transform: translateX(-50%) rotate(90deg); }
  .kit-card { padding: 16px; }
  .kit-donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .kit-legend { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .kit-page *, .kit-page *::before, .kit-page *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .kit-action:hover { transform: none; }
}

/* ── Stat cards (census) ─────────────────────────────────────────────── */
.kit-stats { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.kit-stat { align-items: center; background: var(--dash-card); border: 1px solid var(--dash-line); border-radius: var(--dash-radius-card); box-shadow: var(--dash-shadow-card); color: inherit; display: flex; gap: 13px; min-height: 92px; min-width: 0; padding: 16px 18px; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.kit-stat:hover { border-color: var(--tone); box-shadow: var(--dash-shadow-hover); color: inherit; }
@media (max-width: 1200px) {
  .kit-stats, .kit-skeleton__row--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .kit-attention, .kit-stats { grid-template-columns: minmax(0, 1fr); }
}

/* ── Progress strip (§ 5.5) ──────────────────────────────────────────── */
.kit-progress { align-items: center; display: flex; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 18px; }
.kit-scope-tag { background: var(--dash-primary-soft); border-radius: 999px; color: var(--dash-primary); font-size: 10.5px; letter-spacing: .02em; padding: 1px 8px; }
.kit-bar { background: var(--dash-track); border-radius: 999px; flex: 3 1 300px; height: 10px; overflow: hidden; }
.kit-bar span { background: var(--dash-success); border-radius: inherit; display: block; height: 100%; transition: width .4s ease; }

/* ── Dark mode (the app toggles body.dark-mode; palette matches the global dark theme) ── */
body.dark-mode .kit-page {
  --dash-card: #1a2035; --dash-soft: #212a40; --dash-line: rgba(255,255,255,.09); --dash-track: rgba(255,255,255,.08);
  --dash-ink: #e2e8f0; --dash-label: #c9d1d9; --dash-muted: #94a3b8; --dash-brand-navy: #e2e8f0;
  --dash-primary: #6fb1dc; --dash-primary-strong: #8fc3e6; --dash-primary-soft: rgba(111,177,220,.14);
  --dash-shadow-card: 0 6px 20px rgba(0,0,0,.28); --dash-shadow-hover: 0 8px 24px rgba(0,0,0,.4);
  color: var(--dash-ink);
}
body.dark-mode .kit-page .tone-blue { --tone: #6fb1ec; --tone-soft: rgba(63,143,216,.18); }
body.dark-mode .kit-page .tone-amber { --tone: #e8b45a; --tone-soft: rgba(217,154,50,.16); }
body.dark-mode .kit-page .tone-green { --tone: #5cc58f; --tone-soft: rgba(57,156,106,.18); }
body.dark-mode .kit-page .tone-violet { --tone: #b3a6cc; --tone-soft: rgba(142,128,168,.2); }
body.dark-mode .kit-page .tone-red { --tone: #f07a72; --tone-soft: rgba(224,75,63,.18); }
body.dark-mode .kit-page .tone-slate { --tone: #a3b3bf; --tone-soft: rgba(163,179,191,.14); }
body.dark-mode .kit-page .tone-navy { --tone: #9fc0dc; --tone-soft: rgba(159,192,220,.14); }
body.dark-mode .kit-page .tone-teal { --tone: #4fc1c7; --tone-soft: rgba(14,113,119,.28); }
/* Surfaces the light theme paints with fixed colours. */
body.dark-mode .kit-hero { --hero-ink: #e2e8f0; --hero-glass: rgba(255,255,255,.06); --hero-glass-line: rgba(255,255,255,.12); --hero-glass-hover: rgba(255,255,255,.10); --hero-glass-active: rgba(255,255,255,.14); --hero-focus: rgba(110,170,210,.45);
  background: linear-gradient(115deg, #1c2d40 0%, #1d2a3d 50%, #241f3d 100%); border-color: rgba(255,255,255,.08); box-shadow: none; }
body.dark-mode .kit-hero .kit-eyebrow { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); color: #8fc3e6; }
body.dark-mode .kit-hero__lead { color: #a9b6c6; }
body.dark-mode .kit-hero__stats > div { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); box-shadow: none; }
body.dark-mode .kit-page .kit-ring dd { background: conic-gradient(#5e9bc4 var(--ring, 0%), rgba(255,255,255,.1) 0); }
body.dark-mode .kit-page .kit-ring dd span { background: var(--dash-card); }
body.dark-mode .kit-page .kit-alert, body.dark-mode .kit-page .kit-btn { background: var(--dash-card); }
body.dark-mode .kit-page .kit-alert--error { --line: rgba(224,75,63,.4); --icon: #f07a72; --icon-bg: rgba(224,75,63,.16); --text: #f3a29c; }
body.dark-mode .kit-page .kit-alert--warning { --line: rgba(217,154,50,.4); --icon: #e8b45a; --icon-bg: rgba(217,154,50,.16); --text: #f0c987; }
body.dark-mode .kit-page .kit-btn:hover { background: var(--dash-soft); }
body.dark-mode .kit-page .kit-skeleton span { background: linear-gradient(90deg, #1f2740 0%, #2a3350 50%, #1f2740 100%); background-size: 200% 100%; }
body.dark-mode .kit-page .kit-attention__item.is-zero, body.dark-mode .kit-page .kit-attention__item.is-failed { background: rgba(255,255,255,.04); }
body.dark-mode .kit-page .kit-attention__item.is-zero .kit-attention__icon, body.dark-mode .kit-page .kit-attention__item.is-zero strong { color: #64748b; }
body.dark-mode .kit-page .kit-chip { background: rgba(255,255,255,.08); color: var(--dash-ink); }
body.dark-mode .kit-page .kit-flow__stage { background: var(--dash-soft); border-color: var(--dash-line); }
body.dark-mode .kit-page .kit-flow__stage:not(:last-child)::after { background: var(--dash-card); border-color: var(--dash-line); color: var(--dash-muted); }
body.dark-mode .kit-page .kit-donut::after { background: var(--dash-card); }
body.dark-mode .kit-page .kit-trend line { stroke: rgba(255,255,255,.1); }
body.dark-mode .kit-page .kit-trend polygon { fill: rgba(79,193,199,.14); }
body.dark-mode .kit-page .kit-trend polyline { stroke: #4fc1c7; }
body.dark-mode .kit-page .kit-trend__dot { background: var(--dash-card); border-color: #4fc1c7; }
body.dark-mode .kit-page .kit-empty { border-color: rgba(255,255,255,.14); }
body.dark-mode .kit-page .kit-empty i { color: #64748b; }
body.dark-mode .kit-page .kit-avatar { background: var(--dash-primary-soft); color: var(--dash-primary); }
body.dark-mode .kit-page .kit-scope-tag { background: var(--dash-primary-soft); color: var(--dash-primary); }

/* =============================================================================
   Shared controls — buttons, tabs / segmented switches, filter bars, tables.
   Use these instead of re-styling them in each component. They carry fallbacks,
   so they also work in dialogs/footers that are not inside .kit-page.
   ============================================================================= */
.kit-nowrap { white-space: nowrap; }
.kit-sub { color: var(--dash-muted, #5f6c7b); display: block; font-size: 11.5px; font-weight: 500; line-height: 1.35; }
.kit-ellipsis { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-sep { color: #b8c2cc; margin-inline: 4px; }

/* ── Buttons ──────────────────────────────────────────────────────────────
   .kit-button (40px) · --lg (45px, same height as the floating-label fields) · --primary · --danger · --danger-outline
   .kit-icon-btn (32px square, add title + aria-label) · --primary · --danger · --success */
.kit-button {   font-weight: 500 !important;  font-size: 14px !important;align-items: center; background: var(--dash-card, #fff); border: 1px solid var(--dash-line, #e5eaf0); border-radius: var(--dash-radius-control, 10px); color: var(--dash-label, #344054); cursor: pointer; display: inline-flex; flex: none; font: inherit; font-size: 13px; font-weight: 600; gap: 6px; height: 40px; justify-content: center; padding: 0 14px; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s; white-space: nowrap; }
.kit-button i { font-size: 18px; }
.kit-button:hover:not(:disabled) { background: var(--dash-soft, #f5f8fc); color: var(--dash-brand-navy, #1D3F5B); }
.kit-button:disabled { cursor: not-allowed; opacity: .55; }
.kit-button--lg { height: 45px; min-width: 110px; }
.kit-button--primary { background: #32729B; border-color: #32729B; color: #fff; }
.kit-button--primary:hover:not(:disabled) { background: #285d80; border-color: #285d80; color: #fff; }
.kit-button--danger { background: #C4443C; border-color: #C4443C; color: #fff; }
.kit-button--danger:hover:not(:disabled) { background: #a63b33; border-color: #a63b33; color: #fff; }
.kit-button--danger-outline { background: transparent; border-color: #d92d20; color: #d92d20; }
.kit-button--danger-outline:hover:not(:disabled) { background: #d92d20; border-color: #d92d20; color: #fff; }
.kit-icon-btn { align-items: center; background: var(--dash-card, #fff); border: 1px solid var(--dash-line, #e5eaf0); border-radius: 8px; color: var(--dash-label, #344054); cursor: pointer; display: inline-flex; flex: none; font-size: 16px; height: 32px; justify-content: center; padding: 0; transition: background-color .15s, border-color .15s, color .15s; width: 32px; }
.kit-icon-btn:hover:not(:disabled) { background: var(--dash-soft, #f5f8fc); border-color: #cdd5df; color: var(--dash-brand-navy, #1D3F5B); }
.kit-icon-btn:disabled { cursor: not-allowed; opacity: .4; }
.kit-icon-btn--primary { background: var(--dash-primary-soft, #e8f0f4); border-color: transparent; color: var(--dash-primary, #32729B); }
.kit-icon-btn--primary:hover:not(:disabled) { background: #32729B; border-color: #32729B; color: #fff; }
.kit-icon-btn--danger { color: #C4443C; }
.kit-icon-btn--danger:hover:not(:disabled) { background: #FCEFEE; border-color: #f0c3bf; color: #C4443C; }
.kit-icon-btn--success { color: #31865A; }
.kit-icon-btn--success:hover:not(:disabled) { background: #E5F4EB; border-color: #91d5b2; color: #31865A; }
.kit-actions-row { align-items: center; display: inline-flex; flex-wrap: nowrap; gap: 6px; white-space: nowrap; }

/* ── Segmented switch (view switchers, sort, presets) ─────────────────────
   <div class="kit-segmented"><button class="is-active">…</button>…</div>
   --sm for compact rows; --on-hero inside the gradient identity area; tone-* on a button colours its icon. */
.kit-segmented {     font-size: 14px;
    font-weight: 500; align-items: center; background: var(--dash-soft, #f5f8fc); border: 1px solid var(--dash-line, #e5eaf0); border-radius: var(--dash-radius-control, 10px); display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; }
.kit-segmented > :is(button, a) { align-items: center; background: transparent; border: 0; text-decoration: none; border-radius: 8px; color: var(--dash-label, #344054); cursor: pointer; display: inline-flex; font: inherit; font-size: 13px; font-weight: 600; gap: 6px; min-height: 34px; padding: 0 14px; transition: background-color .15s, color .15s, box-shadow .15s; white-space: nowrap; }
.kit-segmented > :is(button, a) i { font-size: 17px; }
.kit-segmented > :is(button, a):hover { color: var(--dash-brand-navy, #1D3F5B); }
.kit-segmented > :is(button, a):is(.is-active, .active) { background: var(--dash-card, #fff); box-shadow: 0 1px 3px rgba(16,24,40,.12); color: var(--dash-primary, #32729B); }
.kit-segmented > :is(button, a):is(.is-active, .active)[class*="tone-"] { color: var(--dash-brand-navy, #1D3F5B); }
.kit-segmented > :is(button, a):is(.is-active, .active)[class*="tone-"] i { color: var(--tone); }
/* Second-level navigation inside a chart section (Problems, Clinical…). */
.kit-subnav { margin-bottom: 16px; }
.kit-segmented__sep { background: var(--dash-line, #e5eaf0); height: 20px; margin: 0 4px; width: 1px; }
.kit-segmented--sm > :is(button, a) { font-size: 12.5px; min-height: 30px; }
.kit-segmented--on-hero { background: var(--hero-glass, #fff); border-color: var(--hero-glass-line, #b9cfe1); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.kit-segmented--on-hero > :is(button, a) { color: var(--dash-brand-navy, #1D3F5B); font-size: 13px; min-height: 35px; }
.kit-segmented--on-hero > :is(button, a) i { color: var(--dash-primary, #32729B); }
/* The chosen option is filled with the brand colour so the current mode is obvious. */
.kit-segmented--on-hero > :is(button, a).is-active { background: var(--dash-primary, #32729B); box-shadow: 0 1px 3px rgba(50,114,155,.35); color: #fff; }
.kit-segmented--on-hero > :is(button, a).is-active i { color: #fff; }

/* ── Underline tabs (inside a card) ───────────────────────────────────────
   <nav class="kit-tabs"><button class="kit-tab is-active"><i></i>Label<span class="kit-tab__count">3</span></button></nav> */
.kit-tabs { border-bottom: 1px solid var(--dash-line, #e5eaf0); display: flex; flex-wrap: wrap; gap: 0 4px; padding: 0 12px; }
.kit-tab { align-items: center; background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--dash-muted, #5f6c7b); cursor: pointer; display: inline-flex; flex: none; font: inherit; font-size: 13px; font-weight: 600; gap: 7px; margin-bottom: -1px; padding: 14px 12px 11px; transition: color .15s, border-color .15s; white-space: nowrap; }
.kit-tab i { font-size: 17px; }
.kit-tab:hover { color: var(--dash-brand-navy, #1D3F5B); }
.kit-tab.is-active { border-bottom-color: var(--dash-primary, #32729B); color: var(--dash-primary, #32729B); }
.kit-tab__count { background: var(--dash-track, #edf3f6); border-radius: 999px; color: var(--dash-label, #344054); font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 7px; }
.kit-tab.is-active .kit-tab__count { background: var(--dash-primary, #32729B); color: #fff; }

/* ── List card: header row (switcher + tools), filter bar, table, pagination ─
   <section class="kit-card kit-list"><header class="kit-list__head">…<div class="kit-list__tools">…</div></header>
   <form class="kit-filters">…</form> <div class="kit-table-wrap">…</div> <app-pagination> */
.kit-list { overflow: hidden; padding: 0; }
.kit-list__head { align-items: center; border-bottom: 1px solid var(--dash-line); display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding: 12px 18px; }
.kit-list__tools { display: flex; flex-wrap: wrap; gap: 8px; }
.kit-list > .kit-alert { margin: 0 18px 14px; }
.kit-list > .kit-empty { margin: 0 18px 18px; }
.kit-list > .kit-skeleton { padding: 0 18px 18px; }
.kit-list > .kit-skeleton span { height: 52px; }
.kit-list > .kit-table-wrap { border-bottom: 0; border-inline: 0; border-radius: 0; }
.kit-list app-pagination { border-top: 1px solid var(--dash-line); display: block; padding: 10px 18px; }

/* Filter bar with floating-label fields (.input-block.local-forms + .form-control / p-dropdown / p-calendar). */
.kit-filters { align-items: flex-start; display: flex; flex-wrap: wrap; gap: 22px 14px; padding: 24px 18px 16px; }
.kit-card.kit-filters { margin-bottom: 14px; }
.kit-field { flex: 1 1 170px; margin-bottom: 0 !important; min-width: 0; position: relative; }
/* Beat the theme’s ".xxx .local-forms.input-block { margin-bottom: … !important }" rules; spacing comes from the grid/flex gap. */
.kit-page .kit-field.local-forms.input-block, .kit-field.local-forms.input-block { margin-bottom: 0 !important; }
.kit-field--sm { flex: 0 1 190px; }
.kit-field--wide { flex: 2 1 260px; }
.kit-field--full { flex: 1 1 100%; }
.kit-field .p-calendar, .kit-field .p-dropdown { width: 100%; }
.kit-field--icon > i { color: #98a2b3; font-size: 17px; inset-block-start: 50%; inset-inline-start: 14px; pointer-events: none; position: absolute; transform: translateY(-50%); z-index: 1; }
.kit-field--icon .form-control { padding-inline-start: 40px; }
.kit-field textarea { resize: vertical; }
[dir="rtl"] .kit-page .local-forms label, .kit-page[dir="rtl"] .local-forms label { left: auto; right: 10px; }

/* ── Table ────────────────────────────────────────────────────────────────
   <div class="kit-table-wrap"><table class="kit-table kit-table--min-md">…<th class="kit-table__actions">…</table></div> */
.kit-table-wrap { border: 1px solid var(--dash-line, #e5eaf0); border-radius: var(--dash-radius-tile, 12px); overflow-x: auto; transition: opacity .2s; }
.kit-table-wrap.is-refreshing { opacity: .55; pointer-events: none; }
.kit-table { border-collapse: collapse; margin: 0; width: 100%; }
.kit-table th { background: var(--dash-soft, #f5f8fc); border: 0; color: var(--dash-muted, #5f6c7b); font-size: 11px; font-weight: 700; letter-spacing: .05em; padding: 10px 14px; text-align: start; text-transform: uppercase; white-space: nowrap; }
.kit-table td { border: 0; border-top: 1px solid var(--dash-line, #e5eaf0); color: var(--dash-ink, #172b4d); font-size: 13px; font-weight: 400; line-height: 1.4; padding: 10px 14px; vertical-align: middle; }
.kit-table tbody tr { transition: background-color .15s; }
.kit-table tbody tr:hover { background: var(--dash-soft, #f5f8fc); }
.kit-table .kit-table__actions {   width: 1%; }
/* Numbers keep aligned digits but follow the column header alignment (start), like every other cell. */
.kit-table .kit-num { font-variant-numeric: tabular-nums; text-align: start; white-space: nowrap; }
.kit-table td { text-align: start; }
.kit-table--min-sm { min-width: 560px; }
.kit-table--min-md { min-width: 760px; }
.kit-table--min-lg { min-width: 900px; }

/* Person cell: avatar + name + sub line. */
.kit-person { align-items: center; display: flex; gap: 10px; min-width: 0; }
.kit-person__text { display: flex; flex-direction: column; min-width: 0; }
.kit-person__text strong { font-size: 13px; font-weight: 600; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-person__text small { color: var(--dash-muted, #5f6c7b); font-size: 11.5px; }

/* Status / type pill: add a tone-* class (falls back to the primary colour). */
.kit-pill { align-items: center; background: var(--tone-soft, var(--dash-primary-soft, #e8f0f4)); border-radius: 999px; color: var(--tone, var(--dash-primary, #32729B)); display: inline-flex; font-size: 11.5px; font-weight: 600; gap: 4px; line-height: 1.5; padding: 2px 10px; white-space: nowrap; }
.kit-pill i { font-size: 14px; }

@media (max-width: 768px) {
  .kit-list__head > .kit-segmented, .kit-list__tools { flex: 1 1 100%; }
  .kit-list__head > .kit-segmented > :is(button, a), .kit-list__tools > .kit-button { flex: 1; justify-content: center; }
  .kit-segmented__sep { display: none; }
  .kit-filters > .kit-button { flex: 1 1 100%; }
}

/* Dark mode for the shared controls. */
body.dark-mode .kit-button { background: #1a2035; border-color: rgba(255,255,255,.09); color: #c9d1d9; }
body.dark-mode .kit-button:hover:not(:disabled) { background: #212a40; color: #e2e8f0; }
body.dark-mode .kit-button--primary { background: #32729B; border-color: #32729B; color: #fff; }
body.dark-mode .kit-button--primary:hover:not(:disabled) { background: #3d86b4; border-color: #3d86b4; color: #fff; }
body.dark-mode .kit-button--danger { background: #C4443C; border-color: #C4443C; color: #fff; }
body.dark-mode .kit-button--danger-outline { background: transparent; border-color: #f07a72; color: #f07a72; }
body.dark-mode .kit-icon-btn { background: #1a2035; border-color: rgba(255,255,255,.09); color: #c9d1d9; }
body.dark-mode .kit-icon-btn:hover:not(:disabled) { background: #212a40; border-color: rgba(255,255,255,.18); color: #e2e8f0; }
body.dark-mode .kit-icon-btn--primary { background: rgba(111,177,220,.14); border-color: transparent; color: #6fb1dc; }
body.dark-mode .kit-icon-btn--primary:hover:not(:disabled) { background: #32729B; color: #fff; }
body.dark-mode .kit-icon-btn--danger { color: #f07a72; }
body.dark-mode .kit-icon-btn--danger:hover:not(:disabled) { background: rgba(224,75,63,.16); border-color: rgba(224,75,63,.4); color: #f07a72; }
body.dark-mode .kit-icon-btn--success { color: #5cc58f; }
body.dark-mode .kit-icon-btn--success:hover:not(:disabled) { background: rgba(57,156,106,.18); border-color: rgba(57,156,106,.45); color: #5cc58f; }
body.dark-mode .kit-segmented > :is(button, a):is(.is-active, .active) { box-shadow: 0 1px 3px rgba(0,0,0,.4); }
body.dark-mode .kit-segmented--on-hero > :is(button, a) { color: #cbd5e1; }
body.dark-mode .kit-segmented--on-hero > :is(button, a) i { color: #8fc3e6; }
body.dark-mode .kit-segmented--on-hero > :is(button, a).is-active { background: #2d5878; color: #fff; }
body.dark-mode .kit-segmented--on-hero > :is(button, a).is-active i { color: #fff; }
body.dark-mode .kit-sep { color: #64748b; }

/* ── Tooltip for icon-only controls ───────────────────────────────────────
   <button class="kit-icon-btn" [attr.data-kit-tip]="'Label' | translate" [attr.aria-label]="'Label' | translate">
   Shows instantly on hover / keyboard focus; anchored to the control's end edge so it stays inside tables. */
[data-kit-tip] { position: relative; }
[data-kit-tip]::after { background: #1D3F5B; border-radius: 8px; bottom: calc(100% + 8px); box-shadow: 0 8px 20px rgba(16,24,40,.22); color: #fff; content: attr(data-kit-tip); font-size: 12px; font-weight: 600; inset-inline-end: 0; line-height: 1.3; opacity: 0; padding: 6px 10px; pointer-events: none; position: absolute; transform: translateY(4px); transition: opacity .15s, transform .15s; white-space: nowrap; z-index: 30; }
[data-kit-tip]::before { border: 6px solid transparent; border-top-color: #1D3F5B; bottom: calc(100% - 4px); content: ""; inset-inline-end: 10px; opacity: 0; pointer-events: none; position: absolute; transform: translateY(4px); transition: opacity .15s, transform .15s; z-index: 30; }
[data-kit-tip]:hover::after, [data-kit-tip]:hover::before, [data-kit-tip]:focus-visible::after, [data-kit-tip]:focus-visible::before { opacity: 1; transform: none; }
[data-kit-tip]:disabled::after, [data-kit-tip]:disabled::before { display: none; }
body.dark-mode [data-kit-tip]::after { background: #0f1117; box-shadow: 0 8px 20px rgba(0,0,0,.5); }
body.dark-mode [data-kit-tip]::before { border-top-color: #0f1117; }

/* ── Section header (list pages inside a card / chart tab) ────────────────
   <header class="kit-section-head"><span class="kit-tile tone-red"><i></i></span>
     <div class="kit-section-head__title"><h2>Title <span class="kit-section-head__count">3</span></h2><p>sub</p></div>
     <div class="kit-section-head__actions"><button class="kit-button kit-button--primary">…</button></div></header> */
.kit-section-head { align-items: center; border-bottom: 1px solid var(--dash-line, #e5eaf0); display: flex; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 16px; min-width: 0; padding-bottom: 14px; }
.kit-section-head > .kit-tile { border-radius: 12px; font-size: 21px; height: 42px; width: 42px; }
.kit-section-head__title { flex: 1 1 200px; min-width: 0; }
.kit-section-head__title h2 { align-items: center; color: var(--dash-brand-navy, #1D3F5B); display: flex; flex-wrap: wrap; font-size: 15.5px; font-weight: 600; gap: 8px; line-height: 1.35; margin: 0; }
.kit-section-head__title p { color: var(--dash-muted, #5f6c7b); font-size: 12.5px; margin: 2px 0 0; }
.kit-section-head__count { background: var(--dash-primary-soft, #e8f0f4); border-radius: 999px; color: var(--dash-primary, #32729B); font-size: 11.5px; font-weight: 700; line-height: 20px; min-width: 22px; padding: 0 7px; text-align: center; }
.kit-section-head__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }

/* ── Record cards (history entries, notes…) ───────────────────────────────
   <div class="kit-records"><article class="kit-record tone-blue">
     <header class="kit-record__head"><span class="kit-record__icon"><i></i></span>
       <div class="kit-record__title"><strong/><small/> or <span class="kit-record__tag"><i/>Label</span></div></header>
     <dl class="kit-record__fields"><div><dt/><dd/></div></dl> <p class="kit-record__note"/>
     <footer class="kit-record__meta"><span><i/>Author</span><span><i/>Date</span><div class="kit-actions-row">icon buttons</div></footer>
   </article></div>  (a single action may also sit at the end of the head) */
.kit-records { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.kit-record { background: var(--dash-card, #fff); border: 1px solid var(--dash-line, #e5eaf0); border-radius: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px 16px 10px; transition: border-color .15s, box-shadow .15s; }
.kit-record:hover { border-color: color-mix(in srgb, var(--tone, #32729B) 28%, var(--dash-line, #e5eaf0)); box-shadow: 0 8px 22px rgba(16,24,40,.07); }
.kit-record__head { align-items: center; display: flex; gap: 12px; min-width: 0; }
.kit-record__icon { background: var(--tone-soft, var(--dash-primary-soft, #e8f0f4)); border-radius: 12px; color: var(--tone, var(--dash-primary, #32729B)); display: grid; flex: none; font-size: 20px; height: 44px; place-items: center; width: 44px; }
.kit-record__title { align-items: flex-start; display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
.kit-record__title strong { color: var(--dash-brand-navy, #1D3F5B); font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.kit-record__title small { color: var(--dash-muted, #5f6c7b); font-size: 12px; }
.kit-record__tag { align-items: center; background: var(--tone-soft, var(--dash-primary-soft, #e8f0f4)); border-radius: 999px; color: var(--tone, var(--dash-primary, #32729B)); display: inline-flex; font-size: 11.5px; font-weight: 600; gap: 4px; line-height: 1.2; max-width: 100%; overflow: hidden; padding: 4px 10px; text-overflow: ellipsis; white-space: nowrap; }
.kit-record__tag i { flex: none; font-size: 13px; }
.kit-record__fields { border-top: 1px dashed var(--dash-line, #e5eaf0); display: grid; gap: 10px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding-top: 12px; }
.kit-record__fields > div { min-width: 0; }
.kit-record__fields > .is-wide { grid-column: 1 / -1; }
.kit-record__fields dt { color: var(--dash-muted, #5f6c7b); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.kit-record__fields dd { color: var(--dash-ink, #172b4d); font-size: 13px; font-weight: 500; margin: 2px 0 0; overflow-wrap: anywhere; }
.kit-record__note { background: var(--dash-soft, #f5f8fc); border-radius: 10px; color: var(--dash-label, #344054); font-size: 12.5px; line-height: 1.55; margin: 0; overflow-wrap: anywhere; padding: 10px 12px; white-space: pre-line; }
.kit-record__meta { align-items: center; border-top: 1px solid var(--dash-line, #e5eaf0); color: var(--dash-muted, #5f6c7b); display: flex; flex-wrap: wrap; font-size: 12px; gap: 4px 14px; margin-top: auto; min-height: 42px; padding-top: 8px; }
.kit-record__meta > span { align-items: center; display: inline-flex; gap: 5px; min-width: 0; white-space: nowrap; }
.kit-record__meta > span i { font-size: 15px; opacity: .8; }
.kit-record__meta > .kit-actions-row { gap: 2px; margin-inline-start: auto; }
/* Card actions: quiet ghost buttons, colour on hover. */
.kit-record :is(.kit-record__head, .kit-record__meta) .kit-icon-btn { background: transparent; border-color: transparent; color: var(--dash-muted, #5f6c7b); font-size: 16px; height: 30px; width: 30px; }
.kit-record :is(.kit-record__head, .kit-record__meta) .kit-icon-btn:hover:not(:disabled) { background: var(--dash-soft, #f5f8fc); border-color: transparent; color: var(--dash-brand-navy, #1D3F5B); }
.kit-record :is(.kit-record__head, .kit-record__meta) .kit-icon-btn--primary:hover:not(:disabled) { background: var(--dash-primary-soft, #e8f0f4); color: var(--dash-primary, #32729B); }
.kit-record :is(.kit-record__head, .kit-record__meta) .kit-icon-btn--danger:hover:not(:disabled) { background: #FCEFEE; color: #C4443C; }
.kit-record :is(.kit-record__head, .kit-record__meta) .kit-icon-btn--success:hover:not(:disabled) { background: #E5F4EB; color: #31865A; }
.kit-record__fields--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 768px) { .kit-record__fields--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
body.dark-mode .kit-record:hover { box-shadow: 0 8px 22px rgba(0,0,0,.35); }
body.dark-mode .kit-record :is(.kit-record__head, .kit-record__meta) .kit-icon-btn:hover:not(:disabled) { background: rgba(255,255,255,.08); }
body.dark-mode .kit-section-head__count { background: rgba(255,255,255,.08); color: var(--dash-ink, #e2e8f0); }

/* Skeleton rows for list loading states. */
.kit-skeleton--rows span { height: 44px; }

/* Removable tags (e.g. chronic diseases): <ul class="kit-tags"><li class="kit-tag tone-amber"><i/><span>Name</span><button class="kit-icon-btn">…</button></li></ul> */
.kit-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.kit-tag { align-items: center; background: var(--tone-soft, var(--dash-primary-soft, #e8f0f4)); border: 1px solid transparent; border-radius: 999px; color: var(--dash-ink, #172b4d); display: inline-flex; font-size: 13px; font-weight: 600; gap: 8px; padding: 4px 4px 4px 12px; }
[dir="rtl"] .kit-tag, .kit-page[dir="rtl"] .kit-tag { padding: 4px 12px 4px 4px; }
.kit-tag > i { color: var(--tone, var(--dash-primary, #32729B)); font-size: 15px; }
.kit-tag .kit-icon-btn { background: transparent; border-color: transparent; border-radius: 50%; height: 26px; width: 26px; }
.kit-tag:not(:has(button)) { padding: 4px 12px; }

/* Item rows (simple named records, e.g. chronic diseases): white rows with a soft tone accent, in an auto-fill grid.
   <ul class="kit-items"><li class="kit-item tone-amber"><span class="kit-item__icon"><i/></span><div class="kit-item__text"><strong/></div><button class="kit-icon-btn kit-item__action"/></li></ul> */
.kit-items { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); list-style: none; margin: 0; padding: 0; }
.kit-item { align-items: center; background: var(--dash-card, #fff); border: 1px solid var(--dash-line, #e5eaf0); border-radius: 12px; box-shadow: inset 3px 0 0 var(--tone, #32729B), 0 1px 2px rgba(16,24,40,.04); display: flex; gap: 12px; min-height: 45px;
    min-width: 0;
    padding: 7px 10px 7px 14px; position: relative; transition: border-color .15s, box-shadow .15s, transform .15s; }
/* The tone accent is an inset shadow (follows the rounded corners, no clipping — so tooltips can leave the row). */
[dir="rtl"] .kit-item, .kit-page[dir="rtl"] .kit-item { box-shadow: inset -3px 0 0 var(--tone, #32729B), 0 1px 2px rgba(16,24,40,.04); padding: 10px 14px 10px 10px; }
.kit-item:hover { border-color: color-mix(in srgb, var(--tone, #32729B) 35%, var(--dash-line, #e5eaf0)); box-shadow: inset 3px 0 0 var(--tone, #32729B), 0 6px 16px rgba(16,24,40,.07); transform: translateY(-1px); }
[dir="rtl"] .kit-item:hover, .kit-page[dir="rtl"] .kit-item:hover { box-shadow: inset -3px 0 0 var(--tone, #32729B), 0 6px 16px rgba(16,24,40,.07); }
.kit-item:hover, .kit-item:focus-within { z-index: 2; }
.kit-item__icon { background: var(--tone-soft, var(--dash-primary-soft, #e8f0f4)); border-radius: 50%; color: var(--tone, var(--dash-primary, #32729B)); display: grid; flex: none; font-size: 16px; height: 36px; place-items: center; width: 36px; }
.kit-item__text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.kit-item__text strong { color: var(--dash-brand-navy, #1D3F5B); font-size: 13.5px; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-item__action { background: transparent; border-color: transparent; opacity: .55; transition: opacity .15s, background-color .15s, border-color .15s; }
.kit-item:hover .kit-item__action, .kit-item__action:focus-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .kit-item, .kit-item:hover { transform: none; transition: none; } }
@media (hover: none) { .kit-item__action { opacity: 1; } }
body.dark-mode .kit-item { background: var(--dash-card, #1a2035); border-color: rgba(255,255,255,.08); }
body.dark-mode .kit-item:hover { border-color: rgba(255,255,255,.18); }

/* Chart section page (list page inside a chart tab): spacing between its blocks. */
.kit-section > .kit-card { margin-bottom: 14px; }
.kit-section > .kit-card:last-child { margin-bottom: 0; }

/* List + optional side panel (add/edit form beside the list). */
.kit-split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.kit-split.has-side { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
.kit-split__side { min-width: 0; }
@media (max-width: 992px) { .kit-split.has-side { grid-template-columns: minmax(0, 1fr); } }

/* ── Dialog forms (add / edit / view popups) ──────────────────────────────
   <div dialog-body><div class="kit-page kit-form">
     <p class="kit-form__intro"><i></i>Hint</p>
     <form class="kit-form__grid"><div class="input-block local-forms kit-field [kit-field--full]">…<span class="kit-field__error">…</span></div></form>
   </div></div>
   <div dialog-footer><div class="kit-form__footer"><button class="kit-button kit-button--primary kit-button--lg">Save</button></div></div> */
.kit-form { padding: 6px 2px 18px; } /* bottom space so the last field never sits on the dialog footer */
.kit-form__intro { align-items: center; background: var(--dash-soft, #f5f8fc); border-radius: 10px; color: var(--dash-label, #344054); display: flex; font-size: 12.5px; gap: 8px; line-height: 1.45; margin: 0 0 22px; padding: 9px 12px; }
/* The theme resets <p> margins inside dialogs, so the gap is also set on what follows the intro. */
.kit-form > .kit-form__intro + * { margin-top: 24px !important; }
.kit-form__intro i { color: var(--dash-primary, #32729B); flex: none; font-size: 17px; }
/* View-only notice: same look as kit-alert--warning. */
.kit-form__intro.is-view { background: var(--dash-card, #fff); border: 1px solid #fedf89; border-inline-start: 4px solid #D99A32; border-radius: var(--dash-radius-tile, 12px); color: #7a5200; font-size: 13px; font-weight: 600; gap: 12px;    padding: 6px 15px;
    background-color: #fef0c738; }
.kit-form__intro.is-view i { background: #fef0c7; border-radius: 50%; color: #b54708; display: grid; font-size: 20px; height: 36px; place-items: center; width: 36px; }
.kit-form__grid { display: grid; gap: 24px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kit-form__grid--1 { grid-template-columns: minmax(0, 1fr); }
.kit-form__grid > .kit-field--full { grid-column: 1 / -1; }
.kit-form__section { color: var(--dash-muted, #5f6c7b); font-size: 11px; font-weight: 700; grid-column: 1 / -1; letter-spacing: .06em; margin: 4px 0 -10px; text-transform: uppercase; }
/* Grouped form cards: <form class="kit-form__groups"><section class="kit-form__group tone-blue">
   <header class="kit-form__group-head"><span class="kit-tile"><i/></span><h5>Title</h5></header><div class="kit-form__grid">…</div></section></form> */
.kit-form__groups { display: flex; flex-direction: column; gap: 14px; }
.kit-form__group { background: var(--group-bg, var(--dash-soft, #f7f9fc)); border: 1px solid var(--dash-line, #e5eaf0); border-radius: 14px; padding: 14px 16px 18px; }
.kit-form__group-head { align-items: center; display: flex; gap: 10px; margin-bottom: 22px; }
.kit-form__group-head .kit-tile { border-radius: 9px; font-size: 17px; height: 32px; width: 32px; }
.kit-form__group-head h5 { color: var(--dash-brand-navy, #1D3F5B); font-size: 13.5px; font-weight: 600; margin: 0; }
.kit-form__group { --group-bg: var(--dash-soft, #f7f9fc); }
.kit-form__group .kit-field .form-control { background-color: var(--dash-card, #fff); }
/* The floating label sits on the field border: top half matches the card, bottom half the field. */
.kit-form__group .kit-field > label { background: linear-gradient(to bottom, var(--group-bg) 50%, var(--dash-card, #fff) 50%); }
.kit-form__group .kit-field label > i { color: var(--tone, var(--dash-primary, #32729B)); font-size: 12px; margin-inline-end: 2px; }
body.dark-mode .kit-form__group { --group-bg: #1d2438; background: var(--group-bg); border-color: var(--dash-line, #2a3348); }
.kit-field__error { color: #C4443C; display: block; font-size: 11.5px; font-weight: 600; margin-top: 4px; }
.kit-field textarea.form-control { min-height: 84px; }
.kit-field .form-control:disabled, .kit-field .form-control[disabled] { background: var(--dash-soft, #f5f8fc); cursor: default; }
.kit-form__footer { align-items: center; display: flex; gap: 8px; justify-content: flex-end; width: 100%; }
@media (max-width: 640px) {
  .kit-form__grid { grid-template-columns: minmax(0, 1fr); }
  .kit-form__footer > .kit-button { flex: 1; }
}
body.dark-mode .kit-form__intro.is-view { background: var(--dash-card, #1a2035); border-color: rgba(217,154,50,.4); border-inline-start-color: #D99A32; color: #f0c987; }
body.dark-mode .kit-form__intro.is-view i { background: rgba(217,154,50,.16); color: #e8b45a; }
body.dark-mode .kit-field__error { color: #f07a72; }

/* ── Choice chips (radio / checkbox groups in forms) ──────────────────────
   <fieldset class="kit-choices"><legend>Label *</legend>
     <label class="kit-choice [tone-red]"><input type="radio" …><i class="bx bx-check-circle"></i><span>Text</span></label>…</fieldset> */
.kit-choices { align-content: flex-start; align-items: center; border: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; min-width: 0; padding: 0; }
.kit-choices > legend { color: var(--dash-label, #344054); float: none; font-size: 12px; font-weight: 600; margin: 0 0 8px; padding: 0; width: 100%; }
.kit-choices > legend .login-danger { color: #C4443C; }
.kit-choice { align-items: center; background: var(--dash-card, #fff); border: 1px solid var(--dash-line, #e5eaf0); border-radius: 999px; color: var(--dash-label, #344054); cursor: pointer; display: inline-flex; font-size: 13px; font-weight: 600; gap: 6px; margin: 0; padding: 7px 14px 7px 10px; transition: background-color .15s, border-color .15s, color .15s; user-select: none; }
[dir="rtl"] .kit-choice, .kit-page[dir="rtl"] .kit-choice { padding: 7px 10px 7px 14px; }
.kit-choice input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.kit-choice > i { color: #b8c2cc; font-size: 16px; }
.kit-choice > i::before { content: "\e9be"; } /* bx-circle (Boxicons 2.0.7) — use <i class="bx"> */
.kit-choice:hover { border-color: #cdd5df; }
.kit-choice:focus-within { box-shadow: 0 0 0 3px rgba(50,114,155,.18); }
.kit-choice:has(input:checked) { background: var(--tone-soft, var(--dash-primary-soft, #e8f0f4)); border-color: var(--tone, var(--dash-primary, #32729B)); color: var(--tone, var(--dash-primary, #32729B)); }
.kit-choice:has(input:checked) > i { color: var(--tone, var(--dash-primary, #32729B)); }
.kit-choice:has(input:checked) > i::before { content: "\e9a8"; } /* bx-check-circle */
.kit-choice:has(input:disabled) { cursor: default; opacity: .75; }
body.dark-mode .kit-choice { background: #1a2035; border-color: rgba(255,255,255,.09); color: #c9d1d9; }
body.dark-mode .kit-choice > i { color: #64748b; }
/* Segment variant: options as equal-width tiles on one row (wraps only on narrow screens). */
.kit-choices--segment { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.kit-choices--segment > legend { grid-column: 1 / -1; }
.kit-choices--segment > .kit-field__error { grid-column: 1 / -1; }
.kit-choices--segment .kit-choice { border-radius: 10px; height: 42px; justify-content: center; padding: 0 12px; }
.kit-choices--segment .kit-choice:has(input:checked) { box-shadow: inset 0 0 0 1px var(--tone, var(--dash-primary, #32729B)); }
/* Grid helper: span two columns of a kit-form__grid. */
.kit-form__grid > .kit-span-2 { grid-column: span 2; }
@media (max-width: 640px) { .kit-form__grid > .kit-span-2 { grid-column: auto; } }

/* ── Side panel form (add/edit beside a list) ─────────────────────────────
   <div class="kit-card kit-form kit-panel"><header class="kit-panel__head">tile + h3 + close</header> … <footer class="kit-form__footer kit-panel__foot"> */
.kit-panel { padding: 14px 16px; }
.kit-panel__head { align-items: center; display: flex; gap: 10px; margin-bottom: 18px; }
.kit-panel__head h3 { color: var(--dash-brand-navy, #1D3F5B); flex: 1; font-size: 14.5px; font-weight: 600; margin: 0; }
.kit-panel__foot { border-top: 1px dashed var(--dash-line, #e5eaf0); margin-top: 16px; padding-top: 14px; }

/* ── File picker (styled <input type="file">) ─────────────────────────────
   <label class="kit-file"><input type="file" …><i class="bx bx-cloud-upload"></i><span>Choose files</span></label>
   Selector is doubled to beat the theme's ".local-forms label" (floating label) rule. */
.local-forms .kit-file, .kit-file { align-items: center; background: var(--dash-soft, #f5f8fc); border: 1.5px dashed #c6d3dd; border-radius: var(--dash-radius-control, 10px); color: var(--dash-label, #344054); cursor: pointer; display: flex; font-size: 13px; font-weight: 600; gap: 8px; height: 45px; left: auto; margin: 0; min-width: 0; padding: 0 14px; position: relative; top: auto; transition: border-color .15s, background-color .15s; z-index: auto; }
.local-forms .kit-file:hover, .kit-file:hover { background: var(--dash-primary-soft, #e8f0f4); border-color: var(--dash-primary, #32729B); }
.kit-file input { cursor: pointer; inset: 0; opacity: 0; position: absolute; width: 100%; }
.kit-file i { color: var(--dash-primary, #32729B); font-size: 20px; }
.kit-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-file span.is-picked { color: var(--dash-brand-navy, #1D3F5B); }
.kit-upload { padding: 10px 0 0; }
.kit-filters > .kit-form__footer { flex: 1 1 100%; }
.kit-upload__notes { flex: 1.5 1 220px; }
/* Notes stay a textarea: starts at field height (one line) and can be dragged taller. */
.kit-upload__notes textarea.form-control { height: 45px; min-height: 45px; resize: vertical; }
.kit-upload__submit { flex: none; }
body.dark-mode .local-forms .kit-file, body.dark-mode .kit-file { background: #212a40; border-color: rgba(255,255,255,.18); color: #c9d1d9; }
.kit-form__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 992px) { .kit-form__grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kit-form__grid--3 { grid-template-columns: minmax(0, 1fr); } }
/* Rich-text editor block inside a dialog form. */
.kit-form__editor { border-top: 1px dashed var(--dash-line, #e5eaf0); margin-top: 22px; padding-top: 16px; }
.kit-form__editor > h4 { align-items: center; color: var(--dash-brand-navy, #1D3F5B); display: flex; font-size: 13.5px; font-weight: 600; gap: 6px; margin: 0 0 10px; }
.kit-form__editor > h4 i { color: var(--dash-primary, #32729B); font-size: 17px; }

/* ── Header colour: brand navy band, white text ──────────────────────────
   Widgets inside keep their own white surfaces (date box fields, chips, buttons) so they stay readable.
   Kept last so it is the one place to retune. */
.kit-hero { --hero-ink: #fff; --hero-glass: rgba(255,255,255,.12); --hero-glass-line: rgba(255,255,255,.24); --hero-glass-hover: rgba(255,255,255,.18); --hero-glass-active: rgba(255,255,255,.26); --hero-focus: rgba(255,255,255,.55);
  --hero-ring: radial-gradient(circle at calc(100% + 40px) -60px, transparent 0 86px, rgba(255,255,255,.07) 87px 108px, transparent 109px);
  background: var(--hero-ring), linear-gradient(115deg, #1D3F5B 0%, #22496a 55%, #285778 100%); border-color: transparent; box-shadow: 0 8px 22px rgba(29,63,91,.20); color: #fff; }
[dir="rtl"] .kit-hero, .kit-page[dir="rtl"] .kit-hero { --hero-ring: radial-gradient(circle at -40px -60px, transparent 0 86px, rgba(255,255,255,.07) 87px 108px, transparent 109px); }
.kit-hero :is(h1, h2) { color: #fff; }
.kit-hero .kit-title-icon { background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.26); color: #fff; }
.kit-hero :focus-visible { outline-color: #fff; }
.kit-hero__stats dt { color: rgba(255,255,255,.75); }
.kit-hero__stats dd { color: #fff; }
/* Figures: inline on the band (no white cards — the text is white here). */
.kit-hero__stats > div, .kit-hero__stats > .kit-ring { background: none; border: 0; border-inline-start: 1px solid rgba(255,255,255,.2); border-radius: 0; box-shadow: none; }
.kit-hero__stats > div:first-child { border-inline-start: 0; }
body.dark-mode .kit-hero__stats > div { background: none; border-color: rgba(255,255,255,.14); }
.kit-hero .kit-ring dd { background: conic-gradient(#fff var(--ring, 0%), rgba(255,255,255,.22) 0); }
.kit-hero .kit-ring dd span { background: #22496a; color: #fff; }
/* Buttons: solid white on the navy so they read as actions. */
.kit-hero .kit-button { background: #fff; border-color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12); color: #1D3F5B; }
.kit-hero .kit-button i { color: #32729B; }
.kit-hero .kit-button:hover:not(:disabled) { background: #e8f0f4; border-color: #e8f0f4; color: #1D3F5B; }
.kit-hero .kit-refresh { background: #fff; color: #1D3F5B; }
.kit-hero .kit-refresh:hover:not(:disabled) { background: #e8f0f4; }
.kit-hero__chip { background: #fff; border-color: #fff; color: #1D3F5B; }
/* Mode switch: translucent track, the chosen option is a white pill. */
.kit-segmented--on-hero { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.24); box-shadow: none; }
.kit-segmented--on-hero > :is(button, a) { color: rgba(255,255,255,.92); }
.kit-segmented--on-hero > :is(button, a) i { color: rgba(255,255,255,.85); }
.kit-segmented--on-hero > :is(button, a):hover { background: rgba(255,255,255,.14); color: #fff; }
.kit-segmented--on-hero > :is(button, a).is-active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); color: #1D3F5B; }
.kit-segmented--on-hero > :is(button, a).is-active i { color: #32729B; }
body.dark-mode .kit-hero { background: linear-gradient(115deg, #142d42 0%, #183650 55%, #1c3f5c 100%); border-color: rgba(255,255,255,.06); box-shadow: none; }
body.dark-mode .kit-hero .kit-button, body.dark-mode .kit-hero .kit-refresh, body.dark-mode .kit-hero__chip { background: #e2e8f0; border-color: #e2e8f0; color: #142d42; }
body.dark-mode .kit-segmented--on-hero > :is(button, a) { color: rgba(255,255,255,.88); }
body.dark-mode .kit-segmented--on-hero > :is(button, a).is-active { background: #e2e8f0; color: #142d42; }
body.dark-mode .kit-segmented--on-hero > :is(button, a).is-active i { color: #32729B; }

/* ── Dropdown panels with long options (panelStyleClass="kit-dropdown-panel") ─────────────────
   Panels are appended to <body>, so this is global: cap the width near the field and wrap long option text. */
.kit-dropdown-panel.p-dropdown-panel { max-width: min(460px, calc(100vw - 32px)); }
.kit-dropdown-panel .p-dropdown-items .p-dropdown-item { font-size: 13px; line-height: 1.4; padding: 9px 14px; white-space: normal; }
.kit-dropdown-panel .p-dropdown-items-wrapper { max-height: 280px !important; }

/* ── Expandable entries (dated clinical entries, e.g. medical details) ──────────────────────────
   <div class="kit-entries"><article class="kit-entry [is-open]"><header class="kit-entry__head"><button class="kit-entry__toggle">
     <span class="kit-entry__icon"><i/></span><span class="kit-entry__title"><strong/><small><span>…</span></small></span><i class="kit-entry__chevron"/></button>
     <div class="kit-entry__actions">icon buttons</div></header><div class="collapse"><dl class="kit-record__fields kit-entry__body">…</dl></div></article></div> */
.kit-entries { display: flex; flex-direction: column; gap: 10px; }
.kit-entry { background: var(--dash-card, #fff); border: 1px solid var(--dash-line, #e5eaf0); border-radius: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04); transition: border-color .15s, box-shadow .15s; }
.kit-entry:hover { border-color: #cdd8e3; }
.kit-entry.is-open { border-color: #c9dcec; box-shadow: 0 8px 22px rgba(16,24,40,.06); }
.kit-entry__head { align-items: center; display: flex; gap: 10px; padding: 10px 12px 10px 14px; }
.kit-entry__toggle { align-items: center; background: none; border: 0; color: inherit; cursor: pointer; display: flex; flex: 1; font: inherit; gap: 12px; min-width: 0; padding: 0; text-align: start; }
.kit-entry__icon { background: var(--dash-primary-soft, #e8f0f4); border-radius: 10px; color: var(--dash-primary, #32729B); display: grid; flex: none; font-size: 15px; height: 38px; place-items: center; width: 38px; }
.kit-entry__title { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.kit-entry__title strong { color: var(--dash-brand-navy, #1D3F5B); font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-entry__title small { color: var(--dash-muted, #5f6c7b); display: flex; flex-wrap: wrap; font-size: 12px; gap: 4px 14px; }
.kit-entry__title small > span { align-items: center; display: inline-flex; gap: 4px; }
.kit-entry__title small i { font-size: 14px; }
.kit-entry__chevron { color: var(--dash-muted, #5f6c7b); flex: none; font-size: 20px; transition: transform .2s; }
.kit-entry.is-open .kit-entry__chevron { transform: rotate(180deg); }
.kit-entry__actions { flex: none; }
/* The collapse wrapper carries the side spacing (the field grid itself resets margins). */
.kit-entry > .collapse, .kit-entry > .collapsing { padding: 0 16px 0 0px; }
[dir="rtl"] .kit-entry > :is(.collapse, .collapsing), .kit-page[dir="rtl"] .kit-entry > :is(.collapse, .collapsing) { padding: 0 66px 0 16px; }
.kit-entry .kit-entry__body { gap: 16px 24px; margin: 0; padding: 14px 20px 18px; }
.kit-entry__body dt { margin-bottom: 3px; }
@media (max-width: 768px) { .kit-entry > :is(.collapse, .collapsing) { padding: 0 14px !important; } }
.kit-entry__body dd { white-space: pre-line; }
body.dark-mode .kit-entry { background: var(--dash-card, #1a2035); border-color: rgba(255,255,255,.08); box-shadow: none; }
body.dark-mode .kit-entry.is-open { border-color: rgba(143,195,230,.3); }
@media (max-width: 768px) { .kit-entry__head { align-items: flex-start; flex-wrap: wrap; } .kit-entry__actions { margin-inline-start: 50px; } }

/* ── Native <select> inside a kit field: same look as the PrimeNG dropdowns (45px, soft border, chevron). ── */
.kit-field select.form-control { -webkit-appearance: none; appearance: none; background: var(--dash-card, #fff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6c7b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center / 16px 16px; border: 1px solid #dfe3ea; border-radius: 10px; color: var(--dash-ink, #172b4d); cursor: pointer; font-size: 13.5px; height: 45px; padding: 0 42px 0 14px; transition: border-color .15s, box-shadow .15s; }
[dir="rtl"] .kit-field select.form-control, .kit-page[dir="rtl"] .kit-field select.form-control { background-position: left 14px center; padding: 0 14px 0 42px; }
.kit-field select.form-control:hover:not(:disabled) { border-color: #c7d0db; }
.kit-field select.form-control:focus { border-color: var(--dash-primary, #32729B); box-shadow: 0 0 0 3px rgba(50,114,155,.14); outline: 0; }
.kit-field select.form-control:disabled { background-color: var(--dash-soft, #f5f8fc); cursor: not-allowed; opacity: .8; }
.kit-field select.form-control:invalid, .kit-field select.form-control option[value="null"] { color: var(--dash-muted, #5f6c7b); }
.kit-field select.form-control option { color: var(--dash-ink, #172b4d); }
body.dark-mode .kit-field select.form-control { background-color: rgba(255,255,255,.04); border-color: rgba(255,255,255,.12); color: #e2e8f0; }
