:root {
  --bg: #F5F4F1; --card: #FFFFFF; --ink: #151515; --ink-2: #4A463F; --muted: #6B675F; --faint: #9C978C;
  --line: #E4E1DA; --line-2: #F0EDE7; --black: #0E0E0E; --black-2: #1A1A1A; --on-black: #F2EFE8; --on-black-2: #B9B4A8;
  --gold: #C9A227; --gold-ink: #8A6A1A; --gold-soft: #FBF5E3; --red: #8C2F1F; --red-soft: #F6E3DE; --green: #2F6B3F;
  --display: 'Antonio', 'Helvetica Neue', Arial, sans-serif;
  --sans: 'Inter', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  --r: 6px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- logo ---------- */
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--on-black); }
.logo img { height: 26px; width: auto; filter: invert(1); }
.logo .wm { font-family: var(--display); font-weight: 300; font-size: 30px; letter-spacing: .14em; line-height: 1; }
.logo .tag { font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); padding-left: 12px; border-left: 1px solid #333; }

/* ---------- sign-in ---------- */
.auth { min-height: 100vh; background: var(--black); color: var(--on-black); display: flex; flex-direction: column; }
.auth header { padding: 24px; }
.auth main { flex: 1; display: grid; place-items: center; padding: 24px 16px 64px; }
.auth .panel { width: 100%; max-width: 420px; }
.auth h1 { font-family: var(--display); font-weight: 300; font-size: 44px; letter-spacing: .04em; line-height: 1.05; margin: 0 0 10px; text-transform: uppercase; }
.auth p { color: var(--on-black-2); margin: 0 0 24px; }
.auth label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--on-black-2); margin: 0 0 8px; }
.auth input, .auth select, .auth textarea { width: 100%; height: 52px; padding: 0 16px; background: var(--black-2); border: 1px solid #333; border-radius: var(--r); color: var(--on-black); font-size: 16px; }
.auth textarea { height: 96px; padding: 12px 16px; resize: vertical; }
.auth input:focus, .auth select:focus, .auth textarea:focus { border-color: var(--gold); outline: none; }
.auth .code { font-size: 28px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.btn-gold { width: 100%; height: 52px; border: 0; border-radius: var(--r); background: var(--gold); color: #111; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 14px; }
.btn-gold[disabled] { opacity: .6; cursor: default; }
.auth .alt { margin-top: 24px; font-size: 14px; color: var(--on-black-2); }
.auth .alt button, .linkbtn { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.auth .err { color: #F0A493; font-size: 14px; margin: 12px 0 0; min-height: 20px; }
.auth .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth .field { margin-bottom: 16px; }
.ts { margin: 16px 0; min-height: 0; }

/* ---------- app shell ---------- */
.topbar { background: var(--black); color: var(--on-black); position: sticky; top: 0; z-index: 30; }
.topbar .in { max-width: 1480px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.topbar .acct { text-align: right; line-height: 1.25; }
.topbar .acct b { display: block; font-size: 14px; }
.topbar .acct span { font-size: 12px; color: var(--on-black-2); }
.tb-btn { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid #3A3A3A; background: transparent; color: var(--on-black); font-size: 13px; font-weight: 500; white-space: nowrap; }
.tb-btn.on { border-color: var(--gold); color: var(--gold); }
.repbar { background: #1B170B; border-top: 1px solid #3a3115; color: var(--on-black); }
.repbar .in { max-width: 1480px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.repbar .pill { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #111; background: var(--gold); padding: 3px 8px; border-radius: 3px; }
.repbar select { height: 36px; min-width: 260px; max-width: 100%; border-radius: 4px; border: 1px solid #5a4a1a; background: #0E0E0E; color: var(--on-black); padding: 0 10px; }
.repbar .meta { color: var(--on-black-2); }
.repbar .send { margin-left: auto; }

.wrap { max-width: 1480px; margin: 0 auto; padding: 24px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.tab small { font-weight: 400; color: var(--muted); font-size: 12px; }
.tab.on { background: var(--black); color: var(--on-black); border-color: var(--black); }
.tab.on small { color: var(--gold); }
.search { flex: 1 1 220px; max-width: 360px; position: relative; }
.search input { width: 100%; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); padding: 0 16px 0 40px; }
.search svg { position: absolute; left: 14px; top: 13px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip .p { color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.on .p { color: var(--gold); }
.chip-label { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-right: 2px; }
.note { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; }

.layout { display: flex; gap: 28px; align-items: flex-start; margin-top: 20px; }
.styles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }

/* ---------- style card ---------- */
.style { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.style-h { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 24px; padding: 16px 20px 14px; background: #FAF9F7; border-bottom: 1px solid var(--line-2); }
.style-h .t { flex: 1 1 260px; min-width: 0; }
.style-h h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1; letter-spacing: .03em; text-transform: uppercase; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.badge { font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; border-radius: 999px; padding: 4px 9px; line-height: 1; }
.b-entry { border: 1px solid #BDB7AB; color: var(--ink-2); }
.b-core { background: var(--black); color: var(--on-black); }
.b-signature { background: var(--gold); color: #111; }
.b-fit { background: var(--line-2); color: var(--ink-2); }
.b-phase { background: #FDECD8; color: #8A4B12; }
.style-h .meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.style-h .price { text-align: right; }
.style-h .price b { font-size: 22px; font-variant-numeric: tabular-nums; }
.style-h .price span { display: block; font-size: 12px; color: var(--muted); }

.cw { display: flex; flex-wrap: wrap; gap: 14px 20px; padding: 14px 20px; border-top: 1px solid var(--line-2); }
.cw:first-of-type { border-top: 0; }
.cw .id { flex: 0 0 250px; display: flex; gap: 14px; align-items: center; min-width: 0; }
.thumb { flex: 0 0 auto; position: relative; width: 112px; height: 76px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: #EFEDE8; overflow: hidden; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .zoom { position: absolute; right: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 3px; background: rgba(255,255,255,.92); display: grid; place-items: center; color: var(--ink-2); }
.thumb.soldout img { opacity: .5; filter: grayscale(.4); }
.thumb .noimg { width: 100%; height: 100%; display: grid; place-items: center; font-size: 11px; color: var(--faint); }
.cw .nm { min-width: 0; }
.cw .nm b { display: block; font-weight: 600; }
.cw .sku { font: 12px var(--mono); color: var(--muted); }
.cw .units { margin-top: 4px; font-size: 12px; color: var(--faint); }
.cw .units.has { color: var(--ink); font-weight: 700; }
.tagline { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag-so { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tag-ltd { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-ink); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

.tiles { flex: 1 1 360px; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.tile { width: 146px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.tile.has { border: 1.5px solid var(--ink); background: var(--gold-soft); }
.tile.locked { border-style: dashed; background: #F7F6F3; color: var(--faint); }
.tile .top { display: flex; align-items: center; gap: 7px; padding: 8px 10px 0; font-size: 13px; }
.tile .top .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .top .add { font-size: 11.5px; font-weight: 600; color: var(--gold-ink); }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #8A857B; flex: 0 0 auto; }
.step { display: flex; align-items: center; padding: 0 2px 2px; }
.step button { width: 42px; height: 44px; border: 0; background: transparent; font-size: 19px; line-height: 1; color: var(--ink); }
.step button:disabled { color: #CFCAC0; cursor: default; }
.step input { width: 42px; height: 38px; border: 1px solid var(--line); border-radius: 3px; text-align: center; font-size: 15px; font-variant-numeric: tabular-nums; background: #fff; }
.tile.has .step input { border-color: var(--ink); font-weight: 700; }
.tile .st { padding: 0 10px 8px; margin-top: -4px; font-size: 11px; line-height: 1.3; }
.st.low { color: var(--gold-ink); font-weight: 600; }
.st.bo { color: var(--gold-ink); font-weight: 600; }
.tile .oos { height: 44px; padding: 0 10px; display: flex; align-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.tile.locked .st { color: var(--muted); }

/* ---------- order summary ---------- */
.summary { flex: 0 0 380px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; background: var(--black); color: var(--on-black); border-radius: var(--r); padding: 24px; }
.summary h2 { margin: 0; font-family: var(--display); font-weight: 300; font-size: 34px; text-transform: uppercase; letter-spacing: .03em; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.summary h2 small { font-family: var(--sans); font-size: 13px; color: var(--on-black-2); text-transform: none; letter-spacing: 0; }
.summary .for { font-size: 13px; color: var(--on-black-2); margin-top: 4px; }
.summary .hint { margin: 20px 0; font-size: 14px; color: var(--on-black-2); }
.lines { list-style: none; margin: 16px 0 0; padding: 0; }
.lines li { display: flex; gap: 10px; justify-content: space-between; padding: 10px 0; border-top: 1px solid #262626; font-size: 14px; }
.lines li .l { min-width: 0; }
.lines li .l span { display: block; font-size: 12px; color: var(--on-black-2); }
.lines li .l code { font: 11.5px var(--mono); color: #8E897F; }
.lines li .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lines li .r button { display: block; margin: 4px 0 0 auto; background: none; border: 0; color: #8E897F; font-size: 12px; text-decoration: underline; padding: 0; }
.totals { border-top: 1px solid #333; margin-top: 4px; padding-top: 12px; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; color: var(--on-black-2); }
.totals .grand { color: var(--on-black); font-size: 20px; font-weight: 700; padding-top: 8px; }
.summary label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--on-black-2); margin: 16px 0 6px; }
.summary input, .summary textarea { width: 100%; height: 44px; padding: 0 12px; border-radius: 4px; border: 1px solid #333; background: var(--black-2); color: var(--on-black); }
.summary textarea { height: 72px; padding: 10px 12px; resize: vertical; }
.summary .f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary .f2 label { margin-top: 16px; }
.summary .submit { margin-top: 20px; }
.summary .fine { font-size: 12px; color: #8E897F; margin: 12px 0 0; }
.summary .clear { margin-top: 10px; background: none; border: 0; color: #8E897F; font-size: 12px; text-decoration: underline; padding: 0; }
.mbar { display: none; }

/* ---------- viewer ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(10,10,10,.72); display: flex; align-items: center; justify-content: center; padding: 24px; }
.viewer { width: 100%; max-width: 1180px; max-height: calc(100vh - 48px); overflow: auto; background: var(--card); border-radius: 8px; display: flex; flex-wrap: wrap; position: relative; }
.viewer .x { position: absolute; right: 12px; top: 12px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 22px; }
.viewer .pic { flex: 1 1 560px; min-width: 0; background: #EFEDE8; display: flex; flex-direction: column; }
.viewer .pic .main { flex: 1; min-height: 360px; display: grid; place-items: center; position: relative; }
.viewer .pic .main img { width: 100%; height: 100%; max-height: 640px; object-fit: contain; }
.viewer .pic .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 20px; }
.viewer .pic .prev { left: 12px; } .viewer .pic .next { right: 12px; }
.viewer .views { display: flex; gap: 6px; padding: 12px; justify-content: center; flex-wrap: wrap; }
.viewer .views button { width: 72px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: #fff; overflow: hidden; }
.viewer .views button.on { border: 2px solid var(--ink); }
.viewer .views img { width: 100%; height: 100%; object-fit: cover; }
.viewer .info { flex: 1 1 360px; min-width: 0; padding: 32px 28px; display: flex; flex-direction: column; gap: 18px; }
.viewer .info h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 36px; text-transform: uppercase; letter-spacing: .03em; line-height: 1; }
.viewer .info .sub { font-size: 15px; color: var(--ink-2); }
.viewer .info .counter { font-size: 12px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.viewer .info .tiles { flex: 0 0 auto; }
.viewer .done { margin-top: auto; height: 48px; border: 0; border-radius: 4px; background: var(--black); color: var(--on-black); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- confirmation / orders ---------- */
.page { max-width: 920px; margin: 0 auto; padding: 32px 24px 64px; }
.page h1 { font-family: var(--display); font-weight: 300; font-size: 48px; text-transform: uppercase; letter-spacing: .03em; margin: 0 0 8px; line-height: 1; }
.page .lead { color: var(--ink-2); margin: 0 0 24px; }
.sheet { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; margin-bottom: 18px; }
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.sheet .m { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; white-space: nowrap; }
table.t code { font: 12px var(--mono); color: var(--muted); }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #FAF9F7; }
.tot { display: flex; justify-content: flex-end; gap: 32px; margin-top: 12px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.tot b { font-size: 18px; }
.btn { height: 44px; padding: 0 18px; border-radius: 4px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--ink); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.status { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); }
.status.Confirmed, .status.Shipped, .status[data-s="Entered in QuickBooks"] { background: #E3F0E6; color: var(--green); }
.status.Cancelled { background: var(--red-soft); color: var(--red); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .2s; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 6px; font-size: 14px; z-index: 90; max-width: calc(100vw - 32px); pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .summary { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; top: auto; max-height: 85vh; border-radius: 14px 14px 0 0; transform: translateY(105%); transition: transform .25s; flex: none; }
  .summary.open { transform: none; box-shadow: 0 -10px 40px rgba(0,0,0,.35); }
  .mbar { display: flex; position: fixed; z-index: 40; left: 12px; right: 12px; bottom: 12px; height: 56px; border: 0; border-radius: 10px; background: var(--black); color: var(--on-black); align-items: center; justify-content: space-between; padding: 0 18px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
  .mbar span:last-child { color: var(--gold); }
  .styles { padding-bottom: 84px; }
}
@media (max-width: 640px) {
  .wrap { padding: 16px; }
  .topbar .in, .repbar .in { padding-left: 16px; padding-right: 16px; }
  .topbar .acct { display: none; }
  .cw { padding: 14px 16px; }
  .cw .id { flex: 1 1 100%; }
  .tile { width: calc(50% - 4px); }
  .style-h { padding: 14px 16px; }
  .style-h .price { text-align: left; }
  .repbar select { min-width: 0; flex: 1 1 100%; }
  .repbar .send { margin-left: 0; }
  .auth h1 { font-size: 36px; }
  .viewer .info { padding: 20px 16px; }
  .overlay { padding: 0; }
  .viewer { max-height: 100vh; border-radius: 0; }
}

@media print {
  .topbar, .repbar, .actions, .mbar, #toast { display: none !important; }
  body { background: #fff; }
  .sheet { border: 0; padding: 0; }
}

/* lens photo picker */
.tile .top { width: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; border-radius: 4px 4px 0 0; }
.tile .top .eye { flex: 0 0 auto; color: var(--faint); opacity: 0; transition: opacity .15s; }
.tile .top:hover .eye, .tile .top:focus-visible .eye { opacity: 1; }
.tile.viewing { box-shadow: inset 0 3px 0 var(--gold); }
.tile.viewing .top .eye { opacity: 1; color: var(--gold-ink); }
.thumb .standin, .viewer .standin { position: absolute; left: 4px; bottom: 4px; padding: 2px 6px; border-radius: 3px; background: rgba(14,14,14,.78); color: #F2EFE8; font-size: 10px; font-weight: 600; letter-spacing: .02em; pointer-events: none; }
.viewer .standin { left: 12px; bottom: 12px; font-size: 12px; padding: 4px 8px; }
.viewer .views button { position: relative; }
.viewer .views button span { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; background: rgba(255,255,255,.88); color: var(--ink-2); font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* frame measurements */
.meas { display: inline-flex; align-items: stretch; margin-top: 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; overflow: hidden; }
.meas span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 56px; padding: 5px 10px; border-left: 1px solid var(--line-2); }
.meas span:first-child { border-left: 0; }
.meas small { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.meas b { font-size: 17px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.meas em { align-self: center; padding: 0 10px 0 4px; font-style: normal; font-size: 11px; color: var(--faint); }
.viewer .meas { margin-top: 0; }
@media (max-width: 560px) { .meas span { min-width: 0; padding: 5px 8px; } .meas b { font-size: 15px; } }
