/* ==========================================================================
   Jig — listing studio for art makers (prints, wood, ceramics)
   Shared shell + component styles. Tokens mirror css/tokens.css but Jig uses
   its own typographic treatment (Hanken Grotesk + mono kickers).
   Source of truth for the design: design/jig/  (see design/jig/README.md)
   ========================================================================== */

:root {
  --jig-canvas:        #f7f8f7;
  --jig-surface:       #ffffff;
  --jig-ink:           #212b26;
  --jig-ink-muted:     #3d4a44;
  --jig-text-muted:    #68736d;
  --jig-text-faint:    #9aa49e;

  --jig-primary:       #0c6457;
  --jig-primary-dark:  #0a5449;
  --jig-primary-deep:  #123a34;
  --jig-primary-tint:  #e3f1ee;
  --jig-primary-tint2: #f3f8f6;
  --jig-primary-line:  #cfe0da;

  --jig-border:        #e6e9e7;
  --jig-border-strong: #d5dad7;
  --jig-border-faint:  #f2f4f2;

  --jig-actor-va:      #3d5a80;
  --jig-actor-buyer:   #a8763a;
  --jig-companion:     #6b5a3e;
  --jig-companion-bg:  #efeae2;

  --jig-font:      'Hanken Grotesk', system-ui, sans-serif;
  --jig-font-mono: ui-monospace, 'SF Mono', Menlo, monospace;

  --jig-radius-card:  12px;
  --jig-radius-panel: 14px;
  --jig-radius-chip:  8px;
  --jig-radius-pill:  999px;

  --jig-shadow-card:  0 1px 2px rgba(18,32,26,0.05);
  --jig-shadow-hover: 0 2px 6px rgba(18,32,26,0.06), 0 8px 24px rgba(18,32,26,0.08);
  --jig-shadow-frame: 0 4px 12px rgba(18,32,26,0.08), 0 16px 48px rgba(18,32,26,0.10);

  --jig-sidebar-w: 236px;
  --jig-topbar-h:  60px;
}

/* ---- Reset / base ------------------------------------------------------- */
.jig * { box-sizing: border-box; }
.jig {
  margin: 0;
  font-family: var(--jig-font);
  color: var(--jig-ink);
  background: var(--jig-canvas);
  -webkit-font-smoothing: antialiased;
}
.jig a { color: inherit; text-decoration: none; }
.jig input::placeholder { color: var(--jig-text-faint); }

/* ---- App shell (full viewport) ----------------------------------------- */
.jig-app {
  display: flex;
  width: 100%;
  min-height: 100vh;
  background: var(--jig-canvas);
}

/* ---- Sidebar ------------------------------------------------------------ */
.jig-side {
  flex: 0 0 var(--jig-sidebar-w);
  width: var(--jig-sidebar-w);
  background: var(--jig-surface);
  border-right: 1px solid var(--jig-border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.jig-side__brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 16px; }
.jig-side__mark {
  width: 22px; height: 22px; border-radius: 5px; background: var(--jig-primary);
  display: flex; align-items: center; justify-content: center; flex: 0 0 22px;
}
.jig-side__name { font-weight: 700; font-size: 20px; color: var(--jig-primary); }
.jig-side__tag {
  margin-left: auto; font-family: var(--jig-font-mono);
  font-size: 8.5px; letter-spacing: 0.08em; color: var(--jig-text-faint);
}
.jig-nav a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: 8px; font-size: 13px; margin-bottom: 1px; font-weight: 500;
  color: var(--jig-ink);
}
.jig-nav a:hover { background: var(--jig-border-faint); }
.jig-nav a.on { font-weight: 700; color: var(--jig-primary); background: var(--jig-primary-tint); }
.jig-nav a svg { flex: 0 0 17px; }
.jig-nav__badge {
  margin-left: auto; font-size: 10px; font-weight: 700; border-radius: 999px;
  padding: 2px 7px; color: var(--jig-actor-buyer); background: #f8f1e6;
}
.jig-nav a.on .jig-nav__badge { color: #fff; background: var(--jig-actor-buyer); }
.jig-side__spacer { flex: 1; }
/* Back to the main MapX dashboard — Jig has no other way out of its own shell. */
.jig-side__back {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin-bottom: 8px;
  border-top: 1px solid var(--jig-border-faint); border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--jig-ink); text-decoration: none;
}
.jig-side__back:hover { background: var(--jig-border-faint); color: var(--jig-primary); }
.jig-side__back svg { flex: 0 0 17px; }
.jig-side__qr {
  border: 1px solid var(--jig-border); border-radius: 8px; padding: 11px 12px; margin-bottom: 10px;
}
.jig-side__qr-label {
  font-family: var(--jig-font-mono); font-size: 8.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--jig-text-faint); padding-bottom: 6px;
}
.jig-side__qr-row { display: flex; align-items: center; gap: 9px; }
.jig-side__qr-code {
  width: 30px; height: 30px; border-radius: 5px; flex: 0 0 30px;
  background: repeating-conic-gradient(#212b26 0% 25%, #ffffff 0% 50%) 0 0 / 7px 7px;
}
.jig-side__qr-pin { font-family: var(--jig-font-mono); font-size: 14px; font-weight: 700; letter-spacing: 0.08em; }
.jig-side__user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.jig-side__avatar {
  width: 28px; height: 28px; border-radius: 999px; background: var(--jig-primary-tint);
  color: var(--jig-primary); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex: 0 0 28px;
}
.jig-side__user-name { font-size: 12.5px; font-weight: 600; }
.jig-side__user-role { font-size: 10.5px; color: var(--jig-text-faint); }

/* ---- Main column -------------------------------------------------------- */
.jig-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jig-topbar {
  min-height: var(--jig-topbar-h); flex: 0 0 auto;
  border-bottom: 1px solid var(--jig-border); background: var(--jig-surface);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  position: sticky; top: 0; z-index: 5;
}
.jig-topbar__title { font-size: 19px; font-weight: 600; line-height: 1; }
.jig-topbar__sub { font-size: 11px; color: var(--jig-text-faint); padding-top: 2px; }
.jig-search {
  display: flex; align-items: center; gap: 8px; height: 36px; background: var(--jig-border-faint);
  border-radius: 8px; padding: 0 12px; width: 280px;
}
.jig-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: inherit; font-size: 12.5px; }
.jig-body { flex: 1; padding: 20px 28px 32px; }

