/* ==========================================================================
   CHIQUE WIP — light theme, matching the Replenishment Control Center.
   Calm white surfaces on a faint engineering grid, hairline borders, and
   yellow used only where something is actionable. Black carries the type.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg:          #ffffff;
  --surface:     #ffffff;
  --surface-2:   #f8fafc;
  --fill:        #f3f4f6;
  --fill-2:      #e9ecef;

  --ink:         #0f172a;   /* near-black: all type sits on this */
  --ink-2:       #475569;
  --ink-3:       #64748b;
  --ink-4:       #94a3b8;

  --line:        #e5e7eb;   /* hairline */
  --line-strong: #d1d5db;   /* inputs */
  --grid:        rgba(148, 163, 184, .18);

  --yellow:      #facc15;
  --yellow-deep: #eab308;
  --yellow-soft: #fef9e7;
  --yellow-line: #fde68a;

  --green:       #16a34a;
  --green-soft:  #ecfdf5;
  --green-line:  #a7f3d0;
  --red:         #dc2626;
  --red-soft:    #fef2f2;
  --red-line:    #fecaca;
  --amber:       #b45309;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 18px;

  --sh-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --sh-md: 0 8px 24px rgba(15, 23, 42, .07);
  --sh-lg: 0 18px 48px rgba(15, 23, 42, .13);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Outfit", "Inter", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --t: .18s cubic-bezier(.4, 0, .2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* The cross-section grid. Fixed, so it stays put while the page scrolls and
   reads as paper the interface sits on rather than texture that moves with it. */
body {
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.primary {
  background: var(--ink); color: #fff; border: 0;
  padding: 9px 18px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background var(--t), transform var(--t), box-shadow var(--t);
  box-shadow: var(--sh-xs);
}
.primary:hover { background: #1e293b; }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .4; cursor: default; transform: none; }
.primary.wide {
  width: 100%; padding: 13px; font-size: 15px; margin-top: 8px;
}
/* The one yellow control on any given screen: the thing you came here to do. */
.primary.go {
  background: var(--yellow); color: var(--ink);
  box-shadow: 0 1px 2px rgba(161, 98, 7, .2);
}
.primary.go:hover { background: var(--yellow-deep); }

.ghost {
  background: #fff; border: 1px solid var(--line-strong); color: var(--ink-2);
  padding: 8px 15px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.ghost:hover { background: var(--fill); color: var(--ink); }

.icon {
  background: none; border: 0; color: var(--ink-3);
  font-size: 24px; line-height: 1; padding: 2px 8px; border-radius: var(--r-sm);
  transition: background var(--t), color var(--t);
}
.icon:hover { background: var(--fill); color: var(--ink); }

/* ── Sign in ─────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 390px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 34px 30px 30px; box-shadow: var(--sh-md);
}
.login-brand { display: flex; flex-direction: column; gap: 4px; margin-bottom: 28px; }
.login-brand .mark {
  font-family: var(--display); font-weight: 800; font-size: 1.25rem;
  letter-spacing: -.01em; position: relative; display: inline-block;
}
/* The hand-drawn yellow underline from the Replenishment header. */
.login-brand .mark::after,
.brand .mark::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12'%3E%3Cpath d='M2,8 C50,2 150,11 198,5' fill='none' stroke='%23facc15' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.login-brand .sub {
  font-size: .7rem; color: var(--ink-3); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; margin-top: 6px;
}
.login-card label { margin-top: 15px; }
.login-card .primary { margin-top: 24px; }

/* ── Header ──────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 13px 24px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand .mark {
  font-family: var(--display); font-weight: 800; font-size: 1.05rem;
  letter-spacing: -.01em; position: relative; display: inline-block;
}
.brand .sub {
  font-size: .66rem; color: var(--ink-3); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; margin-top: 3px;
}

/* Tabs: dark pill for the active one, exactly as Replenishment does it. */
.tabs { display: inline-flex; gap: 8px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 8px 16px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.tab:hover { background: var(--fill); }
.tab.is-on {
  background: var(--ink); color: #fff; border-color: var(--ink);
  box-shadow: var(--sh-xs);
}

/* ── Status strip ────────────────────────────────────────────────────── */
.strip {
  display: flex; align-items: center; gap: 10px;
  margin: 18px auto 0; max-width: 1280px;
  padding: 11px 16px; font-size: 13.5px; font-weight: 500;
  background: var(--yellow-soft); color: var(--amber);
  border: 1px solid var(--yellow-line); border-radius: var(--r-md);
}
.strip.bad {
  background: var(--red-soft); color: var(--red); border-color: var(--red-line);
}
.strip.ok {
  background: var(--green-soft); color: var(--green); border-color: var(--green-line);
}

main { padding: 22px 24px 80px; max-width: 1280px; margin: 0 auto; }

/* ── Stat tiles ──────────────────────────────────────────────────────── */
.stats {
  display: grid; gap: 14px; margin-bottom: 22px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--sh-xs);
}
.stat dt {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 7px;
}
.stat dd {
  margin: 0; font-family: var(--display); font-size: 25px; font-weight: 700;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink);
}
.stat .sub {
  display: block; font-family: var(--sans); font-size: 12.5px;
  color: var(--ink-3); font-weight: 400; margin-top: 3px; letter-spacing: 0;
}

/* ── Panels ──────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 24px; margin-bottom: 20px;
  box-shadow: var(--sh-xs);
}
.panel h2 { font-size: 17px; margin-bottom: 5px; }
.lede { color: var(--ink-2); font-size: 14px; margin-bottom: 18px; max-width: 62ch; }

/* ── Drop zone ───────────────────────────────────────────────────────── */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 36px 20px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface-2);
  transition: border-color var(--t), background var(--t);
}
.drop:hover, .drop.is-over {
  border-color: var(--yellow-deep); background: var(--yellow-soft);
}
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-title { font-size: 15px; font-weight: 600; }
.drop-sub { font-size: 13px; color: var(--ink-3); }
.picked {
  margin-top: 12px; font-size: 13.5px; color: var(--ink-2);
  background: var(--fill); border: 1px solid var(--line);
  padding: 10px 13px; border-radius: var(--r-sm); overflow-wrap: anywhere;
}

