:root {
  /* Pastel pink + blue brand palette.
     The topbar/headings use a deeper rose so white text stays legible;
     soft pink and blue are used as surface tints and accents, while all
     data stays high-contrast dark ink for fast reading. */
  --rose: #c98a9b;          /* deeper dusky rose -- topbar, primary accent */
  --rose-deep: #a96d80;     /* topbar border / hover */
  --pink-soft: #f7e3ea;     /* pale pink surface tint */
  --pink-tint: #fdf3f7;     /* very pale pink (accent card bg) */
  --blue-soft: #e3edf6;     /* pale blue surface tint */
  --blue-accent: #7fa8cc;   /* pastel blue accent */
  --ink: #2b2630;           /* near-black with a faint warm cast */
  --muted: #7a7480;
  --line: #ece6ea;          /* soft pink-grey hairline */
  --bg: #fbf8fa;            /* barely-pink off-white page */
  --card: #ffffff;
  --pos: #1a7f4b;
  --neg: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* Top bar */
.topbar {
  background: var(--rose);
  color: #fff;
  border-bottom: 3px solid var(--rose-deep);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em; }
.brand-sub { font-weight: 400; opacity: 0.85; font-size: 0.85rem; margin-left: 6px; }
.nav a { color: #fff; text-decoration: none; margin-left: 22px; font-size: 0.95rem; opacity: 0.9; }
.nav a:hover { opacity: 1; text-decoration: underline; }

/* Headings & text */
main.wrap { padding-top: 28px; padding-bottom: 40px; min-height: 60vh; }
h1 { font-size: 1.7rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 32px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.lede { color: var(--muted); margin: 0 0 22px; max-width: 70ch; }
.crumb { margin: 0 0 8px; }
.crumb a, a { color: var(--rose-deep); }
.crumb a { text-decoration: none; }

/* Dashboard cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 4px;
  text-decoration: none; color: var(--ink);
}
a.card:hover { border-color: var(--rose); }
.card-num { font-size: 2rem; font-weight: 700; line-height: 1; }
.card-label { color: var(--muted); font-size: 0.9rem; }

/* Figure strip on detail page */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 8px; }
.fig { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.fig-num { display: block; font-size: 1.8rem; font-weight: 700; line-height: 1; }
.fig-label { color: var(--muted); font-size: 0.85rem; }
.fig-accent { border-color: var(--rose); background: var(--pink-tint); }

/* Tables */
table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.grid.narrow { max-width: 520px; }
.grid th, .grid td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.grid th { background: var(--blue-soft); font-weight: 600; color: #3a4654; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: #fafafa; }
.grid tfoot td { background: var(--pink-soft); font-weight: 600; border-top: 2px solid var(--rose); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.empty { color: var(--muted); text-align: center; padding: 22px; }
.tag { display: inline-block; font-size: 0.72rem; background: #fde8c8; color: #8a5a00; padding: 1px 7px; border-radius: 10px; margin-left: 4px; }

/* Footer */
.foot { color: var(--muted); font-size: 0.82rem; border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 24px; }

@media (max-width: 600px) {
  .topbar .wrap { flex-direction: column; height: auto; padding: 10px 24px; gap: 6px; }
  .nav a { margin: 0 12px 0 0; }
}

/* ---- Forms, buttons, flashes (action screens) ---- */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.flashes { margin-bottom: 18px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 0.93rem; border: 1px solid; }
.flash-success { background: #eaf7ef; color: #14633a; border-color: #bfe6cd; }
.flash-error { background: #fdeceb; border-color: #f3c4c0; color: #8f1f17; }

.form { padding: 22px 24px; margin-bottom: 26px; }
.form-title { font-size: 1.05rem; margin: 18px 0 4px; border: none; padding: 0; }
.hint { color: var(--muted); font-size: 0.86rem; margin: 0 0 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; font-weight: 600; color: #4a4450; }
.field input, .field select {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--blue-accent); outline-offset: 1px; border-color: var(--blue-accent); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row .field { flex: 1 1 160px; }
.row .field.grow { flex: 3 1 240px; }
.cw-row { gap: 12px; margin-bottom: 0; }

.size-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.size-box {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem; cursor: pointer; background: #fff;
}
.size-box input { margin: 0; }

.btn {
  display: inline-block; background: var(--rose); color: #fff; border: none;
  padding: 10px 18px; border-radius: 8px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--rose-deep); }
.linkbtn {
  background: none; border: none; padding: 0; font: inherit; color: var(--rose-deep);
  cursor: pointer; text-decoration: underline;
}

/* ---- Invoice import preview ---- */
.ok-badge { display: inline-block; font-size: 0.72rem; background: #eaf7ef; color: #14633a; padding: 1px 8px; border-radius: 10px; }
.flagged-row { background: #fdf3ef; }
.flagged-row:hover { background: #fbece5; }
.line-warn { font-size: 0.78rem; color: #8a5a00; margin-top: 2px; }

/* ---- Purchase orders / capture grid ---- */
.actions { display: flex; gap: 12px; margin-bottom: 20px; }
.btn-go { background: #1a7f4b; }
.btn-go:hover { background: #14633a; }
.status-pill { display: inline-block; font-size: 0.8rem; padding: 3px 12px; border-radius: 12px; font-weight: 600; }
.status-draft { background: var(--blue-soft); color: #3a4654; }
.status-placed { background: var(--pink-soft); color: #8a3a52; }
.status-part_received { background: #fff3d6; color: #8a5a00; }
.status-received { background: #eaf7ef; color: #14633a; }
.status-cancelled { background: #eee; color: #777; }

.grid-scroll { overflow-x: auto; margin-bottom: 16px; }
.order-grid th, .order-grid td { padding: 6px 8px; }
.cell-input { width: 52px; padding: 5px 6px; text-align: right; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.cell-input:focus { outline: 2px solid var(--blue-accent); border-color: var(--blue-accent); }

/* ---- Create-during-import ---- */
.create-style { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.create-style-name { font-weight: 600; font-size: 1.05rem; padding: 8px 0; }
.code-fixed { padding: 9px 0; font-weight: 600; }
.code-input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; width: 110px; }

/* ---- Customer order line actions ---- */
.line-actions { white-space: nowrap; }
.inline-act { display: inline-flex; align-items: center; gap: 4px; margin: 2px 6px 2px 0; }
.btn-mini { background: var(--rose); color: #fff; border: none; padding: 5px 10px; border-radius: 6px; font: inherit; font-size: 0.82rem; cursor: pointer; }
.btn-mini:hover { background: var(--rose-deep); }
.btn-mini.btn-go { background: #1a7f4b; }
.btn-mini.btn-go:hover { background: #14633a; }
.btn-plain { background: #eee; color: #555; }
.btn-plain:hover { background: #e0e0e0; }
.loc-select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 0.82rem; }
.addline .field { margin-bottom: 0; }

/* ---- Product images ---- */
.thumb-cell { width: 52px; padding: 4px !important; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; background: var(--blue-soft); }
.sku-head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 8px; }
.sku-photo { width: 180px; height: 180px; object-fit: cover; border-radius: 12px; background: var(--blue-soft); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
@media (max-width: 640px){ .sku-head { flex-direction: column; } .sku-photo { width: 100%; height: auto; } }

/* ---- Search & pagination ---- */
.search-row { display: flex; gap: 8px; margin-bottom: 4px; }
.search-row input[type=search] { flex: 1; max-width: 420px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.search-row input[type=search]:focus { outline: 2px solid var(--blue-accent); border-color: var(--blue-accent); }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 20px 0; }

/* ---- Login & user nav ---- */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: var(--bg); margin: 0; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 32px; width: 360px; max-width: 90vw; box-shadow: 0 4px 20px rgba(0,0,0,0.06); }
.login-brand { font-size: 1.3rem; font-weight: 700; color: var(--rose-deep); margin-bottom: 20px; text-align: center; }
.login-card .field { margin-bottom: 14px; }
.nav-user { color: #fff; opacity: 0.85; font-size: 0.85rem; margin-left: 10px; }
.nav-logout { display: inline; margin: 0; }
.nav-logout button { background: rgba(255,255,255,0.18); color: #fff; border: none; padding: 5px 12px; border-radius: 6px; font: inherit; font-size: 0.82rem; cursor: pointer; }
.nav-logout button:hover { background: rgba(255,255,255,0.3); }

/* ---- Stock count / scanning ---- */
.count-entry { margin-bottom: 18px; }
.lookup-result { margin-top: 10px; min-height: 22px; }
.scan-area { margin-top: 14px; padding: 12px; background: var(--blue-soft); border-radius: 10px; max-width: 360px; }
.scan-area #scanVideo { width: 100%; border-radius: 8px; overflow: hidden; }
.ok-badge { display: inline-block; background: #e3f4e8; color: #1f7a44; padding: 3px 10px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; }
.tag { display: inline-block; background: #fdeede; color: #9a5b16; padding: 3px 10px; border-radius: 6px; font-size: 0.82rem; }
.card-grid { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---- Book-in scan feedback ---- */
.flash-row { background: #e3f4e8 !important; transition: background 0.3s; }
.qty-in:focus { outline: 2px solid var(--blue-accent); }

/* ---- Reports ---- */
.drill-head:hover { background: var(--blue-soft); }
.drill-row td { font-size: 0.9rem; color: #555; background: #fcfcfd; }
.indent { padding-left: 24px !important; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---- Brand logo ---- */
.brand { display: inline-flex; align-items: baseline; gap: 10px; }
.brand-logo { height: 26px; width: auto; display: block; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.login-logo { height: 38px; width: auto; max-width: 80%; }

/* ---- Delete bin, filter toggle, disco tag, room table ---- */
.row-actions { text-align: right; white-space: nowrap; }
.inline-delete { display: inline; margin: 0; }
.bin {
  background: none; border: none; cursor: pointer; font-size: 15px;
  opacity: .35; padding: 2px 6px; border-radius: 6px; line-height: 1;
  transition: opacity .12s, background .12s;
}
.bin:hover { opacity: 1; background: rgba(190,80,90,.12); }
.filter-row { display: flex; gap: 10px; align-items: center; margin: 4px 0 12px; flex-wrap: wrap; }
.toggle {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line, #e3d9dc); text-decoration: none;
  color: var(--ink, #3a2c30); font-size: 13px; background: #fff;
}
.toggle.on { background: var(--rose, #b76e79); color: #fff; border-color: var(--rose, #b76e79); }
.tag-disco {
  display: inline-block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .04em; padding: 1px 6px; border-radius: 4px;
  background: #efe3e6; color: #8a5a64; vertical-align: middle;
}
.table-scroll { overflow-x: auto; }
table.compact th, table.compact td { padding: 5px 8px; font-size: 13px; }

/* ---- Help page + contextual help button ---- */
#help-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 50;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--rose, #b76e79); color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  box-shadow: 0 3px 12px rgba(120,60,70,.35); transition: transform .12s, box-shadow .12s;
}
#help-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(120,60,70,.45); }
.help-wrap { max-width: 820px; }
.help-toc {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px;
  background: #fff; border: 1px solid var(--line, #e3d9dc); border-radius: 10px;
  padding: 16px 20px; margin: 8px 0 26px;
}
.help-toc a { color: var(--rose, #b76e79); text-decoration: none; font-size: 14px; padding: 3px 0; }
.help-toc a:hover { text-decoration: underline; }
.help-sec { scroll-margin-top: 84px; padding: 14px 0 22px; border-top: 1px solid var(--line, #e3d9dc); }
.help-sec h2 { color: var(--ink, #3a2c30); margin-bottom: 8px; }
.help-sec h3 { color: #6b5b60; font-size: 15px; margin: 16px 0 6px; }
.help-sec p, .help-sec li { line-height: 1.55; }
.help-sec ul, .help-sec ol { margin: 4px 0 10px 22px; }
.help-sec li { margin: 3px 0; }
.help-note {
  background: var(--soft, #f6eef0); border-left: 3px solid var(--rose, #b76e79);
  border-radius: 6px; padding: 10px 14px; margin: 12px 0; font-size: 14px;
}

/* ---- Style edit: size chips, small buttons, add-sizes rows ---- */
.btn-sm { padding: 4px 12px; font-size: 13px; }
.size-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px;
  padding: 3px 9px; border: 1px solid var(--line, #e3d9dc); border-radius: 999px;
  background: #fff; cursor: pointer; user-select: none;
}
.chip input { margin: 0; }
.chip:hover { border-color: var(--rose, #b76e79); }
.add-sizes-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px solid var(--line, #e3d9dc); margin: 0;
}
