/**
 * Porecast Labeling — extends dbdb/webapp/static/css/bioeffect-theme.css (same design system as PO Manager).
 */
* { box-sizing: border-box; }

:root {
  --fg: var(--bio-text);
  --muted: var(--bio-text-muted);
  --bg: var(--bio-bg-page);
  --card: var(--bio-bg-white);
  --border: var(--bio-border);
  --accent: var(--bio-accent);
  --accent-hover: var(--bio-accent-hover);
  --accent-light: rgba(61, 82, 72, 0.14);
  --danger: var(--bio-error-text);
  --warn: var(--bio-warn-text);
  --ok: var(--bio-success-text);
  --chip: var(--bio-bg-subtle);
  --row-hover: var(--bio-bg-subtle);
  /* Same dark green as primary actions (e.g. + New service) */
  --bio-brand-header-bg: #3d4c45;
}

body.bio-body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--fg);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--bio-text);
  margin: 1rem 0 0.5rem;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--bio-text);
  margin: 1rem 0 0.5rem;
  font-size: 1.05rem;
}
/* Tab page titles — same on every tab (All-store inventory, … inventory, … retail) */
h2.page-heading {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.22;
  color: var(--bio-text);
  margin: 1rem 0 0.5rem;
}
/* Major in-tab blocks (retail eligible + sales history) */
h3.section-heading-primary {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--bio-text);
  margin: 2.5rem 0 1rem;
  padding: 0.5rem 0 0.75rem;
  border-bottom: 3px solid var(--bio-accent);
}
/* Secondary lists (recommendations, manager-added, retail recs) */
h3.section-heading-secondary {
  font-family: var(--font-ui);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--bio-text);
  margin: 2.25rem 0 0.85rem;
  padding: 0;
  border-bottom: none;
}
p.subtle, .subtle { color: var(--muted); }
.container { max-width: 80rem; margin: 0 auto; padding: 1rem 1.5rem; }
.container.tight { display: flex; align-items: center; padding: 0.4rem 1.5rem; }
.spacer { flex: 1; }

.topbar {
  background: var(--bio-bg-white);
  border-bottom: 1px solid var(--bio-border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--bio-shadow-sm);
}
.brand { font-weight: 700; color: var(--accent); }
.brand-with-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
}
a.brand-with-logo:hover .brand-text {
  text-decoration: underline;
}
a.brand-logo-only {
  text-decoration: none;
}
a.brand-logo-only:hover {
  opacity: 0.92;
}
.brand-logo {
  flex-shrink: 0;
  width: auto;
  height: auto;
  max-height: 48px;
  max-width: min(200px, 42vw);
  min-width: 44px;
  min-height: 44px;
  object-fit: contain;
  object-position: left center;
  display: block;
}
.brand-text {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.05rem;
}
.page-head h1 {
  color: var(--accent);
}

