/* AHMIS dark mode: html[data-theme=dark], switched by theme.js. Screen only; printing stays light.
   Bootstrap 5.3 components follow data-bs-theme; this file darkens AHMIS's own surfaces and glass. */
@media screen{
html[data-theme=dark]{--navy:#0b1626;--navy2:#16263d;--ink:#e6edf6;--muted:#a3b2c6;--line:#2a3b53;--bg:#0b1220;
  --bs-body-bg:#0b1220;--bs-body-color:#e6edf6;--bs-secondary-color:#a3b2c6;--bs-border-color:#2c3d55;--bs-tertiary-bg:#121c2d}
html[data-theme=dark] body{background:#0b1220;color:#e6edf6}
html[data-theme=dark] body.spatial-app{
  --ink:#e6edf6;--glass:rgba(19,29,46,.74);--glass-line:rgba(255,255,255,.09);
  --sp-shadow:0 26px 54px -24px rgba(0,0,0,.7),0 8px 20px -10px rgba(0,0,0,.45);
  background:radial-gradient(42vmax 42vmax at 82% 6%,rgba(110,80,200,.22),transparent 70%),
    linear-gradient(135deg,#08121f 0%,#0d1428 55%,#160f22 100%) fixed}
html[data-theme=dark] body.spatial-app::before{background:rgba(20,140,140,.28)}
html[data-theme=dark] body.spatial-app::after{background:rgba(70,90,200,.26)}
html[data-theme=dark] .spatial-app{--ink:#e6edf6;--glass:rgba(19,29,46,.74);--glass-line:rgba(255,255,255,.09)}

/* surfaces */
html[data-theme=dark] :is(.topbar,.panel,.card,.stat-card,.kpi-card,.dashboard-panel,.mini-stat,.hero-card,.q-card,.order-row,.plan-card,
  .claim-stat,.manual-box,.cam-box,.receipt,.pc-msg,.login-card,.user-menu-panel,.modal-content,.offcanvas,.accordion-item,.list-group,
  .table-responsive,.form-section,.dropdown-menu,.ux-palette,.ux-dialog,.popover){
  background-color:var(--glass,#131d2e)!important;border-color:rgba(255,255,255,.09)!important;color:#e6edf6}
html[data-theme=dark] .spatial-app .topbar,html[data-theme=dark] .spatial-app .content .card,html[data-theme=dark] .spatial-app .content .panel,
html[data-theme=dark] .spatial-app .kpi-card,html[data-theme=dark] .spatial-app .dashboard-panel{box-shadow:var(--sp-shadow),inset 0 1px 0 rgba(255,255,255,.06)!important}
html[data-theme=dark] .user-menu-panel,html[data-theme=dark] .dropdown-menu,html[data-theme=dark] .ux-palette{background-color:#142034!important}
html[data-theme=dark] :is(.locale-chip,.clock-chip,.date-pill,.id-tag){background:rgba(255,255,255,.06)!important;border-color:rgba(255,255,255,.12)!important;color:#dfe8f3}
html[data-theme=dark] :is(h1,h2,h3,h4,h5,h6,.spatial-app .content h1,.spatial-app .content h2,.spatial-app .content h3,.spatial-app .content h4,.spatial-app .content h5){color:#eef3fa}
html[data-theme=dark] :is(.text-muted,.small.text-muted,.form-text,.kpi-card>small,.section-heading p,.revenue-head small,.stat-label,.welcome p,.panel-head p){color:#a9b8cc!important}
html[data-theme=dark] .eyebrow{color:#5fd0d4}
html[data-theme=dark] a:not(.btn):not(.kpi-card){color:#6fd3d8}
html[data-theme=dark] .sidebar nav a,html[data-theme=dark] .sidebar a{color:#eaf1f8}

/* tables and forms */
html[data-theme=dark] .table{--bs-table-bg:transparent;--bs-table-color:#e6edf6;--bs-table-striped-bg:rgba(255,255,255,.03);--bs-table-hover-bg:rgba(255,255,255,.05);color:#e6edf6}
html[data-theme=dark] .table thead th{color:#a9b8cc;background:rgba(255,255,255,.04)}
html[data-theme=dark] .table td,html[data-theme=dark] .table th{border-color:rgba(255,255,255,.08)}
html[data-theme=dark] :is(.form-control,.form-select,input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),textarea,select){
  background-color:#0f1828;color:#e6edf6;border-color:#33465f}
html[data-theme=dark] :is(.form-control,.form-select,input,textarea,select):focus{background-color:#122036;border-color:#2bb3b8;color:#fff}
html[data-theme=dark] ::placeholder{color:#7f90a6}
html[data-theme=dark] .form-control:disabled,html[data-theme=dark] .form-control[readonly]{background-color:#162236;color:#b8c5d6}
html[data-theme=dark] .btn-light{background:#1b2940;border-color:#2c3d55;color:#e6edf6}
html[data-theme=dark] .btn-outline-primary{color:#6fd3d8;border-color:#2a8f94}
html[data-theme=dark] .btn-outline-secondary{color:#c6d2e1;border-color:#4a5d78}
html[data-theme=dark] kbd{background:#24344d;color:#e6edf6}
html[data-theme=dark] hr{border-color:rgba(255,255,255,.12)}

/* status colours stay readable on dark */
html[data-theme=dark] .alert-success{background:rgba(25,135,84,.18)!important;color:#9fe3c0;border-color:rgba(25,135,84,.4)!important}
html[data-theme=dark] .alert-danger{background:rgba(220,53,69,.16)!important;color:#ffb3bb;border-color:rgba(220,53,69,.4)!important}
html[data-theme=dark] .alert-warning{background:rgba(255,193,7,.14)!important;color:#ffe08a;border-color:rgba(255,193,7,.35)!important}
html[data-theme=dark] .alert-info{background:rgba(13,202,240,.12)!important;color:#9ee6f7;border-color:rgba(13,202,240,.3)!important}
html[data-theme=dark] :is(.urgent,.bed-cleaning,.status-unpaid,.status-closed,.sub-past_due,.sub-pill-past_due,.pay-override,.clear-owing){filter:brightness(.82) saturate(1.1)}
html[data-theme=dark] .donut-hole{background:#131d2e!important;color:#e6edf6}
html[data-theme=dark] .kpi-icon{background:rgba(255,255,255,.08)!important}

/* pictures that are mostly white get a soft edge instead of glaring */
html[data-theme=dark] img.brand-logo,html[data-theme=dark] img.welcome-logo{background:#e9eef4!important}
}

/* the light/dark button */
.theme-toggle{display:inline-flex;align-items:center;gap:6px;border:1px solid rgba(16,32,58,.18);background:rgba(255,255,255,.7);color:#10203a;
  border-radius:999px;padding:5px 11px;font-size:13px;font-weight:700;cursor:pointer;line-height:1.2}
.theme-toggle .tt-icon{font-size:15px}
.theme-toggle:hover{border-color:#0c8b91}
html[data-theme=dark] .theme-toggle{background:rgba(255,255,255,.07);border-color:rgba(255,255,255,.18);color:#f4f8fc}
@media(max-width:700px){.theme-toggle .tt-text{display:none}}
@media print{.theme-toggle{display:none!important}}

/* sign-in page */
.sp-theme{position:absolute;top:16px;right:16px;z-index:5}
@media screen{
html[data-theme=dark] .sp-stage{--ink:#e6edf6;--muted:#aab9cd;--teal:#4cc9ce;--danger:#ff9b93;
  background:linear-gradient(135deg,#08121f 0%,#0d1428 55%,#160f22 100%)}
html[data-theme=dark] .sp-orb{opacity:.42}
html[data-theme=dark] .sp-card::before,html[data-theme=dark] .sp-card::after{background:rgba(22,33,52,.45);border-color:rgba(255,255,255,.08);box-shadow:0 30px 60px -24px rgba(0,0,0,.6)}
html[data-theme=dark] .sp-glass{background:linear-gradient(160deg,rgba(24,36,57,.9),rgba(15,24,40,.82))!important;border-color:rgba(255,255,255,.1)!important;box-shadow:0 40px 80px -30px rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.08)!important}
html[data-theme=dark] .sp-input,html[data-theme=dark] .sp-control{background:#0f1828!important;color:#e6edf6!important;border-color:#33465f!important}
html[data-theme=dark] .sp-switch{background:rgba(255,255,255,.06)!important}
html[data-theme=dark] .sp-switch a{color:#cfd9e6}
html[data-theme=dark] .sp-switch a.is-on{background:rgba(76,201,206,.18)!important;color:#fff}
html[data-theme=dark] .sp-foot,html[data-theme=dark] .sp-sub,html[data-theme=dark] .sp-label,html[data-theme=dark] .sp-check-label{color:#b9c6d6}
html[data-theme=dark] .sp-foot a{color:#6fd3d8}
html[data-theme=dark] .sp-brand small{color:#aab9cd}
}
.theme-toggle{white-space:nowrap}
@media screen{html[data-theme=dark] .sp-check-input{background-color:#0f1828!important;border-color:#5b6f8a!important}}

/* language switch (user menu and sign-in page) */
.lang-switch{display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:4px 9px}
.lang-switch span{font-size:13px;color:var(--muted,#566478);margin-right:4px}
.lang-switch button{border:1px solid rgba(16,32,58,.18);background:transparent;border-radius:999px;padding:3px 10px;font-size:13px;font-weight:700;color:inherit;cursor:pointer}
.lang-switch button.on{background:#0c8b91;border-color:#0c8b91;color:#fff}
.sp-lang{position:absolute;top:16px;right:150px;z-index:5;background:rgba(255,255,255,.7);border-radius:999px;border:1px solid rgba(16,32,58,.18)}
html[data-theme=dark] .sp-lang{background:rgba(255,255,255,.07);border-color:rgba(255,255,255,.18)}
html[data-theme=dark] .lang-switch button{border-color:rgba(255,255,255,.2)}
@media(max-width:700px){.sp-lang{right:70px}}
@media print{.lang-switch{display:none!important}}

/* skip link: hidden until focused with the keyboard (also on pages without Bootstrap) */
.visually-hidden-focusable:not(:focus):not(:focus-within){position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}

/* top bar: keep the page title readable when the right-hand tools are wide (longer French labels) */
.topbar{flex-wrap:wrap;row-gap:10px}
.topbar-left{flex:1 1 200px;min-width:180px}
.topbar-left h5{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-right{flex-wrap:wrap;justify-content:flex-end;row-gap:8px}
