/* Touch, narrow screens, notches and the on-screen keyboard share one contract. */
.overlay { z-index:100; }
.modal-head h2 { min-width:0; overflow-wrap:anywhere; }
.modal-head > .btn { flex-shrink:0; }
.store-assistant.is-suspended { visibility:hidden; pointer-events:none; }
.store-assistant.has-external-opener .assistant-launcher { display:none; }
.assistant-backdrop { position:fixed; inset:0; border:0; background:#13241f66; }
.order-open { border:0; background:transparent; font:inherit; font-weight:700; color:var(--brand-ink); text-align:start; padding:4px 8px; cursor:pointer; border-radius:8px; }
.order-open:hover { background:var(--brand-soft); }
.order-open:focus-visible { outline:3px solid var(--brand); outline-offset:3px; }
.customers-broadcast { position:sticky; top:16px; }
.mobile-table-caption { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }

@media(max-width:900px),(pointer:coarse) {
  .shell :is(button,.btn),.landing :is(button,.btn) { min-width:44px; min-height:44px; }
  .shell .btn,.shell .btn.sm,.shell .btn.icon-only,.landing button,.seo-public .btn,
  .shell :is(.chip,.segmented button,.mybots-filters button,.order-open,summary,.info-trigger,.info-close) { min-height:44px; }
  .shell .info-trigger,.shell .info-close { min-width:44px; }
  .shell .switch,.landing .switch,.shell .check,.landing .check { min-height:44px; }
  .shell .info-popover { padding-inline-end:60px; }
  .shell .btn.icon-only,.shell .btn.sm.icon-only,.shell .sidebar-close,.landing-motion-toggle,
  .assistant-popup-header .btn.icon-only,.modal-head .btn.icon-only { min-width:44px; min-height:44px; }
  .shell :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]),
  .shell .input.sm,.landing :is(input,select,textarea),.assistant-chat .composer textarea { font-size:16px; min-height:44px; }
  .landing .landing-auth-form .input { font-size:16px; }
  .shell :is(input,select,textarea),.landing :is(input,select,textarea) { scroll-margin-block:100px 120px; }
  .shell .mybots-search input { min-width:0; width:100%; }
  .shell .main { min-height:100dvh; }
  .shell .pg { grid-template-columns:minmax(0,1fr); }
  .shell .pg > *,.shell .phone-wrap,.shell .phone { min-width:0; max-width:100%; }
  .shell .tg-input input { min-width:0; width:0; flex:1; }
  .shell .tg-kb a { min-height:44px; }
  .shell .tg-kb .r { flex-wrap:wrap; }
  .shell .phone-screen { height:min(760px,calc(var(--viewport-height,100dvh) - 140px)); }
  .shell .page { padding-bottom:calc(96px + env(safe-area-inset-bottom,0px)); }
  .shell .mobile-bar { padding-top:max(10px,env(safe-area-inset-top,0px)); padding-inline:max(14px,env(safe-area-inset-left,0px)) max(14px,env(safe-area-inset-right,0px)); }
  .shell .workspace-sidebar { height:var(--viewport-height,100dvh); top:var(--viewport-top,0px); padding-top:max(20px,env(safe-area-inset-top,0px)); padding-bottom:max(18px,env(safe-area-inset-bottom,0px)); z-index:90; }
  .sidebar-backdrop { z-index:85; }
  .overlay { top:var(--viewport-top,0px); bottom:auto; height:var(--viewport-height,100dvh); }
  .overlay.center { padding:16px; }
  .modal { display:flex; flex-direction:column; max-height:calc(var(--viewport-height,100dvh) - 32px); overflow:hidden; }
  .modal-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
  .modal-head,.modal-foot { flex-shrink:0; }
  .modal-foot { flex-wrap:wrap; padding-bottom:max(16px,env(safe-area-inset-bottom,0px)); }
  .drawer { max-width:100%; height:100%; overflow:hidden; }
  .drawer .modal-body { flex:1; }
}

