/* 
 Author: Suvamoy Sarkar
 Company: Centcept Technologies
 License: Protected by Centcept
 Website: https://centcept.com
*/
:root{
  --bg:#f5f7fb;--card:#ffffff;--text:#1f2937;--muted:#6b7280;
  --primary:#4f46e5;--primary-600:#4338ca;--success:#10b981;--warning:#f59e0b;--danger:#ef4444;
  /* UI tokens */
  --border-color:#e5e7eb; /* light gray borders */
  --bg-elevated:#ffffff;  /* elevated panel background */
  --text-muted:#6b7280;   /* secondary text color */
}
/* Dark theme variables */
[data-theme="dark"]{
  --bg:#0b1220;--card:#0f172a;--text:#e5e7eb;--muted:#94a3b8;
  --primary:#7c3aed;--primary-600:#6d28d9;--success:#34d399;--warning:#fbbf24;--danger:#f87171;
  --border-color:#334155; /* dark mode border */
  --bg-elevated:#0f172a;  /* elevated panel background */
  --text-muted:#94a3b8;   /* secondary text color */
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial}
/* Constrain app to viewport width */
html, body{width:100vw;max-width:100vw;overflow-x:hidden}
.layout{width:100%;max-width:100vw}
a{color:var(--primary);text-decoration:none}
.layout{display:flex;min-height:100vh}
.sidebar{width:260px;position:fixed;left:0;top:0;bottom:0;height:100vh;overflow-y:auto;color:#e5e7eb;z-index:100;
  background:linear-gradient(180deg, rgba(79,70,229,.15), rgba(20,184,166,.12)),
             linear-gradient(135deg, #0f172a 0%, #0b1220 60%);
  border-right:1px solid #1f2937; box-shadow:inset -1px 0 0 rgba(255,255,255,.03);
  backdrop-filter:saturate(120%) blur(8px);
}
.sidebar{scrollbar-width:none; -ms-overflow-style:none}
.sidebar::-webkit-scrollbar{width:0;height:0;display:none}
.sidebar{transition:left .25s ease,width .2s ease, box-shadow .2s ease}
.sidebar::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:linear-gradient(180deg,#7c3aed,#22c55e,#f59e0b);opacity:.8}
.sidebar .logo{display:flex;align-items:center;gap:10px;padding:16px 18px;font-weight:600;border-bottom:1px solid #1f2937}
.nav{padding:8px 10px;}
.nav a{display:flex;align-items:center;gap:10px;margin:6px 6px;border-radius:12px;padding:10px 12px;color:#cbd5e1;position:relative;overflow:hidden}
.nav a::after{content:"";position:absolute;left:var(--ripple-x,50%);top:var(--ripple-y,50%);width:8px;height:8px;background:currentColor;border-radius:50%;transform:translate(-50%,-50%) scale(0);opacity:.15;pointer-events:none}
.nav a:active::after{animation:ripple .5s ease-out}
.nav a:hover{background:rgba(255,255,255,.05);color:#fff}
.nav a.active{background:linear-gradient(90deg, rgba(124,58,237,.25), rgba(34,197,94,.15));color:#fff;box-shadow:0 8px 24px rgba(124,58,237,.15)}
.nav a.active::before{content:"";position:absolute;left:-6px;top:8px;bottom:8px;width:6px;border-radius:8px;background:linear-gradient(180deg,#7c3aed,#22c55e)}
.nav .nav-toggle{display:flex;align-items:center;gap:10px;margin:6px 6px;border-radius:12px;padding:10px 12px;color:#cbd5e1;background:transparent;border:none;width:calc(100% - 12px);cursor:pointer;position:relative;text-align:left}
.nav .nav-toggle:hover{background:rgba(255,255,255,.05);color:#fff}
.nav .nav-toggle.active{background:linear-gradient(90deg, rgba(124,58,237,.25), rgba(34,197,94,.15));color:#fff;box-shadow:0 8px 24px rgba(124,58,237,.15)}
.nav .nav-toggle .caret{margin-left:auto;transition:transform .2s ease}
.nav .nav-toggle[aria-expanded="true"] .caret{transform:rotate(180deg)}
.submenu{display:none;margin:4px 14px 8px 26px;padding-left:8px;border-left:1px dashed #334155}
.submenu.open{display:block}
.submenu a{display:flex;align-items:center;gap:8px;margin:6px 0;border-radius:10px;padding:8px 10px;color:#cbd5e1}
.submenu a::before{content:"›";display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:6px;background:rgba(255,255,255,.06);color:#fff;flex:none}
.submenu a:hover{background:rgba(255,255,255,.05);color:#fff}
.nav-section{margin:10px 14px;color:var(--muted);font-size:12px;letter-spacing:.08em;text-transform:uppercase;border-top:1px dashed #334155;padding-top:8px}
.sidebar-footer{margin:12px;display:flex;align-items:center;gap:10px;padding:12px;background:rgba(255,255,255,.06);border:1px solid #334155;border-radius:14px}
.sf-avatar{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:linear-gradient(135deg,#7c3aed,#22c55e);color:#fff;font-weight:700}
.sf-info .sf-name{font-weight:600}
.sf-info .sf-role{font-size:12px;color:#94a3b8}
.content{flex:1;display:flex;flex-direction:column;min-height:100vh;margin-left:260px;height:auto;overflow:visible}
.topbar{display:grid;grid-template-columns:min-content 1fr;align-items:center;padding:12px 18px;background:linear-gradient(135deg, rgba(124,58,237,.12), rgba(34,197,94,.08)), var(--card);border-bottom:0;position:sticky;top:0;z-index:80;backdrop-filter:saturate(120%) blur(6px);box-shadow:0 10px 30px rgba(2,6,23,.06)}
.topbar{width:100%;max-width:100vw;overflow-x:hidden;padding-top:calc(env(safe-area-inset-top) + 12px)}
.topbar::after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:linear-gradient(90deg,#7c3aed,#22c55e,#f59e0b);opacity:.65}
.top-actions{display:flex;align-items:center;gap:12px}
.top-actions .toolbar{display:flex;gap:8px;align-items:center;position:relative}
.top-actions .profile{margin-left:auto;position:relative}
.top-actions .btn{min-width:auto; justify-content:center}
.search-wrap{position:relative;max-width:520px;width:100%}
.search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:#6b7280}
.search-input{width:100%;height:36px;padding:8px 12px 8px 36px;border:1px solid #e5e7eb;border-radius:9999px;background:rgba(255,255,255,.85);color:var(--text);backdrop-filter:saturate(120%) blur(6px)}
.search-input::placeholder{color:#9ca3af}
.search-input:focus{outline:2px solid rgba(124,58,237,.25)}
/* Utility: hide small labels on phones */
.hide-sm{display:inline}
/* Global search dropdown */
.search-results{position:absolute;top:calc(100% + 6px);left:0;min-width:320px;max-width:480px;background:var(--card);border:1px solid #e5e7eb;border-radius:14px;box-shadow:0 18px 40px rgba(0,0,0,.2);z-index:90;overflow:hidden}
.sr-item{display:flex;align-items:flex-start;gap:10px;padding:10px;cursor:pointer;border-bottom:1px solid #eef2f7}
.sr-item:last-child{border-bottom:none}
.sr-item:hover{background:#f3f4f6}
.sr-item.active{background:#eef2ff}
.sr-type{display:inline-block;font-size:12px;color:#6b7280;background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;padding:2px 8px;min-width:72px;text-align:center}
.sr-text{flex:1}
.sr-title{font-weight:600}
.sr-sub{color:#6b7280;font-size:12px;margin-top:2px}
.sr-empty{padding:10px;color:#6b7280}
.sr-footer{padding:8px 10px;background:#f9fafb;text-align:right}
.sr-footer a{color:var(--primary);font-weight:600}
.toolbar .menu-anchor{position:relative}
.toolbar-menu{position:absolute;right:0;top:calc(100% + 8px);min-width:220px;background:#fff;border:1px solid #e5e7eb;border-radius:14px;box-shadow:0 18px 40px rgba(0,0,0,.2);padding:8px;display:none;z-index:1000}
.toolbar-menu.open{display:block}
.toolbar-menu.simple{min-width:240px}
.toolbar-menu.simple a{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:10px;color:#1f2937;text-decoration:none}
.toolbar-menu.simple a:hover{background:#f3f4f6}
.top-actions .profile{position:relative}
.avatar-circle{width:24px;height:24px;border-radius:8px;display:grid;place-items:center;background:linear-gradient(135deg,#7c3aed,#22c55e);color:#fff;font-size:12px;font-weight:700}
.profile-btn{display:flex;align-items:center;gap:8px}
.profile-menu{position:absolute;right:0;top:calc(100% + 8px);min-width:220px;background:#fff;border:1px solid #e5e7eb;border-radius:14px;box-shadow:0 18px 40px rgba(0,0,0,.2);padding:8px;display:none;z-index:1000}
.profile-menu.open{display:block}
.profile-menu a{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:10px;color:#1f2937}
.profile-menu a:hover{background:#f3f4f6}
.profile-menu a.danger{color:#ef4444}
.pm-header{display:flex;align-items:center;gap:10px;padding:8px 10px}
.pm-avatar{width:28px;height:28px;border-radius:10px;display:grid;place-items:center;background:linear-gradient(135deg,#7c3aed,#22c55e);color:#fff;font-weight:700}
.pm-info .pm-name{font-weight:600}
.pm-info .pm-role{font-size:12px;color:#6b7280}
.pm-divider{height:1px;background:#e5e7eb;margin:6px 4px}
.container{padding:18px;flex:1}
.content{background:radial-gradient(1200px 400px at 100% -100%, rgba(124,58,237,.08), transparent),radial-gradient(900px 300px at -20% 0%, rgba(34,197,94,.06), transparent)}
.site-footer{margin-top:18px;padding:16px 18px;background:linear-gradient(135deg, rgba(124,58,237,.08), rgba(34,197,94,.06)), var(--card);color:var(--muted);position:relative;backdrop-filter:saturate(120%) blur(6px);box-shadow:0 -10px 30px rgba(2,6,23,.06)}
.site-footer::before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:linear-gradient(90deg,#7c3aed,#22c55e,#f59e0b);opacity:.65}
.site-footer .footer-content{display:flex;justify-content:center;align-items:center;gap:10px;font-size:13px}
.site-footer .footer-content span{letter-spacing:.02em}
.site-footer .footer-content a{color:var(--primary);text-decoration:none}
.site-footer .footer-content a:hover{text-decoration:underline}
.card{background:var(--card);border:1px solid #e5e7eb;border-radius:14px;padding:16px;box-shadow:0 6px 28px rgba(2,6,23,.06)}
.card:hover{box-shadow:0 10px 34px rgba(2,6,23,.09);transform:translateY(-1px)}
.dashboard-hero{background:linear-gradient(135deg, rgba(124,58,237,.18), rgba(34,197,94,.12)); border-color:#c7d2fe}
.dashboard-hero .row{align-items:center}
.dashboard-hero h3, .dashboard-hero h2{margin:0}
/* Dashboard controls layout */
.dash-controls{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch}
.dash-controls .ctrl-group{display:flex;align-items:center;gap:10px;flex-wrap:nowrap}
.dash-controls .btn{min-width:auto;padding-block:8px;padding-inline:18px}
.dash-controls .input{height:34px;flex:0 1 280px}
.dash-controls label{display:flex;align-items:center;gap:6px;white-space:nowrap}
.section-controls{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch}
.section-controls .ctrl-group{display:flex;align-items:center;gap:8px;flex-wrap:nowrap}
.section-controls h3,h4{margin:0}
.section-controls .btn{min-width:auto;padding-block:8px;padding-inline:18px}
.section-controls .input{height:34px;flex:0 1 280px}
.grid{display:grid;gap:16px;grid-template-columns:repeat(4,minmax(0,1fr))}
/* Two-column grid utility for pages like Settings */
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.card{background:var(--card);border:1px solid #e5e7eb;border-radius:12px;padding:16px}
.metric{display:flex;justify-content:space-between;align-items:center}
.badge{font-size:24px;font-weight:700}
.btn{display:inline-flex;align-items:center;gap:8px;padding-block:12px;padding-inline:18px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:var(--text);cursor:pointer;white-space:nowrap;max-width:100%;text-overflow:ellipsis;overflow:hidden}
.btn{position:relative;overflow:hidden;transition:transform .05s ease}
.btn svg{flex:none}

/* Consistent widths for content-level buttons (avoids oversized topbar controls) */
.container .btn,
.card .btn,
.table .btn,
.pagination .btn,
.modal .dialog .actions .btn{
  min-width:auto;
  justify-content:center;
}
.btn::after{content:"";position:absolute;left:var(--ripple-x,50%);top:var(--ripple-y,50%);width:8px;height:8px;background:currentColor;border-radius:50%;transform:translate(-50%,-50%) scale(0);opacity:.15;pointer-events:none}
.btn:active::after{animation:ripple .5s ease-out}
@keyframes ripple{to{transform:translate(-50%,-50%) scale(18);opacity:0}}
.btn.primary{background:var(--primary);color:#fff;border-color:var(--primary)}
.btn.soft:hover{background:#eef2ff;border-color:#c7d2fe;color:#111827}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:10px;border-bottom:1px solid #eef2f7;text-align:left}

/* Reusable filter bar for tables */
.table-filters{display:flex;align-items:center;gap:10px;flex-wrap:nowrap;margin:8px 0 12px;padding:10px 12px;border:1px solid var(--border-color);border-radius:12px;background:var(--bg-elevated);overflow-x:auto;-webkit-overflow-scrolling:touch}
.table-filters .tf-group{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;flex:1 1 auto}
.table-filters .tf-input{height:34px;padding:6px 10px;line-height:20px}
.table-filters .tf-select{height:34px;padding:6px 10px;line-height:20px}
.table-filters .input{box-sizing:border-box;font-size:14px}
.table-filters input[type="date"].input{padding:6px 10px;line-height:20px}
.table-filters .date-range{display:flex;align-items:center;gap:6px}
.table-filters .date-range .sep{color:var(--text-muted)}
.table-filters .tf-buttons{display:flex;align-items:center;gap:8px;margin-left:auto;flex:0 0 auto}

/* Column sorting indicators */
.table th.sortable{cursor:pointer;user-select:none;white-space:nowrap}
.table th.sort-asc::after{content:" \25B2";font-size:12px;margin-left:6px;color:var(--text-muted)}
.table th.sort-desc::after{content:" \25BC";font-size:12px;margin-left:6px;color:var(--text-muted)}

/* Prevent horizontal overflow across inner pages */
img,canvas,svg,video{max-width:100%;height:auto}
pre,code{white-space:pre-wrap;word-break:break-word}
.grid, .row, .card, .table, .container, .content{min-width:0}
.topbar, .site-footer{max-width:100vw}
.search-results, .toolbar-menu, .profile-menu{max-width:96vw}

/* Responsive breakpoints */
@media (max-width:1200px){
  .grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:900px){
  .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:640px){
  .grid{grid-template-columns:repeat(1,minmax(0,1fr))}
}

/* Mobile-first app behavior */
@media (max-width:980px){
  .sidebar{left:-260px;width:240px;z-index:100}
  .sidebar.open{left:0}
  .content{margin-left:0;max-width:100vw;overflow-x:hidden}
  /* Backdrop overlay shown when sidebar is open */
  .sidebar-backdrop{position:fixed;inset:0;background:rgba(2,6,23,.45);backdrop-filter:saturate(120%) blur(2px);display:none;z-index:90}
  .sidebar-backdrop.open{display:block}
  body.sidebar-open{overflow:hidden}
  .topbar{grid-template-columns:min-content 1fr;padding:10px 12px;padding-top:calc(env(safe-area-inset-top) + 10px)}
  .topbar{overflow:hidden}
  .top-actions{gap:8px;flex-wrap:wrap}
.top-actions .btn{min-width:auto;padding-block:8px;padding-inline:18px}
  .mobile-nav{display:flex;backdrop-filter:saturate(120%) blur(8px);box-shadow:0 -10px 30px rgba(2,6,23,.12)}
  .fab{display:flex}
  .container{padding:14px;max-width:100vw;overflow-x:hidden}
  .form-grid{grid-template-columns:1fr}
  .table{display:block;overflow-x:auto}
  .search-results, .toolbar-menu{left:8px !important; right:8px !important; max-width:calc(100vw - 16px)}
  .profile-menu{max-width:calc(100vw - 16px)}
  /* Dashboard controls: mobile layout */
  .dash-controls{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;padding:8px 10px;border-radius:12px}
  .dash-controls .ctrl-group{display:flex;align-items:center;gap:8px;flex:0 0 auto}
  .dashboard-hero .row{flex-wrap:nowrap}
.dashboard-hero .btn{min-width:auto;padding-block:8px;padding-inline:18px}
  .dashboard-hero .input{height:32px}
  .hide-sm{display:none}
  /* Section controls: mobile layout */
  .section-controls{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;padding:8px 10px;border-radius:12px}
  .section-controls .ctrl-group{display:flex;align-items:center;gap:8px;flex:0 0 auto}
}

/* Carousel-like section scrolling for cards */
@media (max-width:980px){
  .grid[data-carousel]{
    display:flex;gap:12px;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:8px;scroll-snap-type:x mandatory;
  }
  .grid[data-carousel] .card{flex:0 0 85%;scroll-snap-align:start}
}

/* Dark theme adjustments for modernized topbar elements */
.theme-dark .search-input{background:rgba(17,24,39,.7);border-color:#334155;color:#e5e7eb}
.theme-dark .search-input::placeholder{color:#94a3b8}
.theme-dark .toolbar-menu.simple{background:#0f172a;border-color:#334155}
.theme-dark .toolbar-menu.simple a{color:#e5e7eb}
.theme-dark .toolbar-menu.simple a:hover{background:#111827}
.avatar{width:32px;height:32px;border-radius:6px;object-fit:cover;border:1px solid #e5e7eb;background:#fff}

/* Hide specific sidebar items without removing features */
.sidebar .nav a[href="index.php?page=calendar"],
.sidebar .nav a[href="index.php?page=invoices"]{
  display:none !important;
}
/* Hide in mobile nav if present */
.mobile-nav [data-menu-id="invoices"],
.mobile-nav [data-menu-id="calendar"]{
  display:none !important;
}

/* Chatbot controls */
.bot-controls{display:flex;flex-wrap:nowrap;align-items:center;gap:10px;padding:10px 12px;background:rgba(255,255,255,.6);backdrop-filter:saturate(120%) blur(8px);border-bottom:1px solid #e5e7eb;position:sticky;top:0;z-index:5;border-top-left-radius:16px;border-top-right-radius:16px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}
.bot-controls .ctrl-group{display:flex;align-items:center;gap:6px;flex:0 0 auto}
.bot-controls .ctrl-group label{font-size:12px;color:var(--muted)}
.bot-controls .ctrl-select,.bot-controls .ctrl-input{height:30px;padding:6px 8px;border:1px solid #e5e7eb;border-radius:10px;background:#fff;color:var(--text)}
.bot-controls .ctrl-input[type="date"]{padding:4px 8px}
.bot-controls .date-range .sep{color:var(--muted)}
.bot-controls .ctrl-buttons{display:flex;align-items:center;gap:6px;margin-left:auto;flex:0 0 auto}
.bot-controls .ctrl-btn{min-width:auto;padding:8px 10px;border-radius:10px}

[data-theme="dark"] .bot-controls{background:rgba(17,24,39,.65);border-color:#334155}
[data-theme="dark"] .bot-controls .ctrl-select,[data-theme="dark"] .bot-controls .ctrl-input{background:#0f172a;border-color:#334155;color:#e5e7eb}
.avatar.avatar-lg{width:64px;height:64px;border-radius:12px}
.upload-group{display:flex;align-items:center;gap:12px}
.upload-name{color:var(--muted);font-size:12px}
.upload-name.success{color:var(--success)}
.upload-name.error{color:var(--danger)}
.upload-name.progress{color:var(--primary)}
.btn.soft{background:#f9fafb;color:#1f2937}
.auth-wrap{display:grid;place-items:center;min-height:100vh;background:linear-gradient(120deg,#eef2ff,#f8fafc)}
.auth-card{width:100%;max-width:420px;background:#fff;border:1px solid #e5e7eb;border-radius:16px;padding:22px;box-shadow:0 10px 30px rgba(0,0,0,.06)}
.login-page{position:relative;overflow:hidden;background:radial-gradient(1200px 600px at -10% -10%, #e0e7ff 0%, transparent 60%), radial-gradient(1200px 600px at 110% 110%, #d1fae5 0%, transparent 60%), linear-gradient(120deg,#eef2ff,#f8fafc)}
.login-decor{position:absolute;inset:0;pointer-events:none}
.login-decor .blob{position:absolute;filter:blur(60px);opacity:.35}
.login-decor .b1{width:360px;height:360px;background:#a78bfa;top:-80px;left:-80px;border-radius:50%}
.login-decor .b2{width:360px;height:360px;background:#22c55e;bottom:-80px;right:-80px;border-radius:50%}

/* Reports detail view: hide Export buttons via CSS only (feature intact) */
#btnPdf,
#btnCsv,
#btnXls{
  display:none !important;
}

/* Reports detail: title and controls in a single row, controls right-aligned */
.content[data-page^="reports_"] .page{
  display:grid;
  grid-template-columns:1fr auto;
  align-items:center;
  row-gap:12px;
}
.content[data-page^="reports_"] .page > h1{
  grid-column:1;
  margin:0;
}
.content[data-page^="reports_"] .page > .controls{
  grid-column:2;
  justify-content:flex-end;
}
.content[data-page^="reports_"] .page > .card{
  grid-column:1 / -1;
}
.content[data-page^="reports_"] .page .controls .spacer{display:none}
.login-decor .grid{position:absolute;inset:0;background-image:radial-gradient(circle at 1px 1px, rgba(99,102,241,.08) 1px, transparent 1px);background-size:20px 20px}
.login-card{position:relative;background:rgba(255,255,255,.85);backdrop-filter:blur(10px);border:1px solid rgba(229,231,235,.7);box-shadow:0 20px 50px rgba(2,6,23,.12), 0 2px 8px rgba(2,6,23,.08)}
.login-brand{display:flex;align-items:center;gap:12px;margin-bottom:6px}
.login-brand .brand-logo{width:40px;height:40px;border-radius:10px;object-fit:contain;border:1px solid #e5e7eb;background:#fff}
.brand-text .brand-title{margin:0;font-size:22px}
.brand-text .brand-sub{margin:2px 0 0;color:var(--muted)}
.login-form{display:grid;gap:12px;margin-top:10px}
.input-group{display:flex;align-items:center;gap:8px;border:1px solid #e5e7eb;border-radius:12px;padding:8px 10px;background:#fff}
.input-group .input{border:none;padding:8px 2px}
.input-group .input:focus{outline:none}
.input-group .input-icon{color:#6b7280}
.login-row{display:flex;justify-content:space-between;align-items:center;margin:6px 0 4px}
.muted{color:var(--muted)}
.alert{padding:10px;border-radius:12px;margin-bottom:12px}
.alert.error{background:#fee2e2;color:#b91c1c;border:1px solid #fecaca}
.login-submit{margin-top:6px}
.login-footer{margin-top:14px;text-align:center;font-size:12px}
/* Focus styles */
.input-group:focus-within{border-color:#a78bfa;box-shadow:0 0 0 3px rgba(167,139,250,.2)}
/* Dark theme */
[data-theme="dark"] .login-page{background:radial-gradient(1200px 600px at -10% -10%, #3730a3 0%, transparent 60%), radial-gradient(1200px 600px at 110% 110%, #064e3b 0%, transparent 60%), linear-gradient(120deg,#0f172a,#111827)}
[data-theme="dark"] .login-card{background:rgba(2,6,23,.85);border-color:rgba(51,65,85,.7)}
[data-theme="dark"] .input-group{background:#0f172a;border-color:#334155}
[data-theme="dark"] .input-group .input{background:transparent;color:#e5e7eb}
[data-theme="dark"] .brand-text .brand-title{color:#e5e7eb}
[data-theme="dark"] .brand-text .brand-sub{color:#94a3b8}
[data-theme="dark"] .alert.error{background:#7f1d1d;color:#fecaca;border-color:#fecaca}
.input{width:100%;padding:12px;border:1px solid #e5e7eb;border-radius:10px}
.row{display:flex;gap:10px;align-items:center}
/* Align Theme through Settings group to the right in the top header */
.topbar .top-actions #themeToggle{margin-left:auto}
/* Modal */
.modal-backdrop{position:fixed;inset:0;background:rgba(2,6,23,.55);display:none;z-index:50}
.modal{position:fixed;inset:0;display:none;place-items:center;z-index:60}
.modal.open,.modal-backdrop.open{display:grid}
.modal .dialog{width:100%;max-width:800px;background:#fff;border:1px solid #e5e7eb;border-radius:14px;box-shadow:0 20px 60px rgba(0,0,0,.2);padding:18px;max-height:85vh;display:flex;flex-direction:column}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.form-grid .input{width:100%}
.actions{display:flex;justify-content:flex-end;gap:10px;margin-top:12px}
/* Modal scrollable body and sticky footer */
.modal .dialog > .form-grid{flex:1 1 auto;min-height:0;overflow:auto}
.modal .dialog .actions{position:sticky;bottom:0;background:rgba(255,255,255,.96);backdrop-filter:blur(6px);border-top:1px solid #e5e7eb;padding-top:12px;z-index:1}
/* Tighter spacing inside modals */
.modal .dialog .form-grid{grid-template-columns:180px minmax(0,1fr);column-gap:6px;row-gap:8px}
.modal .dialog .row{gap:8px}
/* Pagination */
.pagination{display:flex;gap:8px;align-items:center;margin-top:12px}
.pagination .btn{padding-block:8px;padding-inline:18px}
/* Mobile bottom navigation */
.mobile-nav{position:fixed;left:0;right:0;bottom:0;background:linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.85));border-top:1px solid #e5e7eb;display:none;z-index:40;padding-bottom:calc(env(safe-area-inset-bottom) + 6px)}
.mobile-nav .nav-row{display:flex;justify-content:space-around;gap:6px;padding:8px 10px}
.mobile-nav a{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px 0;border-radius:12px;color:#6b7280;font-size:12px;transition:background .15s ease, color .15s ease}
.mobile-nav a .icon{font-size:22px}
.mobile-nav a.active{color:var(--primary);background:#eef2ff;box-shadow:0 6px 16px rgba(124,58,237,.12)}
/* Floating Action Button */
.fab{position:fixed;right:16px;bottom:calc(env(safe-area-inset-bottom) + 96px);width:56px;height:56px;border-radius:50%;background:var(--primary);color:#fff;border:none;box-shadow:0 8px 24px rgba(0,0,0,.25);display:none;align-items:center;justify-content:center;z-index:45}
.fab svg{width:24px;height:24px}
.fab.hidden{display:none!important}
/* Plunge Bot toggle */
.bot-btn{position:fixed;right:16px;bottom:16px;width:72px;height:72px;border-radius:50%;background:#111827;color:#fff;border:1px solid #1f2937;box-shadow:0 8px 24px rgba(0,0,0,.25);display:flex;align-items:center;justify-content:center;z-index:44;font-size:30px}
.bot-btn:hover{transform:translateY(-1px)}
/* Bot toggle logo */
.bot-btn .bot-icon{width:40px;height:40px;object-fit:contain;display:block}
/* Bot panel */
.bot-panel{position:fixed;right:16px;bottom:100px;width:480px;max-height:85vh;height:500px;background:rgba(255,255,255,.85);backdrop-filter:blur(10px);border:1px solid rgba(229,231,235,.7);border-radius:16px;box-shadow:0 20px 50px rgba(2,6,23,.18), 0 2px 8px rgba(2,6,23,.08);display:none;flex-direction:column;overflow:auto;z-index:46;transform:translateY(8px);opacity:.98;transition:transform .18s ease, opacity .18s ease}
.bot-panel.open{display:flex;transform:translateY(0);opacity:1}
.bot-header{padding:14px 16px;background:linear-gradient(135deg, rgba(124,58,237,.16), rgba(34,197,94,.12));border-bottom:1px solid rgba(229,231,235,.7);display:flex;align-items:center;gap:12px;border-top-left-radius:16px;border-top-right-radius:16px}
.bot-logo{width:24px;height:24px;object-fit:contain;border-radius:6px}
.bot-title{font-weight:700}
.bot-header{display:flex;align-items:center;gap:8px}
.bot-header .bot-subtitle{margin-right:4px}
.bot-header .bot-new-icon{min-width:auto;display:inline-flex;align-items:center;justify-content:center;width:32px;height:30px;border:none;background:transparent;color:#000;border-radius:9999px;cursor:pointer;flex:0 0 auto;margin-left:auto}
.bot-header .bot-new-icon:hover{color:#000;opacity:0.85}
.bot-header .bot-new-icon:focus-visible{outline:2px solid rgba(0,0,0,0.35);outline-offset:2px}
.bot-subtitle{margin-left:auto;color:var(--muted);font-size:12px}
.bot-close{background:transparent;border:0;color:var(--muted);cursor:pointer;margin-left:8px}
.bot-body{display:flex;flex-direction:column;height:100%}
.bot-messages{padding:12px;overflow:visible;display:flex;flex:1;flex-direction:column;gap:8px;padding-bottom:76px}
.msg{display:flex}
.msg.user{justify-content:flex-end}
.msg.bot{justify-content:flex-start}
.bubble{max-width:80%;padding:12px 14px;border-radius:16px;border:1px solid #e5e7eb;background:linear-gradient(180deg, #fff, #f8fafc);color:var(--text);box-shadow:0 8px 26px rgba(2,6,23,.08);animation:fadeInUp .18s ease}
.msg.user .bubble{background:linear-gradient(180deg, #eef2ff, #e0e7ff);border-color:#c7d2fe}
.msg.bot .bubble{background:#f8fafc}
.bot-input{display:flex;gap:10px;padding:12px;border-top:1px solid #e5e7eb;position:sticky;bottom:0;background:rgba(255,255,255,.9);backdrop-filter:blur(10px);z-index:1}
.bot-input .input{flex:1;border:1px solid #e5e7eb;border-radius:9999px;padding:12px 14px;background:#fff;color:#111827;outline:none;transition:border-color .12s ease, box-shadow .12s ease}
.bot-input .input::placeholder{color:#9ca3af}
.bot-input .input:focus{border-color:#a78bfa;box-shadow:0 0 0 3px rgba(167,139,250,.25)}
.bot-input .btn.primary{border-radius:9999px;padding:0 18px;height:42px;line-height:42px;background:linear-gradient(135deg,#7c3aed,#6366f1);color:#fff;border:0;box-shadow:0 10px 20px rgba(99,102,241,.25);transition:transform .12s ease, box-shadow .12s ease}
.bot-input .btn.primary:hover{transform:translateY(-1px);box-shadow:0 16px 28px rgba(99,102,241,.3)}
.bot-input .btn.primary:active{transform:translateY(0)}
.bot-suggestions{display:flex;flex-wrap:wrap;gap:8px;padding:8px 12px;border-top:1px dashed #e5e7eb;max-height:140px;overflow:auto}
.chip{padding:8px 12px;border-radius:9999px;background:#f3f4f6;border:1px solid #e5e7eb;color:#111827;cursor:pointer;transition:transform .12s ease, box-shadow .12s ease}
.chip:hover{background:#e5e7eb;transform:translateY(-1px);box-shadow:0 6px 16px rgba(2,6,23,.06)}
.chip:active{transform:translateY(0)}
.bot-list{margin:0;padding-left:18px}
@media (max-width:640px){
  .bot-btn{display:none}
.bot-panel{right:10px;left:10px;width:auto;bottom:200px;max-height:55vh;height:500px}
}
/* Dark theme for bot */
[data-theme="dark"] .bot-btn{background:#0f172a;border-color:#334155}
[data-theme="dark"] .bot-panel{background:#0f172a;border-color:#334155}
[data-theme="dark"] .bot-panel{background:rgba(2,6,23,.85);border-color:rgba(51,65,85,.7)}
[data-theme="dark"] .bot-header{background:linear-gradient(135deg, rgba(124,58,237,.22), rgba(34,197,94,.18));border-bottom-color:#334155}
[data-theme="dark"] .bot-input{background:rgba(2,6,23,.9);border-top-color:#334155}
[data-theme="dark"] .bot-input .input{background:#0f172a;color:#e5e7eb;border-color:#334155}
[data-theme="dark"] .bot-input .input:focus{border-color:#a78bfa;box-shadow:0 0 0 3px rgba(167,139,250,.25)}
[data-theme="dark"] .bubble{background:linear-gradient(180deg,#0f172a,#0b1220);border-color:#334155;color:#e5e7eb}
[data-theme="dark"] .msg.user .bubble{background:linear-gradient(180deg,#1e293b,#16233a);border-color:#334155}

@keyframes fadeInUp{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
[data-theme="dark"] .bot-header{border-bottom-color:#334155}
[data-theme="dark"] .bubble{background:#0f172a;border-color:#334155;color:#e5e7eb}
[data-theme="dark"] .msg.user .bubble{background:#1e293b;border-color:#334155}
[data-theme="dark"] .chip{background:#111827;border-color:#334155;color:#e5e7eb}
/* Utility */
.hide-sm{display:inline}
/* Ensure labels are hidden on mobile viewports, overriding earlier utility if needed */
@media (max-width:980px){
  .hide-sm{display:none !important}
}
@media (max-width:980px){.grid{grid-template-columns:repeat(2,1fr)}.sidebar{position:fixed;left:-260px;top:0;height:100vh}.sidebar.open{left:0}.topbar{position:sticky}.content{margin-left:0;height:auto;overflow:visible}}
@media (max-width:640px){
  .grid{grid-template-columns:1fr}
  .sidebar{display:none}
  .sidebar.open{display:block}
  .mobile-nav{display:block}
  .container{padding-bottom:64px}
  .table{display:block;overflow-x:auto}
  .fab{display:flex;bottom:calc(env(safe-area-inset-bottom) + 120px)}
.btn{padding-block:12px;padding-inline:18px;border-radius:12px}
  .search-wrap{display:none}
}

/* Desktop collapse */
@media (min-width:981px){
  body.sidebar-collapsed .sidebar{width:0}
  body.sidebar-collapsed .sidebar .logo,
  body.sidebar-collapsed .sidebar .nav{display:none}
  body.sidebar-collapsed .content{margin-left:0}
  .fab{bottom:80px}
  /* Fixed header height on desktop; prevent internal scrolling/clipping */
  .topbar{height:64px; padding:8px 16px; overflow:hidden}
  .top-actions{flex-wrap:nowrap}
.top-actions .btn{min-width:auto;padding-block:8px;padding-inline:18px}
}

/* Dark theme overrides */
[data-theme="dark"] .topbar{background:var(--card);border-bottom-color:#1f2937}
[data-theme="dark"] .topbar{background:linear-gradient(135deg, rgba(124,58,237,.16), rgba(34,197,94,.12)), var(--card)}
[data-theme="dark"] .topbar::after{opacity:.8}
[data-theme="dark"] .search-input{background:#0f172a;border-color:#334155;color:#e5e7eb}
[data-theme="dark"] .toolbar-menu{background:#0f172a;border-color:#334155}
[data-theme="dark"] .card{background:var(--card);border-color:#334155}
[data-theme="dark"] .profile-menu{background:#0f172a;border-color:#334155}
[data-theme="dark"] .profile-menu a{color:#e5e7eb}
[data-theme="dark"] .profile-menu a:hover{background:#111827}

/* Settings page: temporarily hide Dashboard Cards and Sidebar Menu controls */
.content[data-page="settings"] .card.soft:has(#dash_row1),
.content[data-page="settings"] .card.soft:has(#sidebar_list){
  display:none !important;
}
[data-theme="dark"] .pm-divider{background:#1f2937}
[data-theme="dark"] .content{background:radial-gradient(1200px 400px at 100% -100%, rgba(124,58,237,.12), transparent),radial-gradient(900px 300px at -20% 0%, rgba(34,197,94,.1), transparent)}
[data-theme="dark"] .btn{background:#0f172a;color:#e5e7eb;border-color:#334155}
[data-theme="dark"] .btn.primary{background:var(--primary);border-color:var(--primary);color:#fff}
[data-theme="dark"] .avatar{border-color:#334155;background:#0f172a}
[data-theme="dark"] .modal .dialog{background:#0f172a;border-color:#334155}
/* Dark theme adjustments for sticky footer */
[data-theme="dark"] .modal .dialog .actions{background:rgba(2,6,23,.92);border-top-color:#334155}
[data-theme="dark"] .table th,[data-theme="dark"] .table td{border-bottom-color:#1f2937}
[data-theme="dark"] .mobile-nav{background:#0f172a;border-top-color:#1f2937}
[data-theme="dark"] .mobile-nav a{color:#94a3b8}
[data-theme="dark"] .mobile-nav a.active{background:#111827;color:#a78bfa;box-shadow:0 6px 16px rgba(2,6,23,.5)}
[data-theme="dark"] .nav a{color:#94a3b8}
[data-theme="dark"] .nav a:hover,[data-theme="dark"] .nav a.active{background:#111827;color:#fff}
[data-theme="dark"] .nav .nav-toggle{color:#94a3b8}
[data-theme="dark"] .nav .nav-toggle:hover,[data-theme="dark"] .nav .nav-toggle.active{background:#111827;color:#fff}
[data-theme="dark"] .submenu a{color:#94a3b8}
[data-theme="dark"] .submenu a:hover{background:#111827;color:#fff}

/* Sidebar icon mapping (unique look without external icons) */
.nav a::before{content:"";display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:6px;background:rgba(255,255,255,.08);color:#fff;flex:none}
.nav a[href*="dashboard"]::before{content:"🏠"}
.nav a[href*="users"]::before{content:"👤"}
.nav a[href*="roles"]::before{content:"🛡️"}
.nav a[href*="customers"]::before{content:"👥"}
.nav a[href*="labs"]::before{content:"🏥"}
.nav a[href*="lab_tests"]::before{content:"🧪"}
.nav a[href*="lab_test_results"]::before{content:"📈"}
.nav a[href*="subscriptions"]::before{content:"💳"}
.nav a[href*="faqs"]::before{content:"❓"}
.nav a[href*="lab_tests_master"]::before{content:"🧬"}
.nav a[href*="test_categories"]::before{content:"🗂️"}
.nav a[href*="genders"]::before{content:"⚧"}
.nav a[href*="settings"]::before{content:"⚙️"}
.nav a[href*="audit"]::before{content:"📜"}
.nav a[href*="logout"]::before{content:"🚪"}

/* Dark theme sidebar enhancements */
[data-theme="dark"] .sidebar{background:linear-gradient(180deg, rgba(124,58,237,.12), rgba(34,197,94,.08)), linear-gradient(135deg,#0b1220,#0a0f1a)}
[data-theme="dark"] .sidebar::before{opacity:.9}
[data-theme="dark"] .sidebar-footer{background:rgba(17,24,39,.6);border-color:#1f2937}
[data-theme="dark"] .sf-info .sf-role{color:#64748b}

/* Dark theme toolbar & search overrides */
[data-theme="dark"] .search-input{background:#0f172a;border-color:#334155;color:#e5e7eb}
[data-theme="dark"] .toolbar-menu{background:#0f172a;border-color:#334155}
/* Dark theme footer */
.theme-dark .site-footer{background:linear-gradient(135deg, rgba(124,58,237,.06), rgba(34,197,94,.05)), #0f172a;color:#94a3b8}
.theme-dark .site-footer::before{background:linear-gradient(90deg,#7c3aed,#22c55e,#f59e0b);opacity:.5}
.theme-dark .site-footer .footer-content a{color:#a78bfa}

/* Settings organizer modern layout */
.organizer{ list-style:none; padding:0; margin:8px 0; display:flex; flex-direction:column; gap:8px }
.organizer-item{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid #e5e7eb; border-radius:10px; background:var(--card); transition:background .2s, border-color .2s }
.organizer-item:hover{ background:#f3f4f6 }
.organizer-title{ display:flex; align-items:center; gap:8px; font-weight:500 }
.organizer-sub{ color:var(--muted); font-size:12px }
.organizer-actions{ display:flex; align-items:center; gap:8px }
.btn.icon{ padding-block:6px; padding-inline:18px; min-width:auto }
.btn.icon.soft{ background:transparent; border:1px solid #e5e7eb }

/* Toggle switch */
/* use label.switch + input[type=checkbox] + span.slider */

/* Dark theme organizer tweaks */
[data-theme="dark"] .organizer-item{ background:#0f172a; border-color:#334155 }
[data-theme="dark"] .organizer-item:hover{ background:#111827 }
[data-theme="dark"] .btn.icon.soft{ border-color:#334155 }

/* === UI visibility adjustments (feature preserved for future use) === */
/* Hide theme switch in topbar */
.topbar #themeToggle { display: none !important; }

/* Hide bot UI (button, panel, and floating action button) */
.fab, .bot-btn, .bot-panel { display: none !important; }

/* Hide specific dashboard cards */
.card[data-card-id="chartRoles"],
.card[data-card-id="chartAssignments"],
.card[data-card-id="recent_audits"],
.card[data-card-id="chartTestTypes"] { display: none !important; }

/* Remove Settings from the topbar */
.topbar #prefsBtn { display: none !important; }
/* disabled state remains visible */
.lab-controls .switch{ flex:none }
.switch input:disabled + .slider{ background: var(--border-color); opacity: 1; cursor: not-allowed }
/* Labs-specific pricing UI removed */

/* simple switch */
.switch{ position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input{ opacity:0; width:0; height:0; }
.slider{ position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:var(--border-color); transition:.2s; border-radius:22px; }
.slider:before{ position:absolute; content:""; height:18px; width:18px; left:2px; bottom:2px; background:white; transition:.2s; border-radius:50%; }
.switch input:checked + .slider{ background: var(--primary); }
.switch input:checked + .slider:before{ transform: translateX(18px); }

.switch.lg{ width:48px; height:26px; }
.switch.lg .slider{ border-radius:26px; }
.switch.lg .slider:before{ height:22px; width:22px; left:2px; bottom:2px; }
.switch.lg input:checked + .slider:before{ transform: translateX(22px); }

/* compact variant for inline lists */
.switch.sm{ width:36px; height:20px; }
.switch.sm .slider{ border-radius:20px; }
.switch.sm .slider:before{ height:16px; width:16px; left:2px; bottom:2px; }
.switch.sm input:checked + .slider:before{ transform: translateX(16px); }

.toggle-list{ display:flex; flex-wrap:wrap; gap:8px; }
.toggle-item{ display:inline-flex; align-items:center; gap:8px; padding:6px 10px; border:1px solid var(--border-color); border-radius:9999px; background: var(--bg-elevated); white-space:nowrap; flex:none; }
.toggle-item .name{ font-weight:500; }
.toggle-item:hover{ background:#f3f4f6 }
[data-theme="dark"] .toggle-item{ background:#0f172a; border-color:#334155 }
[data-theme="dark"] .toggle-item:hover{ background:#111827 }

/* Status text color codes */
.status-active { color: #0f766e; }
.status-deactive { color: #6b7280; }
.status-pending { color: #b45309; }
.status-completed { color: #16a34a; }
.status-cancelled { color: #ef4444; }

[data-theme="dark"] .status-active { color: #2dd4bf; }
[data-theme="dark"] .status-deactive { color: #9ca3af; }
[data-theme="dark"] .status-pending { color: #f59e0b; }
[data-theme="dark"] .status-completed { color: #22c55e; }
[data-theme="dark"] .status-cancelled { color: #f87171; }