/* Desktop fits the viewport; narrow pages keep natural scrolling. */
@media (min-width:850px){
  .estimate-page{height:100vh;height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}
  .estimate-page header{position:relative;top:auto}
  .estimate-page .estimate-shell{display:grid;grid-template-rows:auto auto minmax(0,1fr);gap:.55rem;width:100%;min-height:0;max-height:100%;margin:0 auto;padding:.55rem 1.25rem .65rem;box-sizing:border-box}
  .estimate-page .breadcrumbs{margin:0}
  .estimate-page .estimate-page-heading{margin:0;padding:.65rem 1rem;border-radius:14px}
  .estimate-page .estimate-page-heading h1{font-size:clamp(1.65rem,3.3vw,2.5rem);margin:.2rem 0 .3rem}
  .estimate-page .estimate-page-heading p{margin:.2rem 0}
  .estimate-page .estimate-page-heading .estimate-notice{margin-top:.25rem}
  .estimate-page .estimate-layout{align-items:stretch;min-height:0;grid-template-columns:minmax(240px,.75fr) minmax(0,1.65fr);gap:.7rem}
  .estimate-page .estimate-layout>.detail-card{min-height:0;padding:.75rem .9rem}
  .estimate-page .estimate-layout .detail-card h2{margin:0 0 .2rem;font-size:1.3rem}
  .estimate-page .estimate-chat{display:flex;flex-direction:column;position:static;overflow:auto}
  .estimate-page .guide-log{flex:1 0 1.8rem;min-height:1.8rem;max-height:none;margin:.45rem 0}
  .estimate-page .guide-chat{flex:none;margin-top:auto}
  .estimate-page .estimate-workspace{overflow:auto}
  .estimate-page .estimate-fields .field{margin-top:.45rem;gap:.24rem}
  .estimate-page .estimate-fields :is(input,select,textarea){padding:.4rem .6rem}
  .estimate-page .estimate-fields textarea{min-height:3.25rem;height:3.25rem}
  .estimate-page .estimate-workspace .actions{margin:.55rem 0 0}
  .estimate-page .estimate-workspace .actions .btn{min-height:42px;padding:.48rem .8rem}
  .estimate-page footer .footer-inner{padding:.38rem 1.25rem}
  .estimate-page footer .footer-chucky{display:none}
  .estimate-page footer .footer-brand{font-size:1rem}
  .estimate-page footer .footer-meta{font-size:.84rem}
}
@media (min-width:850px) and (max-height:520px){
  .estimate-page{grid-template-rows:auto minmax(0,1fr)}
  .estimate-page footer,.estimate-page .breadcrumbs{display:none}
  .estimate-page .estimate-shell{grid-template-rows:auto minmax(0,1fr)}
  .estimate-page .estimate-page-heading{padding:.45rem .8rem}
  .estimate-page .estimate-page-heading .eyebrow{display:none}
}
@media (min-width:850px) and (max-height:355px){
  .estimate-page{height:auto;overflow:auto;display:block}
  .estimate-page .estimate-shell{display:block}
  .estimate-page .estimate-layout{margin-top:.6rem;min-height:360px}
}

@media (min-width:850px) and (min-height:356px){
  .estimate-page .estimate-layout>.detail-card{margin:0;width:100%;max-height:100%}
  .estimate-page footer{padding:0}
  .estimate-page .nav{padding-block:.32rem}
  .estimate-page .nav .brand-emblem{width:3.65rem}
  .estimate-page .estimate-fields .field{margin-top:.37rem}
  .estimate-page .estimate-fields .field label{line-height:1.2}
}
@media (min-width:850px) and (max-height:680px) and (min-height:521px){
  .estimate-page .estimate-page-heading{padding:.48rem 1rem}
  .estimate-page .estimate-page-heading .eyebrow{display:none}
  .estimate-page .breadcrumbs{display:none}
  .estimate-page .estimate-shell{grid-template-rows:auto minmax(0,1fr)}
}

#estimate-photo-preview[hidden],#estimate-remove-photo[hidden]{display:none}
@media(min-width:850px) and (min-height:356px){
  .estimate-page .estimate-workspace{display:flex;flex-direction:column;overflow:hidden}
  .estimate-page .estimate-fields{min-height:0;overflow:auto;align-content:start;align-items:start;padding:0 .15rem}
  .estimate-page .estimate-fields .estimate-wide{grid-column:auto}
  .estimate-page .estimate-workspace .actions{flex:none}
  .estimate-page .estimate-fields .field input[type=file]{padding:.32rem;max-width:100%}
  .estimate-page #estimate-photo-status{font-size:.8rem;line-height:1.2}
  .estimate-page .estimate-page-heading .eyebrow{display:none}
  .estimate-page .estimate-page-heading h1{font-size:clamp(1.5rem,3vw,2.15rem)}
}

