/* Polaris screens. The design SYSTEM (colour, type, spacing, radii,
   elevation, motion, controls) lives in tokens.css, which is loaded first and
   also carries the legacy aliases (--ink, --paper, --line, --blue, ...) that
   the rules below still use. Migrate a rule to the semantic names when you
   touch it; do not add new uses of the aliases. */

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font: var(--t-body-13);
  letter-spacing: var(--tr-body-13);
  color: var(--text-primary); background: var(--surface-canvas);
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
#shell { display: flex; min-height: 100vh; }

/* rail */
#rail {
  width: 232px; flex: 0 0 232px; padding: 14px 12px 12px;
  border-right: 1px solid var(--line); background: var(--card);
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: width .16s ease, flex-basis .16s ease;
}
/* Collapsed rail: icons only. Labels are hidden rather than removed so the
   accessibility tree and the ⌘K palette keep working unchanged. */
#rail.mini { width: 58px; flex-basis: 58px; padding: 14px 8px 12px; }
#rail.mini .lbl, #rail.mini .brandtext, #rail.mini .chev,
#rail.mini kbd, #rail.mini .acctwho, #rail.mini .acctgear { display: none; }
#rail.mini .navgroup { justify-content: center; padding: 6px 0; font-size: 0; }
#rail.mini .navgroup::before { content: '···'; font-size: 12px; letter-spacing: 1px; }
#rail.mini a, #rail.mini #railsearch, #rail.mini #acct { justify-content: center; padding: 8px 0; }
#rail.mini .navlinks { display: block !important; }
#rail.mini #railhead { justify-content: center; }
#rail.mini .navbadge { position: absolute; margin: -14px 0 0 16px; min-width: 8px; height: 8px; padding: 0; font-size: 0; }

#railhead { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
#railtoggle {
  margin-left: auto; border: none; background: transparent; color: var(--ink2);
  font-size: 14px; cursor: pointer; padding: 3px 5px; border-radius: 6px; line-height: 1;
}
#railtoggle:hover { background: var(--paper); color: var(--ink); }

#railsearch {
  display: flex; align-items: center; gap: 9px; width: 100%; margin-bottom: 6px;
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink2); font-size: 13px; cursor: pointer;
  font-family: inherit; text-align: left;
}
#railsearch:hover { border-color: var(--ink2); color: var(--ink); }
#railsearch .ic { font-size: 13px; }
#railsearch kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px;
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; color: var(--muted);
}

