:root { --accent: #0f6e6e; --ink: #1c2328; --muted: #6b757c; --line: #e3e7ea; --bg: #f6f7f8; --bad: #b42318; --warn: #a15c00; --good: #1e7a3c; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
.hidden { display: none !important; }
button { font: inherit; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
button.link { background: none; color: var(--accent); padding: 0; }
input, select, textarea { font: inherit; width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; margin: 0 0 12px; color: var(--muted); font-size: 12px; }
label input, label select, label textarea { margin-top: 4px; color: var(--ink); font-size: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.error { color: var(--bad); min-height: 1em; }
.login { min-height: 100vh; display: grid; place-items: center; }
.login form { width: 340px; }
.login h1 { margin: 0 0 16px; font-size: 20px; }
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
aside { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 16px; border-bottom: 3px solid var(--accent); }
.brand strong { display: block; font-size: 16px; }
.brand span { color: var(--muted); font-size: 12px; }
nav { flex: 1; overflow: auto; padding: 8px 0; }
nav a { display: block; padding: 7px 16px; color: var(--ink); text-decoration: none; }
nav a.active, nav a:hover { background: var(--bg); color: var(--accent); font-weight: 600; }
.me { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
main { padding: 22px 28px; min-width: 0; }
h2 { margin: 0 0 4px; font-size: 20px; }
.help { color: var(--muted); margin: 0 0 14px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 12px 0; }
.toolbar input { max-width: 320px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 26px; font-weight: 650; margin-top: 4px; }
.bar { height: 8px; background: var(--line); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }
.tablewrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
th { position: sticky; top: 0; background: #fafbfb; font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f3f8f8; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--bg); }
.pill.due { background: #fdecea; color: var(--bad); }
.pill.low { background: #fdecea; color: var(--bad); }
.pill.watch { background: #fff4e5; color: var(--warn); }
.pill.ok { background: #e9f6ee; color: var(--good); }
.drawer { position: fixed; inset: 0; background: rgba(20, 25, 30, .35); display: flex; justify-content: flex-end; z-index: 10; }
.drawer-body { width: min(560px, 100%); background: #fff; height: 100%; overflow: auto; padding: 22px; }
.drawer-body h3 { margin: 0 0 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.calc { background: var(--bg); padding: 7px 9px; border-radius: 6px; margin-top: 4px; color: var(--ink); font-size: 14px; min-height: 34px; }
.actions { display: flex; gap: 8px; margin-top: 10px; position: sticky; bottom: -22px; background: #fff; padding: 12px 0; }
.actions .spacer { flex: 1; }
.sub { margin-top: 22px; }
.sub h4 { margin: 0 0 8px; }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  aside { position: static; height: auto; min-width: 0; }
  nav { display: flex; flex: none; overflow-x: auto; padding: 0; }
  nav a { white-space: nowrap; }
  main { padding: 14px; }
  .row2 { grid-template-columns: 1fr; }
}
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--ink); }
label.inline input { width: auto; margin: 0; }
table.sheet input, table.sheet select { width: 130px; padding: 4px 6px; }
table.sheet tbody tr { cursor: default; }
.statement { margin-bottom: 16px; }
.statement h3 { margin-top: 0; }
.card a { color: var(--accent); }
.banner { background: #fff8e6; border-color: #f0d48a; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 0 0 12px; }
.filters label.inline { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; color: var(--muted); }
.filters select { width: auto; min-width: 170px; }
.filters button.link, button.link { background: none; border: 0; color: var(--accent); padding: 6px 4px; cursor: pointer; }
.toolbar .count { margin: 0 0 0 auto; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
.breakdown { margin: 0 0 16px; }
.breakdown table td { border-bottom: 1px solid var(--line); max-width: none; }
.breakdown tr.total td { font-weight: 650; border-bottom: 0; border-top: 2px solid var(--ink); }
.breakdown tbody tr { cursor: default; }
input.narrow { width: 80px; }
main > .card + .card { margin-top: 16px; }
.card h4 { margin: 14px 0 8px; }
table.sheet td input[type=text] { width: 160px; }
/* List pages: the table scrolls inside its frame so the header (and totals line) stay frozen. */
.tablewrap.listwrap { max-height: calc(100vh - 230px); }
.listwrap thead { position: sticky; top: 0; z-index: 2; }
.listwrap thead th { position: static; }
.listwrap thead tr.totals th { background: #eef5f5; color: var(--ink); font-size: 13px; font-weight: 650; border-bottom: 2px solid var(--line); }
tr.group td { font-weight: 500; }
tr.detail { cursor: default; background: #fafbfb; }
tr.detail > td { padding: 4px 10px 12px 28px; max-width: none; }
table.subsizes { width: auto; min-width: 70%; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
table.subsizes th { position: static; }
.toolbar label.inline { display: flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 13px; }
.toolbar label.inline input { width: auto; }
.toolbar select { width: auto; }
.navhead { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 16px 4px; }
.subhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
button.small { padding: 4px 10px; font-size: 13px; }
@media (max-width: 760px) { .navhead { display: none; } }
.docs .docrow { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line); }
.docs .docrow a { color: var(--accent); }
.uploadrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.uploadrow select, .uploadrow input[type=text], .uploadrow input[type=date] { width: auto; }
.uploadrow input[type=file] { width: auto; border: 0; padding: 0; }
.drawer-body .card { margin-bottom: 14px; }
/* Dashboard */
a.card.stat.link { text-decoration: none; color: inherit; display: block; }
a.card.stat.link:hover { border-color: var(--accent); }
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.dgrid .dsec { margin: 0 !important; min-width: 0; }
.dgrid .dsec h3 { margin: 0 0 10px; font-size: 15px; }
ul.todo { margin: 0; padding-left: 18px; }
ul.todo li { padding: 4px 0; }
ul.todo a { color: var(--ink); }
ul.todo a:hover { color: var(--accent); }
/* Catalogs & info cards */
.printable { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.cat-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px solid var(--accent); padding-bottom: 10px; margin-bottom: 14px; }
.cat-brand { font-size: 22px; font-weight: 700; color: var(--accent); }
.cat-title { font-size: 18px; font-weight: 650; text-align: right; }
.cat-cat { margin: 18px 0 6px; color: var(--accent); }
table.cat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.cat-table th { position: static; background: #f2f6f6; }
table.cat-table td.wrap, .cat-table td { white-space: normal; max-width: none; }
.cat-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.infocard { padding: 4px 0 24px; }
.infocard + .infocard { border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 18px; }
.infocard h2 { margin: 6px 0 2px; }
.ic-sec h4 { margin: 14px 0 4px; color: var(--accent); }
.ic-sec p { margin: 0; white-space: pre-line; }
@media print {
  aside, .noprint, .drawer { display: none !important; }
  main { padding: 0 !important; }
  body { background: #fff; }
  .printable { border: 0; padding: 0; }
  .infocard { break-after: page; border: 0 !important; margin: 0 !important; }
  .infocard:last-child { break-after: auto; }
}
.todosec h3 .pill { font-size: 12px; vertical-align: middle; }
a.button-link { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); text-decoration: none; }
.drawer-body textarea { width: 100%; font-family: inherit; }
@media print { .todosec { break-inside: avoid; } }
/* Missing product info to-do list: stacked items that wrap (readable on a phone), chips that jump to each step */
.intro { font-size: 15px; margin: 4px 0 12px; max-width: 760px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
button.chip { background: #fff4e5; color: var(--warn); border: 1px solid #f3d9b1; border-radius: 16px; padding: 5px 12px; font-size: 13px; }
button.chip.done { background: #e9f6ee; color: var(--good); border-color: #c8e8d3; }
.todosec { margin-bottom: 14px; }
.todosec h3 { margin-top: 0; }
.todolist { display: flex; flex-direction: column; gap: 8px; }
.todoitem { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; background: #fff; }
.todoitem:hover, .todoitem:focus { background: #f3f8f8; border-color: var(--accent); outline: none; }
.todoitem .tbody { flex: 1; min-width: 0; }
.todoitem .t { font-weight: 600; overflow-wrap: anywhere; }
.todoitem .s { color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.todoitem .go { color: var(--accent); font-weight: 600; white-space: nowrap; font-size: 13px; }
.hint { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.banner .grow { flex: 1; min-width: 200px; }
@media (max-width: 760px) { .todoitem { flex-wrap: wrap; } .todoitem .go { margin-left: auto; } }
@media print { .todoitem { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 6px 0; } }
a.card.banner.link { text-decoration: none; color: var(--ink); font-size: 15px; }
a.card.banner.link:hover { border-color: var(--warn); }
.banner .go { color: var(--accent); font-weight: 600; white-space: nowrap; }
/* List tabs (e.g. Leads: Inbound | Outbound | All) */
.tabs { display: flex; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
button.tab { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 6px 16px; }
button.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Wholesale price list: retired tiers stay visible inside a product, greyed out */
.pill.retired { background: #eef0f2; color: var(--muted); }
table.subsizes tr.retired td { color: var(--muted); }
.subwrap { overflow-x: auto; }
p.sublink { margin: 8px 0 0; }
tr.group:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 760px) { tr.detail > td { padding-left: 10px; } table.subsizes { min-width: 100%; } }
p.sublink a { color: var(--accent); }
/* Wholesale price list on a phone: one card per product, tiers listed inside when opened */
.wcards { display: flex; flex-direction: column; gap: 8px; }
.wcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.wcard.open { border-color: var(--accent); }
.wcard .whead, .wcard .wtier { padding: 10px 12px; cursor: pointer; }
.wcard .wtier { border-top: 1px solid var(--line); background: #fafbfb; }
.wcard .wtier.retired { color: var(--muted); }
.wcard .t { font-weight: 600; overflow-wrap: anywhere; }
.wcard .wtier .t { font-weight: 500; }
.wcard .s { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.wcard p.sublink { padding: 8px 12px 10px; margin: 0; border-top: 1px solid var(--line); }
.wcard .s.strong { color: var(--ink); }
td.nowrap input { width: 80px; }
/* Wholesale pricing tier editor: narrower boxes so the whole row (incl. Remove) fits */
table.sheet input[type=number] { width: 92px; }
table.sheet input[type=text] { width: 150px; }
pre.card { white-space: pre-wrap; font-size: 13px; }
pre.card:empty { display: none; }

/* ---------- Top bar (Portal.topMenu): groups with drop-downs; one Menu button on a phone ---------- */
.app.topbar { display: block; }
.app.topbar aside { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 4px; border-right: 0; border-bottom: 3px solid var(--accent); padding: 0 12px; }
.app.topbar .brand { padding: 8px 12px 8px 0; border-bottom: 0; white-space: nowrap; }
.app.topbar .brand span { display: none; }
.app.topbar nav { display: flex; flex: 1; overflow: visible; padding: 0; gap: 2px; align-items: stretch; }
.app.topbar .menugroup { position: relative; }
.app.topbar .menugroup > a, .app.topbar .menubtn { display: block; padding: 14px 12px; background: none; color: var(--ink); border-radius: 0; font-weight: 500; white-space: nowrap; text-decoration: none; }
.app.topbar .menubtn::after { content: ' \25BE'; color: var(--muted); font-size: 11px; }
.app.topbar .menugroup.active > a, .app.topbar .menugroup.active > .menubtn { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.app.topbar .menugroup > a:hover, .app.topbar .menubtn:hover, .app.topbar .menugroup.open > .menubtn { background: var(--bg); color: var(--accent); }
.app.topbar .dropdown { display: none; position: absolute; left: 0; top: 100%; min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 0 0 8px 8px; box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 6px 0; }
.app.topbar .menugroup.open .dropdown { display: block; }
.app.topbar .dropdown a { padding: 8px 16px; white-space: nowrap; }
.app.topbar .me { border-top: 0; padding: 0 0 0 12px; white-space: nowrap; align-items: center; }
.app.topbar main { max-width: 1400px; margin: 0 auto; }
.menutoggle { display: none; }
@media (max-width: 900px) {
  .app.topbar aside { flex-wrap: wrap; padding: 0 10px; }
  .app.topbar .brand { flex: 1; padding: 10px 0; }
  .app.topbar .menutoggle { display: block; padding: 6px 12px; }
  .app.topbar nav, .app.topbar .me { display: none; }
  .app.topbar aside.menuopen nav { display: flex; flex-direction: column; flex-basis: 100%; max-height: calc(100vh - 60px); overflow-y: auto; padding-bottom: 8px; }
  .app.topbar aside.menuopen .me { display: flex; flex-basis: 100%; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
  .app.topbar .menugroup > a, .app.topbar .menubtn { width: 100%; text-align: left; padding: 11px 6px; }
  .app.topbar .menugroup.active > a, .app.topbar .menugroup.active > .menubtn { box-shadow: inset 3px 0 0 var(--accent); }
  .app.topbar .dropdown { position: static; box-shadow: none; border: 0; border-radius: 0; padding: 0 0 6px 14px; min-width: 0; }
  .app.topbar .dropdown a { white-space: normal; }
}
@media print { .app.topbar aside { display: none !important; } }
.reportgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.reportgrid h3 { margin: 0 0 8px; font-size: 15px; }
a.reportlink { display: block; padding: 9px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
a.reportlink strong { display: block; color: var(--accent); }
a.reportlink:hover strong { text-decoration: underline; }

/* ---------- Lookup lists ---------- */
.lookups { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.listpicker { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 0; }
.listpicker a { display: flex; justify-content: space-between; padding: 7px 14px; color: var(--ink); text-decoration: none; }
.listpicker a.active, .listpicker a:hover { background: var(--bg); color: var(--accent); font-weight: 600; }
.listpicker-phone { display: none; }
.lookups h3 { margin: 0 0 6px; }
.lookups tr.inactive td { color: var(--muted); }
.lookups td .pill { margin-left: 8px; }
.rowactions { white-space: nowrap; text-align: right; }
.rowactions button { margin-left: 4px; }
.rowactions button:disabled { opacity: .35; cursor: default; }
.lookups form.toolbar { margin-top: 14px; }
.lookuplinks { display: flex; gap: 14px; margin-top: 4px; font-size: 12px; }
.lookuplinks a, .lookuplinks button.link { font-size: 12px; }
.tabpanel .subhead { margin-top: 4px; }
@media (max-width: 760px) {
  .lookups { grid-template-columns: minmax(0, 1fr); }
  .listpicker { display: none; }
  .listpicker-phone { display: block; }
}
.app.topbar ~ .drawer { z-index: 40; }
.onlyphone { display: none; }
@media (max-width: 760px) {
  .lookups th.status, .lookups td.status { display: none; }
  .lookups .onlyphone { display: inline; }
  .lookups .rowactions { white-space: normal; }
  .lookups .rowactions button { margin: 2px 0 2px 4px; }
}

/* ---------- Company page ---------- */
.crumbs { margin: 0 0 4px; font-size: 13px; }
.crumbs a { color: var(--muted); text-decoration: none; }
h2.companytitle { margin-bottom: 2px; }
h2.companytitle .pill { font-size: 13px; vertical-align: middle; font-weight: 500; }
.pill.ok { background: #e3f3e8; color: var(--good); }
a.tab { display: inline-block; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 6px 16px; text-decoration: none; }
a.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.companypanel > .card, .companypanel > .toolbar { margin-bottom: 14px; }
table.facts th { text-align: left; color: var(--muted); font-weight: 500; width: 210px; padding: 7px 10px 7px 0; vertical-align: top; }
table.facts td { padding: 7px 0; }
.about h4 { margin: 0 0 4px; }
.about p { margin: 0 0 12px; white-space: pre-wrap; }
.card.banner.ok { border-color: #b7dfc3; background: #f2faf4; }
.card.banner.bad { border-color: #f1c0bb; background: #fdf3f2; color: var(--bad); }
.accountform { max-width: 720px; }
@media (max-width: 760px) { table.facts th { width: auto; } .tabs { overflow-x: auto; flex-wrap: nowrap; } }
table.facts th, table.facts tr:hover td, table.facts tr:hover th { background: none; }
.reportgrid + .card, .card + .reportgrid, .card + .card { margin-top: 16px; }
