/* Polish layer (2026-11-15). Loaded last. Same layout, same colors, same names: this file only
   rounds, smooths and steadies what is already there. Delete it and the CRM looks as before. */
:root{--r-pill:999px;--r-card:14px;--r-in:10px;--shadow-1:0 1px 2px rgba(27,48,32,.06),0 1px 1px rgba(27,48,32,.04);--shadow-2:0 6px 24px rgba(27,48,32,.10),0 2px 6px rgba(27,48,32,.06);--ease-out:cubic-bezier(.2,.7,.2,1)}
html{-webkit-text-size-adjust:100%;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}

/* ---------- buttons: one rounded shape everywhere ---------- */
.pbtn,.btn,.claim,.ptabs button,.pill,.quick button,.dbtn,.new-doc-blank.pbtn{border-radius:var(--r-pill)}
.pbtn,.btn,.claim,.ptabs button,.pill,.quick button,.seg button,.nav,.bottom-nav button,.new-doc,.docs-start,.row,.jc,.mini{transition:background-color .18s var(--ease-out),border-color .18s var(--ease-out),color .18s var(--ease-out),box-shadow .2s var(--ease-out),transform .12s var(--ease-out)}
.pbtn{padding:.55rem 1.05rem;letter-spacing:.01em}
.pbtn.sm{padding:.34rem .8rem}
.pbtn:hover:not(:disabled){filter:brightness(1.06)}
.pbtn.ghost:hover:not(:disabled),.pbtn.crit:hover:not(:disabled){filter:none;background:var(--stone-50)}
.pbtn:active:not(:disabled),.btn:active,.claim:active,.ptabs button:active{transform:scale(.97)}
.pbtn:disabled,.btn:disabled{opacity:.5;cursor:not-allowed}
.seg{border-radius:var(--r-pill);padding:3px}
.seg button{border-radius:var(--r-pill)}
:focus-visible{outline:2px solid var(--gold-bright);outline-offset:2px}

/* ---------- surfaces ---------- */
.card{border-radius:var(--r-card);box-shadow:var(--shadow-1)}
.stat.card{border-radius:var(--r-card)}
.banner{border-radius:12px}
.chip{border-radius:var(--r-pill);padding:.14rem .55rem}
.jc{border-radius:12px;box-shadow:var(--shadow-1)}
.jc:hover{box-shadow:var(--shadow-2)}
.col{border-radius:var(--r-card)}
.doc,.mini{border-radius:12px}
.in{border-radius:var(--r-in);transition:border-color .15s var(--ease-out),box-shadow .15s var(--ease-out)}
.in:focus{outline:none;border-color:var(--forest);box-shadow:0 0 0 3px rgba(44,74,50,.14)}
.search{border-radius:var(--r-pill);padding-left:.95rem;padding-right:.95rem}
.toast{border-radius:var(--r-pill);box-shadow:var(--shadow-2)}
dialog,.send-dialog{border-radius:18px}
dialog::backdrop{backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}

/* ---------- steady frame: the page never changes width or shape when switching ---------- */
.view{scrollbar-gutter:stable}
@media (prefers-reduced-motion:no-preference){
 .view.view-enter > *{animation:rl-in .22s var(--ease-out) both}
 dialog[open]{animation:rl-pop .18s var(--ease-out) both}
}
@keyframes rl-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
@keyframes rl-pop{from{opacity:0;transform:translateY(6px) scale(.985)}to{opacity:1;transform:none}}

/* ---------- top bar on a computer: the light header gets light-header buttons ---------- */
@media (min-width:821px){
 .bar .new-proposal-trigger{color:var(--forest);background:var(--paper);border:1px solid var(--stone-200);min-height:40px;padding:0 1.05rem;font-size:12.5px}
 .bar .new-proposal-trigger:hover{background:var(--stone-50);border-color:var(--forest)}
 .bar .quick-add-trigger{min-height:40px;padding:0 1.15rem;font-size:12.5px}
 .bar .search{min-height:40px}
}

