/* NUtec Planning v2 slice — plan board styles on top of brand tokens.
 * Modeled on the Claude Design concept's plan board (pb-*) look. */

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body { margin: 0; background: var(--bg-soft); font-size: var(--fs-14); }

:root {
  --surface-muted: var(--nu-grey-100);
  --dur-fast: 120ms; --dur-base: 200ms;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- App shell: sidebar + main column (concept pp-shell) ---- */
.pp-shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; background: var(--bg-soft);
  transition: grid-template-columns var(--dur-base) var(--ease-out); }
.pp-shell.collapsed { grid-template-columns: 60px 1fr; }

.pp-side { background: var(--surface); border-right: 1px solid var(--border-subtle); display: flex;
  flex-direction: column; padding: 14px 10px; gap: 2px; overflow: hidden; }
.pp-side .brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px;
  border-bottom: 1px solid var(--border-subtle); margin-bottom: 8px; min-height: 34px; }
.pp-side .brand img.full { height: 22px; }
.pp-side .brand img.mark { height: 26px; width: 26px; object-fit: contain; display: none; cursor: pointer; }
.pp-side .brand .toggle { margin-left: auto; width: 24px; height: 24px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer; color: var(--fg-muted); flex-shrink: 0; }
.pp-side .brand .toggle:hover { background: var(--bg-soft); color: var(--fg-strong); }
.pp-shell.collapsed .pp-side .brand { justify-content: center; }
.pp-shell.collapsed .pp-side .brand img.full,
.pp-shell.collapsed .pp-side .brand .toggle { display: none; }
.pp-shell.collapsed .pp-side .brand img.mark { display: block; }

.pp-side .sec { font-weight: 700; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-subtle); padding: 13px 10px 5px; white-space: nowrap; }
.pp-side .sec .sec-short { display: none; }
.pp-shell.collapsed .pp-side .sec { text-align: center; font-size: 10px; letter-spacing: 0.08em;
  padding: 12px 0 4px; }
.pp-shell.collapsed .pp-side .sec .sec-full { display: none; }
.pp-shell.collapsed .pp-side .sec .sec-short { display: inline; }

.pp-link { font-family: var(--font-body); font-size: 13px; padding: 8px 10px; border-radius: 7px;
  color: var(--fg-muted); display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  white-space: nowrap; border: none; background: none; width: 100%; text-align: left; }
.pp-link:hover { background: var(--bg-soft); color: var(--fg-strong); }
.pp-link.active { background: var(--brand); color: #fff; }
.pp-link .ic { width: 17px; height: 17px; flex-shrink: 0; display: inline-flex; }
.pp-link .lbl { overflow: hidden; text-overflow: ellipsis; }
.pp-link .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-muted); color: var(--fg-muted); padding: 1px 7px; border-radius: 999px; }
.pp-link.active .count { background: rgba(255,255,255,0.22); color: #fff; }
.pp-shell.collapsed .pp-link { justify-content: center; padding: 8px 0; gap: 0; }
.pp-shell.collapsed .pp-link .lbl, .pp-shell.collapsed .pp-link .count { display: none; }
.pp-side .side-foot { font-size: 10.5px; color: var(--fg-subtle); padding: 8px 10px; white-space: nowrap; }
.pp-shell.collapsed .pp-side .side-foot { display: none; }

.pp-main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.pp-top { background: var(--surface); border-bottom: 1px solid var(--border-subtle); display: flex;
  align-items: center; justify-content: space-between; padding: 0 22px; height: 54px; flex-shrink: 0; }
.pp-top .crumbs { font-size: 13px; color: var(--fg-muted); display: flex; align-items: center; gap: 8px; }
.pp-top .crumbs strong { color: var(--fg-strong); font-weight: 600; }
.pp-top .crumbs .sep { color: var(--border); }
.pp-top .right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--fg-muted); }
.pp-top .role-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 11px;
  letter-spacing: 0.04em; padding: 5px 11px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  color: var(--fg-muted); }
.pp-top .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--nu-olive-300); color: #fff;
  display: flex; align-items: center; justify-content: center; }
