:root {
  --bar: #23272e; --bar2: #2e3239; --accent: #f5a623; --link: #2563c9;
  --bg: #f4f5f7; --card: #fff; --line: #e3e6ea; --text: #1d2229; --muted: #6b7280;
  --green: #2e9e4f; --red: #d6291f; --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; margin: 0; font-weight: 700; }
h2.subject { font-size: 19px; margin: 4px 0 16px; font-weight: 600; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: #4b5563; margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.right { text-align: right; } .spacer { flex: 1; } .prewrap { white-space: pre-wrap; margin: 0; }
.inline { display: inline; margin: 0; }

/* top bar + tabs */
.topbar { background: var(--bar); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 24px; }
.brand { color: #fff; font-weight: 700; letter-spacing: .04em; font-size: 20px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.gsearch { flex: 0 1 460px; margin: 0; }
.gsearch input { width: 100%; padding: 9px 12px; border-radius: 6px; border: 1px solid #555c66;
  background: #2f343b; color: #fff; font-size: 14px; }
.gsearch input::placeholder { color: #9aa1ab; }
.btn-plus { background: #3a3f47; color: #fff; border: 1px solid #555c66; }
.who { color: #cfd4da; font-size: 14px; }
.linkbtn { background: none; border: 0; color: #cfd4da; cursor: pointer; font-size: 14px; padding: 0; }
.linkbtn:hover { color: #fff; text-decoration: underline; }
.tabs { background: var(--bar2); display: flex; gap: 2px; padding: 0 24px; overflow-x: auto; }
.tabs a { color: #cfd4da; padding: 14px 20px; display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 15px; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a .ico { font-size: 22px; line-height: 1; }
.tabs a:hover { background: #383d45; text-decoration: none; color: #fff; }
.tabs a.active { color: var(--accent); background: var(--bar); border-bottom-color: var(--accent); }

.container { max-width: 1320px; margin: 0 auto; padding: 24px; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.msg { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; background: #e0f0ff; color: #0a4a85; border: 1px solid #b9dcfb; }
.msg-success { background: #e4f6ea; color: #14602d; border-color: #b6e3c4; }
.msg-error { background: #fde8e6; color: #8a1c14; border-color: #f4bbb6; }
.notice { background: #fff8e6; border: 1px solid #f3dd9b; padding: 8px 12px; border-radius: 6px; }

/* page header */
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.inline-search { display: flex; gap: 6px; margin: 0; }
.inline-search input { width: 300px; max-width: 60vw; }

/* buttons + inputs */
.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid #c8cdd3; background: #fff;
  color: var(--text); cursor: pointer; font-size: 14px; line-height: 1.2; }
.btn:hover { background: #f1f3f5; text-decoration: none; }
.btn-primary { background: var(--link); border-color: var(--link); color: #fff; }
.btn-primary:hover { background: #1d4fa3; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #247f3f; }
.btn-small { padding: 4px 10px; font-size: 13px; }
.wide { width: 100%; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c8cdd3; border-radius: 6px; font: inherit; background: #fff; color: var(--text); }
textarea { resize: vertical; }
.inline-search input, .filters select { width: auto; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: #374151; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filters label { margin: 0; }

/* cards + tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.card.pad, .pad { padding: 16px 18px; }
.narrow { max-width: 720px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: #f0f2f4; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; }
.count { padding: 10px 18px; font-size: 12px; font-weight: 700; color: #4b5563; letter-spacing: .05em; text-align: right; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 13px; padding: 10px 14px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.grid th a { color: var(--link); }
table.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tbody tr:nth-child(even) { background: #fafbfc; }
table.grid tbody tr:hover { background: #f1f6fd; }
td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }
.pill { display: inline-block; padding: 3px 10px; border: 1px solid #c8cdd3; border-radius: 5px; background: #fff; font-size: 13px; white-space: nowrap; }
.pill-done { background: #e4f6ea; border-color: #b6e3c4; color: #14602d; }
.pill-red { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.pill-plain { background: #f3f4f6; }
.pager { display: flex; gap: 16px; justify-content: center; padding: 14px; }

/* two-column layouts (flexbox so it works in every browser) */
.cols { display: flex; gap: 20px; align-items: flex-start; }
.col-main { flex: 1 1 0; min-width: 0; }
.col-side { flex: 0 0 340px; width: 340px; }
.facts { margin: 0; }
.facts dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-top: 10px; }
.facts dt:first-child { margin-top: 0; } .facts dd { margin: 2px 0 0; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 4px 0; }
.stack > * + * { margin-top: 12px; }
.actions { display: flex; gap: 8px; }
.field .err, .err { color: var(--red); font-size: 13px; margin-top: 4px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.errorlist { color: var(--red); list-style: none; padding: 0; margin: 0 0 8px; }

/* stat tiles (customer page) */
.stats { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.stat { flex: 1 1 210px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .value small { font-size: 13px; font-weight: 400; color: var(--muted); }
.stat .value.owed { color: var(--red); }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 18px 0 0; }
.timeline li { border-left: 3px solid var(--line); padding: 6px 0 14px 14px; margin-left: 4px; }
.timeline li.private { border-left-color: var(--accent); background: #fffaf0; }
.timeline .meta { color: var(--muted); font-size: 13px; margin-bottom: 3px; }

/* customer picker */
.cust-results { list-style: none; margin: 6px 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; max-height: 260px; overflow: auto; }
.cust-results:empty { display: none; }
.cust-results li { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cust-results li:last-child { border-bottom: 0; }
.cust-picked { margin-bottom: 4px; }

/* login */
.login-card { max-width: 380px; margin: 60px auto; padding: 28px; }
.login-card h1 { font-size: 24px; } .login-card label { margin-top: 14px; } .login-card button { margin-top: 20px; }

@media (max-width: 900px) {
  .cols { flex-direction: column; }
  .col-side, .col-main { width: 100%; flex: none; }
  .container { padding: 14px; } .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .gsearch { flex-basis: 100%; order: 5; } h1 { font-size: 22px; }
}

/* spacing touches */
.page-head .btn + .btn { margin-left: 8px; }
.who { margin-left: 8px; margin-right: 8px; }
.topbar .gsearch, .topbar .btn-plus { margin-left: 4px; }

/* dashboard */
.welcome { margin-bottom: 18px; }
.dash-top { display: flex; align-items: flex-start; margin-bottom: 18px; }
.dash-top > .card { margin-bottom: 0; }
.dash-top > .get-started { margin-right: 20px; }
.dash-top > .get-started { flex: 0 0 380px; }
.dash-top > section.card:last-child { flex: 1 1 0; min-width: 0; }
.get-started h2, .summary h2, .center { font-size: 22px; margin: 0 0 14px; }
.center { text-align: center; }
.get-started h2 { text-align: center; }
.summary h2 small { font-size: 14px; font-weight: 400; color: var(--muted); }
.big-btn { display: flex; align-items: stretch; margin-bottom: 12px; text-decoration: none !important; }
.big-btn .ico { width: 56px; display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: #f5f6f8; border: 1px solid var(--line); border-right: 0; border-radius: 6px 0 0 6px; }
.big-btn .lbl { flex: 1; background: #5fae6a; color: #fff; font-size: 20px; padding: 14px 18px; border-radius: 0 6px 6px 0; }
.big-btn:hover .lbl { background: #4f9b5a; }
.summary-cols { display: flex; flex-wrap: wrap; }
.summary-cols > div { margin: 0 44px 12px 0; }
.summary-cols h4, .chart h4 { margin: 0 0 6px; font-size: 15px; color: #374151; }
.summary-cols p { margin: 0; line-height: 1.9; }
.charts { display: flex; flex-wrap: wrap; justify-content: space-between; }
.chart { flex: 1 1 250px; min-width: 230px; margin: 0 14px 24px; text-align: center; }
.donut { display: block; margin: 6px auto 0; }
.legend { list-style: none; padding: 0; margin: 12px 0 0; text-align: left; display: inline-block; font-size: 13px; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.bars { display: flex; align-items: flex-end; height: 156px; margin-top: 6px; padding-bottom: 0; border-bottom: 1px solid var(--line); }
.bar-col { flex: 1 1 0; min-width: 0; margin: 0 1.5px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar { width: 100%; background: #5b3fa8; border-radius: 3px 3px 0 0; }
.bar-col span { position: relative; top: 17px; height: 0; font-size: 10px; color: var(--muted); line-height: 14px; white-space: nowrap; }
.chart .bars { margin-bottom: 30px; }
.overdue { color: var(--red); font-weight: 600; }
.right-link { float: right; text-transform: none; letter-spacing: 0; }
.linkbtn.dark { color: var(--link); font-size: 13px; }
@media (max-width: 900px) { .dash-top { flex-direction: column; } .dash-top > .get-started { flex: none; width: 100%; } }

/* sales documents, POS, inventory */
.cols.two-even > section { flex: 1 1 0; min-width: 0; margin-bottom: 18px; }
.cols.two-even .card + .card { margin-top: 0; }
.pos-cols .col-side { flex-basis: 380px; width: 380px; }
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-title h3 { margin: 0; }
.change-cust summary { cursor: pointer; display: inline-block; list-style: none; }
.change-cust[open] { position: relative; }
.change-cust form { margin-top: 10px; min-width: 300px; }
.banner { text-align: center; font-weight: 700; letter-spacing: .06em; padding: 10px; border-radius: 6px; color: #fff; margin-bottom: 12px; }
.banner.left { text-align: left; letter-spacing: 0; font-weight: 600; margin: 10px 0; }
.banner-paid { background: #2e8b2e; } .banner-unpaid { background: #e08e0b; } .banner-overdue { background: var(--red); } .banner-void { background: #6b7280; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; margin-left: 10px; }
.grid-form { display: flex; flex-wrap: wrap; margin: 0 -6px; }
.grid-form .field { flex: 1 1 210px; margin: 0 6px 10px; } .grid-form .field.full { flex-basis: 100%; }
.stack.tight > * + * { margin-top: 6px; }
.inline-facts { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-wrap: wrap; }
.inline-facts dt, .inline-facts dd { margin: 0 6px 0 0; } .inline-facts dd { margin-right: 22px; }
.mt { margin-top: 16px; } .pad { padding: 16px 18px; }
table.lines input[type=text] { min-width: 220px; } .num-in { width: 84px; text-align: right; }
.totals-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 18px 18px; }
table.totals { width: 300px; } table.totals td { padding: 4px 8px; } table.totals tr.grand td { border-top: 1px solid #333; font-weight: 700; font-size: 16px; }
table.totals.big { width: 100%; } table.totals.big tr.grand td { font-size: 22px; }
.add-item { border-top: 1px solid var(--line); padding: 14px 18px 18px; background: #fafbfc; }
.small-table td, .small-table th { padding: 6px 10px; }
.custom-item { margin-top: 12px; } .custom-item summary { cursor: pointer; color: var(--link); }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.inline-form input[type=text] { width: 260px; } .right-form { justify-content: flex-end; margin: 0; }
.terms { font-size: 13px; color: #374151; }
.sig-canvas { border: 1px solid #c8cdd3; border-radius: 6px; background: #fff; width: 100%; max-width: 520px; height: auto; touch-action: none; cursor: crosshair; }
.sig-img { max-width: 320px; border-bottom: 1px solid #333; }
.stat-bar { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.stat-cell { flex: 1; display: flex; align-items: center; justify-content: space-around; padding: 16px 10px; border-right: 1px solid var(--line); text-decoration: none !important; color: var(--text); }
.stat-cell:last-child { border-right: 0; } .stat-cell .big { font-size: 28px; font-weight: 700; }
.tag { padding: 8px 12px; border-radius: 5px; font-size: 13px; color: #fff; font-weight: 600; }
.tag-amber { background: #e9a23b; } .tag-red { background: #cf4c3f; } .tag-green { background: #4caf50; }
.tick { color: #2e8b2e; font-size: 17px; }
.cat-tabs { display: flex; flex-wrap: wrap; padding: 12px 14px 0; border-bottom: 2px solid var(--line); }
.cat-tabs a { padding: 8px 14px; color: #374151; border-radius: 5px 5px 0 0; }
.cat-tabs a.active { background: #8a8d91; color: #fff; text-decoration: none; }
.filters .grow { flex: 1 1 260px; } .filters .grow input { width: 100%; }
.stock { display: inline-block; min-width: 30px; text-align: center; padding: 2px 8px; border-radius: 4px; color: #fff; font-weight: 700; }
.stock-ok { background: #2e8b2e; } .stock-low { background: #e08e0b; } .stock-zero { background: #8a8d91; }
.disabled-row { opacity: .55; }
.denoms { display: flex; flex-wrap: wrap; } .denom { display: flex; align-items: center; justify-content: space-between; width: 260px; margin: 0 16px 10px 0; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.denom .dv { font-weight: 700; } .denom input { width: 90px; text-align: right; }
.stat-value { font-size: 34px; font-weight: 700; }
.zreport h2 { margin-top: 0; } .small-table.grid td { border-bottom: 1px solid var(--line); }
.wide-search input { width: 100%; max-width: none; flex: 1; } .wide-search { margin: 0; }
@media (max-width: 900px) { .pos-cols .col-side { width: 100%; flex-basis: auto; } .stat-bar { flex-direction: column; } .stat-cell { border-right: 0; border-bottom: 1px solid var(--line); } }
@media print { .topbar, .tabs, .page-head .btn, .messages { display: none !important; } }

/* form-control fixes */
input[type=date], input[type=datetime-local] { width: 100%; padding: 8px 10px; border: 1px solid #c8cdd3; border-radius: 6px; font: inherit; background: #fff; color: var(--text); }
input, select, textarea { font-weight: 400; }
input.num-in { width: 84px; text-align: right; }
.inline-form select, .inline-search select { width: auto; }
.filters .check { color: var(--text); font-size: 14px; margin-right: 6px; }
.filters .check input { margin-right: 4px; }
