/* P37 brand: charcoal, white and P37 gold. Trebuchet MS throughout, sentence case. */
:root {
  --gold: #FFD700; --gold-ink: #8a7000; --gold-soft: #fff6c2; --charcoal: #141414; --charcoal-2: #1f1f1f; --charcoal-3: #2b2b2b;
  --ink: #141414; --ink-2: #535353; --ink-3: #7a7a7a; --line: #e4e4e4; --line-2: #d0d0d0; --bg: #f6f6f4; --white: #fff;
  --ok: #1f7a3f; --ok-bg: #e5f4ea; --warn: #8a5a00; --warn-bg: #fff2d6; --bad: #b3261e; --bad-bg: #fde8e6; --info: #1d4f91; --info-bg: #e7effa;
  --radius: 8px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  font-family: "Trebuchet MS", "Lucida Grande", "Segoe UI", Arial, sans-serif; font-size: 14px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
a { color: inherit; }
a.link, .link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 2px; cursor: pointer; }
h1, h2, h3, h4 { font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
p { margin: 0 0 8px; line-height: 1.45; }
small, .muted { color: var(--ink-2); }
.tiny { font-size: 12px; color: var(--ink-3); }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }

/* layout */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--charcoal); color: #eee; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; border-bottom: 1px solid #2a2a2a; }
.brand img { height: 30px; }
.brand .mark { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--charcoal); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.brand b { font-size: 15px; display: block; } .brand span { font-size: 11px; color: #aaa; }
.nav { padding: 8px 8px 16px; display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: #d8d8d8; font-size: 13.5px; }
.nav a:hover { background: var(--charcoal-3); color: #fff; }
.nav a.on { background: var(--gold); color: var(--charcoal); font-weight: 700; }
.nav .count { background: #3a3a3a; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.nav a.on .count { background: var(--charcoal); color: var(--gold); }
.side .foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid #2a2a2a; font-size: 12px; color: #aaa; }
.side .foot button { color: #ddd; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .search { flex: 1; max-width: 560px; position: relative; }
.top .search input { width: 100%; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--bg); }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 420px; overflow: auto; z-index: 30; }
.search-results a { display: block; padding: 8px 12px; text-decoration: none; border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a.sel { background: var(--gold-soft); }
.content { padding: 20px 24px 60px; max-width: 1400px; width: 100%; }
.demo-bar { background: repeating-linear-gradient(45deg, var(--gold), var(--gold) 12px, #f5cf00 12px, #f5cf00 24px); color: var(--charcoal); text-align: center; font-weight: 700; padding: 5px; font-size: 12.5px; }
.menu-btn { display: none; }

/* page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* cards and grids */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.card > h2, .card > h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.split { display: grid; grid-template-columns: minmax(0,2fr) minmax(280px,1fr); gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; border-top: 3px solid var(--gold); }
.kpi .v { font-size: 20px; font-weight: 700; } .kpi .l { font-size: 12px; color: var(--ink-2); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--ink-2); } dl.facts dd { margin: 0; }

/* buttons & forms */
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line-2); background: var(--white); color: var(--ink); border-radius: 6px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; line-height: 1.2; }
button:hover, .btn:hover { border-color: var(--ink-2); }
button.primary, .btn.primary { background: var(--charcoal); color: var(--white); border-color: var(--charcoal); }
button.primary:hover { background: #000; }
button.gold, .btn.gold { background: var(--gold); border-color: var(--gold); color: var(--charcoal); font-weight: 700; }
button.danger { color: var(--bad); border-color: #e8b4b0; }
button.ghost { border-color: transparent; background: transparent; }
button.small, .btn.small { padding: 4px 8px; font-size: 12.5px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--white); color: var(--ink); width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; font-weight: 700; }
label.f .hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
label.f .err { font-size: 12px; color: var(--bad); margin-top: 3px; }
label.check { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 140px; }

/* tables */
table.t { width: 100%; border-collapse: collapse; background: var(--white); }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; background: #fafafa; position: sticky; top: 0; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #fffbe0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 700; background: #eee; color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); } .badge.gold { background: var(--gold); color: var(--charcoal); } .badge.dark { background: var(--charcoal); color: var(--gold); }
.notice { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; border-left: 4px solid; }
.notice.info { background: var(--info-bg); border-color: var(--info); } .notice.warn { background: var(--warn-bg); border-color: #d99a00; } .notice.bad { background: var(--bad-bg); border-color: var(--bad); } .notice.ok { background: var(--ok-bg); border-color: var(--ok); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; font-size: 13.5px; }
.tabs a.on { color: var(--ink); border-color: var(--gold); font-weight: 700; }

/* today items */
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .why { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.item .meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.item .acts { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.section-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #fafafa; border-bottom: 1px solid var(--line); font-weight: 700; }

/* timeline */
.tl { list-style: none; padding: 0; margin: 0; }
.tl li { padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.tl li::before { content: ''; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; }
.tl li.auto::before { background: var(--line-2); }
.tl .h { font-weight: 700; } .tl .b { white-space: pre-wrap; margin-top: 4px; }

/* pipeline board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col { min-width: 240px; width: 240px; background: #efefec; border-radius: var(--radius); padding: 8px; }
.col h3 { font-size: 13px; display: flex; justify-content: space-between; padding: 4px 4px 8px; }
.col.drop { outline: 3px dashed var(--gold); }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; cursor: grab; }
.tile .n { font-weight: 700; } .tile .s { font-size: 12px; color: var(--ink-2); }

/* dialogs & toasts */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(720px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.wide { width: min(1080px, 96vw); }
dialog::backdrop { background: rgba(20,20,20,.55); }
dialog .dh { background: var(--charcoal); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--gold); }
dialog .dh h2 { margin: 0; font-size: 16px; } dialog .dh button { background: transparent; color: #fff; border: 0; font-size: 20px; }
dialog .db { padding: 16px; max-height: 70vh; overflow: auto; } dialog .df { padding: 12px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); background: #fafafa; }
#toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: var(--charcoal); color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); border-left: 4px solid var(--gold); max-width: 420px; }
.toast.bad { border-color: #ff6b5e; }

/* assistant panel */
.assist { position: fixed; right: 0; top: 0; bottom: 0; width: min(440px, 100vw); background: #fff; border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 50; display: flex; flex-direction: column; }
.assist .dh { background: var(--charcoal); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; border-bottom: 3px solid var(--gold); }
.assist .body { padding: 14px; overflow: auto; flex: 1; }
.assist .dh { align-items: center; } .assist .dh h2 { margin: 0; font-size: 16px; } .assist .dh button { color: #fff; }
.assist .msg { margin: 10px 0; padding: 10px 12px; border-radius: var(--radius); line-height: 1.45; overflow-wrap: anywhere; }
.assist .msg.user { background: var(--gold-soft); margin-left: 32px; white-space: pre-wrap; }
.assist .msg.assistant { background: var(--bg); }
.assist .msg ol, .assist .msg ul { margin: 0 0 8px; padding-left: 22px; } .assist .msg li { margin-bottom: 4px; }
.assist .ask { display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); } .assist .ask textarea { flex: 1; min-height: 0; resize: none; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--charcoal); padding: 20px; }
.login .box { background: #fff; border-radius: 12px; padding: 28px; width: min(400px, 100%); border-top: 6px solid var(--gold); }
.login .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }

.empty { text-align: center; padding: 28px 16px; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--gold); }
.right { text-align: right; } .nowrap { white-space: nowrap; } .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.mt { margin-top: 12px; } .mb0 { margin-bottom: 0; } .hide { display: none !important; }
.math { background: #fafafa; border: 1px dashed var(--line-2); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 250px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .g2, .g3, .g4, .split, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 14px 12px 60px; }
  .top { padding: 8px 12px; }
  .item { grid-template-columns: 1fr; } .item .acts { justify-content: flex-start; }
  table.t.stack thead { display: none; }
  table.t.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.t.stack td { display: flex; justify-content: space-between; border: 0; padding: 4px 10px; }
  table.t.stack td::before { content: attr(data-l); color: var(--ink-2); font-size: 12px; margin-right: 12px; }
}
@media print { .side, .top, .actions, .demo-bar { display: none !important; } .shell { display: block; } }

/* ---- shared extras ---- */
.pre { white-space: pre-wrap; background: #fafafa; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
/* ---- retailer portal ---- */
.order-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 16px; align-items: start; }
.order-layout .cart { position: sticky; top: 72px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.product { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.product img, .product .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--charcoal); }
.product .ph { display: grid; place-items: center; color: var(--gold); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 900px) { .order-layout { grid-template-columns: 1fr; } .order-layout .cart { position: static; } }
@media (max-width: 1200px) { .item { grid-template-columns: minmax(0,1fr); } .item .acts { justify-content: flex-start; } }