.pp-body { flex: 1; min-height: 0; overflow: auto; }

.shell { max-width: 1280px; margin: 0 auto; padding: 24px 28px 60px; }

.masthead { display: flex; align-items: baseline; gap: 14px; margin-bottom: 4px; }
.masthead h1 { font-size: var(--fs-30); margin: 0; }
.masthead .tag { font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--tracking-wide);
  text-transform: uppercase; color: var(--brand); border: 1px solid var(--nu-olive-300);
  background: var(--nu-olive-100); border-radius: var(--radius-pill); padding: 3px 10px; }
.sub { color: var(--fg-muted); margin: 0 0 20px; }
.refresh-box { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; }
.refresh-at { font-size: 12px; color: var(--fg-subtle); font-family: var(--font-mono); }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; min-width: 260px; }
.search input { border: none; outline: none; font-family: var(--font-body); font-size: var(--fs-14); width: 100%; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius-pill); padding: 5px 12px; cursor: pointer;
  font-family: var(--font-body); font-size: 12.5px; font-weight: 700; color: var(--fg-muted); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .sw { width: 9px; height: 9px; border-radius: 2px; }
.count { margin-left: auto; color: var(--fg-subtle); font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: none; padding: 7px 14px; cursor: pointer; font-family: var(--font-body); font-weight: 700; font-size: 12.5px; background: var(--surface); color: var(--fg-muted); }
.seg button.on { background: var(--brand); color: #fff; }

/* Phase legend */
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 12px;
  font-size: 12px; color: var(--fg-muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* Board table */
.board { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(260px, 1.4fr) minmax(240px, 1.6fr) 130px 120px 110px;
  gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border-subtle); }
.row:last-child { border-bottom: none; }
.row.head { background: var(--bg-soft); font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fg-muted); padding: 9px 18px; }
.row.job:hover { background: var(--nu-grey-050); }
.row.group-h { border-bottom: none; }
.row.sub { padding-top: 6px; padding-bottom: 6px; background: var(--nu-grey-050); border-bottom: 1px solid var(--border-subtle); }
.row.sub:hover { background: var(--nu-olive-100); }
.row.sub + .row.job:not(.sub) { border-top: 1px solid var(--border-subtle); }
.batch-tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--gem-sapphire); background: #e6ebf5; border-radius: var(--radius-pill); padding: 1px 7px; }
.fx-tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #33517e; background: #e2ecf8; border: 1px solid var(--prod-nucoat);
  border-radius: var(--radius-pill); padding: 1px 7px; }
.draft-tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--warning); background: #fdf3d5; border-radius: var(--radius-pill); padding: 1px 7px; }
.sub-indent { padding-left: 40px; position: relative; }
.sub-indent::before { content: ''; position: absolute; left: 13px; top: -14px; bottom: 50%; width: 14px;
  border-left: 2px solid var(--nu-grey-300); border-bottom: 2px solid var(--nu-grey-300); border-bottom-left-radius: 8px; }

