/* OPD Management Software — design system shared with the CA software / Earth Movers "Blue" theme:
 * Manrope; two flat themes (Settings → Theme): Blue #2861ac (default) and Teal #1a9585 — see THEMES below for the colour variables.
 * Field colours stay: white = empty, light yellow = typing, light green = filled.
 * Corners: change --r-* below (set all to 0 for square corners). */
:root {
    /* brand */
    --blue-900: var(--t-ink); --blue-800: var(--t-hover); --blue-700: var(--t-hover); --blue-600: var(--t-main); --blue-500: var(--t-main); --blue-400: var(--t-hi);
    --blue-100: rgba(var(--t-rgb), .16); --blue-50: rgba(var(--t-rgb), .08);
    /* theme colours come from the --t-* set (THEMES below): --theme-line = table / card / pop-up heads, --theme-grad = sidebar, --brand = buttons */
    --theme-line: var(--t-head);
    --brand: var(--t-main);
    --brand-hover: var(--t-hover);
    --brand-ink: var(--t-ink);
    /* theme surfaces: sidebar, OPD header, pop-up headers (same as the website login panel) */
    --theme-grad: var(--t-side);
    /* neutrals */
    --ink: #1e293b; --ink-2: #475569; --muted: #64748b; --line: #e2e8f0; --line-2: #eef2f6;
    --bg: #f4f6f9; --surface: #fff; --surface-2: #f1f5f9;
    --ok: #1f9d63; --warn: #d98a15; --danger: #d64545;
    --row-hover: #e9f7ef;
    /* depth */
    --shadow-card: 0 1px 2px rgba(15, 23, 42, .05), 0 5px 18px rgba(15, 23, 42, .07);
    --shadow-hover: 0 2px 6px rgba(15, 23, 42, .06), 0 12px 30px rgba(15, 23, 42, .13);
    --shadow-pop: 0 24px 60px rgba(15, 23, 42, .25);
    /* corners */
    --r-sm: 8px; --r: 10px; --r-lg: 14px; --r-xl: 18px;
    /* layout */
    --side-w: 260px; --top-h: 70px;
    --bs-primary: var(--t-main); --bs-primary-rgb: var(--t-rgb);
    --bs-link-color: var(--t-main); --bs-link-color-rgb: var(--t-rgb); --bs-link-hover-color-rgb: var(--t-rgb);
    --bs-body-font-family: "Manrope", "Noto Sans Devanagari", "Noto Sans Kannada", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-color: #1e293b; --bs-border-color: #e2e8f0;
    --bs-border-radius: 10px; --bs-border-radius-sm: 8px; --bs-border-radius-lg: 14px; --bs-border-radius-xl: 18px; --bs-border-radius-xxl: 18px; --bs-border-radius-pill: 50rem;
}
/* ============ THEMES — Settings → Theme (whole clinic). <html data-theme="…"> is set in include/head.php.
   --t-side sidebar · --t-head table / card / pop-up heads · --t-main buttons, accents · --t-ink dark text · --t-hi icons on dark heads
   --t-soft / --t-soft2 light tints · --t-line tinted borders · --t-rgb the main colour for rgba() shadows ============ */
