/* Lawn-A-Matic mobile/PWA form polish v5.5.350 */
@media (max-width: 820px) {
  body.lam-mobile-form-mode input,
  body.lam-mobile-form-mode select,
  body.lam-mobile-form-mode textarea,
  body.lam-mobile-form-mode .lam-inp,
  body.lam-mobile-form-mode .form-control {
    min-height: 44px;
    font-size: 16px !important;
    border-radius: 12px !important;
    padding: 10px 12px !important;
    box-sizing: border-box;
  }
  body.lam-mobile-form-mode input[type="number"],
  body.lam-mobile-form-mode input[inputmode="decimal"],
  body.lam-mobile-form-mode input[name*="qty" i],
  body.lam-mobile-form-mode input[name*="quantity" i] {
    text-align: left !important;
  }
  body.lam-mobile-form-mode button,
  body.lam-mobile-form-mode .btn,
  body.lam-mobile-form-mode .lam-btn {
    min-height: 42px;
    border-radius: 12px !important;
  }
  table.lam-mobile-card-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 12px !important;
  }
  table.lam-mobile-card-table thead { display: none !important; }
  table.lam-mobile-card-table tbody,
  table.lam-mobile-card-table tr,
  table.lam-mobile-card-table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  table.lam-mobile-card-table tr {
    background: #fff;
    border: 1px solid rgba(15,23,42,.12);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(15,23,42,.06);
    padding: 10px;
    margin: 0 0 12px;
  }
  body.lam-dark table.lam-mobile-card-table tr {
    background: #0f172a !important;
    border-color: rgba(148,163,184,.18) !important;
  }
  table.lam-mobile-card-table td {
    border: 0 !important;
    padding: 7px 2px !important;
  }
  table.lam-mobile-card-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
  }
  table.lam-mobile-card-table td[data-label="" ]::before,
  table.lam-mobile-card-table td:not([data-label])::before { display:none; }
  table.lam-mobile-card-table input,
  table.lam-mobile-card-table select,
  table.lam-mobile-card-table textarea {
    width: 100% !important;
    max-width: 100% !important;
  }
  .lam-pwa-backbar {
    position: sticky;
    top: 0;
    z-index: 850;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    background: rgba(245,247,251,.96);
    border-bottom: 1px solid rgba(15,23,42,.10);
    backdrop-filter: blur(10px);
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
    margin: 0 -16px 12px;
  }
  body.lam-dark .lam-pwa-backbar {
    background: rgba(15,23,42,.96);
    border-bottom-color: rgba(148,163,184,.18);
  }
  .lam-pwa-backbar button,
  .lam-pwa-backbar a {
    appearance: none;
    border: 1px solid rgba(15,23,42,.14);
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    padding: 9px 12px;
    font-weight: 900;
    font-size: 13px;
    text-decoration: none;
  }
  body.lam-dark .lam-pwa-backbar button,
  body.lam-dark .lam-pwa-backbar a {
    background: #0b1220;
    color: #e5e7eb;
    border-color: rgba(148,163,184,.24);
  }
  .lam-pwa-backbar .lam-pwa-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-weight: 900;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}


/* v5.5.143: force invoice/estimate line-item editors into app-style cards on small screens. */
@media (max-width: 820px) {
  .table-wrap,
  .job-items-wrap,
  .line-items-wrap,
  .invoice-items-wrap,
  .estimate-items-wrap {
    overflow-x: visible !important;
    max-width: 100% !important;
  }
  table.lam-line-item-card-table,
  table#itemsTable,
  table#job-items-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 12px !important;
  }
  table.lam-line-item-card-table thead,
  table#itemsTable thead,
  table#job-items-table thead { display: none !important; }
  table.lam-line-item-card-table tbody,
  table.lam-line-item-card-table tr,
  table.lam-line-item-card-table td,
  table#itemsTable tbody,
  table#itemsTable tr,
  table#itemsTable td,
  table#job-items-table tbody,
  table#job-items-table tr,
  table#job-items-table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  table.lam-line-item-card-table tbody tr,
  table#itemsTable tbody tr,
  table#job-items-table tbody tr {
    background: #fff;
    border: 1px solid rgba(15,23,42,.12);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(15,23,42,.06);
    padding: 10px;
    margin: 0 0 12px;
  }
  table.lam-line-item-card-table tbody td,
  table#itemsTable tbody td,
  table#job-items-table tbody td {
    border: 0 !important;
    padding: 7px 2px !important;
    text-align: left !important;
  }
  table.lam-line-item-card-table tbody td::before,
  table#itemsTable tbody td::before,
  table#job-items-table tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
  }
  table.lam-line-item-card-table td[data-label=""]::before,
  table.lam-line-item-card-table td:not([data-label])::before,
  table#itemsTable td[data-label=""]::before,
  table#itemsTable td:not([data-label])::before,
  table#job-items-table td[data-label=""]::before,
  table#job-items-table td:not([data-label])::before { display:none !important; }
  table.lam-line-item-card-table input,
  table.lam-line-item-card-table select,
  table.lam-line-item-card-table textarea,
  table#itemsTable input,
  table#itemsTable select,
  table#itemsTable textarea,
  table#job-items-table input,
  table#job-items-table select,
  table#job-items-table textarea {
    width: 100% !important;
    max-width: 100% !important;
  }
  body.lam-dark table.lam-line-item-card-table tbody tr,
  body.lam-dark table#itemsTable tbody tr,
  body.lam-dark table#job-items-table tbody tr {
    background: #0f172a !important;
    border-color: rgba(148,163,184,.18) !important;
  }
}