.store-switch select {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--bio-border-strong);
  border-radius: var(--bio-radius);
  background: var(--bio-bg-white);
  font-size: 0.875rem;
  color: var(--bio-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.store-switch select:focus {
  outline: none;
  border-color: var(--bio-accent);
  box-shadow: 0 0 0 3px rgba(44, 53, 48, 0.12);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
  border-bottom: 1px solid var(--bio-border);
  padding: 0 1.5rem;
  background: var(--bio-bg-white);
}
.tab {
  background: transparent;
  border: none;
  padding: 0.75rem 1.1rem;
  border-bottom: 3px solid transparent;
  border-radius: var(--bio-radius) var(--bio-radius) 0 0;
  color: var(--bio-text-muted);
  font-weight: 500;
  cursor: pointer;
  font-size: 0.8125rem;
  transition: background 0.15s, color 0.15s;
}
.tab:hover {
  color: var(--bio-text);
  background: var(--bio-bg-subtle);
}
.tab.active {
  color: var(--bio-text);
  background: var(--bio-bg-subtle);
  border-bottom-color: var(--bio-accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.toolbar {
  display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.toolbar input[type=search], .toolbar input[type=text] {
  flex: 1;
  min-width: 220px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--bio-border-strong);
  border-radius: var(--bio-radius);
  background: var(--bio-bg-white);
  font-size: 0.875rem;
  color: var(--bio-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.toolbar input[type=search]:focus, .toolbar input[type=text]:focus {
  outline: none;
  border-color: var(--bio-accent);
  box-shadow: 0 0 0 3px rgba(44, 53, 48, 0.12);
}
.user-chip { font-size: 0.8125rem; color: var(--bio-text-muted); }
.user-chip a { font-weight: 600; color: var(--bio-accent); }
.user-chip a:hover { color: var(--bio-accent-hover); }
.inline { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.92rem; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bio-border);
  border-radius: var(--bio-radius-lg);
  background: var(--bio-bg-white);
  margin-bottom: 1.5rem;
  box-shadow: var(--bio-shadow-sm);
}
.table-wrap-inner {
  width: 100%;
  min-width: 720px;
}
table { border-collapse: collapse; width: 100%; }
thead tr { background: var(--bio-bg-subtle); }
th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
  vertical-align: middle;
}
tbody tr:hover { background: var(--row-hover); }
.table-striped-brand {
  table-layout: fixed;
  width: 100%;
}
.table-striped-brand thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bio-bg-subtle);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bio-text-soft);
  box-shadow: 0 1px 0 var(--bio-border);
}
.table-striped-brand tbody tr.brand-section-row {
  background: var(--bio-brand-header-bg);
}
.table-striped-brand tbody tr.brand-section-row:hover {
  background: var(--bio-brand-header-bg);
}
.table-striped-brand tbody tr.data-row:hover {
  background: var(--row-hover) !important;
}
.brand-section-td {
  padding: 0.85rem 0.75rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.brand-section-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 3.25rem;
}
.brand-section-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}
/* Only when no full-color asset exists (_black only): render mark white on dark header */
.brand-section-logo[data-brand-logo-mono="1"] {
  filter: brightness(0) invert(1);
}
.table-striped-brand tbody tr.brand-section-row .brand-section-fallback {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  flex-shrink: 0;
}
.brand-section-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
td.actions { white-space: nowrap; text-align: right; }

/* My inventory — fixed layout needs explicit column share so Brand + Size controls don’t collide */
#myInvTable .table-wrap-inner {
  min-width: 980px;
}
#myInvTable .table-striped-brand th:nth-child(1),
#myInvTable .table-striped-brand td:nth-child(1) {
  width: 20%;
  min-width: 9.5rem;
}
#myInvTable .table-striped-brand th:nth-child(2),
#myInvTable .table-striped-brand td:nth-child(2) {
  width: 14%;
  min-width: 11.25rem;
  padding-right: 1rem;
}
#myInvTable .table-striped-brand th:nth-child(3),
#myInvTable .table-striped-brand td:nth-child(3) {
  width: 13%;
  min-width: 10rem;
  padding-left: 0.35rem;
}
#myInvTable .table-striped-brand th:nth-child(4),
#myInvTable .table-striped-brand td:nth-child(4),
#myInvTable .table-striped-brand th:nth-child(5),
#myInvTable .table-striped-brand td:nth-child(5),
#myInvTable .table-striped-brand th:nth-child(6),
#myInvTable .table-striped-brand td:nth-child(6) {
  width: 8%;
}
#myInvTable .table-striped-brand th:nth-child(7),
#myInvTable .table-striped-brand td:nth-child(7) {
  width: 11%;
}
#myInvTable .table-striped-brand th:nth-child(8),
#myInvTable .table-striped-brand td:nth-child(8) {
  width: 10%;
  min-width: 5.75rem;
}

.table-compact th,
.table-compact td {
  padding: 0.22rem 0.45rem;
  font-size: 0.86rem;
  line-height: 1.25;
}


.chip {
  display: inline-block;
  background: var(--chip);
  color: var(--fg);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.78rem;
  margin-right: 4px;
}
.chip.accent { background: rgba(61, 82, 72, 0.12); color: var(--bio-accent); }
.chip.warn { background: var(--bio-warn-bg); color: var(--bio-warn-text); }
.chip.ok { background: var(--bio-success-bg); color: var(--bio-success-text); }
.chip.danger { background: var(--bio-error-bg); color: var(--bio-error-text); }
.chip.you {
  background: var(--bio-info-bg);
  color: var(--bio-info-text);
  font-weight: 600;
}

