/* Shared screen layout. Preserve company colours and printed document sizing. */
@media screen {
  html[data-cl-language-ready=false] body { visibility: hidden; }
  :root { --cl-body-size: .875rem; --cl-copy-leading: 1.5; --cl-gap: 12px; }
  body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  *, *::before, *::after { box-sizing: border-box; }
  :where(main, dialog, header, nav) :where(h1,h2,h3,h4,p,label,small,strong,a,button,td,th,figcaption,code) { overflow-wrap: anywhere; }
  :where(main,dialog) :where(p,label,small,button,td,th,figcaption) { line-height: var(--cl-copy-leading); }
  :where(main,dialog) :where(input,select,textarea) { min-width: 0; max-width: 100%; }
  :where(main,dialog) textarea { resize: vertical; }
  :where(button,[role=button]) { touch-action: manipulation; }

  /* Contractor workspace: readable density, natural heights and wrap-safe rows. */
  body .shell { font-size: var(--cl-body-size); line-height: var(--cl-copy-leading); grid-template-columns: 240px minmax(0,1fr); }
  body .main { padding: 24px clamp(16px,2.5vw,36px) 64px; }
  body .sidebar { padding: 22px 12px; gap: 22px; }
  body .sidebar .brand { font-size: 1.2rem; letter-spacing: -.025em; gap: 8px; padding-inline: 8px; white-space: normal; }
  body .sidebar .brandmark { flex: 0 0 34px; width: 34px; height: 34px; }
  body .sidebar .brandmark img { width: 34px; height: 34px; }
  body .sidebar .nav button { min-height: 42px; padding: 9px 11px; gap: 10px; font-size: .875rem; line-height: 1.4; white-space: normal; }
  body .workflow-nav-label { font-size: .75rem; padding: 6px 11px; letter-spacing: .04em; }
  body .sidebar small { font-size: .8rem; padding-inline: 10px; }
  body .top { flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
  body .top > div:first-child { flex: 1 1 230px; min-width: 0; }
  body .top h1 { font-size: clamp(1.5rem,2.4vw,2rem); letter-spacing: -.025em; line-height: 1.2; }
  body .eyebrow { font-size: .7rem; letter-spacing: .075em; line-height: 1.5; }
  body .top > a, body .top .pill { white-space: normal !important; max-width: 100%; }
  body .top .pill { padding: 7px 11px; font-size: .8rem; }
  body .card { padding: 18px; border-radius: 14px; }
  body .card, body .jobtile, body .planner-day, body .boardcol, body .crm-column { min-width: 0; }
  body .card > *, body .split > *, body .detail > *, body .scope-grid > *, body .grid > *, body .form .row > *, body .photoform > *, body .crm-controls > *, body .quote-line > * { min-width: 0; }
  body .grid, body .split, body .detail, body .scope-grid, body .handoff-grid, body .handoff-columns, body .enterprise-columns { gap: var(--cl-gap); }
  body .split { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); }
  body .detail, body .scope-grid, body .handoff-columns, body .enterprise-columns { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body .metric-card, body .enterprise-kpis .card { min-height: 112px; }
  body .metric, body .crm-metrics strong, body .enterprise-kpis strong { font-size: clamp(1.35rem,2vw,1.85rem); line-height: 1.25; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
  body .muted, body .note { font-size: .8125rem; line-height: 1.5; }
  body .sectionhead, body .dialoghead, body .toolbar, body .quickbar, body .actions, body .clockentry, body .scope-card { flex-wrap: wrap; gap: 10px; }
  body .sectionhead { margin: 24px 0 12px; align-items: center; }
  body .sectionhead h2, body .dialoghead h2 { font-size: 1.125rem; line-height: 1.35; letter-spacing: -.02em; }
  body .primary, body .secondary, body .hero-button { font-size: .8125rem; line-height: 1.4; padding: 9px 13px; min-height: 42px; white-space: normal; text-align: center; max-width: 100%; }
  body .actions > *, body .crm-actions > *, body .estimate-card-actions > * { max-width: 100%; }
  body .search { min-width: min(230px,100%); max-width: 100%; }
  body .form { gap: 12px; }
  body .form label, body .photoform label, body .clockbar label { font-size: .8125rem; line-height: 1.45; }
  body .form .row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  body .form :is(input,select,textarea), body .photoform :is(input,select), body .clockbar select { font-size: .875rem; min-height: 42px; padding: 9px 11px; }
  body .dialog { max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; }
  body .dialoghead { align-items: flex-start; }
  body .dialoghead h2 { flex: 1 1 170px; }
  body .dialoghead .close { flex: 0 0 auto; min-width: 40px; min-height: 40px; }
  body .photoitem .photometa strong, body .punch-card-body strong { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.45; }
  body .photometa small { display: block; line-height: 1.45; margin-top: 4px; }
  body .jobtile { padding: 12px; }
  body .boardhead, body .planner-day-head { flex-wrap: wrap; gap: 6px; }
  body .planner-item strong { font-size: .8125rem; line-height: 1.4; }
  body .status, body .crm-priority { white-space: normal; max-width: 100%; line-height: 1.4; }
  body .segmented { flex-wrap: wrap; overflow: visible; gap: 3px; }
  body .segmented button { white-space: normal; font-size: .8125rem; line-height: 1.4; padding: 8px 10px; min-height: 40px; }
  body .overview-hero { padding: 24px; min-height: 180px; grid-template-columns: minmax(0,1fr) 145px; gap: 20px; }
  body :is(.overview-hero,.estimate-hero,.crm-hero,.enterprise-hero,.punch-hero,.closeout-intro,.help-hero,.radar-hero) h2 { font-size: clamp(1.35rem,2.4vw,1.85rem); line-height: 1.25; letter-spacing: -.025em; }
  body :is(.estimate-hero,.crm-hero,.enterprise-hero,.punch-hero,.closeout-intro,.help-hero,.radar-hero) { flex-wrap: wrap; padding: 24px; gap: 16px; }
  body :is(.estimate-hero,.crm-hero,.enterprise-hero,.punch-hero,.closeout-intro,.help-hero,.radar-hero) > div { flex: 1 1 260px; min-width: 0; }
  body .estimate-hero .primary, body .punch-hero .primary, body .radar-card-bottom button { white-space: normal; }
  body .estimate-card { flex-wrap: wrap; padding: 18px; gap: 14px; }
  body .estimate-card > div:first-child { flex: 1 1 250px; min-width: 0; }
  body .estimate-card-right { flex: 1 1 200px; min-width: 0; }
  body .estimate-card-right > strong { font-size: 1.35rem; }
  body .quote-line { grid-template-columns: 90px minmax(120px,2fr) 64px 70px 85px 90px 32px; gap: 8px; }
  body .quote-line label { white-space: normal; font-size: .75rem; }
  body .quote-summary { grid-template-columns: repeat(4,minmax(0,1fr)); }
  body .crm-lead-top, body .crm-agenda > div, body .finance-aging, body .business-banner { flex-wrap: wrap; align-items: flex-start; }
  body .crm-lead-top > div { flex: 1 1 130px; min-width: 0; }
  body .crm-lead h2 { font-size: 1.0625rem; line-height: 1.4; }
  body .crm-controls { grid-template-columns: minmax(0,2fr) repeat(3,minmax(0,1fr)); }
  body .crm-controls label { min-width: 0; font-size: .8125rem; }
  body .crm-board { grid-template-columns: repeat(5,minmax(265px,1fr)); gap: 12px; scrollbar-width: thin; }
  body .crm-board .crm-actions { gap: 7px; }
  body .crm-actions button, body .crm-actions a { font-size: .8125rem; min-height: 40px; line-height: 1.4; }
  body .crm-stage-label { flex-wrap: wrap; }
  body .crm-stage-label select { flex: 1 1 130px; }
  body .tablewrap table { min-width: 620px; }
  body .finance-table table { min-width: 700px; white-space: normal; }
  body :is(.tablewrap,.finance-table) th, body :is(.tablewrap,.finance-table) td { padding: 12px; font-size: .8125rem; line-height: 1.45; }
  body :is(.tablewrap,.finance-table) th { font-size: .7rem; letter-spacing: .04em; }
  body .finance-table td:first-child { min-width: 190px; max-width: 360px; }
  body .finance-table td:not(:first-child) { font-variant-numeric: tabular-nums; min-width: 95px; }
  body .invoice-card { grid-template-columns: minmax(0,1fr) minmax(110px,.4fr) minmax(130px,.5fr); gap: 14px; }

  body.capture-screen { font-size: .9375rem; line-height: 1.5; }
  body.capture-screen header, body.capture-screen .header-links { flex-wrap: wrap; gap: 12px; }
  body.capture-screen .header-links a { white-space: normal; }
  body.capture-screen main { padding-top: 20px; }
  body.capture-screen h1 { font-size: clamp(1.5rem,3vw,1.9rem); line-height: 1.25; }
  body.capture-screen h2 { font-size: 1.125rem; line-height: 1.4; }
  body.capture-screen section { padding: 18px; margin-block: 14px; }
  body.capture-screen .items :is(li,span,strong) { overflow-wrap: anywhere; }

  /* Public homepage, enrolment, customer approval and account screens. */
  body .cl-home { font-size: var(--cl-body-size); overflow-x: visible; }
  body .cl-header, body .cl-nav, body .cl-footer { flex-wrap: wrap; gap: 14px; }
  body .cl-header { padding-block: 20px; }
  body .cl-hero { grid-template-columns: minmax(0,1.06fr) minmax(0,1fr); gap: 40px; padding-block: 60px; }
  body .cl-hero h1 { font-size: clamp(2rem,3.6vw,3.2rem); letter-spacing: -.035em; line-height: 1.15; }
  body .cl-lead { font-size: .9375rem; line-height: 1.65; }
  body .cl-section { padding-block: 60px; }
  body .cl-section h2, body .cl-region h2, body .cl-final h2 { font-size: clamp(1.5rem,2.7vw,2rem); letter-spacing: -.025em; line-height: 1.25; }
  body .cl-preview { transform: none; min-width: 0; }
  body .cl-preview-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  body .cl-preview-metrics strong { white-space: normal; font-size: clamp(.95rem,1.8vw,1.25rem); }
  body .cl-preview-top, body .cl-change, body .cl-job-top, body .cl-progress-label { flex-wrap: wrap; gap: 8px; }
  body .cl-tools-grid, body .cl-step-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body .cl-tool > div { min-width: 0; }
  body .signup-header { height: auto; min-height: 76px; padding-block: 16px; flex-wrap: wrap; }
  body .signup-intro h1 { font-size: clamp(1.8rem,3.7vw,2.8rem); line-height: 1.2; letter-spacing: -.025em; }
  body .signup-plan { min-height: 0; padding: 20px; }
  body .signup-desc { min-height: 0; }
  body .review-shell { font-size: .9375rem; }
  body .review-layout { grid-template-columns: minmax(0,1fr) minmax(260px,.42fr); gap: 18px; margin-block: 28px; }
  body .review-main h1 { font-size: clamp(1.6rem,3vw,2.35rem); line-height: 1.25; letter-spacing: -.025em; }
  body .review-header, body .review-price { flex-wrap: wrap; gap: 10px; }
  body .review-price > span { flex: 1 1 160px; min-width: 0; }
  body .review-price > strong { max-width: 100%; font-size: 1.1rem; }
  body .review-card { padding: 20px; min-width: 0; }
  body .account-screen { font-size: .9375rem; line-height: 1.55; }
  body .account-screen h1 { font-size: clamp(1.5rem,3vw,2rem) !important; line-height: 1.25 !important; }
  body .account-screen h2 { font-size: 1.2rem; line-height: 1.4; }
  body .account-screen button, body .account-screen a { max-width: 100%; white-space: normal; line-height: 1.45; }
  body .account-screen table { width: 100%; min-width: 540px; font-size: .8125rem; }

  @media (max-width: 1100px) {
    body .crm-controls { grid-template-columns: repeat(2,minmax(0,1fr)); }
    body .planner-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
    body .enterprise-columns { grid-template-columns: 1fr; }
    body .quote-line { grid-template-columns: repeat(3,minmax(0,1fr)); }
  }
  @media (max-width: 850px) {
    body .shell { display: block; }
    body .main { padding: 20px 16px 56px; }
    body .split, body .detail, body .handoff-columns { grid-template-columns: 1fr; }
    body .mobilebar { padding: 8px 10px; scrollbar-width: thin; }
    body .mobilebar button { min-height: 42px; font-size: .8125rem; line-height: 1.4; }
    body .cl-hero, body .review-layout { grid-template-columns: 1fr; }
    body .cl-hero { gap: 28px; padding-block: 36px; }
    body .review-decision { position: static; }
  }
  @media (max-width: 600px) {
    body .top > div:first-child { flex-basis: 100%; }
    body .top .pill { flex-basis: 100%; width: fit-content; }
    body .form .row, body .photoform, body .scope-grid, body .clockbar, body .invoice-card { grid-template-columns: 1fr; }
    body .photoform .full { grid-column: auto; }
    body .form :is(input,select,textarea), body .photoform :is(input,select), body .clockbar select, body .crm-controls :is(input,select), body .quote-line :is(input,select) { font-size: 16px; }
    body .crm-controls, body .cl-tools-grid, body .cl-step-grid { grid-template-columns: 1fr; }
    body .crm-board { grid-template-columns: repeat(5,minmax(260px,82vw)); }
    body .overview-hero { padding: 20px; grid-template-columns: minmax(0,1fr) 82px; gap: 12px; min-height: 0; }
    body .overview-hero h2 { font-size: 1.4rem; }
    body .quote-line, body .quote-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    body .planner-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    body .service-visit, body .closeout-card { grid-template-columns: 1fr; }
    body .punch-card { grid-template-columns: 52px minmax(0,1fr); }
    body .punch-card > .status, body .service-card > .status { grid-column: 1/-1; justify-self: start; }
    body .crm-agenda > div > span { flex-basis: 100%; }
    body .estimate-card-right { justify-items: start; }
    body .estimate-card-actions { justify-content: flex-start; }
    body .cl-header, body .cl-section, body .cl-hero { padding-inline: 18px; }
    body .cl-brand { font-size: 1.2rem; flex-shrink: 1; }
    body .cl-nav { justify-content: flex-start; }
    body .dialog { width: calc(100% - 24px); padding: 16px; max-height: calc(100dvh - 24px); }
    body .account-screen { padding: 18px !important; }
  }
  @media (max-width: 400px) {
    body .grid, body .crm-metrics, body .finance-metrics, body .enterprise-kpis, body .service-summary, body .planner-grid, body .photogrid { grid-template-columns: 1fr; }
    body .crm-metrics .card:last-child { grid-column: auto; }
    body .overview-hero { grid-template-columns: 1fr; }
    body .hero-progress { display: none; }
    body .cl-preview-body { padding: 16px; }
    body .cl-preview-metrics { grid-template-columns: 1fr; }
  }
}

.document-preview{width: min(1100px,calc(100vw - 24px));height:calc(100dvh - 24px);max-width:none;max-height:none;border:1px solid #bdcddb;border-radius:12px;padding:12px;background:#f4f7fb;color:#001f3d;overflow:hidden}.document-preview::backdrop{background:#001f3d99}.document-preview h2{display:inline-block;font:600 18px Arial;margin:8px 12px}.document-preview>button{float:right;min-height:44px;padding:10px 16px;background:#ff9500;color:#001f3d;border:0;border-radius:8px;font-weight:700}.document-preview iframe{display:block;width:100%;height:calc(100% - 60px);border:0;background:white;margin-top:12px}@media print{.document-preview{display:none}}
