/* t821 — Lambert admin mobile layout. Everything here applies below 768px only
   (except .lbm-only, which is hidden on every width until the mobile query shows it). */
.lbm-only{display:none!important}
@media (max-width:767.98px){
  :root{--lbm-safe:env(safe-area-inset-bottom,0px)}
  .lbm-only{display:block!important}
  .lbm-only-flex{display:flex!important}
  .lbm-only-grid{display:grid!important}
  .lbm-desk{display:none!important}
  main,.lbm-cdpage{overflow-wrap:break-word}
  /* a browser still holding the pre-t823 client-detail chunk keeps the old safety net */
  body:has(.min-h-screen.bg-gray-50.py-8:not(.lbm-cdpage)){overflow-x:hidden}
  /* 16px fields so iOS does not zoom; 44px minimum height */
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]),select,textarea{font-size:16px!important}
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]),select{min-height:44px}
  /* fields that had no border (no forms plugin) were invisible */
  input.border-gray-300:not(.border):not([type=checkbox]):not([type=radio]),select.border-gray-300:not(.border),textarea.border-gray-300:not(.border){border:1px solid #d1d5db;background:#fff;padding:0 12px;min-height:48px;border-radius:12px}
  textarea.border-gray-300:not(.border){padding:10px 12px}
  /* tap targets */
  button,[role=button],label.cursor-pointer{min-height:44px;min-width:44px}
  a[class*=px-],a[class*=p-2],a[class*=py-],a.inline-block{min-height:44px}
  :where(a[class*=px-],a[class*=py-],a.inline-block){display:inline-flex;align-items:center}
  a:has(> svg:only-child){min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center}
  main a.w-full{width:100%}
  main input[type=checkbox],main input[type=radio]{width:22px;height:22px}
  main label:has(> input[type=checkbox]),main label:has(> input[type=radio]){min-height:44px;display:flex;align-items:center}
  /* AA contrast for text */
  .text-gray-400{color:#6b7280!important}
  .text-green-600{color:#15803d!important}
  .text-yellow-600{color:#92400e!important}
  .text-orange-600{color:#c2410c!important}
  .bg-orange-600{background-color:#c2410c!important}
  .bg-green-600{background-color:#15803d!important}
  .bg-blue-600{background-color:#1d4ed8!important}
  .text-primary-600{color:#bd141b!important}
  .text-yellow-800{color:#854d0e!important}

  /* layout chrome */
  .lbm-main{padding-bottom:calc(84px + var(--lbm-safe))}
  .lbm-main.lbm-notabs{padding-bottom:calc(96px + var(--lbm-safe))}
  .lbm-hdr .lambert-logo{height:22px}
  .lbm-tabbar{position:fixed;left:0;right:0;bottom:0;z-index:40;background:#fff;border-top:1px solid #e5e7eb;padding-bottom:var(--lbm-safe);display:flex!important}
  .lbm-tab{flex:1 1 0;height:64px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:12px;font-weight:600;color:#4b5563;background:none;border:0;min-width:0}
  .lbm-tab .lbm-pill{width:56px;height:30px;border-radius:999px;display:flex;align-items:center;justify-content:center}
  .lbm-tab svg{width:22px;height:22px}
  .lbm-tab[aria-current=page]{color:#bd141b}
  .lbm-tab[aria-current=page] .lbm-pill{background:#fee2e3}
  /* bottom sheets */
  .lbm-bd{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:55;display:none!important}
  .lbm-bd.lbm-open{display:block!important}
  .lbm-sheet{position:fixed;left:0;right:0;bottom:0;z-index:60;background:#fff;border-radius:24px 24px 0 0;max-height:88vh;overflow-y:auto;padding:8px 16px calc(16px + var(--lbm-safe));box-shadow:0 -10px 30px rgba(0,0,0,.15);display:none!important}
  .lbm-sheet.lbm-open{display:block!important}
  .lbm-grab{width:40px;height:5px;border-radius:999px;background:#d1d5db;margin:4px auto 8px}
  .lbm-sheet-h{display:flex;align-items:center;justify-content:space-between;min-height:48px}
  .lbm-sheet-h h2{font-size:18px;font-weight:700;color:#111827}
  .lbm-x{width:44px;height:44px;border-radius:999px;display:flex;align-items:center;justify-content:center;color:#374151;background:#f3f4f6}
  .lbm-sec{font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#4b5563;margin:12px 0 8px}
  .lbm-tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  .lbm-tile{min-height:88px;border-radius:16px;background:#f9fafb;border:1px solid #e5e7eb;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;font-size:13px;font-weight:600;color:#1f2937;text-align:center;padding:8px}
  .lbm-tile svg{width:24px;height:24px;color:#bd141b}
  .lbm-tile[aria-current=page]{background:#fee2e3;border-color:#fca5a5}
  .lbm-row{display:flex;align-items:center;gap:12px;min-height:56px;padding:0 8px;width:100%;font-size:16px;font-weight:500;color:#111827;border-radius:12px;text-align:left;background:none}
  .lbm-row:active{background:#f3f4f6}
  .lbm-row svg{width:20px;height:20px;color:#4b5563;flex-shrink:0}
  .lbm-row.lbm-danger,.lbm-row.lbm-danger svg{color:#b91c1c}
  .lbm-btn{height:48px;border-radius:12px;font-weight:600;font-size:16px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 16px}
  .lbm-btn svg{width:20px;height:20px}
  .lbm-btn-p{background:#e31b23;color:#fff}
  .lbm-btn-s{background:#fff;color:#1f2937;border:1px solid #d1d5db}
  .lbm-btn-g{background:#f3f4f6;color:#1f2937}
  .lbm-user{display:flex;align-items:center;gap:12px;padding:8px 0}
  .lbm-av{width:40px;height:40px;border-radius:999px;background:#e31b23;color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;flex-shrink:0}
  /* floating action button */
  .lbm-fab{position:fixed!important;right:16px;bottom:calc(84px + var(--lbm-safe));z-index:30;height:56px!important;padding:0 20px 0 16px!important;border-radius:999px!important;box-shadow:0 8px 20px rgba(227,27,35,.35);font-weight:600}
  /* list screens */
  .lbm-page{padding-left:16px!important;padding-right:16px!important;padding-top:12px!important}
  .lbm-h{font-size:22px!important}
  .lbm-list{display:flex!important;flex-direction:column;gap:12px;margin-bottom:16px}
  .lbm-card{position:relative;background:#fff;border:1px solid #e5e7eb;border-radius:16px}
  .lbm-card>a.lbm-cl{display:block;padding:14px 16px;min-height:64px;border-radius:16px;color:inherit}
  .lbm-card>a.lbm-cl:active{background:#f9fafb}
  .lbm-card.lbm-has-act>a.lbm-cl{padding-right:68px}
  .lbm-card .lbm-act{position:absolute;right:12px;top:50%;transform:translateY(-50%);width:44px;height:44px;border-radius:999px;display:flex;align-items:center;justify-content:center;background:#dcfce7;color:#166534}
  .lbm-card .lbm-act svg{width:20px;height:20px}
  .lbm-card.lbm-late{border-left:4px solid #dc2626}
  .lbm-t{font-size:16px;font-weight:600;color:#111827;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .lbm-s{font-size:14px;color:#4b5563;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .lbm-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;font-weight:700;color:#374151}
  .lbm-meta{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:8px;font-size:14px;color:#4b5563}
  .lbm-amt{font-weight:700;color:#111827;font-variant-numeric:tabular-nums}
  .lbm-badge{display:inline-flex;align-items:center;height:24px;padding:0 8px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap}
  .lbm-b-blue{background:#dbeafe;color:#1e40af}.lbm-b-gray{background:#f3f4f6;color:#374151}.lbm-b-green{background:#dcfce7;color:#166534}.lbm-b-amber{background:#fef3c7;color:#92400e}.lbm-b-red{background:#fef2f2;color:#b91c1c;box-shadow:inset 0 0 0 1px #fecaca}
  .lbm-ini{width:40px;height:40px;border-radius:999px;background:#f3f4f6;color:#374151;font-weight:700;font-size:14px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
  .lbm-plate{display:inline-flex;align-items:center;height:22px;padding:0 6px;border-radius:6px;background:#111827;color:#fff;font-family:ui-monospace,monospace;font-size:12px;font-weight:700;letter-spacing:.04em}
  .lbm-chips{display:flex!important;gap:8px;overflow-x:auto;margin:0 -12px;padding:2px 12px;scrollbar-width:none}
  .lbm-chips::-webkit-scrollbar{display:none}
  .lbm-chip{flex-shrink:0;height:44px;padding:0 16px;border-radius:999px;border:1px solid #d1d5db;background:#fff;font-size:14px;font-weight:600;color:#374151;display:inline-flex;align-items:center;gap:6px}
  .lbm-chip[aria-pressed=true]{background:#111827;border-color:#111827;color:#fff}
  .lbm-chip .lbm-n{min-width:20px;height:20px;border-radius:999px;background:#e31b23;color:#fff;font-size:12px;display:inline-flex;align-items:center;justify-content:center;padding:0 5px}
  .lbm-filterbox{padding:12px!important;border-radius:16px!important}
  .lbm-filterbox>div{gap:12px}
  /* filter grid shown as a bottom sheet on mobile */
  .lbm-fsheet{display:none!important}
  .lbm-fsheet.lbm-open{display:flex!important;flex-direction:column;gap:16px;position:fixed;left:0;right:0;bottom:0;z-index:60;background:#fff;border-radius:24px 24px 0 0;max-height:90vh;overflow-y:auto;padding:8px 16px calc(16px + var(--lbm-safe));box-shadow:0 -10px 30px rgba(0,0,0,.15)}
  .lbm-pager{flex-wrap:wrap;gap:8px}
  /* contract detail */
  .lbm-dhead{padding:8px 12px!important}
  .lbm-dhead h1{font-size:18px!important;line-height:1.3}
  .lbm-dhead p{font-size:13px}
  .lbm-dhead .lbm-back{width:44px;height:44px;display:flex;align-items:center;justify-content:center;padding:0!important}
  .lbm-dtitle{display:flex;align-items:center;gap:4px;width:100%}
  .lbm-dtitle>div:nth-child(2){flex:1;min-width:0}
  .lbm-more{width:44px;height:44px;border-radius:999px;display:flex!important;align-items:center;justify-content:center;color:#374151;flex-shrink:0;margin-left:auto}
  .lbm-dbody{padding:0 12px 16px!important}
  .lbm-tabs{position:sticky;top:0;z-index:20;background:#f9fafb;margin:0 -12px;padding:0 12px;scrollbar-width:none;-webkit-mask-image:linear-gradient(to right,#000 85%,transparent);mask-image:linear-gradient(to right,#000 85%,transparent)}
  .lbm-tabs::-webkit-scrollbar{display:none}
  .lbm-tabs nav{gap:4px!important}
  .lbm-tabs nav>button{flex-shrink:0;min-height:48px;padding:0 10px!important;font-size:15px!important;white-space:nowrap}
  .lbm-tabs nav>button:last-child{margin-right:32px}
  .lbm-abar{position:fixed;left:0;right:0;bottom:0;z-index:40;background:#fff;border-top:1px solid #e5e7eb;padding:12px 16px calc(12px + var(--lbm-safe));display:flex!important;gap:10px}
  .lbm-abar .lbm-btn-p{flex:1}
  .lbm-pay{padding:16px!important}
  .lbm-payhead{flex-wrap:wrap;gap:12px}
  .lbm-paybtns{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;gap:8px!important}
  .lbm-paybtns>button{justify-content:center;min-height:48px;font-size:15px!important;font-weight:600}
  .lbm-doc-actions{order:-1;width:100%;margin-left:0!important;display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:12px!important;border-bottom:1px solid #e5e7eb}
  .lbm-doc-actions>*{margin:0!important;min-height:88px;border-radius:16px!important;flex-direction:column;justify-content:center!important;text-align:center;gap:6px;padding:8px!important;font-size:14px!important;font-weight:600}
  .lbm-doc-actions>* svg{width:24px!important;height:24px!important}
  .lbm-doc-actions>* span{font-size:14px!important}
  .lbm-doc-actions>*:first-child:not(label){background:#e31b23!important;color:#fff!important;border-color:#e31b23!important}
  /* generic modals: keep inside the screen */
  .fixed.inset-0 .max-w-md,.fixed.inset-0 .max-w-lg,.fixed.inset-0 .max-w-xl,.fixed.inset-0 .max-w-2xl,.fixed.inset-0 .max-w-3xl,.fixed.inset-0 .max-w-4xl{max-height:92vh;overflow-y:auto}
  /* dashboard */
  .lbm-kpis{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important}
  .lbm-qa{display:flex!important;overflow-x:auto;gap:8px!important;grid-template-columns:none!important;scrollbar-width:none;margin-left:-16px;margin-right:-16px;padding:0 16px 4px}
  .lbm-qa::-webkit-scrollbar{display:none}
  .lbm-qa>*{flex-shrink:0;min-width:140px}
  .lbm-order-1{order:1}.lbm-order-2{order:2}.lbm-order-3{order:3}
  /* settings save bar */
  .lbm-savebar{position:sticky;bottom:calc(76px + var(--lbm-safe));z-index:30;background:#fff;border-top:1px solid #e5e7eb;margin:0 -16px;padding:12px 16px;display:flex;gap:8px}
  .lbm-savebar>button{flex:1;min-height:48px}
}
@media (max-width:767.98px){
  .lbm-hdr>div{padding:6px 16px!important}
  .lbm-hdr a{min-height:44px;display:flex;align-items:center}
}
@media (max-width:767.98px){
  .lbm-dcol{display:flex;flex-direction:column;gap:16px}
  .lbm-dcol>*{order:9;margin-top:0!important;margin-bottom:0!important}
  .lbm-dcol>.lbm-o1{order:1}.lbm-dcol>.lbm-o2{order:2}.lbm-dcol>.lbm-o3{order:3}.lbm-dcol>.lbm-o4{order:4}.lbm-dcol>.lbm-o5{order:5}.lbm-dcol>.lbm-o6{order:6}
  .lbm-kpis{gap:12px!important}
  .lbm-kpis .p-5{padding:14px!important}
  .lbm-kpis svg{width:22px!important;height:22px!important}
  .lbm-kpis .text-3xl{font-size:28px!important;line-height:1.1}
  .lbm-kpis h3{font-size:14px}
  .lbm-kpis p{font-size:13px}
  .lbm-qabox{padding:12px 0 12px 16px!important;margin-bottom:16px!important;overflow:hidden}
  .lbm-qa{padding:0 16px 0 0;margin:0}
  .lbm-qa>a{min-height:44px;padding:0 14px!important;border-style:solid!important;white-space:nowrap}
  .lbm-dcol .p-5{padding:16px}
  .lbm-dcol a.border-b{min-height:56px;align-items:center}
}
@media (max-width:767.98px){
  .lbm-hacts>div:first-child{display:none!important}
  .lbm-hacts{width:100%}
  .lbm-hacts>*{min-height:44px}
  .lbm-filterbox .lbm-chips{display:flex!important}
  .lbm-btn.lbm-only{display:inline-flex!important}
  .lbm-btn.lbm-only.w-full{display:flex!important}
}
@media (max-width:767.98px){
  .lbm-page>.mb-6:first-child>div.flex-col{flex-direction:row!important;align-items:center;justify-content:space-between}
  .lbm-hacts{width:auto}
  .lbm-hacts>button{padding:0 12px!important}
  .lbm-vhdr .flex>div:first-child{display:none!important}
  .lbm-vhdr .flex>button{flex:0 0 auto}
}
@media (max-width:767.98px){
  .lbm-fab{width:auto!important;left:auto!important;flex:none!important}
  .lbm-hacts>button>span:not(.rounded-full){display:none}
  .lbm-h{white-space:nowrap}
}
@media (max-width:767.98px){
  .lbm-dtitle{flex-wrap:nowrap}
  .lbm-dtitle>*{margin-left:0!important}
  .lbm-dtitle .order-last{order:9}
  .lbm-dtitle .space-x-3>*{margin-left:0!important}
  .lbm-sum{background:#fff;margin:0 -12px;padding:12px 16px;border-bottom:1px solid #e5e7eb}
  .lbm-sumg{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:10px}
  .lbm-sumg>div{background:#f9fafb;border-radius:12px;padding:8px 10px;min-width:0}
  .lbm-sumg span{display:block;font-size:12px;color:#4b5563}
  .lbm-sumg b{display:block;font-size:14px;color:#111827;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
  .lbm-sumg .lbm-due{background:#fef2f2}.lbm-sumg .lbm-due b,.lbm-sumg .lbm-due span{color:#b91c1c}
  .lbm-dbody>.mt-6:first-of-type{margin-top:12px}
}
@media (max-width:767.98px){
  .lbm-wrap{flex-wrap:wrap;row-gap:4px;column-gap:12px!important}
  .lbm-wrap>*{white-space:nowrap}
  main a.hover\:underline,main a[class*=text-xs]{min-height:44px;min-width:44px;display:inline-flex;align-items:center;justify-content:center}
}
@media (max-width:767.98px){
  .lbm-dbody .flex.items-center.justify-between{flex-wrap:wrap;gap:8px}
  .lbm-dbody .p-6{padding:16px}
  .lbm-dbody h2.text-xl{font-size:18px}
  .printable-contract-content{overflow:hidden}
  .printable-contract-content iframe{width:816px!important;max-width:none!important;zoom:.41}
  .lbm-doc-actions span span{display:none!important}
  .lbm-doc-actions>*>span{font-size:13px!important;line-height:1.2;word-break:normal;overflow-wrap:anywhere}
}
@media (max-width:374px){.printable-contract-content iframe{zoom:.37}}
@media (min-width:420px) and (max-width:767.98px){.printable-contract-content iframe{zoom:.46}}
@media (max-width:767.98px){
  .lbm-rk>*{padding:14px!important}
  .lbm-rk .text-2xl,.lbm-rk .text-3xl{font-size:20px!important;overflow-wrap:anywhere}
}
/* ---- t823 follow-ups (mobile only) ---- */
@media (max-width:767.98px){
  /* pages outside the shared layout (client / vehicle detail) get the same bottom tab bar */
  html.lbm-has-vnav body{padding-bottom:calc(84px + var(--lbm-safe))}
  .lbm-cdpage{padding-top:12px!important}
  .lbm-cdpage>div{padding-left:12px!important;padding-right:12px!important}
  .lbm-cdhead{flex-wrap:wrap;gap:12px;align-items:flex-start!important}
  .lbm-cdhead>div:first-child{min-width:0;flex:1 1 0}
  .lbm-cdhead .flex.items-center.gap-4{flex-wrap:wrap;gap:8px}
  .lbm-cdhead h1{font-size:22px!important;line-height:1.25;overflow-wrap:anywhere}
  .lbm-cdtabs{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .lbm-cdtabs nav{width:max-content}
  .lbm-cdlist{padding:12px}
  .lbm-vtabs{overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .lbm-vtabs::-webkit-scrollbar{display:none}
  .lbm-vtabs nav{width:max-content}
  .lbm-vtabs nav>button{flex-shrink:0;min-height:48px;padding:0 14px!important;white-space:nowrap}
  /* payments: one button + sheet instead of three small buttons */
  .lbm-payhead:has(.lbm-addpay) .lbm-paybtns{display:none!important}
  .lbm-addpay{display:flex!important;width:100%}
  .lbm-row .lbm-s{font-size:13px;color:#4b5563;font-weight:400}
  /* notes composer */
  .lbm-ncomp{position:sticky;bottom:calc(76px + var(--lbm-safe));z-index:15;background:#fff;border:1px solid #e5e7eb;border-radius:16px;padding:10px;box-shadow:0 -6px 16px rgba(0,0,0,.06)}
  .lbm-notabs .lbm-ncomp{bottom:calc(88px + var(--lbm-safe))}
  .lbm-nchips{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;margin:0 0 8px;padding-bottom:2px}
  .lbm-nchips::-webkit-scrollbar{display:none}
  .lbm-nchips .lbm-chip{padding:0 14px}
  .lbm-chip[aria-checked=true]{background:#111827;border-color:#111827;color:#fff}
  .lbm-nrow{display:flex;gap:8px;align-items:flex-end}
  .lbm-ninput{flex:1 1 0;min-width:0;min-height:48px;max-height:160px;border:1px solid #d1d5db;border-radius:12px;padding:12px;resize:none;field-sizing:content;background:#fff}
  .lbm-nsend{flex:0 0 48px;width:48px;height:48px;border-radius:12px;background:#e31b23;color:#fff;display:flex;align-items:center;justify-content:center}
  .lbm-nsend:disabled{opacity:.45}
  .lbm-nsend svg{width:20px;height:20px}
  .lbm-nerr{color:#b91c1c;font-size:14px;margin:0 0 6px}
  .lbm-nhead{flex-wrap:wrap;gap:8px}
  /* settings accordion + save bar only when changed */
  .lbm-acc{padding:0!important;overflow:hidden}
  .lbm-acch{position:relative;margin:0!important;padding:0 52px 0 16px;min-height:56px}
  .lbm-acc>:not(.lbm-acch){padding:0 16px 16px}
  .lbm-acc:not(.lbm-acc-open)>:not(.lbm-acch){display:none!important}
  .lbm-acct{position:absolute!important;inset:0;margin:0!important;width:100%;display:flex!important;justify-content:flex-end;align-items:center;padding-right:16px;background:none;color:#4b5563}
  .lbm-acct svg{width:20px;height:20px;transition:transform .2s}
  .lbm-acc-open .lbm-acct svg{transform:rotate(180deg)}
  .lbm-savebar.lbm-sb-clean{display:none!important}
  /* login: show-password */
  input#password{padding-right:52px!important}
  .lbm-pwt{position:absolute!important;right:0;top:0;bottom:0;width:48px;display:flex!important;align-items:center;justify-content:center;color:#4b5563;background:none}
  .lbm-pwt[aria-pressed=true]{color:#bd141b}
  .lbm-x svg{width:20px;height:20px}
}
