/* NAJM Studio interface styles.
 *
 * Lifted from the approved najm-studio.html prototype. The only change is that
 * --logo now points at /assets/najm-wordmark.png instead of carrying the
 * wordmark inline. Do not restyle anything here without asking Jass: the look,
 * spacing and wording are signed off.
 */

:root{
  --burg:#3b0710;--burg2:#521220;--cream:#fbf1e5;--gold:#c9a25e;
  --bg:#f8eddf;--paper:#fffaf3;--ink:#2b1316;--muted:#7c625c;--line:#e6d4bf;--line2:#efe2d1;
  --accent:#3b0710;--accentInk:#fbf1e5;--goldink:#86652a;--danger:#a3261b;--ok:#3f6b3a;--hover:#f5e7d4;--spend:#5a1422;--shade:rgba(59,7,16,.06);
  --serif:"Cormorant Garamond","Cormorant",Georgia,"Times New Roman",serif;
  --sans:"Hanken Grotesk",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --logo:url(/assets/najm-wordmark.png);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){--bg:#150306;--paper:#20070c;--ink:#f3e5d3;--muted:#b89c90;--line:#3f1b21;--line2:#2c0e14;--accent:#d9b676;--accentInk:#2a060c;--goldink:#d9b676;--danger:#ec7a6b;--ok:#93c38a;--hover:#2a0b11;--spend:#b25866;--shade:rgba(0,0,0,.3)}
}
:root[data-theme="dark"]{--bg:#150306;--paper:#20070c;--ink:#f3e5d3;--muted:#b89c90;--line:#3f1b21;--line2:#2c0e14;--accent:#d9b676;--accentInk:#2a060c;--goldink:#d9b676;--danger:#ec7a6b;--ok:#93c38a;--hover:#2a0b11;--spend:#b25866;--shade:rgba(0,0,0,.3)}
:root{box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
*,*::before,*::after{box-sizing:inherit}
html,body{margin:0;min-height:100%}
body{background:var(--bg);color:var(--ink);font:15px/1.5 var(--sans);-webkit-font-smoothing:antialiased}
img{max-width:100%}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
a{color:var(--goldink)}
[hidden]{display:none!important}

/* layout */
#app{display:grid;grid-template-columns:228px minmax(0,1fr);min-height:100vh}
#side{background:var(--burg);color:var(--cream);padding:22px 14px;position:sticky;top:0;height:100vh;height:100dvh;display:flex;flex-direction:column;gap:2px;overflow:auto}
.brand{display:block;width:132px;height:36px;background:var(--cream);-webkit-mask:var(--logo) left center/contain no-repeat;mask:var(--logo) left center/contain no-repeat;margin:2px 10px 4px}
.brand-sub{font:italic 500 17px/1 var(--serif);color:var(--gold);margin:0 10px 22px}
.nav{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:none;border:0;color:rgba(251,241,229,.78);padding:9px 10px;border-radius:6px;cursor:pointer;font-size:14.5px}
.nav:hover{background:rgba(251,241,229,.07);color:var(--cream)}
.nav.on{background:rgba(251,241,229,.1);color:var(--cream);box-shadow:inset 2px 0 0 var(--gold)}
.nav svg{width:17px;height:17px;flex:none;opacity:.85}
.side-cta{margin:0 0 16px;background:var(--gold);color:var(--burg);border:0;border-radius:6px;padding:10px 12px;font-weight:600;cursor:pointer;text-align:left}
.side-cta:hover{filter:brightness(1.06)}
.side-foot{margin-top:auto;font-size:12px;color:rgba(251,241,229,.55);padding:12px 10px 0;line-height:1.4}
.dot{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:6px;background:#8a8a8a;vertical-align:1px}
.dot.live{background:#7fc27a}.dot.local{background:var(--gold)}
#main{padding:30px 38px 70px;min-width:0}
@media (max-width:860px){
  #app{grid-template-columns:1fr}
  #side{position:sticky;top:0;height:auto;flex-direction:row;align-items:center;padding:10px 12px;gap:4px;overflow-x:auto;z-index:20}
  .brand{width:84px;height:26px;margin:0 8px 0 2px;flex:none}
  .brand-sub,.side-foot{display:none}
  .nav{width:auto;white-space:nowrap;padding:7px 10px}.nav span{display:none}.nav.on span{display:inline}
  .side-cta{margin:0 4px 0 0;flex:none;white-space:nowrap;padding:8px 10px}
  #main{padding:20px 16px 60px}
}

/* type */
h1{font:500 38px/1.05 var(--serif);margin:0;letter-spacing:-.01em}
h2{font:500 25px/1.15 var(--serif);margin:0 0 12px}
h3{font:600 14px/1.3 var(--sans);margin:0 0 10px;color:var(--ink)}
.muted{color:var(--muted)}.small{font-size:13px}.num{font-variant-numeric:tabular-nums}
.head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:22px}
.head .sub{color:var(--muted);margin-top:6px}
.crumb{font-size:13px;color:var(--muted);margin-bottom:6px}
.crumb button{background:none;border:0;padding:0;color:var(--goldink);cursor:pointer;font-size:13px}

/* controls */
.btn{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--line);background:var(--paper);border-radius:7px;padding:8px 13px;cursor:pointer;font-size:14px;font-weight:500;white-space:nowrap;text-decoration:none;color:var(--ink)}
.btn:hover{background:var(--hover)}
.btn.primary{background:var(--accent);color:var(--accentInk);border-color:var(--accent)}
.btn.primary:hover{filter:brightness(1.12);background:var(--accent)}
.btn.danger{color:var(--danger);border-color:color-mix(in srgb,var(--danger) 40%,var(--line))}
.btn.sm{padding:5px 9px;font-size:13px}
.btn:disabled{opacity:.5;cursor:default}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.row.end{justify-content:flex-end}.grow{flex:1}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:7px;overflow:hidden;background:var(--paper)}
.seg button{border:0;background:none;padding:7px 12px;cursor:pointer;font-size:13.5px}
.seg button.on{background:var(--accent);color:var(--accentInk)}
input[type=text],input[type=email],input[type=tel],input[type=number],input[type=date],input[type=search],input[type=password],select,textarea{width:100%;background:var(--paper);border:1px solid var(--line);border-radius:7px;padding:8px 10px;min-height:38px}
textarea{resize:vertical;line-height:1.5}
input:focus,select:focus,textarea:focus{outline:2px solid color-mix(in srgb,var(--gold) 70%,transparent);outline-offset:0;border-color:var(--gold)}
.search{max-width:280px}
.grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px 14px}
.fld{display:flex;flex-direction:column;gap:5px;grid-column:span 12;min-width:0}
.fld>span{font-size:12.5px;color:var(--muted);font-weight:500}
.fld.chk{flex-direction:row;align-items:center;gap:9px;padding-top:22px}
.fld.chk input{width:18px;height:18px;accent-color:var(--burg)}
.w2{grid-column:span 2}.w3{grid-column:span 3}.w4{grid-column:span 4}.w6{grid-column:span 6}.w8{grid-column:span 8}
@media (max-width:1100px){.w2,.w3{grid-column:span 6}.w4{grid-column:span 6}}
@media (max-width:600px){.w2,.w3,.w4,.w6,.w8{grid-column:span 12}}

