/* MedX v5.2 Workforce: a left menu on every screen + Home cards + task screens.
   Menu: clinic, Home, the person's tasks grouped by area, More tasks, then Search, language, shrink and the person.
   Home: greeting, one search box, richer cards (icon badge, name, one helper line, at most one number).
   Task: slim header (task + patient), one flow, one primary action, Done -> Home. Phones: a drawer menu + a bottom bar. */

body.app { background: var(--c-bg); min-height: 100vh; }
.app-wrap { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Top bar (same on every workforce screen) ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
}
a.appbar__mark:hover { text-decoration: none; box-shadow: 0 0 0 3px var(--blue-100); }
.appbar__search { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border-radius: var(--r-full); border: 1px solid var(--c-border-strong); color: var(--c-text); font-weight: 650; font-size: 15px; white-space: nowrap; }
.appbar__search:hover { border-color: var(--c-primary); background: var(--blue-50); text-decoration: none; }
.appbar__search .icon { width: 19px; height: 19px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 400; padding: 10px 16px; border-radius: var(--r-sm); background: var(--c-text); color: var(--c-surface); font-weight: 650; }
.skip-link:focus { top: 12px; text-decoration: none; }
/* Icon + sentence lists (design page, admin sign-in) */
.help-tips { display: flex; flex-direction: column; gap: 12px; color: var(--c-text-2); } /* colour on the list, so a list styled inline wins */
.help-tips li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.help-tips .icon { flex: none; margin-top: 3px; color: var(--blue-700); }
.signin__art .help-tips .icon { color: inherit; }
.help-tips b { color: var(--c-text); }
.appbar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--c-text); }
.appbar__brand:hover { text-decoration: none; }
.appbar__mark { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--brand-mark); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.appbar__clinic { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.appbar__clinic b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__clinic span { font-size: 13px; color: var(--c-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__task { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 18px; font-weight: 700; }
.appbar__task .tile__icon { width: 40px; height: 40px; border-radius: 12px; }
.appbar__task .tile__icon svg { width: 28px; height: 28px; }
.appbar__task span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.appbar__menu { display: none; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 10px; border-radius: var(--r-full); border: 1px solid var(--c-border-strong); color: var(--c-text); font-weight: 650; font-size: 15px; }
.appbar__menu:hover { border-color: var(--c-primary); background: var(--blue-50); text-decoration: none; }
.appbar__menu .icon { width: 20px; height: 20px; }
.appbar__title { font-size: 16px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar--home { display: none; } /* Home on PC: the menu already has the clinic, Search and the person */
.app-wrap:has(> .side) .appbar .appbar__search { display: none; } /* Search lives in the menu on PC */
.appbar .segmented span { padding: 5px 12px; }
.person-chip { display: flex; align-items: center; gap: 10px; padding: 3px 12px 3px 3px; border-radius: var(--r-full); cursor: pointer; list-style: none; }
.person-chip::-webkit-details-marker { display: none; }
.person-chip:hover, .menu[open] > .person-chip { background: var(--c-surface-3); }
.person-chip__text { display: flex; flex-direction: column; line-height: 1.25; }
.person-chip__text b { font-size: 14px; }
.person-chip__text span { font-size: 13px; color: var(--c-text-3); }
.pt-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 4px; border-radius: var(--r-full); background: var(--c-surface-2); border: 1px solid var(--c-border); font-size: 14px; white-space: nowrap; }
.pt-chip .avatar { width: 32px; height: 32px; font-size: 13px; }
.pt-chip b { font-weight: 700; }
.pt-chip .tag { margin-left: 4px; }

/* Menus (details) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 80; min-width: 240px; padding: 6px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); }
.menu__item, .menu__row { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 10px; border-radius: 8px; color: var(--c-text); font-size: 15px; }
.menu__item:hover { background: var(--c-surface-3); text-decoration: none; }
.menu__item .icon, .menu__row > .icon { color: var(--c-text-3); }
.menu__sep { height: 1px; background: var(--c-border); margin: 6px 4px; }
.menu__head { padding: 8px 10px 6px; font-size: 13px; font-weight: 700; color: var(--c-text-3); }
.switch-btn { position: relative; width: 44px; height: 26px; flex: none; border: 0; border-radius: 99px; background: var(--c-border-strong); cursor: pointer; }
.switch-btn::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--t-med) var(--ease); }
.switch-btn[aria-checked="true"] { background: var(--c-primary); }
.switch-btn[aria-checked="true"]::after { transform: translateX(18px); }

/* ---------- Home ---------- */
.home { position: relative; flex: 1; padding: 32px 20px 56px; overflow: hidden; }
.home::before, .home::after { content: ""; position: absolute; z-index: 0; border-radius: 50%; pointer-events: none; }
.home::before { width: 520px; height: 520px; right: -180px; top: -220px; background: var(--blue-100); }
.home::after { width: 220px; height: 220px; left: -90px; bottom: -80px; background: var(--blue-100); opacity: .7; }
.home__in { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.home__hello .eyebrow { font-size: 15px; }
.home__hello h1 { font-size: 34px; margin-top: 4px; }
.home__hello h1 [lang="ur"] { font-size: 1em; line-height: 2.5; } /* Nastaliq rises far above the cap height */
.home__search { display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 22px; border-radius: var(--r-full); background: var(--c-surface); border: 1px solid var(--c-border-strong); box-shadow: var(--shadow-sm); color: var(--c-text-3); font-size: 18px; max-width: 640px; }
.home__search:hover { border-color: var(--c-primary); text-decoration: none; color: var(--c-text-2); }
.home__search .icon { width: 24px; height: 24px; color: var(--c-text-2); }

.home__search kbd { margin-left: auto; font: 600 13px var(--font-mono); padding: 2px 8px; border: 1px solid var(--c-border-strong); border-radius: 7px; color: var(--c-text-3); }

/* Home cards: icon badge, at most one number, the task name, one helper line, and an arrow. The first card is larger. */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 16px;
  min-height: 200px; padding: 22px; border-radius: 22px;
  background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text);
  box-shadow: 0 1px 2px rgba(20, 48, 59, .05);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.tile:hover { border-color: var(--c-primary); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.tile:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 3px; }
.tile__icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; flex: none; background: var(--cat-desk-bg); color: var(--cat-desk-fg); box-shadow: inset 0 0 0 1px rgba(20, 48, 59, .05); }
.tile__icon svg { width: 42px; height: 42px; }
.tile__body { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-right: 30px; }
.tile__label { font-size: 18px; font-weight: 700; line-height: 1.3; }
.tile__label [lang="ur"] { font-size: 19px; line-height: 1.7; }
.tile__hint { font-size: 14.5px; line-height: 1.4; color: var(--c-text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile__hint [lang="ur"] { font-size: 15px; line-height: 1.9; }
.tile__go { position: absolute; right: 20px; bottom: 24px; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--c-text-3); transition: transform var(--t-fast), color var(--t-fast); }
.tile:hover .tile__go { color: var(--c-primary); transform: translateX(3px); }
.tile__count { position: absolute; top: 20px; right: 20px; display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: var(--r-full); font-size: 14px; font-weight: 700; background: var(--c-surface-3); color: var(--c-text-2); white-space: nowrap; }
.tile__count--warn { background: var(--st-warn-bg); color: var(--st-warn); }
.tile__count--crit { background: var(--st-crit); color: var(--c-on-danger); }
.tile--lead { grid-column: span 2; flex-direction: row; align-items: center; gap: 26px; background: linear-gradient(120deg, var(--c-surface) 50%, var(--blue-50)); }
.tile--lead .tile__icon { width: 104px; height: 104px; border-radius: 28px; }
.tile--lead .tile__icon svg { width: 70px; height: 70px; }
.tile--lead .tile__body { margin-top: 0; }
.tile--lead .tile__label { font-size: 23px; }
.tile--lead .tile__hint { font-size: 16px; }
.tile--more .tile__icon { background: var(--c-surface-3); color: var(--c-text-2); }
.tile--more { border-style: dashed; background: transparent; box-shadow: none; }

/* Category tints */
.cat-desk .tile__icon, .tile__icon.cat-desk { background: var(--cat-desk-bg); color: var(--cat-desk-fg); }
.cat-care .tile__icon, .tile__icon.cat-care { background: var(--cat-care-bg); color: var(--cat-care-fg); }
.cat-lab .tile__icon, .tile__icon.cat-lab { background: var(--cat-lab-bg); color: var(--cat-lab-fg); }
.cat-pharm .tile__icon, .tile__icon.cat-pharm { background: var(--cat-pharm-bg); color: var(--cat-pharm-fg); }
.cat-money .tile__icon, .tile__icon.cat-money { background: var(--cat-money-bg); color: var(--cat-money-fg); }
.cat-manage .tile__icon, .tile__icon.cat-manage { background: var(--cat-manage-bg); color: var(--cat-manage-fg); }

/* Thin Lucide icons drawn to match Healthicons line weight */
.li { fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }

/* Urdu: mirror the reading order where the words are translated. Task bodies are English in the prototype, so they stay left to right. */
.i18n:has(input[value="ur"]:checked) :is(.home__in, .more-list, .who) { direction: rtl; }
.i18n:has(input[value="ur"]:checked) .tile__count { right: auto; left: 18px; }
.i18n:has(input[value="ur"]:checked) .tile__go { right: auto; left: 20px; scale: -1 1; }

/* ---------- More sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 100; display: none; background: rgba(15, 29, 36, .45); }
.sheet:target { display: block; }
.sheet__panel { position: absolute; left: 50%; bottom: 0; translate: -50% 0; width: min(760px, 100%); max-height: 85vh; overflow: auto; background: var(--c-surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); padding: 10px 24px 28px; animation: sheet-up .2s var(--ease); }
@keyframes sheet-up { from { translate: -50% 30px; opacity: 0; } to { translate: -50% 0; opacity: 1; } }
.sheet__grip { width: 48px; height: 5px; border-radius: 99px; background: var(--c-border-strong); margin: 4px auto 14px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.more-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.more-item { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--c-border); color: var(--c-text); font-weight: 650; }
.more-item:hover { border-color: var(--c-primary); text-decoration: none; background: var(--blue-50); }
.more-item .tile__icon { width: 44px; height: 44px; border-radius: 12px; }
.more-item .tile__icon svg { width: 30px; height: 30px; }
.sheet__note { margin-top: 16px; font-size: 14px; color: var(--c-text-3); }
.more-item[data-phone] { display: none; } /* main tiles the phone bottom bar has no room for */
.more-item[aria-current="page"] { border-color: var(--c-primary); background: var(--blue-50); box-shadow: inset 4px 0 0 var(--c-primary); }

/* ---------- Left menu: on every workforce screen (a drawer on phones) ----------
   The person's own tasks, grouped by area, in their Home order. The current one is a filled pill. No numbers here. */
:root { --side-w: 256px; --bar-h: 0px; }
.app-wrap:has(> .side) { padding-left: var(--side-w); }
.app-wrap:has(#side-mini:checked) { --side-w: 78px; }
.side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: var(--side-w); display: flex; flex-direction: column; background: var(--c-surface); border-right: 1px solid var(--c-border); }
.side__toggle { position: absolute; opacity: 0; pointer-events: none; }
.side__head { flex: none; display: flex; align-items: center; gap: 8px; height: 72px; padding: 0 14px; border-bottom: 1px solid var(--c-border); }
.side__brand { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--c-text); }
.side__brand:hover { text-decoration: none; }
.side__brand:hover .appbar__mark { box-shadow: 0 0 0 3px var(--blue-100); }
.side__clinic { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.side__clinic b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__clinic span { font-size: 12.5px; color: var(--c-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__close { display: none; }
.side__scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.side__tasks, .side__group { display: flex; flex-direction: column; gap: 2px; }
.side__label { padding: 14px 12px 6px; font-size: 12.5px; font-weight: 700; color: var(--c-text-3); }
.side__item { position: relative; flex: none; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 10px; border-radius: 12px; color: var(--c-text-2); font-size: 15px; font-weight: 650; line-height: 1.25; cursor: pointer; list-style: none; }
.side__item::-webkit-details-marker { display: none; }
.side__item:hover { background: var(--blue-50); color: var(--c-text); text-decoration: none; }
.side__item:focus-visible { outline: 3px solid var(--c-primary); outline-offset: -3px; }
.side__item .tile__icon, .bar__item .tile__icon { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
.side__item .tile__icon svg, .bar__item .tile__icon svg { width: 24px; height: 24px; }
.side__item--home .tile__icon, .side__item--search .tile__icon, .side__more > summary .tile__icon, .bar__item:not([data-tile]) .tile__icon { background: var(--c-surface-3); color: var(--c-text-2); }
.side__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__text [lang="ur"] { font-size: 15px; line-height: 1.8; }
.side__item[aria-current="page"] { background: var(--blue-100); color: var(--c-text); font-weight: 750; }
.side__item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c-primary); }
.side__more { margin-top: 6px; border-top: 1px solid var(--c-border); padding-top: 6px; }
.side__more > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .55; }
.side__more[open] > summary::after { transform: rotate(-135deg); }
.side__foot { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid var(--c-border); }
.side__kbd { margin-left: auto; font: 600 12px var(--font-mono); padding: 1px 7px; border: 1px solid var(--c-border-strong); border-radius: 6px; color: var(--c-text-3); }
.side__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; }
.side__shrink { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: var(--r-full); color: var(--c-text-3); font-size: 13.5px; font-weight: 650; cursor: pointer; }
.side__shrink:hover { background: var(--c-surface-3); color: var(--c-text); }
.side__toggle:focus-visible ~ .side__foot .side__shrink { outline: 3px solid var(--c-primary); }
.side .menu__pop { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }
.side .person-chip { padding: 4px 10px 4px 4px; border-radius: 12px; }
/* Shrunk: icons only, with the name as a tooltip */
.side:has(.side__toggle:checked) :is(.side__text, .side__clinic, .side__kbd, .segmented, .person-chip__text) { display: none; }
.side:has(.side__toggle:checked) .side__label { height: 1px; margin: 8px 10px; padding: 0; overflow: hidden; background: var(--c-border); color: transparent; }
.side:has(.side__toggle:checked) :is(.side__item, .side__head, .side__row) { justify-content: center; }
.side:has(.side__toggle:checked) .side__item { padding: 6px 0; }
.side:has(.side__toggle:checked) .side__head { padding: 0; }
.side:has(.side__toggle:checked) .side__more > summary::after { display: none; }
.side:has(.side__toggle:checked) .side__shrink svg { transform: scaleX(-1); }

/* Phone bottom bar on task screens: Home, the first 3 tasks, More (which lists the rest) */
.bar { display: none; }

/* ---------- Search dialog ---------- */
.find-dlg { place-items: start center; padding-top: min(10vh, 90px); }
.find-dlg__box { width: min(640px, 100%); max-height: min(78vh, 640px); display: flex; flex-direction: column; overflow: hidden; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); }
.find-dlg__in { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--c-border); }
.find-dlg__in input { flex: 1; height: 44px; border: 0; outline: 0; background: none; font: inherit; font-size: 19px; color: var(--c-text); min-width: 0; }
.find-dlg__list { overflow-y: auto; padding: 6px 10px 12px; }
.find-dlg__label { font-size: 13px; font-weight: 700; color: var(--c-text-3); padding: 12px 10px 4px; }
.find-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 10px; border-radius: 12px; color: var(--c-text); font-weight: 650; }
.find-item:hover, .find-item.is-sel { background: var(--blue-100); text-decoration: none; }
.find-item .tile__icon { width: 40px; height: 40px; border-radius: 12px; }
.find-item .tile__icon svg { width: 28px; height: 28px; }
.find-item small { display: block; font-weight: 500; font-size: 13.5px; color: var(--c-text-3); }
.find-empty { display: none; padding: 26px; text-align: center; color: var(--c-text-3); }
.find-dlg__list.is-empty .find-empty { display: block; }