.inv-brand-select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.9rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bio-bg-white);
  color: var(--bio-text);
}
.inv-brand-select:focus {
  outline: none;
  border-color: var(--bio-accent);
  box-shadow: 0 0 0 3px rgba(44, 53, 48, 0.12);
}

.inv-size-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.inv-size-wrap .inv-size-input {
  flex: 1 1 72px;
  min-width: 72px;
  max-width: 100%;
}
.inv-size-wrap.inv-size-saved .inv-size-input {
  border-color: var(--bio-success-text);
  box-shadow: 0 0 0 2px rgba(45, 74, 45, 0.18);
}
.inv-size-wrap .inv-size-save {
  flex-shrink: 0;
}
.inv-size-input {
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bio-bg-white);
}
.inv-size-input:focus {
  outline: none;
  border-color: var(--bio-accent);
  box-shadow: 0 0 0 3px rgba(44, 53, 48, 0.12);
}

.bom-use-pair {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.bom-use-chip {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--bio-text-muted);
  cursor: help;
  padding: 0.15rem 0.45rem;
  border-radius: var(--bio-radius);
  background: var(--bio-bg-subtle);
  border: 1px solid var(--bio-border);
  white-space: nowrap;
}
.bom-use-chip:hover {
  background: rgba(61, 82, 72, 0.1);
  color: var(--bio-accent);
  border-color: var(--bio-border-strong);
}
.bom-use-chip strong {
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

.bom-popover {
  position: fixed;
  z-index: 200;
  max-height: min(320px, 70vh);
  overflow-y: auto;
  background: var(--bio-bg-white);
  border: 1px solid var(--bio-border);
  border-radius: var(--bio-radius-lg);
  box-shadow: var(--bio-shadow-card);
  padding: 0;
  /* Shell does not capture clicks — tooltip sits above the table in DOM order; without this,
     invisible popover bounds block buttons (e.g. Add to my list) below. */
  pointer-events: none;
}
.bom-popover-inner {
  padding: 0.65rem 0.85rem 0.75rem;
  pointer-events: auto;
}
.bom-popover-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.bom-popover-ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
  line-height: 1.45;
}
.bom-popover-ul li {
  margin: 0.15rem 0;
}

button.primary, button.secondary, button.danger {
  padding: 0.4rem 0.8rem;
  border-radius: var(--bio-radius);
  border: 1px solid var(--bio-border);
  background: var(--bio-bg-white);
  color: var(--fg);
  cursor: pointer;
  font-size: 0.9rem;
}
button.primary {
  background: var(--bio-accent);
  color: #fafbf9;
  border-color: var(--bio-accent);
  font-weight: 600;
  letter-spacing: 0.04em;
}
button.primary:hover { background: var(--bio-accent-hover); color: #fff; }
button.secondary:hover { background: var(--bio-bg-subtle); }
button.danger { color: var(--bio-error-text); }
button.danger:hover { background: var(--bio-error-bg); }
button.small { padding: 0.25rem 0.55rem; font-size: 0.85rem; }

.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.store-card {
  display: block;
  background: var(--bio-bg-white);
  border: 1px solid var(--bio-border);
  border-radius: var(--bio-radius-lg);
  padding: 1rem 1.25rem;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: var(--bio-shadow-sm);
}
.store-card:hover {
  box-shadow: var(--bio-shadow-card);
  border-color: var(--bio-border-strong);
  text-decoration: none;
}
.store-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--bio-accent);
}
.store-full { font-size: 0.85rem; }