/* ── Controls ────────────────────────────────────────────────────────── */
.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 22px;
}
#search {
  flex: 1 1 260px; min-width: 0;
  padding: 10px 14px; font-size: 14.5px;
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
}
#search::placeholder { color: var(--ink-4); }
#search:focus {
  outline: none; border-color: var(--yellow-deep);
  box-shadow: 0 0 0 3px var(--yellow-soft);
}

.filters {
  display: inline-flex; gap: 6px; padding: 3px;
  background: var(--fill); border: 1px solid var(--line); border-radius: 10px;
}
.filters label {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; color: var(--ink-3);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background var(--t), color var(--t);
}
.filters input { position: absolute; opacity: 0; pointer-events: none; }
.filters label:has(input:checked) {
  background: #fff; color: var(--ink); box-shadow: var(--sh-xs);
}
.pill {
  font-size: 11.5px; font-weight: 700; color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  background: var(--fill-2); padding: 1px 7px; border-radius: 999px;
}
.filters label:has(input:checked) .pill {
  background: var(--yellow); color: var(--ink);
}

/* ── Photo grid ──────────────────────────────────────────────────────── */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.card:hover {
  transform: translateY(-2px); box-shadow: var(--sh-md);
  border-color: var(--line-strong);
}
.card .shot {
  aspect-ratio: 3 / 4; width: 100%; object-fit: cover; display: block;
  background: var(--fill); border: 0; padding: 0; cursor: zoom-in;
}
.card .shot.none {
  display: grid; place-items: center; cursor: default;
  color: var(--ink-4); font-size: 12.5px;
  background: repeating-linear-gradient(
    45deg, var(--surface-2), var(--surface-2) 10px, var(--fill) 10px, var(--fill) 20px);
}
.card .meta { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 3px; }
.card .art { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
.card .nm, .card .col {
  font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere;
}
.card .foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-4);
}
.card .foot button {
  background: none; border: 0; color: var(--ink-2);
  font-size: 12px; font-weight: 600; padding: 0;
}
.card .foot button:hover { color: var(--ink); text-decoration: underline; }

/* Where a photo came from — Shopify is automatic, uploaded is somebody's work. */
.tag {
  align-self: flex-start; font-size: 10px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid transparent;
}
.tag.shopify { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.tag.uploaded { background: var(--fill); color: var(--ink-2); border-color: var(--line-strong); }
.tag.need { background: var(--yellow-soft); color: var(--amber); border-color: var(--yellow-line); }

.empty {
  text-align: center; padding: 64px 20px; color: var(--ink-3); font-size: 14.5px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl);
}
.muted { color: var(--ink-3); }
.center { text-align: center; }

