/* =====================================================================
   ALMAJAD CRM 3.6.33 | VISUAL ONLY
   Original Almajad United Polyclinic blue/orange logo and colors.
   Zero changes to permissions, handlers, forms, payments or database.
   Latest override: intentionally placed AFTER all existing CSS.
   ===================================================================== */
:root{
  --a33-blue:#1055a1;
  --a33-deep:#092f5c;
  --a33-navy:#082b4d;
  --a33-orange:#fa6726;
  --a33-ink:#102f50;
  --a33-muted:#6a8093;
  --a33-line:#dce7f1;
  --a33-sky:#eaf3fd;
  --a33-radius:19px;
  --a33-shadow:0 11px 35px rgba(22,67,117,.065);
}
*{box-sizing:border-box}
html{max-width:100%;-webkit-text-size-adjust:100%}
body{max-width:100%;color:var(--a33-ink)}
.app-body{background:radial-gradient(ellipse at 95% 0%,#e9f3ff 0%,transparent 36%),linear-gradient(150deg,#f4f8fd,#edf3f9 70%,#f9fbff);}
.app-body .app-layout,.app-body .workspace,.app-body .main-content{min-width:0}
.app-body .workspace{max-width:100%}
.app-body .main-content{max-width:1760px;margin-inline:auto;}
.app-body .main-content .panel,.app-body .main-content .v33-fastsearch,
.app-body .main-content .crm362-filter-panel{
  border:1px solid var(--a33-line);border-radius:var(--a33-radius);
  box-shadow:var(--a33-shadow);background-color:#fff;
}
.app-body h1,.app-body h2,.app-body h3{color:var(--a33-ink)}
.app-body :is(.btn-primary,button.btn-primary,a.btn-primary){
 background:linear-gradient(115deg,#0b3766,#1161ad)!important;color:#fff!important;
 border:1px solid transparent;border-radius:12px;
 box-shadow:0 7px 17px rgba(12,76,143,.17);
 transition:transform .18s ease,box-shadow .18s ease,filter .18s ease;
}
.app-body :is(.btn-primary,button.btn-primary,a.btn-primary):hover{
 transform:translateY(-1px);box-shadow:0 11px 22px rgba(12,76,143,.23);filter:brightness(1.05)
}
.app-body :is(input,select,textarea){accent-color:var(--a33-blue)}
.app-body :is(input,textarea,select):focus-visible{outline:2px solid #4293ec;outline-offset:2px}
/* Main navigation: same pages and roles, new visual language */
.app-body .sidebar{background:linear-gradient(166deg,#092e52 3%,#0a416f 60%,#071e3b 100%)!important;
 border-inline-start:1px solid #164a71;box-shadow:-6px 0 26px rgba(6,39,78,.09);color:#ecf5ff}
.app-body .side-brand{padding-block:20px 15px;border-bottom:1px solid #ffffff19;}
.app-body .side-brand .sidebar-logo{
 width:90px;max-width:90px;height:58px;max-height:58px;object-fit:contain;
 padding:5px;background:#fff;border-radius:13px;filter:none;flex:none;
}
.app-body .side-brand strong{color:#fff;font-size:14px}
.app-body .side-brand small,.app-body .sidebar-caption{color:#afc8e5!important}
.app-body .side-nav .nav-link{
 color:#d0e1f4!important;border:1px solid transparent;border-radius:12px;
 margin-block:4px;min-height:44px;transition:background .18s ease,transform .18s ease,border-color .18s ease;
}
.app-body .side-nav .nav-link .icon{color:#b4d1ee}
.app-body .side-nav .nav-link:hover{
 background:rgba(255,255,255,.095)!important;transform:translateX(-3px);color:#fff!important;
 border-color:rgba(255,255,255,.08);
}
.app-body .side-nav .nav-link.active{
 background:linear-gradient(112deg,#0961a1,#0d78b4)!important;color:#fff!important;
 box-shadow:inset -3px 0 var(--a33-orange),0 6px 16px rgba(0,14,42,.17)!important;
}
.app-body .side-nav .nav-link.active .icon{color:#fff}
.app-body .sidebar-bottom{border-top:1px solid #ffffff1d;background:transparent}
.app-body .sidebar-profile strong{color:#fff}
.app-body .sidebar-profile small{color:#b1cee7}
.app-body .signout{color:#e4effb!important;background:rgba(255,255,255,.075)!important;border-radius:11px}
/* Desktop navigation tooltip: purely native title stays available via existing data-tooltip */
.app-body .topbar{background:rgba(255,255,255,.93);border-bottom:1px solid #dce7ef;
 box-shadow:0 2px 10px rgba(15,66,113,.035);backdrop-filter:blur(14px)}
.app-body .breadcrumb,.app-body .ksa-label{color:#506f8a}
.app-body .topbar .user-circle{background:linear-gradient(130deg,#115db1,#1b83bc);box-shadow:0 5px 16px #155da63b}
/* Home greeting: retain existing buttons, name, metrics, and server data */
.app-body .v33-welcome{position:relative;isolation:isolate;overflow:hidden;border-radius:23px!important;
 min-height:185px;padding:clamp(23px,3vw,38px)!important;
 background:linear-gradient(112deg,rgba(8,47,94,.99),rgba(16,83,146,.95) 65%,rgba(19,108,165,.94))!important;
 color:#fff;box-shadow:0 13px 28px rgba(17,79,140,.14)}
.app-body .v33-welcome::before{content:"";position:absolute;z-index:-1;
 width:520px;height:520px;left:-125px;top:-190px;border-radius:50%;
 border:65px solid #ffffff0b;box-shadow:0 0 0 120px #ffffff05;pointer-events:none}
.app-body .v33-welcome::after{content:"";position:absolute;inset:0;z-index:-1;
 background:linear-gradient(270deg,transparent 48%,rgba(3,28,63,.36)),url('/assets/img/tenant-logo.png') left 28px center / 135px auto no-repeat;
 opacity:.11;pointer-events:none}
.app-body .v33-welcome :is(h1,p,.v33-date,.v33-overline){color:#fff!important}
.app-body .v33-welcome h1{font-size:clamp(25px,3vw,39px);letter-spacing:-.02em}
.app-body .v33-welcome p{opacity:.87;font-size:14px;line-height:1.85}
.app-body .v33-welcome .v33-overline{font-weight:800;letter-spacing:.07em;opacity:.72}
.app-body .v33-welcome .btn.btn-primary{background:#fff!important;color:#0a4478!important;box-shadow:none}
.app-body .v33-welcome .btn.btn-subtle{background:rgba(255,255,255,.10)!important;border:1px solid #ffffff55!important;color:#fff!important}
.app-body .v33-heading h2{font-size:clamp(18px,1.8vw,24px);font-weight:900}
.app-body .v33-kpi{min-width:0;background:linear-gradient(145deg,#fff,#f9fbfe)!important;border:1px solid #e1eaf3!important;
 border-radius:18px!important;box-shadow:var(--a33-shadow)!important;transition:transform .18s ease,box-shadow .18s ease}
.app-body .v33-kpi:hover{transform:translateY(-3px);box-shadow:0 16px 34px rgba(20,75,121,.13)!important}
.app-body .v33-kpi strong{color:#113f72!important;font-size:clamp(24px,2.6vw,32px)}
.app-body .v33-kpi-icon{border-radius:13px!important}
.app-body .v33-queue-card{min-width:0;border:1px solid #deebf5!important;border-radius:16px!important;
 box-shadow:0 6px 17px rgba(8,57,105,.04)!important;background:#fff!important;
 transition:transform .18s ease,box-shadow .18s ease}
.app-body .v33-queue-card:hover{transform:translateY(-2px);box-shadow:0 11px 22px rgba(12,60,107,.10)!important}
.app-body .v33-queue-card strong,.app-body .v33-queue-card b{color:#194c78}
.app-body .v33-queue-icon{border-radius:12px}
.app-body .crm362-customers thead th{background:#0c416d!important}
.app-body .crm362-customers .crm362-data-row:hover{background:#f2f7ff!important}
.app-body .crm362-phone{color:#1055a1;background:#eef6ff}
/* One coherent brand palette for analytic containers; DO NOT change chart datasets. */
.app-body .crm3626-chart-bar{background:linear-gradient(155deg,#ff925e,#fa6726 38%,#135aa5)}
.app-body .crm3626-chart-empty{background:#f6f9ff;border-color:#cedeed}
.app-body .crm3626-archive-hero{background:linear-gradient(115deg,#0a315e,#17609e)}
/* ========================= LOGIN SCREEN ========================= */
.login-body{background:radial-gradient(circle at 14% 4%,#e3f1ff,transparent 43%),linear-gradient(145deg,#eef5fc,#f6f9fe)!important;color:var(--a33-ink)}
.login-body::before{background:radial-gradient(circle at 86% 76%,#f7a57d28,transparent 32%),radial-gradient(circle at 0% 15%,#4f9bea24,transparent 35%)}
.login-body .login-wrap{width:min(1240px,calc(100% - 50px))!important;min-height:640px;
 grid-template-columns:minmax(350px, .85fr) minmax(390px,1.15fr)!important;
 border-radius:28px!important;border:1px solid #fff!important;
 box-shadow:0 30px 92px rgba(13,59,103,.18)!important}
.login-body .login-card{padding:55px clamp(28px,4vw,67px)!important;
 background:linear-gradient(165deg,#fff,#f7faff)!important;}
.login-body .crm365-login-header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px}
.login-body img.login-logo{display:block;max-width:195px;width:195px;max-height:125px;height:auto;object-fit:contain;filter:none!important}
.login-body .crm365-workspace-badge{color:#1e619b;background:#ecf5ff;border:1px solid #dbe9f9;border-radius:999px;
 letter-spacing:.08em;font-size:10px;padding:7px 10px}
.login-body .login-intro{margin:20px 0 28px!important}
.login-body .login-intro .eyebrow{color:#f06c32!important;letter-spacing:.02em!important}
.login-body .login-intro h1{color:var(--a33-deep)!important;font-size:clamp(28px,2.8vw,38px)!important;font-weight:900}
.login-body .login-intro p{color:#6f8397!important}
.login-body .login-form .input-wrap{background:#f9fbff!important;border:1px solid #d7e4f1!important;border-radius:13px!important;min-height:52px}
.login-body .login-form .input-wrap:focus-within{border-color:#3083d6!important;box-shadow:0 0 0 3px #2e88e419!important}
.login-body .login-form input{font-size:16px!important;min-width:0!important}
.login-body .login-form label{color:#294a6e}
.login-body .login-form .btn-primary{background:linear-gradient(105deg,#0a315e,#0d62ad)!important;
 box-shadow:0 10px 22px #1759a13a!important;min-height:54px;color:#fff!important;border-radius:13px!important}
.login-body .login-footer{color:#7d93a9}
.login-body .login-aside.crm365-aside{
 min-width:0!important;min-height:640px;position:relative;isolation:isolate;overflow:hidden;
 background:linear-gradient(0deg,rgba(3,27,57,.93),rgba(8,49,93,.30) 63%,rgba(7,32,64,.12)),
 url('/assets/img/tenant-soft-bg.webp') center / cover no-repeat!important;color:#fff;
}
.login-body .crm365-aside-art{opacity:.50}
.login-body .crm365-aside-content{position:relative;z-index:2;padding:clamp(30px,4vw,57px)!important}
.login-body .crm365-aside-content h2{color:#fff!important;font-size:clamp(30px,3.5vw,48px)}
.login-body .crm365-aside-content h2 em{color:#ffc9aa!important;font-style:normal}
.login-body .crm365-aside-content p{color:#e3edf7}
.login-body .crm365-aside-metrics span{background:#ffffff1d!important;border:1px solid #ffffff36;border-radius:11px}
/* ==================== RESPONSIVE MODALS ==================== */
/* A desktop modal keeps its current content/actions, with reliable box sizing. */
.crm362-overlay,.crm360-modal-backdrop{box-sizing:border-box;min-width:0;max-width:100%;overflow-x:hidden;overscroll-behavior:contain}
.crm362-dialog,.crm360-modal{box-sizing:border-box!important;min-width:0!important;}
.crm362-dialog *,.crm360-modal *{box-sizing:border-box;}
.crm362-dialog :is(input,select,textarea),.crm360-modal :is(input,select,textarea){min-width:0!important;max-width:100%!important;}
.crm362-dialog .crm362-fields>*,.crm360-modal :is(.v33-action,.crm360-attend-grid,.crm360-extra-form)>*{min-width:0;max-width:100%;}
.crm362-dialog .crm362-dialog-head{position:relative}
.crm362-dialog .crm362-dialog-head h2{color:#113f72}
.crm362-dialog .crm362-dismiss,.crm360-modal .crm360-close{border-radius:11px;background:#eaf3ff;color:#144f88}
.crm362-dialog .crm362-actions{background:linear-gradient(0deg,#fff 75%,#ffffffec);}
/* Mobile: no page horizontal dragging; dialogs fit the VISUAL viewport. */
@media(max-width:860px){
 .login-body .login-wrap{grid-template-columns:1fr!important;max-width:570px;margin:18px auto!important;min-height:0!important}
 .login-body .login-card{padding:37px 31px!important}
 .login-body .login-aside.crm365-aside{min-height:215px!important}
 .login-body .crm365-aside-content{padding:27px 31px!important}
 .login-body .crm365-aside-content h2{font-size:27px!important}
 .app-body .v33-welcome{min-height:155px;padding:22px!important}
 .app-body .v33-welcome::after{background-size:85px auto}
}
@media(max-width:700px){
 html,body.app-body,body.login-body{width:100%;max-width:100%;overflow-x:clip!important}
 .app-body .app-layout,.app-body .workspace,.app-body .main-content{width:100%;max-width:100%;min-width:0!important}
 .app-body .main-content{padding-inline:12px!important}
 .app-body .main-content .panel{max-width:100%;min-width:0}
 .app-body .v33-home-kpis{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
 .app-body .v33-kpi{padding:15px 12px!important}
 .app-body .v33-kpi strong{font-size:clamp(20px,5vw,27px)!important;overflow-wrap:anywhere}
 .app-body .v33-queue-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
 .app-body .v33-queue-card{padding:12px 10px!important}
 .app-body .v33-queue-card strong{font-size:12px!important}
 .app-body .v33-queue-card b{font-size:20px!important}
 .app-body .v33-welcome{border-radius:16px!important;gap:15px}
 .app-body .v33-welcome h1{font-size:clamp(23px,6vw,29px)!important}
 .app-body .v33-welcome-buttons{display:flex;flex-wrap:wrap;gap:8px}
 .app-body .v33-welcome-buttons .btn{flex:1 1 auto;min-width:0;font-size:12px}
 /* Important: full-screen native-feeling sheet for the customer editor */
 .crm362-overlay{position:fixed!important;inset:0!important;padding:0!important;z-index:9999!important;
    display:flex!important;align-items:stretch!important;justify-content:stretch!important;
    width:100vw!important;max-width:100vw!important;height:100dvh!important;max-height:100dvh!important;
    overflow:hidden!important}
 .crm362-overlay[hidden]{display:none!important}
 .crm362-dialog{position:relative!important;inset:auto!important;transform:none!important;
    flex:1 1 auto!important;display:block!important;max-width:100vw!important;width:100vw!important;min-width:0!important;
    height:100dvh!important;max-height:100dvh!important;min-height:0!important;
    padding:18px 16px calc(23px + env(safe-area-inset-bottom,0px))!important;
    border:0!important;margin:0!important;border-radius:0!important;
    overflow-y:auto!important;overflow-x:hidden!important;
    overscroll-behavior-y:contain;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;
    box-shadow:none!important;background:#fff!important;}
 .crm362-dialog-head{padding-bottom:13px!important;margin-bottom:15px!important}
 .crm362-dialog .crm362-fields{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important}
 .crm362-dialog .crm362-appointment{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important}
 .crm362-dialog :is(input,select,textarea){width:100%!important;min-width:0!important;max-width:100%!important;font-size:16px!important;
    padding:12px!important;border-radius:12px;white-space:normal}
 .crm362-dialog .crm362-wide{grid-column:auto!important}
 .crm362-dialog .crm362-actions{display:flex!important;flex-direction:column-reverse!important;gap:9px;
    padding:14px 0 calc(8px + env(safe-area-inset-bottom,0px))!important}
 .crm362-dialog .crm362-actions .btn{width:100%!important;min-height:47px}
 .crm362-dialog :is(.crm362-service-form,.crm364-extra-service,.crm3614-history,.crm3614-note-form){min-width:0!important;width:100%!important;max-width:100%!important}
 /* Appointments screen: same data and privileges, a FULL mobile sheet not a wide desktop modal */
 .crm360-modal-backdrop{position:fixed!important;inset:0!important;padding:0!important;max-width:100vw!important;
    width:100vw!important;height:100dvh!important;max-height:100dvh!important;overflow:hidden!important;
    display:flex!important;align-items:stretch!important;justify-content:stretch!important;z-index:9998!important}
 .crm360-modal-backdrop[hidden]{display:none!important}
 .crm360-modal-backdrop .crm360-modal{position:relative!important;inset:auto!important;transform:none!important;
    margin:0!important;width:100vw!important;max-width:100vw!important;min-width:0!important;
    height:100dvh!important;max-height:100dvh!important;min-height:0!important;
    padding:22px 16px calc(30px + env(safe-area-inset-bottom,0px))!important;
    overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;border-radius:0!important;box-shadow:none!important}
 .crm360-modal .v33-detail-facts,.crm360-modal .v33-action,.crm360-modal :is(.crm360-extra-form,.crm360-attend-grid){
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;max-width:100%;min-width:0}
 .crm360-modal :is(input,select,textarea,button){font-size:16px!important;max-width:100%!important;min-width:0!important}
 .crm360-modal .v33-action-footer{flex-direction:column;align-items:stretch}
 .crm360-modal .v33-action-footer .btn{width:100%!important}
 .crm360-modal :is(.v33-notes,.v33-detail-facts,.crm367-note-log){max-width:100%!important;min-width:0!important;overflow-wrap:anywhere}
}
@media(max-width:440px){
 .login-body .login-wrap{width:calc(100% - 18px)!important;margin:9px auto!important;border-radius:17px!important}
 .login-body .login-card{padding:28px 21px!important}
 .login-body img.login-logo{width:160px!important;max-height:99px!important}
 .login-body .login-intro h1{font-size:29px!important}
 .login-body .crm365-workspace-badge{font-size:9px}
 .login-body .login-aside.crm365-aside{min-height:168px!important}
 .login-body .crm365-aside-content{padding:20px!important}
 .login-body .crm365-aside-content h2{font-size:23px!important;margin:0 0 7px}
 .login-body .crm365-aside-content p{font-size:12px!important;margin:0!important}
 .crm362-dialog{padding-inline:13px!important}
 .crm360-modal-backdrop .crm360-modal{padding-inline:13px!important}
}
@media(prefers-reduced-motion:reduce){
 .app-body .side-nav .nav-link,.app-body .v33-kpi,.app-body .v33-queue-card,.app-body .btn-primary{transition:none!important}
}