/* panels */
.panel{background:var(--paper);border:1px solid var(--line);border-radius:10px;padding:20px 22px}
.panel+.panel{margin-top:16px}
.panel-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:14px}
.panel-head h2{margin:0}
.cols{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr);gap:16px;align-items:start}
.cols>div>.panel+.panel{margin-top:16px}
@media (max-width:1100px){.cols{grid-template-columns:1fr}}
.banner{border:1px solid color-mix(in srgb,var(--gold) 60%,var(--line));background:color-mix(in srgb,var(--gold) 12%,var(--paper));border-radius:8px;padding:10px 14px;font-size:14px;margin-bottom:16px}
.banner.warn{border-color:color-mix(in srgb,var(--danger) 45%,var(--line));background:color-mix(in srgb,var(--danger) 8%,var(--paper))}
.empty{padding:38px 20px;text-align:center;color:var(--muted)}
.empty b{display:block;font:500 22px/1.2 var(--serif);color:var(--ink);margin-bottom:6px}

/* tables */
.tbl{overflow-x:auto;border:1px solid var(--line);border-radius:10px;background:var(--paper)}
table{border-collapse:collapse;width:100%;font-variant-numeric:tabular-nums}
th{font-size:12.5px;font-weight:600;color:var(--muted);text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);white-space:nowrap;background:var(--paper);position:sticky;top:0}
th.sortable{cursor:pointer;user-select:none}th.sortable:hover{color:var(--ink)}
td{padding:10px 12px;border-bottom:1px solid var(--line2);vertical-align:middle}
tr:last-child td{border-bottom:0}
tbody tr.click{cursor:pointer}tbody tr.click:hover td{background:var(--hover)}
td.r,th.r{text-align:right}
td .strong{font-weight:600}
.pill{display:inline-block;border-radius:999px;padding:2px 9px;font-size:12px;font-weight:500;white-space:nowrap;border:1px solid transparent}
.g0{background:color-mix(in srgb,var(--burg) 9%,var(--paper));color:var(--ink);border-color:color-mix(in srgb,var(--burg) 18%,transparent)}
.g1{background:color-mix(in srgb,var(--gold) 20%,var(--paper));color:var(--ink);border-color:color-mix(in srgb,var(--gold) 45%,transparent)}
.g2{background:color-mix(in srgb,#4f7a4a 15%,var(--paper));color:var(--ink);border-color:color-mix(in srgb,#4f7a4a 35%,transparent)}
.g3{background:var(--line2);color:var(--muted)}
.neg{color:var(--danger)}.pos{color:var(--ok)}

/* dashboard */
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:1px;background:var(--line2);border:1px solid var(--line);border-radius:10px;overflow:hidden;margin-bottom:16px}
.kpi{padding:18px 20px;background:var(--paper)}
.kpi .v{font:500 32px/1.05 var(--serif);font-variant-numeric:lining-nums tabular-nums}
.kpi .l{font-size:13px;color:var(--muted);margin-top:4px}
.dash>.panel{margin-top:0!important}.tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:-8px 0 18px}.tools .search{flex:1;min-width:180px}
.dash{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:16px}
@media (max-width:1000px){.dash{grid-template-columns:1fr}}
.stagebar{display:grid;grid-template-columns:190px 1fr 28px;gap:10px;align-items:center;font-size:13.5px;padding:4px 0}
.stagebar.wide{grid-template-columns:minmax(110px,170px) 1fr 76px}
.stagebar .track{height:10px;background:var(--line2);border-radius:5px;overflow:hidden}
.stagebar .fill{height:100%;background:var(--gold);border-radius:5px}
.legend{display:flex;gap:16px;font-size:12.5px;color:var(--muted)}
.legend i{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:6px;vertical-align:-1px}
.list{list-style:none;margin:0;padding:0}
.list li{display:flex;justify-content:space-between;gap:12px;padding:9px 0;border-bottom:1px solid var(--line2);font-size:14px}
.list li:last-child{border-bottom:0}
.list li button{background:none;border:0;padding:0;cursor:pointer;text-align:left;color:var(--ink);font-weight:500}
.list li button:hover{color:var(--goldink)}

