/* Sourcing system — operations UI.
   No web fonts, no CDNs: this has to render with the wifi switched off. */
:root {
  --ink: #14181D;
  --ink-2: #1D242C;
  --paper: #F4F5F7;
  --card: #FFFFFF;
  --line: #E2E5EA;
  --line-soft: #EDEFF2;
  --text: #1A1F26;
  --muted: #6B7480;
  --faint: #98A1AD;
  --accent: #C2410C;
  --accent-soft: #FFF3EC;
  --teal: #0F766E;
  --teal-soft: #ECFDF9;
  --amber: #B45309;
  --amber-soft: #FFFAEB;
  --red: #B42318;
  --red-soft: #FEF3F2;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
/* Any explicit `display` below would otherwise beat the browser's rule for the
   hidden attribute, silently showing things we asked to hide. */
[hidden] { display: none !important; }
/* Which supplier makes what is the business's edge. Staff accounts never
   receive it from the server; this hides the places it would have shown. */
body.staff .owner-only { display: none !important; }
.owner-only[title] { cursor: help; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--paper);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }

/* ─── Shell ─────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #C9D1DB; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 0;
}
.brand { padding: 0 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 14px; }
.brand b { display: block; color: #fff; font-size: 15px; letter-spacing: -0.01em; }
.brand span { font-size: 11px; color: #7C8794; letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; flex: 1; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 20px; font-size: 13.5px;
  color: #AEB8C4; border-left: 2px solid transparent; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: rgba(194,65,12,.16); color: #fff; border-left-color: var(--accent); }
.nav .ico { width: 17px; text-align: center; opacity: .85; }
.nav .badge {
  margin-left: auto; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}
.nav .badge.quiet { background: rgba(255,255,255,.14); color: #C9D1DB; }
.sidefoot { padding: 12px 20px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #6E7885; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: #12B76A; } .dot.off { background: #F79009; }

.main { padding: 24px 28px 60px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-head .spacer { flex: 1; }

/* ─── Bits ──────────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 6px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 500; transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn.accent { background: var(--accent); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--line-soft); opacity: 1; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field input, .field select, .field textarea, .inp {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { min-height: 76px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* On a phone — which is how the Camera, Intake and Meet pages are used at a
   fair — the sidebar becomes a strip of links across the top instead of eating
   half the screen. */
@media (max-width: 860px) {
  .app { display: block; }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 2px; padding: 8px 10px; overflow-x: auto;
  }
  .sidebar { flex-wrap: nowrap; }
  .sidebar .brand { padding: 0 12px 0 4px; border-bottom: 0; margin-bottom: 0; flex: none; }
  .sidebar .brand span { display: none; }
  .sidebar .nav {
    display: flex; flex-direction: row; gap: 2px; overflow-x: auto; flex: 1;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .sidebar .nav::-webkit-scrollbar { display: none; }
  .sidebar .nav a { padding: 8px 11px; font-size: 13px; white-space: nowrap; border-radius: 8px; }
  .sidebar .sidefoot { display: none; }
  .main { padding: 14px 14px 80px; }
  .page-head h1 { font-size: 20px; }
}

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--line-soft); color: var(--muted); white-space: nowrap;
}
.pill.lead    { background: #EEF2F6; color: #475467; }
.pill.met     { background: #EFF4FF; color: #2E5AAC; }
.pill.quoting { background: var(--amber-soft); color: var(--amber); }
.pill.sampling{ background: var(--amber-soft); color: var(--amber); }
.pill.active  { background: var(--teal-soft); color: var(--teal); }
.pill.rejected{ background: var(--red-soft); color: var(--red); }
.pill.queued  { background: #EEF2F6; color: #475467; }
.pill.processing { background: var(--amber-soft); color: var(--amber); }
.pill.review  { background: var(--accent-soft); color: var(--accent); }
.pill.done    { background: var(--teal-soft); color: var(--teal); }
.pill.error   { background: var(--red-soft); color: var(--red); }
.pill.high    { background: var(--red-soft); color: var(--red); }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint);
  font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line);
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover { background: #FAFBFC; }
tbody tr:last-child td { border-bottom: none; }
.t-strong { font-weight: 600; }
.t-sub { font-size: 12px; color: var(--muted); }
.t-cn { font-size: 12px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 400px; }
.toolbar select { width: auto; min-width: 130px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 1px; }
.stat.alert { border-color: #FBC7B6; background: var(--accent-soft); }
.stat.alert .n { color: var(--accent); }

/* Product shots are wide (an L-shaped desk is 3:1) and shot on white. `cover`
   crops the ends off, which on a catalogue card hides the actual product —
   `contain` letterboxes instead, and the white ground makes the padding
   invisible. */
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: contain; background: #fff; border: 1px solid var(--line); display: block; }
.thumb.lg { width: 100%; height: 170px; border-radius: 6px 6px 0 0; object-fit: contain; background: #fff; padding: 8px; border: none; border-bottom: 1px solid var(--line-soft); }
.thumb-ph { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 17px; }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(16,24,40,.5); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px; z-index: 60; overflow-y: auto;
}
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 640px; box-shadow: 0 20px 40px rgba(16,24,40,.2); }
.modal.wide { max-width: 980px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 16px; flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #FAFBFC; border-radius: 0 0 10px 10px; }
.x { font-size: 20px; color: var(--faint); line-height: 1; padding: 0 4px; }
.x:hover { color: var(--text); }

/* Toast */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 7px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(16,24,40,.28); opacity: 0; transition: all .25s cubic-bezier(.2,.8,.2,1); z-index: 200;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.bad { background: var(--red); }

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 20px; text-align: center;
  color: var(--muted); background: #fff; transition: all .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone b { display: block; color: var(--text); font-size: 15px; margin-bottom: 3px; }
.dropzone.over b { color: var(--accent); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button {
  padding: 9px 15px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.warn { background: var(--amber-soft); border: 1px solid #FDE2B3; color: #7A4A08; padding: 10px 13px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.warn a { text-decoration: underline; }
.info { background: #EFF4FF; border: 1px solid #C7D8F5; color: #2E5AAC; padding: 10px 13px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.pcard .body { padding: 11px 13px; }
.pcard .nm { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.pcard .mt { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pcard .pr { margin-top: 7px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Variants of one product share a name and a photo, so the dimensions are the
   only thing telling them apart — they belong on the card, not buried inside. */
.pcard .size {
  margin-top: 3px; font-size: 12px; color: var(--text); font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.pcard .ref { margin-top: 2px; font-size: 11px; color: var(--faint); font-family: ui-monospace, monospace; }
