/* Customer portal layout */
body.portal { display: flex; flex-direction: column; min-height: 100vh; }
.p-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 40; }
.p-header .wrap { min-height: 66px; gap: 14px; }
.p-header .brand { color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; text-decoration: none !important; }
.p-header .brand img { width: 40px; height: 40px; border-radius: 9px; }
.p-header .brand small { display: block; font: 700 .64rem var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--mustard); }
.p-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.p-nav a { color: #dbe4f2; font-weight: 700; padding: 8px 12px; border-radius: 999px; font-size: .9rem; }
.p-nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.p-nav a.active { background: var(--mustard); color: var(--navy); }
.p-user { display: flex; align-items: center; gap: 10px; color: #fff; font-size: .9rem; }
.p-user .avatar { width: 38px; height: 38px; border-color: var(--mustard); }
.p-user button { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 999px; padding: 5px 12px; cursor: pointer; font: 700 .8rem var(--font-body); }
main#app { flex: 1; width: 100%; padding-top: 28px; padding-bottom: 40px; }
.p-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 18px 16px; font-size: .82rem; color: var(--faint); border-top: 1px solid var(--border); }

.auth-wrap { max-width: 460px; margin: 20px auto; }
.auth-hero { text-align: center; margin-bottom: 20px; }
.auth-hero .avatar { margin: 0 auto 10px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: .2em; }
.page-head p { color: var(--muted); margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; color: var(--text); text-decoration: none !important; transition: .15s; position: relative; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.tile .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 10px; background: var(--teal-soft); }
.tile .ico svg { width: 26px; height: 26px; }
.tile.gold .ico { background: var(--mustard-soft); }
.tile.coral .ico { background: var(--coral-soft); }
.tile h3 { font-size: 1.05rem; margin-bottom: .2em; }
.tile p { font-size: .84rem; color: var(--muted); margin: 0; }
.tile .count { position: absolute; top: 14px; right: 14px; }

.list-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; color: var(--text); text-decoration: none !important; transition: .12s; }
.list-item:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.list-item .t { font-weight: 800; }
.list-item .s { font-size: .82rem; color: var(--muted); }