/* kanban */
.board{display:flex;gap:12px;overflow-x:auto;padding-bottom:14px;align-items:flex-start;min-height:60vh}
.kcol{flex:0 0 250px;background:color-mix(in srgb,var(--paper) 55%,var(--bg));border:1px solid var(--line2);border-radius:10px;padding:10px;transition:background .15s}
.kcol.over{background:color-mix(in srgb,var(--gold) 18%,var(--paper));border-color:var(--gold)}
.kcol-h{display:flex;justify-content:space-between;align-items:baseline;font-size:13px;font-weight:600;padding:2px 4px 10px}
.kcol-h span{color:var(--muted);font-weight:500}
.kcards{display:flex;flex-direction:column;gap:8px;min-height:40px}
.kcard{background:var(--paper);border:1px solid var(--line);border-radius:8px;padding:10px 10px 10px 8px;display:grid;grid-template-columns:18px 1fr;gap:6px;cursor:pointer}
.kcard:hover{border-color:var(--gold)}
.kcard.dragging{opacity:.35}
.grip{cursor:grab;color:var(--muted);touch-action:none;display:flex;align-items:flex-start;padding-top:2px}
.grip svg{width:14px;height:14px}
.kcard .t{font-weight:600;font-size:14px;line-height:1.3}
.kcard .m{font-size:12.5px;color:var(--muted);margin-top:2px}
.kcard .thumb{width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:5px;margin-top:8px;background:var(--line2)}
.kcard .b{display:flex;justify-content:space-between;gap:6px;margin-top:8px;font-size:12px}
.ghost{position:fixed;pointer-events:none;z-index:500;transform:rotate(2deg);box-shadow:0 12px 30px rgba(0,0,0,.25);width:230px}