/* ---------- Task screens ---------- */
.task { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 28px 20px 120px; display: flex; flex-direction: column; gap: 20px; }
.task--wide { max-width: 1240px; }
.task__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.task__head h1 { font-size: 30px; }
.task__head p { font-size: 16px; color: var(--c-text-2); margin-top: 4px; max-width: 70ch; }
.task__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.steps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; color: var(--c-text-3); font-weight: 650; }
.steps b { color: var(--c-link); }
.steps__dots { display: inline-flex; gap: 6px; }
.steps__dots i { width: 28px; height: 6px; border-radius: 99px; background: var(--c-border-strong); }
.steps__dots i.is-on { background: var(--c-primary); }
.step-pane { display: none; flex-direction: column; gap: 20px; }
.flow:not(:has(.step-pane:target)) .step-pane:first-of-type, .step-pane:target { display: flex; }
.actionbar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; padding: 14px 18px; border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: 0 -10px 30px -18px rgba(20, 48, 59, .35); }
.actionbar__info { flex: 1 1 200px; font-size: 15px; color: var(--c-text-2); }
.actionbar .btn--primary { min-width: 200px; }
.pick-list { display: flex; flex-direction: column; border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); overflow: hidden; }
.pick { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--c-border); cursor: pointer; color: var(--c-text); }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--blue-50); text-decoration: none; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:has(input:checked) { background: var(--blue-50); box-shadow: inset 4px 0 0 var(--c-primary); }
.pick__main { flex: 1; min-width: 0; }
.pick__main b { display: block; font-size: 16px; }
.pick__main small { display: block; font-size: 14px; color: var(--c-text-3); }
.pick__end { text-align: right; font-size: 14px; color: var(--c-text-2); }

