/* Shared phone layout, loaded after existing page styles. */
.crm-menu-trigger{display:none}
.crm-menu-dialog{width:min(620px,calc(100vw - 24px));max-height:calc(100dvh - 32px);padding:18px;border:1px solid #dbe5ef;border-radius:16px;color:#17202a;background:#fff;overflow:auto}
.crm-menu-dialog::backdrop{background:#06152daa}
.crm-menu-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;position:sticky;top:-18px;background:#fff;padding:12px 0;z-index:1}
.crm-menu-heading h2{margin:0}
.crm-menu-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.crm-menu-links a{display:flex;align-items:center;min-height:48px;margin:0;padding:12px;color:#17202a;background:#f4f6f8;border:1px solid #dbe5ef;border-radius:10px;overflow-wrap:anywhere}
.crm-menu-links a:hover,.crm-menu-links a[aria-current="page"]{background:#06152d;color:white}
@media screen and (max-width:900px){
  *,*::before,*::after{box-sizing:border-box}
  html{scroll-padding-top:calc(var(--crm-header-height,0px) + 16px)}
  body{padding-bottom:calc(var(--kts-mobile-nav-height,64px) + 16px)}
  body:not(:has(.mobile-nav)){padding-bottom:0}
  main,.content,.portal-main,.tech-app,.tt-token-main,.wrap{min-width:0;max-width:100%}
  .content{padding:14px 12px 32px}
  .wrap{padding:16px}
  .crm-header{display:flex;height:auto;min-height:64px;flex-wrap:wrap;gap:10px;padding:10px 12px;position:sticky;top:0;z-index:10}
  .crm-header .header-brand{flex:1;min-width:0}
  .crm-header .header-brand img{max-width:36px;max-height:36px}
  .crm-header .header-brand .muted{display:none}
  .crm-header>.badge{display:none}
  .crm-header .global-search{flex:1 1 100%;max-width:none;margin:0;order:5}
  .crm-menu-trigger{display:inline-flex!important;align-items:center;justify-content:center;min-height:44px}
  body .mobile-nav,body:has(.leads-workspace) .mobile-nav{display:flex;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin;min-height:56px;align-items:stretch;gap:0}
  body .mobile-nav a,body:has(.leads-workspace) .mobile-nav a{flex:0 0 auto;min-width:70px;min-height:56px;max-width:none;white-space:nowrap;padding:10px 12px;font-size:12px;overflow-wrap:normal}
  .crm-bottom-menu{position:sticky;left:0;z-index:2;flex:0 0 70px;background:#172b43;color:white;border-radius:0;border-right:1px solid #ffffff33;min-height:56px;padding:10px}
  .cards,.cards.six,.report-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .grid2,.grid3,.grid2.wide-left,.formgrid,.formgrid.two,.editor-form,.delivery-grid,.portal-grid,.payment-grid,.integration-grid{grid-template-columns:minmax(0,1fr)}
  .grid2>*,.grid3>*,.grid>*,.formgrid>*,.cards>*,.report-cards>*{min-width:0}
  section,.panel,.card,.item{max-width:100%;padding:14px}
  .card strong,.report-cards strong{font-size:22px;overflow-wrap:anywhere}
  h1{font-size:28px;line-height:1.2;overflow-wrap:anywhere}
  h2{font-size:20px;overflow-wrap:anywhere}
  p,.item,.file,.bubble,code,.badge,.status{overflow-wrap:anywhere}
  .badge,.status{white-space:normal;max-width:100%}
  .topline,.section-title,.presentation-head,.tech-head,.top{flex-wrap:wrap;gap:12px;align-items:flex-start}
  .topline>div,.section-title>div,.top>div{min-width:0;max-width:100%}
  .toolbar,.report-filters,.message-compose,.onway-form{flex-wrap:wrap;gap:10px}
  .toolbar>*{min-width:0;max-width:100%}
  .report-filters label{min-width:0;flex:1 1 140px}
  .actions,.quick-actions,.send-toolbar-actions,.category-dialog-actions{display:flex;flex-wrap:wrap;align-items:stretch;gap:10px}
  .actions>*,.quick-actions>*{min-width:0;max-width:100%}
  .actions>.button,.quick-actions>.button,.actions>button{flex:1 1 130px;text-align:center}
  button,.button,.btn{min-height:44px;line-height:1.35;white-space:normal;touch-action:manipulation}
  .button,.btn{display:inline-flex;justify-content:center;align-items:center}
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea{font-size:16px!important;min-height:48px;min-width:0;max-width:100%;width:100%}
  input[type="checkbox"],input[type="radio"]{flex-shrink:0;width:20px;height:20px}
  label.check,.permissions label,.perm{min-height:44px}
  input[type="file"]{padding:9px;font-size:14px!important}
  form>button{max-width:100%}
  .tabs,.backend-jump,.install-scope-tabs{gap:8px;flex-wrap:wrap;max-width:100%}
  .tabs a,.backend-jump a,.install-scope-tabs a{min-height:44px;display:inline-flex;align-items:center;white-space:normal}
  .table-scroll{max-width:100%;overscroll-behavior-x:contain}
  table.crm-card-table{display:block;width:100%;min-width:0}
  .crm-card-table>tbody,.crm-card-table>thead,.crm-card-table>tfoot{display:block;width:100%}
  .crm-card-table .crm-table-heading{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden;clip-path:inset(50%);padding:0!important;border:0!important}
  .crm-card-table tr:not(.crm-table-heading){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;border:1px solid #dbe5ef;border-radius:12px;margin:0 0 12px;padding:14px;background:#fff}
  .crm-card-table td{display:block;min-width:0;padding:0;border:0;overflow-wrap:anywhere;font-size:14px}
  .crm-card-table td::before{content:attr(data-label);display:block;color:#64748b;font-size:12px;font-weight:700;margin-bottom:6px}
  .crm-card-table td:first-child,.crm-card-table td.crm-table-actions,.crm-card-table td.crm-table-empty{grid-column:1/-1}
  .crm-card-table td:first-child>a{display:inline-flex;align-items:center;min-height:44px;font-size:16px}
  .crm-card-table td.crm-table-empty::before{display:none}
  .crm-table-actions>.document-menu{display:inline-block}
  .document-menu summary,.category-menu>summary{min-height:44px;min-width:44px}
  .document-menu-panel button,.document-menu-panel a{min-height:44px}
  dialog{width:calc(100vw - 24px)!important;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px)!important;padding:14px;overflow:auto;border-radius:14px}
  dialog iframe{max-width:100%;height:65dvh!important}
  .category-dialog-head,.crm-menu-heading{flex-wrap:wrap}
  img{max-width:100%}
  pre{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%}
  .bubble{max-width:94%}
  .message-compose textarea{flex:1 1 100%}
  .message-compose button,.message-compose .button{flex:1}
  .pricebook-category-boxes{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .pricebook-category-picture{height:120px}
  .pricebook-category-caption{padding:12px;overflow-wrap:anywhere}
  .pricebook-category-caption h3{font-size:16px}
  .install-config-bar,.warranty-grid{grid-template-columns:minmax(0,1fr)}
  .presentation-config,.backend-jump{top:var(--crm-header-height,0px)}
  .presentation-total{bottom:var(--kts-mobile-nav-height,0px)}
  .portal-head{display:flex;flex-wrap:wrap;height:auto;gap:12px;padding:14px}
  .portal-brand{min-width:0;flex:1 1 200px}
  .portal-notify{width:100%;margin:0}
  .portal-phone{white-space:nowrap}
  .portal-doc,.portal-hero{padding:16px}
  .portal-hero h1{font-size:28px}
  .portal-row{flex-wrap:wrap}
  .portal-row>div{min-width:0}
  .tech-head{flex-direction:column}
  .login-card{padding:22px;min-width:0;max-width:100%}
  .dispatch-col{min-width:min(84vw,330px);max-width:none}
}
@media screen and (max-width:420px){
  .cards .card,.report-cards .card{padding:12px}
  .cards .card strong,.report-cards strong{font-size:20px}
  .pricebook-category-boxes{grid-template-columns:minmax(0,1fr)}
  .crm-menu-links{grid-template-columns:minmax(0,1fr)}
  .actions>.button,.actions>button{flex-basis:100%}
}
@media print{.crm-menu-dialog,.crm-menu-trigger,.crm-bottom-menu{display:none!important}}
