:root {
  --ink: #171714;
  --muted: #6f6b60;
  --paper: #f5f2e9;
  --surface: #fffef9;
  --line: #ded8ca;
  --gold: #c99727;
  --gold-dark: #86600d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }
.site-shell { min-height: 100vh; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1160px) / 2));
  background: #1b1b18;
  color: white;
  border-bottom: 1px solid #3d382b;
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #d8b65f;
  color: #efcd77;
  font-family: Georgia, serif;
  font-size: 13px;
  letter-spacing: .08em;
}
.brand strong { display: block; font-family: Georgia, serif; font-size: 19px; letter-spacing: .02em; }
.brand small { display: block; margin-top: 2px; color: #aaa596; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }

.sync-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #514b3c;
  border-radius: 999px;
  color: #d9d4c6;
  font-size: 12px;
}
.sync-pill span { width: 7px; height: 7px; border-radius: 50%; background: #d3a743; }
.sync-pill.is-live span { background: #55c894; box-shadow: 0 0 0 4px rgba(85, 200, 148, .12); }

.workspace { width: min(1160px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 38px; }
.heading-row { display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.eyebrow { margin: 0 0 12px; color: var(--gold-dark); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 6vw, 66px); font-weight: 500; line-height: .98; letter-spacing: -.035em; }
.intro { max-width: 620px; margin: 18px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }

.sync-card { min-width: 180px; padding: 16px 18px; border-left: 1px solid var(--line); }
.sync-card > span { display: block; color: var(--muted); font-size: 11px; }
.sync-card strong { display: block; margin: 4px 0 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; }
.sync-card button { padding: 0; border: 0; background: transparent; color: var(--gold-dark); font-size: 12px; font-weight: 700; }
.sync-card button:disabled { cursor: wait; opacity: .65; }
.sync-card button span { display: inline-block; margin-right: 5px; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.setup-note {
  display: flex;
  gap: 13px;
  margin: 30px 0 18px;
  padding: 15px 17px;
  border: 1px solid #dfcc98;
  background: #fff8e6;
}
.note-icon { flex: 0 0 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #b8891d; color: white; font-family: Georgia, serif; font-weight: 700; }
.setup-note strong { font-size: 13px; }
.setup-note p { margin: 3px 0 0; color: #6f5d36; font-size: 12px; line-height: 1.6; }

.price-panel { margin-top: 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 18px 50px rgba(48, 42, 28, .07); }
.panel-controls { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.tabs { align-self: stretch; display: flex; gap: 24px; }
.tabs button { position: relative; display: flex; align-items: center; gap: 9px; padding: 0 2px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.tabs button::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: transparent; }
.tabs button.active { color: var(--ink); }
.tabs button.active::after { background: var(--gold); }
.tabs b { min-width: 23px; padding: 2px 6px; border-radius: 999px; background: #ece8de; font-size: 10px; }
.search { width: min(290px, 40vw); display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); background: white; }
.search span { color: #9b9586; font-size: 18px; }
.search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search input::placeholder { color: #aaa596; }

.table-head, .table-row { display: grid; grid-template-columns: 132px minmax(210px, 1.45fr) .65fr .8fr; align-items: center; }
.table-head { min-height: 44px; padding: 0 24px; border-bottom: 1px solid var(--line); background: #f5f2ea; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.table-head span:nth-child(3), .table-head span:nth-child(4) { text-align: right; }
.product-group + .product-group { border-top: 1px solid var(--line); }
.table-row { min-height: 96px; padding: 10px 24px; }
.table-row + .table-row { border-top: 1px solid #eeeae1; }
.table-row:hover { background: #fffcf4; }
.product-name { display: flex; align-items: center; gap: 11px; font-size: 13px; font-weight: 750; }
.product-photo { display: grid; place-items: center; width: 112px; height: 76px; overflow: hidden; border: 1px solid #d8c487; background: #151512; }
.product-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.viewer-trigger { position: relative; padding: 0; color: inherit; cursor: zoom-in; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.viewer-trigger::after { content: "3D"; position: absolute; top: 4px; right: 4px; padding: 2px 4px; border: 1px solid rgba(238, 206, 119, .65); background: rgba(18, 18, 15, .78); color: #f0cf78; font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.viewer-trigger:hover { z-index: 1; transform: translateY(-2px); border-color: #c69a2b; box-shadow: 0 8px 18px rgba(91, 68, 15, .18); }
.viewer-trigger:focus-visible { outline: 3px solid rgba(201, 151, 39, .35); outline-offset: 2px; }
.product-photo i, .mobile-product-photo i, .mobile-card h2 i { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #d8c487; background: #f9edc6; color: #86600d; font-family: Georgia, serif; font-size: 11px; font-style: normal; font-weight: 700; }
.weight { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.weight small, .mobile-card small { color: var(--muted); font-family: inherit; font-size: 10px; }
.table-row > strong { text-align: right; font-family: Georgia, serif; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mobile-list { display: none; }
.empty { margin: 0; padding: 48px 24px; text-align: center; color: var(--muted); font-size: 13px; }

body.viewer-open { overflow: hidden; }
.viewer-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: rgba(12, 12, 10, .78); backdrop-filter: blur(8px); }
.viewer-dialog { width: min(780px, 100%); overflow: hidden; border: 1px solid #5a4a22; background: #171714; color: #f7f2e5; box-shadow: 0 32px 100px rgba(0, 0, 0, .5); }
.viewer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; padding: 22px 24px; border-bottom: 1px solid #3f3827; }
.viewer-header p { margin: 0 0 7px; color: #cfa94e; font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.viewer-header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(22px, 4vw, 34px); font-weight: 500; }
.viewer-header span { display: block; margin-top: 5px; color: #aaa493; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.viewer-close { width: 38px; height: 38px; border: 1px solid #514832; border-radius: 50%; background: transparent; color: #e3dccb; font-size: 26px; font-weight: 300; line-height: 1; }
.viewer-close:hover { border-color: #d0a64a; color: #f0cc75; }

.viewer-stage { position: relative; height: 410px; display: grid; place-items: center; overflow: hidden; outline: 0; background: radial-gradient(circle at 50% 45%, rgba(219, 174, 65, .15), transparent 35%), linear-gradient(145deg, #22221e, #11110f); perspective: 1050px; touch-action: none; cursor: grab; user-select: none; }
.viewer-stage::before { content: ""; position: absolute; width: 440px; height: 90px; bottom: 46px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0, 0, 0, .58), transparent 68%); filter: blur(7px); }
.viewer-stage.is-dragging { cursor: grabbing; }
.viewer-object { --bw: 340px; --bh: 210px; --bd: 38px; --face-image: none; position: relative; width: var(--bw); height: var(--bh); transform-style: preserve-3d; will-change: transform; }
.viewer-face { position: absolute; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(255, 228, 153, .52); background-color: #d6a72b; box-shadow: inset 0 0 24px rgba(255, 245, 184, .22); }
.viewer-front, .viewer-back { width: var(--bw); height: var(--bh); background-image: radial-gradient(circle at 35% 18%, rgba(255,255,255,.24), transparent 28%), linear-gradient(135deg, #efce70, #a36c08); background-position: center; background-size: cover; }
.viewer-front { transform: translateZ(calc(var(--bd) / 2)); }
.viewer-back { transform: rotateY(180deg) translateZ(calc(var(--bd) / 2)); }
.viewer-object.has-photo .viewer-front, .viewer-object.has-photo .viewer-back { background-color: #11110f; background-image: var(--face-image); background-position: center; background-repeat: no-repeat; background-size: contain; }
.viewer-face span { display: grid; place-items: center; width: 72px; height: 72px; border: 2px solid rgba(100, 65, 7, .5); color: #6d4704; font-family: Georgia, serif; font-size: 25px; font-weight: 700; }
.viewer-object.has-photo .viewer-face span { display: none; }
.viewer-left, .viewer-right { left: calc((var(--bw) - var(--bd)) / 2); width: var(--bd); height: var(--bh); background: linear-gradient(90deg, #77500a, #e7bc4d 50%, #8e610d); }
.viewer-left { transform: rotateY(-90deg) translateZ(calc(var(--bw) / 2)); }
.viewer-right { transform: rotateY(90deg) translateZ(calc(var(--bw) / 2)); }
.viewer-top, .viewer-bottom { top: calc((var(--bh) - var(--bd)) / 2); width: var(--bw); height: var(--bd); background: linear-gradient(#f3d779, #a8730c); }
.viewer-top { transform: rotateX(90deg) translateZ(calc(var(--bh) / 2)); }
.viewer-bottom { transform: rotateX(-90deg) translateZ(calc(var(--bh) / 2)); }
.viewer-object.is-casting { --bd: 54px; }
.viewer-hint { position: absolute; right: 0; bottom: 16px; left: 0; margin: 0; color: #8f8a7d; text-align: center; font-size: 10px; letter-spacing: .06em; }
.viewer-controls { display: flex; justify-content: center; gap: 8px; padding: 15px 18px 8px; background: #1d1d19; }
.viewer-controls button { min-width: 42px; height: 38px; padding: 0 13px; border: 1px solid #4a4435; background: #26251f; color: #e7dfcb; font-size: 15px; }
.viewer-controls button:hover { border-color: #c9a33f; color: #f1cf78; }
.viewer-controls #viewer-reset { min-width: 72px; font-size: 11px; }
.viewer-note { margin: 0; padding: 3px 18px 16px; background: #1d1d19; color: #777267; text-align: center; font-size: 9px; }

footer { display: flex; justify-content: space-between; gap: 30px; padding: 20px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
footer p { margin: 0; }
footer span { text-align: right; }

@media (max-width: 720px) {
  .topbar { height: 66px; padding: 0 18px; }
  .brand strong { font-size: 16px; }
  .brand-mark { width: 36px; height: 36px; }
  .sync-pill { padding: 7px 9px; font-size: 10px; }
  .workspace { width: min(100% - 28px, 620px); padding-top: 36px; }
  .heading-row { display: block; }
  h1 { font-size: 44px; }
  .sync-card { display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 24px; padding: 13px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .sync-card > span { margin-right: auto; }
  .sync-card strong { margin: 0; font-size: 13px; }
  .sync-card button { padding-left: 10px; border-left: 1px solid var(--line); }
  .setup-note { margin-top: 22px; }
  .price-panel { margin-top: 14px; border-right: 0; border-left: 0; }
  .panel-controls { display: block; padding: 0 14px 14px; }
  .tabs { height: 58px; gap: 18px; }
  .search { width: 100%; }
  .desktop-table { display: none; }
  .mobile-list { display: block; padding: 12px; background: #f5f2ea; }
  .mobile-card { margin: 0 0 10px; padding: 16px; border: 1px solid var(--line); background: var(--surface); }
  .mobile-card:last-child { margin-bottom: 0; }
  .mobile-card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
  .mobile-card h2 i { width: 26px; height: 26px; }
  .mobile-product-row { display: grid; grid-template-columns: 92px minmax(45px, .5fr) minmax(118px, 1fr); align-items: center; gap: 10px; min-height: 82px; }
  .mobile-product-row + .mobile-product-row { border-top: 1px solid #eeeae1; }
  .mobile-product-photo { display: grid; place-items: center; width: 84px; height: 62px; overflow: hidden; border: 1px solid #d8c487; background: #151512; }
  .mobile-product-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
  .mobile-product-photo i { width: 26px; height: 26px; }
  .mobile-weight { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
  .mobile-product-row strong { text-align: right; font-family: Georgia, serif; font-size: 16px; font-variant-numeric: tabular-nums; }
  footer { display: block; padding: 18px 2px 0; }
  footer span { display: block; margin-top: 8px; text-align: left; }
  .viewer-modal { align-items: end; padding: 0; }
  .viewer-dialog { width: 100%; max-height: 94dvh; overflow-y: auto; border-right: 0; border-bottom: 0; border-left: 0; }
  .viewer-header { padding: 17px 18px; }
  .viewer-stage { height: 340px; }
  .viewer-stage::before { width: 300px; bottom: 42px; }
  .viewer-object { --bw: 250px; --bh: 155px; --bd: 30px; }
  .viewer-object.is-casting { --bd: 40px; }
  .viewer-face span { width: 58px; height: 58px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