.estimate-chucky{display:grid;place-items:center;margin:.6rem 0 0;min-width:0;background:#edf5f1;border:1px solid #dce9e1;border-radius:12px;overflow:hidden}
.estimate-chucky img{display:block;width:100%;height:clamp(120px,26vw,195px);object-fit:contain;padding:.2rem}
@media(min-width:850px) and (min-height:356px){
  .estimate-page .estimate-chucky{flex:1 1 0;min-height:3.35rem;position:relative}
  .estimate-page .estimate-chucky img{position:absolute;inset:0;height:100%;width:100%;object-fit:contain}
}

/* Chat-first estimate workflow */
.estimate-conversation [hidden]{display:none!important}
.estimate-conversation .estimate-chat{width:100%;margin:0}
.estimate-conversation .guide-log{display:block}
#intake-messages{display:grid;gap:.45rem}
#intake-actions{margin-top:.55rem}
#intake-actions:empty{display:none}
#intake-actions .intake-buttons{display:flex;flex-wrap:wrap;gap:.35rem}
.intake-buttons button,.intake-bubble button{font:inherit;font-size:.89rem;color:var(--teal-dark);font-weight:750;cursor:pointer;background:white;border:1px solid #99b6a9;border-radius:9px;padding:.34rem .55rem;min-height:36px}
.intake-buttons button:hover,.intake-bubble button:hover{background:#fff0e6}
#intake-actions .field{margin-top:.45rem;gap:.2rem}
#intake-actions .field label{color:var(--teal-dark)}
#intake-actions :is(select,input){width:100%;min-width:0;border:1px solid #9eb4a8;border-radius:8px;padding:.42rem;font:inherit;background:white;color:var(--teal-dark)}
#intake-actions .intake-buttons{margin-top:.45rem}
.intake-bubble{margin-left:.5rem;padding:.5rem .65rem;background:#ffebdc;border-radius:9px}
.intake-bubble p{padding:0;background:none!important}
.intake-bubble button{margin-top:.35rem}
#intake-fallback{color:#52615e;background:none;padding:0;font-size:.85rem}
#intake-workspace{display:flex;flex:1;flex-direction:column;min-height:0;gap:.65rem}
#intake-workspace .estimate-chucky{margin-top:.3rem;flex:1;min-height:12rem}
#intake-workspace .estimate-chucky img{height:clamp(175px,45vw,340px)}
.intake-resource{border:1px solid #dce9e1;border-radius:12px;padding:.8rem;background:#edf5f1}
.intake-resource h3{margin:0 0 .35rem;color:var(--teal-dark);font-size:1.1rem}
".intake-resource-button{color:var(--teal-dark);background:#fff;border:1px solid #99b6a9;border-radius:9px;padding:.42rem .65rem;min-height:38px;margin:.36rem .45rem .2rem 0;font:inherit;font-weight:750;cursor:pointer}
.intake-resource-button:hover{background:#fff0e6}
.intake-resource-button:focus-visible{outline:2px solid #08634c;outline-offset:2px}
.intake-resource-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:.5rem;list-style:none;padding:0}
.intake-resource-options li{padding:.35rem .5rem;background:#fff;border-radius:8px}
.intake-resource-options p,.intake-resource-definitions dd{margin:.2rem 0 .55rem}
.intake-resource-definitions dt{font-weight:750;color:var(--teal-dark)}
.intake-workspace h4,.intake-resource h4{margin:.7rem 0 .25rem}
.intake-project-photos{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}
.intake-project-photos figure{margin:0}
.intake-project-photos figcaption{font-size:.87rem}
.intake-resource img.intake-coverage-map{height:auto;max-height:300px}
.intake-resource img,.intake-resource video{margin-top:.55rem;max-width:100%;width:100%;max-height:210px;object-fit:contain;border-radius:8px}
@media(min-width:850px) and (min-height:356px){
  .estimate-conversation .estimate-workspace{overflow:auto}
  #intake-workspace .estimate-chucky{min-height:7rem}
  #intake-workspace .estimate-chucky img{height:100%;padding:.45rem}
  .estimate-conversation .guide-log{flex:1 0 3rem}
}

@media(max-width:849px){.estimate-conversation .guide-log{max-height:none;overflow:visible}}

/* Keep the message composer in place as the conversation grows. */
.estimate-conversation .guide-chat :focus-visible,
.estimate-conversation .intake-buttons button:focus-visible,
.estimate-conversation .guide-log:focus-visible{outline:2px solid #08634c;outline-offset:2px}
.estimate-conversation .guide-chat{padding:.2rem}
@media(max-width:849px){
  .estimate-conversation .estimate-chat{min-width:0}
  .estimate-conversation .guide-log{min-height:8rem;max-height:clamp(10rem,43svh,24rem);overflow:auto;overscroll-behavior:contain}
  .estimate-conversation .guide-chat input{font-size:16px}
}

/* Chucky’s opening choices live in the transcript, not in the composer. */
#intake-actions.awaiting-reply{visibility:hidden}
#intake-messages .chucky-typing{justify-self:start;display:flex;align-items:center;gap:.5rem;padding:.45rem .7rem;border-radius:.7rem;background:#edf3ec;color:#244a3e;font-size:.86rem}
.chucky-typing-dots{display:inline-flex;align-items:center;gap:.2rem}
.chucky-typing-dots i{width:.28rem;height:.28rem;border-radius:50%;background:currentColor;animation:chucky-typing-dot 1.05s ease-in-out infinite}
.chucky-typing-dots i:nth-child(2){animation-delay:.15s}.chucky-typing-dots i:nth-child(3){animation-delay:.3s}
@keyframes chucky-typing-dot{0%,60%,100%{opacity:.45}30%{opacity:1}}
@media(prefers-reduced-motion:reduce){.chucky-typing-dots i{animation:none}}

.chucky-opening-actions{display:flex;flex-wrap:wrap;gap:.35rem}