/* ── Forms ───────────────────────────────────────────────────────────── */
form label, .sheet-inner > label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); margin: 15px 0 6px;
}
input[type=text], input[type=search], input[type=password], input:not([type]) {
  width: 100%; padding: 10px 12px; font-size: 16px;  /* 16px stops iOS zoom */
  background: #fff; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color var(--t), box-shadow var(--t);
}
input:focus {
  outline: none; border-color: var(--yellow-deep);
  box-shadow: 0 0 0 3px var(--yellow-soft);
}
input[type=file] {
  width: 100%; padding: 14px; font-size: 13.5px; color: var(--ink-2);
  background: var(--surface-2);
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
}
.row2, .row3 { display: grid; gap: 12px; }
@media (min-width: 560px) {
  .row2 { grid-template-columns: 1fr 1fr; }
  .row3 { grid-template-columns: .85fr 1.3fr 1fr; }
}

.keyline {
  margin-top: 15px; padding: 11px 13px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: 12.5px; color: var(--ink-3);
  overflow-wrap: anywhere;
}
.keyline code { font-family: var(--mono); font-size: 12px; color: var(--ink); font-weight: 600; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 7px; }
.hint.warn { color: var(--amber); }

#thumb-wrap { margin-top: 12px; }
#thumb {
  max-height: 210px; border-radius: var(--r-md); display: block;
  border: 1px solid var(--line);
}

.msg {
  font-size: 13.5px; margin-top: 14px; padding: 11px 13px;
  border-radius: var(--r-sm); border: 1px solid transparent;
}
.msg.err { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.msg.ok { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }

/* ── Sheets ──────────────────────────────────────────────────────────── */
.sheet {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .38);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s var(--t);
}
.sheet-inner {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 0 24px 28px; max-height: 93vh; overflow-y: auto;
  box-shadow: var(--sh-lg); animation: rise .3s var(--t);
}
.wide-sheet { max-width: 700px; }
@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet-inner { border-radius: var(--r-xl); animation: pop .24s var(--t); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(20px); } }
@keyframes pop { from { transform: scale(.98); opacity: 0; } }

.sheet-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 13px; margin-bottom: 6px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 18px; }
.sheet-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px;
}
.sheet-actions .primary { min-width: 190px; }

/* ── Confirmation ────────────────────────────────────────────────────── */
.cmp {
  display: grid; gap: 12px; margin: 4px 0 18px;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}
.cmp .stat { background: var(--surface-2); box-shadow: none; }
.delta { font-size: 12.5px; font-weight: 600; font-family: var(--sans); }
.delta.up { color: var(--green); }
.delta.down { color: var(--amber); }

.vendors { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.vendor-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13.5px; padding: 9px 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.vendor-row b { font-weight: 700; font-variant-numeric: tabular-nums; }

.warnbox {
  background: var(--yellow-soft); color: var(--amber);
  border: 1px solid var(--yellow-line);
  padding: 12px 14px; border-radius: var(--r-sm);
  font-size: 13.5px; margin-bottom: 18px;
}
.subhead {
  font-family: var(--display); font-size: 14px; font-weight: 700;
  margin: 4px 0 10px;
}

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.mini { border-collapse: collapse; width: 100%; font-size: 12.5px; min-width: 620px; }
table.mini th, table.mini td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.mini th {
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-4); font-weight: 700; background: var(--surface-2);
}
table.mini td.n { text-align: right; font-variant-numeric: tabular-nums; }

.todo { margin: 0 0 18px 20px; color: var(--ink-2); font-size: 14px; }
.todo li { margin-bottom: 7px; }
.todo code, .lede code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--fill); padding: 1px 5px; border-radius: 4px;
}

.spin {
  display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px;
}
.primary.go .spin { border-color: rgba(15, 23, 42, .3); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Lightbox ────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 23, 42, .93);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px; padding: 28px;
  animation: fade .18s var(--t);
}
.lightbox img {
  max-width: min(100%, 600px); max-height: 68vh;
  border-radius: var(--r-md); box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  animation: pop .25s var(--t);
}
.lb-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px;
  max-width: 620px;
}
.lb-field { text-align: center; }
.lb-field dt {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--yellow); margin-bottom: 3px;
}
.lb-field dd { margin: 0; font-size: 14px; color: #fff; font-weight: 500; }
.lb-x {
  position: absolute; top: 16px; right: 20px; color: #fff; font-size: 30px;
  background: rgba(255, 255, 255, .12);
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--r-sm);
}
.lb-x:hover { background: rgba(255, 255, 255, .24); color: #fff; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