/* ---------- Proposal page: same title, same frame, Studio in a rounded card ---------- */
.view.proposal-view{display:flex;flex-direction:column;padding-bottom:1.4rem}
.view.proposal-view > .page-head{flex:none}
.studio-shell{display:flex;flex-direction:column;flex:1;min-height:520px;height:auto;border:1px solid var(--stone-200);border-radius:var(--r-card);overflow:hidden;background:var(--paper);box-shadow:var(--shadow-1)}
.studio-bar{padding:.55rem .9rem;background:var(--paper);border-bottom:1px solid var(--stone-200)}
.studio-host{display:flex}
.studio-frame{height:auto;flex:1;min-height:0}

/* ---------- send and builder windows ---------- */
.send-form{gap:.7rem}
.send-foot{border-top:1px solid var(--stone-100);padding:.7rem 0 .1rem}
.new-doc,.docs-start{border-radius:12px;border-left-width:4px}
.new-doc:hover,.docs-start:hover{box-shadow:var(--shadow-2)}
.b-line .in{min-width:0}
.vol{border-radius:12px}
.b-total{border-radius:0}

/* ---------- phone: app feel ---------- */
@media (max-width:820px){
 .pbtn,.btn{min-height:44px}
 .pbtn.sm{min-height:36px}
 .card{border-radius:16px}
 /* Header keeps its two rows: brand + Quick add, then search + New proposal. */
 .bar{display:grid;grid-template-columns:1fr auto;grid-template-areas:"title quick" "search proposal";align-items:center;column-gap:10px;row-gap:12px}
 .bar h1{grid-area:title;min-width:0}
 .bar .sp{display:none}
 .bar .quick-add-trigger{grid-area:quick}
 .bar .search{grid-area:search;width:100%;min-width:0}
 .bar .new-proposal-trigger{grid-area:proposal;margin:0;min-height:44px;font-size:12.5px;padding:0 14px}
 .view.proposal-view{padding:12px 10px calc(84px + var(--app-safe-bottom,0px))}
 .view.proposal-view > .page-head{margin-bottom:10px}
 .studio-shell{min-height:calc(100dvh - 300px);border-radius:16px}
 .studio-bar{padding:.45rem .6rem}
 .studio-bar .studio-sync{font-size:11px}
 .send-dialog,.builder-dialog{width:calc(100% - 16px);max-height:calc(100dvh - 16px)}
 .send-foot{position:sticky;bottom:0}
 .send-foot .pbtn{flex:1}
 .toast{max-width:calc(100% - 32px)}
}
@media (max-width:380px){.bar .new-proposal-trigger{padding:0 10px;font-size:12px}}
/* Dark theme: the light-header button keeps its contrast. */
@media (min-width:821px){
 :root[data-theme="dark"] .bar .new-proposal-trigger{color:var(--ink);border-color:var(--stone-200)}
}
@media (min-width:821px) and (prefers-color-scheme:dark){
 :root[data-theme="system"] .bar .new-proposal-trigger{color:var(--ink);border-color:var(--stone-200)}
}
/* Alerts assigned to you stand out a little. */
.row.assigned{background:#FBF5E4;border-left:3px solid var(--gold-bright)}
:root[data-theme="dark"] .row.assigned{background:var(--gold-pale)}
/* Proposal: expand / collapse the Studio. The CRM sidebar stays; the top bar and title step aside. */
.studio-size{display:inline-grid;place-items:center;width:34px;height:34px;flex:none;border-radius:999px;border:1px solid var(--forest);background:var(--forest);color:#fff;cursor:pointer;box-shadow:0 1px 2px rgba(27,48,32,.18);transition:filter .15s,transform .1s}
.studio-size:hover{filter:brightness(1.12)}
.studio-size:active{transform:scale(.94)}
.studio-size svg path{stroke-width:2.4}
:root[data-theme="dark"] .studio-size{background:#2C4A32;border-color:#2C4A32}
body.studio-max:has(.view.proposal-view) .bar{display:none}
body.studio-max .view.proposal-view{padding:12px 14px}
body.studio-max .view.proposal-view > .page-head{display:none}
body.studio-max .view.proposal-view .studio-shell{min-height:calc(100dvh - 24px);border-radius:12px}
@media (max-width:820px){body.studio-max .view.proposal-view{padding:6px 6px calc(78px + var(--app-safe-bottom,0px))}body.studio-max .view.proposal-view .studio-shell{min-height:calc(100dvh - 90px)}}

/* Audit 2026-11-15 */
/* Helper text: the same grey, a shade deeper, so it reads comfortably on paper and on the
   pipeline columns (was about 4:1 and 3.3:1; now above 4.5:1). Light theme only. */
:root:not([data-theme="dark"]){--ink-3:#5F685A}
@media (prefers-color-scheme:dark){:root[data-theme="system"]{--ink-3:#a6b4a3}}
/* Phone: a thumb-sized tap area around small controls, without changing how they look. */
@media (max-width:820px){
 .check{position:relative}
 .check::after{content:"";position:absolute;inset:-11px}
 .calendar-day,[data-action="calendar-day"]{min-height:38px}
}
/* Refresh: one round icon in the top bar. Reloads the latest data and the newest CRM. */
.bar .refresh-trigger{display:inline-grid;place-items:center;width:40px;height:40px;padding:0;flex:none;border-radius:999px}
/* Icon buttons match the Studio expand button: green with a white icon, light or dark mode. */
.bar .refresh-trigger{color:#fff;background:#2C4A32;border:1px solid #2C4A32;box-shadow:0 1px 2px rgba(27,48,32,.18)}
.bar .refresh-trigger:hover{filter:brightness(1.12);background:#2C4A32}
.bar .refresh-trigger svg path{stroke-width:2.4}
/* On the dark phone header, a light ring keeps the green button visible against the green bar. */
@media (max-width:820px){.bar .refresh-trigger{border-color:rgba(255,255,255,.35);background:rgba(255,255,255,.12)}}
.refresh-trigger.spinning svg{animation:rl-spin .7s linear infinite}
@keyframes rl-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.refresh-trigger.spinning svg{animation:none;opacity:.5}}
@media (max-width:820px){
 .bar{grid-template-columns:1fr auto auto;grid-template-areas:"title refresh quick" "search search proposal"}
 .bar .refresh-trigger{grid-area:refresh;width:44px;height:44px}
}
/* Full-screen windows (email and PDF preview): edge to edge on a phone, every control clear of the notch and home bar. */
.pv-bar{height:auto;min-height:calc(56px + var(--app-safe-top,0px));padding:var(--app-safe-top,0px) max(16px,var(--app-safe-right,0px)) 0 max(16px,var(--app-safe-left,0px))}
.pv-stage{height:calc(100% - 56px - var(--app-safe-top,0px))}
.pv-pages{padding-bottom:calc(40px + var(--app-safe-bottom,0px))}
.compose-x svg,.pv-x svg,.tour-x svg{display:block}
.compose-text{overflow:hidden;flex:1 0 auto}
.compose-sig .sig-lines{min-width:0;overflow-wrap:anywhere}
.compose-sig .sig-card{min-width:0;max-width:100%}
@media (max-width:820px){
 dialog.send-dialog.compose,dialog.pdf-viewer{inset:0;margin:0;width:100%;height:100dvh;max-width:none;max-height:none;border-radius:0}
 .compose-head{padding:calc(8px + var(--app-safe-top,0px)) max(10px,var(--app-safe-right,0px)) 8px max(16px,var(--app-safe-left,0px))}
 .compose-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .compose-x{width:44px;height:44px;flex:none}
 .pv-x{width:44px;height:44px}
 .compose-foot{padding:10px max(12px,var(--app-safe-right,0px)) calc(10px + var(--app-safe-bottom,0px)) max(12px,var(--app-safe-left,0px))}
 .compose-text{min-height:160px}
 .compose-sig img{width:76px}
}
.cf-val{overflow-wrap:anywhere}
/* Long job names: the sticky window title stays two lines on a phone instead of filling the screen. */
@media (max-width:820px){
 dialog .mh h2{font-size:22px;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
 dialog .mh{padding:16px 18px 12px}
}
/* Dropdowns: the chosen text never runs under the arrow. */
select.in{padding-right:34px;text-overflow:ellipsis}
@media (max-width:820px){dialog .mb{padding-top:14px}dialog .mb > .chip:first-child{justify-self:start}}
/* Readable in both themes: today's date on the calendar, the draft-sync note, and the builder's "open a blank" links. */
.is-today>.calendar-date{color:#fff}
.studio-sync{color:var(--ink-3)}
.new-doc-blank{color:var(--ink-2);min-height:32px;padding:4px .2rem}
:root[data-theme="dark"] .new-doc{background:var(--paper);border-color:var(--stone-200);border-left-color:#C9A44C;color:var(--ink)}
:root[data-theme="dark"] .new-doc strong{color:var(--ink)}
:root[data-theme="dark"] .new-doc span{color:var(--ink-2)}
:root[data-theme="dark"] .new-doc:hover,:root[data-theme="dark"] .new-doc:focus-visible{background:var(--stone-50);border-color:#9fc79f}
/* Dark theme for the Proposal windows (email, builder, recently deleted, settings): they follow the CRM's dark palette
   instead of staying light. The signature card, attachment chips and email preview stay white on purpose: that is how the customer sees them. */
:root[data-theme="dark"] .send-dialog{background:var(--paper);color:var(--ink)}
:root[data-theme="dark"] .send-foot,:root[data-theme="dark"] .compose-foot{background:var(--paper);border-top-color:var(--stone-200)}
:root[data-theme="dark"] .send-head h2,:root[data-theme="dark"] .b-sub{color:var(--ink)}
:root[data-theme="dark"] :is(.send-row .lb,.send-check small,.chip small,.b-line.b-head,.vol .lb,.b-line.b-rhead,.b-alt .lb,.b-line.b-ahead,.b-hint,.cf-lb,.compose-note){color:var(--ink-3)}
:root[data-theme="dark"] :is(.send-row .ok,.es-row .ok,.cf-link,.att-act){color:#9fc79f}
:root[data-theme="dark"] .linkish{color:#efaa99}
:root[data-theme="dark"] .new-doc-blank{color:var(--ink-2)}
:root[data-theme="dark"] :is(.b-sec,.cf-row,.send-extra,.send-thumb){border-color:var(--stone-200)}
:root[data-theme="dark"] .b-line{border-color:var(--stone-200)}
:root[data-theme="dark"] .cf-row:focus-within{border-bottom-color:#9fc79f}
:root[data-theme="dark"] .b-total{border-top-color:#9fc79f}
:root[data-theme="dark"] .vol,:root[data-theme="dark"] .compose-banner.muted{background:var(--stone-50);color:var(--ink)}
:root[data-theme="dark"] .compose-banner{background:#2e2819;color:var(--ink)}
:root[data-theme="dark"] .compose-banner.muted{border-left-color:var(--stone-200)}
:root[data-theme="dark"] .send-extra{background:var(--stone-50)}
:root[data-theme="dark"] .tool-btn{color:var(--ink-2)}
:root[data-theme="dark"] .tool-btn:hover{background:var(--stone-50);color:var(--ink)}
:root[data-theme="dark"] .compose-text,:root[data-theme="dark"] .cf-in{color:var(--ink)}
:root[data-theme="dark"] .att-chip small,:root[data-theme="dark"] .att-chip span:not(.att-ico){color:#1A1F17}
/* Light theme: the small grey labels in the builder and chooser use the CRM's readable grey. */
:is(.new-doc span,.vol .lb,.b-alt .lb,.b-line.b-head,.b-line.b-rhead,.b-line.b-ahead,.b-hint,.send-row .lb,.send-check small,.chip small){color:var(--ink-3)}
:root[data-theme="dark"] .new-doc span{color:var(--ink-2)}
/* Email fields look like Gmail's: the underline shows focus, no box inside the line; no dropdown arrow on To. */
.cf-in:focus,.cf-in:focus-visible{outline:none;box-shadow:none;border:0}
.cf-in::-webkit-calendar-picker-indicator,.cf-in::-webkit-list-button{display:none!important;opacity:0}
.cf-row:focus-within{box-shadow:0 1px 0 0 #2C4A32}
:root[data-theme="dark"] .cf-row:focus-within{box-shadow:0 1px 0 0 #9fc79f}

/* Phone or computer set to dark mode with the CRM on "System": same dark fixes as the Dark setting. */
@media (prefers-color-scheme:dark){
 :root[data-theme="system"] .row.assigned{background:var(--gold-pale)}
 :root[data-theme="system"] .studio-size{background:#2C4A32;border-color:#2C4A32}
 :root[data-theme="system"] .new-doc{background:var(--paper);border-color:var(--stone-200);border-left-color:#C9A44C;color:var(--ink)}
 :root[data-theme="system"] .new-doc strong{color:var(--ink)}
 :root[data-theme="system"] .new-doc span{color:var(--ink-2)}
 :root[data-theme="system"] .new-doc:hover,:root[data-theme="system"] .new-doc:focus-visible{background:var(--stone-50);border-color:#9fc79f}
 /* Dark theme for the Proposal windows (email, builder, recently deleted, settings): they follow the CRM's dark palette
    instead of staying light. The signature card, attachment chips and email preview stay white on purpose: that is how the customer sees them. */
 :root[data-theme="system"] .send-dialog{background:var(--paper);color:var(--ink)}
 :root[data-theme="system"] .send-foot,:root[data-theme="system"] .compose-foot{background:var(--paper);border-top-color:var(--stone-200)}
 :root[data-theme="system"] .send-head h2,:root[data-theme="system"] .b-sub{color:var(--ink)}
 :root[data-theme="system"] :is(.send-row .lb,.send-check small,.chip small,.b-line.b-head,.vol .lb,.b-line.b-rhead,.b-alt .lb,.b-line.b-ahead,.b-hint,.cf-lb,.compose-note){color:var(--ink-3)}
 :root[data-theme="system"] :is(.send-row .ok,.es-row .ok,.cf-link,.att-act){color:#9fc79f}
 :root[data-theme="system"] .linkish{color:#efaa99}
 :root[data-theme="system"] .new-doc-blank{color:var(--ink-2)}
 :root[data-theme="system"] :is(.b-sec,.cf-row,.send-extra,.send-thumb){border-color:var(--stone-200)}
 :root[data-theme="system"] .b-line{border-color:var(--stone-200)}
 :root[data-theme="system"] .cf-row:focus-within{border-bottom-color:#9fc79f}
 :root[data-theme="system"] .b-total{border-top-color:#9fc79f}
 :root[data-theme="system"] .vol,:root[data-theme="system"] .compose-banner.muted{background:var(--stone-50);color:var(--ink)}
 :root[data-theme="system"] .compose-banner{background:#2e2819;color:var(--ink)}
 :root[data-theme="system"] .compose-banner.muted{border-left-color:var(--stone-200)}
 :root[data-theme="system"] .send-extra{background:var(--stone-50)}
 :root[data-theme="system"] .tool-btn{color:var(--ink-2)}
 :root[data-theme="system"] .tool-btn:hover{background:var(--stone-50);color:var(--ink)}
 :root[data-theme="system"] .compose-text,:root[data-theme="system"] .cf-in{color:var(--ink)}
 :root[data-theme="system"] .att-chip small,:root[data-theme="system"] .att-chip span:not(.att-ico){color:#1A1F17}
 :root[data-theme="system"] .new-doc span{color:var(--ink-2)}
 :root[data-theme="system"] .cf-row:focus-within{box-shadow:0 1px 0 0 #9fc79f}
}