/* wizard steps */
.steps { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.steps span { flex: 1; min-width: 90px; text-align: center; padding: 8px 6px; border-radius: 999px; background: var(--surface-2); font-size: .74rem; font-weight: 800; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.steps span.on { background: var(--navy); color: #fff; }
.steps span.done { background: var(--teal-soft); color: var(--teal-2); }

/* pattern picker */
.patterns { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pat { border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); cursor: pointer; transition: .15s; position: relative; }
.pat:hover { border-color: var(--accent); transform: translateY(-2px); }
.pat.sel { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.pat img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.pat .n { padding: 8px 10px 4px; font-weight: 800; font-size: .86rem; }
.pat .d { padding: 0 10px 10px; display: flex; align-items: center; justify-content: space-between; font-size: .72rem; color: var(--muted); }
.pat .chk { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--teal); color: #fff; display: none; place-items: center; font-weight: 900; }
.pat.sel .chk { display: grid; }
.pat-none { display: grid; place-items: center; text-align: center; padding: 14px; color: var(--muted); font-size: .84rem; min-height: 160px; }
.density { display: inline-flex; gap: 2px; }
.density i { width: 10px; height: 10px; border-radius: 2px; background: var(--line); }
.density i.on { background: var(--teal); }
.density.hi i.on { background: var(--coral); }

/* thread swatches */
.threads { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thread { display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--surface); border: 2px solid var(--border); border-radius: 10px; padding: 8px 4px; cursor: pointer; font: 700 .72rem var(--font-body); color: var(--muted); }
.thread .sw { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); box-shadow: inset 0 -4px 8px rgba(0,0,0,.12); }
.thread:hover { border-color: var(--accent); }
.thread.sel { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-2); }
.matcher { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; }
.matcher img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; }
.dom { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.dom span { width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); }
@media (max-width: 520px) { .matcher { grid-template-columns: 1fr; } .matcher img { width: 100%; height: 160px; } }

/* photo uploader */
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface); transition: .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--teal-soft); }
.drop input { display: none; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.photos figure { margin: 0; position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 1; }
.photos img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photos button { position: absolute; top: 4px; right: 4px; background: rgba(14,39,72,.8); color: #fff; border: 0; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-weight: 900; }
.photos .pending { opacity: .5; }

/* estimate panel */
.est { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 18px 20px; position: sticky; top: 84px; }
.est .big { font: 700 2.2rem var(--font-display); color: var(--mustard); }
.est .l { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: #b8c6dd; font-weight: 800; }
.est dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .86rem; margin: 12px 0 0; }
.est dt { color: #c9d3e3; } .est dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.est .stitch-line { background: repeating-linear-gradient(90deg, var(--mustard) 0 6px, transparent 6px 11px); opacity: .6; }
.two { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } .est { position: static; } }

.invoice-doc { background: #fff; color: #111; padding: 32px; border-radius: var(--radius); border: 1px solid var(--border); max-width: 820px; margin: 0 auto; }
.invoice-doc .hd { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 3px solid var(--navy); padding-bottom: 14px; margin-bottom: 18px; }
.invoice-doc h2 { color: var(--navy); }
.invoice-doc table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.invoice-doc th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #666; border-bottom: 1px solid #ddd; padding: 8px 6px; }
.invoice-doc td { padding: 9px 6px; border-bottom: 1px solid #eee; }
.invoice-doc .num { text-align: right; white-space: nowrap; }
.invoice-doc .totals { margin-left: auto; width: 280px; margin-top: 12px; }
.invoice-doc .totals td { border: 0; padding: 4px 6px; }
.invoice-doc .grand { font: 700 1.3rem var(--font-display); color: var(--navy); border-top: 2px solid var(--navy) !important; }

/* framed quilt photos ("My Stuff") */
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 12px; }
.qgrid.small-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 8px; }
.qframe { margin: 0; position: relative; padding: 8px; background: linear-gradient(135deg, #f6f1e7, #efe7d8); border: 6px solid var(--navy); outline: 2px solid var(--mustard); outline-offset: -10px; box-shadow: 0 10px 24px rgba(14,39,72,.18), inset 0 0 0 1px rgba(255,255,255,.6); border-radius: 4px; transition: transform .2s; }
.qframe:hover { transform: rotate(-1deg) scale(1.02); }
.qframe.big { grid-column: span 2; }
.qframe img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: zoom-in; border: 1px solid rgba(14,39,72,.15); }
.qframe.big img { aspect-ratio: 4/3; }
.qframe figcaption { font-size: .74rem; font-weight: 700; color: var(--navy); text-align: center; padding: 6px 2px 0; font-family: var(--font-display); }
.qframe .ribbon { position: absolute; top: 12px; left: -6px; background: var(--mustard); color: var(--navy); font: 800 .62rem var(--font-body); letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
@media (max-width: 520px) { .qframe.big { grid-column: span 1; } }

/* messaging + reviews */
.msg-row { display: flex; }
.msg-row.me { justify-content: flex-end; }
.msg-row .bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); white-space: pre-wrap; font-size: .94rem; }
.msg-row.me .bubble { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.msg-row.me .bubble .muted { color: #c9d3e3; }
.msg-row.them .bubble { border-bottom-left-radius: 4px; }
.stars button { background: none; border: 0; font-size: 2rem; color: var(--line); cursor: pointer; padding: 0 2px; }
.stars button.on { color: var(--mustard); }
.st-published { background: var(--green-soft); color: #1f6b30; } .st-in_review { background: var(--mustard-soft); color: #8a6a12; } .st-not_shown { background: var(--surface-2); color: var(--muted); }

/* Repair request: model picker */
.mlist { display: none; position: relative; z-index: 5; max-height: 260px; overflow: auto; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 10px; margin-top: 4px; box-shadow: 0 8px 24px rgba(14,39,72,.12); }
.mlist button { display: flex; flex-direction: column; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; font: inherit; color: inherit; border-bottom: 1px solid var(--line); }
.mlist button:hover { background: var(--surface-2); } .mlist button span { font-size: .78rem; color: var(--faint); } .mlist button.la { opacity: .6; }
