/* ApplifyPH Clinic — admin panel
   Look and layouts modelled on the RBJocsing portal: coloured header bar, page gradient,
   one rounded card, menu layouts chosen in Admin › Theme & layout. Colours come from
   --primary/--accent/--hl/... set by theme_head() in admin/includes/theme.php. */
:root {
  --primary: #0c3b5e; --onp: #fff; --accent: #0e8a86; --ona: #fff; --hl: #5fd3c6; --onhl: #0c2233;
  --info: #2f7fc1; --danger: #c0392b; --neutral: #7f8c9a; --bg1: #08263d; --bg2: #0f4566; --mainw: 1180px;
  --card: #f2f4f5; --panel: #ffffff; --text: #1f2d3a; --muted: #5d6d7e; --line: #d9dee3; --soft: rgba(127, 127, 127, .09);
}
[data-bs-theme="dark"] {
  --card: #1e2b38; --panel: #26364a; --text: #e8eef3; --muted: #a9b7c3; --line: #3a4d60;
  --bs-body-bg: #26364a; --bs-body-color: #e8eef3; --bs-border-color: #3a4d60; --bs-secondary-color: #a9b7c3;
  --bs-tertiary-bg: #2d3f54; --bs-secondary-bg: #2d3f54;
}
* { box-sizing: border-box; }
body.admin { margin: 0; font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: .94rem; color: var(--text);
  background: linear-gradient(var(--bg1), var(--bg2)) fixed; min-height: 100vh; }
