﻿/* Complete HMS -- theme on top of Bootstrap 5.3 (shared look with SmartGST) */
:root {
  --hm-primary: #2754c5;
  --hm-primary-rgb: 39, 84, 197;
  --hm-ink: #172033;
  --hm-muted: #667085;
  --hm-bg: #f3f5f9;
  --hm-card: #ffffff;
  --hm-line: #e3e7ef;
  --hm-side: #0f1b33;
  --hm-side-ink: #b7c1d6;
  --hm-side-active: #ffffff;
  --hm-success: #0f9d58;
  --hm-danger: #d93025;
  --hm-warn: #f29900;
  --hm-primary-hover: #1f45a6;
  --hm-surface: #ffffff;       /* cards, grids, top bar */
  --hm-surface-2: #f8f9fc;     /* table heads, totals rows */
  --hm-hover: #f6f8fd;
  --hm-soft: #eaf0ff;          /* picked / active highlight */
  --hm-top-bg: rgba(255,255,255,.92);
  --hm-input-line: #d5dbe6;
  --hm-label: #475467;
  --hm-radius: .85rem;
  --hm-side-sec: #7382a3;
  --hm-kbd-bg: #e9edf5; --hm-kbd-ink: #34405a; --hm-kbd-line: #d3d9e6;
  --hm-shadow: 0 1px 2px rgba(16,24,40,.04);
  --hm-brand-logo: linear-gradient(135deg, #4f7cff, #22c1a4);
  --bs-primary: var(--hm-primary);
  --bs-primary-rgb: var(--hm-primary-rgb);
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-font-size: .875rem;
  --bs-body-color: var(--hm-ink);
  --bs-border-color: var(--hm-line);
  --bs-link-color: var(--hm-primary); --bs-link-color-rgb: var(--hm-primary-rgb);
  --bs-link-hover-color: var(--hm-primary-hover); --bs-link-hover-color-rgb: var(--hm-primary-rgb);
}

body { background: var(--hm-bg); }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--hm-primary); --bs-btn-border-color: var(--hm-primary); --bs-btn-hover-bg: var(--hm-primary-hover); --bs-btn-hover-border-color: var(--hm-primary-hover); --bs-btn-active-bg: var(--hm-primary-hover); --bs-btn-active-border-color: var(--hm-primary-hover); }
.text-primary { color: var(--hm-primary) !important; }
.bg-primary { background: var(--hm-primary) !important; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fw-600 { font-weight: 600; }
.small-muted { color: var(--hm-muted); font-size: .78rem; }
kbd { background: var(--hm-kbd-bg); color: var(--hm-kbd-ink); border: 1px solid var(--hm-kbd-line); box-shadow: none; font-size: .7rem; padding: .05rem .3rem; }

/* ---- Shell */
.hm-shell { display: flex; min-height: 100vh; }
.hm-side {
  width: 236px; flex: 0 0 236px; background: var(--hm-side); color: var(--hm-side-ink);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin;
  transition: margin-left .2s ease;
}
.hm-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem .8rem; color: #fff; font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; }
.hm-brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--hm-brand-logo); display: grid; place-items: center; font-size: 1rem; }
.hm-company { margin: 0 .8rem .6rem; padding: .5rem .7rem; border-radius: .6rem; background: rgba(255,255,255,.06); font-size: .78rem; line-height: 1.3; }
.hm-company b { color: #fff; display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-nav { list-style: none; margin: 0; padding: 0 .6rem 1.5rem; }
.hm-nav .sec { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--hm-side-sec); padding: .9rem .6rem .35rem; }
.hm-nav a { display: flex; align-items: center; gap: .6rem; padding: .42rem .6rem; border-radius: .5rem; color: var(--hm-side-ink); font-size: .83rem; }
.hm-nav a i { font-size: 1rem; opacity: .85; width: 1.1rem; text-align: center; }
.hm-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.hm-nav a.active { background: var(--hm-primary); color: var(--hm-side-active); }
.hm-nav a kbd { margin-left: auto; background: rgba(255,255,255,.08); color: #9aa7c2; border: 0; }
.hm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hm-top {
  position: sticky; top: 0; z-index: 1020; background: var(--hm-top-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hm-line); display: flex; align-items: center; gap: .75rem; padding: .55rem 1.25rem; min-height: 56px;
}
.hm-top h1 { font-size: 1.05rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-content { padding: 1.25rem; flex: 1; }
.hm-foot { padding: .6rem 1.25rem; color: var(--hm-muted); font-size: .75rem; border-top: 1px solid var(--hm-line); background: var(--hm-surface); }
body.side-collapsed .hm-side { margin-left: -236px; }

@media (max-width: 991.98px) {
  .hm-side { position: fixed; z-index: 1040; margin-left: -236px; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.side-open .hm-side { margin-left: 0; }
  .hm-content { padding: .85rem; }
  .hm-top { padding: .5rem .85rem; }
}

/* ---- Cards */
.card { --bs-card-bg: var(--hm-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); box-shadow: var(--hm-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--hm-line); font-weight: 600; padding: .75rem 1rem; }
.stat { padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; }
.stat .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex: 0 0 44px; }
.stat .v { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat .l { color: var(--hm-muted); font-size: .78rem; }
.ic-blue { background: #e8efff; color: #2754c5; } .ic-green { background: #e3f6ec; color: #0f9d58; }
.ic-amber { background: #fff3dc; color: #c77700; } .ic-red { background: #fde7e5; color: #c5221f; }
.ic-violet { background: #efe9ff; color: #6d28d9; } .ic-teal { background: #dff7f3; color: #0f766e; }
.quick-tile { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .9rem .5rem; border-radius: .75rem; border: 1px solid var(--hm-line); background: var(--hm-surface); color: var(--hm-ink); font-weight: 600; font-size: .8rem; transition: .15s; }
.quick-tile i { font-size: 1.35rem; color: var(--hm-primary); }
.quick-tile:hover { border-color: var(--hm-primary); box-shadow: 0 4px 14px rgba(var(--hm-primary-rgb), .12); transform: translateY(-1px); }

/* ---- Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .5rem .65rem; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--hm-muted); font-weight: 600; background: var(--hm-surface-2); border-bottom: 1px solid var(--hm-line); white-space: nowrap; }
.table-hover tbody tr:hover { background: var(--hm-hover); }
.table tr.grp td { background: var(--hm-surface-2); font-weight: 700; }
.table tr.tot td { font-weight: 700; border-top: 2px solid var(--hm-input-line); background: var(--hm-surface-2); }
.table-report td { font-size: .82rem; }
tr[data-href] { cursor: pointer; }

/* ---- Forms */
.form-control, .form-select { border-color: var(--hm-input-line); border-radius: .5rem; font-size: .86rem; }
.form-control:focus, .form-select:focus, .btn:focus-visible { border-color: var(--hm-primary); box-shadow: 0 0 0 .2rem rgba(var(--hm-primary-rgb), .18); }
.form-label { font-weight: 600; font-size: .76rem; color: var(--hm-label); margin-bottom: .25rem; }
.form-control-sm, .form-select-sm { font-size: .82rem; }
input.is-picked { background: var(--hm-soft); }
.req::after { content: ' *'; color: var(--hm-danger); }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 130px; }

/* ---- Autocomplete */
.ac-wrap { position: relative; }
.ac-list {
  position: fixed; z-index: 1080; width: max-content; max-width: min(560px, 92vw);
  max-height: 320px; overflow-y: auto; background: var(--hm-surface); border: 1px solid var(--hm-input-line); border-radius: .6rem;
  box-shadow: 0 12px 32px rgba(16,24,40,.16); padding: .25rem;
}
.ac-item { padding: .42rem .6rem; border-radius: .4rem; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; font-size: .84rem; }
.ac-item .sub { color: var(--hm-muted); font-size: .74rem; white-space: nowrap; }
.ac-item.active, .ac-item:hover { background: var(--hm-soft); }
.ac-item.create { color: var(--hm-primary); font-weight: 600; border-top: 1px dashed var(--hm-line); margin-top: .2rem; }
.ac-empty { padding: .5rem .6rem; color: var(--hm-muted); font-size: .8rem; }

/* ---- Voucher entry */
.voucher-head { background: var(--hm-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); padding: 1rem; }
.grid-wrap { background: var(--hm-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); overflow: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 900px; table-layout: auto; }
table.grid th[data-col], table.grid td[data-col] { min-width: 76px; }
table.grid th[data-col=item], table.grid td[data-col=item] { min-width: 240px; }
table.grid th[data-col=description], table.grid td[data-col=description] { min-width: 160px; }
table.grid td[data-col=unit] select, table.grid td[data-col=gst_rate] select { min-width: 72px; }
table.grid th { position: sticky; top: 0; background: var(--hm-surface-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--hm-muted); padding: .5rem .4rem; border-bottom: 1px solid var(--hm-line); white-space: nowrap; font-weight: 600; z-index: 2; }
table.grid td { padding: .2rem .25rem; border-bottom: 1px solid var(--hm-line); vertical-align: top; }
table.grid td.sno { width: 34px; text-align: center; color: var(--hm-muted); padding-top: .55rem; font-size: .78rem; }
table.grid input, table.grid select { border: 1px solid transparent; background: transparent; border-radius: .35rem; width: 100%; padding: .32rem .4rem; font-size: .84rem; color: inherit; }
table.grid input:hover { border-color: var(--hm-line); }
table.grid input:focus, table.grid select:focus { outline: none; border-color: var(--hm-primary); background: var(--hm-surface); box-shadow: 0 0 0 .15rem rgba(var(--hm-primary-rgb), .15); }
table.grid input.n { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.amt { text-align: right; padding: .5rem .6rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.grid .del { color: #b0b7c3; border: 0; background: none; padding: .35rem; }
table.grid .del:hover { color: var(--hm-danger); }
table.grid tr.row-active td { background: var(--hm-hover); }
.item-meta { font-size: .7rem; color: var(--hm-muted); padding: 0 .45rem; min-height: .9rem; }
.item-meta .low { color: var(--hm-danger); font-weight: 600; }
.totals-card { background: var(--hm-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); padding: .9rem 1rem; }
.totals-card .r { display: flex; justify-content: space-between; padding: .18rem 0; font-size: .86rem; }
.totals-card .r span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.totals-card .grand { border-top: 2px dashed var(--hm-line); margin-top: .4rem; padding-top: .55rem; font-size: 1.25rem; font-weight: 800; color: var(--hm-primary); }
.save-bar { position: sticky; bottom: 0; z-index: 1010; background: var(--hm-top-bg); backdrop-filter: blur(6px); border-top: 1px solid var(--hm-line); margin: 1rem -1.25rem -1.25rem; padding: .7rem 1.25rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.shortcut-hint { color: var(--hm-muted); font-size: .74rem; }
.party-card { background: var(--hm-surface-2); border: 1px dashed var(--hm-input-line); border-radius: .6rem; padding: .5rem .7rem; font-size: .8rem; line-height: 1.45; }
.badge-soft { background: var(--hm-soft); color: var(--hm-ink); font-weight: 600; }
.badge-igst { background: #fff1e0; color: #b25e00; }
.badge-local { background: #e3f6ec; color: #0b7a44; }

/* ---- Bill designer */
.designer-list { list-style: none; margin: 0; padding: 0; }
.designer-list li { display: flex; align-items: center; gap: .5rem; background: var(--hm-surface); border: 1px solid var(--hm-line); border-radius: .55rem; padding: .4rem .55rem; margin-bottom: .35rem; font-size: .83rem; }
.designer-list li .handle { cursor: grab; color: #98a2b3; font-size: 1.1rem; }
.designer-list li.sortable-ghost { opacity: .4; background: #eaf0ff; }
.designer-list li.off { opacity: .55; background: #f7f8fa; }
.designer-list li input[type=text] { border: 1px solid #e3e7ef; border-radius: .35rem; padding: .15rem .35rem; font-size: .8rem; }
.designer-list li input.w { width: 56px; text-align: right; }
.preview-frame { width: 100%; height: calc(100vh - 170px); min-height: 520px; border: 1px solid var(--hm-line); border-radius: .85rem; background: #525659; }
.paper-pick .btn { font-size: .78rem; }

/* ---- Misc */
.toast-container { z-index: 1090; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--hm-muted); }
.empty-state i { font-size: 2.4rem; color: #c3cad8; display: block; margin-bottom: .5rem; }
.auth-bg { min-height: 100vh; background: radial-gradient(1000px 500px at 10% -10%, #cfdcff 0, transparent 60%), radial-gradient(800px 500px at 110% 110%, #c9f3ea 0, transparent 60%), #f3f6fb; }
.auth-card { max-width: 440px; border-radius: 1.2rem; box-shadow: 0 20px 60px rgba(16,24,40,.12); border: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.bal-dr { color: #0b6b3a; } .bal-cr { color: #b3261e; }
@media print {
  .hm-side, .hm-top, .hm-foot, .no-print, .save-bar { display: none !important; }
  .hm-content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; }
}

/* Keyboard row navigation (â†‘ / â†“ / Enter) */
tr[data-item] { cursor: pointer; }
.table tr.row-focus > td { background: var(--hm-soft) !important; }
.table tr.row-focus > td:first-child { box-shadow: inset 3px 0 0 var(--hm-primary); }

/* =====================================================================
   Themes: <html data-theme="..."> set from Settings -> Appearance.
   "modern" is the :root default above.
   ===================================================================== */

/* Classic: Tally-style teal, cream paper, square corners, yellow row highlight */
html[data-theme=classic] {
  --hm-primary: #1a6e75; --hm-primary-rgb: 26, 110, 117; --hm-primary-hover: #135459;
  --hm-ink: #1f2a2e; --hm-muted: #6b6a5f; --hm-label: #4b4a40;
  --hm-bg: #f4f1e8; --hm-surface: #fffdf7; --hm-surface-2: #efe9d8; --hm-hover: #f7f1de; --hm-soft: #fde9a4;
  --hm-line: #ddd5bf; --hm-input-line: #cbbf9f; --hm-top-bg: rgba(255,253,247,.96);
  --hm-side: #16474d; --hm-side-ink: #cfe3e2; --hm-side-sec: #8fb3b1;
  --hm-radius: .3rem; --hm-shadow: none;
  --hm-kbd-bg: #f1ead3; --hm-kbd-ink: #4b4a40; --hm-kbd-line: #d8cca8;
  --hm-brand-logo: linear-gradient(135deg, #f5b700, #1a6e75);
}
html[data-theme=classic] .form-control, html[data-theme=classic] .form-select, html[data-theme=classic] .btn { border-radius: .2rem; }
html[data-theme=classic] .hm-top h1 { color: var(--hm-primary); }

/* Stunning: violet-pink gradients, soft glow, extra-round */
html[data-theme=stunning] {
  --hm-primary: #6d28d9; --hm-primary-rgb: 109, 40, 217; --hm-primary-hover: #5b21b6;
  --hm-ink: #1e1537; --hm-muted: #6f6790; --hm-label: #4c4470;
  --hm-bg: #f6f4fe; --hm-surface: #ffffff; --hm-surface-2: #f7f5ff; --hm-hover: #f8f5ff; --hm-soft: #efe9ff;
  --hm-line: #e7e3f8; --hm-input-line: #d8d1f3; --hm-top-bg: rgba(255,255,255,.8);
  --hm-side: linear-gradient(180deg, #1e1b4b 0%, #3b0764 65%, #581c87 100%); --hm-side-ink: #d7cffc; --hm-side-sec: #a597e0;
  --hm-radius: 1.1rem; --hm-shadow: 0 8px 24px rgba(109,40,217,.07);
  --hm-kbd-bg: #efe9ff; --hm-kbd-ink: #4c1d95; --hm-kbd-line: #ddd0fb;
  --hm-brand-logo: linear-gradient(135deg, #f472b6, #8b5cf6);
}
html[data-theme=stunning] body { background: radial-gradient(900px 420px at 100% -10%, #f3e8ff 0, transparent 60%), radial-gradient(700px 400px at -10% 110%, #fce7f3 0, transparent 60%), var(--hm-bg) fixed; }
html[data-theme=stunning] .btn-primary { background-image: linear-gradient(135deg, #7c3aed, #db2777); border-color: transparent; box-shadow: 0 6px 16px rgba(124,58,237,.25); }
html[data-theme=stunning] .hm-nav a.active { background: linear-gradient(135deg, #7c3aed, #db2777); box-shadow: 0 6px 16px rgba(219,39,119,.25); }
html[data-theme=stunning] .totals-card .grand { background: linear-gradient(135deg, #7c3aed, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-theme=stunning] .card:hover { box-shadow: 0 12px 32px rgba(109,40,217,.1); }

/* Emerald: calm green */
html[data-theme=emerald] {
  --hm-primary: #0f8a5f; --hm-primary-rgb: 15, 138, 95; --hm-primary-hover: #0b6e4b;
  --hm-bg: #f1f7f4; --hm-surface-2: #f5faf7; --hm-hover: #f3faf6; --hm-soft: #dff5ea;
  --hm-line: #dde9e3; --hm-input-line: #cbdcd3;
  --hm-side: #0b2e24; --hm-side-ink: #b9d8cc; --hm-side-sec: #6f9f8e;
  --hm-kbd-bg: #e3f1ea; --hm-kbd-ink: #24473a; --hm-kbd-line: #c9dfd4;
  --hm-brand-logo: linear-gradient(135deg, #34d399, #0ea5e9);
}

/* Dark: true black (Bootstrap dark mode is switched on alongside) */
html[data-theme=dark] {
  color-scheme: dark;
  --hm-primary: #4f7cff; --hm-primary-rgb: 79, 124, 255; --hm-primary-hover: #3d68e6;
  --hm-ink: #e6e9ef; --hm-muted: #8b93a4; --hm-label: #aab2c2;
  --hm-bg: #050506; --hm-surface: #121317; --hm-surface-2: #191b21; --hm-hover: #1a1c23; --hm-soft: #1b2849;
  --hm-line: #24272f; --hm-input-line: #333845; --hm-top-bg: rgba(10,10,12,.88);
  --hm-side: #000000; --hm-side-ink: #a3abbb; --hm-side-sec: #5d6576;
  --hm-success: #34c77b; --hm-danger: #f26b61; --hm-warn: #f5b340;
  --hm-shadow: none;
  --hm-kbd-bg: #22252d; --hm-kbd-ink: #c8cfdb; --hm-kbd-line: #333845;
  --bs-body-bg: var(--hm-surface); --bs-secondary-bg: #1b1d22; --bs-tertiary-bg: #16181d; --bs-emphasis-color: #f4f6fa;
  --bs-secondary-color: var(--hm-muted);
}
html[data-theme=dark] .btn-light { --bs-btn-bg: #1b1d23; --bs-btn-color: var(--hm-ink); --bs-btn-border-color: var(--hm-input-line); --bs-btn-hover-bg: #23262e; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #3a3f4c; --bs-btn-active-bg: #2a2e38; --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--hm-primary); }
html[data-theme=dark] .ic-blue { background: rgba(79,124,255,.16); color: #8aa6ff; } html[data-theme=dark] .ic-green { background: rgba(52,199,123,.15); color: #5fd699; }
html[data-theme=dark] .ic-amber { background: rgba(245,179,64,.15); color: #f5b340; } html[data-theme=dark] .ic-red { background: rgba(242,107,97,.15); color: #f58a82; }
html[data-theme=dark] .ic-violet { background: rgba(167,139,250,.15); color: #b9a4fb; } html[data-theme=dark] .ic-teal { background: rgba(45,212,191,.14); color: #5eead4; }
html[data-theme=dark] .badge-igst { background: rgba(245,179,64,.15); color: #f5b340; }
html[data-theme=dark] .badge-local { background: rgba(52,199,123,.15); color: #5fd699; }
html[data-theme=dark] .bal-dr { color: #5fd699; } html[data-theme=dark] .bal-cr { color: #f58a82; }
html[data-theme=dark] .empty-state i, html[data-theme=dark] table.grid .del { color: #4a505e; }
html[data-theme=dark] .designer-list li.off { background: #0e0f12; }
html[data-theme=dark] .designer-list li input[type=text] { background: transparent; color: inherit; border-color: var(--hm-input-line); }
html[data-theme=dark] .hm-company { background: rgba(255,255,255,.05); }
html[data-theme=dark] .form-control::placeholder { color: #5d6576; }

/* Theme picker cards (Settings -> Appearance) */
.theme-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; }
.theme-pick label { cursor: pointer; border: 2px solid var(--hm-line); border-radius: .8rem; padding: .5rem; background: var(--hm-surface); transition: .15s; }
.theme-pick input { position: absolute; opacity: 0; }
.theme-pick input:checked + label { border-color: var(--hm-primary); box-shadow: 0 0 0 .2rem rgba(var(--hm-primary-rgb), .18); }
.theme-pick input:focus-visible + label { outline: 2px solid var(--hm-primary); outline-offset: 2px; }
.theme-pick .sw { display: flex; height: 92px; border-radius: .5rem; overflow: hidden; border: 1px solid rgba(0,0,0,.08); }
.theme-pick .sw .s { width: 30%; }
.theme-pick .sw .m { flex: 1; padding: .45rem; display: flex; flex-direction: column; gap: .3rem; }
.theme-pick .sw .m i { display: block; height: 10px; border-radius: 3px; }
.theme-pick .sw .m b { display: block; height: 22px; border-radius: 4px; }
.theme-pick .nm { font-weight: 700; margin-top: .45rem; font-size: .88rem; }
.theme-pick .ds { color: var(--hm-muted); font-size: .74rem; }

/* =====================================================================
   HMS additions
   ===================================================================== */

/* Medical teal theme */
html[data-theme=medical] {
  --hm-primary: #0e7c86; --hm-primary-rgb: 14, 124, 134; --hm-primary-hover: #0a646c;
  --hm-bg: #eef6f6; --hm-surface-2: #f4fafa; --hm-hover: #eef8f8; --hm-soft: #d9f1f2;
  --hm-line: #d8e8e8; --hm-input-line: #c3dada;
  --hm-side: #0b3b3f; --hm-side-ink: #b8d9db; --hm-side-sec: #6fa3a7;
  --hm-kbd-bg: #e1f1f2; --hm-kbd-ink: #1f4a4d; --hm-kbd-line: #c3dfe1;
  --hm-brand-logo: linear-gradient(135deg, #2dd4bf, #0ea5e9);
}

/* Compact density (default for front-desk speed) */
html[data-density=compact] { --bs-body-font-size: .82rem; }
html[data-density=compact] .hm-content { padding: .8rem 1rem; }
html[data-density=compact] .hm-top { min-height: 48px; padding: .4rem 1rem; }
html[data-density=compact] .card-header { padding: .5rem .8rem; }
html[data-density=compact] .card-body { padding: .7rem .8rem; }
html[data-density=compact] .form-control, html[data-density=compact] .form-select { padding: .28rem .5rem; font-size: .82rem; }
html[data-density=compact] .form-label { margin-bottom: .12rem; font-size: .72rem; }
html[data-density=compact] .table > :not(caption) > * > * { padding: .34rem .5rem; }
html[data-density=compact] .hm-nav a { padding: .32rem .6rem; }
html[data-density=compact] .hm-nav .sec { padding: .6rem .6rem .25rem; }
html[data-density=compact] .row.g-2 { --bs-gutter-y: .4rem; }
html[data-density=compact] .save-bar { margin: .8rem -1rem -.8rem; padding: .5rem 1rem; }

/* Patient summary card shown after picking a patient */
.pt-card { display: flex; gap: .75rem; align-items: center; background: var(--hm-soft); border: 1px solid var(--hm-line); border-radius: .6rem; padding: .45rem .7rem; }
.pt-card .av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--hm-primary); color: #fff; font-weight: 700; flex: 0 0 38px; }
.pt-card .nm { font-weight: 700; }
.pt-card .meta { font-size: .74rem; color: var(--hm-muted); }
.fee-box { background: var(--hm-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); padding: .7rem .8rem; }
.fee-box .big { font-size: 1.6rem; font-weight: 800; color: var(--hm-primary); letter-spacing: -.02em; }
.pay-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
.pay-grid label { font-size: .68rem; font-weight: 600; color: var(--hm-label); text-transform: uppercase; }
.pay-grid input { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 575.98px) { .pay-grid { grid-template-columns: repeat(2, 1fr); } }
.token-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; border-radius: 11px; background: var(--hm-primary); color: #fff; font-weight: 700; font-size: .75rem; padding: 0 .45rem; }
.badge-status { font-weight: 600; font-size: .68rem; }
.sec-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--hm-muted); font-weight: 700; margin: .2rem 0 .35rem; }
.list-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: end; margin-bottom: .6rem; }
.list-toolbar .form-control, .list-toolbar .form-select { width: auto; }
.nav-tabs .nav-link { padding: .4rem .8rem; font-size: .82rem; }
.money-pos { color: #0b7a44; } .money-neg { color: #b3261e; }
html[data-theme=dark] .money-pos { color: #5fd699; } html[data-theme=dark] .money-neg { color: #f58a82; }

/* HM.dialog - compact confirm / prompt / alert (replaces the browser's boxes) */
.hm-dialog-wrap { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); opacity: 0; transition: opacity .15s ease; }
.hm-dialog-wrap.show { opacity: 1; }
.hm-dialog { width: min(380px, 100%); background: var(--hm-surface); color: var(--hm-ink); border-radius: calc(var(--hm-radius) + .15rem);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .28); padding: 1.15rem 1.15rem .95rem; text-align: center;
  transform: scale(.94) translateY(6px); transition: transform .15s ease; }
.hm-dialog-wrap.show .hm-dialog { transform: none; }
.hm-dialog-icon { font-size: 2.1rem; line-height: 1; margin-bottom: .45rem; }
.hm-dialog-title { font-weight: 700; font-size: 1.02rem; margin-bottom: .2rem; }
.hm-dialog-text { color: var(--hm-label); font-size: .92rem; white-space: pre-line; overflow-wrap: anywhere; }
.hm-dialog .form-control { text-align: left; }
.hm-dialog-btns { display: flex; gap: .5rem; justify-content: center; margin-top: 1rem; }
.hm-dialog-btns .btn { min-width: 6.5rem; }
@media (max-width: 575.98px) {
  .hm-dialog-wrap { align-items: flex-end; padding: 0; }
  .hm-dialog { width: 100%; border-radius: 1rem 1rem 0 0; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateY(30px); }
  .hm-dialog-btns .btn { flex: 1; }
}

/* Date picker (flatpickr): theme colours, compact, works in dark mode */
.flatpickr-calendar { font-family: inherit; font-size: .85rem; border-radius: var(--hm-radius); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.startRange, .flatpickr-day.endRange { background: var(--hm-primary); border-color: var(--hm-primary); }
.flatpickr-day.today { border-color: var(--hm-primary); }
.flatpickr-day.today:hover { background: var(--hm-soft); color: var(--hm-ink); }
.flatpickr-months .flatpickr-month, .flatpickr-current-month .flatpickr-monthDropdown-months { font-weight: 600; }
html[data-bs-theme=dark] .flatpickr-calendar, html[data-bs-theme=dark] .flatpickr-months .flatpickr-month,
html[data-bs-theme=dark] .flatpickr-current-month .flatpickr-monthDropdown-months, html[data-bs-theme=dark] span.flatpickr-weekday,
html[data-bs-theme=dark] .flatpickr-time input, html[data-bs-theme=dark] .flatpickr-time .flatpickr-am-pm { background: var(--hm-surface); color: var(--hm-ink); fill: var(--hm-ink); }
html[data-bs-theme=dark] .flatpickr-day { color: var(--hm-ink); }
html[data-bs-theme=dark] .flatpickr-day.prevMonthDay, html[data-bs-theme=dark] .flatpickr-day.nextMonthDay { color: var(--hm-muted); }
html[data-bs-theme=dark] .flatpickr-day:hover { background: var(--hm-hover); }

/* Notifications bell */
.hm-bell-n { position: absolute; top: -6px; right: -8px; font-size: .62rem; }
.hm-notes { width: 360px; max-width: calc(100vw - 24px); }
.hm-notes-list { max-height: 420px; overflow-y: auto; }
.hm-note { display: flex; gap: .6rem; padding: .55rem .9rem; border-bottom: 1px solid var(--hm-line); color: var(--hm-ink); }
.hm-note:hover { background: var(--hm-hover); color: var(--hm-ink); }
.hm-note.unread { background: var(--hm-soft); }
.hm-note > i { font-size: 1.1rem; margin-top: .1rem; }
.hm-note .t { font-weight: 600; font-size: .82rem; }
.hm-note .b { font-size: .78rem; color: var(--hm-muted); }
.hm-note .w { font-size: .7rem; color: var(--hm-muted); margin-top: .1rem; }
.hm-toast-note .toast-body:hover { background: var(--hm-hover); }

/* ---- Top menu (Settings -> Appearance, or each user's own choice). The sidebar stays as the phone menu. */
.hm-head { position: sticky; top: 0; z-index: 1020; }
.hm-topnav { display: none; }
@media (min-width: 992px) {
  html[data-menu=top] .hm-side, html[data-menu=top] #sideToggle { display: none; }
  html[data-menu=top] .hm-top { min-height: 46px; padding-top: .3rem; padding-bottom: .3rem; }
  .hm-topnav { display: flex; align-items: center; gap: .5rem; position: relative; z-index: 1030; min-height: 42px; padding: 0 .75rem; background: var(--hm-side); color: var(--hm-side-ink); }
}
.hm-topnav .hm-brand { padding: .3rem .4rem .3rem 0; font-size: .95rem; white-space: nowrap; }
.hm-topnav .hm-brand .logo { width: 26px; height: 26px; border-radius: 7px; font-size: .85rem; }
.hm-tnav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .1rem; min-width: 0; }
.hm-tnav > li > a { display: flex; align-items: center; gap: .35rem; padding: .32rem .55rem; border-radius: .45rem; color: var(--hm-side-ink); font-size: .82rem; white-space: nowrap; }
.hm-tnav > li > a:hover, .hm-tnav > li > a.show { background: rgba(255,255,255,.1); color: #fff; }
.hm-tnav > li > a.active { background: var(--hm-primary); color: var(--hm-side-active); }
html[data-theme=stunning] .hm-tnav > li > a.active { background: linear-gradient(135deg, #7c3aed, #db2777); }
.hm-tnav .dropdown-menu { max-height: calc(100vh - 110px); overflow-y: auto; font-size: .83rem; min-width: 14rem; }
.hm-tnav .dropdown-item { display: flex; align-items: center; gap: .55rem; padding: .32rem .8rem; }
.hm-tnav .dropdown-item i { width: 1.1rem; text-align: center; opacity: .8; }
.hm-tnav .dropdown-item kbd { margin-left: auto; }
.hm-tnav .dropdown-item.active, .hm-tnav .dropdown-item:active { background: var(--hm-primary); color: #fff; }
.hm-tco { margin-left: auto; font-size: .74rem; line-height: 1.2; text-align: right; white-space: nowrap; padding-left: .5rem; }
.hm-tco b { display: block; color: #fff; font-size: .78rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1399.98px) { .hm-tco { display: none; } }
@media print { .hm-topnav { display: none !important; } }

/* ---- Ctrl+K search */
.hm-jump-btn { display: flex; align-items: center; gap: .45rem; flex: 0 1 280px; min-width: 0; padding: .24rem .55rem; color: var(--hm-muted); font-size: .8rem; background: var(--hm-surface); border: 1px solid var(--hm-input-line); border-radius: .5rem; text-align: left; }
.hm-jump-btn:hover { border-color: var(--hm-primary); color: var(--hm-ink); }
.hm-jump-btn span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-top h1 { flex: 0 1 auto; min-width: 0; }
@media (max-width: 991.98px) { .hm-jump-btn { flex: 0 0 auto; } .hm-jump-btn span, .hm-jump-btn kbd { display: none; } }
.hm-jump-wrap { position: fixed; inset: 0; z-index: 2000; display: flex; justify-content: center; align-items: flex-start; padding: 11vh 16px 16px; background: rgba(15,23,42,.45); }
.hm-jump { width: min(640px, 100%); max-height: 74vh; display: flex; flex-direction: column; overflow: hidden; background: var(--hm-surface); border: 1px solid var(--hm-line); border-radius: .9rem; box-shadow: 0 24px 64px rgba(16,24,40,.35); }
.hm-jump-in { display: flex; align-items: center; gap: .6rem; padding: .65rem .9rem; border-bottom: 1px solid var(--hm-line); color: var(--hm-muted); }
.hm-jump-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--hm-ink); font-size: .95rem; }
.hm-jump-list { flex: 1; min-height: 0; overflow-y: auto; padding: .25rem .35rem .4rem; }
.hm-jump-sec { padding: .5rem .55rem .15rem; color: var(--hm-muted); font-size: .67rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.hm-jump-item { display: flex; align-items: center; gap: .6rem; padding: .38rem .55rem; border-radius: .45rem; color: var(--hm-ink); font-size: .85rem; }
.hm-jump-item > i { color: var(--hm-muted); width: 1.1rem; text-align: center; }
.hm-jump-item.active { background: var(--hm-soft); color: var(--hm-ink); }
.hm-jump-item.active > i { color: var(--hm-primary); }
.hm-jump-item .t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-jump-item .s { margin-left: auto; flex-shrink: 0; max-width: 55%; color: var(--hm-muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-jump-item .s + kbd { margin-left: .3rem; }
.hm-jump-none { padding: 1.3rem; color: var(--hm-muted); font-size: .85rem; text-align: center; }
.hm-jump-foot { display: flex; gap: 1rem; padding: .35rem .9rem; border-top: 1px solid var(--hm-line); color: var(--hm-muted); font-size: .72rem; }
@media (max-width: 575.98px) { .hm-jump-wrap { padding-top: 12px; } .hm-jump-foot { display: none; } }

/* ---- IPD: discharge steps */
.dc-steps { display: flex; list-style: none; margin: 0 0 .5rem; padding: 0; overflow: hidden; background: var(--hm-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); }
.dc-step { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: .55rem; padding: .55rem .75rem; border-right: 1px solid var(--hm-line); }
.dc-step:last-child { border-right: 0; }
.dc-step .n { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--hm-surface-2); border: 1px solid var(--hm-input-line); color: var(--hm-muted); font-size: .8rem; font-weight: 700; }
.dc-step .t { font-size: .82rem; font-weight: 700; color: var(--hm-muted); }
.dc-step .d { font-size: .72rem; color: var(--hm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-step > div:last-child { min-width: 0; }
.dc-step.done .n { background: var(--hm-success); border-color: transparent; color: #fff; }
.dc-step.done .t { color: var(--hm-ink); }
.dc-step.now { background: var(--hm-soft); }
.dc-step.now .n { background: var(--hm-primary); border-color: transparent; color: #fff; }
.dc-step.now .t { color: var(--hm-ink); }
@media (max-width: 767.98px) { .dc-steps { flex-direction: column; } .dc-step { border-right: 0; border-bottom: 1px solid var(--hm-line); } .dc-step:last-child { border-bottom: 0; } }
.dc-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem 1rem; background: var(--hm-surface); border-top: 1px solid var(--hm-line); border-radius: 0 0 var(--hm-radius) var(--hm-radius); }
.dc-next { border-color: var(--hm-primary); }
.dc-next > .card-header { background: var(--hm-soft); }
.dc-money { display: flex; flex-wrap: wrap; gap: .3rem 1.3rem; font-size: .84rem; }
.dc-money b { font-size: .95rem; }
.dc-check { list-style: none; margin: 0; padding: 0; font-size: .82rem; display: grid; gap: .2rem; }
.dc-check i { margin-right: .35rem; }
.bed.pre { border-left-color: #f59e0b; }