:root, :root[data-theme="blue"], .tp-sw[data-theme="blue"] {
    --t-side: #173d6e; --t-head: #2861ac; --t-main: #2861ac; --t-hover: #1f4f8e; --t-ink: #1b4278; --t-hi: #a9c6ee;
    --t-soft: #eaf1fa; --t-soft2: #f4f8fc; --t-line: #c9d9ee; --t-rgb: 40, 97, 172;
}
:root[data-theme="teal"], .tp-sw[data-theme="teal"] {
    --t-side: #0f5249; --t-head: #1a9585; --t-main: #1a9585; --t-hover: #147a6d; --t-ink: #0f5a50; --t-hi: #a3e0d6;
    --t-soft: #e6f4f2; --t-soft2: #f3faf9; --t-line: #bfe2dc; --t-rgb: 26, 149, 133;
}
/* dashboard chart bars follow the theme */
.d2-chart rect.bar { fill: var(--t-hi); } .d2-chart rect.bar.on { fill: var(--t-ink); }
/* Settings → Theme picker */
.theme-picks { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-pick { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 8px 12px; border: 2px solid #e1e8ef; border-radius: 6px; background: #fff; text-align: left; }
.theme-pick:hover { border-color: #b6c2d0; }
.theme-pick.on { border-color: var(--t-main); box-shadow: 0 0 0 3px rgba(var(--t-rgb), .15); }
.theme-pick .tp-sw { display: flex; flex: none; width: 46px; height: 30px; border-radius: 4px; overflow: hidden; }
.theme-pick .tp-sw i { flex: 1; background: var(--t-side); }   /* each swatch carries its own data-theme, so it shows that theme's colours */
.theme-pick .tp-sw i + i { background: var(--t-main); }
.theme-pick b { display: block; font-size: .84rem; color: #1e293b; }
.theme-pick small { display: block; font-size: .7rem; color: #64748b; }
.theme-pick .bi-check-circle-fill { margin-left: auto; color: var(--t-main); font-size: 1.1rem; }
body { background: var(--bg); color: var(--ink); font-size: .875rem; line-height: 1.5; letter-spacing: -.005em; min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
main { flex: 1; position: relative; }
[ng-cloak], .ng-cloak { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd6de; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: #cdeefe; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ============ BUTTONS — lift on hover, press on click; Save = green, Back / Cancel = red, New = violet ============ */
.btn { --bs-btn-border-width: 1.5px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    padding: 9px 17px; font-size: .84rem; font-weight: 600; letter-spacing: .15px; line-height: 1.35; border-radius: var(--r);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease; }
.btn i { font-size: 1.05em; line-height: 1; }
.btn i.me-1 { margin-right: .1rem !important; }
.btn:hover { transform: translateY(-1.5px); }
.btn:active { transform: translateY(0) scale(.975); transition-duration: .05s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3.5px rgba(var(--t-rgb), .28); }
.btn:disabled, .btn.disabled { opacity: .5; transform: none; box-shadow: none; }
.btn-sm { padding: 5px 12px; font-size: .78rem; border-radius: var(--r-sm); }
.btn-primary { background: var(--brand); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(var(--t-rgb), .30), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-hover); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(var(--t-rgb), .40), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn-primary:disabled { background: var(--brand); color: #fff; }
.btn-success { background: #15935b; border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(31, 157, 99, .28); }
.btn-success:hover, .btn-success:focus { background: #117a4b; border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(31, 157, 99, .38); }
.btn-success:disabled { background: #15935b; color: #fff; }
.btn-danger, .btn-back, .btn-danger.btn-back { background: #dc3545; border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(214, 69, 69, .28); }
.btn-danger:hover, .btn-back:hover, .btn-danger:focus, .btn-back:focus { background: #bb2d3b; border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(214, 69, 69, .38); }
.btn-dark { background: #334155; border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(30, 30, 50, .25); }
.btn-dark:hover { background: #1e293b; color: #fff; }
.btn-export { background: #0f766e; border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(23, 162, 162, .28); }
.btn-export:hover, .btn-export:focus { background: #115e59; color: #fff; box-shadow: 0 8px 20px rgba(23, 162, 162, .38); }
.btn-export.disabled { color: #fff; }
.btn-print { background: var(--t-hover); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(47, 111, 176, .28); }
.btn-print:hover, .btn-print:focus { background: var(--t-hover); color: #fff; box-shadow: 0 8px 20px rgba(47, 111, 176, .38); }
.btn-print:disabled { background: var(--t-hover); color: #fff; }
.btn-outline-primary { color: var(--blue-600); border-color: var(--blue-400); background: transparent; }
.btn-outline-primary:hover, .btn-outline-primary:focus { background: var(--blue-600); border-color: var(--blue-600); color: #fff; box-shadow: 0 6px 16px rgba(var(--t-rgb), .28); }
.btn-outline-success:hover { box-shadow: 0 6px 16px rgba(31, 157, 99, .28); }
.btn-outline-danger:hover { box-shadow: 0 6px 16px rgba(214, 69, 69, .28); }
.btn-outline-secondary { color: var(--ink-2); border-color: var(--line); background: var(--surface); }
.btn-outline-secondary:hover { background: var(--surface-2); border-color: #aeb1c4; color: var(--ink); }
.btn-soft { background: var(--blue-50); color: var(--blue-700); border-color: transparent; }
.btn-soft:hover { background: var(--blue-100); color: var(--blue-800); box-shadow: 0 4px 12px rgba(var(--t-rgb), .16); }
.btn-clear { background: #dc3545; border-color: #dc3545; color: #fff; box-shadow: 0 3px 10px rgba(220, 53, 69, .25); }
.btn-clear:hover, .btn-clear:focus { background: #c82333; border-color: #c82333; color: #fff; }
.btn-close { opacity: .5; transition: transform .15s ease, opacity .15s ease; }
.btn-close:hover { transform: rotate(90deg); opacity: 1; }
.pagination { --bs-pagination-active-bg: var(--t-main); --bs-pagination-active-border-color: var(--t-main); --bs-pagination-color: #0373ad; --bs-pagination-hover-bg: var(--blue-50); --bs-pagination-border-color: var(--line); gap: 4px; }
.pagination .page-link { border-radius: var(--r-sm) !important; font-weight: 500; }

/* ============ SIDEBAR — deep navy; logo badge + clinic name; icon chips; the open page is a white pill with a blue
   accent bar; language switch as a card at the bottom ============ */
.app-sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); z-index: 1040; display: flex; flex-direction: column; overflow: hidden;
    background: var(--theme-grad); color: #fff; border-right: 0; box-shadow: 4px 0 22px rgba(15, 30, 51, .22); transition: transform .25s ease; }
.app-sidebar::before { content: ""; position: absolute; left: -90px; bottom: -110px; width: 280px; height: 280px; border-radius: 50%; pointer-events: none;
    background: none; display: none; }
/* faint stethoscope drawn behind the menu (white at 7%, so it shows in every theme) */
.app-sidebar::after { content: ""; position: absolute; right: -18px; bottom: 70px; width: 210px; height: 268px; pointer-events: none; opacity: .07;
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20220%20280%27%20fill%3D%27none%27%20stroke%3D%27white%27%20stroke-width%3D%279%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2746%27%20cy%3D%2718%27%20r%3D%279%27%20fill%3D%27white%27%2F%3E%3Ccircle%20cx%3D%27130%27%20cy%3D%2718%27%20r%3D%279%27%20fill%3D%27white%27%2F%3E%3Cpath%20d%3D%27M46%2028v62a42%2042%200%200%200%2084%200V28%27%2F%3E%3Cpath%20d%3D%27M88%20132v48a50%2050%200%200%200%20100%200v-28%27%2F%3E%3Ccircle%20cx%3D%27188%27%20cy%3D%27130%27%20r%3D%2722%27%2F%3E%3Ccircle%20cx%3D%27188%27%20cy%3D%27130%27%20r%3D%278%27%20fill%3D%27white%27%2F%3E%3C%2Fsvg%3E") no-repeat center / contain; transform: rotate(-12deg); }
/* clinic: round logo badge + name + tagline, level with the top bar */
.side-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; height: var(--top-h); padding: 0 16px; flex: none; text-decoration: none;
    overflow: hidden; background: #fff; border-bottom: 1px solid var(--line); }
.side-logo { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 1.1rem;
    background: var(--t-main); box-shadow: 0 6px 14px rgba(var(--t-rgb), .35); }
.side-name { min-width: 0; display: flex; flex-direction: column; }
.side-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; font-size: 1.05rem; line-height: 1.2;
    letter-spacing: -.3px; color: var(--blue-900); }
.side-tag { margin-top: 1px; font-size: .62rem; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: #64748b; white-space: nowrap; }
.side-brand:hover .side-title { color: var(--blue-700); }
.side-nav { position: relative; z-index: 1; flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 16px 14px 20px; }
.side-nav::-webkit-scrollbar { width: 5px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .35); border-radius: 5px; }
.side-link { position: relative; display: flex; align-items: center; gap: 12px; margin: 4px 0; padding: 7px 12px 7px 8px; border-radius: 12px;
    color: rgba(255, 255, 255, .9); text-decoration: none; font-size: .9rem; font-weight: 500; white-space: nowrap;
    transition: background-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.side-link > i:first-child { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-size: 1rem; border-radius: 10px;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); color: #fff; transition: background-color .18s ease, color .18s ease, box-shadow .18s ease; }
.side-link:hover { background: rgba(255, 255, 255, .13); color: #fff; transform: translateX(3px); }
.side-link:hover > i:first-child { background: rgba(255, 255, 255, .2); }
.side-link.active, .side-link.active:hover { background: #fff; color: var(--t-ink); font-weight: 700; transform: none;
    box-shadow: 0 8px 20px rgba(3, 40, 70, .3); }
.side-link.active::before { content: ""; position: absolute; left: -14px; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0; background: #7dd3fc;
    box-shadow: 0 0 10px rgba(125, 211, 252, .9); }
.side-link.active > i:first-child { background: var(--t-main); border-color: transparent; color: #fff; box-shadow: 0 4px 10px rgba(var(--t-rgb), .35); }
.side-foot { position: relative; z-index: 1; margin: 10px 14px 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .18); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.side-foot-label { font-size: .74rem; font-weight: 600; color: rgba(255, 255, 255, .9); }
.side-foot .lang-switch { border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .12); }
.side-foot .lang-switch a { color: #fff; }
.side-foot .lang-switch a:not(.active):hover { background: rgba(255, 255, 255, .2); }
.side-foot .lang-switch a.active { background: #fff; color: var(--t-main); }
.side-backdrop { display: none; }

/* ============ MAIN + TOP BAR ============ */
.app-main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.app-topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 14px; height: var(--top-h); padding: 0 24px;
    background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 8px rgba(15, 23, 42, .04); }
.app-topbar::after { content: none; }
.top-btn { width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--r); background: var(--blue-50); color: var(--blue-700); font-size: 1.2rem; box-shadow: none; }
.top-btn:hover { background: var(--blue-100); color: var(--blue-800); }
.top-page { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-ic { width: 42px; height: 42px; flex: none; place-items: center; border-radius: 12px; background: var(--t-soft); color: var(--blue-600); font-size: 1.15rem; }
.top-title { min-width: 0; font-weight: 800; font-size: 1.15rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; letter-spacing: -.2px; }
.top-crumb { display: flex; align-items: center; font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: .2px; white-space: nowrap; overflow: hidden; }
.top-crumb .bi { font-size: .7rem; color: var(--blue-500); }
.top-date { display: inline-flex; align-items: center; color: var(--blue-800); font-size: .8rem; font-weight: 600; white-space: nowrap; background: #fff; border: 1px solid var(--line);
    padding: 8px 12px; border-radius: var(--r); box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.top-date i { color: var(--blue-600); }
.top-time { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 991px) {
    .app-sidebar { transform: translateX(-100%); }
    body.side-open .app-sidebar { transform: none; }
    body.side-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }
    .app-main { margin-left: 0; }
    .app-topbar { padding: 0 14px; gap: 10px; }
}
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-weight: 600; flex: none; box-shadow: 0 3px 10px rgba(var(--t-rgb), .35); }
.profile-chip { display: flex !important; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 4px 10px 4px 4px; border-radius: 30px; }
.profile-chip:hover { background: var(--blue-50); color: var(--ink); }
.profile-chip .small { font-size: .72rem; }
.profile-menu { min-width: 16rem; }
.dropdown-menu { border: 1px solid var(--t-line); border-radius: 10px; padding: 6px; background: var(--surface); box-shadow: 0 16px 38px rgba(15, 23, 42, .18); }
.dropdown-item { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 8px 14px 8px 12px; border-radius: 7px; border-left: 3px solid transparent;
    font-size: .86rem; font-weight: 500; color: var(--ink); transition: background-color .1s ease, border-color .1s ease; }
.dropdown-item + .dropdown-item { margin-top: 2px; }
.dropdown-item:hover, .dropdown-item:focus { background: #f0f8ff; border-left-color: var(--blue-400); color: var(--ink); }
.dropdown-item:active, .dropdown-item.active { background: var(--t-soft); border-left-color: var(--blue-600); color: var(--blue-900); font-weight: 600; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); padding: 2px; background: var(--surface-2); white-space: nowrap; border-radius: var(--r-sm); }
.lang-switch a { color: var(--ink-2); text-decoration: none; font-size: .76rem; font-weight: 600; padding: .2rem .65rem; line-height: 1.4; border-radius: 6px; }
.lang-switch a.active { background: var(--blue-800); color: #fff; }
.lang-switch a:not(.active):hover { background: #e9e9f0; }

/* ============ PAGE ============ */
main.container-fluid { padding: 24px 24px 40px !important; }
@media (max-width: 767px) { main.container-fluid { padding: 16px 14px 28px !important; } }
main .row.g-2 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }
main .row.g-3 { --bs-gutter-x: 1.25rem; --bs-gutter-y: 1.25rem; }
main > .mb-2, main > div > .mb-2, main > form.mb-2 { margin-bottom: 1.1rem !important; }
main > .mb-3, main > div > .mb-3, main > form.mb-3 { margin-bottom: 1.4rem !important; }
main .card.mt-3 { margin-top: 1.25rem !important; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--ink); letter-spacing: -.3px; line-height: 1.25; }
.page-sub { color: var(--muted); margin: 3px 0 0; font-size: .86rem; }
.card { --bs-card-spacer-y: 1.1rem; --bs-card-spacer-x: 1.25rem; border: none; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card); transition: box-shadow .18s ease; }
.card-header { background: transparent; color: var(--ink); border-bottom: 1px solid var(--line); padding: 14px 20px; font-size: .95rem; font-weight: 700; letter-spacing: -.1px;
    display: block; position: relative; }
.card-header:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card-header.d-flex { display: flex; }
.card-header > .bi:first-child, .card-header > span > .bi:first-child { color: var(--blue-600); }
.card-header .text-muted { color: var(--muted) !important; }
.card-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 12px 20px; }
.card-footer:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty-state i { display: block; font-size: 2.6rem; color: var(--blue-400); opacity: .6; margin-bottom: .4rem; }
.app-footer { color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); flex-shrink: 0; padding-top: 12px !important; padding-bottom: 12px !important; font-size: .8rem; }
.app-footer a { color: var(--blue-700); font-weight: 600; text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.toast { border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .22); font-weight: 500; min-width: 280px; }
.badge { font-weight: 600; border-radius: 30px; padding: .4em .75em; }
.text-bg-dark { background: var(--brand) !important; }
.alert { border-radius: 12px; }
details > summary { cursor: pointer; color: var(--ink-2); }
hr { border-color: var(--line); opacity: 1; }

/* ============ MODALS ============ */
.modal-content { border: none; border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; }
.modal-header { background: var(--theme-line); color: #fff; border-bottom: 0; padding: 18px 24px; }
.modal-header .modal-title { font-weight: 700; font-size: 1.05rem; color: #fff; }
.modal-header .modal-title .bi, .modal-header .modal-title .text-danger { color: #fff !important; }
.modal-header .text-muted { color: rgba(255, 255, 255, .75) !important; }
.modal-header .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .8; }
.modal-body { padding: 22px 24px; }
.modal-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 14px 24px; gap: 8px; }
.modal-footer > * { margin: 0; }
.modal-backdrop { --bs-backdrop-bg: #0f172a; --bs-backdrop-opacity: .5; }

/* ============ FIELDS — light rose = empty, yellow while typing, green once filled ============ */
.form-label { font-size: .8rem; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control, .form-select { padding: 8px 13px; min-height: 40px; font-size: .86rem; font-weight: 500; line-height: 1.45; color: var(--ink); background-color: #fff0f0;
    border: 1.5px solid #bdb6b6; border-radius: 9px; box-shadow: inset 0 1px 2px rgba(20, 20, 40, .035);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
textarea.form-control { min-height: 72px; resize: vertical; }
.form-control::placeholder { color: #9698a8; font-weight: 400; }
.form-control:hover:not(:disabled):not([readonly]), .form-select:hover:not(:disabled) { border-color: #9a9292; background-color: #ffe8e8; }
.form-control-sm, .form-select-sm { padding: 5px 10px; font-size: .8rem; min-height: 34px; border-radius: var(--r-sm); }
.form-select { appearance: none; background-repeat: no-repeat; background-position: right 11px center; background-size: 15px 15px; padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236b6c78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); }
.form-select:hover, .form-select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235444D1' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); }
.form-select-sm { background-position: right 9px center; background-size: 13px 13px; padding-right: 29px; }
.form-text { color: var(--muted); }
.form-control:not([readonly]):not([type="file"]).is-filled, .form-select.is-filled { background-color: #eefaf3 !important; border-color: #72c496 !important; }
.form-control:not([readonly]):not([type="file"]):focus, .form-control:not([readonly]):not([type="file"]).is-typing,
.form-select:focus, .form-select.is-typing { background-color: #fffbe6 !important; border-color: #e8c65a !important; box-shadow: 0 0 0 3px rgba(232, 198, 90, .22) !important; outline: none; }
.form-control.is-invalid, .form-select.is-invalid { background-color: #fff4f4 !important; border-color: var(--danger) !important; }
.form-control[readonly], .form-control:disabled, .form-select:disabled { background-color: var(--surface-2); color: var(--muted); box-shadow: none; }
.input-group-text { padding: 8px 13px; font-size: .82rem; font-weight: 600; border-radius: 9px; background: var(--blue-50); border: 1.5px solid var(--line); color: var(--blue-700); }
.form-check-input { width: 1.2em; height: 1.2em; border: 1.8px solid #b3b5c4; cursor: pointer; transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease; }
.form-check-input[type="checkbox"] { border-radius: 6px; }
.form-check-input:hover:not(:disabled) { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(var(--t-rgb), .12); }
.form-check-input:focus { border-color: var(--blue-600); box-shadow: 0 0 0 4px rgba(var(--t-rgb), .16); }
.form-check-input:checked { background-color: var(--blue-600); border-color: var(--blue-600); box-shadow: 0 2px 7px rgba(var(--t-rgb), .35); }
.form-switch .form-check-input { width: 2.5em; height: 1.36em; border-radius: 2em; background-color: #d3d5df; border-color: #d3d5df; }
.form-switch .form-check-input:checked { background-color: var(--blue-600); border-color: var(--blue-600); }
.form-check-label { cursor: pointer; font-weight: 500; color: var(--ink); }
.calc-box { background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: 11px; padding: 13px 16px; }
.calc-box .v { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.form-err { color: #c62828; font-size: .85rem; font-weight: 500; }
.form-err:not(:empty)::before { content: "\F33A"; font-family: "bootstrap-icons"; margin-right: .35rem; }

/* filters */
.filter-card .card-body { padding: 16px 20px; }
.filter-card .form-label { color: var(--muted); font-size: .72rem; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.filter-card .form-control, .filter-card .form-select { min-height: 38px; font-size: .84rem; padding-left: 11px; }

/* ============ TABLES — framed inside the card, navy head, green wash on hover ============ */
.card > .table-responsive, .card > .table-responsive-lg, .card > .table-responsive-xl, .card > div > .table-responsive-lg { margin: 10px; border: 1px solid var(--line); border-radius: var(--r); width: auto; overflow: auto; }
.card > .table-responsive:not(:first-child), .card > .table-responsive-lg:not(:first-child) { margin-top: 12px; }
.app-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; background: var(--surface); font-size: .84rem; }
.app-table > thead > tr, .table > thead > tr { background: var(--theme-line); }
.app-table > thead > tr > th, .table > thead > tr > th { font-size: .68rem; letter-spacing: .6px; text-transform: uppercase; color: #fff; font-weight: 700; padding: 12px 14px; white-space: nowrap;
    vertical-align: middle; background: transparent; border: none; border-bottom: 2px solid var(--t-ink);
    --bs-table-bg: transparent; --bs-table-color: #fff; }
.table > thead > tr > th + th { box-shadow: inset 1px 0 0 rgba(255, 255, 255, .14); }
.table > thead > tr > th a { color: #fff; }
/* every table cell on one line (tables scroll sideways) */
.table th, .table td { white-space: nowrap; }
.app-table > tbody > tr > td, .app-table > tfoot > tr > td { padding: 11px 14px; vertical-align: middle; color: var(--ink); border: none; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
    --bs-table-bg: transparent; background-color: transparent; transition: background-color .14s ease; }
.app-table > tbody > tr > td:last-child, .app-table > tfoot > tr > td:last-child { border-right: none; }
.app-table > tbody > tr:last-child > td { border-bottom: none; }
.app-table > tbody > tr { background: var(--surface); }
.app-table > tbody > tr:hover > td { background: var(--row-hover); }
.app-table > tbody > tr:hover > td:first-child { box-shadow: inset 3px 0 0 0 var(--ok); }
.app-table > tbody > tr.row-muted td { color: #9a9cad; text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.app-table > tbody > tr.row-muted td.cell-actions { text-decoration: none; }
.app-table > tfoot > tr > td, .app-table tr.row-total > td { background: #f0f8ff; font-weight: 700; color: var(--brand-ink); border-top: 1px solid var(--blue-100); }
.app-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.app-table .nowrap { white-space: nowrap; }
.app-table .cell-actions { white-space: nowrap; text-align: center; width: 1%; }
.id-badge { display: inline-block; min-width: 42px; padding: 2px 8px; border-radius: 30px; background: var(--blue-50); color: var(--blue-700); font-weight: 700; font-size: .74rem; text-align: center; }
@media (max-width: 991px) {
    .card > .table-responsive-lg { border: 0; margin: 4px; }
}

/* action buttons in tables — colour carries the meaning, each with its own glow */
.act { --a: #6c757d; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 26px; height: 26px; padding: 0 7px; margin: 0 2px;
    border: none; border-radius: var(--r-sm); background: var(--a); color: #fff; font-size: .72rem; font-weight: 600; line-height: 1; text-decoration: none; cursor: pointer;
    box-shadow: 0 2px 5px rgba(20, 20, 40, .16); transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease; }
.act i { font-size: .76rem; line-height: 1; }
.act:hover, .act:focus-visible { background: color-mix(in srgb, var(--a) 82%, #000); color: #fff; transform: translateY(-1.5px); box-shadow: 0 5px 12px color-mix(in srgb, var(--a) 38%, transparent); }
.act:active { transform: translateY(0) scale(.94); }
/* every action button says what it does: its title (Edit, Delete, Print, Statement …) is shown beside the icon */
.act[title]::after { content: attr(title); font-size: .68rem; font-weight: 600; letter-spacing: .1px; white-space: nowrap; }
.act[title] { padding: 0 8px 0 6px; }
.act:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.act-view   { --a: var(--t-main); }
.act-edit   { --a: #1f9d63; }
.act-print  { --a: #475569; }
.act-pay    { --a: #2f6fb0; }
.act-del    { --a: #d64545; }
.act-cancel { --a: #e0702a; }
.act-toggle { --a: #7c5cd6; }
.act-key    { --a: #d98a15; }

/* status chips — soft pills */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 30px; font-size: .72rem; font-weight: 600; border: 0; white-space: nowrap; line-height: 1.45; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-active, .chip-completed, .chip-paid, .chip-billed, .chip-purchase { background: #e3f6ec; color: var(--ok); }
.chip-inactive, .chip-cancelled, .chip-reversed { background: #eef0f2; color: var(--muted); }
.chip-pending, .chip-partial, .chip-unbilled, .chip-issued { background: #fdf0dc; color: #b87211; }
.chip-unpaid { background: #fde6e6; color: var(--danger); }
.chip-adjustment, .chip-admin { background: var(--t-soft); color: var(--blue-600); }
.chip-staff { background: #e3ecf6; color: #2f6fb0; }

/* stat cards (detail pages) */
.stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit; height: 100%; transition: box-shadow .18s ease, transform .18s ease; }
.stat:hover { box-shadow: var(--shadow-hover); color: inherit; transform: translateY(-2px); }
.stat .ico, .kpi .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.stat .num { font-size: 1.1rem; font-weight: 700; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: .74rem; line-height: 1.3; }
.ico-blue { background: #e3ecf6; color: #2f6fb0; } .ico-green { background: #e3f6ec; color: var(--ok); } .ico-orange { background: #fdf0dc; color: var(--warn); }
.ico-red { background: #fde6e6; color: var(--danger); } .ico-purple { background: var(--t-soft); color: var(--blue-600); } .ico-teal { background: #dff4f4; color: #17a2a2; }
.ico-grey { background: var(--surface-2); color: var(--ink-2); } .ico-yellow { background: #fdf3d6; color: #b87211; }
/* totals strip above a list: one small tile per figure — label (small) on top, amount (b) below */
.sum-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; font-size: .86rem; color: var(--ink-2); }
.sum-row > span { display: flex; flex-direction: column; justify-content: space-between; gap: 2px; min-width: 0; padding: 8px 12px; background: #f8fafc; border: 1px solid #e6e3f7; border-radius: 10px; }
.sum-row > span > small { font-size: .68rem; font-weight: 600; line-height: 1.3; color: var(--muted); text-transform: uppercase; letter-spacing: .3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-row b { font-size: 1rem; font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sum-row > span.text-muted { grid-column: 1 / -1; padding: 0 2px; background: none; border: 0; }
.card-body.sum-row { padding: 10px; }
@media (max-width: 767px) {
    .sum-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .sum-row > span { padding: 7px 10px; }
    .sum-row > span > small { white-space: normal; }
    .sum-row b { font-size: .92rem; }
    .sum-row > span:last-child:nth-child(odd) { grid-column: 1 / -1; }     /* odd count: the last tile takes the full row */
}

/* ============ DASHBOARD — the doctor's working screen: head, KPIs, month strip, queue | follow-ups, 7 days | top lists ============ */
.dash2 { --ind: var(--t-main); --ind-50: var(--t-soft); --ind-100: var(--t-soft); --navy: var(--t-ink); --navy-2: var(--t-main); --sky: var(--t-main); --gold: var(--t-hi);
    display: flex; flex-direction: column; gap: 12px; }
/* laptop and bigger screens: the page fills the screen; queue | follow-ups and the bottom row are tall (they scroll inside) */
@media (min-width: 1200px) and (min-height: 640px) {
    .dash2 { min-height: calc(100vh - var(--top-h) - 110px); }
    .dash2 .d2-main { flex: 1.6 1 0; min-height: 400px; } .dash2 .d2-bottom { flex: 1 1 0; min-height: 310px; }
}
@media (max-width: 1199px), (max-height: 639px) { .d2-body { max-height: 440px; } .d2-chart { height: 270px; } }
/* head */
.d2-head { display: flex; align-items: center; gap: 16px; flex: none; }
.d2-hello { min-width: 0; }
.d2-hello h1 { font-size: 1.35rem; font-weight: 800; margin: 0; letter-spacing: -.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d2-hello .sub { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.d2-hello .sub i { color: var(--ind); }
.d2-actions { display: flex; gap: 8px; flex: none; margin-left: auto; }
/* dashboard head buttons: New OPD green, New patient red */
.btn-opd, .btn-opd:visited { padding: 10px 20px; font-size: .9rem; background: #15935b; border-color: #15935b; color: #fff; box-shadow: 0 6px 16px rgba(21, 147, 91, .32); }
.btn-opd:hover, .btn-opd:focus { background: #117a4b; border-color: #117a4b; color: #fff; box-shadow: 0 10px 22px rgba(21, 147, 91, .4); }
.btn-np, .btn-np:visited { padding: 10px 20px; font-size: .9rem; background: var(--t-ink); border-color: var(--t-ink); color: #fff; box-shadow: 0 6px 16px rgba(15, 30, 51, .3); }
.btn-np:hover, .btn-np:focus { background: var(--t-main); border-color: var(--t-main); color: #fff; box-shadow: 0 10px 22px rgba(15, 30, 51, .4); }
/* KPI tiles */
.d2-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; flex: none; }
.d2-kpi { --c: var(--ind); display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid #e1e8ef; border-top: 3px solid var(--c); border-radius: 6px;
    background: #fff;
    box-shadow: var(--shadow-card); color: var(--ink); text-decoration: none; min-width: 0; transition: transform .15s ease, box-shadow .15s ease; animation: dashIn .4s ease both; }
a.d2-kpi[href]:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.k-ic { width: 44px; height: 44px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 1.2rem; color: #fff; background: var(--c);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 35%, transparent); }
.k-txt { display: flex; flex-direction: column; min-width: 0; }
.k-lbl { font-size: .7rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-val { font-size: 1.5rem; font-weight: 800; line-height: 1.2; color: var(--ink); letter-spacing: -.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-sub { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tone-indigo { --c: var(--t-main); } .tone-amber { --c: #d98a15; } .tone-green { --c: #15935b; } .tone-teal { --c: #0f8f94; } .tone-red { --c: #c2414f; }
.d2-skel { height: 72px; background: linear-gradient(90deg, #fff 0%, #f1f5f9 50%, #fff 100%); background-size: 200% 100%; animation: skel 1.2s linear infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* cards */
.d2-main { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 12px; min-height: 0; }
.d2-bottom { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 3.5fr) minmax(0, 3.5fr); gap: 12px; min-height: 0; }
.d2-card { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid #e1e8ef; border-radius: 6px; box-shadow: var(--shadow-card); overflow: hidden; animation: dashIn .45s ease both; }
.d2-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 14px; background: var(--theme-line); color: #fff; flex: none;
    border-bottom: 2px solid var(--gold); }
.d2-t { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .88rem; color: #fff; margin-right: 4px; white-space: nowrap; letter-spacing: .2px; }
.d2-t i { color: var(--gold); }
.d2-more { margin-left: auto; font-size: .76rem; font-weight: 600; color: rgba(255, 255, 255, .82); text-decoration: none; }
.d2-more:hover { color: #fff; text-decoration: underline; }
.d2-note { margin-left: auto; font-size: .72rem; color: rgba(255, 255, 255, .75); }
.d2-card-head .chart-legend { margin-left: auto; gap: 10px; font-size: .72rem; color: rgba(255, 255, 255, .88); }
.d2-card-head .chip { background: rgba(255, 255, 255, .16) !important; color: #fff !important; border-color: transparent !important; }
.d2-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 10px; }
/* queue table */
.d2-queue .d2-body { padding: 0; }
.d2-qtable { font-size: .82rem; }
.d2-qtable thead { position: sticky; top: 0; z-index: 1; }
/* the queue header is a light band under the dark card head (not the same colour twice) */
.d2-qtable > thead > tr { background: var(--t-soft) !important; }
.d2-qtable thead th { padding: 7px 8px !important; background: transparent !important; color: var(--t-ink) !important; font-size: .64rem !important; letter-spacing: .7px;
    border-bottom: 2px solid var(--t-main) !important; box-shadow: none !important; }
.d2-qtable td { padding: 7px 8px; vertical-align: middle; border-bottom: 1px solid #edf1f5; }
.d2-qtable tbody tr:nth-child(even) td { background: #fafcfe; }
.d2-qtable tbody tr td:first-child { box-shadow: inset 3px 0 0 #15935b; }
.d2-qtable tbody tr.q-wait td { background: #fffaf0; }
.d2-qtable tbody tr.q-wait td:first-child { box-shadow: inset 3px 0 0 #d98a15; }
.d2-qtable tbody tr:hover td { background: var(--t-soft); }
.d2-qtable .q-pt b { color: var(--t-ink); }
.d2-qtable .tc { text-align: center; width: 48px; } .d2-qtable .tr { text-align: right; }
.d2-qtable .tok { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 50%; background: var(--t-ink); color: #fff; font-weight: 800; }
.d2-qtable tr.q-wait .tok { background: #d98a15; }
.d2-qtable .q-pt { white-space: normal; min-width: 140px; }
.d2-qtable .q-pt b { display: block; line-height: 1.25; }
.d2-qtable .q-pt small { display: block; color: var(--muted); font-size: .72rem; }
.act-call { --a: #15935b; }
.d2-qtable .act-print::after { content: none; }
.d2-qtable .act-print { padding: 0 6px; }
/* side tabs */
.d2-tabs { gap: 4px; }
.d2-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 4px 12px; border-radius: 20px; font-size: .8rem; font-weight: 600; color: rgba(255, 255, 255, .82); }
.d2-tabs button:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.d2-tabs button.on { background: #fff; color: var(--t-ink); }
.d2-tabs button b { min-width: 18px; padding: 0 5px; border-radius: 10px; background: rgba(255, 255, 255, .22); color: #fff; font-size: .7rem; }
.d2-tabs button.on b { background: var(--t-main); color: #fff; }
.d2-list { list-style: none; margin: 0; padding: 0; }
.d2-list li { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px dashed var(--line); font-size: .82rem; }
.d2-list li:last-child { border-bottom: 0; }
.l-main { flex: 1 1 0; min-width: 0; line-height: 1.25; }
.l-main a { color: var(--ink); text-decoration: none; } .l-main a:hover { color: var(--ind); }
.l-main small { display: block; color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-date { flex: none; min-width: 48px; text-align: center; padding: 3px 6px; border-radius: 6px; background: var(--ind-50); color: var(--ind); font-size: .72rem; font-weight: 700; }
.l-date.now { background: #fdf0dc; color: #b87211; } .l-date.over { background: #fde6e6; color: var(--danger); }
.l-av { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--t-main); color: #fff; font-weight: 800; text-transform: uppercase; }
.d2-list .act { flex: none; margin: 0; }
.d2-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; min-height: 110px; color: var(--muted); text-align: center; border: 0 !important; }
.d2-empty > i { font-size: 1.9rem; color: #9db9cf; }
.d2-empty b { font-weight: 600; font-size: .84rem; }
/* 7-day chart */
.d2-chart { position: relative; overflow: hidden; padding: 6px 8px 2px; }
.top-row.med .tr-bar i { background: #0f766e; }
.dash2 .tr-bar i { background: var(--t-ink); }
.dash2 .tr-bar { height: 10px; }
.dash2 .top-row { padding: 8px 2px; }
.dash2 .top-row b { color: var(--ind); }
@keyframes dashIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.d2-main .d2-card { animation-delay: .05s; } .d2-bottom .d2-card { animation-delay: .1s; }
/* hover a day to see its figures */
.chart-hit { cursor: pointer; }
.chart-hit.on { fill: rgba(var(--t-rgb), .07); }
.chart-tip { position: absolute; top: 6px; transform: translateX(-50%); z-index: 2; min-width: 170px; padding: 9px 12px; font-size: .78rem; line-height: 1.6; pointer-events: none;
    background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 26px rgba(15, 23, 42, .16); }
.chart-tip b { display: block; color: var(--ink); margin-bottom: 2px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chart-tip div span { margin-left: auto; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-tip .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .76rem; font-weight: 500; color: var(--ink-2); }
.chart-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.dot-visits { background: var(--t-hi); } .dot-main { background: var(--t-main); } .dot-fees { background: #0ea5a4; }
.d2-chart text.bar-val { fill: var(--t-ink); }
/* laptops: a little tighter */
@media (min-width: 1200px) and (max-width: 1440px) {
    .d2-kpi { padding: 10px 12px; gap: 10px; }
    .k-ic { width: 38px; height: 38px; font-size: 1.05rem; }
    .k-val { font-size: 1.3rem; }
}
/* tablets and phones: one column, lists scroll inside a fixed height */
@media (max-width: 1199px) {
    .d2-head { flex-wrap: wrap; }
    .d2-actions { margin-left: auto; }
    .d2-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .d2-main, .d2-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
    .d2-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .d2-kpi:last-child { grid-column: 1 / -1; }
    .d2-kpi { padding: 10px; gap: 8px; }
    .k-ic { width: 34px; height: 34px; font-size: 1rem; }
    .k-val { font-size: 1.2rem; }
    .d2-hello h1 { font-size: 1.15rem; white-space: normal; }
    .d2-actions { width: 100%; } .d2-actions .btn { flex: 1; }
}
/* ============ FORMS — "No. + Date" bar on the right of the first row, then numbered sections ============ */
.form-top { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px 18px; margin: -4px 0 18px; padding: 10px 14px;
    background: var(--t-soft2); border: 1px solid var(--blue-100); border-radius: 12px; }
.ft-item { display: flex; align-items: center; gap: 8px; margin: 0; }
.ft-lbl { font-size: .7rem; font-weight: 700; color: var(--blue-700); text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; margin: 0; }
.ft-val { display: inline-block; min-width: 110px; padding: 7px 14px; text-align: center; font-weight: 700; font-size: .86rem; color: var(--ink); background: #fff;
    border: 1.5px solid var(--line); border-radius: 9px; font-variant-numeric: tabular-nums; }
.form-top .form-control { width: 170px; min-height: 38px; }
.summary-strip { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 11px; background: var(--blue-50); border: 1px solid var(--blue-100); }
.modal-body .form-label { font-size: .78rem; }
@media (max-width: 575px) {
    .form-top { justify-content: stretch; }
    .ft-item { flex: 1 1 100%; justify-content: space-between; }
    .form-top .form-control { width: 60%; }
}
/* change password pop-up */
.pw-side { height: 100%; padding: 18px 18px 16px; border-radius: 14px; background: var(--t-soft); color: var(--ink-2); }
.pw-side li { margin-bottom: 6px; }
.pw-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; color: #fff; background: var(--brand); margin-bottom: 12px; box-shadow: 0 6px 14px rgba(var(--t-rgb), .35); }

/* ============ TYPE-TO-SEARCH DROP-DOWN (select with search-select) ============ */
.ss-wrap { position: relative; }
.ss-hidden { display: none !important; }
.ss-input { padding-right: 34px !important; cursor: text;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236b6c78' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5 14 14'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; background-size: 14px 14px; }
.ss-list { position: absolute; z-index: 1065; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; padding: 6px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(15, 23, 42, .18); }
.ss-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: .86rem; color: var(--ink); }
.ss-item small { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.ss-item.act { background: var(--blue-50); color: var(--blue-800); }
.ss-item.on { font-weight: 700; }
.ss-item.on::after { content: "\F26E"; font-family: "bootstrap-icons"; color: var(--blue-600); margin-left: auto; }
.ss-item.ss-none { color: var(--muted); font-style: italic; }
.ss-empty { padding: 10px; color: var(--muted); font-size: .84rem; text-align: center; }
.filter-card .ss-list { min-width: 240px; }

/* ============ RESPONSIVE TABLES — a wide table scrolls inside its own box at every width; the page never scrolls sideways ============ */
.table-responsive, .table-responsive-sm, .table-responsive-md, .table-responsive-lg, .table-responsive-xl, .table-responsive-xxl { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
main, .card, .modal-body, .tab-content, [class*="col-"] { min-width: 0; }
.app-table { min-width: 100%; }
/* laptops: a little tighter so more columns fit without scrolling */
@media (min-width: 992px) and (max-width: 1399px) {
    .app-table > thead > tr > th, .table > thead > tr > th { padding: 10px 10px !important; font-size: .64rem !important; letter-spacing: .4px; }
    .app-table > tbody > tr > td, .app-table > tfoot > tr > td { padding: 9px 10px !important; font-size: .8rem !important; }
    .act { min-width: 30px; height: 30px; padding: 0 7px; margin: 0 2px; }
}
/* tablets: same, page gutters smaller */
@media (min-width: 768px) and (max-width: 991px) { main.container-fluid { padding-left: 18px !important; padding-right: 18px !important; } }
/* big screens: more room, slightly larger text */
@media (min-width: 1800px) {
    body { font-size: .92rem; }
    main.container-fluid { padding-left: 36px !important; padding-right: 36px !important; }
    .app-table > tbody > tr > td, .app-table > tfoot > tr > td { font-size: .86rem !important; padding: 12px 15px !important; }
    .app-table > thead > tr > th { font-size: .72rem !important; padding: 13px 15px !important; }
}
/* a modal table on a phone scrolls sideways inside the pop-up */
.modal-body > .table-responsive, .modal-body .table-responsive { border: 1px solid var(--line); border-radius: var(--r); }
.modal-body > table.app-table { display: block; overflow-x: auto; }

/* ============ TABLE TEXT — one size everywhere ============ */
.app-table { font-size: .82rem; }
.app-table > tbody > tr > td, .app-table > tfoot > tr > td { font-size: .82rem; padding: 10px 13px; }
.app-table > thead > tr > th, .table > thead > tr > th { font-size: .68rem; padding: 11px 13px; }
.app-table td .small, .app-table td small { font-size: .74rem; }
.app-table td .chip { font-size: .7rem; }
.app-table th.sr, .app-table td.sr { width: 1%; text-align: center; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.app-table > thead > tr > th.sr { color: rgba(255, 255, 255, .85); }

/* ============ DETAIL PAGES ============ */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: .88rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; color: var(--ink); }
.bal-box { border: none; border-radius: var(--r-lg); background: var(--surface); padding: 14px 18px; height: 100%; box-shadow: var(--shadow-card); position: relative; overflow: hidden; }
.bal-box::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue-600); }
.bal-box .lbl { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.bal-box .v { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bal-box.due::before { background: var(--danger); } .bal-box.ok::before { background: var(--ok); } .bal-box.info::before { background: #2f6fb0; } .bal-box.warn::before { background: var(--warn); }
.nav-tabs { border-bottom: 1px solid var(--line); gap: 4px; }
.nav-tabs .nav-link { color: var(--muted); border: none; border-bottom: 2px solid transparent; font-weight: 600; font-size: .88rem; padding: 10px 16px; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--blue-700); background: transparent; }
.nav-tabs .nav-link.active { color: var(--blue-600); border-bottom-color: var(--blue-600); background: transparent; }

/* ============ BILL CREATE ============ */
.pick-table tr.picked > td { background: #eefaf3 !important; }
.totals-table td { padding: 7px 12px; font-size: .88rem; }
.totals-table tr.grand td { font-size: 1.05rem; font-weight: 700; border-top: 2px solid var(--blue-600); color: var(--brand-ink); }

/* ============ SESSIONS ============ */
/* session ending / ended: a box in the middle of the screen over a dimmed page */
.idle-warn { position: fixed; inset: 0; z-index: 3100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.idle-box { width: 100%; max-width: 380px; background: #fff; border-top: 5px solid var(--t-main); padding: 26px 24px 22px; text-align: center; box-shadow: var(--shadow-pop); animation: idleIn .2s ease both; }
.idle-box.ended { border-top-color: var(--danger); }
.idle-ic { width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: var(--t-soft); color: var(--t-main); }
.idle-box.ended .idle-ic { background: #fde6e6; color: var(--danger); }
.idle-box h5 { font-weight: 800; margin: 0 0 6px; }
.idle-time { font-size: 2rem; font-weight: 800; color: var(--t-main); font-variant-numeric: tabular-nums; line-height: 1.2; margin: 4px 0 6px; }
.idle-box p { color: var(--muted); font-size: .86rem; margin: 0 0 16px; }
.idle-box .btn { min-width: 130px; }
@keyframes idleIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.sess-table tr.sess-me td { background: #eefaf3; }

/* ---------- print (bills, receipts, statements, reports): black and white, A4, clean report layout ---------- */
body.print-body { background: #e9eaee; display: block; }
.print-page { background: #fff; max-width: 210mm; margin: 0 auto 24px; padding: 14mm 14mm 12mm; color: #111; font-family: "Manrope", "Noto Sans Devanagari", "Noto Sans Kannada", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 12px; line-height: 1.45;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .12); }
.print-page.landscape { max-width: 297mm; }
/* on a phone or tablet screen the A4 page keeps its layout and scrolls sideways inside itself (printing is unchanged) */
@media screen and (max-width: 1100px) {
    .print-page { overflow-x: auto; padding: 18px 14px; margin: 0 8px 16px; }
    .print-page > * { min-width: 680px; }
    .print-tools { padding: 0 8px; }
    .inv-head { flex-wrap: wrap; }
}
.print-page h1 { font-size: 20px; margin: 0; }
.print-page table { width: 100%; border-collapse: collapse; }
.print-page .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.print-page .c { text-align: center; }
.print-page .bordered th, .print-page .bordered td { border: 1px solid #000; padding: 6px 8px; vertical-align: top; }
.print-page .bordered th { background: #eeeeee; color: #000; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; border-bottom: 2px solid #000; }
.print-page .bordered, .print-page .rep-table, .print-page .rep-party, .print-page .rep-sum { border: 1.5px solid #000; }
.print-page .bordered tr.hl td { background: #eeeeee; font-size: 15px; font-weight: 800; }
/* faint grey header and total rows keep their shade when printed */
.print-page th, .print-page tfoot td, .print-page tr.sub td, .print-page tr.hl td, .rep-sum td, .app-table th, .app-table tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* party details on statements: plain "Label: value" lines in two columns, no table */
.rep-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 30px; margin: 0 0 14px; font-size: 12.5px; }
.rep-info span { display: inline-block; min-width: 92px; color: #444; font-weight: 600; }
.rep-info small { color: #555; }
.rcpt-due { margin-top: 16px; padding: 10px 14px; border: 1.5px solid #000; background: #eeeeee; font-size: 17px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rcpt-due b { font-size: 20px; font-weight: 800; }
.doc-foot { margin: 22px 0 0; padding-top: 8px; border-top: 1px solid #000; text-align: center; font-size: 11px; color: #333; }
.print-page .bordered td { white-space: nowrap; }
.print-tools { max-width: 210mm; margin: 14px auto; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 0; }
.print-tools.landscape { max-width: 297mm; }
/* firm heading on every printed page */
.inv-head { display: flex; gap: 18px; align-items: center; padding: 0 0 12px; margin-bottom: 14px; border-bottom: 2.5px solid #000; }
.inv-head img { max-height: 64px; max-width: 120px; filter: grayscale(1); }
.inv-head .firm { font-size: 23px; font-weight: 800; color: #000; margin: 0 0 3px; line-height: 1.15; letter-spacing: -.3px; }
.inv-head .meta { font-size: 11.5px; line-height: 1.55; color: #222; }
.inv-head .meta i { color: #000; margin-right: 5px; }
.inv-head .doc { text-align: right; white-space: nowrap; font-size: 11.5px; line-height: 1.6; }
.inv-head .doc .t { display: inline-block; border: 1.5px solid #000; color: #000; font-weight: 800; font-size: 14px; letter-spacing: 1px; padding: 4px 14px; margin-bottom: 6px; }
/* bank details and UPI QR: two separate framed boxes side by side */
.pay-wrap { display: flex; gap: 12px; margin-top: 12px; align-items: stretch; }
.pay-box { border: 1.5px solid #000; padding: 0 0 10px; }
.pay-box .ttl { font-weight: 700; color: #000; margin-bottom: 8px; padding: 6px 12px; text-transform: uppercase; font-size: 10.5px; letter-spacing: .6px;
    background: #eeeeee; border-bottom: 1px solid #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pay-box .ttl i { color: #000; }
.pay-box.bank { flex: 1 1 auto; }
.pay-box.bank table { margin: 0 12px; width: calc(100% - 24px); }
.pay-box.bank td { padding: 3px 10px 3px 0; white-space: nowrap; border-bottom: 1px dotted #999; }
.pay-box.bank tr:last-child td { border-bottom: 0; }
.pay-box.bank td.k { color: #444; width: 1%; }
.pay-box.qr { flex: 0 0 170px; text-align: center; font-size: 10.5px; }
.pay-box.qr svg, .pay-box.qr img { width: 118px; height: 118px; display: block; margin: 0 auto 4px; }
.print-head { border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; display: flex; gap: 14px; align-items: center; }
.print-head img { max-height: 64px; max-width: 120px; }
.stamp { display: inline-block; border: 3px solid #000; color: #000; padding: 2px 10px; font-weight: 800; font-size: 18px; transform: rotate(-6deg); }
/* statements and reports */
.rep-party, .rep-sum { margin-bottom: 12px; }
.rep-party td { border: 1px solid #000; padding: 8px 12px; vertical-align: top; font-size: 12px; }
.rep-party .big { font-size: 15px; }
.rep-party .k, .rep-sum .k { display: block; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #444; margin-bottom: 3px; }
.rep-sum td { border: 1px solid #000; padding: 8px 12px; vertical-align: top; width: 1%; white-space: nowrap; background: #f6f6f6; }
.rep-sum b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.rep-sum small { display: block; font-size: 9.5px; color: #444; }
.rep-table th, .rep-table td { border: 1px solid #000; padding: 6px 9px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rep-table thead th { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid #000; text-align: left; background: #eeeeee; }
.rep-table thead th.r { text-align: right; }
.rep-table thead th.c { text-align: center; }
.rep-table td.wrap { white-space: normal; }
.rep-table tr.sub td, .rep-table tfoot td { font-weight: 700; background: #f3f3f3; }
.rep-table tfoot td { border-top: 2px solid #000; background: #eeeeee; }
.rep-table .muted { color: #555; padding: 18px; }
.rep-note { margin: 10px 0 0; font-size: 10.5px; color: #333; }
.rep-foot { margin: 14px 0 0; padding-top: 6px; border-top: 1px solid #000; font-size: 10px; color: #444; text-align: center; }
.pdf-foot { text-align: center; font-size: 10.5px; color: #333; }
/* client-wise work report: one summary box per client above the entries */
.rep-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin: 10px; }
.rs-item { border: 1px solid var(--line); border-left: 3px solid var(--blue-600); border-radius: 10px; padding: 10px 14px; background: #fff; }
.rs-name { font-weight: 700; margin-bottom: 6px; }
.rs-figs { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.rs-figs span { display: flex; flex-direction: column; }
.rs-figs small { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.rs-figs b { font-variant-numeric: tabular-nums; }
@media print {
    .rep-summary { margin: 0 0 10px; }
    .rs-item { border: 1px solid #000; border-radius: 0; background: #f3f3f3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media print {
    /* margin 0 = the browser prints no address / date line; the page keeps its own margin as padding (on every page) */
    @page { size: A4; margin: 0; }
    .print-page, body:not(.print-body) main.container-fluid { padding: 11mm 12mm 16mm !important; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
    .pdf-foot { position: fixed; left: 0; right: 0; bottom: 5mm; display: block !important; letter-spacing: .3px; }
    .rep-foot { display: none; }
    body, body.print-body { background: #fff !important; display: block; }
    .print-page { padding: 0; margin: 0; max-width: none; box-shadow: none; }
    .print-tools, .d-print-none { display: none !important; }
    thead { display: table-header-group; }
    tr { break-inside: avoid; }
    .app-main { margin-left: 0 !important; min-height: 0; }
    main.container-fluid { padding: 0 !important; }
    body { font-size: 11px; }
    /* reports page (reports.php): the same black and white report look */
    .card { border: 0 !important; box-shadow: none !important; }
    .card > .table-responsive, .card > .table-responsive-lg { margin: 0 !important; border: 0 !important; overflow: visible !important; }
    .app-table { font-size: 10.5px !important; }
    .app-table { border: 1.5px solid #000 !important; }
    .app-table > thead > tr > th { background: #eeeeee !important; color: #000 !important; border: 1px solid #000 !important; border-bottom: 2px solid #000 !important; box-shadow: none !important;
        font-size: 9.5px !important; padding: 5px 7px !important; }
    .app-table > tbody > tr > td, .app-table > tfoot > tr > td { color: #000 !important; background: #fff !important; border: 1px solid #000 !important; font-size: 10.5px !important; padding: 4px 7px !important; box-shadow: none !important; }
    .app-table > tfoot > tr > td, .app-table tr.row-total > td { font-weight: 700; border-top: 2px solid #000 !important; background: #eeeeee !important; }
    .app-table .text-danger, .app-table .text-success { color: #000 !important; }
    .chip { background: none !important; color: #000 !important; padding: 0 !important; }
    .chip::before { display: none; }
}
.qr-preview { border: 1px dashed #a59cf0; background: #f8f7ff; padding: .75rem; text-align: center; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 170px; }
.qr-preview svg { width: 150px; height: 150px; background: #fff; }

/* ===================== Phones: app look (bottom menu, + button, folded filters, card rows, full-screen forms) ===================== */
.bottom-nav, .filter-toggle { display: none; }
@media screen and (max-width: 767px) {
    :root { --bn-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px); }
    body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
    .app-main { padding-bottom: calc(var(--bn-h) + var(--safe-b)); }
    main.container-fluid { padding: 12px 12px 84px !important; }

    /* top bar: compact, the side menu opens from "More" in the bottom bar */
    .app-topbar { height: 56px; padding: 0 12px; }
    .app-topbar .top-btn { display: none; }
    .top-crumb { display: none !important; }
    .top-title { font-size: 1.05rem; }
    .page-title { font-size: 1.2rem; }
    .page-sub { font-size: .78rem; }

    /* bottom menu bar */
    .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1032; height: calc(var(--bn-h) + var(--safe-b)); padding: 0 4px var(--safe-b);
        background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(15, 23, 42, .08); }
    .bn-item { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; padding: 0;
        color: #64748b; font-size: .66rem; font-weight: 600; text-decoration: none; }
    .bn-item i { font-size: 1.15rem; line-height: 1; width: 48px; height: 28px; display: grid; place-items: center; border-radius: 14px; transition: background-color .15s ease; }
    .bn-item span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bn-item.active { color: var(--t-main); }
    .bn-item.active i { background: var(--t-soft); }
    .side-backdrop { z-index: 1035; }
    .toast-container { padding: 10px !important; left: 0; }

    /* "New …" button of a list → round + button above the bottom bar */
    .btn-new { position: fixed; right: 16px; bottom: calc(var(--bn-h) + var(--safe-b) + 16px); z-index: 1031; width: 56px; height: 56px; padding: 0; border-radius: 50%;
        display: grid; place-items: center; font-size: 0; box-shadow: 0 8px 22px rgba(var(--t-rgb), .45); }
    .btn-new i { font-size: 1.5rem; margin: 0 !important; }

    /* filters folded behind a "Filters" button */
    .filter-toggle { display: flex; align-items: center; width: 100%; margin-bottom: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line);
        border-radius: 12px; color: var(--ink); font-size: .88rem; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
    .filter-toggle.open { border-color: #b9b5e6; color: var(--t-main); }
    .filter-toggle.open .bi-chevron-down { transform: rotate(180deg); }
    .filter-toggle .ft-dot { width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--danger); }
    .filter-toggle + .filter-card:not(.f-open) { display: none; }
    .filter-card .card-body { padding: 12px; }

    /* tables stay tables: they scroll sideways inside their card (swipe), with compact text */
    .table-responsive-lg, .table-responsive { -webkit-overflow-scrolling: touch; }
    .app-table { font-size: .8rem; }
    .app-table > thead > tr > th { font-size: .62rem !important; padding: 8px 8px !important; }
    .app-table > tbody > tr > td, .app-table > tfoot > tr > td { padding: 7px 8px !important; }
    .app-table .cell-actions .act { height: 28px; }
    .card > .table-responsive-lg { margin: 0; }

    /* forms (pop-ups) full screen, title on top and Back / Save fixed at the bottom */
    .modal:not(#confirmModal) .modal-dialog { margin: 0; max-width: none; min-height: 100%; align-items: stretch; }
    .modal:not(#confirmModal) .modal-content { min-height: 100vh; min-height: 100dvh; border-radius: 0; overflow: visible; }
    .modal:not(#confirmModal) .modal-header { position: sticky; top: 0; z-index: 3; }
    .modal:not(#confirmModal) .modal-body { flex: 1 0 auto; }
    .modal:not(#confirmModal) .modal-footer { position: sticky; bottom: 0; z-index: 3; padding: 10px 12px calc(10px + var(--safe-b)); box-shadow: 0 -4px 14px rgba(15, 23, 42, .08); flex-wrap: wrap; }
    .modal:not(#confirmModal) .modal-footer > .btn, .modal:not(#confirmModal) .modal-footer > a.btn { flex: 1 1 calc(50% - 8px); min-height: 44px; white-space: nowrap; }
}
/* PDF viewer (makePdf in assets/js/script.js): the made PDF over the page, with Download / Close */
.pdf-viewer { position: fixed; inset: 0; z-index: 4000; display: flex; flex-direction: column; background: rgba(15, 23, 42, .78); backdrop-filter: blur(3px); }
.pdf-viewer .pv-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--t-ink); color: #fff; font-weight: 600; }
.pdf-viewer .pv-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-viewer iframe { flex: 1; width: 100%; border: 0; background: #525659; }
/* the page copy html2pdf.js draws: keep it at the left edge (centred, it is cut off on the left) */
.html2pdf__container { margin: 0 !important; right: auto !important; }
/* phones and tablets: the made PDF as a sheet from the bottom — Share (WhatsApp …), Download, Close */
.pdf-sheet { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 23, 42, .55); }
.pdf-sheet .ps-box { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 10px; padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 30px rgba(15, 23, 42, .25); text-align: center; animation: psUp .22s ease-out; }
.pdf-sheet .ps-icon { font-size: 2.6rem; line-height: 1; color: #d64545; }
.pdf-sheet .ps-name { font-weight: 700; word-break: break-word; }
.pdf-sheet .ps-size { margin-top: -6px; font-size: .78rem; color: var(--muted); }
.pdf-sheet .btn { min-height: 46px; font-weight: 600; }
@keyframes psUp { from { transform: translateY(100%); } to { transform: none; } }
.pdf-cover { position: fixed; inset: 0; z-index: 3990; display: flex !important; align-items: center; justify-content: center; background: #f5f5fa; color: var(--t-hover); font-weight: 600; font-size: 1rem; }

/* installed app (no browser bar): leave room for the phone's status bar */
@media (display-mode: standalone) { .app-topbar { padding-top: env(safe-area-inset-top, 0px); height: calc(var(--top-h) + env(safe-area-inset-top, 0px)); } }

/* =====================================================================================================
   OPD MANAGEMENT SOFTWARE — additions (kept below the shared design system)
   ===================================================================================================== */

/* focus mode (OPD entry page): no sidebar, no top bar, the page brings its own slim header */
body.focus-mode .app-sidebar, body.focus-mode .app-topbar, body.focus-mode .side-backdrop, body.focus-mode .bottom-nav { display: none !important; }
body.focus-mode .app-main { margin-left: 0; }
body.focus-mode main.container-fluid { padding: 10px 14px 12px !important; }
/* OPD page only: a clear theme-tinted background (the white cards stand out) and a softer red #ea5350 */
body.focus-mode { --danger: #ea5350; background: linear-gradient(160deg, rgba(var(--t-rgb), .2) 0%, rgba(var(--t-rgb), .1) 100%) fixed, #e9eef5; }
body.focus-mode .btn-danger, body.focus-mode .btn-back, body.focus-mode .btn-clear { background: #ea5350; border-color: #ea5350; box-shadow: 0 4px 12px rgba(234, 83, 80, .3); }
body.focus-mode .btn-danger:hover, body.focus-mode .btn-back:hover, body.focus-mode .btn-clear:hover { background: #d63f3c; border-color: #d63f3c; }

/* page heading row used by every tab */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.page-head > :first-child { margin-right: auto; min-width: 0; }

/* the clear focus ring on the active field (keyboard users) */
.form-control:focus, .form-select:focus, .form-check-input:focus { outline: 2px solid rgba(var(--t-rgb), .55) !important; outline-offset: 1px; }

/* roles and visit types */
.chip-doctor { background: #e3f3f2; color: #0f8f94; }
.chip-receptionist { background: #e3ecf6; color: #2f6fb0; }
.chip-new { background: var(--t-soft); color: var(--blue-600); }
.chip-demo { background: #e3ecf6; color: #2f6fb0; }

/* group buttons with counts above a list (Investigation master) */
.count-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.count-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 30px; border: 1px solid var(--line); background: var(--surface);
    color: var(--ink-2); font-size: .8rem; font-weight: 600; cursor: pointer; transition: all .15s ease; }
.count-pill b { min-width: 22px; padding: 1px 7px; border-radius: 20px; background: var(--surface-2); color: var(--ink); text-align: center; font-variant-numeric: tabular-nums; }
.count-pill:hover { border-color: var(--blue-400); color: var(--blue-700); }
.count-pill.on { background: var(--brand); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(var(--t-rgb), .28); }
.count-pill.on b { background: rgba(255, 255, 255, .25); color: #fff; }

/* empty state inside a list */
.empty-state { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty-state i { display: block; font-size: 2.4rem; color: var(--blue-400); margin-bottom: 8px; }
.empty-state b { display: block; color: var(--ink); font-size: .98rem; margin-bottom: 2px; }

.setup-list { list-style: none; margin: 0; padding: 0; }
.setup-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px dashed var(--line); }
.setup-list li:last-child { border-bottom: 0; }
.setup-list .s-ic { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.setup-list li.done .s-ic { background: #e3f6ec; color: var(--ok); }
.setup-list li.done .s-t { color: var(--muted); text-decoration: line-through; }
.setup-list .s-t { flex: 1; min-width: 0; font-weight: 600; }
.setup-list .s-t small { display: block; font-weight: 400; color: var(--muted); text-decoration: none; }
.soon-card { border: 1px dashed var(--blue-400); background: var(--t-soft2); }
.soon-card .soon-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 1.3rem; }

/* settings: English / मराठी / ಕನ್ನಡ tabs of the clinic profile */
.lang-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; background: var(--surface-2); border-radius: var(--r); margin-bottom: 14px; }
.lang-tabs button { flex: 1 1 0; min-width: 96px; border: 0; background: transparent; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 600; color: var(--ink-2); }
.lang-tabs button.on { background: #fff; color: var(--blue-700); box-shadow: 0 2px 8px rgba(15, 23, 42, .1); }
.lang-tabs .miss { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 20px; background: #fdf0dc; color: #b87211; font-size: .7rem; }
[lang="kn"], .kn { font-family: 'Noto Sans Kannada', 'Manrope', sans-serif; }
.logo-box { width: 132px; height: 132px; border: 1px dashed var(--line); border-radius: var(--r); display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-box i { font-size: 2rem; color: var(--muted); }
.rx-preview { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: #fff; font-size: .82rem; }
.rx-preview .rp-name { font-weight: 800; font-size: 1.05rem; color: var(--blue-800); }
.rx-preview .rp-doc { font-weight: 700; }
.rx-preview .rp-line { color: var(--muted); }

/* one-time setup page */
body.install-page { background: #f4f6f9; }


/* =====================================================================================================
   PHASE 2 — patient search, OPD entry (focus mode), OPD list, patient history
   ===================================================================================================== */
.min-w-0 { min-width: 0; }
.pre { white-space: pre-line; }
/* table cells whose text may wrap (remarks, translations, complaints, audit details) */
.td-wrap { white-space: normal !important; }
.td-wide { min-width: 180px; }
.td-break { word-break: break-word; }
.toast-stack { z-index: 1090; }
.install-box { max-width: 540px; }
kbd { background: #fff; color: var(--blue-800); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: .68rem; font-weight: 700; box-shadow: 0 1px 0 var(--line); }
.btn kbd { margin-left: 4px; background: rgba(255, 255, 255, .22); color: inherit; border-color: rgba(255, 255, 255, .35); box-shadow: none; }
.btn-soft kbd { background: #fff; color: var(--blue-700); border-color: var(--line); }

/* ---- type-ahead lists (patient search, medicines, complaints, tests …) — drawn on <body> ---- */
.ac-drop { position: fixed; z-index: 2100; overflow-y: auto; background: #fff; border: 1px solid var(--t-line); border-radius: 10px; box-shadow: 0 16px 38px rgba(15, 23, 42, .18); padding: 6px; text-align: left; }
.ac-item { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; min-height: 38px; padding: 8px 14px 8px 12px; border-radius: 7px; cursor: pointer;
    line-height: 1.35; text-align: left; border-left: 3px solid transparent; transition: background-color .1s ease, border-color .1s ease; }
.ac-item + .ac-item { margin-top: 2px; }
.ac-item span { font-size: .86rem; color: var(--ink); font-weight: 500; white-space: pre-line; }
.ac-item small { font-size: .72rem; color: var(--muted); }
.ac-item em { font-style: normal; color: var(--blue-600); font-weight: 600; font-size: .78rem; }
.ac-item:hover { background: #f0f8ff; border-left-color: #7dd3fc; }
/* the highlighted row shares the class name "act" with the small table buttons (.act) — undo the button look here */
.ac-item.act { display: flex; justify-content: center; min-width: 0; height: auto; margin: 2px 0 0; padding: 8px 14px 8px 12px; gap: 2px;
    border: 0; border-left: 3px solid var(--blue-600); border-radius: 7px; background: var(--t-soft); color: inherit; font-size: inherit; font-weight: inherit; line-height: 1.35;
    box-shadow: none; transform: none; cursor: pointer; }
.ac-item.act:first-child { margin-top: 0; }
.ac-item.act:hover, .ac-item.act:focus-visible, .ac-item.act:active { background: #d6ecfb; color: inherit; transform: none; box-shadow: none; }
.ac-item.act span { color: var(--blue-900); font-weight: 600; }
.ac-item.ps-new span { color: var(--ok); font-weight: 700; }
.ac-empty { padding: 8px 10px; font-size: .8rem; color: var(--muted); }
.ac-head { padding: 4px 10px 6px; font-size: .74rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--t-line); margin-bottom: 4px; }
/* the list of a drop-down (selectSearch): search box on top, the current choice marked */
.sel-drop { padding-top: 0; }
.sel-q { position: sticky; top: 0; z-index: 1; display: block; width: 100%; height: 36px; margin: 0 0 6px; padding: 0 10px; border: 1px solid var(--t-line);
    border-radius: 0; background: #fff; font-size: .86rem; color: var(--ink); outline: none; box-shadow: 0 6px 0 #fff, 0 -6px 0 #fff; }
.sel-q:focus { border-color: var(--blue-400); background: #fffbe6; }
.sel-drop .ac-item.on { border-left-color: var(--blue-600); }
.sel-drop .ac-item.on span { color: var(--blue-900); font-weight: 600; }
.sel-drop .ac-item.on span::after { content: " \2713"; color: var(--blue-600); font-weight: 700; }
.ps-wrap { position: relative; }
.ps-wrap .form-control { padding-left: 34px; }
.ps-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--blue-600); pointer-events: none; z-index: 2; }
.top-search { width: 340px; }
.top-search .form-control { border-radius: 30px; }

/* ---- OPD entry: slim header + left (entry, 7 numbered steps) / right (history, grey = reference), each side scrolling inside.
   Colours have one meaning each: blue = headers, chosen items and the main action · green = Save · orange = a vital outside
   the usual range · red = warnings only (allergy, unsaved changes) and the small Back button. ---- */
body.focus-mode .app-footer { padding: 4px 0 !important; font-size: .72rem; }
.opd-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px; margin-bottom: 12px; background: var(--theme-line); color: #fff; border-radius: 0;
    box-shadow: 0 4px 14px rgba(var(--t-rgb), .3); }
.opd-top .btn-soft { background: rgba(255, 255, 255, .14); color: #fff; }
.opd-top .btn-soft:hover { background: rgba(255, 255, 255, .26); color: #fff; box-shadow: none; }
.opd-top kbd { background: rgba(0, 0, 0, .22); color: #fff; }
.opd-top .chip { background: rgba(255, 255, 255, .16); color: #fff; }
.opd-top .chip-pending { background: #ffe8a3; color: #6b4e00; }
.opd-back { background: #ea5350; color: #fff; border: 1px solid #ea5350; box-shadow: 0 4px 12px rgba(234, 83, 80, .3); }
.opd-back:hover, .opd-back:focus { background: #d63f3c; border-color: #d63f3c; color: #fff; }
.opd-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: rgba(255, 255, 255, .28); }
.opd-top .opd-big { padding: 7px 16px; font-size: .9rem; font-weight: 700; }
.opd-top .btn-success.opd-big { background: #1f9d63; border-color: #1f9d63; box-shadow: 0 4px 12px rgba(31, 157, 99, .35); }
.opd-top .btn-print.opd-big { background: #fff; color: var(--t-ink); box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.opd-top .btn-print.opd-big kbd { background: var(--t-soft); color: var(--t-ink); }
.opd-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.opd-brand b { display: block; font-size: .98rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.opd-brand small { color: rgba(255, 255, 255, .78); font-size: .74rem; }
/* current time, big, just before the Back button */
.opd-clock { display: inline-flex; align-items: center; gap: 7px; margin-right: 4px; color: #fff; font-size: 1.10rem; font-weight: 700; line-height: 1; letter-spacing: .3px;
    white-space: nowrap; font-variant-numeric: tabular-nums; }
.opd-clock i { font-size: 1.1rem; color: rgba(255, 255, 255, .8); }
.ob-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; }
.opd-state { display: flex; gap: 6px; flex-wrap: wrap; }
.opd-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.opd-shell { display: grid; grid-template-columns: minmax(0, 60fr) minmax(0, 40fr); gap: 16px; height: calc(100vh - 124px); min-height: 520px; }
.opd-left, .opd-right { overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.opd-right { background: #f4f6f9; border: 1px solid var(--line); border-radius: 0; padding: 14px; }
.opd-card { background: #fff; border-radius: 0; box-shadow: var(--shadow-card); padding: 14px 16px 16px; margin-bottom: 16px; border-left: 3px solid #e2e8f0; transition: border-color .15s ease, box-shadow .15s ease; }
.opd-card:focus-within { border-left-color: var(--blue-600); box-shadow: 0 2px 6px rgba(15, 23, 42, .05), 0 8px 22px rgba(var(--t-rgb), .12); }
.opd-left .form-label { font-size: .76rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.opd-left .form-control, .opd-left .form-select { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: .88rem; }
.opd-left .form-control-lg { min-height: 42px; font-size: 1rem; }
.opd-left textarea.form-control { min-height: 0; }
.opd-left .row.g-2 { --bs-gutter-y: .75rem; --bs-gutter-x: .9rem; }
/* step header (number · icon · title · "?" tip): a #d7e5ff strip across the top of its card */
.opd-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; letter-spacing: .2px; margin: -14px -16px 12px; padding: 7px 16px; background: #d7e5ff;
    border-bottom: 1px solid #b9cdf2; color: #0f2f5f; flex-wrap: wrap; }
.opd-card:focus-within .opd-h { background: #c9dcfd; }
.opd-h > i { color: #2861ac; }
.opd-no { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #2861ac; color: #fff; font-size: .74rem; font-weight: 800; }
.opd-tip { color: var(--muted); font-size: .85rem; cursor: help; }
.opd-tip:hover { color: var(--blue-600); }
.hint { margin-left: auto; font-size: .68rem; font-weight: 500; color: var(--muted); }
.rx { font-size: 1.15rem; font-weight: 800; color: var(--blue-700); line-height: 1; }
/* the chosen patient: a light card, not an alarm */
.pt-strip { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #ea5350; border: 1px solid #ea5350; border-left: 3px solid #c9302d; min-height: 46px; color: #fff; }
.pt-strip .pt-main b { color: #fff; }
.pt-strip .pt-main small { color: rgba(255, 255, 255, .9); }
.pt-strip .pt-av { background: #fff; color: #ea5350; }
.pt-strip .btn-soft { background: #fff; color: #ea5350; border-color: #fff; }
.pt-main { flex: 1; min-width: 0; line-height: 1.25; }
.pt-main b { display: block; font-size: .98rem; }
.pt-main small { color: var(--ink-2); font-size: .76rem; }
.pt-av { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; text-transform: uppercase; }
.pt-av.lg { width: 44px; height: 44px; font-size: 1.1rem; }
/* vitals: one row of 6, the unit inside the box; orange = outside the usual range */
.vitals { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.vt-in { position: relative; }
.vt-in .form-control { padding-right: 46px; }
.vt-unit { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: .68rem; color: var(--muted); pointer-events: none; }
.vt.warn .form-control, .vt.warn .form-control.is-filled { background-color: #fff1e0 !important; border-color: #f0a048 !important; color: #8a4b00; font-weight: 700; }   /* over the green "filled" colour */
.vt.warn .form-label { color: #b86400; }
.vt.warn .form-label::after { content: "\F33A"; font-family: bootstrap-icons; font-weight: 400; margin-left: 2px; }
@media (max-width: 767px) { .vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); } .vt-in .form-control { padding-right: 30px; padding-left: 8px; } .vt-unit { right: 5px; font-size: .6rem; } }

/* complaint / test tags: the box looks like the other fields */
.tag-box { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 36px; padding: 4px 6px; border: 1.5px solid #bdb6b6; border-radius: 9px; background: #fff0f0;
    box-shadow: inset 0 1px 2px rgba(20, 20, 40, .035); cursor: text; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.tag-box:hover { border-color: #9a9292; background: #ffe8e8; }
.tag-box.is-filled { background: #eefaf3; border-color: #72c496; }
.tag-box:focus-within { border-color: #e8c65a; background: #fffbe6; box-shadow: 0 0 0 3px rgba(232, 198, 90, .22); }
.tag-box .tag-input::placeholder { color: #7a7f93; font-weight: 500; }
.tag-box:focus-within .tag-input { font-size: .92rem; font-weight: 600; }
/* chosen complaints: solid theme colour, white text */
.tag-box .tag { background: var(--t-main); color: #fff; box-shadow: 0 2px 6px rgba(var(--t-rgb), .3); }
.tag-box .tag em { color: rgba(255, 255, 255, .85); }
.tag-box .tag-x:hover { color: #ffd2d1; }
.tag { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 20px; background: var(--t-soft); color: var(--t-ink); font-size: .78rem; font-weight: 600; cursor: pointer; }
.tag em { font-style: normal; font-weight: 500; color: var(--muted); }
.tag-test { background: #e3f3f2; color: #0f7f84; cursor: default; }
.tag-x { border: 0; background: transparent; color: inherit; padding: 0 3px; line-height: 1; opacity: .7; }
.tag-x:hover { opacity: 1; color: var(--danger); }
.tag-input { flex: 1; min-width: 140px; border: 0; outline: none !important; background: transparent; border-radius: 6px; font-size: .88rem; padding: 3px 8px; }
/* quick picks: solid light chips; blue with ✓ once added */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-btn { border: 1px solid var(--line); background: #f6f8fb; color: var(--ink-2); border-radius: 20px; padding: 3px 11px; font-size: .74rem; font-weight: 600; }
.chip-btn:hover { background: var(--t-soft); border-color: var(--t-line); color: var(--t-ink); }
.chip-btn.on { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.chip-more { border: 0; background: transparent; color: var(--blue-600); font-size: .74rem; font-weight: 700; padding: 3px 6px; }
.chip-more:hover { text-decoration: underline; }
.chip-clear { color: var(--danger); border-color: #f1c0c0; background: #fff6f6; }

/* medicines table: taller zebra rows; on wide screens the header stays on top while the left side scrolls */
.med-table { margin: 0; border-collapse: separate; border-spacing: 0; }
.med-table thead tr { background: var(--theme-line); }
.med-table > thead > tr > th { background: var(--t-main); color: #fff; font-size: .62rem !important; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding: 6px 8px !important; line-height: 1.2; white-space: nowrap; }
@media (min-width: 1200px) {
    .opd-left .table-responsive { overflow: visible; }
    .med-table > thead > tr > th { position: sticky; top: -1px; z-index: 2; }
}
.med-table td { padding: 5px 4px; vertical-align: middle; border-bottom: 1px solid var(--line-2); }
.med-table > tbody > tr:nth-child(even) > td { background: #f7f9fc; }
.med-table .form-control, .med-table .form-select { min-height: 34px !important; padding: 4px 8px !important; font-size: .84rem !important; }
.med-table td.sr { width: 28px; text-align: center; color: var(--muted); font-weight: 600; font-size: .78rem; }
.med-table .c-med { position: relative; min-width: 200px; }
.med-table .c-dose { width: 104px; } .med-table .c-time { width: 128px; } .med-table .c-days { width: 56px; } .med-table .c-qty { width: 60px; }
.med-table .c-ins { min-width: 130px; } .med-table .c-x { width: 36px; text-align: center; }
.med-table tr.row-blank td { background: #fff !important; }
.med-table tr.row-blank .c-med .form-control:not(:focus) { border-style: dashed; border-color: var(--t-line); background: #fbfdff; }
.med-new { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--ok); font-size: .8rem; }

/* tests */
.sel-tests { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.inv-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.inv-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 3px 11px; font-size: .74rem; font-weight: 600; color: var(--ink-2); }
.inv-tabs button.on { background: var(--brand); color: #fff; border-color: transparent; }
.inv-tabs button b { display: inline-block; min-width: 16px; margin-left: 3px; border-radius: 10px; background: #e3f6ec; color: var(--ok); font-size: .66rem; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 8px; max-height: 140px; overflow-y: auto; padding: 6px; border: 1px solid var(--line-2); border-radius: 8px; }
.inv-item { display: flex; align-items: center; gap: 5px; font-size: .78rem; padding: 3px 5px; border-radius: 5px; cursor: pointer; margin: 0; color: var(--ink-2); font-weight: 500; }
.inv-item:hover { background: var(--surface-2); }
.inv-item.on { background: var(--t-soft); color: var(--t-ink); font-weight: 700; }
.opd-save .btn { padding: 9px 10px; font-weight: 700; }

/* history panel (right, grey = for reference): patient card, then the visits — the last one open */
.hist-empty { text-align: center; padding: 50px 16px; color: var(--muted); }
.hist-empty > i { font-size: 2.6rem; color: var(--blue-400); }
.hist-empty b { display: block; color: var(--ink); font-size: 1rem; margin: 6px 0 4px; }
.kbd-mini { display: flex; flex-direction: column; gap: 6px; align-items: center; margin-top: 14px; font-size: .78rem; }
.kbd-mini span { display: flex; gap: 8px; align-items: center; }
.pt-card { padding: 12px 14px; border-radius: 0; background: #fff; border: 1px solid var(--t-line); border-left: 3px solid var(--blue-600); margin-bottom: 14px; color: var(--ink); }
.pt-name { font-weight: 800; font-size: 1.05rem; line-height: 1.2; color: var(--t-ink); }
.pt-meta { color: var(--ink-2); font-size: .78rem; }
.pt-allergy { margin-top: 8px; padding: 6px 10px; border-radius: 0; background: #fde6e6; color: #a51d1d; font-weight: 700; font-size: .8rem; border-left: 3px solid #ea5350; }
.pt-notes { margin-top: 6px; font-size: .78rem; color: var(--muted); white-space: pre-line; }
.hist-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: .86rem; color: var(--ink-2); }
.hv { border: 1px solid var(--line); border-radius: 0; margin-bottom: 8px; overflow: hidden; background: #fff; }
.hv.open { border-color: var(--t-line); box-shadow: 0 4px 14px rgba(var(--t-rgb), .1); }
/* a previous visit: faint yellow with a blue border and red text; the open one red with white text (red #ea5350) */
.hv-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; font-size: .8rem; background: #fffbe6; border: 1px solid #2861ac; color: #ea5350; font-weight: 600; }
.hv-head:hover { background: #fff3c4; }
.hv.open .hv-head { background: #ea5350; border-color: #ea5350; color: #fff; }
.hv.open .hv-head .hv-date, .hv.open .hv-head .hv-sum, .hv.open .hv-head .bi { color: #fff; }
.hv.open .hv-head .chip { background: rgba(255, 255, 255, .2); color: #fff; }
.hv-date { font-weight: 800; color: #ea5350; white-space: nowrap; }
.hv-sum { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ea5350; }
.hv-body { padding: 6px 10px 10px; font-size: .8rem; font-weight: 500; }
.hv-row { display: flex; gap: 8px; padding: 4px 2px; margin: 2px 0; color: var(--ink); border-bottom: 1px dashed var(--line-2); }
.hv-row > i { color: var(--blue-600); flex: none; margin-top: 2px; }
.hv-row em { font-style: normal; color: var(--muted); }
/* medicines of a previous visit: the whole table pink with white text */
.hv-rx { width: 100%; margin: 6px 0; font-size: .78rem; font-weight: 600; background: #ea508c; color: #fff; border: 1px solid #ea508c; }
.hv-rx td { padding: 5px 7px; border-bottom: 1px dashed #7f7777; }
.hv-fee { font-size: .975em; font-weight: 700; color: var(--ink); }
.hv-rx td:first-child { font-weight: 700; color: #fff; }
.hv-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; background: #f4f6f9; padding: 6px 8px; }
@media (max-width: 1199px) {
    .opd-shell { grid-template-columns: minmax(0, 1fr); height: auto; }
    .opd-left, .opd-right { overflow: visible; }
}

/* ---- totals tiles (OPD list, patient history) ---- */
.sum-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.st { --c: var(--t-main); padding: 12px 14px; border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow-card); border: 1px solid #e1e8ef; display: flex; flex-direction: column; justify-content: center; }
.st span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.st b { font-size: 1.35rem; font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; }
.st b.sm { font-size: 1rem; }
.st-blue { --c: #1d6fd8; } .st-violet { --c: var(--t-main); } .st-teal { --c: #0f8f94; } .st-orange { --c: #e0661f; } .st-green { --c: #15935b; }
.quick-days { align-self: flex-end; }

/* ---- patient history ---- */
.hist-search { width: 420px; max-width: 100%; }
.hist-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.hist-tabs button { border: 0; background: var(--surface-2); color: var(--ink-2); border-radius: var(--r-sm); padding: 6px 12px; font-weight: 600; font-size: .82rem; display: inline-flex; gap: 6px; align-items: center; }
.hist-tabs button b { background: #fff; border-radius: 10px; padding: 0 7px; font-size: .72rem; }
.hist-tabs button.on { background: var(--brand); color: #fff; }
.hist-tabs button.on b { background: rgba(255, 255, 255, .25); }
@media (max-width: 767px) { .top-search, .hist-search { width: 100%; } }

/* =====================================================================================================
   PHASE 3 — masters (translation prompts), print preview
   ===================================================================================================== */
.tr-alert { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--r-lg); background: #fff8e6;
    border: 1px solid #f4d58d; color: #6b4e00; font-size: .86rem; }
.tr-alert > i { font-size: 1.2rem; color: #c98a08; }
.tr-add { border: 1px dashed #e8b95a; background: #fffaf0; color: #b87211; border-radius: 20px; padding: 1px 9px 1px 5px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.tr-add:hover { background: #fdf0dc; border-style: solid; }
.tr-box { padding: 10px 12px; border-radius: var(--r); background: var(--t-soft2); border: 1px solid var(--t-line); }
.tr-h { font-weight: 700; font-size: .82rem; color: var(--blue-700); margin-bottom: 6px; }
.pp-src { padding: 7px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; min-height: 34px; }
.pp-missing { padding: 10px 12px; border-radius: var(--r); background: #fff8e6; border: 1px solid #f4d58d; color: #6b4e00; font-size: .84rem; }
.pp-missing .tag { cursor: default; background: #fff; color: #6b4e00; border: 1px solid #f4d58d; margin: 2px; }
.rx-lang { width: auto; min-height: 30px !important; padding-top: 2px; padding-bottom: 2px; font-size: .78rem; }


/* =====================================================================================================
   PHASE 4 — full dashboard (one screen at 1366×768), reports
   ===================================================================================================== */
.top-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px dashed var(--line); font-size: .82rem; }
.top-row:last-child { border-bottom: 0; }
.tr-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.tr-bar { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.tr-bar i { display: block; height: 100%; border-radius: 8px; background: var(--t-main); }
.top-row b { min-width: 24px; text-align: right; color: var(--blue-700); font-variant-numeric: tabular-nums; }

/* reports */
.rep-pick { font-weight: 600; }
.rep-summary { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.rep-summary span { display: flex; flex-direction: column; padding: 6px 12px; border-radius: var(--r); background: var(--surface-2); }
.rep-summary small { color: var(--muted); font-size: .7rem; font-weight: 600; text-transform: uppercase; }
.rep-summary b { color: var(--blue-700); }
.rep-scroll { max-height: calc(100vh - 330px); min-height: 200px; }
.rep-scroll thead { position: sticky; top: 0; z-index: 1; }
.pt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 30px; background: var(--t-soft); color: var(--blue-700); font-weight: 600; font-size: .86rem; }
.quick-range { align-self: flex-end; }

/* =====================================================================================================
   LOGIN PAGE (index.php) — welcome panel + form in one box on a soft blue page (only the form on phones)
   ===================================================================================================== */
body.login-body { display: block; min-height: 100vh;
    background: #f4f6f9; }
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px; }
.lp-top { width: 100%; max-width: 880px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lp-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.05rem; color: var(--t-ink); min-width: 0; }
.lp-brand b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-tools { display: inline-flex; align-items: center; gap: 8px; }
.lp-install { background: #fff; border: 1px solid var(--t-line); color: var(--t-main); }
.lp-install:hover { background: var(--t-soft); color: var(--t-ink); }
.logo-mark { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1.1rem;
    background: var(--t-main); box-shadow: 0 6px 14px rgba(var(--t-rgb), .3); }
.login-wrap { width: 100%; max-width: 880px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); border-radius: 18px; overflow: hidden; background: #fff;
    box-shadow: 0 30px 80px rgba(11, 34, 51, .22); }
.login-side { position: relative; overflow: hidden; padding: 40px 32px; color: #fff; background: var(--theme-grad); }
.login-side::after { content: ""; position: absolute; right: -60px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; border: 30px solid rgba(255, 255, 255, .07); }
.login-side::before { content: ""; position: absolute; left: -50px; top: -50px; width: 140px; height: 140px; border-radius: 50%; border: 0; display: none; }
.login-side .logo-mark { position: relative; width: 54px; height: 54px; font-size: 1.45rem; border-radius: 14px; background: rgba(255, 255, 255, .16); box-shadow: none; }
.login-side h4 { color: #fff; font-size: 1.7rem; font-weight: 800; margin: 20px 0 2px; }
.ls-clinic { color: rgba(255, 255, 255, .82); margin: 0 0 22px; }
.login-side ul { list-style: none; padding: 0; margin: 0 0 26px; display: grid; gap: 12px; }
.login-side li { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.login-side li i { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: #bfe8fd; }
.ls-safe { position: relative; display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: rgba(255, 255, 255, .8); }
.ls-safe i { color: #7dd3fc; }
.login-box { padding: 40px 34px 28px; }
.login-head { margin-bottom: 18px; }
.login-head .logo-mark { width: 50px; height: 50px; margin: 0 0 10px; font-size: 1.35rem; border-radius: 14px; }
.login-head h1 { font-size: 1.7rem; font-weight: 800; margin: 0; color: #0f172a; }
.login-head p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.login-note { font-size: .88rem; padding: 9px 12px; margin-bottom: 14px; border-radius: 10px; background: #fff6e0; border-left: 4px solid #e0a800; color: #6b4e00; }
.login-note.is-ok { background: #eefaf2; border-color: #1e9e5a; color: #155d37; }
.login-note.is-error { background: #fdecec; border-color: #d92d20; color: #912018; }
.login-box .input-group-text { background: var(--t-soft); color: var(--t-main); border-color: #bdb6b6; border-width: 1.5px; transition: background-color .15s ease, border-color .15s ease; }
/* the icon box takes the field's colour (yellow while typing, green once filled); typed text a little larger and bolder while typing */
.login-box .input-group:has(.form-control.is-filled) .input-group-text { background: #dcf3e5; border-color: #72c496; color: #15935b; }
.login-box .input-group:focus-within .input-group-text { background: #fff3c4; border-color: #e8c65a; color: #8a6d00; }
.login-box .form-control:focus { font-size: .95rem; font-weight: 600; }
.login-box .form-control { min-height: 46px; }
.login-box .pw-eye { border-color: #bdb6b6; }
.lp-btn { padding: 12px; font-size: 1rem; background: var(--theme-grad); }
.lp-btn:hover, .lp-btn:focus { background: var(--theme-grad); filter: brightness(1.08); }
.login-foot { margin: 14px 0 0; font-size: .82rem; color: var(--muted); text-align: center; }
.lp-foot { font-size: .82rem; color: var(--muted); }
.lp-foot a { color: var(--t-main); font-weight: 700; text-decoration: none; }
@media (max-width: 767px) {
    .login-wrap { grid-template-columns: minmax(0, 1fr); }
    .login-side { display: none; }
    .login-box { padding: 30px 22px 22px; }
    .login-head { text-align: center; }
    .login-head .logo-mark { margin: 0 auto 10px; }
    .lp-brand .logo-mark { display: none; }
}

/* ============ DROP-DOWN LISTS (every <select class="form-select">) ============
   Chrome / Edge 135+ draw the list with our own look: roomy rows, soft blue selected row with a tick, rounded panel,
   the same style as the search lists (.ac-drop). Other browsers keep their normal list. The field itself is unchanged. */
@supports (appearance: base-select) {
    select.form-select, select.form-select::picker(select) { appearance: base-select; }
    select.form-select { display: flex; align-items: center; }
    select.form-select::picker-icon { display: none; }                       /* our own arrow (background image) stays */
    select.form-select::picker(select) { min-width: anchor-size(width); max-height: min(340px, 60vh); margin: 5px 0; padding: 6px; overflow-y: auto;
        background: #fff; border: 1px solid var(--t-line); border-radius: 10px; box-shadow: 0 16px 38px rgba(15, 23, 42, .18);
        opacity: 0; transform: translateY(-4px); transition: opacity .14s ease, transform .14s ease, overlay .14s allow-discrete, display .14s allow-discrete; }
    select.form-select:open::picker(select) { opacity: 1; transform: none; }
    @starting-style { select.form-select:open::picker(select) { opacity: 0; transform: translateY(-4px); } }
    select.form-select option { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 12px 8px 14px; border-radius: 7px;
        border-left: 3px solid transparent; font-size: .86rem; font-weight: 500; line-height: 1.35; color: var(--ink); white-space: normal; cursor: pointer;
        transition: background-color .1s ease; }
    select.form-select option + option { margin-top: 2px; }
    select.form-select option:hover, select.form-select option:focus-visible { background: #f0f8ff; border-left-color: var(--blue-400); outline: none; }
    select.form-select option:checked { background: var(--t-soft); border-left-color: var(--blue-600); color: var(--blue-900); font-weight: 600; }
    select.form-select option::checkmark { order: 1; margin-left: auto; content: "\2713"; color: var(--blue-600); font-weight: 700; }
    select.form-select option:disabled { color: var(--muted); opacity: .6; cursor: default; }
    select.form-select-sm option { min-height: 34px; padding: 6px 10px 6px 12px; font-size: .8rem; }
}

/* ============ KEYBOARD SHORTCUTS pop-up (OPD, F1): corporate — four bordered tables with #d7e5ff headers, square corners ============ */
.sc-modal .modal-dialog { max-width: 860px; }
.sc-modal .modal-content { border-radius: 0; border: 1px solid #b9c6d6; }
.sc-modal .modal-header { border-radius: 0; padding: 14px 20px; }
.sc-modal .modal-title { font-size: 1.15rem; font-weight: 700; }
.sc-htext small { display: block; margin-top: 2px; font-size: .8rem; color: rgba(255, 255, 255, .8); }
.sc-modal .btn-close { align-self: flex-start; }
.sc-modal .modal-body { padding: 16px 20px; background: #f4f6f9; }
.sc-modal .modal-footer { border-radius: 0; }
.sc-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.sc-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #c9d4e1; }
.sc-table th { padding: 9px 14px; background: var(--theme-line); color: #fff; font-size: .86rem; font-weight: 700; text-align: left; border-bottom: 1px solid #b8cbeb; }
.sc-table td { padding: 10px 14px; border-top: 1px solid #e3e8ef; vertical-align: middle; }
.sc-table tbody tr:first-child td { border-top: 0; }
.sc-table tbody tr:hover td { background: #f6f9fd; }
.sc-name { font-size: .98rem; font-weight: 600; line-height: 1.35; color: var(--ink); }
.sc-keys { width: 1%; white-space: nowrap; text-align: right; }
.sc-keys b { margin: 0 5px; font-size: .82rem; font-weight: 700; color: var(--muted); }
kbd.sc-key { display: inline-block; min-width: 34px; padding: 4px 9px; border: 1px solid #aebccd; border-bottom-width: 2px; border-radius: 3px; background: #fff;
    color: #12325a; font-family: inherit; font-size: .86rem; font-weight: 700; line-height: 1.3; text-align: center; box-shadow: none; }
@media (max-width: 767px) { .sc-groups { grid-template-columns: minmax(0, 1fr); } }

/* ---- Investigation master: Groups pop-up (show / hide a group in the OPD entry) */
.head-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.count-pill .bi-eye-slash { color: #b42f2f; }
.count-pill.on .bi-eye-slash { color: #fff; }
.grp-form { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.grp-form-h { font-size: .82rem; color: var(--blue-700); margin-bottom: 6px; }
.grp-table tr.row-edit td { background: #fff8db; }
.app-table.grp-table > tbody > tr.row-muted td { text-decoration: none; }
.show-btn { display: inline-flex; align-items: center; gap: 5px; min-width: 92px; justify-content: center; border-radius: 20px; font-weight: 600; font-size: .76rem; }
.show-btn.is-on { background: #e3f6ec; color: #11733f; border: 1px solid #b8e6cb; }
.show-btn.is-off { background: #fdeaea; color: #b42f2f; border: 1px solid #f3c2c2; }
.show-btn:hover { filter: brightness(.96); }

/* ---- dashboard queue on a phone: Type / Time move under the name, tighter cells */
@media (max-width: 575px) {
    .d2-qtable .q-pt { min-width: 0; }
    .d2-qtable td, .d2-qtable thead th { padding-left: 5px !important; padding-right: 5px !important; }
    .d2-qtable .tc { width: 38px; }
}
@media (max-width: 575px) {
    .show-btn { min-width: 0; padding: 4px 9px; }
    .show-btn .show-txt { display: none; }
    .grp-table td, .grp-table thead th { padding-left: 6px !important; padding-right: 6px !important; }
    .grp-table td.cell-actions { white-space: normal; }
    .grp-table td.cell-actions .act { margin: 2px 0; }
}

/* ============ SETTINGS — compact two columns, navy section heads (same as the dashboard), timings builder, Save bar at the bottom ============ */
.set-page { padding-bottom: 8px; }
.set-card { border: 1px solid #e1e8ef; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-card); }
.set-card > .card-body { padding: 14px 16px; }
.set-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 14px; font-weight: 700; font-size: .88rem; color: #fff; letter-spacing: .2px;
    background: var(--theme-line); border-bottom: 2px solid var(--t-main); }
.set-head > i { color: var(--t-hi); }
.set-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .22); color: #fff; font-size: .72rem; font-weight: 800; }
.set-sub { margin-left: auto; font-size: .72rem; font-weight: 500; color: rgba(255, 255, 255, .78); }
.set-hint { font-size: .74rem; color: var(--muted); margin: 0 0 8px; }
.set-page .form-label { font-size: .76rem; margin-bottom: 3px; color: #334155; }
.set-page .form-label > i { color: var(--t-main); }
.set-langs { margin-bottom: 10px; padding: 3px; }
.set-langs button { padding: 6px 10px; }
.set-langs button.on { color: var(--t-ink); box-shadow: inset 0 -2px 0 var(--t-main), 0 2px 8px rgba(15, 23, 42, .1); }
/* timings */
.day-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.day-pick { min-width: 54px; padding: 5px 10px; border: 1px solid var(--t-line); background: #fff; border-radius: 6px; font-size: .78rem; font-weight: 600; color: #475569; }
.day-pick:hover { border-color: var(--t-main); color: var(--t-ink); }
.day-pick.on { background: var(--t-ink); border-color: var(--t-ink); color: #fff; }
.day-pick.day-all { min-width: 0; border-style: dashed; color: var(--t-main); }
.tm-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.tm-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; border: 1px solid #e1e8ef; border-radius: 6px; padding: 7px 12px; background: #f8fafc; transition: border-color .15s, background .15s; }
.tm-row.on { border-color: var(--t-line); background: #f0f7fc; box-shadow: inset 3px 0 0 var(--t-main); }
.tm-check { display: flex; align-items: center; gap: 7px; margin: 0; width: 150px; font-weight: 700; font-size: .84rem; color: var(--t-ink); cursor: pointer; }
.tm-check .form-check-input { margin: 0; }
.tm-check i { color: #d98a15; }
.tm-times { display: flex; align-items: center; gap: 6px; }
.tm-times .form-control { width: 150px; min-width: 0; padding: 5px 8px; font-size: .82rem; }
.tm-times .form-control:disabled { background: #eef2f6 !important; border-color: #e1e8ef !important; color: #94a3b8 !important; }
.tm-to { font-size: .74rem; color: var(--muted); }
.tm-extra { display: grid; grid-template-columns: 22px repeat(3, minmax(0, 1fr)) auto; gap: 6px; align-items: center; margin-top: 8px; }
.tm-extra-no { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--t-soft); color: var(--t-main); font-weight: 800; }
.tm-extra .form-control { padding: 5px 8px; font-size: .82rem; }
.tm-out { margin-top: 12px; border: 1px dashed var(--t-line); border-radius: 6px; background: #fbfdff; }
.tm-out-h { padding: 6px 10px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--t-main); border-bottom: 1px dashed var(--t-line); }
.tm-lang { display: flex; gap: 10px; padding: 6px 10px; font-size: .8rem; border-bottom: 1px solid #eef2f6; }
.tm-lang:last-child { border-bottom: 0; }
.tm-lang-n { flex: none; width: 60px; font-weight: 700; color: #475569; font-size: .74rem; padding-top: 1px; }
.tm-lines { display: flex; flex-wrap: wrap; gap: 3px 14px; color: #1e293b; }
.tm-lines b { color: var(--t-ink); }
.tm-lines em { color: var(--muted); }
/* right column: logo + header preview stay in view */
.set-side { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 1200px) { .set-side { position: sticky; top: calc(var(--top-h) + 14px); } }
.set-logo { width: 92px; height: 92px; }
.set-preview { padding: 12px; border-top: 3px solid var(--t-main); border-radius: 4px; }
.set-preview .rp-top { display: flex; gap: 10px; align-items: flex-start; }
.set-preview .rp-logo { width: 42px; height: 42px; object-fit: contain; flex: none; }
.set-preview .rp-id { flex: 1 1 auto; min-width: 0; }
.set-preview .rp-name { color: var(--t-ink); }
.set-preview .rp-right { flex: none; max-width: 48%; text-align: right; font-size: .72rem; line-height: 1.45; color: #334155; }
.set-preview .rp-right b { color: var(--t-ink); }
.set-preview .rp-addr { margin-top: 8px; padding: 4px 8px; background: var(--t-ink); color: #fff; font-size: .72rem; border-radius: 3px; }
/* Save bar */
.set-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding: 10px 14px;
    background: rgba(255, 255, 255, .96); border: 1px solid #e1e8ef; border-top: 3px solid var(--t-main); border-radius: 6px; box-shadow: 0 -6px 18px rgba(15, 23, 42, .08); }
.set-bar-note { font-size: .76rem; color: var(--muted); }
/* security tabs on the navy head */
.set-tabs button { border: 0; background: transparent; padding: 3px 12px; border-radius: 20px; font-size: .8rem; font-weight: 600; color: rgba(255, 255, 255, .82); }
.set-tabs button:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.set-tabs button.on { background: #fff; color: var(--t-ink); }
@media (max-width: 575px) { .tm-check { width: 100%; } .tm-times { width: 100%; } .tm-times .form-control { flex: 1 1 0; width: auto; } }
@media (max-width: 575px) {
    .tm-extra { grid-template-columns: 22px minmax(0, 1fr) auto; }
    .tm-extra .form-control[lang] { grid-column: 2 / 3; }
    .set-preview .rp-top { flex-wrap: wrap; } .set-preview .rp-right { max-width: 100%; text-align: left; width: 100%; }
    .set-bar .btn { flex: 1; }
}

/* ---- auto-translation (masters, clinic profile): "auto — check" badge, spinner, note */
.tr-auto { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 0 7px; border-radius: 20px; background: #fff4d6; color: #8a5a00;
    font-size: .66rem; font-weight: 700; vertical-align: middle; }
.tr-spin { width: .8rem; height: .8rem; margin-left: 6px; border-width: .14em; color: var(--t-main); vertical-align: middle; }
.tr-note { margin: 0 0 8px; padding: 5px 10px; border-left: 3px solid var(--t-main); background: var(--t-soft); color: var(--t-ink); font-size: .74rem; }
.tr-note.off { border-left-color: #d98a15; background: #fff8ea; color: #6b4e00; }

/* ============ PATIENT HISTORY — banner with key figures, visit cards (left), medicines / tests / fees always in view (right) ============ */
.ph-banner { margin-bottom: 16px; background: #fff; border: 1px solid #e1e8ef; border-radius: 6px; box-shadow: var(--shadow-card); overflow: hidden; }
.ph-id { display: flex; align-items: center; gap: 16px; padding: 16px 18px; background: var(--theme-line); color: #fff; }
.ph-av { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.5rem; font-weight: 800;
    text-transform: uppercase; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); }
.ph-who { flex: 1 1 auto; min-width: 0; }
.ph-who h2 { margin: 0 0 6px; font-size: 1.3rem; font-weight: 800; color: #fff; letter-spacing: -.2px; }
.ph-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 4px; background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .85); font-size: .74rem; }
.ph-tag b { color: #fff; }
.ph-blood { background: #c2414f; color: #fff; font-weight: 700; }
.ph-contact { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; font-size: .78rem; color: rgba(255, 255, 255, .8); }
.ph-contact i { margin-right: 5px; color: var(--t-hi); }
.ph-contact a { color: #fff; text-decoration: none; font-weight: 600; }
.ph-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.ph-actions .btn { justify-content: flex-start; min-width: 118px; }
.ph-actions .btn-primary { background: #fff; color: var(--t-ink); box-shadow: none; }
.ph-actions .btn-primary:hover { background: var(--t-soft); color: var(--t-ink); }
.ph-actions .btn-export, .ph-actions .btn-print { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; border: 1px solid rgba(255, 255, 255, .25); }
.ph-actions .btn-export:hover, .ph-actions .btn-print:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.ph-alert { display: flex; align-items: center; gap: 8px; padding: 8px 18px; background: #fdecee; color: #a51d2d; font-size: .82rem; border-bottom: 1px solid #f5c6cc; }
.ph-alert b { font-weight: 800; }
.ph-note { display: flex; gap: 8px; padding: 7px 18px; background: #fffbea; color: #6b5300; font-size: .78rem; white-space: pre-line; border-bottom: 1px solid #f1e3a8; }
.ph-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ph-stats > div { padding: 11px 18px; border-right: 1px solid #edf1f5; }
.ph-stats > div:last-child { border-right: 0; }
.ph-stats span { display: block; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #64748b; }
.ph-stats b { display: block; margin-top: 2px; font-size: 1.05rem; font-weight: 800; color: var(--t-ink); font-variant-numeric: tabular-nums; }
.ph-stats .due b { color: #c2414f; }
.ph-stats .money b { color: #15935b; }
/* section cards with the navy head */
.ph-card { border: 1px solid #e1e8ef; border-radius: 6px; overflow: hidden; }
.ph-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 14px; background: var(--theme-line); color: #fff; }
.ph-h { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .86rem; }
.ph-h i { color: var(--t-hi); }
.ph-h b { min-width: 22px; padding: 0 7px; border-radius: 10px; background: rgba(255, 255, 255, .22); font-size: .7rem; text-align: center; }
.ph-dates { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ph-dates span { font-size: .74rem; color: rgba(255, 255, 255, .8); }
.ph-dates .form-control { width: 140px; min-height: 30px !important; padding: 2px 8px !important; font-size: .78rem !important; }
.ph-toggle { display: inline-flex; gap: 10px; font-size: .74rem; }
.ph-toggle a { color: rgba(255, 255, 255, .8); text-decoration: none; }
.ph-toggle a:hover { color: #fff; text-decoration: underline; }
/* visit cards */
.ph-visits { padding: 12px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; }
.pv { background: #fff; border: 1px solid #e1e8ef; border-left: 4px solid #94a3b8; border-radius: 4px; }
.pv.open { border-left-color: var(--t-main); box-shadow: 0 4px 14px rgba(15, 30, 51, .08); }
.pv.wait { border-left-color: #d98a15; }
.pv-head { display: flex; align-items: center; gap: 12px; padding: 9px 12px; cursor: pointer; }
.pv-head:hover { background: var(--t-soft2); }
.pv-date { flex: none; width: 54px; padding: 4px 0; text-align: center; border-radius: 4px; background: var(--t-soft); color: var(--t-ink); line-height: 1.1; }
.pv-date b { display: block; font-size: 1.25rem; font-weight: 800; }
.pv-date small { display: block; font-size: .64rem; font-weight: 700; text-transform: uppercase; color: #64748b; }
.pv.open .pv-date { background: var(--t-ink); color: #fff; }
.pv.open .pv-date small { color: rgba(255, 255, 255, .8); }
.pv-main { flex: 1 1 auto; min-width: 0; }
.pv-dx { display: block; font-weight: 700; font-size: .9rem; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-sub { display: block; font-size: .74rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-fee { flex: none; font-weight: 700; font-size: .82rem; color: #15935b; font-variant-numeric: tabular-nums; }
.pv-chev { flex: none; color: #64748b; }
.pv-body { padding: 12px 14px; border-top: 1px solid #edf1f5; }
.pv-vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pv-vitals > div { padding: 6px 10px; border: 1px solid #e1e8ef; border-radius: 4px; background: #f8fafc; white-space: nowrap; }
.pv-vitals span { display: block; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #64748b; }
.pv-vitals b { font-size: 1rem; font-weight: 800; color: var(--t-ink); }
.pv-vitals small { margin-left: 3px; font-size: .68rem; color: #94a3b8; }
.pv-facts { margin: 0 0 12px; border: 1px solid #edf1f5; border-radius: 4px; }
.pv-facts > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); border-bottom: 1px solid #edf1f5; }
.pv-facts > div:last-child { border-bottom: 0; }
.pv-facts dt { padding: 7px 10px; background: var(--t-soft2); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #475569; }
.pv-facts dt i { margin-right: 6px; color: var(--t-main); }
.pv-facts dd { margin: 0; padding: 7px 12px; font-size: .84rem; color: #1e293b; }
.pv-facts dd.pre { white-space: pre-line; }
.pv-strong { color: var(--t-ink); }
.pv-pill { display: inline-block; margin: 0 6px 4px 0; padding: 1px 9px; border-radius: 4px; background: var(--t-soft); color: var(--t-ink); font-size: .78rem; font-weight: 600; }
.pv-pill em { font-style: normal; font-weight: 500; color: #64748b; }
.pv-pill.test { background: #e7f6f3; color: #0f5f57; }
.pv-note { display: block; color: #64748b; font-size: .8rem; }
.pv-rx { border: 1px solid #e1e8ef; border-radius: 4px; overflow: hidden; }
.pv-rx-h { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--t-soft2); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #475569;
    border-bottom: 1px solid #e1e8ef; }
.pv-rx-h span { font-size: 1rem; color: var(--t-main); text-transform: none; }
.pv-rx .app-table { border: 0; }
.pv-none { padding: 10px 12px; font-size: .8rem; color: #64748b; }
.pv-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e1e8ef; }
.pv-paid { font-size: .8rem; color: #334155; }
.pv-paid i { margin-right: 5px; color: #15935b; }
.pv-paid b { color: #15935b; }
.pv-paid.muted, .pv-paid.muted i { color: #94a3b8; }
.pv-btns { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
/* right column lists */
.ph-side { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 1200px) { .ph-side { position: sticky; top: calc(var(--top-h) + 14px); } }
.ph-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; background: #fff; }
.ph-list li { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid #edf1f5; }
.ph-list li:nth-child(even) { background: #fafcfe; }
.pl-main { flex: 1 1 auto; min-width: 0; }
.pl-main b { display: block; font-size: .82rem; font-weight: 700; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-main small { display: block; font-size: .72rem; color: #64748b; }
.pl-count { flex: none; min-width: 34px; padding: 1px 6px; border-radius: 4px; background: var(--t-soft); color: var(--t-ink); font-weight: 800; font-size: .74rem; text-align: center; }
.pl-amt { flex: none; font-weight: 700; color: #15935b; font-size: .84rem; font-variant-numeric: tabular-nums; }
.ph-list li.pl-empty { color: #94a3b8; font-size: .8rem; justify-content: center; padding: 14px; }
.ph-list li.pl-total { justify-content: space-between; background: #eef7f1; font-weight: 700; color: var(--t-ink); position: sticky; bottom: 0; }
.ph-list li.pl-total b { color: #15935b; font-size: .95rem; }
/* tablets and phones */
@media (max-width: 991px) {
    .ph-id { flex-wrap: wrap; }
    .ph-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
    .ph-actions .btn { min-width: 0; flex: 1 1 auto; justify-content: center; }
    .ph-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ph-stats > div { border-bottom: 1px solid #edf1f5; }
    .ph-dates { margin-left: 0; }
}
@media (max-width: 575px) {
    .ph-id { padding: 14px; gap: 12px; }
    .ph-av { width: 46px; height: 46px; font-size: 1.2rem; }
    .ph-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ph-stats > div { padding: 9px 14px; }
    .ph-dates { width: 100%; }
    .ph-dates .form-control { flex: 1 1 0; width: auto; }
    .pv-head { gap: 8px; flex-wrap: wrap; }
    .pv-main { flex-basis: calc(100% - 70px); }
    .pv-facts > div { grid-template-columns: minmax(0, 1fr); }
    .pv-facts dt { padding: 5px 10px; }
    .pv-btns { margin-left: 0; width: 100%; }
}

/* phone: each medicine of a visit as a small card (label : value) instead of a wide table */
@media (max-width: 575px) {
    .pv-rx .table-responsive { overflow: visible; }
    .hv-meds thead { display: none; }
    .hv-meds, .hv-meds tbody, .hv-meds tr, .hv-meds td { display: block; width: 100%; }
    .hv-meds tr { padding: 6px 10px; border-bottom: 1px solid #e1e8ef; }
    .hv-meds > tbody > tr > td { position: relative; padding: 2px 0 2px 84px !important; border: 0 !important; text-align: left !important; font-size: .8rem !important; white-space: normal; }
    .hv-meds > tbody > tr > td::before { content: attr(data-label); position: absolute; left: 0; top: 3px; width: 76px; font-size: .66rem; font-weight: 700; text-transform: uppercase; color: #64748b; }
    .hv-meds > tbody > tr > td.sr { display: none; }
}
/* this month | to-do: two cards in one row */
.d2-duo { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 12px; flex: none; }
.d2-duo.solo { grid-template-columns: minmax(0, 1fr); }
.dm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); flex: 1 1 auto; }   /* fills the card; each figure centred both ways */
.dm { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 5px 12px; color: #1e293b; text-decoration: none; border-right: 1px solid #edf1f5; min-width: 0; }
.dm:last-child { border-right: 0; }
a.dm[href]:hover { background: var(--t-soft2); color: #1e293b; }
.dm > i { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 6px; background: var(--t-soft); color: var(--t-main); font-size: .9rem; }
.dm > span { min-width: 0; }
.dm small { display: block; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #64748b; line-height: 1.2; }
.dm b { display: block; font-size: 1rem; line-height: 1.2; font-weight: 800; color: var(--t-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px; align-content: center; }
.dt { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid #f1d27a; border-left: 3px solid #d98a15; border-radius: 4px; background: #fffaf0;
    color: #6b4e00; font-size: .76rem; font-weight: 600; text-decoration: none; }
.dt:hover { background: #fff1d1; color: #4d3800; }
.dt > i:first-child { color: #d98a15; }
.dt b { min-width: 18px; padding: 0 5px; border-radius: 10px; background: #d98a15; color: #fff; font-size: .68rem; text-align: center; }
.dt-go { font-size: .7rem; opacity: .6; }
.dt-done { display: flex; align-items: center; gap: 8px; color: #15935b; font-weight: 700; font-size: .8rem; }
/* compact heads on these two cards; the to-do head is red, its items blink gently until done */
.d2-duo .d2-card-head { padding: 5px 12px; }
.d2-duo .d2-t { font-size: .8rem; }
.d2-todo .d2-card-head { background: #c2414f; border-bottom-color: #8f2632; }
.d2-todo .d2-t i { color: #ffd6da; }
.d2-todo .dt { animation: todoBlink 1.4s ease-in-out infinite; }
@keyframes todoBlink { 0%, 100% { background: #fffaf0; box-shadow: none; } 50% { background: #ffe08a; box-shadow: 0 0 0 3px rgba(217, 138, 21, .25); } }
.dt-done i { font-size: 1.2rem; }
@media (max-width: 1199px) { .d2-duo { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) {
    .dm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dm:nth-child(2) { border-right: 0; }
    .dm:nth-child(-n+2) { border-bottom: 1px solid #edf1f5; }
}

/* ============ LANGUAGES choice (Settings, first-login setup) + locked profile note ============ */
.lang-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.lang-pick { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border: 2px solid #e1e8ef; border-radius: 6px; background: #fff; font-size: .82rem; font-weight: 600;
    color: #334155; cursor: pointer; }
.lang-pick:hover { border-color: #b6c2d0; }
.lang-pick.on { border-color: var(--t-main); background: var(--t-soft2); color: var(--t-ink); }
.lang-pick input { accent-color: var(--t-main); }
.lock-note { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; padding: 8px 12px; border-left: 3px solid #d98a15; background: #fff8ea; color: #6b4e00; font-size: .78rem; }
.set-page .form-control[readonly] { background: #f1f5f9 !important; color: #475569; cursor: not-allowed; }

/* ============ FIRST-LOGIN SETUP pop-up ============ */
.sw-head { align-items: flex-start; }
.sw-sub { margin-top: 4px; font-size: .8rem; color: rgba(255, 255, 255, .82); }
.sw-body { background: #f8fafc; padding: 16px 18px; }
.sw-sec { background: #fff; border: 1px solid #e1e8ef; border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; }
.sw-h { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 10px; font-weight: 800; font-size: .92rem; color: var(--t-ink); }
.sw-h small { font-weight: 500; font-size: .74rem; color: #64748b; }
.sw-no { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #e2e8f0; color: #475569; font-size: .74rem; font-weight: 800; }
.sw-no.ok { background: #15935b; color: #fff; }
.sw-warn { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; padding: 7px 12px; background: #fdecee; color: #a51d2d; font-size: .78rem; font-weight: 600; border-left: 3px solid #c2414f; }
.sw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.sw-field .form-label { font-size: .76rem; margin-bottom: 3px; }
.sw-tr { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px; align-items: center; margin-top: 5px; }
.sw-tr-l { font-size: .72rem; font-weight: 700; color: #64748b; }
.sw-tips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sw-tips .chip-btn.on { background: var(--t-main); color: #fff; border-color: var(--t-main); }
.sw-agree { display: flex; gap: 10px; align-items: flex-start; margin: 4px 2px 0; padding: 10px 12px; border: 2px dashed #f1c27d; border-radius: 6px; background: #fffaf0;
    font-size: .82rem; font-weight: 600; color: #6b4e00; cursor: pointer; }
.sw-agree .form-check-input { margin-top: 2px; flex: none; }
.sw-foot { justify-content: space-between; gap: 10px; }
.sw-left { font-size: .78rem; color: #a35c00; flex: 1 1 auto; }
.sw-left.ok { color: #15935b; font-weight: 700; }
.sw-thanks { text-align: center; padding: 36px 24px 30px; background: #fff; }
.sw-thanks-ic { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--t-soft); color: var(--t-main); font-size: 2.2rem; }
.sw-thanks h3 { margin: 0; font-size: 1.15rem; font-weight: 700; color: #475569; }
.sw-site { display: inline-block; margin: 4px 0 2px; font-size: 1.6rem; font-weight: 800; color: var(--t-main); text-decoration: none; letter-spacing: -.3px; }
.sw-site:hover { color: var(--t-hover); text-decoration: underline; }
.sw-tag { margin: 0 0 18px; font-size: .95rem; font-weight: 600; color: var(--t-ink); }
.sw-ready { margin: 0 0 8px; font-size: .84rem; color: #64748b; }
.sw-next { list-style: none; display: flex; width: fit-content; flex-direction: column; gap: 6px; margin: 0 auto 22px; padding: 0; text-align: left; font-size: .86rem; color: #1e293b; }
.sw-next i { margin-right: 8px; color: var(--t-main); }
@media (max-width: 767px) {
    .sw-grid { grid-template-columns: minmax(0, 1fr); }
    .sw-body { padding: 12px; }
    .sw-foot .btn { width: 100%; }
    .sw-site { font-size: 1.25rem; }
}

/* reports: a red row = a day without patients / holiday, a cancelled visit, a missed follow-up (same in the PDF and Excel) */
.app-table > tbody > tr.row-red > td { background: #fde2e4 !important; color: #9b1c2b; }
.app-table > tbody > tr.row-red > td a { color: #9b1c2b; }

/* ============ MEDICAL CERTIFICATE tab — patient strip, day buttons, A4-style live preview ============ */
.mc-pt { display: flex; align-items: flex-start; gap: 12px; }
.mc-av { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--t-main); color: #fff; font-size: 1.2rem; font-weight: 800; text-transform: uppercase; }
.mc-who { flex: 1 1 auto; min-width: 0; }
.mc-who b { display: block; font-size: 1.02rem; color: var(--t-ink); }
.mc-who small { display: block; font-size: .78rem; color: #475569; }
.mc-who .mc-last { margin-top: 3px; color: var(--t-main); font-weight: 600; }
.mc-days { margin-left: 6px; padding: 0 8px; border-radius: 10px; background: var(--t-soft); color: var(--t-ink); font-size: .7rem; font-weight: 800; }
.mc-quick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mc-quick .chip-btn { padding: 1px 8px; font-size: .7rem; }
.mc-body { font-size: .9rem; line-height: 1.6; }
.mc-side { position: relative; }
@media (min-width: 1200px) { .mc-side { position: sticky; top: calc(var(--top-h) + 14px); } }
.mc-paper { padding: 18px 20px 16px; border: 1px solid #d9e0e8; border-top: 4px solid var(--t-main); background: #fff; box-shadow: 0 6px 18px rgba(15, 30, 51, .08);
    font-family: Georgia, "Noto Sans Devanagari", "Noto Sans Kannada", serif; color: #1e293b; }
.mc-p-title { text-align: center; font: 800 1rem Manrope, sans-serif; letter-spacing: 2px; color: var(--t-ink); }
.mc-p-sub { text-align: center; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.mc-p-meta { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 6px; padding: 4px 8px; background: var(--t-soft2); border: 1px solid var(--t-line); font: .74rem Manrope, sans-serif; }
.mc-p-pt { font: .78rem Manrope, sans-serif; color: #334155; margin-bottom: 8px; }
.mc-p-body { white-space: pre-line; font-size: .84rem; line-height: 1.65; text-align: justify; min-height: 120px; }
.mc-p-id { font: .74rem Manrope, sans-serif; margin-top: 6px; }
.mc-p-sig { display: flex; justify-content: space-between; align-items: flex-end; gap: 6px; margin-top: 26px; font: .66rem Manrope, sans-serif; color: #64748b; }
.mc-p-sig > span { border-top: 1px solid #94a3b8; padding-top: 2px; }
.mc-p-sig .mc-p-stamp { border: 1px dashed #94a3b8; padding: 14px 10px; }
.mc-row { cursor: pointer; }

/* ============ EXPENSES (include/expenses.php) ============ */
.exp-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; font-weight: 500; }
.exp-sum b { font-size: .9rem; margin-left: 4px; }
.exp-bal { display: flex; align-items: center; justify-content: flex-end; height: 38px; padding: 0 12px; border: 1px solid var(--t-line); background: #f6f9fc; font-weight: 700; color: var(--ok); }
.exp-bal.due { color: #c0392b; background: #fff4f2; border-color: #f3c7c0; }
