@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700&family=Figtree:wght@400;500;600;700&display=swap");

:root {
  --paper: #f1f4f1;
  --surface: #ffffff;
  --ink: #18262e;
  --muted: #5b6b72;
  --line: #dce3df;
  --line-strong: #bfcac5;
  --brand: #126b5b;
  --brand-dark: #0d544a;
  --brand-soft: #dcefe9;
  --side: #12342e;
  --side-hover: #1c4a42;
  --danger: #b3342b;
  --danger-soft: #fbe5e2;
  --marigold: #f0b429;
  --radius: 14px;
  --radius-sm: 10px;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  font-variant-numeric: tabular-nums;
}
a { color: var(--brand-dark); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 32px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.right { text-align: right; }
.pos { color: #19764a; }
.neg { color: var(--danger); }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; border-radius: 6px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 16px; background: var(--side); color: #e7f1ee;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 700 20px var(--display); }
.brand svg { width: 26px; height: 26px; }
.find input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid #2b5a51; background: #0d2b26; color: #fff; font: 500 15px var(--body);
}
.find input::placeholder { color: #8fb3aa; }
.find input:focus { border-color: var(--marigold); outline: none; box-shadow: 0 0 0 3px rgba(240,180,41,.3); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .side-foot a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: #cfe3de; text-decoration: none; font-weight: 600;
}
.nav a:hover, .side-foot a:hover { background: var(--side-hover); color: #fff; }
.nav a.on { background: #f6f3e7; color: var(--side); }
.nav svg, .side-foot svg { width: 20px; height: 20px; flex: none; }
.nav .badge { margin-left: auto; background: var(--marigold); color: #3b2a00; border-radius: 999px; padding: 0 8px; font-size: 13px; font-weight: 700; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.main { padding: 30px 36px 60px; max-width: 1180px; width: 100%; }
.tabbar { display: none; }

/* ---------- page bits ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; border-left: 5px solid var(--brand); background: var(--brand-soft); }
.flash.error { border-left-color: var(--danger); background: var(--danger-soft); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.card > h2, .card > h3 { margin-bottom: 14px; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.empty p { margin-bottom: 14px; }

/* ---------- buttons and fields ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font: 700 15px var(--body); text-decoration: none; cursor: pointer;
}
.btn:hover, button:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.secondary, button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover, button.secondary:hover { background: #eef3f0; }
.btn.amber, button.amber { background: var(--marigold); border-color: var(--marigold); color: #3b2a00; }
.btn.amber:hover, button.amber:hover { background: #dba01c; border-color: #dba01c; }
.btn.danger, button.danger { background: var(--surface); color: var(--danger); border-color: #e2b5b0; }
.btn.danger:hover, button.danger:hover { background: var(--danger-soft); }
.btn.sm, button.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; }

label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 6px; }
label .hint { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: 16px var(--body);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* ---------- chips and the SKU tag ---------- */
.chip { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #e8edf0; color: #3e515b; white-space: nowrap; }
.st-ordered { background: #e8edf0; color: #3e515b; }
.st-in_stock { background: #dcebfa; color: #1b5a93; }
.st-listed { background: #d9f0e0; color: #1a6638; }
.st-pending { background: #fde8b0; color: #6d4b00; }
.st-sold { background: #e8ddf4; color: #55308a; }
.src-pallet { background: #f8ddd0; color: #8a3b1a; }
.src-influencer { background: #e3e8f7; color: #354a8c; }
.sku-tag {
  position: relative; display: inline-flex; align-items: center; padding: 3px 12px 3px 22px;
  border: 1.5px solid var(--ink); border-radius: 4px 12px 12px 4px; background: #fff;
  font-weight: 700; font-size: 15px; letter-spacing: .02em; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.sku-tag::before { content: ""; position: absolute; left: 7px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; border: 1.5px solid var(--ink); }
a.sku-tag:hover { background: #fff6d8; }
.sku-tag.big { font-size: 24px; padding: 6px 18px 6px 30px; border-width: 2px; }
.sku-tag.big::before { left: 11px; width: 10px; height: 10px; margin-top: -5px; }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 22px; }
.stat { padding: 18px 22px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat .num { font: 700 30px var(--display); letter-spacing: -0.02em; }
.stat .lbl { color: var(--muted); font-size: 14px; }
.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px; align-items: start; }
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.row-list li:first-child { border-top: 0; padding-top: 0; }
.row-list .grow { flex: 1; min-width: 0; }
.row-list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline a { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; }
.pipeline a:first-child { border-top: 0; padding-top: 0; }
.pipeline a:hover .count { background: var(--brand-soft); }
.pipeline .count { font: 700 18px var(--display); padding: 2px 12px; border-radius: 999px; background: #eef3f0; }

/* ---------- inventory ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.tab:hover { border-color: var(--line-strong); }
.tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab .n { font-size: 13px; padding: 0 8px; border-radius: 999px; background: #eef3f0; color: var(--ink); }
.tab.on .n { background: #2f4650; color: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .grow { flex: 1 1 260px; }
.filters select { width: auto; min-width: 150px; }
.bulk { margin-bottom: 14px; }
.bulk summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); padding: 6px 0; }
.bulk .form-grid { margin-top: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 13px; font-weight: 700; color: var(--muted); padding: 12px 14px; background: #f7faf8; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:first-child td { border-top: 0; }
.tbl tbody tr:hover { background: #f7faf8; }
.tbl .num { text-align: right; }
.tbl td.num, .tbl th.num, .tbl td.date { white-space: nowrap; }
.tbl .check { width: 44px; }
.name-cell .name { font-weight: 600; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--muted); }

/* ---------- item page ---------- */
.item-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.item-head h1 { font-size: 26px; margin: 12px 0 8px; max-width: 760px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px 24px; margin: 22px 0 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
.sale-line { margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-sm); background: #f3edfa; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.panel > summary { list-style: none; cursor: pointer; padding: 18px 22px; font: 700 18px var(--display); display: flex; align-items: center; justify-content: space-between; }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: "+"; font: 600 24px var(--body); color: var(--muted); }
.panel[open] > summary::after { content: "\2212"; }
.panel .body { padding: 0 22px 22px; }
.panel .body > p.muted { margin-bottom: 16px; }

/* ---------- quick entry ---------- */
.seg { display: inline-flex; background: #e1e8e4; border-radius: var(--radius-sm); padding: 4px; margin-bottom: 22px; }
.seg a { padding: 9px 20px; border-radius: 8px; text-decoration: none; font-weight: 700; color: var(--muted); }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.quick { max-width: 780px; }
.sku-input { font-size: 22px; font-weight: 700; min-height: 56px; letter-spacing: .02em; }
.preview { margin-top: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: #f6f8f6; border: 1px dashed var(--line-strong); min-height: 64px; }
.preview.ok { background: var(--brand-soft); border-style: solid; border-color: #b8ddd2; }
.preview.warn { background: var(--danger-soft); border-style: solid; border-color: #efc4bf; }
.preview .pname { font-weight: 700; }

/* ---------- reports ---------- */
.rep-table th, .rep-table td { white-space: nowrap; }
.note { color: var(--muted); font-size: 14px; margin-top: 10px; }

/* ---------- login ---------- */
.login { max-width: 400px; margin: 12vh auto 0; padding: 0 20px; }
.login .brand { color: var(--side); margin-bottom: 20px; }

/* ---------- phones and small screens ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
  .side .nav, .side .side-foot { display: none; }
  .brand span { display: none; }
  .find { flex: 1; }
  .main { padding: 18px 14px 96px; }
  h1 { font-size: 26px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: #fff; border-top: 1px solid var(--line-strong); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; position: relative; }
  .tabbar a.on { color: var(--brand-dark); }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar .badge { position: absolute; top: 4px; left: 54%; background: var(--marigold); color: #3b2a00; border-radius: 999px; padding: 0 6px; font-size: 11px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 14px; border-top: 1px solid var(--line); }
  .tbl tr:first-child { border-top: 0; }
  .tbl td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 16px; text-align: right; }
  .tbl td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 14px; text-align: left; }
  .tbl td.name-cell { display: block; text-align: left; }
  .tbl td.name-cell .name { white-space: normal; max-width: none; }
  .tbl td.check { width: auto; }
  .tbl td.go { justify-content: flex-start; padding-top: 8px; }
  .row-list li { flex-wrap: wrap; row-gap: 6px; }
  .row-list li .grow { order: 3; flex-basis: 100%; }
  .row-list li .btn { margin-left: auto; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin-left: -14px; margin-right: -14px; padding: 0 14px 4px; scrollbar-width: none; }
  .tab { flex: none; }
  .tbl td, .tbl th { white-space: normal; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 140px; }
}

svg.i { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- problem solve ---------- */
.tab-problem .n { background: #fde8b0; color: #6d4b00; }
.tab-problem.on { background: #6d4b00; border-color: #6d4b00; }
.tab-problem.on .n { background: #f0b429; color: #3b2a00; }
.pipeline .count.warn { background: #fde8b0; color: #6d4b00; }
.fix-note { max-width: 360px; }
.callout { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 20px; padding: 14px 16px; border-radius: var(--radius-sm); background: #fff3d1; border-left: 5px solid var(--marigold); }
.callout form { margin: 0; }

.amazon-chip { display:inline-block; font-size:12px; font-weight:600; color:#7a4a00; background:#fff3d6; border:1px solid #f0d594; border-radius:999px; padding:1px 9px; text-decoration:none; }
.amazon-chip:hover { background:#ffe8b0; }