/* v5.5.352: compact PWA-only escape utility strip.
   It is intentionally slim, lives at the top of the document, and only appears
   when JavaScript confirms the app is running in standalone/PWA mode. */
body.lam-pwa-standalone{
  --lam-pwa-escape-height: 44px;
}
body.lam-pwa-standalone .lam-pwa-backbar{
  position:sticky;
  top:0;
  z-index:5000;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:4px;
  width:100%;
  max-width:none;
  margin:0;
  padding:max(5px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 5px max(8px, env(safe-area-inset-left));
  border:0;
  border-bottom:1px solid rgba(15,23,42,.10);
  border-radius:0;
  background:rgba(248,250,252,.97);
  color:#0f172a;
  box-shadow:0 2px 9px rgba(15,23,42,.08);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  box-sizing:border-box;
}
body.lam-pwa-standalone.lam-pwa-surface-dark .lam-pwa-backbar{
  background:rgba(9,16,29,.97);
  color:#eef4ff;
  border-bottom-color:rgba(226,232,240,.12);
  box-shadow:0 2px 10px rgba(0,0,0,.26);
}
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-action,
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-home{
  appearance:none;
  min-height:34px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin:0;
  padding:0 9px;
  border:1px solid transparent;
  border-radius:9px;
  background:transparent;
  color:inherit;
  text-decoration:none;
  font:800 12.5px/1 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  cursor:pointer;
  box-sizing:border-box;
  box-shadow:none;
  white-space:nowrap;
  -webkit-tap-highlight-color:transparent;
}
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-back{
  justify-self:start;
}
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-home{
  justify-self:center;
  color:#166534;
  border-color:rgba(22,163,74,.18);
  background:rgba(34,197,94,.06);
}
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-exit{
  justify-self:end;
}
body.lam-pwa-standalone.lam-pwa-surface-dark .lam-pwa-backbar .lam-pwa-escape-home{
  color:#86efac;
  border-color:rgba(74,222,128,.20);
  background:rgba(34,197,94,.08);
}
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-action:hover,
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-home:hover{
  background:rgba(15,23,42,.055);
  border-color:rgba(15,23,42,.10);
}
body.lam-pwa-standalone.lam-pwa-surface-dark .lam-pwa-backbar .lam-pwa-escape-action:hover,
body.lam-pwa-standalone.lam-pwa-surface-dark .lam-pwa-backbar .lam-pwa-escape-home:hover{
  background:rgba(255,255,255,.065);
  border-color:rgba(226,232,240,.12);
}
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-action:focus-visible,
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-home:focus-visible{
  outline:2px solid #22c55e;
  outline-offset:1px;
}
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-icon,
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-home-icon{
  font-size:16px;
  line-height:1;
  font-weight:900;
}
body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-home-icon{
  color:#16a34a;
}
body.lam-pwa-standalone.lam-pwa-surface-dark .lam-pwa-backbar .lam-pwa-home-icon{
  color:#4ade80;
}
/* Keep existing fixed app chrome below the compact PWA strip. */
body.lam-pwa-standalone .lam-menu-btn{
  top:calc(var(--lam-pwa-escape-height, 44px) + 10px) !important;
}
body.lam-pwa-standalone .lam-sidebar{
  top:var(--lam-pwa-escape-height, 44px) !important;
  height:calc(100vh - var(--lam-pwa-escape-height, 44px)) !important;
}
body.lam-pwa-standalone .site-header{
  top:var(--lam-pwa-escape-height, 44px) !important;
}
/* Login and other narrow utility pages should not retain a large top gutter. */
body.lam-pwa-standalone .page-wrap{
  margin-top:16px !important;
}
/* PDF wrapper keeps its iframe within the remaining viewport below the strip. */
body.lam-pwa-standalone .pwa-pdf-shell{
  height:calc(100dvh - var(--lam-pwa-escape-height, 44px)) !important;
}
@media(max-width:520px){
  body.lam-pwa-standalone .lam-pwa-backbar{
    gap:2px;
    padding-left:max(6px, env(safe-area-inset-left));
    padding-right:max(6px, env(safe-area-inset-right));
  }
  body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-action,
  body.lam-pwa-standalone .lam-pwa-backbar .lam-pwa-escape-home{
    min-height:32px;
    padding:0 8px;
    font-size:12px;
  }
}