.navsec { display: flex; flex-direction: column; }
.navsec .navlinks { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.navsec[data-collapsed="1"] .navlinks { display: none; }
.navsec[data-collapsed="1"] .chev { transform: rotate(0deg); }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; margin-bottom: 16px; }
.brand .star { color: var(--blue); }
.brand .sub { display: block; font-size: 11px; font-weight: 500; color: var(--ink2); letter-spacing: .8px; text-transform: uppercase; margin-left: 22px; }
.navgroup {
  display: flex; align-items: center; width: 100%;
  font-size: 10.5px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--ink2); margin: 12px 0 4px; padding: 3px 8px; border-radius: 6px;
  background: none; border: none; cursor: pointer; font-family: inherit; text-align: left;
}
.navgroup:hover { color: var(--ink); background: var(--paper); }
.navgroup .chev { margin-left: auto; font-size: 13px; transform: rotate(90deg); transition: transform .14s ease; letter-spacing: 0; }
#rail a {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px;
  transition: background .12s ease;
}
#rail a .ic { width: 16px; text-align: center; color: var(--ink2); font-size: 13px; }
#rail a:hover { background: var(--paper); }
#rail a.active { background: var(--blue-soft); color: var(--blue); }
#rail a.active .ic { color: var(--blue); }
.navbadge {
  margin-left: auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.navbadge.on { display: inline-flex; }
/* Account block, bottom of the rail — where every tool of this shape puts it.
   Real auth arrives with hosting; until then this reports WHO the app thinks
   you are and WHICH database you are on, which is the honest version. */
#railfoot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); position: relative; }
#acct {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px;
  border: none; background: none; border-radius: 8px; cursor: pointer;
  font-family: inherit; text-align: left; color: var(--ink);
}
#acct:hover { background: var(--paper); }
.avatar {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.acctwho { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.acctname { font-size: 13px; font-weight: 550; }
.acctmeta { font-family: var(--mono); font-size: 10px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acctgear { color: var(--ink2); font-size: 13px; }
#acctmenu {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 5px; z-index: 40;
}
#acctmenu.open { display: block; }
#acctmenu a, #acctmenu button {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border-radius: 7px;
  border: none; background: none; color: var(--ink); font-size: 13px; font-family: inherit;
  cursor: pointer; text-decoration: none;
}
#acctmenu a:hover, #acctmenu button:hover { background: var(--paper); }
.acctnote { font-size: 10.5px; color: var(--muted); padding: 7px 9px 3px; border-top: 1px solid var(--line); margin-top: 4px; line-height: 1.45; }
#themebtn:hover, #cmdkhint:hover { color: var(--blue); border-color: var(--blue); }
#cmdkhint { font-family: var(--mono); font-size: 10.5px; }

/* main. min-width:0 lets a wide table scroll inside its own .tablewrap
   instead of pushing the whole page sideways (flex items default to
   min-width:auto, which refuses to shrink below content width). */
#view { flex: 1; min-width: 0; padding: 26px 32px 60px; max-width: 1220px; }
.loading { color: var(--ink2); padding: 40px; }
h1 { font-size: 21px; font-weight: 700; letter-spacing: .1px; }
.pagehead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.pagehead .meta { color: var(--ink2); font-size: 13px; }
.pagesub { color: var(--ink2); font-size: 13.5px; margin-bottom: 20px; max-width: 780px; }

/* cards + grids */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); margin-bottom: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.card .k { font-size: 11.5px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; color: var(--ink2); display: flex; gap: 8px; align-items: center; }
.card .v { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .d { font-size: 12.5px; color: var(--ink2); margin-top: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel h2 { font-size: 14px; font-weight: 650; margin-bottom: 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.panel h2 .meta { font-weight: 400; color: var(--ink2); font-size: 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--ink2); padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
tr.grouprow td {
  background: var(--paper); font-weight: 650; font-size: 12.5px;
  letter-spacing: .3px; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
tr.grouprow .name { font-family: var(--mono); font-size: 10.5px; font-weight: 400; margin-left: 6px; }
.sku { font-family: var(--mono); font-size: 12px; }
.name { color: var(--ink2); font-size: 12.5px; }
.tablewrap { overflow-x: auto; }

/* badges */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.b-grey { background: var(--line2); color: var(--ink2); }

/* charts */
.chart { width: 100%; height: 190px; display: block; }
.chartwrap { position: relative; }
.chartwrap .tip {
  position: absolute; top: 6px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-size: 11.5px; line-height: 1.5;
  padding: 6px 10px; border-radius: 8px; pointer-events: none; white-space: nowrap;
  box-shadow: var(--shadow-pop); z-index: 5;
}
.chartwrap .tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.spark { width: 120px; height: 34px; display: block; margin-top: 8px; opacity: .9; }

/* kpi + chips */
.cards.kpis { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card.kpi .v { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; vertical-align: middle; }
.chip-up { background: var(--green-soft); color: var(--green); }
.chip-down { background: var(--red-soft); color: var(--red); }

/* geo verdict strip */
.geopanel { display: flex; flex-direction: column; gap: 7px; }
.geoline { display: flex; align-items: center; gap: 9px; font-size: 13.5px; flex-wrap: wrap; }
.geoline b { width: 24px; }

/* recommended actions */
.action { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px; border-bottom: 1px solid var(--line2); }
.action:last-child { border-bottom: none; }
.action .grow { flex: 1; }
.action .t { font-weight: 600; font-size: 13.5px; }
.action .d { font-size: 12.5px; color: var(--ink2); margin-top: 2px; max-width: 720px; }
.sevdot { width: 9px; height: 9px; border-radius: 99px; margin-top: 6px; flex: 0 0 9px; }
.dot-red { background: var(--red); } .dot-amber { background: var(--amber); } .dot-grey { background: var(--muted); }
.panel.warn { border-color: var(--amber); }

/* family grouping */
tr.grouprow { cursor: pointer; user-select: none; }
tr.grouprow:hover td { background: var(--hover); }
tr.grouprow .chev { display: inline-block; width: 14px; color: var(--blue); }
.famagg { float: right; font-weight: 500; font-size: 11.5px; color: var(--ink2); }
.famagg .badge { margin-left: 6px; }
.aggwarn { color: var(--red); font-weight: 650; }
tr.famchild.hide { display: none; }
.famctl { display: inline-flex; gap: 6px; }

/* chart legend chips + explore */
.lchip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 550; padding: 3px 10px; border-radius: 99px;
  background: var(--card); border: 1px solid var(--line); cursor: pointer; color: var(--ink);
}
.lchip .sw { width: 9px; height: 9px; border-radius: 3px; }
.lchip.off { opacity: .38; }
.lchip:hover { background: var(--paper); }
.leg .legend { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.tiptotal { border-top: 1px solid rgba(128,128,128,.35); margin-top: 3px; padding-top: 3px; }
.xlink { font-size: 12px; font-weight: 600; color: var(--blue); text-decoration: none; }
.xlink:hover { text-decoration: underline; }
.checkline { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink2); padding-bottom: 8px; }

/* creative pipeline */
.cregrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.crecard { border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.crebody { padding: 12px 14px; flex: 1; }
.crehead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.crehook { font-size: 13px; font-style: italic; margin: 6px 0 2px; }
.crecard .bar { margin-top: 8px; }
.crecard input { padding: 2px 6px; font-size: 12px; width: 56px; }
.cremedia {
  height: 150px; background: var(--paper); border-bottom: 1px solid var(--line2);
  display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer;
}
.cremedia img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cremedia .noimg { color: var(--muted); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cremedia .noimg .big { font-size: 26px; opacity: .5; }
.cremedia .mediabtns { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 5px; opacity: 0; transition: opacity .15s; }
.cremedia:hover .mediabtns { opacity: 1; }
.mediabtns button { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--card); }
.drivetag { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 700; letter-spacing: .5px; background: var(--card); border: 1px solid var(--line); color: var(--ink2); border-radius: 5px; padding: 1px 6px; }

/* lightbox */
#lightbox {
  position: fixed; inset: 0; z-index: 90; background: rgba(10, 10, 12, .82);
  display: none; align-items: center; justify-content: center; cursor: zoom-out;
}
#lightbox.open { display: flex; }
#lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 10px; box-shadow: var(--shadow-pop); }

/* inbox */
.sugg { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.sugg .head { display: flex; gap: 10px; align-items: flex-start; }
.sugg .t { font-weight: 650; font-size: 14px; flex: 1; }
.sugg .d { font-size: 13px; color: var(--ink2); margin: 6px 0 4px; max-width: 860px; white-space: pre-wrap; }
.sugg .metaline { font-size: 11.5px; color: var(--ink2); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.sugg .metaline .sku { font-size: 11px; }
.sugg .btns { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.sugg .evwrap { margin-top: 8px; }
.sugg details summary { cursor: pointer; font-size: 12px; color: var(--ink2); user-select: none; }
.sugg pre { background: var(--paper); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font-size: 11.5px; overflow-x: auto; margin-top: 6px; font-family: var(--mono); }
.sugg .rejectbox { display: none; gap: 6px; flex: 1; min-width: 260px; }
.sugg .rejectbox.open { display: flex; }
.sugg .rejectbox input { flex: 1; font-size: 13px; }
.diff { font-family: var(--mono); font-size: 11.5px; }
.diff .arr { color: var(--ink2); margin: 0 6px; }

/* agent screen */
.cadgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 18px; }
.cadcard { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 14px 16px; box-shadow: var(--shadow); }
.cadcard h3 { font-size: 14px; font-weight: 700; text-transform: capitalize; display: flex; align-items: center; gap: 8px; }
.cadcard .sched { font-family: var(--mono); font-size: 11px; color: var(--ink2); margin: 2px 0 8px; }
.cadcard p { font-size: 12.5px; color: var(--ink2); margin-bottom: 10px; }
.cadcard .runbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.summarycell { max-width: 420px; font-size: 12.5px; color: var(--ink2); }

/* toasts */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 550;
  padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-pop);
  animation: toastin .18s ease; max-width: 380px;
}
.toast.err { background: var(--red); color: #fff; }
.toast.ok { background: var(--green); color: #fff; }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* command palette */
#cmdk { position: fixed; inset: 0; z-index: 95; background: rgba(10, 10, 12, .45); display: none; align-items: flex-start; justify-content: center; padding-top: 14vh; }
#cmdk.open { display: flex; }
#cmdkbox { width: 560px; max-width: 92vw; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; }
#cmdkbox input { width: 100%; border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 16px; font-size: 15px; background: var(--card); color: var(--ink); }
#cmdkbox input:focus { outline: none; }
#cmdklist { max-height: 46vh; overflow-y: auto; padding: 6px; }
.cmdkitem { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.cmdkitem .ic { width: 18px; text-align: center; color: var(--ink2); }
.cmdkitem .hint { margin-left: auto; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.cmdkitem.sel { background: var(--blue-soft); color: var(--blue); }
.cmdkitem.sel .ic { color: var(--blue); }

/* png export */
.pngbtn {
  position: absolute; top: 6px; right: 6px; z-index: 4;
  font-size: 13px; padding: 2px 8px; border-radius: 7px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink2);
  opacity: 0; transition: opacity .15s;
}
.panel:hover .pngbtn, .chartwrap:hover .pngbtn { opacity: 1; }
.pngbtn:hover { color: var(--blue); border-color: var(--blue); }

/* misc */
button.mini { font-size: 11.5px; padding: 3px 9px; }
button.mini.on { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.wsel { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 2px; }
.staledot { color: var(--red); font-size: 9px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink2); margin-top: 6px; flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* pacing bars */
.bar { height: 8px; background: var(--line2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; border-radius: 99px; background: var(--blue); }

/* loop */
.bucket { margin-bottom: 4px; }
.loopitem { display: flex; gap: 12px; align-items: flex-start; padding: 9px 6px; border-bottom: 1px solid var(--line2); }
.loopitem:last-child { border-bottom: none; }
.loopitem .t { font-weight: 550; font-size: 13.5px; }
.loopitem .d { font-size: 12.5px; color: var(--ink2); }
.loopitem .pill { cursor: pointer; user-select: none; }
.bucketlabel { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--blue); margin: 14px 0 2px; }
.pill { cursor: pointer; user-select: none; }

/* forms */
input, select, textarea, button {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
button { cursor: pointer; font-weight: 600; }
button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.primary:hover { filter: brightness(1.06); }
button.ghost:hover { background: var(--paper); }
button.approve { background: var(--green); border-color: var(--green); color: #fff; }
button.approve:hover { filter: brightness(1.08); }
button.danger { color: var(--red); border-color: var(--red); background: transparent; }
button.danger:hover { background: var(--red-soft); }
.formrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--ink2); }
.field input, .field select { min-width: 110px; }
textarea { width: 100%; min-height: 110px; font-family: var(--mono); font-size: 12px; }
.note { font-size: 12.5px; color: var(--ink2); }
.ok { color: var(--green); font-weight: 600; font-size: 13px; }
.err { color: var(--red); font-weight: 600; font-size: 13px; }
.right { margin-left: auto; }

/* ---- pricer panel (Amazon screen) ------------------------------------- */
/* The shadow engine's read-out: a nested "decision card" per move, plus the
   dimmed rows for ladder levels the bandit believes in but is not exploring. */
.panel h3 { font-size: 13px; font-weight: 650; margin: 16px 0 8px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.panel h3 .meta { font-weight: 400; color: var(--ink2); font-size: 12px; }
.panel h3:first-of-type { margin-top: 12px; }
.panel.sub { background: var(--paper); border-style: dashed; padding: 12px 14px; margin: 10px 0 14px; box-shadow: none; }
.panel.sub h3 { margin-top: 0; }
.row.gap { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; margin: 8px 0 10px; font-size: 12.5px; }
.row.gap .name { font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--ink2); }
tr.dim td { opacity: .45; }

/* ---------- shared text weight ----------
   .muted is used ~40 times across the app and had NO rule: every "secondary"
   span was rendering at full ink, which is most of why dense screens read
   busy. One line fixes it everywhere. */
.muted { color: var(--ink2); font-weight: 400; }
.mono { font-family: var(--mono); }

/* ---------- view tabs (PIM detail + list presets) ----------
   Deliberately not another pill row: pills above pills read as one confusing
   strip. A bottom-border tab strip separates "which view" from "which filter". */
.vtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.vtab { border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink2);
  white-space: nowrap; cursor: pointer; }
.vtab:hover { color: var(--ink); }
.vtab[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.vtab .cnt { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-left: 5px; }
.vtab:focus-visible, .sechead:focus-visible { outline: 2px solid var(--blue-soft); outline-offset: 2px; border-radius: 6px; }
.subtabs { margin-bottom: 12px; }
.subtabs .cnt { font-family: var(--mono); font-size: 10px; opacity: .7; }

/* ---------- collapsible sections ---------- */
.sec .sechead { display: flex; align-items: baseline; gap: 8px; width: 100%; border: none;
  background: none; padding: 0; font: inherit; font-size: 14px; font-weight: 650;
  color: var(--ink); cursor: pointer; text-align: left; }
.sec .sechead .chev { color: var(--blue); width: 14px; display: inline-block;
  transform: rotate(90deg); transition: transform .14s ease; }
.sec[data-collapsed="1"] .sechead .chev { transform: rotate(0deg); }
.sec[data-collapsed="1"] .secbody { display: none; }
.sec .secbody { margin-top: 12px; }
.sechead .cnt { margin-left: auto; font-size: 11.5px; font-weight: 500; color: var(--ink2); }
.sechead .gap { font-size: 11.5px; font-weight: 650; color: var(--red); }
.sechead .cnt + .gap { margin-left: 8px; }

/* ---------- PIM ---------- */
.pimhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pimbar { display: inline-block; width: 52px; height: 7px; border-radius: 4px; background: var(--red-soft); overflow: hidden; vertical-align: middle; }
.pimfill { display: block; height: 100%; border-radius: 4px; }
.pimfill.g { background: var(--green); }
.pimfill.a { background: var(--amber); }
.pimfill.r { background: var(--red); }
tr.pimrow { cursor: pointer; }
tr.pimrow:hover td { background: var(--green-soft); }
.listctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pimsearch { padding: 5px 9px; font-size: 12.5px; border: 1px solid var(--line); border-radius: 7px;
  background: transparent; color: inherit; min-width: 200px; }

/* field grids: labels quiet, values prominent */
.pimgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.pimgrid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pimcol.wide { grid-column: 1 / -1; }
.pimcol label, .pimattr label { display: block; font-size: 10.5px; letter-spacing: .4px;
  text-transform: uppercase; color: var(--ink2); margin-bottom: 3px; }
.pimcol input, .pimcol select, .pimcol textarea, .pimcell textarea {
  width: 100%; padding: 5px 8px; font-size: 12.5px; font-family: inherit; border: 1px solid var(--line);
  border-radius: 6px; background: transparent; color: inherit; }
.pimcol textarea, .pimcell textarea { resize: vertical; }
.pimcol input.mono, .pimcol input[inputmode="decimal"] { font-family: var(--mono); }
.pimcol input.bad, .pimcol select.bad { border-color: var(--red); }
.pimcol .sug { margin-top: 4px; font-size: 10.5px; }
.fcheck { display: block; margin-top: 3px; font-size: 10.5px; font-family: var(--mono); }
.fcheck.ok { color: var(--green); }
.fcheck.err { color: var(--red); }

/* a field the completeness rules want and nothing filled */
.pimmiss { color: var(--red); }

/* the UFI scope verdict line on the Compliance tab (0034) */
.ufiverdict { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; font-size: 12px; color: var(--ink2); }
.ufiverdict-err span { color: var(--red); }
.ufiverdict-warn span { color: var(--amber); }
.ufiverdict-ok span { color: var(--green); }

/* combobox (step 2): searchable selector with colour-token dots */
.combo { position: relative; }
.combobtn { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;
  background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
  font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.combobtn:hover { border-color: var(--line2); }
.combobtn .caret { margin-left: auto; color: var(--muted); font-size: 10px; }
.combobtn .cval, .comboopt .cval { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combobtn .cval.muted, .comboopt .cval.muted { color: var(--muted); }
.cdot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; display: inline-block; padding: 0; }
.cdot.b-grey { background: var(--muted); }
.cdot.b-green { background: var(--green); } .cdot.b-amber { background: var(--amber); }
.cdot.b-red { background: var(--red); } .cdot.b-blue { background: var(--blue); }
.cdot.b-violet { background: var(--violet); }
.combopop { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 100%; max-width: 320px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-pop);
  padding: 6px; }
.combosearch { width: 100%; margin-bottom: 6px; background: transparent; border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 12px; color: var(--ink); }
.comboopts { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.comboopt { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; background: none;
  border: 0; border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.comboopt:hover { background: var(--hover); }
.comboopt.on { background: var(--hover); font-weight: 600; }
/* display:flex would defeat the hidden attribute the search filter sets */
.comboopt[hidden], .combopop[hidden] { display: none; }

/* on-pack declaration box (step 4) */
.declbox { margin: 12px 0 6px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.declbox b { font-size: 12px; }
.declbox ul { margin: 6px 0 8px; padding-left: 18px; }
.declbox li { margin: 2px 0; }

/* availability matrix chips + the floating status menu */
.availchip { border: 0; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 11px;
  font-weight: 600; cursor: pointer; }
.availchip.unlisted { background: transparent; color: var(--muted); border: 1px dashed var(--line2); }
.availchip.unlisted:hover { border-style: solid; color: var(--ink2); }
#availmenu { position: absolute; z-index: 70; min-width: 180px; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 6px; }
#availmenu .availhead { font-size: 10.5px; color: var(--muted); padding: 4px 8px 6px; font-family: var(--mono); }
#availmenu button { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; background: none;
  border: 0; border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; }
#availmenu button:hover { background: var(--hover); }
#availmenu button.on { background: var(--hover); font-weight: 600; }

/* content matrix */
.pimattr { margin: 0 0 14px; }
.pimattr label { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--ink); }
.pimattr label .muted { font-weight: 400; font-size: 11px; }
.pimcell.inherit textarea { border-style: dashed; }
.pimattr .fb { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.pimdiff { font-size: 11.5px; color: var(--ink2); max-width: 460px; }
.qdet { font-size: 11.5px; color: var(--ink2); }

/* multi-select chips */
.chipset { display: flex; flex-wrap: wrap; gap: 5px; }
.chiptog { border: 1px solid var(--line); background: transparent; color: var(--ink2);
  border-radius: 999px; padding: 3px 9px; font: inherit; font-size: 11.5px; cursor: pointer; }
.chiptog:hover { border-color: var(--blue); color: var(--ink); }
.chiptog.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); font-weight: 600; }

/* inline add rows (BOM component, certification) */
.addrow { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.addrow input, .addrow select { padding: 5px 8px; font-size: 12.5px; border: 1px solid var(--line);
  border-radius: 6px; background: transparent; color: inherit; }
.addrow input.narrow { width: 64px; text-align: right; }

/* empty states carry the next action, not just an apology */
.pimempty { font-size: 12.5px; color: var(--ink2); padding: 4px 0; line-height: 1.6; }
.pimempty code { font-family: var(--mono); font-size: 11px; background: var(--paper);
  border: 1px solid var(--line2); border-radius: 5px; padding: 1px 5px; }

/* assets */
.assetgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.assetcard { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper); }
.assetcard img { width: 100%; height: 110px; object-fit: cover; display: block; }
.assetfile { height: 110px; display: grid; place-items: center; font-family: var(--mono);
  font-size: 13px; color: var(--ink2); background: var(--line2); }
.assetmeta { padding: 7px 8px; font-size: 11.5px; display: grid; gap: 2px; }