/* Services tab */
.two-col {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
}
.service-tree {
  border: 1px solid var(--bio-border);
  border-radius: var(--bio-radius-lg);
  background: var(--bio-bg-white);
  padding: 0.75rem;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  box-shadow: var(--bio-shadow-sm);
}
.tree-toolbar { display: flex; gap: 0.3rem; margin-bottom: 0.5rem; }
.tree-toolbar input { flex: 1; padding: 0.35rem 0.55rem; border: 1px solid var(--bio-border-strong); border-radius: var(--bio-radius); background: var(--bio-bg-white); color: var(--bio-text); }
.tree-section {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--bio-accent);
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--bio-border);
}
.tree-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.tree-cat { font-weight: 600; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; margin-top: 0.5rem; }
.tree-item {
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
}
.tree-item.enh { border-left: 2px solid rgba(61, 82, 72, 0.35); padding-left: 0.45rem; margin-left: 0.1rem; }
.tree-item:hover { background: var(--chip); }
.tree-item.active { background: rgba(61, 82, 72, 0.12); color: var(--bio-accent); font-weight: 600; }
.tree-item .count { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

#serviceDetail {
  border: 1px solid var(--bio-border);
  border-radius: var(--bio-radius-lg);
  background: var(--bio-bg-white);
  padding: 1rem 1.25rem;
  box-shadow: var(--bio-shadow-sm);
}
#serviceDetail h3 { margin-top: 1.25rem; }
.bom-bom-intro { margin: -0.35rem 0 0.65rem; max-width: 52rem; }
/* One grid per row: column 4 must be a fixed track (not auto), or the header row
   (empty actions cell) and data rows (wide Remove) get different 1fr widths and
   Size / Qty no longer line up under the labels. */
.bom-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(6.75rem, 10rem) minmax(5.25rem, 7rem) 6.75rem;
  gap: 0.5rem 0.65rem;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px dashed var(--border);
  align-items: center;
}
.bom-line > div {
  min-width: 0;
}
.bom-line.head { font-weight: 600; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
.bom-line.head > div:nth-child(2),
.bom-line.head > div:nth-child(3) {
  text-align: left;
}
.bom-head-with-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: 0;
}
.bom-info-icon {
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--bio-border-strong);
  background: var(--bio-bg-subtle);
  color: var(--bio-text-soft);
  font-size: 0.65rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: help;
}
.bom-info-icon:hover {
  color: var(--bio-accent);
  border-color: var(--bio-accent);
}
.bom-product {
  font-weight: 500;
  color: var(--fg);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bom-size-readonly {
  font-size: 0.9rem;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bom-line-actions {
  padding-right: 0.35rem;
  text-align: right;
}
.bom-head-actions-spacer {
  padding: 0;
}
.bom-row-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: stretch;
  margin: 0.65rem 0 1rem;
  padding: 0.55rem 0.65rem;
  background: var(--bio-bg-subtle);
  border: 1px dashed var(--bio-border);
  border-radius: var(--bio-radius-lg);
}
.bom-row-add input[type="text"] {
  flex: 1;
  min-width: 140px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--bio-border-strong);
  border-radius: var(--bio-radius);
  font-size: 0.9rem;
  background: var(--bio-bg-white);
}
.bom-ac-wrap {
  position: relative;
  flex: 1.2;
  min-width: 200px;
}
.bom-ac-wrap > input {
  width: 100%;
}
.bom-ac-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bio-bg-white);
  border: 1px solid var(--bio-border);
  border-radius: var(--bio-radius-lg);
  box-shadow: var(--bio-shadow-card);
}
.bom-ac-dropdown.open {
  display: block;
}
.bom-ac-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: none;
  border-bottom: 1px solid var(--bio-border);
  background: var(--bio-bg-white);
  font-size: 0.88rem;
  color: var(--fg);
  cursor: pointer;
}
.bom-ac-item:last-child {
  border-bottom: none;
}
.bom-ac-item:hover {
  background: var(--row-hover);
}
.enhancement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.enhancement-table th,
.enhancement-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.enhancement-table thead th {
  background: var(--bio-bg-subtle);
  font-weight: 600;
  color: var(--bio-text-soft);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.enhancement-table tbody tr:hover {
  background: var(--row-hover);
}
.bom-line input, .bom-line select { padding: 0.25rem 0.4rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.9rem; width: 100%; }
.bom-line .source {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.35;
}

dialog {
  border: 1px solid var(--bio-border);
  border-radius: var(--bio-radius-lg);
  padding: 1.25rem 1.5rem;
  min-width: 440px;
  max-width: 640px;
  background: var(--bio-bg-white);
  box-shadow: var(--bio-shadow-card);
}
dialog::backdrop { background: rgba(26, 28, 26, 0.45); }
dialog input[type=search] {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
.picker-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.picker-item { padding: 0.45rem 0.6rem; cursor: pointer; border-bottom: 1px solid var(--border); }
.picker-item:hover { background: var(--chip); }
.picker-item .muted { color: var(--muted); font-size: 0.8rem; }
dialog menu { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0; margin: 0.75rem 0 0; }
