:root {
  --primary: #0f766e; --primary-dark: #0b5953; --primary-tint: #e6f4f2;
  --ink: #16212b; --muted: #637381; --line: #e3e8ec; --bg: #f5f7f9; --card: #fff;
  --amber: #b45309; --amber-tint: #fef3e2; --red: #b42318; --red-tint: #fdecea;
  --green: #17803d; --green-tint: #e5f5ea; --violet: #6d28d9; --violet-tint: #f1ebfd;
  --radius: 14px;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); padding-bottom: 76px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
h2.sub { margin: 22px 0 8px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
h3 { margin: 0; }
code { background: #eef2f5; padding: 1px 6px; border-radius: 6px; font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .block { display: block; }
.warn { color: var(--amber); } .err { color: var(--red); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.logo { color: var(--ink); display: flex; align-items: baseline; gap: 8px; text-decoration: none !important; }
.logo b { font-size: 21px; color: var(--primary); letter-spacing: -.02em; }
.logo span { color: var(--muted); font-size: 13px; }
.topnav { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a, .linklike { color: var(--ink); font-weight: 600; font-size: 14px; background: none; border: 0; padding: 4px 0; cursor: pointer; font-family: inherit; }
.linklike.danger { color: var(--red); font-weight: 500; font-size: 13px; }
form.inline { display: inline; }
.pill { font-style: normal; display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--primary);
  color: #fff; font-size: 11.5px; line-height: 19px; text-align: center; font-weight: 700; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 8px; }
.narrow { max-width: 520px; margin: 18px auto; background: var(--card); padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px; font-weight: 700; color: var(--primary); margin: 0 0 2px; }

.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 14px var(--font); cursor: pointer; text-decoration: none !important; }
.btn:hover { border-color: #c5ced6; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--red); border-color: #f0c5c0; }
.btn.block { width: 100%; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .pill { background: #fff; color: var(--primary); }

.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
input, select, textarea { font: 15px var(--font); color: var(--ink); background: #fff; border: 1px solid #cfd8df; border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.searchbar input { flex: 1; } .searchbar .btn { flex-shrink: 0; }
input[type=checkbox], input[type=radio] { width: auto; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: thin; }
.tab { flex: 0 0 auto; padding: 8px 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--ink);
  font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none !important; }
.tab .pill { background: #cfd8df; color: #26323c; }
.tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab.on .pill { background: #fff; color: var(--primary); }
.tab.special { border-color: #d9c8f7; color: var(--violet); background: var(--violet-tint); }
.tab.special.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.filters { display: flex; gap: 8px; align-items: center; margin: 2px 0 12px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 150px; padding: 8px 10px; }
.count { margin-left: auto; font-size: 13px; }
.note-bar { background: var(--primary-tint); color: var(--primary-dark); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin: 0 0 14px; }
.note-bar.special { background: var(--violet-tint); color: #4c1d95; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card.is-out { opacity: .82; }
.pic { height: 118px; position: relative; display: grid; place-items: center; background: linear-gradient(135deg, #dff1ee, #c7e6e1); }
.pic .initials { font-size: 38px; font-weight: 800; color: rgba(15,118,110,.55); letter-spacing: -.03em; }
.pic .formtag { position: absolute; left: 10px; bottom: 8px; font-style: normal; font-size: 11px; font-weight: 700; background: rgba(255,255,255,.85); padding: 2px 8px; border-radius: 99px; color: #334; }
.form-syrup, .form-dry-syrup { background: linear-gradient(135deg, #fde8d3, #f9d3b0); } .form-syrup .initials, .form-dry-syrup .initials { color: rgba(180,83,9,.5); }
.form-injection, .form-infusion { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); } .form-injection .initials, .form-infusion .initials { color: rgba(67,56,202,.5); }
.form-drops, .form-lotion { background: linear-gradient(135deg, #d9f0fb, #b5e0f5); } .form-drops .initials, .form-lotion .initials { color: rgba(3,105,161,.5); }
.form-capsule, .form-softgel { background: linear-gradient(135deg, #fce7f3, #f8cfe5); } .form-capsule .initials, .form-softgel .initials { color: rgba(190,24,93,.45); }
.ribbon { position: absolute; top: 10px; right: 10px; font-size: 11px; padding: 3px 9px; border-radius: 99px; color: #fff; }
.ribbon.new { background: var(--green); } .ribbon.offer { background: var(--violet); }
.ribbon.new + .ribbon.offer { top: 34px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.div-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--primary); }
.name { font-size: 16.5px; line-height: 1.25; }
.comp { margin: 0; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: #3c4954; }
.meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rate { background: var(--primary-tint); border-radius: 8px; padding: 6px 9px; font-size: 14px; }
.stock { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; align-self: flex-start; }
.stock.in { background: var(--green-tint); color: var(--green); }
.stock.low { background: var(--amber-tint); color: var(--amber); }
.stock.out { background: var(--red-tint); color: var(--red); }
.exp.fresh { color: var(--green); }
.scheme { font-size: 13px; background: var(--amber-tint); border-radius: 8px; padding: 6px 9px; }
.scheme small { display: block; color: #7a5a2e; font-size: 11.5px; }
.scheme.special { background: var(--violet-tint); } .scheme.special small { color: #5b3aa5; }
.add-form { display: flex; gap: 8px; align-items: flex-end; margin-top: auto; padding-top: 8px; }
.qty { display: flex; flex-direction: column; gap: 2px; width: 92px; font-size: 12px; color: var(--muted); font-weight: 600; }
.qty small { font-weight: 400; } .qty input { padding: 8px 10px; }
.add-form .btn { flex: 1; padding: 10px 8px; }
.in-cart { color: var(--primary); font-weight: 600; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 22px 0 6px; }
.empty { background: var(--card); border: 1px dashed #cfd8df; border-radius: var(--radius); padding: 30px 16px; text-align: center; color: var(--muted); }

.flashes { margin-bottom: 12px; display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 10px; font-size: 14px; background: var(--green-tint); color: #14532d; }
.flash.warning { background: var(--amber-tint); color: #7c2d12; }
.flash.error { background: var(--red-tint); color: #7f1d1d; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 50; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #17222c; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 22px rgba(0,0,0,.25); animation: pop .2s ease-out; }
.toast.warning { background: #92400e; } .toast.error { background: #991b1b; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.form { display: grid; gap: 12px; margin: 14px 0; }
.field { display: grid; gap: 4px; } .field label { font-weight: 600; font-size: 13.5px; }
.field.check { display: flex; gap: 8px; align-items: flex-start; } .field.check label { font-weight: 400; }
.errorlist { color: var(--red); list-style: none; padding: 0; margin: 0; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 12px; }
.demo-box, .demo-hint { background: #fff8e1; border: 1px solid #f3e0a0; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.demo-hint { margin-top: 18px; }
.big-icon { font-size: 44px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .two-col .panel { margin: 0; }
dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0 0 12px; } dt { color: var(--muted); } dd { margin: 0; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--violet-tint); color: var(--violet); margin-left: 6px; font-weight: 600; }
.tag.err { background: var(--red-tint); color: var(--red); } .tag.ok { background: var(--green-tint); color: var(--green); }
.status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; background: #e8edf1; color: #33414d; }
.status.received, .status.pending { background: var(--amber-tint); color: var(--amber); }
.status.accepted, .status.billed { background: var(--primary-tint); color: var(--primary-dark); }
.status.dispatched, .status.approved { background: var(--green-tint); color: var(--green); }
.status.rejected, .status.cancelled, .status.blocked { background: var(--red-tint); color: var(--red); }
.order-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; color: var(--ink); text-decoration: none !important; }
.order-row:hover { border-color: #b8c4cd; }

.stepper { list-style: none; display: flex; padding: 0; margin: 4px 0 18px; }
.stepper li { flex: 1; text-align: center; font-size: 12.5px; color: var(--muted); position: relative; }
.stepper li::before { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; margin: 0 auto 6px; background: #dde4ea; position: relative; z-index: 1; }
.stepper li::after { content: ""; position: absolute; top: 8px; left: -50%; width: 100%; height: 3px; background: #dde4ea; }
.stepper li:first-child::after { display: none; }
.stepper li.done { color: var(--primary-dark); font-weight: 700; } .stepper li.done::before, .stepper li.done::after { background: var(--primary); }
table.lines, table.totals { width: 100%; border-collapse: collapse; }
table.lines th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 4px; }
table.lines td { padding: 9px 4px; border-bottom: 1px solid #eef1f4; }
.num { text-align: right !important; } tr.ns td { opacity: .55; text-decoration: line-through; }
tr.grand td { font-weight: 800; border-top: 2px solid var(--line); } table.totals td { padding: 5px 0; } table.totals td:last-child { text-align: right; }

.cart-line { display: flex; gap: 14px; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.cl-main { flex: 1 1 260px; } .cl-main .comp { -webkit-line-clamp: 2; margin: 3px 0 4px; }
.cl-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.switch { display: flex; gap: 8px; align-items: center; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--ink); text-decoration: none !important; display: grid; gap: 2px; }
.tile b { font-size: 30px; line-height: 1; } .tile span { color: var(--muted); font-size: 13px; }
.tile.hot { border-color: #f0b44c; background: var(--amber-tint); }
.linklist { padding-left: 18px; margin: 0; } .linklist li { margin: 8px 0; }
.choice { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; cursor: pointer; }
.choice span { flex: 1; font-size: 14px; } .score { font-style: normal; font-weight: 700; color: var(--primary); }

.bottomnav { display: none; }
@media (max-width: 720px) {
  h1 { font-size: 22px; }
  .two-col { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pic { height: 92px; } .pic .initials { font-size: 30px; }
  .card-body { padding: 10px; } .name { font-size: 15px; }
  .add-form { flex-direction: column; align-items: stretch; } .qty { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  .qty input { width: 80px; }
  .bottomnav { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); }
  .bottomnav a { text-align: center; padding: 13px 4px; color: var(--muted); font-weight: 700; font-size: 13.5px; text-decoration: none !important; }
  .bottomnav a.on { color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
  body:has(.bottomnav) .topnav a { display: none; }
}
@media (max-width: 460px) { .grid { grid-template-columns: 1fr; } .pic { height: 100px; } }

.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pic .formtag, .pic .ribbon { z-index: 1; }
a.visual { font-size: 12.5px; font-weight: 600; color: var(--primary); }

/* list view and paste order */
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.viewtoggle { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.viewtoggle a { padding: 7px 14px; font-weight: 700; font-size: 13.5px; color: var(--muted); text-decoration: none !important; background: var(--card); }
.viewtoggle a.on { background: var(--primary); color: #fff; }
.listwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.plist { width: 100%; border-collapse: collapse; }
.plist th { text-align: left; font-size: 12.5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.plist td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.plist tr.is-out { opacity: .65; }
.plist .pname small { display: block; }
.plist .qcol { width: 110px; white-space: nowrap; }
.plist .qcol input { width: 80px; }
.plist small.tag { display: inline-block; margin-top: 3px; }
.sticky-act { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 12px 0; background: var(--bg, #fff); border-top: 1px solid var(--line); margin-top: 10px; z-index: 5; }
.wide { max-width: 860px; margin-left: auto; margin-right: auto; }
.example { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; }
.form textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.paste-row { display: grid; grid-template-columns: 1fr 1.4fr 120px; gap: 10px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--card); }
.paste-row.check { border-color: #f0b44c; background: var(--amber-tint); }
.paste-row .qty { display: flex; gap: 6px; align-items: center; }
.paste-row .qty input { width: 80px; }
.tag.warn { background: #fde7c0; color: #8a5a00; }
@media (max-width: 720px) { .paste-row { grid-template-columns: 1fr; } .viewtoggle { margin-left: 0; } }