/* Done screen */
.done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 40px 24px; border-radius: var(--r-xl); background: var(--c-surface); border: 1px solid var(--c-border); }
.done__check { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--st-ok); color: var(--c-surface); }
.done__check .icon { width: 40px; height: 40px; stroke-width: 2.5; }
.done h2 { font-size: 26px; }
.done p { color: var(--c-text-2); max-width: 52ch; }
.done__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* Simple stat row (owner Today: at most 5) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }

/* ---------- Brand mark (sign-in pages) ---------- */
.brand { display: flex; align-items: center; gap: 12px; color: var(--c-text); }
.brand:hover { text-decoration: none; }
.brand__logo { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--brand-mark); color: #fff; }
.brand__logo svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.brand__name { display: block; font-weight: 700; font-size: 18px; line-height: 1.2; }
.brand__sub { display: block; font-size: 13px; color: var(--c-text-3); }

/* ---------- Sign-in: who is working ---------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.signin__art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; padding: 36px 48px; background: var(--blue-100); }
.signin__art::before { content: ""; position: absolute; width: 480px; height: 480px; right: -190px; top: -150px; border-radius: 50%; background: var(--blue-200); opacity: .8; }
.signin__art > * { position: relative; }
.signin__panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; background: var(--c-surface); }
.signin__card { width: min(560px, 100%); }
.signin-step { display: none; flex-direction: column; gap: 20px; }
.signin__card:not(:has(.signin-step:target)) .signin-step:first-child, .signin-step:target { display: flex; }
.who { display: flex; flex-direction: column; gap: 18px; }
.who__clinic { display: flex; flex-direction: column; gap: 8px; }
.who__clinic h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--c-text-2); }
.who__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.who-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--c-border-strong); color: var(--c-text); }
.who-card:hover { border-color: var(--c-primary); background: var(--blue-50); text-decoration: none; }
.who-card b { display: block; font-size: 15px; }
.who-card small { display: block; font-size: 13.5px; color: var(--c-text-3); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin__art { display: none; }
}
@media (max-width: 640px) {
  .appbar { padding: 0 12px; gap: 8px; }
  .appbar__clinic span, .person-chip__text, .appbar__search span, .pt-chip span:not(.avatar) { display: none; }
  .appbar__search { width: 40px; padding: 0; justify-content: center; }
  .pt-chip { padding: 0 4px; } /* initials only */
  .appbar__task { font-size: 16px; }
  .home { padding: 20px 14px 40px; }
  .home__hello h1 { font-size: 27px; }
  .home__search { height: 54px; font-size: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { min-height: 148px; padding: 16px; border-radius: 18px; }
  .tile__icon { width: 60px; height: 60px; border-radius: 16px; }
  .tile__icon svg { width: 38px; height: 38px; }
  .tile__label { font-size: 16px; }
  .tile__count { top: 12px; right: 12px; height: 26px; padding: 0 9px; font-size: 13px; }
  .task { padding: 18px 14px 110px; }
  .task__head h1 { font-size: 25px; }
  .actionbar > .btn { flex: 1 1 auto; }
  .actionbar .btn--primary { flex: 1 1 100%; min-width: 0; } /* own full-width row: long labels like "Finish and bill Rs 9,000" fit */
  /* Task pages: the task name needs the room. Language is chosen on Home and remembered; the hidden radios still apply it. */
  .appbar__task .tile__icon, .appbar:has(.appbar__task) .segmented { display: none; }
  /* The menu becomes a drawer (#menu): Back or Close shuts it. The bottom bar keeps Home and 3 tasks one tap away. */
  :root { --bar-h: 72px; }
  .app-wrap:has(> .side), .app-wrap:has(#side-mini:checked) { padding-left: 0; --side-w: min(320px, 86vw); }
  .side { display: none; z-index: 120; box-shadow: 0 0 0 100vmax rgba(15, 29, 36, .45); }
  .side:target { display: flex; }
  .side__close { display: inline-flex; }
  .side__shrink { display: none; }
  .side .person-chip__text { display: flex; } /* the drawer has room for the name */
  .side:has(.side__toggle:checked) :is(.side__text, .side__clinic, .side__kbd, .segmented, .person-chip__text) { display: revert; }
  .appbar__menu, .appbar--home { display: flex; }
  .appbar__menu span { display: none; }
  .appbar__menu { width: 40px; padding: 0; justify-content: center; }
  .app-wrap:has(> .side) .appbar .appbar__search { display: inline-flex; }
  .tiles { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tile, .tile--lead { grid-column: auto; flex-direction: row; align-items: center; gap: 14px; min-height: 0; padding: 14px 44px 14px 14px; border-radius: 18px; background: var(--c-surface); }
  .tile--more { background: transparent; }
  .tile__icon { width: 52px; height: 52px; border-radius: 15px; }
  .tile__icon svg { width: 34px; height: 34px; }
  .tile--lead .tile__icon { width: 60px; height: 60px; border-radius: 17px; }
  .tile--lead .tile__icon svg { width: 40px; height: 40px; }
  .tile__body, .tile--lead .tile__body { order: 1; flex: 1; margin-top: 0; padding-right: 0; }
  .tile__label, .tile--lead .tile__label { font-size: 16.5px; }
  .tile__hint, .tile--lead .tile__hint { font-size: 13.5px; }
  .tile__count { position: static; order: 2; height: 26px; padding: 0 9px; font-size: 12.5px; }
  .tile__go { top: 50%; bottom: auto; right: 14px; margin-top: -11px; }
  .bar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; height: calc(var(--bar-h) + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom); background: var(--c-surface); border-top: 1px solid var(--c-border); box-shadow: 0 -8px 24px -16px rgba(20, 48, 59, .45); }
  .bar__tiles { display: contents; }
  .bar__item { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 2px 4px; border-radius: 12px; color: var(--c-text-2); font-size: 11.5px; font-weight: 650; line-height: 1.15; text-align: center; }
  .bar__item:hover { background: var(--blue-50); text-decoration: none; }
  .bar__item .tile__icon { width: 30px; height: 30px; border-radius: 9px; }
  .bar__item .tile__icon svg { width: 22px; height: 22px; }
  .bar__item .side__text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .bar__item .side__text [lang="ur"] { font-size: 12.5px; line-height: 1.45; }
  .bar__item[aria-current="page"], .bar__item--more[data-phone-current] { background: var(--blue-50); color: var(--c-text); font-weight: 750; }
  .bar__item[aria-current="page"]::before, .bar__item--more[data-phone-current]::before { content: ""; position: absolute; left: 22%; right: 22%; top: -4px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c-primary); }
  .more-item[data-phone] { display: flex; }
  .app-wrap:has(> .bar) .task { padding-bottom: calc(120px + var(--bar-h)); }
  .app-wrap:has(> .bar) .actionbar { bottom: calc(var(--bar-h) + 8px + env(safe-area-inset-bottom)); }
}
@media print {
  .appbar, .actionbar, .side, .bar, .skip-link { display: none !important; }
  .app-wrap:has(> .side) { padding-left: 0; }
}

