/* Customer and partner commerce flow */
.nav-cart{position:relative;border:1px solid rgba(207,166,74,.35)!important;background:rgba(207,166,74,.08)}
.nav-cart>b{display:inline-grid;place-items:center;min-width:20px;height:20px;margin-right:6px;padding:0 5px;border-radius:20px;background:#d5ad54;color:#07181d;font-size:11px}
.partner-welcome{display:flex;align-items:center;justify-content:space-between;gap:24px;margin:0 0 24px;padding:26px 30px;border-radius:24px;color:#fff;background:radial-gradient(circle at 10% 10%,rgba(213,173,84,.18),transparent 35%),linear-gradient(135deg,#071a20,#0d333b);box-shadow:0 20px 55px rgba(4,24,29,.18)}
.partner-welcome h1{margin:4px 0 8px;color:#fff}.partner-welcome p{margin:0;color:#c7d7db}.partner-welcome>span{white-space:nowrap;padding:10px 14px;border:1px solid rgba(255,255,255,.16);border-radius:99px;background:rgba(255,255,255,.07)}.partner-welcome>span.verified{color:#0c3328;background:#bcebd5;border-color:#bcebd5}
.cart-hero{border-radius:25px;padding:28px;background:linear-gradient(135deg,#f6f1e5,#fff 60%);border:1px solid #e7dcc2}.cart-layout-v2{align-items:start}.cart-lines{overflow:hidden}
.cart-kind{display:block;width:max-content;margin-bottom:7px;padding:4px 8px;border-radius:7px;background:#e8f1f2;color:#17424a;font-size:11px;font-weight:800}.money{display:block;color:#0a333a;font-size:17px;white-space:nowrap}.money small{font-size:11px}
.schedule-row>td{padding:0 14px 20px!important;background:#f6f9f9}.cart-schedule{padding:18px;border:1px solid #dce7e8;border-radius:18px;background:#fff}.cart-schedule>header{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:14px}.cart-schedule h3{margin:3px 0}
.schedule-ok,.schedule-required{padding:7px 11px;border-radius:10px;font-size:12px;font-weight:800}.schedule-ok{background:#def4e8;color:#14603c}.schedule-required{background:#fff0dd;color:#9a5311}.compact-days{max-height:205px;overflow:auto;padding:5px}.sticky-summary{position:sticky;top:105px}
.retail-price{display:block;margin-top:7px;color:#87959a;font-size:12px}.partner-caption,.partner-saving{display:block;color:#168059;font-size:11px;font-weight:800}.partner-original{display:block;color:#8b999d;margin:5px 0}.partner-label{color:#96701f!important;font-weight:800}
.invoice-sheet .inline-schedule form{display:none}
@media(max-width:760px){.partner-welcome,.cart-schedule>header{align-items:flex-start;flex-direction:column}.partner-welcome{padding:22px}.cart-hero{padding:22px 18px}.sticky-summary{position:static}.schedule-mode{grid-template-columns:1fr!important}.compact-days{display:flex!important;overflow:auto;max-height:none;padding-bottom:10px}.compact-days label{min-width:145px}.nav-cart{order:-1}}

/* Unified customer/partner portal and strict responsive safety */
.single-submit-hint{display:block;margin-top:12px;padding:9px 12px;border-radius:10px;background:#eef7f5;color:#216157}
.portal-tabs{display:flex;gap:8px;overflow-x:auto;margin:0 0 20px;padding:8px;border:1px solid #dce7e8;border-radius:16px;background:#fff;scrollbar-width:thin}
.portal-tabs a{display:flex;align-items:center;gap:7px;white-space:nowrap;padding:9px 13px;border-radius:11px;color:#52666c;font-size:13px;font-weight:800}
.portal-tabs a.active{color:#fff;background:#0b3034}.portal-tabs b{display:grid;place-items:center;min-width:21px;height:21px;padding:0 5px;border-radius:20px;background:#e8f0f1;color:#26484d;font-size:10px}
.portal-metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:0 0 20px}.portal-metrics a{display:flex;min-width:0;flex-direction:column;padding:20px;border:1px solid #dde7e8;border-radius:17px;background:#fff;box-shadow:0 8px 25px rgba(9,42,45,.06)}.portal-metrics b{overflow:hidden;color:#0b3439;font-size:24px;text-overflow:ellipsis}.portal-metrics span{color:#718186;font-size:12px}.portal-metrics .debt-stat{border-color:#f0d5d5;background:#fffafa}
.portal-summary-list{display:grid}.portal-summary-list>a{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:14px 4px;border-bottom:1px solid #eaf0f1}.portal-summary-list span{display:flex;min-width:0;flex-direction:column}.portal-summary-list small{color:#74858a}.portal-summary-list strong{white-space:nowrap;color:#176857}
img,video,canvas,iframe{max-width:100%}img{height:auto}svg{max-width:100%}.grid>*,.portal-start>*,.admin-content-grid>*,.management-grid>*,.checkout-layout>*,.product-detail>*,.package-card-grid>*,.promo-admin-grid>*{min-width:0}h1,h2,h3,p,a,td,th,small,strong{overflow-wrap:anywhere}.table-wrap{max-width:100%;-webkit-overflow-scrolling:touch}.table-wrap table{margin:0}input,select,textarea,button{max-width:100%}.main-product-image img,.product-card img,.team-card img{max-width:100%;object-fit:contain}
@media(max-width:760px){body{overflow-x:hidden}main{width:100%;max-width:100%;padding:24px 12px}.site-header{width:100%;padding-left:12px;padding-right:12px}.site-header nav{max-width:100%;overflow-x:auto;flex-wrap:nowrap;justify-content:flex-start;padding-bottom:6px}.site-header nav>a,.site-header nav>details,.site-header nav>form{flex:none}.ad-ticker{max-width:100%;overflow:hidden}.customer-portal-head{padding:22px 18px}.customer-portal-head h1{font-size:27px}.portal-tabs{margin-left:-4px;margin-right:-4px}.portal-start,.portal-metrics{grid-template-columns:1fr 1fr}.portal-start>a{padding:14px}.portal-start strong{display:none}.portal-metrics a{padding:15px}.portal-metrics b{font-size:19px}.portal-summary-list>a{align-items:flex-start;flex-direction:column}.portal-summary-list strong{white-space:normal}.cart-lines{overflow:visible}.cart-lines>.table-wrap{border:0;overflow:visible}.cart-lines>.table-wrap>table,.cart-lines>.table-wrap>table>tbody{display:block;min-width:0}.cart-lines>.table-wrap>table>thead{display:none}.cart-lines>.table-wrap>table>tbody>tr:not(.schedule-row){display:grid;grid-template-columns:1fr auto;gap:10px;margin-bottom:0;padding:14px;border:1px solid #dde7e8;border-radius:15px 15px 0 0;background:#fff}.cart-lines>.table-wrap>table>tbody>tr:not(.schedule-row)>td{display:block;padding:4px!important;border:0}.cart-lines>.table-wrap>table>tbody>tr:not(.schedule-row)>td:nth-child(2){grid-column:1/-1}.schedule-row{display:block;margin-bottom:18px}.schedule-row>td{display:block!important;padding:0!important}.cart-schedule{border-radius:0 0 15px 15px}.calc-two{grid-template-columns:1fr!important}.quantity-edit{display:flex!important;flex-direction:row!important}.quantity-edit input{min-width:70px}.messages{right:12px;left:12px;top:12px}.messages p{margin:6px 0}.global-stock-alert{max-width:calc(100% - 24px);margin:12px}.management-nav-v2,.admin-shell .management-nav{overflow-x:auto;flex-direction:row!important}.management-nav-v2 a{flex:none}.invoice-sheet,.admin-panel,.portal-panel,.form-card{max-width:100%}.invoice-title,.management-title,.builder-head{max-width:100%}.promo-admin-grid,.package-card-grid{grid-template-columns:1fr!important}}
@media(max-width:430px){.portal-start,.portal-metrics{grid-template-columns:1fr}.partner-welcome{border-radius:18px}.partner-welcome>span{white-space:normal}.compact-days label{min-width:130px}.logo{max-width:100%}.logo i{flex:none}}

/* Narrow-phone fixes after real-device review */
@media(max-width:560px){
  input,select,textarea{font-size:16px!important}
  .calculator-first-hero{display:flex!important;flex-direction:column;gap:22px;width:100%;overflow:visible}
  .calculator-first-hero>*{width:100%;min-width:0}
  .calc-demo-card{display:block!important;width:100%!important;height:auto!important;min-height:0!important;padding:18px!important;overflow:visible!important;border-radius:22px!important}
  .demo-head,.demo-project,.demo-offers,.calc-demo-card>a{width:100%;min-width:0}
  .demo-head{gap:8px;flex-wrap:wrap}.demo-project{padding:13px;margin:13px 0}.demo-project>div{min-width:0}.demo-project b,.demo-project small{white-space:normal}
  .demo-offers p{gap:8px;padding:9px!important}.demo-offers p span,.demo-offers p b{min-width:0;white-space:normal}
  .home-promotions{display:block!important;width:100%;max-width:100%;padding:16px!important;overflow:hidden!important}
  .home-promo-grid{display:grid!important;grid-template-columns:minmax(0,1fr)!important;width:100%;overflow:visible!important;padding:0!important}
  .home-promo-card{display:grid!important;grid-template-columns:minmax(78px,32%) minmax(0,1fr)!important;width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;min-height:148px;overflow:hidden!important;scroll-snap-align:none!important}
  .home-promo-card>img,.home-promo-card>.home-promo-placeholder{display:block;width:100%!important;height:100%!important;min-height:148px;object-fit:cover!important}
  .home-promo-card>div:last-child{min-width:0;padding:11px!important;overflow:visible!important}
  .home-promo-card header{gap:5px;align-items:flex-start;flex-wrap:wrap}.home-promo-card h3{font-size:13px!important;line-height:1.65}.home-promo-card footer{gap:6px;align-items:flex-start;flex-direction:column}.home-promo-card footer span{min-width:0}.home-promo-card footer strong,.home-promo-card footer>b{white-space:normal!important}
  .promo-detail-hero,.promo-detail-body{width:100%;max-width:100%;overflow:hidden}.promo-detail-hero>img,.promo-visual{height:auto;min-height:210px;object-fit:cover}
  .product-card,.service-card,.team-card,.package-card,.pricing-card{width:100%;max-width:100%;min-width:0;overflow:hidden}
}

/* Comprehensive live reporting */
.report-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin:18px 0}.report-kpis article{display:flex;min-width:0;flex-direction:column;padding:18px;border:1px solid #dce7e8;border-radius:16px;background:#fff}.report-kpis small{color:#72858a}.report-kpis b{overflow:hidden;color:#103a41;font-size:21px;text-overflow:ellipsis}.report-kpis em{font-size:10px;font-style:normal}.report-kpis .danger{border-color:#efd5d0;background:#fff9f8}.report-kpis .danger b{color:#a23d2d}.report-section{margin:18px 0}.report-section td:first-child{color:#71868b;font-weight:900}.report-filter{position:sticky;z-index:7;top:78px}
@media(max-width:900px){.report-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.report-filter{position:static}}
@media(max-width:560px){.report-kpis{grid-template-columns:1fr 1fr}.report-kpis article{padding:13px}.report-kpis b{font-size:17px}.month-board{padding:8px!important;overflow:visible!important}.month-weekdays{display:none!important}.month-grid{display:grid!important;grid-template-columns:1fr!important;min-width:0!important;gap:10px}.month-day{min-height:0!important;border-radius:15px!important}.month-day.blank{display:none}.month-day header>b{font-size:18px}.month-jobs{min-height:0}.calendar-bottom-forms{grid-template-columns:1fr!important}.month-toolbar{align-items:stretch;flex-direction:column}.month-toolbar form{display:grid;grid-template-columns:1fr 1fr}.month-toolbar button{grid-column:1/-1}}

/* Project summary, scheduling spacing and readable mobile invoice */
.project-summary-card{margin:22px 0;padding:24px;border:1px solid #dce6e7;border-radius:22px;background:#fff;box-shadow:0 12px 35px rgba(9,42,48,.07)}.project-summary-card header{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px}.project-summary-card h2{margin:3px 0}.project-summary-card header>span{padding:7px 11px;border-radius:20px;background:#e4f4ec;color:#176143;font-size:12px}.project-summary-card dl{display:grid;grid-template-columns:1fr 1fr;gap:0;margin:0;border:1px solid #e4ebec;border-radius:14px;overflow:hidden}.project-summary-card dl>div{display:flex;justify-content:space-between;gap:15px;padding:12px 14px;border-bottom:1px solid #e9eeee}.project-summary-card dt{color:#6e8085}.project-summary-card dd{margin:0;font-weight:800;text-align:left}.selected-project-date{padding:18px 20px;margin:22px 0;border-radius:17px;background:#eef7f5}.selected-project-date h2{margin:4px 0}.cart-schedule>.customer-schedule-fields{margin:18px 0}.cart-schedule>.customer-schedule-fields>.calc-two{gap:16px;margin-top:18px}.cart-schedule>.customer-schedule-fields>.calc-two label,.cart-schedule>label{display:flex;flex-direction:column;gap:8px}.cart-schedule>label{margin-top:18px}.invoice-sheet>.table-wrap{overflow-x:auto!important;border:1px solid #dce5e8}.invoice-table{table-layout:auto!important;min-width:760px!important}.invoice-table th{white-space:nowrap!important;overflow-wrap:normal!important}.invoice-table th:first-child,.invoice-table td:first-child{width:58px;min-width:58px;text-align:center}.invoice-table th:nth-child(2),.invoice-table td:nth-child(2){min-width:330px}.invoice-table th:nth-child(n+3),.invoice-table td:nth-child(n+3){min-width:115px;white-space:nowrap}.invoice-group-row td{white-space:normal!important}
@media(max-width:560px){.project-summary-card{padding:16px}.project-summary-card header{align-items:flex-start;flex-direction:column}.project-summary-card dl{grid-template-columns:1fr}.project-summary-card dl>div{align-items:flex-start;flex-direction:column;gap:4px}.project-summary-card dd{text-align:right}.cart-schedule>.customer-schedule-fields>.calc-two{display:grid!important;grid-template-columns:1fr!important;gap:14px!important}.cart-schedule select,.cart-schedule input,.cart-schedule textarea{width:100%!important}.invoice-sheet{overflow:hidden}.invoice-sheet>.table-wrap{margin-inline:0;border-radius:12px}.invoice-table{font-size:12px!important}.invoice-table th,.invoice-table td{padding:12px 10px!important;line-height:1.8}}

/* Mobile stability and touch-first UX */
html,body{width:100%;max-width:100%;overscroll-behavior-x:none}
body{overflow-x:clip}
@supports not (overflow:clip){body{overflow-x:hidden}}
main,header,footer,section,article,aside,form,nav,div{min-width:0}
.table-wrap{position:relative;max-width:100%;overscroll-behavior-inline:contain;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch}
.global-stock-alert{overflow:hidden}

@media(max-width:760px){
  html{overflow-x:hidden}
  body{position:relative;width:100%;overflow-x:hidden}
  main{overflow:visible;padding:22px 12px 88px}
  .site-header{position:sticky!important;top:0;display:flex!important;width:100%;max-width:100%;padding:10px 12px!important;gap:10px}
  .site-header .logo{align-self:center;min-width:48px}
  .site-header nav{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;max-width:100%;gap:7px!important;padding:0!important;overflow:visible!important}
  .site-header nav>a,.site-header nav>details,.site-header nav>form{width:100%;min-width:0!important;margin:0!important}
  .site-header nav>a,.site-header nav>details>summary,.site-header nav .ghost-button{display:flex;min-height:42px;align-items:center;justify-content:center;padding:7px 5px!important;border:1px solid rgba(255,255,255,.1);border-radius:10px;background:rgba(255,255,255,.055);font-size:11px!important;text-align:center;line-height:1.45;white-space:normal!important}
  .site-header nav .account-link,.site-header nav .nav-cart{border-color:rgba(255,176,0,.42)!important;background:rgba(255,176,0,.1)!important}
  .site-header .expert-menu{position:relative}
  .site-header .expert-menu>div{right:0;left:auto;width:min(290px,calc(100vw - 24px));max-width:calc(100vw - 24px)}
  .site-header nav form button{width:100%}
  .management-nav-v2,.admin-shell .management-nav{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;margin:0 0 20px!important;padding:8px!important;gap:8px!important;overflow:visible!important;border-radius:16px!important}
  .management-nav-v2>a,.management-nav-v2>details,.admin-shell .management-nav>a{width:100%;min-width:0!important}
  .management-nav-v2 summary,.management-nav-v2 .management-home-link{min-height:58px;padding:9px!important;border-radius:11px!important}
  .management-nav-v2 details>div{position:static!important;width:100%!important;min-width:0!important;margin-top:6px;box-shadow:none!important}
  .management-nav-v2 details[open]{grid-column:1/-1}
  .management-title,.dashboard-head,.customer-portal-head,.panel-title,.section-heading{align-items:stretch!important;flex-direction:column!important;gap:10px!important}
  .management-title>a,.dashboard-head>a,.customer-portal-head>a,.panel-title>a{width:100%;min-height:44px;text-align:center}
  .admin-panel,.portal-panel,.form-card,.panel{padding:17px!important;border-radius:17px!important}
  h1{font-size:clamp(25px,8vw,32px)!important;line-height:1.45}
  h2{font-size:clamp(20px,6vw,25px)!important;line-height:1.5}
  p{line-height:1.9}
  button,.button-link,.primary,.secondary{min-height:44px}
  .filters{display:grid!important;grid-template-columns:1fr!important;width:100%;gap:10px!important;padding:14px!important}
  .filters>*{width:100%!important;min-width:0!important;margin:0!important}
  .inline-form{display:grid!important;grid-template-columns:1fr!important;width:100%;max-width:100%;gap:8px!important}
  .inline-form>*{width:100%!important;min-width:0!important;margin:0!important}
  .table-wrap:has(table[style]),.table-wrap{border-radius:14px}
  .table-wrap:before{content:"برای دیدن ستون‌های بیشتر، جدول را داخل همین کادر جابه‌جا کنید";display:block;position:sticky;right:0;padding:7px 10px;background:#eef5f5;color:#587177;font-size:10px;text-align:center}
  .invoice-sheet>.table-wrap:before{content:"جدول فاکتور را برای مشاهده جزئیات به چپ و راست بکشید"}
  .cart-lines>.table-wrap:before,.month-board.table-wrap:before{display:none}
  .messages{width:auto;max-width:calc(100% - 24px)}
  .messages p{width:100%;padding:12px 14px;overflow-wrap:anywhere}
}

@media(max-width:430px){
  .site-header{align-items:center!important;flex-direction:column!important}
  .site-header nav{grid-template-columns:repeat(2,minmax(0,1fr))}
  .site-header .logo span{display:flex!important;flex-direction:column;font-size:13px}
  .site-header .logo small{font-size:8px}
  .management-nav-v2,.admin-shell .management-nav{grid-template-columns:1fr 1fr}
  .portal-tabs{scroll-snap-type:x proximity;overscroll-behavior-inline:contain}
  .portal-tabs a{scroll-snap-align:start}
}

@media(max-width:760px){
  .add-job-panel form,.add-job-panel form>p{width:100%;max-width:100%;overflow:hidden}
  .add-job-panel input[type="checkbox"],.calendar-admin-forms input[type="checkbox"]{display:inline-block!important;width:22px!important;height:22px;margin:0 0 0 8px;vertical-align:middle}
  .add-job-panel label{max-width:100%;overflow-wrap:anywhere}
}

/* Predictable image frames: uploaded dimensions never disturb the layout */
.product-media{width:100%;height:auto!important;aspect-ratio:4/3;overflow:hidden;background:#f5f7f7!important}
.product-media img{display:block;width:100%!important;height:100%!important;padding:10px;object-fit:contain!important;object-position:center;background:#fff}
.main-product-image{width:100%;height:auto!important;aspect-ratio:4/3;background:#fff!important}
.main-product-image>img{display:block;width:100%!important;height:100%!important;padding:12px;object-fit:contain!important;object-position:center}
.product-thumbs button{background:#fff}.product-thumbs img{display:block;width:100%!important;height:100%!important;padding:3px;object-fit:contain!important;object-position:center}
.team-photo,.about-block .team-photo{position:relative;display:grid!important;place-items:center;width:112px!important;height:112px!important;aspect-ratio:1;overflow:hidden;background:#f2f5f5!important}
.team-photo img,.about-block .team-photo img{position:absolute!important;inset:0;display:block;width:100%!important;height:100%!important;max-height:100%!important;padding:3px;object-fit:contain!important;object-position:center;border-radius:50%;background:#fff}
.expert-profile-photo{display:grid!important;place-items:center;overflow:hidden;background:#f2f5f5!important}
.expert-profile-photo img{display:block;width:100%!important;height:100%!important;padding:6px;object-fit:contain!important;object-position:center;background:#fff}
.staff-thumb{overflow:hidden;object-fit:contain!important;object-position:center;background:#fff!important}
.home-promo-card>img{display:block;width:100%!important;height:auto!important;aspect-ratio:16/9;padding:8px;object-fit:contain!important;object-position:center;background:#f4f6f6}
.promo-detail-hero>img{display:block;width:100%!important;height:auto!important;aspect-ratio:16/10;padding:10px;object-fit:contain!important;object-position:center;background:#f4f6f6}

@media(max-width:560px){
  .product-media{aspect-ratio:4/3!important}
  .main-product-image{aspect-ratio:1/1!important;max-height:none!important}
  .home-promotions{padding:18px!important;overflow:hidden!important}
  .home-promo-grid{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:16px!important;width:100%!important;overflow:visible!important}
  .home-promo-card{display:grid!important;grid-template-columns:minmax(0,1fr)!important;width:100%!important;min-width:0!important;height:auto!important;min-height:0!important;overflow:hidden!important}
  .home-promo-card>img,.home-promo-card>.home-promo-placeholder{grid-column:1;width:100%!important;height:auto!important;min-height:0!important;aspect-ratio:16/9;object-fit:contain!important}
  .home-promo-card>div:last-child{grid-column:1;width:100%;padding:16px!important}
  .home-promo-card p{display:block!important;font-size:12px}
  .home-promo-card footer{align-items:stretch!important;gap:10px!important}
  .promo-detail-hero{overflow:hidden!important}
  .promo-detail-hero>img{width:100%!important;max-height:none!important;min-height:0!important;aspect-ratio:16/10;object-fit:contain!important}
}