.jobid { display: flex; gap: 11px; align-items: center; min-width: 0; }
.fam-dot { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 12px; }
.jno { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.jmeta { font-size: 12px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jmeta b { color: var(--fg); font-weight: 700; }

/* Phase track */
.track { position: relative; height: 22px; }
.track-line { position: absolute; top: 50%; left: 5px; right: 5px; height: 3px; margin-top: -1.5px;
  background: var(--nu-grey-100); border-radius: 2px; }
.track-fill { position: absolute; top: 50%; left: 5px; height: 3px; margin-top: -1.5px; border-radius: 2px; }
.node { position: absolute; top: 50%; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--nu-grey-300); display: flex; align-items: center; justify-content: center; }
.node.reached { border-color: currentColor; background: currentColor; }
.node.lead { box-shadow: 0 0 0 3px rgba(137,146,94,0.25); }
.node svg { color: #fff; }

.phase-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.phase-badge .sw { width: 8px; height: 8px; border-radius: 2px; }
.qty { font-family: var(--font-mono); font-size: 12.5px; }
.due-d { font-size: 12.5px; }
.due-in { display: block; font-size: 11px; color: var(--fg-subtle); }
.due-in.warn { color: var(--warning); font-weight: 700; }
.due-in.bad { color: var(--danger); font-weight: 700; }
.stock-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  color: var(--nu-olive-700); background: var(--nu-olive-100); border-radius: var(--radius-pill); padding: 3px 9px; }
.stock-chip.none { color: var(--fg-subtle); background: var(--nu-grey-050); font-weight: 400; }

/* Orders view */
.order { border-bottom: 1px solid var(--border-subtle); }
.order-head { display: grid; grid-template-columns: minmax(220px, 1.3fr) 110px minmax(200px, 1.2fr) 120px;
  gap: 14px; align-items: center; padding: 12px 18px; cursor: pointer; }
.order-head:hover { background: var(--nu-grey-050); }
.order-lines { padding: 0 18px 12px 46px; }
.oline { display: grid; grid-template-columns: minmax(200px, 1.2fr) 70px minmax(180px, 1fr) 130px 110px; gap: 12px;
  align-items: center; padding: 8px 0; border-top: 1px dashed var(--border-subtle); font-size: 12.5px; }
.job-chip { display: inline-block; margin-right: 7px; font-family: var(--font-mono); font-size: 11px;
  font-weight: 700; color: var(--nu-grey-700); background: var(--nu-grey-050); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill); padding: 1px 8px; cursor: pointer; }
.job-chip:hover { border-color: var(--brand); color: var(--brand-hover); }
.src-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  border-radius: var(--radius-pill); padding: 1px 7px; }
.src-tag.src-allocated { background: var(--nu-olive-100); color: var(--nu-olive-700); }
.src-tag.src-planned { background: #daf1f3; color: var(--info); }
.src-tag.src-inferred { background: var(--nu-grey-100); color: var(--fg-muted); }
.status-pill { display: inline-block; font-size: 11px; font-weight: 700; border-radius: var(--radius-pill);
  padding: 2px 9px; background: var(--nu-grey-100); color: var(--fg-muted); }
.status-pill.Eligible { background: #e2f2e5; color: var(--success); }
.status-pill.Planned { background: var(--nu-olive-100); color: var(--nu-olive-700); }
.status-pill.New { background: #daf1f3; color: var(--info); }

.int-tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--nu-grey-700); background: var(--nu-grey-100);
  border: 1px solid var(--nu-grey-300); border-radius: var(--radius-pill); padding: 1px 7px; vertical-align: 1px; }

/* Drawer (job detail) — modeled on the concept's side drawer */
.scrim { position: fixed; inset: 0; background: rgba(26,26,26,0.32); opacity: 0; pointer-events: none;
  transition: opacity 220ms; z-index: 40; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 94vw); background: var(--surface);
  box-shadow: var(--shadow-md); transform: translateX(102%); transition: transform 260ms cubic-bezier(0.22,0.61,0.36,1);
  z-index: 41; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-h { padding: 20px 22px 16px; border-bottom: 1px solid var(--border-subtle); position: relative; }
.drawer-h .close { position: absolute; top: 14px; right: 14px; border: none; background: var(--nu-grey-050);
  border-radius: 7px; width: 30px; height: 30px; cursor: pointer; font-size: 15px; color: var(--fg-muted); }
.drawer-h .eyerow { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.drawer-h h2 { font-size: var(--fs-24); margin: 0 0 2px; }
.drawer-h .fam { font-size: 12.5px; color: var(--fg-muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 22px 20px; }
.drawer-sec { padding: 15px 0; border-bottom: 1px solid var(--border-subtle); }
.drawer-sec:last-child { border-bottom: none; }
.drawer-sec h4 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fg-muted); font-family: var(--font-body); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--fg-subtle); }
.kv dd { margin: 0; }
.kv dd.mono { font-family: var(--font-mono); font-size: 12.5px; }

