/* PrimeBuy theme: dark navy header, orange accent bar, dark rounded table headers. */
:root {
  --ink: #0f0d24; --ink-2: #1c1a38; --accent: #f5a524; --accent-dark: #d98c0f;
  --bg: #f4f4f7; --card: #fff; --line: #e6e6ec; --text: #1b1a2e; --muted: #6e6c80;
  --ok: #1e7b45; --warn: #9a6400; --err: #b42318; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: #3a37b8; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { background: var(--ink); color: #fff; border-bottom: 4px solid var(--accent); }
.top .wrap { display: flex; align-items: center; gap: 28px; min-height: 76px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; line-height: 1.1; }
.logo-icon { height: 50px; width: auto; display: block; }
.logo-words { display: flex; flex-direction: column; }
.logo-text { font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.logo-text b { color: var(--accent); font-weight: 700; }
.tagline { font-size: 9px; letter-spacing: 1.6px; text-transform: uppercase; opacity: .85; margin-top: 3px; }
.logo-img { height: 54px; display: block; }
.top nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; font-size: 14px; }
.top nav a, .who a, .who .link { color: #fff; text-decoration: none; opacity: .88; font-weight: 500; }
.top nav a:hover, .who a:hover { opacity: 1; color: var(--accent); }
.who { display: flex; gap: 16px; align-items: center; font-size: 14px; }
.who span { opacity: .7; }

main { padding: 24px 16px 40px; }
h1 { font-size: 26px; font-weight: 600; margin: 8px 0 18px; }
h2 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 16px 0; box-shadow: 0 1px 2px rgba(15, 13, 36, .04); }
.card h2 { margin-top: 0; }
.narrow { max-width: 460px; margin: 40px auto; }
.narrow.wide { max-width: 640px; }

/* Forms */
label { display: block; margin: 0 0 12px; font-weight: 500; font-size: 14px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; border: 1px solid #cfcfd9; border-radius: 8px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
label.check input { width: auto; margin: 0; }
textarea { resize: vertical; }
button, .button { display: inline-block; font: inherit; font-weight: 500; padding: 8px 16px; border-radius: 8px; border: 1px solid #c9c9d4; background: #fff; color: var(--text); cursor: pointer; text-decoration: none; }
button:hover, .button:hover { background: #f0f0f5; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }
button.primary:hover, .button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button[disabled] { opacity: .5; cursor: not-allowed; }
button.sm { padding: 6px 11px; font-size: 14px; white-space: nowrap; }
button.link { background: none; border: none; padding: 0; color: #3a37b8; text-decoration: underline; font-weight: 400; }
button.link.danger, .danger { color: var(--err); }
.inline { display: inline; margin: 0; }
form.stack { display: flex; flex-direction: column; gap: 6px; margin: 0; }
form.stack select { margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row form { margin: 0; }
.between { justify-content: space-between; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.cols.aligntop { align-items: start; }
.meta { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.flash { padding: 11px 15px; border-radius: 8px; margin: 0 0 16px; border: 1px solid; }
.flash.ok { background: #e8f5ee; border-color: #b5dcc5; color: var(--ok); }
.flash.error { background: #fdeceb; border-color: #f2c1bd; color: var(--err); }
.flash.warn { background: #fff6e5; border-color: #f0d9a8; color: var(--warn); }
.flash.info { background: #eeedfb; border-color: #cfcdf3; color: var(--ink-2); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

/* Tables (dark rounded header like the PrimeBuy order sheet) */
table.grid { width: 100%; max-width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); margin-bottom: 14px; border-radius: var(--radius); }
.grid th { background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; padding: 12px; text-align: left; }
.grid thead th:first-child { border-top-left-radius: var(--radius); }
.grid thead th:last-child { border-top-right-radius: var(--radius); }
.grid td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:nth-child(even) td { background: #fafafc; }
.grid tfoot td { background: #f6f6f9; border-bottom: none; }
.grid td input[type=number] { width: 90px; margin: 0; }
.grid tr.inactive td { color: var(--muted); background: #f7f7f7; }
.num { text-align: right !important; white-space: nowrap; }
.amount { font-weight: 600; }
.idx { color: var(--muted); width: 40px; font-variant-numeric: tabular-nums; }
.item-sku { font-weight: 600; }
.item-sub { color: var(--muted); font-size: 13px; }
.sku { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #44516a; }
.thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: #f0f0f4; display: block; }
.thumb.ph { border: 1px dashed var(--line); }
.image-field { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.image-field label { flex: 1; margin: 0; }
form.add { display: flex; gap: 6px; align-items: center; margin: 0; }
.pill { display: inline-block; background: var(--accent); color: var(--ink); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.pill.light { background: rgba(15, 13, 36, .15); color: var(--ink); font-weight: 500; }
.filters { display: flex; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 220px; margin: 0; }
.pager { display: flex; gap: 16px; justify-content: center; margin: 12px 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 5px 12px; border-radius: 16px; text-decoration: none; color: var(--text); background: #e7e7ee; font-size: 13px; }
.tabs a.on { background: var(--ink); color: #fff; }

/* Status badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; vertical-align: middle; background: #e7e7ee; color: #334; }
.st-submitted { background: #e6e5fb; color: #3a37b8; }
.st-in_review { background: #efe7fb; color: #5b33a0; }
.st-confirmed { background: #e0f2f1; color: #0e6b62; }
.st-processing { background: #fff1d6; color: #8a5a00; }
.st-partially_shipped { background: #fde8d7; color: #9a4a0b; }
.st-shipped { background: #dff3e6; color: #1e7b45; }
.st-delivered { background: #1e7b45; color: #fff; }
.st-on_hold { background: #fff0c2; color: #7a5d00; }
.st-cancelled { background: #fdeceb; color: var(--err); }

/* Order progress */
.progress { display: flex; list-style: none; padding: 0; margin: 0 0 20px; counter-reset: step; }
.progress li { flex: 1; text-align: center; position: relative; font-size: 13px; color: var(--muted); padding-top: 32px; }
.progress li::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; line-height: 26px; border-radius: 50%; background: #e2e2ea; color: #556; font-weight: 700; z-index: 1; }
.progress li::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 3px; background: #e2e2ea; }
.progress li:first-child::after { display: none; }
.progress li.done, .progress li.current { color: var(--text); }
.progress li.done::before { background: var(--ink); color: var(--accent); content: "✓"; }
.progress li.current::before { background: var(--accent); color: var(--ink); }
.progress li.done::after, .progress li.current::after { background: var(--ink); }
.progress li.current { font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line); }
.timeline li { padding: 6px 0 12px 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: 10px; width: 15px; height: 15px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); box-sizing: border-box; }
.timeline .when { color: var(--muted); font-size: 13px; margin-right: 8px; }

/* Two-factor setup */
.steps { padding-left: 20px; }
.steps li { margin-bottom: 16px; }
.qr { margin: 10px 0; }
.qr svg { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 8px; }
code.secret { display: inline-block; font-size: 15px; letter-spacing: 1px; padding: 6px 10px; margin: 6px 0; }
.code-input { max-width: 160px; font-size: 20px; letter-spacing: 4px; display: inline-block; margin-right: 8px; }
.steps form { display: flex; align-items: center; margin-top: 8px; }

code { background: #efeff4; padding: 1px 5px; border-radius: 4px; }
.wrap-any { word-break: break-all; }
details summary { cursor: pointer; color: #3a37b8; }
li.ok { color: var(--ok); }
.foot { color: var(--muted); font-size: 12px; padding: 20px 16px 30px; }

.m-only { display: none; }
@media (max-width: 720px) {
  .m-hide { display: none !important; }
  .m-only { display: revert; }
  span.m-only { display: inline; }
  .top .wrap { gap: 8px 14px; min-height: 0; }
  .logo-icon { height: 34px; }
  .logo-text { font-size: 19px; }
  .logo-by { font-size: 10px; }
  .top .tagline, .who span { display: none; }
  .who { margin-left: auto; gap: 12px; font-size: 13px; }
  .top nav { order: 3; width: 100%; gap: 6px 14px; font-size: 14px; }
  .cart td input[type=number] { width: 56px; }
  .cart .link { padding: 0; font-size: 12px; }
  .nowrap { white-space: nowrap; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .tabs a { white-space: nowrap; }
  .progress li { font-size: 0 !important; padding-top: 28px; }
  /* Wide admin tables scroll sideways instead of stretching the page. */
  main .grid:not(.catalog):not(.cart):not(.lines):not(.list) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .grid { font-size: 14px; }
  .grid th, .grid td { padding: 8px 6px; }
  .grid th { font-size: 10px; letter-spacing: .5px; }
  .grid td input[type=number] { width: 64px; }
  .catalog td:first-child, .catalog th:first-child { display: none; }
  .idx { width: 22px; padding-right: 2px !important; font-size: 12px; }
  .item-sku { white-space: nowrap; font-size: 13px; }
  form.add { flex-direction: column; align-items: stretch; }
  .filters input, .filters select { min-width: 0; flex: 1; }
  .progress li { font-size: 11px; }
}
@media print {
  .top, .foot, .noprint, nav { display: none !important; }
  body { background: #fff; }
  .grid th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.logo-by { font-size: 12px; font-weight: 500; opacity: .9; margin-top: 1px; }
.logo-by b { color: var(--accent); font-weight: 600; }
/* Documents & billing */
.mt6 { margin-top: 6px; }
.mt8 { margin-top: 8px; }
.big { font-size: 22px; }
.meta-row { margin-bottom: 12px; }
.grid4 { grid-template-columns: repeat(4, 1fr); }
.total-row td { background: var(--ink) !important; color: #fff; }
.total-row td b { color: var(--accent); }
ul.plain { list-style: none; padding: 0; margin: 0 0 8px; }
ul.plain li { margin-bottom: 6px; }
.sm-input { width: 140px; margin: 0; padding: 4px 8px; font-size: 13px; display: inline-block; }
.doc-lines td { vertical-align: top; }
.doc-lines input { margin: 0; padding: 6px 8px; font-size: 14px; }
.w-qty { width: 70px; }
.w-money { width: 100px; }
.w-uom { width: 70px; }
.w-part { width: 140px; }
fieldset.internal { border: 1px dashed #d9a441; border-radius: 8px; padding: 8px 12px 0; margin: 0 0 12px; }
fieldset.internal legend { font-size: 12px; color: #8a5a00; padding: 0 6px; }
button.danger { border-color: var(--err); color: var(--err); }
@media (max-width: 720px) { .grid4 { grid-template-columns: repeat(2, 1fr); } }
.reminder-box { background: #f6f6f9; border-left: 3px solid var(--accent); padding: 8px 12px; margin: 0 0 12px; border-radius: 4px; font-size: 14px; }
/* CRM */
h3 { font-size: 15px; margin: 14px 0 8px; }
.checklist { list-style: none; padding: 0; margin: 0 0 12px; columns: 2; column-gap: 24px; }
.checklist li { padding: 4px 0; break-inside: avoid; }
.checklist .ic { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 50%; background: #e7e7ee; font-size: 12px; font-weight: 700; }
.checklist .done .ic { background: var(--ink); color: var(--accent); }
.checklist .blocked .ic { background: var(--err); color: #fff; }
.checklist .na { color: var(--muted); }
.subcard { background: #fafafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.subcard h3 { margin-top: 0; }
.approval { border-left: 3px solid var(--ok); background: #e8f5ee; padding: 6px 10px; border-radius: 4px; margin: 0 0 10px; font-size: 14px; }
.approval.rejected { border-color: var(--err); background: #fdeceb; }
.approval-card { border-color: #f0d9a8; }
ul.tasks, ul.notes { list-style: none; padding: 0; margin: 0 0 10px; }
ul.tasks li, ul.notes li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.tasks li.done { color: var(--muted); text-decoration: line-through; }
ul.tasks li.overdue { color: var(--err); }
button.tick { padding: 0 6px; font-size: 12px; margin-right: 4px; }
.task-form input, .task-form select { margin: 4px 0; width: auto; }
.task-form input[name=title] { width: 100%; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stats > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; }
.stats b { font-size: 24px; }
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board .col { flex: 0 0 230px; background: #ebebf1; border-radius: var(--radius); padding: 8px; }
.col-head { font-weight: 600; font-size: 13px; padding: 4px 4px 8px; display: flex; justify-content: space-between; }
.pcard { display: block; background: var(--card); border-radius: 8px; padding: 10px; margin-bottom: 8px; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--line); }
.pcard:hover { border-color: var(--accent); }
.pcard.needs { border-left-color: var(--accent); }
.pcard.blocked { border-left-color: var(--err); }
.pcard .next { margin-top: 4px; font-weight: 600; }
.pad { padding: 6px; }
@media (max-width: 720px) { .checklist { columns: 1; } }

.catpick { columns: 2; column-gap: 24px; margin-bottom: 12px; }
.catpick label { break-inside: avoid; display: block; margin: 2px 0; }
@media (max-width: 720px) { .catpick { columns: 1; } }

a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: underline; }
.product { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; }
.product-photo img { width: 100%; max-height: 520px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 10px; display: block; cursor: zoom-in; }
.photo-ph { height: 260px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 10px; background: #f6f6f9; }
.item-sku.big { font-size: 15px; }
.product-name { font-size: 24px; margin: 4px 0 6px; }
.product-price { font-size: 22px; font-weight: 700; margin: 8px 0; }
.product-add { display: flex; gap: 10px; align-items: end; margin: 12px 0 8px; }
.product-add label { display: flex; flex-direction: column; gap: 4px; }
.product-add input[type=number] { width: 110px; }
.details-text { line-height: 1.55; }
@media (max-width: 720px) {
  .product { grid-template-columns: 1fr; gap: 16px; }
  .product-add { flex-direction: row !important; align-items: end !important; }
}
