:root{ 
  --navy-950:#070B14; --navy-900:#0B1120; --navy-800:#121A2E;
  --emerald-900:#0F2A5C; --emerald-800:#0D3E8C; --emerald-700:#0F4DBD; --emerald-600:#145FE0; --emerald-500:#1769FF; --emerald-400:#4F94FF; --emerald-300:#EDF4FF;
  --gray-50:#F5F7F6; --gray-100:#EEF0F2; --gray-400:#93A0AC; --ink-900:#0C1420; --ink-600:#4A5A68;
  --border:#E5EAE7; --radius-md:16px; --radius-sm:10px; --surface:#FFFFFF;
  --font-body:'Inter','Cairo',sans-serif; --font-display:'Space Grotesk','Cairo',sans-serif;
}
html[dir="rtl"]{ --font-display:'Cairo',sans-serif; --font-body:'Cairo',sans-serif; }

html[data-theme="dark"]{
  --navy-950:#050810; --navy-900:#080B14; --navy-800:#0F1420;
  --gray-50:#0B0F17; --gray-100:#141A24; --gray-400:#6B7686; --ink-900:#EDF1F5; --ink-600:#9AA6B4;
  --border:#232B38; --surface:#12161F;
}
html[data-theme="dark"] .btn-outline{ background:var(--surface); color:var(--ink-900); }
html[data-theme="dark"] .btn-light{ background:var(--surface); color:var(--ink-900); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea{
  background:var(--surface); color:var(--ink-900); border-color:var(--border);
}
html[data-theme="dark"] .field input:focus, html[data-theme="dark"] .field select:focus{ background:var(--surface); }
html[data-theme="dark"] .overlay-box{ background:var(--surface); }
html[data-theme="dark"] .toast{ background:var(--navy-900); }
html[data-theme="dark"] .lang-pill, html[data-theme="dark"] .lang-btn{ background:var(--surface); }
html[data-theme="dark"] tbody tr:hover{ background:rgba(255,255,255,.03); }
html[data-theme="dark"] .paper{ background:var(--surface); }
html[data-theme="dark"] img{ filter:brightness(.95); }

@media(prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; scroll-behavior:auto !important; }
}
*{box-sizing:border-box; margin:0; padding:0;}
button,a,input,select,textarea{transition:box-shadow .15s ease, transform .1s ease, background .15s ease, border-color .15s ease, opacity .15s ease;}
:focus-visible{outline:1.5px solid var(--emerald-500); border-color:var(--emerald-500); box-shadow:0 0 0 4px rgba(23,105,255,.12);}
.mini-btn:focus-visible, .btn:focus-visible{outline-offset:3px;}
body{font-family:var(--font-body); background:var(--gray-50); color:var(--ink-900); -webkit-font-smoothing:antialiased;overflow-y: scroll;}
a{text-decoration:none; color:inherit;}
button{font-family:inherit; cursor:pointer;}
input,select,textarea{font-family:inherit;}

