@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

html,body,button,input,select,textarea{font-family:Vazirmatn,Tahoma,Arial,sans-serif!important;font-feature-settings:'ss01' 1,'tnum' 1;text-rendering:optimizeLegibility}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{font-size:14px}
body>aside nav button,body>aside nav .nav-link{font-size:13px!important;line-height:1.65!important}
body>aside nav details summary{font-size:12px!important;line-height:1.6}
body>main h1{font-weight:750;letter-spacing:-.45px}
body>main h2{font-weight:700}
.stats article strong{font-weight:750}
.list-row{font-size:13px;line-height:1.8}
.hero h1{font-weight:560!important;letter-spacing:-1.5px}
.hero-copy>p,.intro p,.doctor-copy p{font-size:15px;line-height:2.05}
.top nav a{font-weight:500}

/* MegaClinic CRM mobile layer — desktop layout remains unchanged. */
.mobile-menu-toggle,.mobile-menu-shade{display:none}

@media(max-width:900px){
  body:has(>aside){display:block;overflow-x:hidden}
  body>aside{width:min(86vw,320px)!important;padding:18px 14px max(22px,env(safe-area-inset-bottom))!important;transform:translateX(110%);transition:transform .24s ease;z-index:1000;box-shadow:-18px 0 55px #061f1b4d;overflow-y:auto;overscroll-behavior:contain}
  body.mobile-menu-open>aside{transform:translateX(0)}
  body.mobile-menu-open{overflow:hidden}
  body>aside .brand{padding:2px 6px 17px!important}
  body>aside .brand div,body>aside .clinic{display:block!important}
  body>aside nav{display:grid!important;gap:4px!important;margin-top:15px!important;padding-bottom:20px}
  body>aside nav button,body>aside nav .nav-link{display:flex!important;align-items:center;width:100%;min-height:46px;padding:11px 13px!important;border-radius:11px;text-decoration:none;color:#dbe9e6;text-align:right;font-size:13px!important;white-space:normal}
  body>aside nav details{border:1px solid #ffffff12;border-radius:12px;overflow:hidden}
  body>aside nav details summary{display:block;padding:13px;color:#e6efed;cursor:pointer;font-size:12px!important;list-style:none}
  body>aside nav details summary::-webkit-details-marker{display:none}
  body>aside nav details[open] summary{background:#ffffff0d;color:#d8b879}
  body>aside .nav-section-title{font-size:10px!important;margin:6px 12px;color:#9eb6b1}
  body>aside .clinic{margin-top:10px!important;font-size:11px}
  body>main{width:100%!important;max-width:none!important;margin:0!important;padding:76px 18px 28px!important}
  body>main>header{display:grid!important;grid-template-columns:1fr auto;gap:10px 14px;align-items:start!important;margin-bottom:18px!important}
  body>main>header>div:first-child{min-width:0}
  body>main>header h1{font-size:22px!important;padding-left:50px}
  body>main>header p{font-size:12px;line-height:1.8;margin-top:4px}
  body>main>header .today{display:none!important}
  .mobile-menu-toggle{display:grid;place-items:center;position:fixed;z-index:1100;top:max(14px,env(safe-area-inset-top));right:14px;width:47px;height:47px;border:0;border-radius:14px;background:#0e5c53;color:#fff;box-shadow:0 8px 24px #0d494338;font-size:0;cursor:pointer}
  .mobile-menu-toggle:before{content:'☰';font-size:23px;line-height:1}
  body.mobile-menu-open .mobile-menu-toggle:before{content:'×';font-size:29px}
  .mobile-menu-shade{display:block;position:fixed;inset:0;z-index:900;background:#071d1a8f;opacity:0;visibility:hidden;transition:.2s;backdrop-filter:blur(2px)}
  body.mobile-menu-open .mobile-menu-shade{opacity:1;visibility:visible}
  .header-actions{grid-column:1/-1;display:grid!important;grid-template-columns:1fr 1fr;gap:8px;width:100%}
  .header-actions>*{display:flex!important;justify-content:center;align-items:center;min-height:44px;margin:0!important;padding:9px!important;font-size:11px!important;text-align:center;text-decoration:none}
  .header-actions .backup{display:none!important}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .stats article{padding:16px!important;min-height:104px}
  .stats article strong{font-size:18px!important;margin-top:9px!important;overflow-wrap:anywhere}
  .panel{padding:16px!important;border-radius:15px!important}
  .panel-head,.toolbar{align-items:stretch!important;gap:10px;flex-wrap:wrap}
  .panel-head>* ,.toolbar>*{max-width:none!important}
  .toolbar input{flex:1 1 100%;min-height:46px}
  .toolbar .primary,.panel-head .primary{min-height:44px}
  .list-row{display:grid!important;grid-template-columns:1fr!important;gap:8px!important;margin-bottom:10px;padding:15px!important;border:1px solid #e2ebe8!important;border-radius:14px;background:#fff;box-shadow:0 4px 16px #123d3808}
  .list-row>span{display:block}
  .list-row>.actions,.list-row .actions{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;width:100%}
  .list-row .actions>*{display:flex;align-items:center;justify-content:center;min-height:42px;padding:7px!important;text-align:center;white-space:normal}
  .cards,.branch-grid{grid-template-columns:1fr!important;gap:11px!important}
  .cards article,.branch-grid article{min-height:auto!important;padding:19px!important}
  .invoice-grid{grid-template-columns:1fr!important;gap:10px!important}
  .invoice-item{grid-template-columns:1fr auto!important}
  .invoice-item .remove{grid-column:1/-1;min-height:38px;background:#fff0ef;border-radius:8px}
  input,select,textarea,button,.btn,.back{font-size:16px!important}
  input,select{min-height:46px}
  textarea{min-height:110px}
  .modal{align-items:end!important;padding:0!important}
  .modal-card{width:100%!important;max-height:92dvh!important;border-radius:22px 22px 0 0!important;padding:24px 18px max(24px,env(safe-area-inset-bottom))!important}
  #toast{left:12px!important;right:12px!important;bottom:max(12px,env(safe-area-inset-bottom))!important;text-align:center;line-height:1.8}
}

/* Shared mobile improvements for patient record, appointments and settings pages. */
@media(max-width:850px){
  body:not(:has(>aside)) .wrap{width:calc(100% - 20px)!important;margin:12px auto max(20px,env(safe-area-inset-bottom))!important}
  body:not(:has(>aside)) .top{display:flex!important;align-items:flex-start!important;flex-wrap:wrap;gap:10px!important;margin-bottom:14px!important}
  body:not(:has(>aside)) .top>div:first-child{flex:1 1 100%}
  body:not(:has(>aside)) .top h1{font-size:22px!important;line-height:1.55}
  body:not(:has(>aside)) .top p{font-size:12px;line-height:1.9}
  body:not(:has(>aside)) .top .actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px}
  body:not(:has(>aside)) .top .actions>*{display:flex;align-items:center;justify-content:center;min-height:44px;text-align:center}
  body:not(:has(>aside)) .card{padding:16px!important;border-radius:15px!important;overflow-x:auto}
  body:not(:has(>aside)) .grid,body:not(:has(>aside)) .layout{grid-template-columns:1fr!important;gap:12px!important}
  body:not(:has(>aside)) .kpis,body:not(:has(>aside)) .stats{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
  body:not(:has(>aside)) .table{min-width:680px}
  body:not(:has(>aside)) input,body:not(:has(>aside)) select,body:not(:has(>aside)) textarea,body:not(:has(>aside)) button,body:not(:has(>aside)) .btn,body:not(:has(>aside)) .back{font-size:16px!important}
  body:not(:has(>aside)) input,body:not(:has(>aside)) select,body:not(:has(>aside)) button,body:not(:has(>aside)) .btn,body:not(:has(>aside)) .back{min-height:44px}
  body:not(:has(>aside)) .event,body:not(:has(>aside)) .user,body:not(:has(>aside)) .row,body:not(:has(>aside)) .patient-row{grid-template-columns:1fr!important;gap:8px!important;border:1px solid #e2ebe8;border-radius:12px;margin-bottom:9px;padding:13px!important}
}

@media(max-width:520px){
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .header-actions{grid-template-columns:1fr 1fr}
  .header-actions .date-patients{grid-column:1/-1}
  .page-intro{margin:8px 0 20px!important}
  .page-intro h2{font-size:23px!important}
  body:not(:has(>aside)) .kpis,body:not(:has(>aside)) .stats{grid-template-columns:1fr 1fr!important}
}

@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important}}
