:root{--plum:#43183a;--plum2:#5e2752;--thread:#c9953c;--bg:#eef0ee;--card:#fff;--ink:#241c28;--mute:#6d6672;--line:#d9d6da;--ok:#2f7d4f;--bad:#b3261e}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:clamp(15px,.3vw + 13.6px,18px)/1.5 Mukta,"Segoe UI",sans-serif;overflow-x:hidden}
img{max-width:100%}
main{width:100%;max-width:1760px;margin:clamp(14px,2vw,28px) auto;padding:0 clamp(10px,2vw,32px) 60px}
section,.card{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:clamp(14px,1.8vw,24px);margin-bottom:20px;min-width:0}
.card{max-width:420px;margin:28px auto}
h2{margin:0 0 14px;font:700 1.6rem "Cormorant Garamond",Georgia,serif;color:var(--plum)}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));gap:14px}
label{display:block;font-weight:600;font-size:.92rem;margin-bottom:4px}
input,select{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:6px;font:inherit;background:#fff}
input[readonly]{background:#f2f0f3;color:var(--mute)}
input:focus,select:focus,button:focus-visible,a:focus-visible{outline:3px solid var(--thread);outline-offset:1px}
button{font:600 1rem Mukta,sans-serif;border:0;border-radius:6px;padding:10px 20px;cursor:pointer}
.primary{background:var(--plum);color:#fff;width:auto}.primary:hover{background:var(--plum2)}
.card .primary{width:100%;margin-top:6px}
.ghost{background:#fff;color:var(--plum);border:1.5px solid var(--plum)}
.ghost.on,.ghost:hover{background:var(--plum);color:#fff}
.row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.bar{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:18px}
.card .f{margin-bottom:14px}
.links{margin-top:16px;font-size:.92rem;color:var(--mute)}
a{color:var(--plum2);font-weight:600}
#children{margin-top:12px;padding-left:14px;border-left:3px solid var(--thread)}
[hidden]{display:none!important}
#measure{margin-top:18px}
.chip{display:flex;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:6px;margin-bottom:8px;font-size:.95rem}
.chip small,small{color:var(--mute)}
.x{background:none;color:var(--bad);padding:2px 6px}
table{width:100%;border-collapse:collapse;font-size:.95rem}
td{overflow-wrap:anywhere}
th,td{text-align:left;padding:8px;border-bottom:1px solid var(--line);vertical-align:top}
td select{padding:6px}
.wrap{overflow-x:auto}
#msg,.msg{margin-top:12px;font-weight:600;min-height:1.4em}
.ok{color:var(--ok)}.err{color:var(--bad)}
.hint{color:var(--mute);margin:0 0 10px;font-size:.92rem}
@media (prefers-reduced-motion:no-preference){#measure:not([hidden]){animation:in .2s ease-out}@keyframes in{from{opacity:0;transform:translateY(-4px)}}}

header.top{position:sticky;top:0;z-index:10;background:var(--plum);color:#fff;padding:10px 16px;text-align:center;border-bottom:3px solid var(--thread)}
.brand{display:inline-block;color:#fff;text-decoration:none;font:700 1.9rem/1.1 "Cormorant Garamond",Georgia,serif;letter-spacing:.04em}
.brand:hover{color:var(--thread)}
.info{display:flex;flex-wrap:wrap;justify-content:center;gap:2px 16px;font-size:.85rem;color:#e9dce6}
.info .mob{color:var(--thread);font-weight:600}
section{scroll-margin-top:110px}
a.btn{display:inline-block;padding:10px 22px;border-radius:6px;text-decoration:none}
.hero{max-width:620px;margin:40px auto;text-align:center}
.hero h2{font-size:2.2rem}
.k{display:block;color:var(--mute);font-size:.85rem}
textarea{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:6px;font:inherit;background:#fff;resize:vertical}
textarea:focus{outline:3px solid var(--thread);outline-offset:1px}
input[type=file]{padding:8px}
.thumbs{display:flex;flex-wrap:wrap;gap:10px;margin-top:8px}
.th{position:relative}
.th img,.pic{width:84px;height:84px;object-fit:cover;border-radius:6px;border:1px solid var(--line);display:block}
.pic.s{width:48px;height:48px}
.th button{position:absolute;top:-8px;right:-8px;width:24px;height:24px;padding:0;border-radius:50%;background:#fff;border:1px solid var(--line);color:var(--bad);line-height:1}
.pics{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.pre{white-space:pre-wrap}
.srch{margin-bottom:14px}
.srch input{flex:1;min-width:220px}
.stat{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.stat select{width:auto}
.stat .primary{padding:6px 14px}
#toast{position:fixed;left:50%;bottom:20px;transform:translateX(-50%);background:#fff;border:1px solid var(--line);border-left:4px solid var(--ok);padding:10px 16px;border-radius:6px;box-shadow:0 4px 14px rgba(0,0,0,.18);z-index:20;font-weight:600;max-width:90vw}
#toast.err{border-left-color:var(--bad)}

/* measurements and details: one line per value, stacked vertically */
.ml{margin:6px 0 4px;padding:0}
.ml>div{display:flex;gap:10px;padding:2px 0;border-bottom:1px dotted var(--line);font-size:.9rem}
.ml dt{min-width:0;flex:0 0 8.6rem;color:var(--mute)}
.ml dd{margin:0;font-weight:600;overflow-wrap:anywhere}
.ml.extra{margin-top:8px}
.itm{padding:8px 0;border-bottom:1px solid var(--line)}
.itm:first-child{padding-top:0}
.itm:last-child{border-bottom:0}
td.items{min-width:0}
.chip .ml{margin-bottom:0}
.acct{color:var(--mute)}

.badge{display:inline-block;padding:2px 10px;border-radius:12px;font-size:.8rem;font-weight:600;color:#fff;background:var(--mute)}
.s-RECEIVED{background:#5e2752}.s-PENDING{background:#b26a00}.s-STITCHING{background:#1f6f8b}.s-READY{background:#2f7d4f}.s-DELIVERED{background:#444}

/* ---- reference images row inside the details list ---- */
.ml .imgs dd{font-weight:400}
.ml .imgs .pics{margin-top:0}
.dctl{margin-top:6px}
.dctl input{width:auto;flex:1 1 130px;max-width:170px}

/* ---- details list: fill the width of the cell in columns instead of one long column ---- */
td.items .ml{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr));column-gap:22px}

/* ---- orders table: fit the screen. Wide screens use the full width; narrow screens show each row as a card ---- */
@media (max-width:1000px){
  .wrap{overflow:visible}
  table.stack,table.stack thead,table.stack tbody,table.stack tr,table.stack td{display:block;width:100%}
  table.stack thead{position:absolute;left:-9999px;top:-9999px}
  table.stack tr{border:1px solid var(--line);border-radius:8px;padding:6px 10px;margin-bottom:12px;background:#fff}
  table.stack td{border-bottom:1px dotted var(--line);padding:8px 0}
  table.stack td:last-child{border-bottom:0}
  table.stack td[data-label]::before{content:attr(data-label);display:block;color:var(--mute);font-size:.8rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em}
}
@media (max-width:600px){
  .brand{font-size:1.5rem}.info{font-size:.78rem;gap:0 10px}
  .ml dt{flex-basis:7rem}
  .row>button,.row>a.btn{flex:1 1 auto}
}

/* ---- bell, summary chips ---- */
.bell{display:inline-flex;align-items:center;gap:8px;text-decoration:none;padding:9px 16px;border:1.5px solid var(--plum);border-radius:6px;color:var(--plum);background:#fff;font-weight:600}
.bell:hover{background:var(--plum);color:#fff}
.bell .cnt{background:var(--bad);color:#fff;border-radius:12px;padding:0 8px;font-size:.8rem;line-height:1.5;min-width:22px;text-align:center}
.bell .cnt[hidden]{display:none}
.sums{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr));gap:12px;margin-bottom:16px}
.sum{border:1px solid var(--line);border-left:4px solid var(--plum);border-radius:8px;padding:10px 14px;background:#fff}
.sum b{display:block;font-size:1.6rem;line-height:1.2;color:var(--plum)}
.sum span{color:var(--mute);font-size:.85rem}
.sum.warn{border-left-color:#b26a00}.sum.warn b{color:#b26a00}
.sum.bad{border-left-color:var(--bad)}.sum.bad b{color:var(--bad)}

/* ---- pagination ---- */
.pager{display:flex;flex-wrap:wrap;gap:10px 18px;justify-content:space-between;align-items:center;margin-top:14px}
.pinfo{color:var(--mute);font-size:.92rem}
.pbtns{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.pg{background:#fff;color:var(--plum);border:1.5px solid var(--plum);padding:6px 12px;min-width:40px}
.pg:hover:not(:disabled),.pg.on{background:var(--plum);color:#fff}
.pg:disabled{opacity:.4;cursor:default}
.gap{color:var(--mute);padding:0 2px}

/* ---- notification pop-up ---- */
.modal{position:fixed;inset:0;background:rgba(36,28,40,.55);display:flex;align-items:center;justify-content:center;padding:14px;z-index:30}
.dlg{background:#fff;border-radius:12px;border-top:5px solid var(--thread);width:100%;max-width:640px;max-height:90vh;overflow:auto;padding:clamp(16px,3vw,26px);box-shadow:0 14px 40px rgba(0,0,0,.35)}
.dlg h2{margin-bottom:4px}
.dlg .sums{margin:14px 0}
.nl{list-style:none;margin:0 0 16px;padding:0}
.nl li{border:1px solid var(--line);border-radius:8px;padding:10px 12px;margin-bottom:8px;display:grid;grid-template-columns:1fr auto;gap:2px 10px}
.nl .nm{font-weight:600}
.nl .sub{grid-column:1/-1;color:var(--mute);font-size:.88rem}
@media (prefers-reduced-motion:no-preference){.dlg{animation:pop .22s ease-out}@keyframes pop{from{opacity:0;transform:translateY(10px) scale(.98)}}}

/* ---- notification screen cards ---- */
.ncards{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,400px),1fr));gap:14px}
.ncard{border:1px solid var(--line);border-radius:10px;padding:14px 16px;background:#fff;min-width:0}
.ncard header{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:6px;flex-wrap:wrap}
.ncard header strong{font:700 1.25rem "Cormorant Garamond",Georgia,serif;color:var(--plum)}
.ncard .ml dt{flex-basis:9rem}
.due{font-weight:700}.due.late{color:var(--bad)}.due.soon{color:#b26a00}.due.done{color:var(--ok)}

/* ---- use the free width: measurements in columns (saved panel, orders table) ---- */
.chip>div:first-child{flex:1;min-width:0}
.chip .ml{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr));column-gap:22px}
@media (min-width:1001px){td.items{width:44%}}
.dlg .sums{grid-template-columns:repeat(4,1fr);gap:8px}
.dlg .sum{padding:8px 10px}.dlg .sum b{font-size:1.4rem}
@media (max-width:480px){.dlg .sums{grid-template-columns:repeat(2,1fr)}}

/* ---- reference images: show the whole picture, not a cropped square ---- */
.th img,.pic{object-fit:contain;background:#f6f4f6;width:96px;height:96px}
.pic.s{width:76px;height:76px}
.pics{gap:10px}
a.pa{display:block;line-height:0;border-radius:6px}
a.pa:hover .pic{border-color:var(--plum);box-shadow:0 0 0 2px var(--thread)}
input[type=file]{max-width:100%}
.lbx{position:relative;max-width:min(96vw,1100px);width:100%;display:flex;flex-direction:column;align-items:center;gap:8px}
#lbImg{max-width:100%;max-height:80vh;object-fit:contain;background:#fff;border-radius:8px}
#lbCap{margin:0;color:#fff;font-size:.9rem}
.lbtn{position:absolute;background:rgba(255,255,255,.92);color:var(--plum);border-radius:50%;width:44px;height:44px;padding:0;font-size:1.8rem;line-height:1}
.lbc{top:-6px;right:-6px}.lbp{left:6px;top:45%}.lbn{right:6px;top:45%}
.lbtn:hover{background:var(--thread);color:#fff}
@media (max-width:600px){.pic.s{width:64px;height:64px}.th img,.pic{width:84px;height:84px}}

/* reference images row spans the whole details block so thumbnails sit side by side */
.ml .imgs{grid-column:1/-1;align-items:flex-start}
.ml .imgs dd{flex:1;min-width:0}
td.items .ml.extra .imgs{border-bottom:0}
@media (min-width:1001px){table.stack td:first-child,table.stack th:first-child{white-space:nowrap}}
@media (min-width:1001px){#list td:nth-child(3){white-space:nowrap}}

/* ---- "how to measure" picture beside the measurement fields ---- */
.mwrap{display:grid;grid-template-columns:minmax(0,1fr) clamp(250px,25vw,360px);gap:clamp(14px,2vw,28px);align-items:start}
.mhelp{position:sticky;top:calc(var(--hdr,80px) + 12px);border:1px solid var(--line);border-top:4px solid var(--thread);border-radius:10px;padding:12px;background:#fff;text-align:center}
.mh-img{background:#fff;border-radius:8px;display:flex;align-items:center;justify-content:center;min-height:200px}
.mh-img img{max-width:100%;max-height:min(52vh,430px);object-fit:contain;display:block}
.mhelp strong{display:block;margin-top:8px;font:700 1.25rem "Cormorant Garamond",Georgia,serif;color:var(--plum)}
.mhelp p{margin:4px 0 0;font-size:.9rem;color:var(--mute);text-align:left}
@media (max-width:900px){
  .mwrap{grid-template-columns:1fr}
  .mhelp{order:-1;z-index:5;display:grid;grid-template-columns:110px 1fr;gap:0 12px;text-align:left;padding:8px;box-shadow:0 4px 12px rgba(0,0,0,.12)}
  .mh-img{grid-row:1/3;min-height:0}.mh-img img{max-height:130px}
  .mhelp strong{margin-top:0;font-size:1.1rem}
}