.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:9px 20px; border-radius:100px; font-weight:600; font-size:13.5px; letter-spacing:-.1px; border:1px solid transparent; transition:transform .15s cubic-bezier(.4,0,.2,1), box-shadow .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease; -webkit-tap-highlight-color:transparent;}
.btn:active{transform:scale(.96);}
.btn-primary{background:linear-gradient(135deg,var(--emerald-500),var(--emerald-700)); color:#fff; }
.btn-primary:hover{transform:translateY(-2px);}
.btn-primary:active{transform:scale(.96);}
.btn-outline{background:var(--surface); border-color:var(--border); color:var(--ink-900);}
.btn-outline:hover{border-color:var(--emerald-500); color:var(--emerald-700);}
.btn-danger{background:var(--surface); border-color:#F3D3D3; color:#C0392B;}
.btn-danger:hover{background:#FDECEC;}
.btn-sm{padding:6px 14px; font-size:12.5px;}

/* Auth */
.auth-wrap{min-height:100vh; display:grid; grid-template-columns:1.05fr .95fr; background:var(--gray-50);}
.auth-side{    background: radial-gradient(ellipse 700px 500px at 20% 0%, rgba(23,105,255, .35), transparent 60%), url(/static/image/blog-digitization.webp);
    color: #fff;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;}

    .auth-side::before {
    content: "";
    position: absolute;
    inset: 0;

    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    z-index: 0;    opacity: .7;
    filter: brightness(0.5);
}



.auth-side::before{content:""; position:absolute; inset:0; background-image:radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px); background-size:24px 24px; opacity:.5;}
.brand{display:flex; align-items:center; gap:10px; position:relative; z-index:2;}
.brand-mark{color:var(--emerald-500);width:36px; height:36px; border-radius:11px; display:flex; align-items:center; justify-content:center; flex-shrink:0; overflow:hidden;}
.brand-mark svg{width:100%; height:100%; display:block;}
.brand-name{font-family:'Reem Kufi Fun', sans-serif; font-weight:700; font-size:19px;}
.brand-name span{color:var(--emerald-300);}
.auth-quote{font-family:var(--font-display); font-size:26px; font-weight:600; line-height:1.35; margin-top:60px; max-width:400px; position:relative; z-index:2;}
.auth-quote span{color:var(--emerald-300);}
.auth-form-side{display:flex; align-items:center; justify-content:center; padding:40px;}
.auth-box{width:100%; max-width:380px;}
.auth-box h2{font-family:var(--font-display); font-size:26px; font-weight:700;}
.auth-box .sub{color:var(--ink-600); margin-top:6px; font-size:14px;}
.field{margin-top:18px;}
.field label{font-size:13px; font-weight:600; display:block; margin-bottom:6px;}
.field input, .field select, .field textarea{width:100%; padding:12px 14px; border-radius:11px; border:1.5px solid var(--border); font-size:14px; outline:none;}
.field input:focus, .field select:focus, .field textarea:focus{border-color:var(--emerald-500); box-shadow:0 0 0 4px rgba(23,105,255,.12);}
.field-check{display:flex; align-items:center; gap:8px; font-size:13.5px; margin-top:14px;}

/* ---------- Company picker (Security Co. / Maintenance Co.) ---------- */
.company-picker{display:flex; flex-wrap:wrap; gap:8px; margin-top:6px;}
.company-pick{border:1.5px solid var(--border); border-inline-start-width:1.5px; border-radius:10px; padding:8px 14px; cursor:pointer; font-size:13px; background:var(--surface); color:var(--ink-700); transition:border-color .15s ease, background .15s ease, border-inline-start-width .15s ease; user-select:none;}
.company-pick:hover{border-color:var(--emerald-300);}
.company-pick.active{border-color:var(--emerald-500); border-inline-start:4px solid var(--emerald-500); background:rgba(23,105,255,.07); color:var(--emerald-700); font-weight:600; padding-inline-start:11px;}
.company-pick.none{color:var(--ink-500);}

/* ---------- Apple-style checkboxes (iOS toggle switches) ---------- */
input[type="checkbox"]{
  appearance:none; -webkit-appearance:none; position:relative;
  width:40px; height:24px; min-width:40px; border-radius:100px; background:var(--gray-100);
  border:1.5px solid var(--border); cursor:pointer; flex-shrink:0; outline:none; margin:0;
  transition:background .2s ease, border-color .2s ease; vertical-align:middle;
}
input[type="checkbox"]::before{
  content:""; position:absolute; top:1.5px; left:1.5px; width:18px; height:18px; border-radius:50%;
  background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.25); transition:transform .2s cubic-bezier(.4,0,.2,1);
}
input[type="checkbox"]:checked{background:var(--emerald-500); border-color:var(--emerald-500);}
input[type="checkbox"]:checked::before{transform:translateX(16px);}
input[type="checkbox"]:focus-visible{outline:2px solid var(--emerald-500); outline-offset:2px;}
input[type="checkbox"]:disabled{opacity:.5; cursor:not-allowed;}
html[dir="rtl"] input[type="checkbox"]::before{left:auto; right:1.5px;}
html[dir="rtl"] input[type="checkbox"]:checked::before{transform:translateX(-16px);}
.perm-table input[type="checkbox"]{width:32px; height:20px; min-width:32px;}
.perm-table input[type="checkbox"]::before{width:15px; height:15px;}
.perm-table input[type="checkbox"]:checked::before{transform:translateX(12px);}
html[dir="rtl"] .perm-table input[type="checkbox"]:checked::before{transform:translateX(-12px);}
.hint{background:#FFF7E6; border:1px solid #F5DFA6; color:#8A6416; font-size:12.5px; padding:10px 12px; border-radius:10px; margin-top:16px;}
.flash{background:#FDECEC; color:#C0392B; padding:10px 14px; border-radius:10px; font-size:13px; margin-bottom:16px;}
.flash-success{background:#E9F1FF; color:#0F4DBD;}
.flash-warning{background:#FFF7E0; color:#8A6416;}
.flash-error{background:#FDECEC; color:#C0392B;}

/* App shell */
.app{min-height:100vh; display:flex;}
.sidebar{width:240px; background:var(--surface); color:var(--ink-900); flex-shrink:0; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; overflow-y:auto; border-right:1px solid var(--border); transition:width .2s ease;}
html[dir="rtl"] .sidebar{border-right:none; border-left:1px solid var(--border);}
.sidebar-head{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:18px 16px; border-bottom:1px solid var(--border); min-height:68px;}
.sidebar-collapse-btn{width:28px; height:28px; border-radius:8px; border:1.5px solid var(--border); background:var(--surface); color:var(--ink-600); display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.sidebar .brand-name span{color:var(--emerald-700);}
.sidebar-collapse-btn:hover{border-color:var(--emerald-500); color:var(--emerald-700);}
.sidebar-nav{flex:1; overflow-y:auto; padding:14px 12px;}
.nav-group-label{font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--gray-400); padding:14px 12px 6px;}
.nav-group-label:first-child{padding-top:2px;}
html.sidebar-collapsed .nav-group-label{display:none;}
.nav-item{display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:10px; color:var(--ink-600); font-size:13.5px; font-weight:500; margin-bottom:2px; width:100%; text-align:left; background:none; border:none;}
.nav-count{margin-inline-start:auto; background:var(--gray-100); color:var(--ink-600); font-size:10.5px; font-weight:700; border-radius:100px; min-width:19px; height:19px; padding:0 6px; display:flex; align-items:center; justify-content:center; flex-shrink:0; line-height:1;}
.nav-item.active .nav-count{background:rgba(255,255,255,.28); color:inherit;}
html.sidebar-collapsed .nav-count{display:none;}
html[dir="rtl"] .nav-item{text-align:right;}
.nav-item:hover{background:var(--gray-100); color:var(--ink-900);}
.nav-item.active{background:rgba(23,105,255,.12); color:var(--emerald-700); font-weight:600;}
.sidebar-foot{padding:14px; border-top:1px solid var(--border);}
.main{flex:1; min-width:0;}
.topbar{position:sticky; top:0; z-index:10; background:var(--surface); border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; padding:14px 26px;}
.topbar-right{display:flex; align-items:center; gap:10px;}
.lang-pill{display:flex; gap:4px; background:var(--gray-50); border:1.5px solid var(--border); border-radius:100px; padding:3px;}
.lang-pill a{padding:6px 12px; border-radius:100px; font-size:12px; font-weight:700; color:var(--ink-600);}
.lang-pill a.active{background:var(--emerald-500); color:#fff;}
.avatar{width:36px; height:36px; border-radius:11px; background:linear-gradient(135deg,var(--emerald-400),var(--emerald-700)); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px;}
.page-body{padding:26px;}
.export-buttons{display:flex; gap:8px;}

/* ---------- Apple-style dashboard widgets (Clock / Weather) ---------- */
.widgets-row{display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:16px;}
.widgets-row.has-attendance{grid-template-columns:repeat(4,1fr);}
@media(max-width:1100px){ .widgets-row.has-attendance{grid-template-columns:repeat(2,1fr);} }
.apple-widget{
  border-radius:22px; padding:20px 22px; color:#fff; position:relative; overflow:hidden;
  min-height:132px; display:flex; flex-direction:column; justify-content:space-between;
}
.apple-widget::after{content:""; position:absolute; inset:0; background:linear-gradient(180deg,rgba(255,255,255,.14),transparent 55%); pointer-events:none;}
.widget-clock{background:linear-gradient(160deg,#1C1C1E,#000);}
.widget-weather{background:linear-gradient(160deg,#3A8DDE,#0B4C8C);}
.widget-stock{background:linear-gradient(160deg,var(--emerald-400),var(--emerald-800,#0D3E8C));}
.widget-attendance{background:linear-gradient(160deg,#FF9500,#FF375F);}
.widget-head{display:flex; align-items:center; justify-content:space-between; font-size:11.5px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:rgba(255,255,255,.75); position:relative; z-index:1;}
.widget-time{font-family:var(--font-display); font-weight:300; font-size:38px; letter-spacing:-.01em; line-height:1; position:relative; z-index:1;}
.widget-date{font-size:12px; color:rgba(255,255,255,.7); margin-top:6px; position:relative; z-index:1;}
.widget-temp{font-family:var(--font-display); font-weight:300; font-size:38px; letter-spacing:-.01em; line-height:1; position:relative; z-index:1; display:flex; align-items:center; gap:10px;}
.widget-temp-icon{font-size:30px; line-height:1;}
.widget-cond{font-size:12px; color:rgba(255,255,255,.8); margin-top:6px; position:relative; z-index:1;}
.widget-stock-val{font-family:var(--font-display); font-weight:700; font-size:30px; letter-spacing:-.01em; line-height:1; position:relative; z-index:1;}
.widget-stock-sub{font-size:12px; color:rgba(255,255,255,.8); margin-top:6px; position:relative; z-index:1;}

/* ---------- Classic analog clock (dashboard widget) ---------- */
.classic-clock-row{display:flex; align-items:center; gap:16px; position:relative; z-index:1;}
.classic-clock-face{width:64px; height:64px; flex-shrink:0;}
@media(prefers-reduced-motion: reduce){ #clock-hour, #clock-minute, #clock-second{transition:none;} }
@media(max-width:560px){ .classic-clock-face{width:54px; height:54px;} }
@media(max-width:860px){ .widgets-row{grid-template-columns:1fr 1fr;} }
@media(max-width:560px){ .widgets-row{grid-template-columns:1fr !important;} .hidden {display:none !important;} }

/* Collapsed sidebar (desktop only, toggled via the chevron next to the logo) */
html.sidebar-collapsed .sidebar{width:76px;}
html.sidebar-collapsed .brand-name{display:none;}
html.sidebar-collapsed .sidebar-head{justify-content:center; padding:18px 10px;}
html.sidebar-collapsed .sidebar-collapse-btn{transform:rotate(180deg); background:var(--surface);}
html.sidebar-collapsed .nav-item{justify-content:center; padding:10px;}
html.sidebar-collapsed .nav-item span{display:none;}
html.sidebar-collapsed .sidebar-foot .btn span{display:none;}
html.sidebar-collapsed .sidebar-foot .btn{width:auto; padding:11px; justify-content:center;}
html.sidebar-collapsed .sidebar-user-text{display:none;}
html.sidebar-collapsed .sidebar-user-info{justify-content:center;}
.mobilShow {display:none;}
.mobilhideen {display:block;}
@media(max-width:980px){
  .mobilShow {display:block;}
  .mobilhideen {display:none;}
  html.sidebar-collapsed .sidebar{width:240px;}
  html.sidebar-collapsed .brand-name{display:inline;}
  html.sidebar-collapsed .sidebar-head{justify-content:space-between; padding:18px 16px;}
  html.sidebar-collapsed .sidebar-collapse-btn{position:static; transform:none;}
  html.sidebar-collapsed .nav-item{justify-content:flex-start; padding:10px 12px;}
  html.sidebar-collapsed .nav-item span{display:inline;}
  html.sidebar-collapsed .sidebar-foot .btn span{display:inline;}
}
.page-title-row{display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; flex-wrap:wrap; gap:10px;}
.page-title{font-family:var(--font-display); font-size:22px; font-weight:700;}
.page-sub{font-size:12.5px; color:var(--ink-600); margin-top:3px;}

/* KPIs */
.kpi-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px;}
.kpi-card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:18px;}
.kpi-icon{width:34px; height:34px; border-radius:10px; background:rgba(23,105,255,.12); color:var(--emerald-700); display:flex; align-items:center; justify-content:center; font-size:16px;}
.kpi-val{font-family:var(--font-display); font-size:23px; font-weight:700; margin-top:14px;}
.kpi-lbl{font-size:12px; color:var(--ink-600); margin-top:3px;}

/* ---------- Dashboard-only: Apple-style gradient KPI cards ---------- */
/* Scoped to .apple-kpi-grid specifically so every OTHER page that
   reuses .kpi-card (Accountant, HR dashboard, Building detail, ...)
   keeps its plain white card look — only the main dashboard gets the
   colorful gradient treatment, matching the widgets row above it. */
.apple-kpi-grid .kpi-card{
  border:none; color:#fff; position:relative; overflow:hidden; padding:20px 22px;
}
.apple-kpi-grid .kpi-card::after{content:""; position:absolute; inset:0; background:linear-gradient(180deg,rgba(255,255,255,.14),transparent 55%); pointer-events:none;}
.apple-kpi-grid .kpi-card:nth-child(1){background:linear-gradient(160deg,#5E5CE6,#3634A3);}
.apple-kpi-grid .kpi-card:nth-child(2){background:linear-gradient(160deg,#0A84FF,#0040DD);}
.apple-kpi-grid .kpi-card:nth-child(3){background:linear-gradient(160deg,#30D158,#1F7A34);}
.apple-kpi-grid .kpi-card:nth-child(4){background:linear-gradient(160deg,#64D2FF,#0071A4);}
.apple-kpi-grid .kpi-icon{background:rgba(255,255,255,.18); color:#fff; position:relative; z-index:1;}
.apple-kpi-grid .kpi-val{color:#fff; position:relative; z-index:1;}
.apple-kpi-grid .kpi-lbl{color:rgba(255,255,255,.8); position:relative; z-index:1;}

/* ---------- Pagination footer (Buildings, Units, Contracts, ...) ---------- */
.pagination-bar{display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; margin-top:14px; padding-top:14px;}
.pagination-info{font-size:12.5px; color:var(--ink-600);}
.pagination-controls{display:flex; align-items:center; gap:4px; flex-wrap:wrap;}
.pagination-btn{padding:7px 12px; border-radius:9px; border:1.5px solid var(--border); background:var(--surface); color:var(--ink-700); font-size:12.5px; font-weight:600; text-decoration:none;}
.pagination-btn:hover{border-color:var(--emerald-300); color:var(--emerald-700);}
.pagination-btn.disabled{color:var(--gray-400); pointer-events:none; opacity:.55;}
.pagination-num{min-width:30px; height:30px; padding:0 4px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:12.5px; font-weight:600; color:var(--ink-700); text-decoration:none;}
.pagination-num:hover{background:var(--gray-100);}
.pagination-num.active{background:var(--emerald-500); color:#fff;}
.pagination-ellipsis{padding:0 4px; color:var(--gray-400); font-size:12.5px;}

/* ---------- Dashboard "coming soon" app store badges ---------- */
.store-badge{display:flex; align-items:center; gap:9px; padding:8px 14px; border-radius:10px; background:#0C1420; color:#fff; cursor:default; user-select:none; transition:transform .15s ease;}
.store-badge:hover{transform:translateY(-1px);}
.store-badge-sub{font-size:8.5px; letter-spacing:.04em; text-transform:uppercase; color:rgba(255,255,255,.65); line-height:1.2;}
.store-badge-main{font-family:var(--font-display); font-size:14px; font-weight:600; line-height:1.2;}

.grid-2{display:grid; grid-template-columns:1.4fr 1fr; gap:16px; margin-bottom:16px;}
.panel{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:22px;}
.panel-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:16px;}
.panel-title{font-weight:700; font-size:15px;}

/* Tables */
.table-wrap{overflow-x:auto;}table{width:100%; border-collapse:collapse; font-size:13.5px;}
thead th{text-align:left; font-size:11px; text-transform:uppercase; color:var(--gray-400); font-weight:700; padding:0 12px 12px; border-bottom:1px solid var(--border); white-space:nowrap;}
html[dir="rtl"] thead th{text-align:right;}
tbody td{padding:13px 12px; border-bottom:1px solid #F2F5F3; white-space:nowrap;}
tbody tr:hover{background:#FAFCFB;}
.td-strong{font-weight:600;}
.badge{font-size:11px; font-weight:700; padding:5px 10px; border-radius:100px; display:inline-block;}
.badge.Overdue{color:#C0392B; background:rgba(220,90,90,.12);}
.badge.Paid{color:var(--emerald-700); background:rgba(23,105,255,.12);}
.badge.Partial{color:#B7791F; background:rgba(214,158,46,.14);}
.badge.Pending{color:#64748B; background:rgba(148,163,184,.16);}
.badge.Vacant{color:#64748B; background:rgba(148,163,184,.16);}
.badge.Occupied{color:var(--emerald-700); background:rgba(23,105,255,.12);}
.badge.Reserved{color:#B7791F; background:rgba(214,158,46,.14);}
.badge.Maintenance{color:#C0392B; background:rgba(220,90,90,.12);}
.row-actions{display:flex; gap:6px;}
.mini-btn{width:30px; height:30px; border-radius:9px; border:1.5px solid var(--border); background:var(--surface); display:flex; align-items:center; justify-content:center; color:var(--ink-600); font-size:13px; transition:transform .15s cubic-bezier(.4,0,.2,1), border-color .15s ease, color .15s ease;}
.mini-btn:active{transform:scale(.9);}
.btn-spinner{display:inline-block; width:12px; height:12px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; margin-inline-end:7px; vertical-align:-2px; animation:btnSpin .6s linear infinite;}
.btn-outline .btn-spinner, .btn-light .btn-spinner{border-color:rgba(10,20,30,.25); border-top-color:var(--ink-900);}
@keyframes btnSpin{ to{ transform:rotate(360deg); } }
@media(prefers-reduced-motion: reduce){ .btn-spinner{ animation:none; } }
.mini-btn:hover{border-color:var(--emerald-500); color:var(--emerald-700);}
.mini-btn.danger:hover{border-color:#F3D3D3; color:#C0392B;}

.card-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:14px;}
.view-toggle-group{display:flex; border:1.5px solid var(--border); border-radius:10px; overflow:hidden; flex-shrink:0;}
.view-toggle-group button{background:var(--surface); border:none; padding:8px 10px; color:var(--ink-600); cursor:pointer; display:flex; align-items:center;}
.view-toggle-group button + button{border-inline-start:1.5px solid var(--border);}
.view-toggle-group button.active{background:rgba(23,105,255,.12); color:var(--emerald-700);}
.card-grid.view-list{display:flex; flex-direction:column; gap:8px;}
.card-grid.view-list .entity-card{display:flex; flex-direction:row; align-items:stretch;}
.card-grid.view-list .entity-card .head{height:auto; width:96px; flex-shrink:0; align-items:center; justify-content:center; padding:0;}
.card-grid.view-list .entity-card .head .occ{position:static;}
.card-grid.view-list .entity-card .body{flex:1; padding:10px 16px; display:flex; flex-direction:column; justify-content:center; gap:2px;}
.card-grid.view-list .entity-card .bar-track{display:none;}
.card-grid.view-list .entity-card .entity-foot{margin-top:4px;}
html[dir="rtl"] .card-grid.view-list .entity-card{flex-direction:row-reverse;}
.entity-card{transition:transform .18s, box-shadow .18s;border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; background:var(--surface);}
.entity-card:hover{box-shadow:0 0 0 4px rgba(23,105,255,.12);}
.entity-card .head{height:90px; display:flex; align-items:flex-end; padding:12px; color:#fff;}
.entity-card .head .occ{background:rgba(0,0,0,.35); font-size:11px; font-weight:700; padding:4px 9px; border-radius:100px;}
.entity-card .body{padding:14px;}
.entity-card h4{font-size:14.5px; font-weight:700;}
.entity-card .loc{font-size:12px; color:var(--ink-600); margin-top:3px;}
.bar-track{height:6px; background:var(--gray-100); border-radius:100px; margin-top:12px; overflow:hidden;}
.bar-fill{height:100%; background:linear-gradient(90deg,var(--emerald-400),var(--emerald-600));}
.entity-foot{display:flex; justify-content:space-between; margin-top:10px; font-size:12px; color:var(--ink-600);}
.entity-actions{display:flex; gap:6px; margin-top:12px;}

.insight-panel{background:linear-gradient(160deg,var(--navy-950),var(--navy-800)); color:#fff; border:none;}
.insight-item{display:flex; gap:10px; padding:12px 0; border-bottom:1px solid rgba(255,255,255,.08); font-size:13px; line-height:1.5; color:rgba(255,255,255,.85);}
.insight-item:last-child{border-bottom:none;}
.insight-empty{font-size:13px; color:rgba(255,255,255,.5); padding:12px 0;}

.filters{display:flex; gap:10px; margin-bottom:18px; flex-wrap:wrap;}
.filters select, .filters input{padding:9px 12px; border-radius:10px; border:1.5px solid var(--border); font-size:13px;}

.form-panel{    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 26px;}
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:0 16px;}
.form-actions{display:flex; gap:10px; margin-top:22px;}
/* Apple-style segmented control — used for two/three-way toggles like tenant mode. */
.segmented-control{display:inline-flex; background:var(--gray-100); border-radius:10px; padding:3px; gap:2px;}
.segmented-option{border:none; background:transparent; padding:7px 16px; border-radius:8px; font-size:13px; font-weight:600; color:var(--ink-600); cursor:pointer; transition:background .18s ease, color .18s ease, box-shadow .18s ease;}
.segmented-option.active{background:var(--surface); color:var(--ink-900); box-shadow:0 1px 3px rgba(0,0,0,.12);}
html[data-theme="dark"] .segmented-option.active{background:var(--gray-100);}
#form-modal-footer .form-actions{margin-top:0;}

.empty-state{text-align:center; padding:40px 20px; color:var(--ink-600); font-size:13.5px;}

@media(max-width:980px){
  .kpi-grid{grid-template-columns:1fr 1fr;}
  .grid-2{grid-template-columns:1fr;}
  .card-grid{grid-template-columns:1fr 1fr;}
  .form-grid{grid-template-columns:1fr;}
}
@media(max-width:620px){
  .kpi-grid,.card-grid{grid-template-columns:1fr;}
  .auth-wrap {grid-template-columns: auto !important;}
}

/* ---------- Overlays / Modals (slide down from the top on open/close) ---------- */
.overlay{
  position:fixed; inset:0; background:rgba(7,11,20,.6); z-index:100;
  display:flex; align-items:flex-start; justify-content:center; padding:8vh 16px;
  opacity:0; visibility:hidden; transition:opacity .22s ease, visibility 0s linear .22s, background .22s ease;
  backdrop-filter: blur(3px);
}
.overlay.open{opacity:1; visibility:visible; transition:opacity .22s ease, visibility 0s linear 0s, background .22s ease;}
.overlay-box{
  background:var(--surface); border-radius:18px; width:100%; 
  display:flex; flex-direction:column; max-height:84vh; overflow:hidden;
  transform:translateY(-64px); opacity:0; transition:transform .3s cubic-bezier(.32,.72,0,1), opacity .25s ease;
}
.overlay.open .overlay-box{transform:translateY(0); opacity:1;}
@media(prefers-reduced-motion: reduce){
  .overlay-box{transition:opacity .15s ease; transform:none !important;}
}
#modal-body{flex:1; display:flex; flex-direction:column; overflow:hidden; padding:0;}
.modal-form{flex:1; display:flex; flex-direction:column; overflow:hidden; min-height:0;}
.modal-header{padding:20px 26px 14px; flex-shrink:0; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:10px;}
.modal-header .page-title{margin:0;}
.modal-scroll{flex:1; overflow-y:auto; padding:18px 26px;}
.modal-footer{flex-shrink:0; padding:14px 26px; border-top:1px solid var(--border); display:flex; gap:10px; background:var(--surface);}
.modal-form .form-panel{border:none; padding:0; max-width:none; box-shadow:none;}
.modal-close-x{background:none; border:none; font-size:18px; color:var(--gray-400); cursor:pointer; line-height:1; padding:4px;}
.modal-close-x:hover{color:var(--ink-900);}

/* ---------- Modal tabs (Details / Photos / Diagram / Documents) ---------- */
.modal-tabs{display:flex; gap:4px; margin-bottom:4px;}
.modal-tab-btn{padding:8px 14px; border-radius:9px 9px 0 0; font-size:12.5px; font-weight:600; color:var(--ink-600); background:none; border:none; cursor:pointer; border-bottom:2px solid transparent;}
.modal-tab-btn.active{color:var(--emerald-700); border-bottom-color:var(--emerald-500); background:rgba(23,105,255,.06);}
.tab-pane{display:none;}
.tab-pane.active{display:block;}

/* ---------- Toasts ---------- */
.toast-stack{position:fixed; bottom:20px; right:20px; z-index:200; display:flex; flex-direction:column; gap:8px;}
html[dir="rtl"] .toast-stack{right:auto; left:20px;}
.toast{background:var(--navy-950); color:#fff; padding:12px 18px; border-radius:12px; font-size:13px; box-shadow:0 14px 30px -10px rgba(0,0,0,.4);}

/* ---------- Unit category tabs ---------- */
.tabs{display:flex; gap:6px; background:var(--surface); border:1.5px solid var(--border); border-radius:100px; padding:4px; width:fit-content; max-width:100%; margin-bottom:18px; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none;}
.tabs::-webkit-scrollbar{display:none;}
.tabs a{padding:9px 18px; border-radius:100px; font-size:13px; font-weight:600; color:var(--ink-600); display:flex; align-items:center; gap:6px; flex-shrink:0; white-space:nowrap;}
.tabs a:hover {box-shadow:0 0 0 4px rgba(23,105,255,.12);color: var(--emerald-700);}
.tabs a.active{background:linear-gradient(135deg,var(--emerald-500),var(--emerald-700)); color:#fff;}
.tabs .count{font-size:10.5px; opacity:.75;}

/* ---------- Unit cards with photos ---------- */
.unit-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:16px;}
.unit-grid.view-list{display:flex; flex-direction:column; gap:8px;}
.unit-grid.view-list .unit-card{display:flex; flex-direction:row; align-items:stretch;}
.unit-grid.view-list .unit-card > a{flex-shrink:0;}
.unit-grid.view-list .unit-photo,
.unit-grid.view-list .unit-photo-placeholder{height:auto; width:120px; align-self:stretch;}
.unit-grid.view-list .unit-body{flex:1; padding:10px 16px; display:flex; flex-direction:column; justify-content:center; gap:2px;}
.unit-grid.view-list .unit-actions{margin-top:6px;}
html[dir="rtl"] .unit-grid.view-list .unit-card{flex-direction:row-reverse;}

/* ---------- "For Sale" style cards — also used by Buildings/Apartments/Villas/Shops ---------- */
.sale-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:16px;}
.sale-grid.view-list{display:flex; flex-direction:column; gap:8px;}
.sale-card{border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; background:var(--surface); transition:transform .18s, box-shadow .18s;}
.sale-card:hover{box-shadow:0 0 0 4px rgba(23,105,255,.12);}
.sale-photo{height:150px; background-size:cover; background-position:center; background-color:var(--gray-100); position:relative;}
.sale-photo-placeholder{height:150px; display:flex; align-items:center; justify-content:center; color:var(--ink-600); background:var(--gray-100); position:relative;}
.sale-photo .badge, .sale-photo-placeholder .badge{position:absolute; top:10px; left:10px; z-index:2;}
.sale-body{padding:14px;}
.sale-title-row{display:flex; justify-content:space-between; align-items:flex-start; gap:8px;}
.sale-title-row h4{font-size:14.5px; font-weight:700;}
.sale-loc{display:flex; align-items:center; gap:5px; font-size:12.5px; color:var(--ink-600); margin:4px 0 8px;}
.sale-price{font-weight:700; font-size:16px; color:var(--emerald-700); margin-bottom:6px;}
.sale-meta{font-size:12px; color:var(--ink-600); margin-top:2px;}
.sale-actions{margin-top:10px; display:flex; gap:6px;}
.sale-grid.view-list .sale-card{display:flex; flex-direction:row; align-items:stretch;}
.sale-grid.view-list .sale-photo,
.sale-grid.view-list .sale-photo-placeholder{height:-webkit-fill-available; width:120px; flex-shrink:0;}
.sale-grid.view-list .sale-body{flex:1; padding:10px 16px; display:flex; flex-direction:column; justify-content:center; gap:2px;}
.sale-grid.view-list .sale-actions{margin-top:6px;}
html[dir="rtl"] .sale-grid.view-list .sale-card{flex-direction:row-reverse;}
.unit-card{border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; background:var(--surface); transition:transform .18s, box-shadow .18s;}
.unit-card:hover{box-shadow:0 0 0 4px rgba(23,105,255,.12);}
.unit-photo{height:150px; background-size:cover; background-position:center; position:relative; background-color:var(--gray-100);}
.unit-photo-placeholder{height:150px; display:flex; align-items:center; justify-content:center; color:var(--ink-600); background:var(--gray-100); position:relative; overflow:hidden;}
.unit-photo .badge, .unit-photo-placeholder .badge{position:absolute; top:10px; left:10px; z-index:2;}
html[dir="rtl"] .unit-photo .badge, html[dir="rtl"] .unit-photo-placeholder .badge{left:auto; right:10px;}
.unit-ad-badge{position:absolute; top:10px; right:10px; background:rgba(23,105,255,.92); color:#fff; font-size:10.5px; font-weight:700; padding:4px 9px; border-radius:100px;}
html[dir="rtl"] .unit-ad-badge{right:auto; left:10px;}
.unit-body{padding:14px;}
.unit-body h4{font-size:14.5px; font-weight:700;}
.unit-meta{font-size:12px; color:var(--ink-600); margin-top:4px;}
.unit-price{font-weight:700; font-size:16px; color:var(--emerald-700); margin-top:6px;}
.unit-actions{display:flex; gap:6px; margin-top:10px; flex-wrap:wrap;}

/* ---------- Upload widgets ---------- */
.upload-drop{border:1.5px dashed var(--border); border-radius:14px; padding:18px; text-align:center; font-size:12.5px; color:var(--ink-600); cursor:pointer; background:var(--gray-50);}
.upload-drop:hover{border-color:var(--emerald-500); color:var(--emerald-700);}
.thumb-row{display:flex; gap:8px; flex-wrap:wrap; margin-top:12px;}
.thumb{position:relative; width:72px; height:72px; border-radius:10px; overflow:hidden; border:1.5px solid var(--border); background-size:cover; background-position:center;}
.thumb.cover{border-color:var(--emerald-500); box-shadow:0 0 0 2px var(--emerald-300);}
.thumb-actions{position:absolute; inset:0; background:rgba(7,11,20,.55); opacity:0; display:flex; align-items:center; justify-content:center; gap:4px; transition:opacity .15s;}
.thumb:hover .thumb-actions{opacity:1;}
.thumb-actions button{width:22px; height:22px; border-radius:6px; border:none; background:var(--surface); font-size:10px; cursor:pointer;}
.doc-row{display:flex; align-items:center; justify-content:space-between; padding:9px 12px; border:1px solid var(--border); border-radius:10px; margin-top:8px; font-size:12.5px;}

/* ---------- Theme color swatches ---------- */
.swatch-grid{display:grid; grid-template-columns:repeat(6,1fr); gap:12px; max-width:420px;}
.swatch{display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer;}
.swatch-circle{width:40px; height:40px; border-radius:50%; border:3px solid transparent; transition:transform .15s;}
.swatch input:checked + .swatch-circle{border-color:var(--ink-900); transform:scale(1.12);}
.swatch-label{font-size:10.5px; color:var(--ink-600);}
.swatch input{position:absolute; opacity:0; width:0; height:0;}

/* ---------- Contract composer (Word-page style) ---------- */
.compose-wrap{display:grid; grid-template-columns:360px 1fr; gap:20px; align-items:start;}
.compose-panel{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:20px; position:sticky; top:80px;}
.paper{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); box-shadow:0 20px 40px -24px rgba(6,78,59,.25); padding:48px; min-height:600px; font-size:13.5px; line-height:1.7; color:var(--ink-900);}
.paper h1{font-family:var(--font-display); font-size:18px; color:var(--emerald-700); margin-bottom:2px;}
.paper .paper-sub{font-size:11.5px; color:var(--ink-600); font-style:italic; margin-bottom:18px;}
.paper .paper-notice{background:#FFF7E6; border:1px solid #F5DFA6; color:#8A6416; font-size:11.5px; padding:10px 12px; border-radius:8px; margin-bottom:20px;}
.paper h2{font-size:13.5px; color:var(--emerald-700); margin:20px 0 8px; font-weight:700;}
.paper table{width:100%; border-collapse:collapse; margin-bottom:6px;}
.paper table td{padding:5px 0; font-size:12.5px; border-bottom:1px solid #F2F5F3;}
.paper table td:first-child{color:var(--ink-600); width:45%;}
.paper table td:last-child{font-weight:600;}

/* ---------- Permission matrix ---------- */
.perm-table{width:100%; border-collapse:collapse; font-size:12.5px;}
.perm-table th, .perm-table td{padding:9px 10px; text-align:center; border-bottom:1px solid var(--border);}
.perm-table th:first-child, .perm-table td:first-child{text-align:left;}
html[dir="rtl"] .perm-table th:first-child, html[dir="rtl"] .perm-table td:first-child{text-align:right;}

@media(max-width:980px){
  .unit-grid{grid-template-columns:1fr 1fr;}
  .compose-wrap{grid-template-columns:1fr;}
  .compose-panel{position:static;}
}
@media(max-width:620px){
  .unit-grid{grid-template-columns:1fr;}
  .swatch-grid{grid-template-columns:repeat(4,1fr);}
}

/* ---------- AI Assistant slide-in panel (available on any page) ---------- */
.ai-panel-backdrop{display:none; position:fixed; inset:0; background:rgba(7,11,20,.45); z-index:69;backdrop-filter: blur(3px);}
.ai-panel-backdrop.open{display:block;}
.ai-panel{
  position:fixed; top:0; left:0; height:100vh; width:100%; max-width:400px;
  background:var(--surface); border-right:1px solid var(--border); z-index:70;
  display:flex; flex-direction:column; 
  transform:translateX(-100%); transition:transform .28s ease;
}
.ai-panel.open{transform:translateX(0);}
.ai-panel-head{display:flex; align-items:center; justify-content:space-between; padding:18px 20px; border-bottom:1px solid var(--border); flex-shrink:0;}
.ai-panel-sub{font-size:12px; color:var(--ink-600); padding:12px 20px 0;}
.ai-panel-log{flex:1; overflow-y:auto; padding:16px 20px; display:flex; flex-direction:column; gap:12px;}
.ai-bubble{max-width:88%; padding:10px 14px; border-radius:14px; font-size:13.5px; line-height:1.5; white-space:pre-wrap;}
.ai-bubble-q{align-self:flex-end; background:var(--emerald-500); color:#fff; border-radius:14px 14px 4px 14px;}
.ai-bubble-a{align-self:flex-start; background:var(--gray-100); color:var(--ink-900); border-radius:14px 14px 14px 4px;}
.ai-bubble-thinking{display:flex; align-items:center; padding:12px 14px;}
.ai-panel-form{display:flex; gap:8px; padding:14px 20px; border-top:1px solid var(--border); flex-shrink:0;}
.ai-panel-form input{flex:1; padding:11px 13px; border-radius:11px; border:1.5px solid var(--border); font-size:13.5px; outline:none;}
.ai-panel-form input:focus{border-color:var(--emerald-500); box-shadow:0 0 0 4px rgba(23,105,255,.12);}
html[dir="rtl"] .ai-panel{left:auto; right:0; border-right:none; border-left:1px solid var(--border); transform:translateX(100%);}
html[dir="rtl"] .ai-panel.open{transform:translateX(0);}
html[dir="rtl"] .ai-bubble-q{align-self:flex-start; border-radius:14px 14px 14px 4px;}
html[dir="rtl"] .ai-bubble-a{align-self:flex-end; border-radius:14px 14px 4px 14px;}
@media(max-width:480px){ .ai-panel{max-width:100%;} }

/* ---------- Floating action buttons (AI Assistant + scroll-to-top) ---------- */
.fab22{
position: relative;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #FFF9DD;
    border: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
   transition:transform .15s ease, opacity .2s ease, box-shadow .15s ease;
}

.fab{
  position:fixed; right:22px; width:52px; height:52px; border-radius:50%; border:none;
  display:flex; align-items:center; justify-content:center; cursor:pointer; z-index:65;
  transition:transform .15s ease, opacity .2s ease, box-shadow .15s ease;
}
.fab:hover{transform:translateY(-2px) scale(1.04); }
.fab-ai{background:linear-gradient(135deg,var(--emerald-500),var(--emerald-700)); color:#fff;}
.fab-top{
  bottom:25px; background:var(--surface); color:var(--ink-600); border:1.5px solid var(--border);
  width:42px; height:42px; opacity:0; pointer-events:none; transform:translateY(8px);
}
.fab-top.visible{opacity:1; pointer-events:auto; transform:translateY(0);}
html[dir="rtl"] .fab{right:auto; left:22px;}
@media(max-width:640px){
  .fab-ai{right:16px; bottom:16px; width:48px; height:48px;}
  .fab-top{right:16px; bottom:74px;}
  html[dir="rtl"] .fab-ai{right:auto; left:16px;}
  html[dir="rtl"] .fab-top{right:auto; left:16px;}
}

/* ---------- Mobile menu / drawer ---------- */
.mobile-menu-btn{display:none; background:var(--surface); border:1.5px solid var(--border); border-radius:11px; width:38px; height:38px; align-items:center; justify-content:center; color:var(--ink-900); cursor:pointer;}
.sidebar-backdrop{display:none; position:fixed; inset:0; background:rgba(7,11,20,.55); z-index:59;backdrop-filter: blur(3px);}
.sidebar-backdrop.open{display:block;}
@media(max-width:980px){
  .sidebar{position:fixed; left:0; top:0; z-index:60; transform:translateX(-100%); transition:transform .25s ease; }
  html[dir="rtl"] .sidebar{left:auto; right:0; transform:translateX(100%);}
  html[dir="rtl"] .sidebar.open{transform:translateX(0%);}
  .sidebar.open{transform:translateX(0);}
  .mobile-menu-btn{display:flex;}
  .hide-mobile{display:none;} 
}
@media(min-width:981px){
  .sidebar-backdrop{display:none !important;}
}
@media(max-width:480px){
  .hide-mobile-inline{display:none;}
}

/* ---------- Sitewide loading indicator ---------- */
/* Slim top progress bar — shown on page navigation, modal loads, and any
   form submission so the user always has feedback that something is
   happening rather than a frozen-looking page. */
#page-loading-bar{position:fixed; top:0; left:0; height:3px; width:0%; background:var(--emerald-500);
  z-index:9999; transition:width .3s ease, opacity .25s ease;  opacity:0;}
#page-loading-bar.active{opacity:1;}
/* Full-page loading overlay — shown while navigating to another page, so
   the transition never looks frozen even before the new page has anything
   to paint. Fades in only if the load takes a moment (see JS delay). */
/* Spinner shown inside the modal body while its content is being fetched */
.modal-loading-spin{display:flex; align-items:center; justify-content:center; padding:60px 20px; color:var(--ink-600);}
.modal-loading-spin svg{animation:spin828 .8s linear infinite;}
@keyframes spin828{to{transform:rotate(360deg);}}
/* Button-level loading state — disabled + spinner replaces the label text
   while a form it belongs to is submitting, so double-clicks can't
   double-submit and there's always visible feedback on the button itself. */
button.btn-loading, .btn.btn-loading{position:relative; color:transparent !important; pointer-events:none;}
button.btn-loading::after, .btn.btn-loading::after{
  content:""; position:absolute; top:50%; left:50%; width:15px; height:15px; margin:-7.5px 0 0 -7.5px;
  border:2px solid rgba(255,255,255,.5); border-top-color:#fff; border-radius:50%; animation:spin828 .7s linear infinite;
}
.btn-outline.btn-loading::after, .btn-danger.btn-loading::after{border-color:rgba(0,0,0,.15); border-top-color:var(--ink-600);}

/* ---------- Icon-button tooltips ---------- */
/* Pure CSS: reads the existing `title` attribute every icon-only button
   already has (mini-btn, the AI assistant FAB, sidebar collapse, view
   toggles, ...) via attr(title) — no markup or JS changes needed, and
   nothing about the button's own layout/click behavior is touched.
   The native browser title tooltip still exists underneath for
   accessibility; this custom one just appears first since it has no
   hover delay. */
.mini-btn[title], .fab22[title], .sidebar-collapse-btn[title],
.view-toggle-group button[title], .modal-close-x[title]{position:relative;}

.mini-btn[title]::after, .fab22[title]::after, .sidebar-collapse-btn[title]::after,
.view-toggle-group button[title]::after, .modal-close-x[title]::after{
  content:attr(title);
  position:absolute;
  top:calc(100% + 8px);
  left:50%;
  transform:translate(-50%,-4px);
  background:#1C1C1E;
  color:#fff;
  font-family:var(--font-body);
  font-size:11.5px;
  font-weight:600;
  line-height:1.3;
  letter-spacing:.01em;
  padding:6px 10px;
  border-radius:8px;
  white-space:nowrap;
  box-shadow:0 8px 20px -4px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.06);
  pointer-events:none;
  opacity:0;
  visibility:hidden;
  z-index:199999;
  transition:opacity .16s ease, transform .16s ease, visibility .16s;
}
/* Small arrow pointing up at the button */
.mini-btn[title]::before, .fab22[title]::before, .sidebar-collapse-btn[title]::before,
.view-toggle-group button[title]::before, .modal-close-x[title]::before{
  content:"";
  position:absolute;
  top:calc(100% - 2px);
  left:50%;
  transform:translateX(-50%);
  border:5px solid transparent;
  border-bottom-color:#1C1C1E;
  pointer-events:none;
  opacity:0;
  visibility:hidden;
  z-index:99999;
  transition:opacity .16s ease, visibility .16s;
}
.mini-btn[title]:hover::after, .fab22[title]:hover::after, .sidebar-collapse-btn[title]:hover::after,
.view-toggle-group button[title]:hover::after, .modal-close-x[title]:hover::after,
.mini-btn[title]:hover::before, .fab22[title]:hover::before, .sidebar-collapse-btn[title]:hover::before,
.view-toggle-group button[title]:hover::before, .modal-close-x[title]:hover::before{
  opacity:1;
  visibility:visible;
  transform:translate(-50%,0);
}
/* Buttons near the top of the viewport (e.g. inside a scrolled table
   header or a modal header) flip the tooltip above instead, so it never
   gets clipped by an ancestor's overflow:hidden or the viewport edge. */
.modal-close-x[title]::after{top:auto; bottom:calc(100% + 8px); transform:translate(-50%,4px);}
.modal-close-x[title]::before{top:auto; bottom:calc(100% + 3px); border-bottom-color:transparent; border-top-color:#1C1C1E;}
.modal-close-x[title]:hover::after, .modal-close-x[title]:hover::before{transform:translate(-50%,0);}

/* ---------- Collapsed-sidebar scrollbar ---------- */
/* Sidebar nav still scrolls when the item list is long, but the
   scrollbar track itself is hidden for a cleaner rail. */
.sidebar-nav{scrollbar-width:none; -ms-overflow-style:none;}
.sidebar-nav::-webkit-scrollbar{display:none;}

/* ---------- Collapsed-sidebar nav-item tooltips ---------- */
/* When the sidebar is collapsed, only the icon is visible (label span
   is display:none). .sidebar-nav has overflow-y:auto to allow
   scrolling, which also clips anything that pokes out past its right
   edge (including a pure-CSS ::after tooltip) and would sit under the
   topbar/main content. So this is built as a single reused tooltip
   element appended straight to <body> and positioned with JS via
   getBoundingClientRect — it can never be clipped by the sidebar's
   scroll container and always renders above everything else. */
#nav-tooltip{
  position:fixed;
  background:#1C1C1E;
  color:#fff;
  font-family:var(--font-body);
  font-size:11.5px;
  font-weight:600;
  line-height:1.3;
  letter-spacing:.01em;
  padding:6px 10px;
  border-radius:8px;
  white-space:nowrap;
  pointer-events:none;
  opacity:0;
  visibility:hidden;
  z-index:99999;
  transition:opacity .12s ease, transform .12s ease, visibility .12s;
}
#nav-tooltip::after{
  content:"";
  position:absolute;
  top:50%;
  border:5px solid transparent;
}
#nav-tooltip.pos-right::after{left:-9px; transform:translateY(-50%); border-right-color:#1C1C1E;}
#nav-tooltip.pos-left::after{right:-9px; transform:translateY(-50%); border-left-color:#1C1C1E;}
#nav-tooltip.show{opacity:1; visibility:visible;}

.PDF:hover {
  box-shadow:0 0 0 4px #e91e6336 !important;
}
.Excel:hover {
  box-shadow:0 0 0 4px rgba(23,105,255,.12);
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

button:focus,
button:active,
a:focus,
a:active,
input:focus,
input:active,
select:focus,
select:active,
textarea:focus,
textarea:active {
    outline: none;
    box-shadow: none;
}



input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    background: #1769FF;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}