/* ---------- Specialty pieces ---------- */
/* Dental chairs: one column per chair, one row per sitting */
.chairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.chair { display: flex; flex-direction: column; border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); overflow: hidden; }
.chair h2 { font-size: 17px; padding: 16px 20px; border-bottom: 1px solid var(--c-border); }
.slot-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--c-border); }
.slot-row:last-child { border-bottom: 0; }
.slot-row > div { flex: 1; min-width: 0; }
.slot-row b { display: block; font-size: 15.5px; }
.slot-row small { display: block; font-size: 14px; color: var(--c-text-3); }
.slot-row__t { width: 56px; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.slot-row.is-done { opacity: .6; }
.slot-row.is-now { background: var(--blue-50); box-shadow: inset 4px 0 0 var(--c-primary); }
.slot-row.is-free b { color: var(--c-text-3); }
@media (max-width: 860px) { .chairs { grid-template-columns: minmax(0, 1fr); } }

/* Tooth chart (FDI numbering): upper row 18–11 | 21–28, lower row 48–41 | 31–38 */
.tooth-chart { display: flex; flex-direction: column; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.tooth-row { display: flex; gap: 6px; align-items: center; min-width: max-content; }
.tooth-row + .tooth-row { padding-top: 10px; border-top: 2px dashed var(--c-border); }
.tooth-gap { width: 14px; }
.tooth { width: 44px; height: 52px; border-radius: 12px 12px 16px 16px; display: grid; place-items: center; font-size: 14px; font-weight: 700; background: var(--c-surface); border: 2px solid var(--c-border-strong); color: var(--c-text-2); font-variant-numeric: tabular-nums; }
.tooth.t-caries { border-color: var(--st-warn); background: var(--st-warn-bg); color: var(--st-warn); }
.tooth.t-filled { border-color: var(--blue-300); background: var(--blue-100); color: var(--blue-800); }
.tooth.t-plan { border-color: var(--st-pending); border-style: dashed; color: var(--st-pending); }
.tooth.t-missing { border-style: dashed; color: var(--c-text-3); background: var(--c-surface-3); text-decoration: line-through; }
.tooth.t-today { border-color: var(--c-primary); background: var(--c-primary); color: var(--c-on-primary); }

/* Antenatal: WHO 8-visit plan */
.anc-plan { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 8px 0 0; padding: 0; }
.anc-plan li { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--c-border-strong); font-size: 13.5px; font-weight: 650; color: var(--c-text-3); }
.anc-plan li.is-done { background: var(--st-ok-bg); border-color: transparent; color: var(--st-ok); }
.anc-plan li.is-now { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }

/* X-ray viewer placeholder */
.xray { border-radius: var(--r-md); overflow: hidden; background: #0b1418; aspect-ratio: 4 / 3; }
.xray svg { width: 100%; height: 100%; display: block; }