/* files */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.tile{position:relative;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--line2);aspect-ratio:1;cursor:pointer;padding:0}
.tile img{width:100%;height:100%;object-fit:cover;display:block}
.tile .doc{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:10px;font-size:12px;color:var(--muted);text-align:center;word-break:break-word}
.tile .doc b{font:600 22px/1 var(--serif);color:var(--ink);margin-bottom:6px}
.tile .cap{position:absolute;left:0;right:0;bottom:0;padding:16px 8px 6px;font-size:12px;color:#fff;background:linear-gradient(transparent,rgba(0,0,0,.6));text-align:left}
.drop{border:1.5px dashed var(--line);border-radius:8px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px;aspect-ratio:1;color:var(--muted);font-size:13px;cursor:pointer;background:none;padding:10px;text-align:center}
.drop:hover,.drop.over{border-color:var(--gold);color:var(--ink);background:color-mix(in srgb,var(--gold) 8%,transparent)}
.tiles.sm{grid-template-columns:repeat(auto-fill,minmax(108px,1fr));gap:8px}.fgroup{padding-top:14px;border-top:1px solid var(--line2);margin-top:14px}.fgroup:first-of-type{border-top:0;margin-top:0;padding-top:4px}.fgroup h3{margin-bottom:8px}
.chosen{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;border:1px solid var(--gold);background:color-mix(in srgb,var(--gold) 9%,var(--paper));border-radius:8px;padding:12px 14px}
.list.pick{max-height:320px;overflow:auto;border:1px solid var(--line2);border-radius:8px;padding:0 12px}.list.pick li button{display:flex;flex-direction:column;gap:1px}
.dropbar{display:flex;flex-direction:column;gap:2px;align-items:flex-start;width:100%;border:1.5px dashed var(--line);border-radius:10px;background:none;padding:14px 18px;margin:0 0 18px;cursor:pointer;text-align:left;color:var(--muted);font-size:13.5px}
.dropbar b{color:var(--ink);font-size:15px;font-weight:600}.dropbar:hover,.dropbar.over{border-color:var(--gold);background:color-mix(in srgb,var(--gold) 8%,transparent)}
.docchip{display:inline-flex;align-items:center;gap:5px;font-size:12px;color:var(--muted)}.docchip img{width:30px;height:30px;object-fit:cover;border-radius:4px;border:1px solid var(--line)}
.docchip b{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:4px;border:1px solid var(--line);background:var(--line2);font-size:10px;color:var(--ink)}
.expgrid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:20px;align-items:start}
@media (max-width:760px){.expgrid{grid-template-columns:1fr}}
.docpane{min-width:0}.docview{display:block;width:100%;height:min(62vh,640px);object-fit:contain;background:var(--line2);border-radius:8px;border:1px solid var(--line)}
.docstrip{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}.docstrip button{width:52px;height:52px;border-radius:6px;border:1px solid var(--line);background:var(--line2);padding:0;overflow:hidden;cursor:pointer;font-size:11px;font-weight:600;color:var(--muted)}
.docstrip button.on{outline:2px solid var(--gold);outline-offset:1px}.docstrip img{width:100%;height:100%;object-fit:cover}
.terms-html{font-size:14px;line-height:1.6}.terms-html h4{font:600 15px/1.3 var(--sans);margin:18px 0 6px}.terms-html p{margin:0 0 8px}.terms-html ul{margin:0 0 10px;padding-left:22px}.terms-html li{margin-bottom:3px}
.doc-sheet ul.decl{font-size:14px;line-height:1.6;padding-left:22px}.doc-imgs{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:0 0 18px}.doc-imgs img{width:100%;aspect-ratio:1;object-fit:cover;border-radius:6px}
.steps{margin:18px 0 0;padding-left:20px;font-size:14px}.steps li{margin-bottom:12px}
.final-tag{position:absolute;top:6px;left:6px;background:var(--gold);color:#3b0710;font-size:11px;font-weight:600;padding:2px 7px;border-radius:999px}
.final-toggle{display:flex;gap:12px;align-items:flex-start;border:1px solid var(--gold);border-radius:8px;padding:12px 14px;margin:6px 0 14px;cursor:pointer;background:color-mix(in srgb,var(--gold) 8%,var(--paper))}
.final-toggle input{width:20px;height:20px;accent-color:var(--burg);margin-top:2px;flex:none}.final-toggle b{display:block}.final-toggle span{font-size:13px;color:var(--muted)}.final-toggle b{color:var(--ink);font-size:14px}
.lib-tiles{grid-template-columns:repeat(auto-fill,minmax(190px,1fr))}
.meter{height:6px;border-radius:3px;background:var(--line2);overflow:hidden;width:180px;display:inline-block;vertical-align:middle;margin-left:8px}
.meter i{display:block;height:100%;background:var(--gold)}

/* timeline */
.tl{list-style:none;margin:0;padding:0 0 0 14px;border-left:1px solid var(--line)}
.tl li{position:relative;padding:0 0 10px 12px;font-size:13.5px}
.tl li::before{content:"";position:absolute;left:-19px;top:6px;width:9px;height:9px;border-radius:50%;background:var(--gold)}
.tl li span{color:var(--muted);font-size:12.5px;display:block}
.money{display:grid;grid-template-columns:1fr auto;gap:6px 12px;font-size:14px;margin:4px 0 14px}
.money .tot{font-weight:600;border-top:1px solid var(--line);padding-top:6px}
.mini{width:100%;font-size:13.5px}.mini td{padding:6px 4px}.mini td:last-child{width:30px}
.x{background:none;border:0;color:var(--muted);cursor:pointer;font-size:18px;line-height:1;padding:2px 6px}.x:hover{color:var(--danger)}

/* modal + toast */
#modal{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:16px}
.scrim{position:absolute;inset:0;background:rgba(20,3,6,.55)}
.sheet{position:relative;background:var(--paper);color:var(--ink);border-radius:12px;padding:22px 24px;width:min(560px,100%);max-height:calc(100% - 24px);overflow:auto;box-shadow:0 20px 60px rgba(0,0,0,.35)}
.sheet.wide{width:min(980px,100%)}
.sheet h2{margin-bottom:14px}
.sheet .foot{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
.lb{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(240px,1fr);gap:18px}
.lb img{width:100%;max-height:70vh;object-fit:contain;background:var(--line2);border-radius:8px}
@media (max-width:760px){.lb{grid-template-columns:1fr}}
#toast{position:fixed;left:50%;bottom:calc(20px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:1100;display:flex;flex-direction:column;gap:6px;align-items:center;pointer-events:none}
#toast div{background:var(--burg);color:var(--cream);padding:9px 16px;border-radius:8px;font-size:14px;box-shadow:0 8px 24px rgba(0,0,0,.25)}

/* contract document */
.doc-sheet{background:#fffaf3;color:#2b1316;border:1px solid var(--line);border-radius:10px;padding:44px 52px;max-width:860px}
.doc-sheet .mark{width:180px;height:48px;background:#3b0710;-webkit-mask:var(--logo) left center/contain no-repeat;mask:var(--logo) left center/contain no-repeat;margin-bottom:18px}
.doc-sheet h2{font-size:30px}
.doc-sheet dl{display:grid;grid-template-columns:200px 1fr;gap:6px 16px;margin:0 0 20px;font-size:14.5px}
.doc-sheet dt{color:#7c625c}.doc-sheet dd{margin:0}
.terms-text{white-space:pre-wrap;font-size:14px;line-height:1.6}
.sigs{display:grid;grid-template-columns:1fr 1fr;gap:28px;margin-top:26px}
.sigs img{height:90px;max-width:100%;object-fit:contain;object-position:left bottom;display:block;border-bottom:1px solid #c9a25e;margin-bottom:6px}
@media (max-width:700px){.doc-sheet{padding:26px 20px}.doc-sheet dl{grid-template-columns:1fr}.sigs{grid-template-columns:1fr}}

/* client mode */
#client{position:fixed;inset:0;z-index:900;background:var(--burg);color:var(--cream);overflow:auto;-webkit-overflow-scrolling:touch;padding:env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px)}
.c-top{display:flex;justify-content:space-between;align-items:center;padding:22px 32px}
.c-mark{width:150px;height:40px;background:var(--cream);-webkit-mask:var(--logo) left center/contain no-repeat;mask:var(--logo) left center/contain no-repeat}
.c-exit{background:none;border:1px solid rgba(251,241,229,.25);color:rgba(251,241,229,.6);border-radius:6px;padding:6px 10px;font-size:12px;cursor:pointer}
.c-wrap{max-width:880px;margin:0 auto;padding:10px 32px 80px}
.c-wrap h1{font:400 50px/1.05 var(--serif);margin:18px 0 6px}
.c-wrap .lede{font:italic 400 22px/1.4 var(--serif);color:var(--gold);margin:0 0 34px}
.c-sec{border-top:1px solid rgba(201,162,94,.45);padding:26px 0}
.c-sec h2{font:500 28px/1.2 var(--serif);margin:0 0 16px;color:var(--cream)}
.c-dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 32px;margin:0}
.c-dl div{border-bottom:1px solid rgba(251,241,229,.12);padding-bottom:10px}
.c-dl dt{font-size:13px;color:rgba(251,241,229,.6)}.c-dl dd{margin:2px 0 0;font:500 21px/1.3 var(--serif)}
.c-brief{font:400 19px/1.55 var(--serif);white-space:pre-wrap;color:rgba(251,241,229,.92)}
.c-imgs{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;margin-top:18px}
.c-imgs img{width:100%;aspect-ratio:1;object-fit:cover;border-radius:6px}
.c-price{display:grid;grid-template-columns:1fr auto;gap:10px 20px;font:400 22px/1.3 var(--serif);font-variant-numeric:lining-nums tabular-nums}
.c-price .big{font-size:32px;color:var(--gold)}
.c-terms{background:var(--cream);color:#2b1316;border-radius:8px;padding:10px 26px 22px;max-height:60vh;overflow:auto;font-size:15px;line-height:1.65}
.c-terms h4{font:600 18px/1.3 var(--serif);color:#3b0710;margin:20px 0 8px}.c-terms p{margin:0 0 10px}.c-terms ul{margin:0 0 12px;padding-left:22px}.c-terms li{margin-bottom:4px}
.c-form{display:grid;grid-template-columns:1fr 1fr;gap:18px 28px}.c-form label{display:block}.c-form .wide{grid-column:1/-1}
#client textarea.c-input{resize:none;font-size:22px}
.c-final{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:4px}.c-final img{width:100%;aspect-ratio:1;object-fit:cover;border-radius:8px;background:var(--cream)}
.c-final.one{grid-template-columns:1fr}.c-final.one img{aspect-ratio:4/3;object-fit:contain}
.c-signmeta{display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;font-size:16px;color:rgba(251,241,229,.75);margin-top:18px}.c-signmeta b{color:var(--cream);font:500 21px/1.2 var(--serif);margin-left:6px}
@media (max-width:700px){.c-form{grid-template-columns:1fr}}
.c-note{font-size:14px;color:rgba(251,241,229,.7);margin:12px 0 0}
.c-opts{display:grid;grid-template-columns:1fr 1fr;gap:12px}.c-opt{display:flex;gap:14px;align-items:flex-start;border:1px solid rgba(251,241,229,.3);border-radius:10px;padding:18px;cursor:pointer;font-size:16px;line-height:1.4}
.c-opt b{display:block;font:500 24px/1.2 var(--serif);color:var(--cream);margin-bottom:4px}.c-opt span{color:rgba(251,241,229,.8)}.c-opt input{width:24px;height:24px;accent-color:var(--gold);flex:none;margin-top:4px}
.c-opt:has(input:checked){border-color:var(--gold);background:rgba(201,162,94,.12)}
.c-decl{font-size:17px;line-height:1.55;padding-left:22px;margin:10px 0 0}.c-decl li{margin-bottom:8px}
@media (max-width:700px){.c-opts{grid-template-columns:1fr}}
.c-agree{display:flex;gap:14px;align-items:flex-start;font-size:17px;margin:22px 0 18px;cursor:pointer}
.c-agree input{width:26px;height:26px;accent-color:var(--gold);flex:none;margin-top:1px}
.c-label{font-size:14px;color:rgba(251,241,229,.7);display:block;margin-bottom:6px}
#client .c-input{width:100%;background:transparent;border:0;border-bottom:1px solid rgba(251,241,229,.4);color:var(--cream);font:400 26px/1.3 var(--serif);padding:6px 2px;border-radius:0;min-height:0}
#client .c-input:focus{outline:0;border-bottom-color:var(--gold)}
.sig-wrap{position:relative;margin-top:22px}
.sig{display:block;width:100%;height:260px;background:var(--cream);border-radius:8px;touch-action:none;cursor:crosshair}
.sig-line{position:absolute;left:28px;right:28px;bottom:58px;border-bottom:1px solid rgba(59,7,16,.35);pointer-events:none}
.sig-x{position:absolute;left:28px;bottom:64px;font:400 30px/1 var(--serif);color:rgba(59,7,16,.4);pointer-events:none}
.c-btns{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:14px;flex-wrap:wrap}
.c-btn{background:var(--gold);color:var(--burg);border:0;border-radius:8px;padding:16px 28px;font:600 17px/1 var(--sans);cursor:pointer}
.c-btn:disabled{opacity:.45;cursor:default}
.c-btn.line{background:none;color:var(--cream);border:1px solid rgba(251,241,229,.4);padding:12px 18px;font-size:15px}
.c-err{color:#f2b6a8;font-size:15px;margin-top:10px;min-height:1em}
.c-done{text-align:center;padding:12vh 20px}
.c-done .c-mark{margin:0 auto 30px;width:220px;height:60px;-webkit-mask-position:center;mask-position:center}
@media (max-width:700px){.c-dl{grid-template-columns:1fr}.c-wrap h1{font-size:38px}.c-wrap{padding:10px 20px 60px}.c-top{padding:16px 20px}}

@media print{
  #side,.head .row,.no-print,#toast{display:none!important}
  #app{display:block}#main{padding:0}body{background:#fff}
  .doc-sheet{border:0;padding:0;max-width:none}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}

/* Added during the port: the prototype had no sign-in, so it had nothing to
   sign out of. The sidebar footer is hidden on narrow screens, so there is a
   second sign-out button in Settings for the tablet. */
.side-signout{display:block;margin-top:8px;background:none;border:0;padding:0;
  font:inherit;font-size:12px;color:var(--gold);cursor:pointer;text-decoration:underline}
.side-signout:hover{color:var(--cream)}

/* A button that reads as a link, for small inline actions like cancelling a
   signing link. Added during the port: the prototype had no such action. */
.linklike{background:none;border:0;padding:0;margin-left:6px;font:inherit;
  color:var(--goldink);cursor:pointer;text-decoration:underline}

/* ---------- phones ---------- */
/*
 * New, not a change to the approved design.
 *
 * The prototype turns the sidebar into a horizontally scrolling strip below
 * 860px, which is fine on a tablet and poor on a phone: you have to swipe the
 * navigation sideways to find anything. Phones were not really a case the
 * prototype addressed.
 *
 * Below 700px it becomes a bottom bar instead. Everything is reachable with a
 * thumb, nothing scrolls, and New enquiry sits above it as a floating button.
 * Tablets and laptops are untouched: 700px is below the narrow side of a
 * Galaxy Tab in portrait.
 */
@media (max-width: 700px) {
  #side {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
    overflow: visible;
    border-top: 1px solid rgba(201, 162, 94, .22);
    z-index: 60;
  }

  /* The wordmark and the sign-out line have no room here. In a standalone app
     the burgundy status bar carries the branding, and each page says what it
     is in its own heading. Sign out stays reachable in Settings. */
  .brand, .brand-sub, .side-foot { display: none }

  .nav {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 7px 2px 5px;
    border-radius: 10px;
    border-left: 0;
  }
  .nav svg { width: 21px; height: 21px; flex: none }

  /* Every label shown, not just the active one, so nothing is a guess.
     Wrapping to two lines rather than truncating: "Photo library" over two
     lines reads better than "Photo libr...". */
  .nav span,
  .nav.on span {
    display: block;
    /* 9px, because "Commissions" is the longest single word and has to fit
       one line at a seventh of a phone's width. Breaks are allowed at spaces
       only: "Photo library" over two lines is fine, "Commissio / ns" is not. */
    font-size: 9px;
    line-height: 1.15;
    letter-spacing: -.01em;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    max-width: 100%;
    text-align: center;
  }
  .nav.on { background: rgba(251, 241, 229, .12) }

  /* New enquiry is the one thing done often enough to deserve its own button,
     so it floats above the bar rather than competing for space inside it. */
  .side-cta {
    position: fixed;
    right: 14px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    z-index: 61;
    border-radius: 999px;
    padding: 13px 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  }

  /* New enquiry already floats above the bar, so the copy of it in each page
     heading is one button too many on a small screen. */
  #main [data-action="intake"] { display: none }

  /* Room for the bar and the floating button. */
  #main { padding: 18px 14px calc(104px + env(safe-area-inset-bottom, 0px)) }

  /* Toasts must clear the bar rather than hide behind it. */
  #toast { bottom: calc(104px + env(safe-area-inset-bottom, 0px)) }
}

/* Narrower phones. "Commissions" is the word that decides this: at a seventh
   of 360px it no longer fits on one line at 9px. */
@media (max-width: 380px) {
  .nav span, .nav.on span { font-size: 8.5px; letter-spacing: -.02em }
  .nav svg { width: 20px; height: 20px }
}

/* The production board on a phone.
 *
 * Eleven columns side by side works on a laptop and not on a phone, where you
 * see one and a half of them and swipe to find anything.
 *
 * It becomes a vertical list instead: every stage in order, full width, read by
 * scrolling down, which is the one gesture a phone is actually good at. Stages
 * with nothing in them shrink to a single line, so eight empty ones do not sit
 * between you and the work.
 *
 * Dragging still works. The board uses pointer events rather than HTML5 drag
 * and drop, so a card can be dragged into the stage above or below it. Moving
 * something several stages along is still easier from the commission itself,
 * which is true on a laptop too.
 */
@media (max-width: 700px) {
  .board {
    flex-direction: column;
    overflow-x: visible;
    gap: 10px;
    min-height: 0;
    padding-bottom: 4px;
  }

  .kcol { flex: 0 0 auto; width: 100%; padding: 10px 12px }

  .kcol-h {
    font-size: 14px;
    padding: 2px 2px 8px;
    position: sticky;
    top: 0;
    z-index: 1;
  }

  /* An empty stage is one line: its name and a zero. Still there, so the shape
     of the process is visible, but not taking up a screen each. */
  .kcol:has(.kcards:empty) {
    padding: 7px 12px;
    background: transparent;
    border-style: dashed;
    opacity: .6;
  }
  .kcol:has(.kcards:empty) .kcol-h { padding-bottom: 0 }
  .kcol:has(.kcards:empty) .kcards { min-height: 0 }

  /* Cards are wider now, so the cover image can be bigger without crowding. */
  .kcard { padding: 12px 12px 12px 8px }
}