.mile { position: relative; padding-left: 22px; }
.mile-item { position: relative; padding: 7px 0 7px 4px; font-size: 13px; color: var(--fg-subtle); }
.mile-item::before { content: ''; position: absolute; left: -18px; top: 13px; width: 10px; height: 10px;
  border-radius: 50%; border: 2px solid var(--nu-grey-300); background: var(--surface); }
.mile-item::after { content: ''; position: absolute; left: -13px; top: 25px; bottom: -7px; width: 2px; background: var(--nu-grey-100); }
.mile-item:last-child::after { display: none; }
.mile-item.done { color: var(--fg); }
.mile-item.done::before { border-color: var(--brand); background: var(--brand); }
.mile-item.now { color: var(--fg); font-weight: 700; }
.mile-item.now::before { border-color: var(--brand); background: var(--surface); box-shadow: var(--focus-ring); }
.mile-when { display: block; font-size: 11.5px; font-weight: 400; color: var(--fg-subtle); font-family: var(--font-mono); }

.linkrow { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--border-subtle);
  border-radius: 8px; margin-bottom: 7px; cursor: pointer; font-size: 12.5px; }
.linkrow:hover { background: var(--nu-grey-050); }
.linkrow .lr-id { font-family: var(--font-mono); font-weight: 700; }
.linkrow .lr-sub { color: var(--fg-subtle); margin-left: auto; }

.rcpt { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 5px 0;
  border-top: 1px dashed var(--border-subtle); }
.rcpt:first-of-type { border-top: none; }
.rcpt .r-qty { font-family: var(--font-mono); font-weight: 700; }
.rcpt.disposal { color: var(--fg-subtle); text-decoration: line-through; }

/* ---- Sales orders page (concept OrdersDashboard shape) ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 7px 14px 6px 17px; box-shadow: var(--shadow-xs); overflow: hidden; }
.stat .accent { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.stat .lbl { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted); }
.stat .num { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.2; display: inline; }
.stat .sub { font-size: 11px; color: var(--fg-subtle); display: inline; margin-left: 7px; }
.stat .sub.dn { color: var(--danger); font-weight: 700; }

.ord-grid { display: grid; grid-template-columns: minmax(300px, 370px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 1020px) { .ord-grid { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 16px 18px; }
.panel h3 { margin: 0; font-size: var(--fs-18); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.psub { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }
.panel .board { border-radius: var(--radius-md); box-shadow: none; }

.tally { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 700;
  font-size: 15px; color: var(--danger); background: #fadddf; border-radius: var(--radius-pill); padding: 3px 11px; }
.tally .d { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

.ord-issue { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--border-subtle); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; }
.ord-issue:hover { background: var(--nu-grey-050); }
.ord-issue-ic { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; background: #fadddf; color: var(--danger); }
.ord-issue-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ord-issue-type { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--danger); }
.ord-issue-oid { font-size: 11px; color: var(--fg-subtle); font-family: var(--font-mono); }
.ord-issue-msg { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }
.ord-issue-msg b { color: var(--fg); }
.ord-clear { display: flex; align-items: center; gap: 8px; color: var(--success); font-weight: 700;
  font-size: 13px; padding: 8px 0; }

.so-head { grid-template-columns: minmax(210px, 1.4fr) 80px 110px 115px 125px; }
.order.has-hold > .so-head { box-shadow: inset 3px 0 0 var(--danger); }
.ord-val { font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  border-radius: var(--radius-pill); padding: 3px 10px; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-danger { color: var(--danger); background: #fadddf; }
.badge-ok { color: var(--success); background: #e2f2e5; }

.hold-tag { display: inline-block; margin-left: 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--danger); background: #fadddf; border: 1px solid #f2b8bd;
  border-radius: var(--radius-pill); padding: 1px 7px; vertical-align: 1px; }
.oline.held { background: rgba(200, 16, 46, 0.04); border-radius: 6px;
  margin: 0 -8px; padding-left: 8px; padding-right: 8px; }

.empty, .loading, .error { padding: 40px; text-align: center; color: var(--fg-subtle); }
.error { color: var(--danger); }
.footnote { margin-top: 14px; font-size: 12px; color: var(--fg-subtle); }