a { color: var(--accent); }
[data-bs-theme="dark"] a { color: color-mix(in srgb, var(--accent) 55%, #fff); }
.text-teal { color: var(--accent) !important; }
.bg-teal { background: var(--accent) !important; color: var(--ona); }
.bg-gold { background: var(--hl) !important; color: var(--onhl); }

/* Buttons mapped to the theme colours */
.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: var(--ona);
  --bs-btn-hover-bg: color-mix(in srgb, var(--accent) 82%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--accent) 82%, #000); --bs-btn-hover-color: var(--ona);
  --bs-btn-active-bg: color-mix(in srgb, var(--accent) 75%, #000); --bs-btn-active-border-color: transparent; --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-navy { background: var(--primary); color: var(--onp); border-color: var(--primary); }
.btn-navy:hover, .btn-navy:focus { background: color-mix(in srgb, var(--primary) 80%, #000); color: var(--onp); border-color: transparent; }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-hover-color: var(--ona);
  --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent); --bs-btn-active-color: var(--ona); }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: var(--danger); --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger); }
.btn-danger { --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); }
.btn-light { --bs-btn-bg: var(--soft); --bs-btn-border-color: transparent; --bs-btn-color: var(--text); --bs-btn-hover-bg: rgba(127, 127, 127, .2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: transparent; }
.btn-gold { background: var(--hl); border-color: var(--hl); color: var(--onhl); font-weight: 600; }
.btn-gold:hover { filter: brightness(.94); color: var(--onhl); }
.btn-check:checked + .btn-outline-primary { background: var(--accent); border-color: var(--accent); color: var(--ona); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 22%, transparent); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-label { font-weight: 500; font-size: .86rem; color: var(--muted); margin-bottom: .25rem; }
.nav-link { color: var(--accent); }

/* Cards and tables inside the page */
.card { --bs-card-bg: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.card-header { background: transparent; font-weight: 600; border-bottom: 1px solid var(--line); padding: .75rem 1rem; }
.card-footer { background: transparent; border-top: 1px solid var(--line); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .7rem; border-color: var(--line); }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(127, 127, 127, .08); }
.clickable { cursor: pointer; }
.alert { border-radius: 10px; }
.badge.text-bg-light { background: var(--soft) !important; color: var(--text) !important; }

/* ---------- Header bar ---------- */
.adm-head { background: var(--primary); color: var(--onp); padding: 10px 20px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 1030; box-shadow: 0 2px 14px rgba(0, 0, 0, .25); }
.adm-logo img { height: 42px; width: auto; display: block; }
.hright { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--onp); }
.clk { font-size: .85rem; opacity: .85; margin-right: 8px; font-variant-numeric: tabular-nums; }
.hbtn { background: none; border: 0; color: var(--onp); font: inherit; font-size: .88rem; cursor: pointer; padding: 6px 10px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.hbtn:hover { background: rgba(255, 255, 255, .12); color: var(--onp); }
.hout { font-weight: 600; letter-spacing: .02em; color: var(--hl); white-space: nowrap; }
.av.av-img { overflow: hidden; background: var(--line); }
.av-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.av-sm { width: 30px; height: 30px; font-size: .72rem; }
.av.av-lg { width: 96px; height: 96px; font-size: 1.8rem; }
.ubtn { padding: 4px 8px 4px 4px; }
.ubtn .av { border: 2px solid rgba(255, 255, 255, .55); }
.uav { position: relative; display: inline-flex; }
.ubdg { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--primary); }
.ubdg[hidden], .msg-bdg[hidden] { display: none; }
.umenu .dropdown-item.active, .umenu .dropdown-item:active { background: var(--primary); color: var(--onp); }
.umenu .dropdown-item.active .bdg { background: #fff; color: var(--danger); }
.uname { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.umenu .dropdown-menu { min-width: 250px; padding: 6px; border-radius: 12px; }
.umenu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 4px; }
.umenu-head .min-w-0 { min-width: 0; }
.umenu .dropdown-item { border-radius: 8px; padding: 8px 10px; }
.fn-list { border: 1px solid var(--bs-border-color); border-radius: 10px; }
.fn-row { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 12px 8px 3.2em; border-bottom: 1px solid var(--bs-border-color); }
.fn-row:last-child { border-bottom: 0; }
.fn-row .form-check-input { flex: none; margin-top: 0; }
/* Help & user manual (1.17.0) */
.ptitle-help { font-size: 1rem; color: var(--muted); vertical-align: middle; text-decoration: none; }
.ptitle-help:hover { color: var(--accent); }
.help-toc-in { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; padding-right: 4px; }
.help-toc .sg { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: .8rem 0 .2rem; }
.help-toc .sg:first-child { margin-top: 0; }
.help-toc a { display: flex; gap: .5rem; align-items: center; padding: .3rem .5rem; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .88rem; }
.help-toc a:hover { background: var(--soft); }
.help-toc a.no-access, .help-sec.no-access .card-body { opacity: .6; }
.help-toc a[hidden], .help-toc .sg[hidden], .help-sec[hidden] { display: none !important; }
.help-sec { margin-bottom: 1rem; scroll-margin-top: 80px; }
.help-sec .card-header { font-weight: 600; }
.help-sec h3 { font-size: .95rem; font-weight: 600; margin: 1rem 0 .4rem; }
.help-sec h3:first-child { margin-top: 0; }
.help-sec li { margin-bottom: .25rem; }
.help-sec .tip { background: var(--soft); border-left: 3px solid var(--accent); border-radius: 6px; padding: .5rem .75rem; font-size: .9rem; }
.help-sec .faq dt { margin-top: .6rem; }
.help-sec .faq dd { margin-left: 0; color: var(--muted); }
.help-intro { color: var(--muted); }
@media (max-width: 991.98px) { .help-toc-in { position: static; max-height: none; } }
@media print {
  .adm-head, .lnav, .adm-foot, .help-tools, .help-toc, .ptitle-help { display: none !important; }
  .help-body { width: 100% !important; }
  .help-sec { break-inside: avoid; border: 1px solid #ccc; }
  .help-sec.no-access { display: none !important; }
}
.adm-logo { flex: none; }
.navtog { display: none; background: none; border: 0; color: var(--onp); font-size: 1.5rem; width: 40px; height: 40px; border-radius: 9px; cursor: pointer; padding: 0; }
.navtog:hover { background: rgba(255, 255, 255, .12); }

/* ---------- Page ---------- */
.adm-main { max-width: var(--mainw); margin: 24px auto; padding: 0 14px; }
.adm-card { background: var(--card); border-radius: 16px; padding: 20px; box-shadow: 0 8px 30px rgba(0, 0, 0, .3); }
.ptitle { font-size: 1.35rem; font-weight: 600; margin: 0 0 14px; color: var(--text); }
.adm-foot { text-align: center; color: rgba(255, 255, 255, .65); font-size: .78rem; padding: 6px 16px 24px; }
.lnav .who { display: none; }
.sg { display: none; }
.ti { display: none; }
.bdg { background: var(--danger); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .72rem; margin-left: 6px; font-weight: 600; }
.sidebar-backdrop { display: none; }

/* Classic: tabs across the top */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 18px; }
.tab { background: var(--primary); color: var(--onp); border-radius: 7px 7px 0 0; padding: 8px 13px; font-size: .86rem; text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; }
.tab:hover { filter: brightness(1.15); color: var(--onp); }
.tab.on { background: var(--hl); color: var(--onhl); font-weight: 600; }

/* Modern: pills in a soft bar */
body.lay-modern .adm-card { padding: 26px 30px; }
body.lay-modern .tabs { background: var(--soft); border: 0; border-radius: 14px; padding: 6px; gap: 4px; margin-bottom: 22px; }
body.lay-modern .tab { background: transparent; color: var(--text); border-radius: 999px; padding: 7px 15px; }
body.lay-modern .tab:hover { background: rgba(127, 127, 127, .16); filter: none; }
body.lay-modern .tab.on { background: var(--primary); color: var(--onp); }

/* Sidebar (plain list) */
@media (min-width: 861px) {
  body.lay-side .lay { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
  body.lay-side .lnav { border: 2px solid var(--line); border-radius: 12px; overflow: hidden; position: sticky; top: 78px; }
  body.lay-side .lnav .who { display: flex; padding: 12px; border-bottom: 1px solid var(--line); }
  body.lay-side .tabs { flex-direction: column; flex-wrap: nowrap; border: 0; padding: 0 0 8px; margin: 0; gap: 0; }
  body.lay-side .sg { display: block; background: var(--primary); color: var(--onp); padding: 4px 12px; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
  body.lay-side .tab { background: transparent; color: var(--text); border-radius: 0; padding: 8px 16px; }
  body.lay-side .tab:hover { background: rgba(127, 127, 127, .12); filter: none; }
  body.lay-side .tab.on { background: transparent; color: var(--accent); font-weight: 700; box-shadow: inset 3px 0 0 var(--hl); }
}

/* Who am I (sidebar layouts) */
.who { align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.who:hover { color: inherit; }
.av { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: var(--hl); display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.who-t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.who-t b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-t small { color: var(--muted); font-size: .74rem; }

/* ---------- Icon sidebar layouts (panel, dark, float, rail): body.navl; collapsed: body.navc; phones: body.navo ---------- */
body.navl .navtog { display: inline-grid; place-items: center; }
body.navl .lnav .who { display: flex; }
body.navl .tabs { flex-direction: column; flex-wrap: nowrap; border: 0; padding: 0; margin: 0; gap: 2px; }
body.navl .sg { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 12px 10px 4px; }
body.navl .tab { display: flex; align-items: center; gap: 11px; background: transparent; color: inherit; border-radius: 10px; padding: 8px 10px; font-weight: 500; position: relative; min-width: 0; }
body.navl .tab:hover { background: rgba(127, 127, 127, .16); filter: none; color: inherit; }
body.navl .tab.on { background: var(--hl); color: var(--onhl); }
body.navl .ti { display: inline-grid; place-items: center; width: 20px; flex: none; font-size: 1.08rem; }
body.navl .tl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.navl .adm-card { padding: 0; }
body.lay-dark .lnav { background: var(--primary); color: var(--onp); }
body.lay-dark .sg { color: color-mix(in srgb, var(--onp) 55%, transparent); }
body.lay-dark .who-t small { color: color-mix(in srgb, var(--onp) 65%, transparent); }
body.lay-dark .av { background: rgba(255, 255, 255, .18); }
body.lay-dark .tab:hover { background: rgba(255, 255, 255, .12); }
body.lay-dark .tab.on { background: rgba(255, 255, 255, .16); color: inherit; box-shadow: inset 3px 0 0 var(--hl); }
body.lay-rail .tab.on { background: var(--accent); color: var(--ona); }
body.lay-float .adm-card { background: transparent; box-shadow: none; }
body.lay-float .lnav, body.lay-float .lmain { background: var(--card); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }

@media (min-width: 861px) {
  body.navl .adm-main { max-width: calc(var(--mainw) + 240px); }
  body.navl .lay { display: grid; grid-template-columns: var(--navw, 236px) minmax(0, 1fr); align-items: stretch; min-height: calc(100vh - 160px); }
  body.navl.navc .lay { --navw: 70px; }
  body.navl .lnav { padding: 14px 10px; min-width: 0; }
  body.navl .lnav > * { position: relative; }
  body.navl .lmain { padding: 22px 26px; min-width: 0; }
  body.navl .who { padding: 0 4px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  body.lay-panel .lnav, body.lay-rail .lnav { background: var(--soft); border-right: 1px solid var(--line); border-radius: 16px 0 0 16px; }
  body.lay-dark .lnav { border-radius: 16px 0 0 16px; }
  body.lay-dark .who { border-color: rgba(255, 255, 255, .18); }
  body.lay-float .lay { gap: 18px; align-items: start; min-height: 0; }
  body.lay-float .lnav { border-radius: 18px; position: sticky; top: 78px; }
  body.lay-float .lmain { border-radius: 18px; }
  body.navl .tabs { position: sticky; top: 76px; }
  /* collapsed: icons only, names as tooltips */
  body.navl.navc .who { justify-content: center; padding: 0 0 12px; }
  body.navl.navc .who-t, body.navl.navc .tl, body.navl.navc .sg { display: none; }
  body.navl.navc .sg + .tab { margin-top: 8px; }
  body.navl.navc .tab { justify-content: center; padding: 10px 0; }
  body.navl.navc .bdg { position: absolute; top: 0; right: 4px; margin: 0; padding: 0 5px; font-size: .64rem; }
}

/* Phones and small tablets: every layout's menu opens from ☰ */
@media (max-width: 860px) {
  .navtog { display: inline-grid !important; place-items: center; }
  .adm-main { margin: 12px auto; padding: 0 8px; }
  .adm-card, body.navl .lmain { padding: 14px; }
  body.navl .adm-card { padding: 0; }
  .lnav .tabs { display: none; }
  body.navo .lnav .tabs { display: flex; flex-direction: column; flex-wrap: nowrap; margin-bottom: 14px; }
  body.navo .tab { border-radius: 8px; }
  body.navl .lnav { padding: 10px 12px; border-radius: 16px 16px 0 0; }
  body.navo .sg { display: block; }
  body.lay-float .lnav { border-radius: 16px; margin-bottom: 12px; }
  body.lay-float .lmain { border-radius: 16px; }
  .lnav .who { display: none !important; }
  body.navo .lnav .who { display: flex !important; padding-bottom: 8px; }
  .adm-logo img { height: 34px; }
  .hout { padding: 6px; }
}

/* ---------- Pages ---------- */
.stat-card { display: flex; align-items: center; gap: .9rem; background: var(--panel); border-radius: 12px; padding: 1rem; text-decoration: none; color: inherit; border: 1px solid var(--line); height: 100%; transition: .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .12); color: inherit; }
.stat-card > i { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-teal > i { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.stat-gold > i { background: color-mix(in srgb, var(--hl) 30%, transparent); color: color-mix(in srgb, var(--hl) 55%, #000); }
.stat-navy > i { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
[data-bs-theme="dark"] .stat-navy > i { color: #9fc3e6; }
[data-bs-theme="dark"] .stat-gold > i { color: var(--hl); }
.stat-danger > i { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

.record-head { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem; margin-bottom: 1rem; }
.record-img { width: 140px; height: 100px; object-fit: cover; border-radius: 10px; }
.record-head h2 a { text-decoration: none; }
.record-tabs { border-bottom: 2px solid var(--line); flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.record-tabs .nav-link { color: var(--muted); border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; font-weight: 500; }
.record-tabs .nav-link.active { color: var(--text); border-bottom-color: var(--hl); background: none; }
.avatar-sm, .avatar-lg { display: inline-grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--hl); font-weight: 700; flex: none; }
.avatar-sm { width: 34px; height: 34px; font-size: .78rem; margin-right: .4rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }
.thumb { width: 84px; height: 60px; object-fit: cover; border-radius: 8px; }
.thumb-sm { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; }
.img-preview { width: 160px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--primary); }
.logo-preview { background: var(--primary); padding: 1rem; border-radius: 10px; display: inline-block; }
.logo-preview img { max-height: 80px; }

.upload-box { background: var(--soft); border: 2px dashed var(--line); border-radius: 12px; padding: .9rem; }
.photo-preview { display: flex; flex-wrap: wrap; gap: .5rem; }
.photo-preview img { width: 90px; height: 66px; object-fit: cover; border-radius: 6px; }
.photo-card { background: var(--panel); border: 2px solid var(--line); border-radius: 12px; overflow: hidden; position: relative; }
.photo-card.is-cover { border-color: var(--hl); }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.cover-badge { position: absolute; top: 8px; left: 8px; background: var(--hl); color: var(--onhl); font-size: .74rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 17px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline li { position: relative; display: flex; gap: 1rem; padding-bottom: 1.1rem; }
.tl-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line); display: grid; place-items: center; color: var(--muted); flex: none; z-index: 1; }
.tl-body { flex: 1; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .85rem; font-size: .9rem; }
.tl-meta { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.tl-meta a { color: var(--muted); }
.tl-details { font-size: .84rem; color: var(--muted); margin-top: .35rem; border-top: 1px dashed var(--line); padding-top: .35rem; }
.tl-lease_start .tl-icon { border-color: var(--accent); color: var(--accent); }
.tl-payment .tl-icon, .tl-maintenance_done .tl-icon { border-color: #198754; color: #198754; }
.tl-maintenance .tl-icon { border-color: #fd7e14; color: #fd7e14; }
.tl-status .tl-icon, .tl-created .tl-icon { border-color: var(--info); color: var(--info); }
.tl-note .tl-icon { border-color: var(--hl); color: color-mix(in srgb, var(--hl) 60%, #000); }

.icon-picker { display: flex; flex-wrap: wrap; gap: .35rem; }
.icon-opt { width: 42px; height: 42px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; font-size: 1.2rem; color: var(--text); }
.icon-opt.active, .icon-opt:hover { background: var(--primary); color: var(--hl); border-color: var(--primary); }

.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--card) 35%); padding: 1.2rem 0 .4rem; margin-top: 1rem; z-index: 5; }

/* Security / audit / theme pages */
.bkbox { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; background: var(--panel); }
.bkbox h2 { font-size: 1rem; font-weight: 600; margin: 0 0 4px; }
.hint { color: var(--muted); font-size: .8rem; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: .78rem; color: #fff; background: var(--neutral); }
.pill.act { background: var(--accent); } .pill.sus { background: var(--danger); } .pill.adm { background: var(--info); }
.pill a { color: inherit; text-decoration: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .84rem; }
.crow { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.crow input[type=color] { width: 52px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }
.crow code { font-size: .8rem; color: var(--muted); }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.presets .btn.on { box-shadow: 0 0 0 2px var(--accent); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 3px; vertical-align: -1px; }
.lay-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; cursor: pointer; margin: 0; }
.lay-opt:hover { background: var(--soft); }
.lay-opt input { margin-top: 4px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(var(--bg1), var(--bg2)) fixed; font-family: Poppins, system-ui, sans-serif; color: var(--text); }
.login-page .adm-head { justify-content: center; }
.login-wrap { flex: 1; display: grid; place-items: center; padding: 24px 14px; }
.login-card { background: var(--card); border-radius: 16px; width: 100%; max-width: 400px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.login-card .captcha-img { border-radius: 8px; border: 1px solid rgba(0, 0, 0, .12); background: #f1f3f7; max-width: 100%; height: auto; }
.login-card h1 { font-size: 1.35rem; font-weight: 600; margin: 0 0 4px; }

/* Review bars */
.review-bar { border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.review-bar.pending { background: color-mix(in srgb, var(--hl) 22%, var(--panel)); border: 1px solid color-mix(in srgb, var(--hl) 55%, transparent); }
.review-bar.rejected { background: color-mix(in srgb, var(--danger) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.review-bar.hidden { background: var(--soft); border: 1px dashed var(--line); }

/* Document thumbnails */
.id-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.id-slot { border: 2px dashed var(--line); border-radius: 12px; padding: .8rem; background: var(--soft); }
.id-slot h3 { font-size: .85rem; font-weight: 600; margin: 0 0 .5rem; display: flex; justify-content: space-between; align-items: center; }
.id-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 1.586; border-radius: 10px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--muted); }
.id-thumb img { width: 100%; height: 100%; object-fit: cover; }
.id-thumb.is-file { flex-direction: column; gap: .3rem; font-size: .78rem; padding: .5rem; text-align: center; word-break: break-all; }
.id-thumb.is-file i { font-size: 2rem; color: var(--accent); }
.id-thumb.empty { flex-direction: column; gap: .3rem; font-size: .8rem; }
.id-thumb.empty i { font-size: 1.8rem; }
.id-pick { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.id-pick label { margin: 0; }
.id-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.doc-mini { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-top: 1px solid var(--line); font-size: .88rem; }
.doc-mini:first-child { border-top: 0; }
.doc-mini .id-thumb { width: 64px; flex: none; aspect-ratio: 4 / 3; }
.doc-mini .id-thumb.is-file span { display: none; }
.doc-mini .id-thumb.is-file i { font-size: 1.4rem; }

/* Print: reports and rent collection (1.5.0) */
@media print {
  body.admin { background: #fff !important; }
  .adm-head, .lnav, .adm-foot, .no-print, .btn, .sticky-save, .nav-tabs, form.no-print, .sidebar-backdrop { display: none !important; }
  body.navl .lay, body.lay-side .lay { display: block !important; }
  .adm-main { max-width: none; margin: 0; padding: 0; }
  .adm-card, body.navl .lmain, body.lay-float .lmain { box-shadow: none !important; padding: 0 !important; background: #fff !important; }
  .card, .bkbox, .stat-card { break-inside: avoid; border-color: #ccc !important; }
  .table-danger > * { background: #fde8e8 !important; }
  a { color: inherit !important; text-decoration: none !important; }
  .print-title { display: block !important; }
}
.print-title { display: none; }
.report-nav .list-group-item.active { background: var(--primary); border-color: var(--primary); color: var(--onp); }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding: 8px 4px 0; border-bottom: 1px solid var(--line); }
.chart-bars .cb { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; height: 100%; position: relative; }
.chart-bars .cb-due { width: 100%; background: color-mix(in srgb, var(--neutral) 30%, transparent); border-radius: 6px 6px 0 0; position: relative; }
.chart-bars .cb-paid { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 6px 6px 0 0; }
.chart-labels { display: flex; gap: 6px; padding: 4px; }
.chart-labels span { flex: 1; text-align: center; font-size: .7rem; color: var(--muted); min-width: 0; overflow: hidden; }

/* Calendar (1.6.0) */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.cal-dow { padding: .45rem .5rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line); text-align: center; }
.cal-day { min-height: 118px; padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day:nth-child(7n + 7) { border-right: 0; }
.cal-day.out { background: var(--soft); }
.cal-day.out .cal-dnum span { opacity: .45; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--hl); }
.cal-dnum { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; font-weight: 600; padding: 0 .15rem; }
.cal-day.today .cal-dnum span { background: var(--hl); color: var(--onhl); border-radius: 999px; padding: 0 .45rem; }
.cal-add { opacity: 0; color: var(--muted); text-decoration: none; font-size: 1rem; line-height: 1; }
.cal-day:hover .cal-add { opacity: 1; }
.cal-chip { display: block; font-size: .72rem; line-height: 1.25; padding: 2px 5px; border-radius: 5px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); background: var(--soft); border-left: 3px solid var(--neutral); }
.cal-chip:hover { filter: brightness(.95); color: var(--text); }
.cal-chip i { margin-right: 3px; }
.cal-more { font-size: .72rem; padding: 0 5px; text-decoration: none; }
@media (max-width: 767.98px) { .cal-day { min-height: 72px; } .cal-chip { font-size: 0; padding: 0; height: 6px; border-left-width: 0; } .cal-chip i { display: none; } .cal-add { opacity: 1; } }

/* colours per kind: appointments by status, events by type, follow-ups */
.appt-requested { --c: #d39e00; } .appt-confirmed { --c: #2f6fb0; } .appt-arrived, .appt-in_progress { --c: #7c4dbd; } .appt-done { --c: #2e8b57; }
.appt-cancelled, .appt-no_show { --c: #8a96a3; } .follow { --c: #0b7f72; }
.ev-meeting { --c: #7c4dbd; } .ev-training { --c: #0f8a7e; } .ev-delivery { --c: #b7791f; } .ev-maintenance { --c: #fd7e14; } .ev-holiday { --c: #c0392b; } .ev-other { --c: #6c757d; }
.cal-chip.appt, .cal-chip.follow, .cal-chip[class*=" ev-"], .cal-chip[class^="ev-"] { border-left-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--panel)); }
.cal-chip.appt-requested { font-weight: 600; }
.cal-chip.appt-cancelled, .cal-chip.appt-no_show { opacity: .55; text-decoration: line-through; }
.cal-chip.ev-done, .agenda-item.ev-done { opacity: .6; } .cal-chip.ev-cancelled, .agenda-item.ev-cancelled { opacity: .5; text-decoration: line-through; }
.cal-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--neutral)); margin-right: 4px; vertical-align: -1px; }

.agenda-day { display: flex; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.agenda-date { width: 64px; flex: none; text-align: center; display: flex; flex-direction: column; line-height: 1.1; }
.agenda-date b { font-size: 1.6rem; } .agenda-date span { color: var(--muted); font-size: .8rem; } .agenda-date em { font-style: normal; font-size: .7rem; color: var(--onhl); background: var(--hl); border-radius: 999px; margin-top: 3px; }
.agenda-item { display: flex; gap: .7rem; align-items: center; padding: .45rem .6rem; border-radius: 10px; margin-bottom: .35rem; background: color-mix(in srgb, var(--c, var(--neutral)) 10%, var(--panel)); border-left: 4px solid var(--c, var(--neutral)); }
.agenda-item > i { color: var(--c); font-size: 1.1rem; }
.up-date { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .5rem .4rem .2rem; }
.up-item { display: flex; gap: .55rem; padding: .4rem; border-radius: 8px; text-decoration: none; color: var(--text); font-size: .84rem; align-items: flex-start; }
.up-item:hover { background: var(--soft); color: var(--text); }
.up-item > i { color: var(--c, var(--muted)); margin-top: 2px; }
.up-item small { display: block; color: var(--muted); font-size: .74rem; }
.ev-type-pick { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Calendar views (1.6.1): square month, week time grid, year */
.cal-square .cal-day { min-height: 0; aspect-ratio: 1 / 1; overflow: hidden; }
.cal-square .cal-chips { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
.cal-dnum a:first-child { color: inherit; text-decoration: none; }
.cal-dnum a:first-child:hover { color: var(--accent); }
.cal-day.today .cal-dnum a:first-child { background: var(--hl); color: var(--onhl); border-radius: 999px; padding: 0 .45rem; }
@media (max-width: 767.98px) { .cal-square .cal-day { aspect-ratio: auto; min-height: 58px; } }

.cal-week { display: grid; grid-template-columns: 64px repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.cw-corner, .cw-head { background: var(--soft); border-bottom: 1px solid var(--line); }
.cw-head { display: flex; flex-direction: column; align-items: center; padding: .35rem 0; text-decoration: none; color: var(--text); border-left: 1px solid var(--line); line-height: 1.15; }
.cw-head span { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cw-head b { font-size: 1.15rem; }
.cw-head.today b { background: var(--hl); color: var(--onhl); border-radius: 999px; padding: 0 .5rem; }
.cw-time { font-size: .7rem; color: var(--muted); text-align: right; padding: .3rem .45rem 0 0; border-bottom: 1px solid var(--line); }
.cw-cell { position: relative; min-height: 44px; padding: 2px 3px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cw-cell.today { background: color-mix(in srgb, var(--hl) 7%, transparent); }
.cw-cell.now { box-shadow: inset 0 2px 0 var(--danger); }
.cw-all { min-height: 52px; background: var(--soft); }
.cw-cell .cal-add { position: absolute; right: 3px; bottom: 1px; }
.cw-cell:hover .cal-add { opacity: 1; }
@media (max-width: 767.98px) { .cal-week { grid-template-columns: 40px repeat(7, minmax(0, 1fr)); } .cw-time { font-size: .6rem; padding-right: 2px; } .cw-cell .cal-chip { font-size: 0; height: 8px; padding: 0; } }

.cal-year { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.cy-month { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .7rem .7rem; }
.cy-month.current { box-shadow: 0 0 0 2px var(--hl); }
.cy-title { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--text); text-decoration: none; margin-bottom: .35rem; }
.cy-title span { font-size: .7rem; font-weight: 500; background: var(--soft); border-radius: 999px; padding: 0 .5rem; color: var(--muted); }
.cy-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cy-dow { font-size: .62rem; text-align: center; color: var(--muted); }
.cy-day { position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; font-size: .72rem; border-radius: 6px; text-decoration: none; color: var(--text); }
.cy-day:hover { background: var(--soft); color: var(--text); }
.cy-day.has { background: color-mix(in srgb, var(--c) 22%, var(--panel)); color: var(--text); font-weight: 600; }
.cy-day.has.appt-requested { background: var(--c); color: #fff; }
.cy-day.today { box-shadow: inset 0 0 0 2px var(--hl); }
.cy-day i { position: absolute; top: 0; right: 1px; font-style: normal; font-size: .5rem; line-height: 1; color: var(--muted); }
.cy-day.has.appt-requested i { color: #fff; }

/* Messages (1.7.0) */
.msg-folders .nav-link { padding: .35rem .8rem; color: var(--text); }
.msg-folders .nav-link.active { background: var(--primary); color: var(--onp); }
.msg-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .9rem; background: var(--panel); }
.msg-row:hover { background: var(--soft); }
.msg-link { flex: 1; min-width: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: .8rem; align-items: center; text-decoration: none; color: var(--text); }
.msg-link:hover { color: var(--text); }
.msg-who, .msg-subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-subj b { font-weight: 500; }
.msg-meta { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.msg-row.unread { box-shadow: inset 3px 0 0 var(--accent); }
.msg-row.unread .msg-who, .msg-row.unread .msg-subj b, .msg-row.unread .msg-meta { font-weight: 700; color: var(--text); }
@media (max-width: 767.98px) { .msg-link { grid-template-columns: 1fr auto; } .msg-subj { grid-column: 1 / -1; grid-row: 2; } }

.msg-field { display: flex; align-items: flex-start; gap: .8rem; border-bottom: 1px solid var(--line); padding: .45rem 0; }
.msg-field > label { width: 64px; flex: none; color: var(--muted); font-size: .88rem; padding-top: .45rem; }
.msg-field .form-control { border: 0; box-shadow: none; padding-left: 0; background: transparent; }
.people-pick { flex: 1; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; position: relative; min-height: 38px; cursor: text; }
.pp-chips { display: contents; }
.pp-chip { display: inline-flex; align-items: center; gap: .3rem; background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; padding: .1rem .2rem .1rem .65rem; font-size: .86rem; }
.pp-chip button { border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0 .3rem; }
.pp-input { flex: 1; min-width: 140px; border: 0; outline: 0; background: transparent; color: var(--text); padding: .35rem 0; }
.pp-list { display: none; position: absolute; left: 0; top: 100%; z-index: 30; min-width: 280px; max-height: 260px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: .3rem; }
.pp-list button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left; padding: .4rem .6rem; border-radius: 8px; color: var(--text); }
.pp-list button:hover, .pp-list button:first-child:focus { background: var(--soft); }
.pp-list button span { font-size: .76rem; color: var(--muted); }
.pp-empty { padding: .5rem .6rem; color: var(--muted); font-size: .85rem; }

.msg-card.mine { border-left: 3px solid var(--accent); }
.msg-card .av { width: 40px; height: 40px; }
.msg-body { white-space: normal; line-height: 1.6; word-break: break-word; }
.msg-card.collapsed-msg { cursor: pointer; }
.msg-card.collapsed-msg .msg-body { max-height: 2.6em; overflow: hidden; color: var(--muted); -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); }
.msg-card.collapsed-msg .msg-atts { display: none; }
.msg-atts { display: flex; flex-wrap: wrap; gap: .6rem; }
.msg-att { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line); border-radius: 10px; padding: .35rem .6rem .35rem .35rem; text-decoration: none; color: var(--text); max-width: 260px; background: var(--panel); }
.msg-att:hover { background: var(--soft); color: var(--text); }
.msg-att img { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; }
.msg-att i { font-size: 1.8rem; color: var(--accent); width: 46px; text-align: center; }
.msg-att span { display: flex; flex-direction: column; font-size: .82rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-att small { color: var(--muted); }
.min-w-0 { min-width: 0; }

/* Dashboard widgets (1.8.0) */
.dash-wbar, .dash-editbar, .dash-hidden-note { display: none; }
.dash-w.is-hidden { display: none; }
body.dash-editing .dash-tools { display: none !important; }
body.dash-editing .dash-editbar { display: block; position: sticky; top: 70px; z-index: 20; background: var(--panel); border: 1px solid var(--hl); border-radius: 12px; padding: .6rem .9rem; margin-bottom: 1rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
body.dash-editing .dash-w { display: block; }
body.dash-editing .dash-w > .dash-wbody { position: relative; border: 2px dashed var(--line); border-top: 0; border-radius: 0 0 12px 12px; padding: .5rem; max-height: 260px; overflow: hidden; pointer-events: none; }
body.dash-editing .dash-w > .dash-wbody::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 50px; background: linear-gradient(transparent, var(--card)); }
body.dash-editing .dash-wbar { display: flex; align-items: center; gap: .4rem; background: var(--soft); border: 2px dashed var(--line); border-radius: 12px 12px 0 0; padding: .35rem .5rem; font-size: .85rem; cursor: grab; }
body.dash-editing .dash-w.is-hidden .dash-wbody { opacity: .45; }
body.dash-editing .dash-w.is-hidden .dash-wname { text-decoration: line-through; color: var(--muted); }
body.dash-editing .dash-w.is-hidden .dash-hidden-note { display: block; padding: .8rem; text-align: center; color: var(--muted); }
body.dash-editing .dash-w.dragging { opacity: .4; }
.dash-wname { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-grip { color: var(--muted); font-size: 1.1rem; }
/* expand / collapse (1.16.0) */
.dash-col { background: none; border: 0; padding: 2px 6px; border-radius: 6px; color: var(--muted); line-height: 1; cursor: pointer; }
.dash-col:hover { background: var(--soft); color: var(--text); }
.dash-col i { display: inline-block; transition: transform .2s; }
.dash-w.collapsed .dash-col i { transform: rotate(180deg); }
.dash-w.collapsed .card { height: auto !important; }
.dash-w.collapsed .card > .card-header { border-bottom: 0; }
.dash-w.collapsed .card > .card-header ~ *, .dash-w.collapsed .dash-sec ~ * { display: none !important; }
.dash-sec { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 .4rem; }
.dash-w.collapsed .dash-sec { margin: 0; padding: .45rem .75rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
body.dash-editing .dash-col, body.dash-editing .dash-sec .dash-col { visibility: hidden; }
.quick-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .6rem; }
.quick-act { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .8rem .4rem; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .84rem; text-align: center; transition: .15s; }
.quick-act i { font-size: 1.4rem; color: var(--accent); }
.quick-act:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }

/* Groups & permissions (1.10.0) */
.perm-table td { vertical-align: middle; }
.perm-table .form-check-input { width: 1.2rem; height: 1.2rem; cursor: pointer; }
.perm-table .lvl-none:checked { background-color: var(--danger); border-color: var(--danger); }
.perm-table .lvl-read:checked { background-color: var(--info); border-color: var(--info); }
.list-group-item.active-group { box-shadow: inset 3px 0 0 var(--hl); background: var(--soft); }
.ro-form { opacity: .7; }
.ro-form button[disabled] { cursor: not-allowed; }

/* ---------- Website Analytics (1.19.0) ---------- */
.anx { --an1:#2a78d6; --an2:#eb6834; --an3:#1baf7a; --an4:#eda100; --an5:#e87ba4; --an6:#008300; --an7:#6250d6; --an8:#e34948; --an-track:#eef1f5; }
[data-bs-theme="dark"] .anx { --an1:#3987e5; --an2:#d95926; --an3:#199e70; --an4:#c98500; --an5:#d55181; --an6:#008300; --an7:#9085e9; --an8:#e66767; --an-track:#33475c; }
.anx .an-muted { color: var(--muted); }
.anx .an-top { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
.anx .an-sub { color: var(--muted); font-size:.86rem; }
.anx .an-live { display:inline-flex; align-items:center; gap:8px; background:var(--panel); border:1px solid var(--line); border-radius:999px; padding:6px 14px; font-size:.86rem; }
.anx .an-live .pulse { width:9px; height:9px; border-radius:50%; background:#cbd5e1; }
.anx .an-live.on .pulse { background:#10b981; animation: anPulse 1.8s infinite; }
@keyframes anPulse { 0% { box-shadow:0 0 0 0 rgba(16,185,129,.5); } 70% { box-shadow:0 0 0 8px rgba(16,185,129,0); } 100% { box-shadow:0 0 0 0 rgba(16,185,129,0); } }
@media (prefers-reduced-motion: reduce) { .anx .an-live.on .pulse { animation:none; } }
.anx .an-note { display:flex; gap:10px; align-items:center; border:1px dashed var(--line); border-radius:12px; padding:9px 14px; margin-bottom:12px; font-size:.86rem; background: var(--soft); }
.anx .an-note span { flex:1; }
.anx .an-filters { display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:space-between; margin-bottom:16px; }
.anx .an-custom { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.anx .an-custom .form-control, .anx .an-custom .form-select { width:auto; }
.anx .an-custom .form-select { max-width:260px; }
.anx .an-seg { display:inline-flex; flex-wrap:wrap; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:3px; gap:2px; }
.anx .an-seg a { padding:5px 11px; border-radius:8px; font-size:.84rem; font-weight:500; color:var(--text); text-decoration:none; }
.anx .an-seg a.on { background:var(--primary); color:var(--onp); }
.anx .an-seg.sm a { padding:3px 9px; font-size:.78rem; }
.anx .an-hero { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:12px; }
.anx .an-hc { position:relative; background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:14px 16px 10px; display:flex; flex-direction:column; gap:6px; min-height:128px; overflow:hidden; }
.anx .an-hc::before { content:""; position:absolute; inset:0 0 auto 0; height:3px; background:var(--hc); }
.anx .hc-head { display:flex; align-items:center; gap:8px; }
.anx .hc-head small { color:var(--muted); font-weight:600; font-size:.74rem; text-transform:uppercase; letter-spacing:.05em; flex:1; }
.anx .hc-ic, .anx .mi-ic { display:grid; place-items:center; color:#fff; border-radius:11px; background:linear-gradient(135deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c)); box-shadow:0 6px 14px color-mix(in srgb, var(--c) 30%, transparent); flex:none; }
.anx .hc-ic { width:36px; height:36px; font-size:1.05rem; }
.anx .mi-ic { width:32px; height:32px; font-size:.95rem; border-radius:10px; }
.anx .an-hc strong { font-size:1.9rem; line-height:1.1; color:var(--text); }
.anx .hc-sub { font-size:.85rem; font-weight:500; color:var(--muted); margin-left:4px; }
.anx .hc-foot { font-size:.78rem; color:var(--muted); margin-top:auto; }
.anx .an-spark { width:100%; height:34px; margin-top:auto; display:block; }
.anx .an-delta { display:inline-flex; align-items:center; font-size:.72rem; font-weight:700; padding:2px 8px; border-radius:999px; background:var(--soft); color:var(--muted); white-space:nowrap; }
.anx .an-delta.up { background:#ecfdf5; color:#047857; } .anx .an-delta.down { background:#fef2f2; color:#b91c1c; } .anx .an-delta.new { background:#eef2ff; color:#4338ca; }
.anx .an-mini { display:grid; grid-template-columns:repeat(5,1fr); background:var(--panel); border:1px solid var(--line); border-radius:14px; margin-bottom:16px; }
.anx .an-mini > div { padding:11px 14px; display:flex; align-items:center; gap:10px; border-left:1px solid var(--line); }
.anx .an-mini > div:first-child { border-left:0; }
.anx .an-mini > div > span:nth-child(2) { display:flex; flex-direction:column; flex:1; min-width:0; }
.anx .an-mini small { color:var(--muted); font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.04em; }
.anx .an-mini b { font-size:1.15rem; color:var(--text); }
.anx .an-panel { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px 18px; margin-bottom:16px; }
.anx .an-ph { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:12px; flex-wrap:wrap; }
.anx .an-ph h2 { font-size:1rem; font-weight:600; margin:0; }
.anx .an-ph h2 .bi { color:var(--accent); margin-right:4px; }
.anx .an-h3 { font-size:.74rem; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin:18px 0 10px; font-weight:600; }
.anx .an-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.anx .an-grid3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.anx .an-grid2 > .an-panel, .anx .an-grid3 > .an-panel { margin-bottom:16px; }
.anx .an-legend { display:flex; gap:14px; font-size:.8rem; color:var(--muted); margin-top:4px; }
.anx .an-legend span, .anx .an-tip span { display:inline-flex; align-items:center; gap:6px; }
.anx .lg-col { display:inline-block; width:10px; height:12px; border-radius:3px 3px 0 0; background:var(--an1); }
.anx .lg-line { display:inline-block; width:16px; height:2px; border-radius:2px; background:var(--an2); position:relative; }
.anx .lg-line::after { content:""; position:absolute; left:5px; top:-3px; width:6px; height:6px; border-radius:50%; background:var(--an2); }
.anx .an-chart { position:relative; }
.anx .an-svg { width:100%; height:auto; display:block; }
.anx .an-svg .grid { stroke:var(--an-track); stroke-width:1; } .anx .an-svg .grid.base { stroke:var(--line); }
.anx .an-svg .ax { font-size:11px; fill:var(--muted); font-family:inherit; }
.anx .an-svg .col { fill:var(--an1); opacity:.85; }
.anx .an-svg .an-wash-a { stop-color:var(--an2); stop-opacity:.16; } .anx .an-svg .an-wash-b { stop-color:var(--an2); stop-opacity:0; }
.anx .an-svg .wash { fill:url(#anWash); }
.anx .an-svg .line { fill:none; stroke:var(--an2); stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.anx .an-svg .dot { fill:var(--an2); stroke:var(--panel); stroke-width:2; }
.anx .an-svg .cross { stroke:var(--muted); stroke-width:1; }
.anx .an-svg .hit { fill:transparent; cursor:crosshair; } .anx .an-svg .hit:hover { fill:var(--soft); }
.anx .an-tip { position:absolute; top:6px; transform:translateX(-50%); background:#0f172a; color:#fff; border-radius:10px; padding:8px 12px; font-size:.8rem; pointer-events:none; display:flex; flex-direction:column; gap:3px; box-shadow:0 8px 24px rgba(15,23,42,.25); white-space:nowrap; z-index:2; }
.anx .an-tip[hidden] { display:none; }
.anx .an-empty { display:flex; flex-direction:column; align-items:center; text-align:center; gap:4px; padding:40px 20px; color:var(--muted); }
.anx .an-empty .bi { font-size:2rem; } .anx .an-empty b { color:var(--text); } .anx .an-empty p { margin:0; font-size:.86rem; }
.anx .an-empty-s { color:var(--muted); text-align:center; padding:18px 8px; margin:0; font-size:.88rem; }
.anx .an-barlist { list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.anx .bl-row { display:flex; justify-content:space-between; gap:10px; align-items:baseline; font-size:.88rem; }
.anx .bl-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.anx .bl-num { font-weight:600; white-space:nowrap; } .anx .bl-num small { font-weight:400; color:var(--muted); margin-left:4px; }
.anx .bl-track { height:6px; background:var(--an-track); border-radius:99px; margin-top:5px; overflow:hidden; }
.anx .bl-track span { display:block; height:100%; background:var(--an1); border-radius:99px; }
.anx .an-minibar { height:4px; background:var(--an-track); border-radius:3px; margin:6px 0 2px; width:160px; max-width:100%; }
.anx .an-minibar span { display:block; height:100%; background:var(--an1); border-radius:3px; }
.anx .an-segbar { display:flex; gap:2px; height:14px; border-radius:7px; overflow:hidden; margin:2px 0 12px; }
.anx .an-segbar span { min-width:4px; }
.anx .an-seglegend { list-style:none; margin:0; padding:0; display:grid; gap:7px; }
.anx .an-seglegend li { display:grid; grid-template-columns:12px 1fr auto 42px; gap:8px; align-items:center; font-size:.88rem; }
.anx .an-seglegend i:first-child { width:10px; height:10px; border-radius:3px; }
.anx .an-seglegend small { color:var(--muted); text-align:right; }
.anx .an-heat { display:grid; gap:3px; overflow-x:auto; }
.anx .heat-row { display:grid; grid-template-columns:34px repeat(24, minmax(11px,1fr)); gap:3px; align-items:center; }
.anx .heat-head span { font-size:.66rem; color:var(--muted); }
.anx .heat-day { font-size:.72rem; color:var(--muted); font-weight:600; }
.anx .heat-cell { height:20px; border-radius:4px; background:color-mix(in srgb, var(--an1) calc(var(--a) * 100%), var(--an-track)); }
.anx .an-table th { font-size:.74rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); font-weight:600; white-space:nowrap; }
@media (max-width: 1100px) { .anx .an-hero { grid-template-columns:repeat(2,1fr); } .anx .an-mini { grid-template-columns:repeat(3,1fr); } .anx .an-grid3 { grid-template-columns:1fr 1fr; } }
@media (max-width: 760px) { .anx .an-grid2, .anx .an-grid3 { grid-template-columns:1fr; } .anx .an-mini { grid-template-columns:1fr 1fr; } .anx .an-mini > div { border-left:0; border-top:1px solid var(--line); } }
@media (max-width: 520px) { .anx .an-hero { grid-template-columns:1fr; } }

/* ---------- Clinic ---------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.hint { color: var(--muted); font-size: .8rem; }
.min-w-0 { min-width: 0; }
.dl-tight dt, .dl-tight dd { margin-bottom: .25rem; }
.dl-tight dt { font-weight: 500; color: var(--muted); }

/* doctor avatars and cards */
.doc-av { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: .78rem; font-weight: 600; color: #fff;
  background: var(--dc, var(--info)); overflow: hidden; }
.doc-av.has-img { background: var(--line); }
.doc-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-av-lg { width: 64px; height: 64px; font-size: 1.1rem; }
.doc-card { display: flex; gap: .9rem; align-items: flex-start; height: 100%; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--dc, var(--info));
  border-radius: 12px; padding: 1rem; color: var(--text); text-decoration: none; transition: .2s; }
.doc-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .1); color: var(--text); }
.doc-card.inactive { opacity: .65; }
.doc-card .pill { color: var(--text); background: var(--soft); }
.doc-card .pill.act { color: #fff; background: var(--accent); }

/* clinic type cards (Clinic Setup) */
.type-card { display: flex; flex-direction: column; gap: .4rem; border: 2px solid var(--line); border-radius: 14px; padding: 1rem 1rem 1rem 2.6rem; position: relative; cursor: pointer; background: var(--panel); transition: .15s; }
.type-card > input { position: absolute; left: 1rem; top: 1.2rem; }
.type-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.tc-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }

/* day board: a column per doctor */
.appt-board { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(240px, 1fr)); gap: .8rem; overflow-x: auto; padding-bottom: .4rem; }
.appt-col { background: var(--soft); border-radius: 12px; padding: .5rem; min-width: 220px; display: flex; flex-direction: column; gap: .35rem; }
.appt-colhead { display: flex; gap: .6rem; align-items: center; padding: .35rem .3rem .55rem; border-bottom: 3px solid var(--dc, var(--info)); margin-bottom: .2rem; }
.appt-off { font-size: .82rem; color: var(--muted); text-align: center; padding: 1rem .5rem; border: 1px dashed var(--line); border-radius: 10px; }
.appt-card { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; align-items: center; padding: .45rem .55rem; border-radius: 10px; background: var(--panel);
  border: 1px solid var(--line); border-left: 4px solid var(--c, var(--neutral)); color: var(--text); text-decoration: none; font-size: .84rem; }
.appt-card:hover { color: var(--text); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.appt-card.on { outline: 2px solid var(--hl); }
.appt-card.st-requested { --c: #d39e00; background: color-mix(in srgb, #d39e00 9%, var(--panel)); } .appt-card.st-confirmed { --c: #2f6fb0; }
.appt-card.st-arrived, .appt-card.st-in_progress { --c: #7c4dbd; } .appt-card.st-done { --c: #2e8b57; opacity: .8; }
.appt-card.st-cancelled, .appt-card.st-no_show { --c: #8a96a3; opacity: .55; }
.ac-time { font-weight: 600; font-size: .78rem; white-space: nowrap; display: flex; flex-direction: column; line-height: 1.15; }
.ac-time i { font-style: normal; font-size: .7rem; color: #7c4dbd; }
.ac-body { min-width: 0; } .ac-body b, .ac-body small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-body small { color: var(--muted); font-size: .74rem; }
.ac-time { grid-row: span 2; align-self: start; }
.ac-st { grid-column: 2; line-height: 1; }
.ac-st .badge { font-size: .64rem; }
.appt-free { display: flex; justify-content: space-between; align-items: center; padding: .3rem .55rem; border-radius: 9px; border: 1px dashed var(--line);
  font-size: .78rem; color: var(--muted); text-decoration: none; }
a.appt-free:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.appt-panel { position: sticky; top: 1rem; }
.queue-no { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 6px; border-radius: 8px; font-size: .8rem; background: color-mix(in srgb, #7c4dbd 15%, var(--panel)); color: #7c4dbd; flex: none; }
[data-bs-theme="dark"] .queue-no { color: #c9b3f0; }

/* time picker (appointment form) */
.slot-pick { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 38px; align-items: center; }
.slot-pick .slot { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: .3rem .6rem; font-size: .82rem; cursor: pointer; }
.slot-pick .slot:hover { border-color: var(--accent); }
.slot-pick .slot.on { background: var(--accent); color: var(--ona); border-color: var(--accent); }
.slot-pick .slot.busy, .slot-pick .slot:disabled { opacity: .45; text-decoration: line-through; cursor: not-allowed; }

/* patient header */
.pat-av { background: var(--accent); color: var(--ona); }
.pat-alerts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.pa { font-size: .84rem; padding: .35rem .7rem; border-radius: 9px; background: var(--soft); display: flex; gap: .4rem; align-items: center; }
.pa.allergy { background: color-mix(in srgb, var(--danger) 13%, var(--panel)); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
[data-bs-theme="dark"] .pa.allergy { color: #f3a49b; }

/* consultation form */
.vitals .form-control { text-align: center; }
.vitals .form-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .2rem; }
.rep-row, .sched-row { align-items: center; }

/* dental chart */
.dchart-set { overflow-x: auto; padding-bottom: .3rem; }
.dchart-set.kid { margin-top: .8rem; }
.dchart-row { display: flex; justify-content: center; gap: 14px; }
.dchart-row.lower { margin-top: 6px; padding-top: 6px; border-top: 2px solid var(--line); }
.dchart-q { display: flex; gap: 4px; }
.dchart-q.r { padding-right: 14px; border-right: 2px solid var(--line); }
.tooth { width: 34px; height: 42px; border-radius: 9px 9px 12px 12px; border: 1.5px solid color-mix(in srgb, var(--text) 30%, transparent); background: var(--tc, #fff);
  display: grid; place-items: end center; padding: 0 0 3px; font-size: .66rem; font-weight: 600; color: #1f2d3a; cursor: default; flex: none; }
.dchart-row.lower .tooth { border-radius: 12px 12px 9px 9px; place-items: start center; padding: 3px 0 0; }
.tooth span { background: rgba(255, 255, 255, .8); border-radius: 4px; padding: 0 2px; }
.dchart[data-editable="1"] .tooth { cursor: pointer; }
.dchart[data-editable="1"] .tooth:hover, .tooth.sel { outline: 3px solid var(--hl); outline-offset: 1px; }
.tooth.c-missing { opacity: .55; background-image: linear-gradient(45deg, transparent 46%, #555 46%, #555 54%, transparent 54%); }
.dchart-key { display: flex; flex-wrap: wrap; gap: .4rem .9rem; justify-content: center; margin-top: .8rem; font-size: .76rem; color: var(--muted); }
.dchart-key i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); margin-right: 4px; vertical-align: -2px; }
@media (max-width: 575.98px) { .tooth { width: 26px; height: 34px; font-size: .58rem; } .dchart-row { gap: 8px; } .dchart-q.r { padding-right: 8px; } .dchart-q { gap: 2px; } }

/* service icon picker */
.icon-pick { display: flex; flex-wrap: wrap; gap: .3rem; }
.icon-pick label { cursor: pointer; margin: 0; }
.icon-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icon-pick i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); font-size: 1.1rem; color: var(--muted); background: var(--panel); }
.icon-pick input:checked + i { background: var(--accent); color: var(--ona); border-color: var(--accent); }
.icon-pick input:focus-visible + i { outline: 2px solid var(--hl); }

/* bill lines */
.ln-medicine td:first-child { color: var(--accent); }