@media(max-width:900px) {
  .mobile-record-table,.mobile-record-table tbody { display:block; width:100%; }
  .mobile-record-table thead { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); }
  .mobile-record-table tbody { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(300px,100%),1fr)); gap:14px; padding:12px; }
  .mobile-record-table tr { display:grid; grid-template-columns:minmax(0,1fr); border:1px solid var(--border); border-radius:16px; padding:10px 14px; background:var(--bg-elev); }
  .shell .mobile-record-table td { display:grid; grid-template-columns:82px minmax(0,1fr); align-items:start; gap:12px; padding:10px 0; text-align:start; border-bottom:1px solid var(--border); min-width:0; }
  .mobile-record-table td::before { content:attr(data-label); font-size:12px; font-weight:700; color:var(--text-2); padding-top:3px; }
  .mobile-record-table td:last-child { border:0; }
  .mobile-record-table td > * { min-width:0; }
  .mobile-record-table .row { align-items:flex-start; }
  .mobile-record-table .row > div:last-child { min-width:0; }
  .mobile-record-table .tiny[href] { display:inline-flex; align-items:center; min-height:44px; }
  .mobile-record-table .badge { white-space:normal; width:fit-content; }
  .mobile-record-table .order-open { justify-self:start; }
  .shell .customers-broadcast { position:static; }
  .order-items-table,.order-items-table tbody { display:block; }
  .order-items-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .order-items-table tr { display:flex; justify-content:space-between; gap:12px; border-bottom:1px solid var(--border); }
  .shell .order-items-table td { border:0; padding:12px; text-align:start; }
  .order-items-table tr.order-item { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:0; }
  .order-items-table .order-item td:first-child { grid-column:1/-1; }
  .order-items-table .order-item td[data-label]::before { content:attr(data-label); display:block; font-size:12px; color:var(--text-2); }
}

@media(max-width:600px) {
  .shell .row { flex-wrap:wrap; }
  .shell .page { padding-inline:max(14px,env(safe-area-inset-right,0px)) max(14px,env(safe-area-inset-left,0px)); }
  .shell .page-head h1 { font-size:24px; }
  .shell .form-grid,.shop-product-numbers { grid-template-columns:minmax(0,1fr); }
  .shell .choice-cards { grid-template-columns:repeat(auto-fit,minmax(min(190px,100%),1fr)); }
  .shell .field-label { flex-wrap:wrap; }
  .shell .card-head { flex-wrap:wrap; }
  .shell .card-head > .grow { flex:1 1 140px; }
  .shell .product-catalog-heading { flex-direction:column; align-items:stretch; }
  .shell .product-catalog-heading > .btn { width:100%; height:auto; white-space:normal; }
  .shell .shop-product > header b { min-width:0; overflow-wrap:anywhere; }
  .shell .kv { grid-template-columns:minmax(0,1fr); gap:4px; }
  .shell .kv dd { margin-bottom:12px; }
  .shell .mybots-search { min-height:48px; }
  .shell .mybots-filters { padding-bottom:8px; scroll-padding-inline:8px; }
  .shell .mybots-stat { flex-direction:column; align-items:center; text-align:center; }
  .shell .mybot-title { overflow-wrap:anywhere; }
  .shell .mybot-chat { min-width:44px; min-height:44px; }
  .shell .tiny,.shell .hint { font-size:12px; }
  .shell :is(.setup-footer,.shop-footer,.studio-footer) { padding-bottom:max(14px,env(safe-area-inset-bottom,0px)); }
  .shell .studio-footer { flex-wrap:wrap; }
  .shell .modal-head,.shell .modal-body,.shell .modal-foot { padding-inline:16px; }
  .store-assistant,.shell:has(.setup-footer,.shop-footer,.studio-footer) .store-assistant { inset-inline-end:max(14px,env(safe-area-inset-left,0px)); bottom:calc(16px + env(safe-area-inset-bottom,0px)); }
  .shell:has(.setup-footer,.shop-footer,.studio-footer) .store-assistant { bottom:calc(100px + env(safe-area-inset-bottom,0px)); }
  .store-assistant .assistant-launcher { width:56px; height:56px; min-height:56px; padding:10px; border-radius:18px; justify-content:center; }
  .store-assistant .assistant-launcher > span:not(.assistant-launcher-icon):not(.assistant-attention) { display:none; }
  .assistant-popup-header { padding:12px 14px; }
  .assistant-project-picker { padding:10px 14px; }
  .assistant-project-picker select { width:100%; min-width:0; font-size:16px; }
  .assistant-context-note { font-size:12px; }
  .assistant-popup-footer { font-size:12px; }
  .assistant-chat .composer .btn { min-width:44px; min-height:44px; height:auto; }
  .assistant-chat .composer { flex-wrap:nowrap; }
  .assistant-session-state { overflow-y:auto; min-height:0; }
  .landing-vibe .landing-nav { flex-wrap:wrap; gap:8px; padding-inline:10px; margin-top:max(14px,env(safe-area-inset-top,0px)); }
  .landing-vibe .landing-nav-actions { gap:8px; margin-inline-start:auto; }
  .landing-vibe .landing-motion-toggle { width:44px; padding:8px; }
  .landing-vibe .landing-login { min-width:44px; padding-inline:8px; }
  .landing-vibe .landing-hero #landing-hero-title { font-size:clamp(31px,9.2vw,45px); line-height:1.25; }
  .landing :is(.landing-footer a,.landing-auth-switch button,.landing-nav-links a,.landing-secondary-link) { display:inline-flex; align-items:center; min-height:44px; }
  .landing .landing-demo-cart { min-height:48px; }
  .landing .seo-knowledge { padding-inline:20px; }
  .seo-public .seo-header nav a,.seo-public .seo-footer nav a,.seo-public .seo-toc a { display:inline-flex; align-items:center; min-height:44px; }
  .seo-faq summary { min-height:44px; }
  .seo-intro,.seo-guide-card { overflow-wrap:anywhere; }
}