/* ---- Buttons ------------------------------------------------------------ */
.jig-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px;
  border: none; border-radius: 8px; background: var(--jig-primary); color: #fff;
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.jig-btn:hover { background: var(--jig-primary-dark); }
.jig-btn--ghost {
  background: var(--jig-surface); color: var(--jig-ink); border: 1px solid var(--jig-border); font-weight: 600;
}
.jig-btn--ghost:hover { border-color: var(--jig-primary-line); background: var(--jig-border-faint); }

/* ---- Kicker / mono labels ---------------------------------------------- */
.jig-kicker {
  font-family: var(--jig-font-mono); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--jig-text-faint);
}
.jig-mono { font-family: var(--jig-font-mono); }

/* ---- Cards -------------------------------------------------------------- */
.jig-card {
  background: var(--jig-surface); border: 1px solid var(--jig-border);
  border-radius: var(--jig-radius-card); box-shadow: var(--jig-shadow-card);
}
a.jig-card, .jig-card--link { transition: box-shadow .14s, border-color .14s; }
a.jig-card:hover, .jig-card--link:hover { box-shadow: var(--jig-shadow-hover); border-color: var(--jig-primary-line); }

/* ---- Chips -------------------------------------------------------------- */
.jig-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--jig-border); background: var(--jig-surface);
  border-radius: var(--jig-radius-chip); font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--jig-ink);
}
.jig-chip.on { border-color: var(--jig-primary); background: var(--jig-primary-tint); color: var(--jig-primary); }

/* ---- Pills / tags ------------------------------------------------------- */
.jig-pill {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 2px 8px; background: var(--jig-primary-tint); color: var(--jig-primary);
}
.jig-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  border-radius: 5px; padding: 3px 6px;
}
.jig-tag--va     { background: #eaf0f7; color: var(--jig-actor-va); }
.jig-tag--buyer  { background: #f8f1e6; color: var(--jig-actor-buyer); }
.jig-tag--companion { background: var(--jig-companion-bg); color: var(--jig-companion); }

/* ---- Info panel --------------------------------------------------------- */
.jig-info {
  background: var(--jig-primary-tint2); border: 1px solid var(--jig-primary-line);
  border-radius: var(--jig-radius-chip); padding: 12px 14px; font-size: 12px; color: var(--jig-ink-muted);
}

/* ---- Placeholder artwork ------------------------------------------------ */
.jig-art {
  background: linear-gradient(135deg, var(--jig-primary-deep), var(--jig-primary));
}
.jig-hatch { background: repeating-linear-gradient(45deg,#e2ebe6 0 7px,#eef4f1 7px 14px); }

/* ---- Loading / empty / error (js/jig-data.js renders these) --------------
   The three states every wired screen needs, defined once so five pages can't
   invent five different "nothing here yet" screens. A skeleton — not a bare
   spinner — because these screens are tables, and a spinner in a table reads
   as a broken page. */
.jig-skel {
  border-radius: 4px;
  background: linear-gradient(90deg, #eef1ef 0%, #f6f8f7 50%, #eef1ef 100%);
  background-size: 200% 100%;
  animation: jig-shimmer 1.3s ease-in-out infinite;
}
@keyframes jig-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.jig-skel-row {
  display: flex; align-items: center; gap: 11px;
  padding: 0 18px; min-height: 56px; border-bottom: 1px solid var(--jig-border-faint);
}
.jig-empty { padding: 34px 22px; text-align: center; }
.jig-empty__h { font-size: 14px; font-weight: 600; color: var(--jig-ink); }
.jig-empty__b {
  font-size: 12px; color: var(--jig-text-muted); line-height: 1.55;
  padding-top: 6px; max-width: 380px; margin: 0 auto; text-wrap: pretty;
}

/* Busy overlay for a slow AI render. Shimmers OVER the previous result rather
   than blanking it — a render that takes 90 s must not look like a dead page. */
.jig-busy { position: relative; }
.jig-busy::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.42) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: jig-shimmer 1.5s ease-in-out infinite;
}

/* Honest marker for the screens that are still design mockups. Without it,
   staff read hardcoded sample numbers as live studio data. */
.jig-mockbar {
  display: flex; align-items: flex-start; gap: 9px;
  background: #fdfaf5; border: 1px solid #d9bd93; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 16px;
}
.jig-mockbar__dot { width: 7px; height: 7px; border-radius: 999px; background: var(--jig-actor-buyer); flex: 0 0 7px; margin-top: 5px; }
.jig-mockbar__t { font-size: 11.5px; color: #6f5a35; line-height: 1.5; text-wrap: pretty; }
.jig-mockbar__t b { font-weight: 700; }
.jig-mockbar a { color: var(--jig-primary); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .jig-skel, .jig-busy::after { animation: none; }
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .jig-side { display: none; }
  .jig-search { width: 180px; }
}