@media(max-width:380px) {
  .landing-vibe .landing-nav { justify-content:space-between; }
  .landing-vibe .landing-nav-actions { width:100%; justify-content:space-between; }
  .landing-vibe .landing-nav-actions .landing-cta { flex:1; justify-content:center; }
  .landing-vibe .landing-demo-product,.landing-vibe .landing-demo-checkout { grid-template-columns:minmax(0,1fr); }
  .landing-vibe .landing-product-info { text-align:center; }
  .landing-vibe .landing-product-info h2 br { display:none; }
  .landing-vibe .landing-product-stock { justify-content:center; }
  .landing-vibe .landing-demo-choice,.landing-vibe .landing-color-choice { min-width:44px; }
  .shell .mobile-record-table td { grid-template-columns:72px minmax(0,1fr); gap:8px; }
}

@media(max-height:500px) and (max-width:900px) {
  .shell .mobile-bar { position:relative; }
  .assistant-popup-footer,.assistant-context-note { display:none; }
  .assistant-popup-header p { display:none; }
}

@media(max-width:600px),(max-height:500px) and (max-width:900px) {
  .store-assistant.is-open .assistant-launcher { display:none; }
  .store-assistant .assistant-popup,.shell:has(.setup-footer,.shop-footer) .assistant-popup {
    position:fixed; inset-inline:12px; top:calc(var(--viewport-top,0px) + max(12px,env(safe-area-inset-top,0px))); bottom:auto;
    width:auto; height:calc(var(--viewport-height,100dvh) - max(12px,env(safe-area-inset-top,0px)) - max(12px,env(safe-area-inset-bottom,0px))); max-height:none; z-index:1;
  }
}

/* Keep Persian copy legible without suppressing browser zoom or clipping long text. */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
:is(.landing,.seo-public,.auth-page,.shell) :is(p,li,dt,dd,.hint,.tiny) { overflow-wrap:break-word; }
.landing :is(.landing-method>p,.landing-feature p,.landing-section-head>p,.landing-value-copy>p,.landing-return>p),
.seo-public .seo-section :is(p,li) { font-size:1rem; line-height:2; }
