:root {
  --maroon: #8b2a38;
  --maroon-deep: #5c1a24;
  --grey: #5c6570;
  --grey-50: #f7f8fa;
  --ink: #16181b;
  --border: #d7dbe0;
  --card: #fff;
  --warn: #8a5a12;
  --ok: #1f7a3f;
  --err: #8b2a38;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --t-navy: #1e4d7b;
  --t-navy-deep: #12324f;
  --t-navy-soft: #e8f0f7;
  --t-teal: #0f7a6c;
  --t-teal-deep: #08564c;
  --t-teal-soft: #e6f5f2;
  --t-amber: #c47a12;
  --t-amber-deep: #8a5408;
  --t-amber-soft: #fbf1de;
  --t-indigo: #3d4a9a;
  --t-indigo-deep: #2a3270;
  --t-indigo-soft: #eceef8;
  --t-green: #2d7a3a;
  --t-green-deep: #1d5427;
  --t-green-soft: #e8f5ea;
  --t-purple: #6b3d8a;
  --t-purple-deep: #4a2860;
  --t-purple-soft: #f3eaf7;
  --t-orange: #c45c1a;
  --t-orange-deep: #8a3e10;
  --t-orange-soft: #fbe9de;
  --t-slate: #5d6b75;
  --t-slate-deep: #3e4a52;
  --t-slate-soft: #eef1f3;
  --header: #1c313a;
  --radius: 13px;
  --radius-sm: 9px;
  --interact: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease, color .15s ease, filter .15s ease;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: var(--font); color: var(--ink); background: #eef1f4; }
body { overflow-x: hidden; }
img { max-width: 100%; height: auto; }
a { color: var(--t-navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 0.35rem; font-weight: 650; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.05rem; }
.muted { color: var(--grey); font-size: 0.92rem; }
.hint { display: block; margin-top: 0.3rem; font-size: 0.82rem; color: var(--grey); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.module-kicker { margin: 0 0 0.25rem; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grey); }

.t-navy { --tint: var(--t-navy); --tint-deep: var(--t-navy-deep); --tint-soft: var(--t-navy-soft); }
.t-teal { --tint: var(--t-teal); --tint-deep: var(--t-teal-deep); --tint-soft: var(--t-teal-soft); }
.t-amber { --tint: var(--t-amber); --tint-deep: var(--t-amber-deep); --tint-soft: var(--t-amber-soft); }
.t-indigo { --tint: var(--t-indigo); --tint-deep: var(--t-indigo-deep); --tint-soft: var(--t-indigo-soft); }
.t-green { --tint: var(--t-green); --tint-deep: var(--t-green-deep); --tint-soft: var(--t-green-soft); }
.t-purple { --tint: var(--t-purple); --tint-deep: var(--t-purple-deep); --tint-soft: var(--t-purple-soft); }
.t-orange { --tint: var(--t-orange); --tint-deep: var(--t-orange-deep); --tint-soft: var(--t-orange-soft); }
.t-maroon { --tint: var(--maroon); --tint-deep: var(--maroon-deep); --tint-soft: #f3e8ea; }
.t-slate { --tint: var(--t-slate); --tint-deep: var(--t-slate-deep); --tint-soft: var(--t-slate-soft); }

.app-header {
  background: var(--header);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 8px 24px rgba(12, 24, 30, 0.18);
}
.app-header-inner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.9rem;
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%;
  background: #fff; display: grid; place-items: center; overflow: hidden;
}
.brand-mark img { width: 34px; height: 34px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 0.95rem; font-weight: 750; }
.brand-text small { font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.7); }

.top-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; flex: 1; }
.nav-btn, a.nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0.35rem 0.75rem; border: 0; border-radius: var(--radius-sm);
  background: var(--tint, #3d5a68); color: #fff; font: inherit; font-weight: 700; font-size: 0.8rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset; transition: var(--interact);
}
.nav-btn:hover, a.nav-btn:hover { filter: brightness(1.14); text-decoration: none; color: #fff; transform: translateY(-1px); }
.nav-btn.current, a.nav-btn.current { background: var(--tint-deep, #12324f); filter: none; transform: none; }

.header-right { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; flex-shrink: 0; }
.plant-switch select {
  min-height: 36px; min-width: 9.5rem; background: #0f2026; color: #fff;
  border: 1px solid #2a4550; border-radius: var(--radius-sm); padding: 0.25rem 0.5rem; font-weight: 650;
}
.user-chip { font-size: 0.8rem; color: rgba(255,255,255,0.88); font-weight: 600; max-width: 12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.user-chip:hover { color: #fff; text-decoration: underline; }
.logout-btn, .refresh-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0.35rem 0.8rem; border: 0; border-radius: var(--radius-sm);
  background: #0f2026; color: #fff; font: inherit; font-weight: 700; font-size: 0.8rem; text-decoration: none;
  cursor: pointer;
}
.logout-btn:hover, .refresh-btn:hover { background: #16333c; text-decoration: none; color: #fff; }
.menu-btn {
  display: none; min-height: 36px; padding: 0.35rem 0.75rem; border: 0; border-radius: var(--radius-sm);
  background: #fff; color: var(--header); font: inherit; font-weight: 750; cursor: pointer;
}

.content { padding: 1.05rem 1.35rem 2.25rem; max-width: 1360px; margin: 0 auto; width: 100%; }
.foot { padding: 0.8rem 1.5rem 1.4rem; color: var(--grey); font-size: 0.78rem; max-width: 1360px; margin: 0 auto; }
.foot-sep { margin: 0 0.35rem; }

.page-shell { display: flex; flex-direction: column; gap: 0.85rem; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  margin-bottom: 0.15rem; flex-wrap: wrap;
  padding: 0.85rem 1rem; background: #fff; border: 1px solid #e2e6ea;
  border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,32,0.04), 0 8px 22px rgba(16,24,32,0.035);
}
.page-head-main { min-width: min(100%, 18rem); flex: 1 1 16rem; }
.page-head .module-kicker { margin: 0 0 0.2rem; color: var(--t-teal); font-weight: 750; }
.page-head h1 { margin: 0; font-size: 1.38rem; letter-spacing: -0.01em; line-height: 1.25; }
.page-head-sub { margin: 0.35rem 0 0; max-width: 52rem; line-height: 1.45; }
.page-head-actions { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; margin-left: auto; }

.card {
  background: var(--card); border: 1px solid #e2e6ea; border-radius: var(--radius);
  padding: 0.95rem 1.05rem; margin-bottom: 0.9rem;
  box-shadow: 0 1px 2px rgba(16,24,32,0.04), 0 10px 24px rgba(16,24,32,0.03);
}
.card > h2:first-child { margin-top: 0; }
.card-elevated { box-shadow: 0 2px 4px rgba(16,24,32,0.05), 0 14px 32px rgba(16,24,32,0.06); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.85rem; margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.kpis, .stat-row {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.55rem; margin-bottom: 0.85rem;
}
.kpis a, .kpis article, .stat-row a, .stat-row article {
  display: block; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid #e2e6ea; border-radius: var(--radius); padding: 0.72rem 0.8rem;
  box-shadow: 0 1px 2px rgba(16,24,32,0.04); transition: var(--interact);
  border-top: 3px solid var(--tint, var(--t-teal));
}
.kpis a:hover, .stat-row a:hover {
  background: var(--tint-soft); border-color: var(--tint); transform: translateY(-2px); text-decoration: none;
  box-shadow: 0 8px 20px rgba(16,24,32,0.08);
}
.kpis span, .stat-row span {
  display: block; color: var(--tint, var(--t-teal)); font-size: 0.68rem; font-weight: 750;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.kpis strong, .stat-row strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.kpis em, .stat-row em { font-style: normal; display: block; color: var(--grey); font-size: 0.78rem; margin-top: 0.15rem; }
.kpis a.warn, .kpis article.warn, .stat-row a.warn, .stat-row article.warn { border-color: #e0c08a; background: #fff8ee; }
.kpis a.danger, .kpis article.danger, .stat-row a.danger, .stat-row article.danger { border-color: #e2c4c8; background: #f8eeee; }

.kpis a:nth-child(1), .kpis article:nth-child(1), .stat-row a:nth-child(1), .stat-row article:nth-child(1) { --tint: var(--t-navy); }
.kpis a:nth-child(2), .kpis article:nth-child(2), .stat-row a:nth-child(2), .stat-row article:nth-child(2) { --tint: var(--t-teal); }
.kpis a:nth-child(3), .kpis article:nth-child(3), .stat-row a:nth-child(3), .stat-row article:nth-child(3) { --tint: var(--t-amber); }
.kpis a:nth-child(4), .kpis article:nth-child(4), .stat-row a:nth-child(4), .stat-row article:nth-child(4) { --tint: var(--maroon); }
.kpis a:nth-child(5), .kpis article:nth-child(5), .stat-row a:nth-child(5), .stat-row article:nth-child(5) { --tint: var(--t-indigo); }
.kpis a:nth-child(6), .kpis article:nth-child(6), .stat-row a:nth-child(6), .stat-row article:nth-child(6) { --tint: var(--t-purple); }
.kpis a:nth-child(7), .kpis article:nth-child(7), .stat-row a:nth-child(7), .stat-row article:nth-child(7) { --tint: var(--t-green); }
.kpis a:nth-child(8), .kpis article:nth-child(8), .stat-row a:nth-child(8), .stat-row article:nth-child(8) { --tint: var(--t-orange); }

.table-wrap {
  overflow: auto; border: 1px solid #e2e6ea; border-radius: var(--radius); background: #fff;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 1px 2px rgba(16,24,32,0.03);
}
.table-wrap-scroll { max-height: min(72vh, 920px); }
.table-wrap table { margin: 0; min-width: 640px; border-collapse: separate; border-spacing: 0; }
.table-wrap thead th {
  position: sticky; top: 0; z-index: 3; background: #f4f7fa;
  box-shadow: inset 0 -1px 0 var(--border); border-bottom: 0;
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.48rem 0.55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--grey); font-weight: 700; background: #fafbfc; }
tbody tr:hover td { background: rgba(15, 122, 108, 0.035); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-warn { background: #fff8ee; }
.row-late { background: #f8eeee; }
.mono { font-variant-numeric: tabular-nums; font-weight: 650; }

.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: var(--grey-50); border: 1px solid var(--border);
  padding: 0.12rem 0.5rem; font-size: 0.76rem; border-radius: 999px;
  text-transform: capitalize; font-weight: 650; line-height: 1.35;
}
.badge-ok { background: #eef7f0; border-color: #b7dcc2; color: var(--ok); }
.badge-warn { background: #fff6e8; border-color: #f0ddb8; color: var(--warn); }
.badge-err { background: #f8eeee; border-color: #e2c4c8; color: var(--err); }
.badge-info { background: var(--t-navy-soft); border-color: #c5d6e6; color: var(--t-navy-deep); }
.badge-muted { background: var(--grey-50); color: var(--grey); }
.badge-rework {
  background: var(--t-orange-soft); border-color: #efc2a4; color: var(--t-orange-deep);
  text-transform: none; letter-spacing: 0.01em;
}

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  background: var(--header); color: #fff; border: 1px solid #13242b;
  padding: 0.48rem 0.95rem; cursor: pointer; font: inherit; font-weight: 700; text-decoration: none;
  border-radius: var(--radius-sm); transition: var(--interact); min-height: 38px;
}
.btn:hover { background: #2b4b58; text-decoration: none; color: #fff; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--t-navy-soft); color: var(--t-navy-deep); border-color: var(--t-navy); }
.btn-danger { background: var(--maroon); border-color: var(--maroon-deep); }
.btn-danger:hover { background: var(--maroon-deep); }
.btn-sm { padding: 0.26rem 0.62rem; font-size: 0.8rem; min-height: 30px; }
.btn-login { width: 100%; min-height: 46px; font-size: 1.05rem; background: var(--maroon); border-color: var(--maroon-deep); }
.btn-login:hover { background: var(--maroon-deep); }
.actions, .row-actions { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
form.inline { display: inline; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 0.28rem; font-size: 0.8rem; font-weight: 650; color: var(--grey); }
label.inline { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--ink); }
input, select, textarea {
  font: inherit; padding: 0.48rem 0.55rem; border: 1px solid var(--border); background: #fff;
  color: var(--ink); width: 100%; border-radius: var(--radius-sm); min-height: 38px;
}
textarea { min-height: 5.5rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--t-navy); box-shadow: 0 0 0 3px var(--t-navy-soft); }

.toolbar, .filter-bar {
  display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 0.85rem; padding: 0.7rem 0.85rem;
  background: #fff; border: 1px solid #e2e6ea; border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16,24,32,0.03);
}
.filter-bar input, .filter-bar select, .toolbar input, .toolbar select { min-width: 180px; min-height: 40px; }
.filter-bar .btn, .toolbar .btn { margin-bottom: 0; }
.toolbar-grow { flex: 1 1 14rem; min-width: 12rem; }
.toolbar-actions { margin-left: auto; display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

.form-actions {
  display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; align-items: center;
}
.form-actions.sticky {
  position: sticky; bottom: 0; z-index: 8;
  margin: 1rem -0.15rem -0.15rem; padding: 0.75rem 0.85rem;
  background: rgba(255,255,255,0.94); border-top: 1px solid #e2e6ea;
  backdrop-filter: blur(8px); box-shadow: 0 -8px 20px rgba(16,24,32,0.05);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.flash {
  padding: 0.7rem 0.9rem; margin-bottom: 0.85rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,32,0.04);
}
.flash-success, .flash-ok {
  background: #eef7f0; border-color: #b7dcc2; color: var(--ok);
  border-left: 4px solid var(--ok);
}
.flash-error {
  background: #f8eeee; border-color: #e2c4c8; color: var(--err);
  border-left: 4px solid var(--err);
}
.flash-warn, .flash-warning {
  background: #fff8ee; border-color: #e0c08a; color: var(--warn);
  border-left: 4px solid var(--warn);
}
.empty-state {
  text-align: center; padding: 2.4rem 1.2rem;
  border: 1px dashed #cfd6dd; border-radius: var(--radius); background: #fafbfc;
}
.empty-state strong { display: block; margin-bottom: 0.35rem; font-size: 1.05rem; }
.empty-state .muted { max-width: 34rem; margin: 0 auto; }

.dash-quick-links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.65rem; }
.dash-access-list { display: grid; gap: 0.35rem; margin: 0.55rem 0 0.85rem; }
.dash-access-list p { margin: 0; display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.35rem 0; border-bottom: 1px solid #eef1f4; }
.dash-access-list p:last-child { border-bottom: 0; }
.dash-access-list .muted { margin-top: 0.35rem; border: 0; display: block; }

.panel-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  margin: 0 0 0.55rem; flex-wrap: wrap;
}
.panel-title h2 { margin: 0; }

.bar-row { display: grid; grid-template-columns: 7.5rem 1fr 5rem; gap: 0.6rem; align-items: center; margin: 0.45rem 0; font-size: 0.9rem; }
.bar { height: 10px; background: #e6eaee; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--t-teal); border-radius: 99px; }
.bar.over > i { background: var(--maroon); }
.load-meta { color: var(--grey); font-size: 0.82rem; text-align: right; }

.auth-split { margin: 0; min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 42%) 1fr; background: #fff; }
.auth-left { display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.auth-left-inner { width: min(420px, 100%); }
.login-logo { height: 64px; width: auto; display: block; margin-bottom: 0.75rem; object-fit: contain; }
.login-kicker { margin: 0 0 1.1rem; color: var(--grey); font-size: 0.9rem; letter-spacing: 0.04em; }
.auth-meta { margin-top: 1.4rem; color: var(--grey); font-size: 0.8rem; }
.auth-right { position: relative; background: var(--maroon-deep); overflow: hidden; min-height: 100vh; }
.auth-right img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-right-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1.4rem 1.6rem;
  background: linear-gradient(transparent, rgba(92, 26, 36, 0.92)); color: #fff;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.auth-right-caption strong { letter-spacing: 0.12em; font-size: 1.05rem; }
.auth-right-caption span { opacity: 0.85; font-size: 0.88rem; }

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1rem; }
.check-grid label { flex-direction: row; align-items: center; color: var(--ink); font-size: 0.92rem; }

.nav-backdrop { display: none; }

@media (max-width: 1100px) {
  .kpis, .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .user-chip { display: none; }
}
@media (max-width: 900px) {
  .kpis, .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .form-grid, .check-grid { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-right { min-height: 220px; }
  .menu-btn { display: inline-flex; }
  .top-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: #14262d; padding: 0.6rem; flex-direction: column; align-items: stretch; z-index: 45; }
  body.nav-open .top-nav { display: flex; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 64px 0 0 0; background: rgba(8,16,20,0.35); z-index: 35; }
  .header-right .plant-switch select { min-width: 7.5rem; }
}
@media (max-width: 640px) {
  .content { padding: 0.9rem 0.75rem 1.5rem; }
  .kpis, .stat-row { grid-template-columns: 1fr 1fr; }
  .page-head { flex-direction: column; padding: 0.75rem 0.85rem; }
  .page-head-actions { margin-left: 0; width: 100%; }
  .toolbar, .filter-bar { padding: 0.65rem 0.7rem; }
  .table-wrap-scroll { max-height: min(68vh, 760px); }
}

.option-group {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.75rem 0.85rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}
.option-group legend {
  padding: 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--grey);
}
.option-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.option-list label {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  cursor: pointer;
}
.option-list label:has(input:checked) {
  border-color: var(--t-navy);
  background: var(--t-navy-soft);
  color: var(--t-navy-deep);
}
.option-list input { width: auto; margin: 0; }
.option-list label.is-locked { opacity: 0.55; cursor: not-allowed; background: #f3f5f7; }
@media (max-width: 900px) {
  .option-list { grid-template-columns: 1fr; }
}

.words { display: block; margin-top: 0.28rem; font-size: 0.8rem; color: var(--grey); font-weight: 550; }
.file-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  margin: 0.4rem 0.45rem 0 0; padding: 0.28rem 0.55rem;
  border: 1px solid var(--border); border-radius: 8px; background: #fafbfc; font-size: 0.85rem;
}

#lotTable input { min-width: 8rem; }
#lotTable .js-lot-run { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
#lotTable tr.lot-over td { background: #f8eeee; }
#lotTable tr.lot-over input[name="lot_qty[]"] {
  border-color: var(--err);
  background: #fdecee;
}
.winding-add {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.35rem;
}
.winding-add input { flex: 1; min-width: 0; }
.winding-add .btn { flex-shrink: 0; width: auto; }
.field-error {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--err);
}
.field-error[hidden] { display: none; }
label[hidden], [hidden] { display: none !important; }
.js-pdf-input.is-invalid {
  border-color: var(--err);
  background: #fdecee;
}

.field-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--ink);
  padding: 0.45rem 0 0.1rem;
  line-height: 1.35;
  min-height: 1.5em;
  user-select: text;
  -webkit-user-select: text;
}
.field-value .badge { font-weight: 650; }
.po-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.po-view input,
.po-view select,
.po-view textarea {
  background: var(--grey-50);
  color: var(--ink);
  cursor: default;
}
.po-view input:focus,
.po-view select:focus,
.po-view textarea:focus {
  outline: none;
  box-shadow: none;
  border-color: var(--border);
}


.nav-drop { position: relative; display: inline-flex; align-items: center; }
.nav-drop-btn::after {
  content: "";
  display: inline-block;
  margin-left: 0.4rem;
  border: 4px solid transparent;
  border-top-color: currentColor;
  border-bottom-width: 0;
  transform: translateY(2px);
}
.nav-drop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 15.75rem;
  padding: 0.35rem;
  background: #0f2026;
  border: 1px solid #2a4550;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(8, 16, 20, 0.35);
  z-index: 50;
  flex-direction: column;
  gap: 0.12rem;
}
@media (min-width: 901px) {
  .nav-drop:hover .nav-drop-menu,
  .nav-drop.open .nav-drop-menu,
  .nav-drop:focus-within .nav-drop-menu {
    display: flex;
  }
}
.nav-drop-label {
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 0.4rem 0.55rem 0.12rem;
}
.nav-drop-item {
  display: block;
  padding: 0.42rem 0.6rem;
  border-radius: 7px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.nav-drop-item:hover { background: #1a3540; text-decoration: none; color: #fff; }
.nav-drop-item.current { background: var(--t-green-deep); color: #fff; }
.nav-drop-indigo .nav-drop-item.current { background: var(--t-indigo-deep); color: #fff; }
@media (max-width: 900px) {
  .nav-drop { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
  .nav-drop > .nav-btn { width: 100%; justify-content: center; }
  .nav-drop-menu {
    position: static;
    display: none;
    box-shadow: none;
    margin-top: 0.25rem;
    min-width: 0;
    width: 100%;
  }
  .nav-drop.open .nav-drop-menu { display: flex; }
}

.po-view.po-design .js-design-unlock {
  background: #fff;
  color: var(--ink);
  cursor: text;
}
.po-view.po-design select.js-design-unlock { cursor: pointer; }
.po-view.po-design .js-design-unlock:focus {
  outline: none;
  border-color: var(--t-navy);
  box-shadow: 0 0 0 3px var(--t-navy-soft);
}
.row-actions .hint { margin: 0; max-width: 16rem; }

.po-docs { margin: 1rem 0; }
.po-docs .doc-add {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.po-docs .cat-ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  align-items: center;
  margin: 0.45rem 0 0.65rem;
}
.po-docs .cat-ticks label.inline {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.9rem;
}
.po-docs .cat-ticks input[type="checkbox"] { width: auto; margin: 0; }
.po-view .po-docs input,
.po-view .po-docs select,
.po-view .po-docs textarea {
  background: #fff;
  color: var(--ink);
  cursor: text;
}
.po-view .po-docs input[type="checkbox"],
.po-view .po-docs input[type="file"],
.po-view .po-docs button { cursor: pointer; }
.po-view .po-docs input:focus,
.po-view .po-docs textarea:focus {
  outline: none;
  border-color: var(--t-navy);
  box-shadow: 0 0 0 3px var(--t-navy-soft);
}

.money-row { display: flex; gap: 0.4rem; align-items: stretch; }
.money-row input { flex: 1; min-width: 0; }
.money-row select { width: auto; min-width: 10.5rem; flex: 0 0 11rem; }
.ap-view.ap-later .js-later-unlock,
.ap-view.ap-admin-step2 .js-step2-unlock {
  background: #fff;
  color: var(--ink);
  cursor: text;
}
.ap-view.ap-later select.js-later-unlock,
.ap-view.ap-admin-step2 select.js-step2-unlock { cursor: pointer; }
.ap-view.ap-later .js-later-unlock:focus,
.ap-view.ap-admin-step2 .js-step2-unlock:focus {
  outline: none;
  border-color: var(--t-navy);
  box-shadow: 0 0 0 3px var(--t-navy-soft);
}
.po-view .js-receive-date,
.ap-view .js-receive-date {
  background: #fff;
  color: var(--ink);
  cursor: text;
}
.po-view .js-receive-date:focus,
.ap-view .js-receive-date:focus {
  outline: none;
  border-color: var(--t-navy);
  box-shadow: 0 0 0 3px var(--t-navy-soft);
}
.ap-step-kicker { margin: 0 0 0.45rem; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--grey); font-weight: 750; }

.ap-details-prompt p { margin: 0.4rem 0 0.85rem; }

.ap-remain { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.55rem; }
.ap-remain .file-chip strong { font-variant-numeric: tabular-nums; }
.stock-block { margin-bottom: 1rem; }
.stock-totals td, .stock-totals th { white-space: nowrap; }
.stock-totals tfoot td { border-top: 2px solid var(--border); background: #fafbfc; }
.stock-grand-note { margin: 0.55rem 0 0; }

.hint-alarm {
  display: block;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  background: #f8eeee;
  border: 1px solid #e2c4c8;
  color: var(--err);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 650;
}


/* Amorphous purchase list — use-status row colors */
.ap-list-table tbody tr.ap-row-planning { background: #f3f4f6; }
.ap-list-table tbody tr.ap-row-manufacturer { background: #fff8e1; }
.ap-list-table tbody tr.ap-row-transit { background: #e3f2fd; }
.ap-list-table tbody tr.ap-row-received { background: #e6f6ea; }
.ap-list-table tbody tr.ap-row-stage-partial { background: #e3f2fd; }
.ap-list-table tbody tr.ap-row-stage-full { background: #bbdefb; }
.ap-list-table tbody tr.ap-row-phys-partial { background: #f3e5f5; }
.ap-list-table tbody tr.ap-row-phys-full { background: #e1bee7; }
.ap-list-table tbody tr.ap-row-moved { background: #fff3e0; }
.ap-list-table tbody tr.ap-row-consumed { background: #ffcdd2; }
.ap-list-table tbody tr.ap-row-planning:hover { background: #e8eaed; }
.ap-list-table tbody tr.ap-row-manufacturer:hover { background: #ffecb3; }
.ap-list-table tbody tr.ap-row-transit:hover { background: #d0e7fa; }
.ap-list-table tbody tr.ap-row-received:hover { background: #d5efdc; }
.ap-list-table tbody tr.ap-row-stage-partial:hover { background: #d0e7fa; }
.ap-list-table tbody tr.ap-row-stage-full:hover { background: #a6d0f4; }
.ap-list-table tbody tr.ap-row-phys-partial:hover { background: #e8d5ef; }
.ap-list-table tbody tr.ap-row-phys-full:hover { background: #d3a9df; }
.ap-list-table tbody tr.ap-row-moved:hover { background: #ffe0b8; }
.ap-list-table tbody tr.ap-row-consumed:hover { background: #efb4bb; }
.ap-list-table tbody tr .row-actions .btn-ghost {
  background: #fff;
  color: var(--ink);
}
.ap-list-table tbody tr .row-actions .btn-danger {
  background: var(--maroon);
  color: #fff;
  border-color: var(--maroon-deep);
}
.ap-list-table tbody tr .row-actions .btn:not(.btn-ghost):not(.btn-danger) {
  background: var(--header);
  color: #fff;
  border-color: #13242b;
}
.ap-list-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
}
.ap-legend-chip {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 650;
}
.ap-legend-note { flex: 1 1 100%; margin: 0.15rem 0 0; }

.ap-list-section { margin-bottom: 1.1rem; }
.ap-list-section h2 { margin: 0 0 0.35rem; }
.ap-list-section h3.ap-list-unit { margin: 0.85rem 0 0.4rem; font-size: 1rem; }
.ap-sec-unapproved { border-left: 4px solid #c0a060; background: #fffbf0; }
.ap-sec-approved-planning { border-left: 4px solid #fb8c00; background: #fff8f0; }
.ap-sec-in-transit { border-left: 4px solid #42a5f5; }
.ap-sec-received { border-left: 4px solid #43a047; background: #f3faf4; }
.ap-sec-opened { border-left: 4px solid #5c6bc0; }
.ap-sec-consumed { border-left: 4px solid #e53935; background: #fff5f5; }
.ap-track-checks { display: flex; flex-wrap: wrap; gap: 0.75rem 1.1rem; margin-top: 0.35rem; }
.ap-track-checks .ap-check { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 650; }


/* Amorphous unified stock pivot */
.stock-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; margin-bottom: 0.65rem; }
.stock-search { display: flex; align-items: center; gap: 0.4rem; }
.stock-search input { min-width: 14rem; padding: 0.35rem 0.55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stock-toolbar-actions { margin-left: auto; display: flex; gap: 0.35rem; }
.stock-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.55rem; align-items: center; margin: 0 0 0.75rem; }
.stock-legend .chip { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 999px; }
.chip-preplan { background: #fffde7; color: #f57f17; border: 1px solid #ffe082; }
.chip-plan { background: #f3f4f6; color: #374151; }
.chip-transit { background: #e3f2fd; color: #1565c0; }
.chip-phys { background: #e8f5e9; color: #2e7d32; }
.chip-stage { background: #ede7f6; color: #5e35b1; }
.stock-pivot-wrap { max-height: min(70vh, 720px); overflow: auto; }
.stock-pivot thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; box-shadow: 0 1px 0 var(--border); }
.stock-pivot .stock-label-col { min-width: 14rem; white-space: nowrap; }
.stock-pivot .stock-unit-row td { background: #eef2ff; font-weight: 650; border-top: 2px solid #c7d2fe; }
.stock-pivot .stock-unit-total td { background: #f3f4f6; }
.stock-pivot .stock-grand-row td { background: #e5e7eb; font-weight: 750; border-top: 2px solid var(--border); }
.stock-pivot .stock-indent { padding-left: 1.6rem; }
.stock-pivot .stock-indent-2 { padding-left: 3rem; color: #4b5563; }
.stock-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; margin-right: 0.35rem;
  border: 1px solid #93c5fd; border-radius: 0.25rem; background: #eff6ff;
  color: #1d4ed8; font-weight: 800; line-height: 1; cursor: pointer; vertical-align: middle;
}
.stock-toggle-sm { width: 1.15rem; height: 1.15rem; font-size: 0.75rem; }
.stock-toggle-spacer { display: inline-block; width: 1.35rem; margin-right: 0.35rem; }
.stock-party-count { margin-left: 0.4rem; font-size: 0.75rem; }
.stock-pivot td.col-preplan { background: rgba(255, 249, 196, 0.65); }
.stock-pivot td.col-plan { background: rgba(243, 244, 246, 0.55); }
.stock-pivot td.col-transit { background: rgba(227, 242, 253, 0.55); }
.stock-pivot td.col-phys { background: rgba(232, 245, 233, 0.55); }
.stock-pivot td.col-stage { background: rgba(237, 231, 246, 0.55); }
.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.82rem; }

.stock-pivot .stock-totals-row td { background: #f3f4f6; }
.stock-pivot .stock-grand-row td { background: #e5e7eb; font-weight: 750; }
.stock-pivot td.num:empty { color: transparent; }

/* Interfactory subsequent (child) lots — italic for clarity next to mother */
.ap-child-lot { font-style: italic; }
.ap-lot-rel { font-size: 0.78rem; margin-top: 0.15rem; font-weight: 500; }
.ap-lot-rel a { font-weight: 600; }

/* Stage Inspection — balance available under planned qty */
.si-bal-avail {
  display: block;
  margin-top: 0.35rem;
  color: #b42318;
  font-weight: 700;
  font-size: 0.9rem;
}
.si-bal-avail strong { font-weight: 800; }

/* Stage Inspection list — Pass / Fail / Canceled whole-row tint */
tr.si-row-pass { background: #e6f6ea; }
tr.si-row-pass:hover { background: #d5efdc; }
tr.si-row-fail,
tr.si-row-canceled { background: #fde8ea; }
tr.si-row-fail:hover,
tr.si-row-canceled:hover { background: #f8d4d8; }

/* Amorphous core production — physical balance under Material kg */
.cp-phys-bal {
  display: block;
  margin-top: 0.35rem;
  color: #b91c1c;
  font-weight: 600;
  font-size: 0.9rem;
}
.cp-phys-bal strong { font-weight: 800; }
.cp-lot-label { white-space: nowrap; max-width: 28rem; overflow: hidden; text-overflow: ellipsis; }
.cp-place-optional { opacity: 0.92; }

/* Core / tank production list — progress row tint */
tr.cp-row-complete { background: #e6f6ea; }
tr.cp-row-complete:hover { background: #d5efdc; }
tr.cp-row-inprod { background: #fff4e5; }
tr.cp-row-inprod:hover { background: #ffe8cc; }
.cp-bal-num { color: #b91c1c; font-weight: 800; }


/* Amorphous core production — daily calendar */
.cp-cal-place-filter { font-weight: 700; }
.cp-cal-place-filter select { min-width: 14rem; }
.cp-cal-wrap { overflow: hidden; }
.cp-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.cp-cal-title { margin: 0; text-align: center; flex: 1; font-size: 1.15rem; }
.cp-cal-filter-note { margin: 0 0 0.7rem; font-size: 0.85rem; }
.cp-cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}
.cp-cal-head {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--grey);
  padding: 0.2rem 0;
}
.cp-cal-cell {
  min-height: 5.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 0.28rem 0.32rem 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}
a.cp-cal-cell:hover { text-decoration: none; border-color: var(--t-amber); }
.cp-cal-cell.is-out { visibility: hidden; border-color: transparent; background: transparent; min-height: 0; padding: 0; }
.cp-cal-dd { font-size: 0.72rem; color: var(--grey); font-weight: 600; line-height: 1; }
.cp-cal-chips {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 0.12rem;
  margin-top: 0.22rem;
  min-width: 0;
}
.cp-cal-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
  padding: 0.04rem 0.18rem;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.06);
}
.cp-cal-sets { display: none; }
.cp-cal-cell.has-prod { background: var(--t-amber-soft); }
.cp-cal-cell.is-today { box-shadow: 0 0 0 2px var(--t-amber); }
.cp-cal-cell.is-selected { box-shadow: 0 0 0 2px var(--t-navy); }
.cp-cal-month-total { margin: 0.85rem 0 0; font-size: 0.98rem; }
@media (max-width: 720px) {
  .cp-cal { gap: 0.22rem; }
  .cp-cal-cell { min-height: 4.8rem; padding: 0.16rem 0.16rem 0.22rem; }
  .cp-cal-chip { font-size: 10px; }
  .cp-cal-head { font-size: 0.65rem; }
  .cp-cal-nav { flex-wrap: wrap; justify-content: center; }
}

#apExtractNote { display:block; margin-top:0.35rem; font-size:0.88rem; color:var(--grey); }
body.ap-po-print { background:#fff; }

.ap-coil-table { width:100%; border-collapse:collapse; }
.ap-coil-table th, .ap-coil-table td { border:1px solid var(--border); padding:0.28rem 0.4rem; }
.ap-coil-table input, .ap-coil-table select { width:100%; min-width:4.5rem; font-size:16px; }
.ap-coil-live { display:flex; gap:1.75rem; flex-wrap:wrap; align-items:baseline; margin:0.4rem 0 0.7rem; font-size:1rem; }
.ap-coil-live strong { font-variant-numeric: tabular-nums; }
.ap-coil-eq-under { color:#16181b; }
.ap-coil-eq-ok { color:#15803d; }
.ap-coil-eq-over { color:#b91c1c; }
#apGradeAddWrap { margin-top:0.6rem; }
#apCoilScan { font-size:16px; padding:0.45rem 0.6rem; width:100%; max-width:24rem; }

.ppic-mod-card {
  margin-top: 0.85rem; border: 1px solid #d9e2ea; background: linear-gradient(180deg, #f8fbfd 0%, #fff 42%);
}
.ppic-mod-card h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.ppic-mod-card > .muted { margin-top: 0; }
.ppic-mod-bulk { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.45rem 0 0.65rem; }
.ppic-mod-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.88rem; min-width: 480px; }
.ppic-mod-table th, .ppic-mod-table td { padding: 0.38rem 0.55rem; border-bottom: 1px solid #e7ebef; }
.ppic-mod-table thead th {
  background: #eef3f7; color: var(--t-slate-deep); position: sticky; top: 0; z-index: 2;
}
.ppic-mod-table th:not(:first-child),
.ppic-mod-table td:not(:first-child) { text-align: center; width: 5rem; }
.ppic-mod-table input[type="radio"] {
  width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--t-teal); cursor: pointer;
}
.ppic-mod-table input[type="radio"]:disabled { cursor: not-allowed; opacity: 0.7; }
.ppic-mod-table tr.ppic-mod-section td {
  background: var(--header); color: #fff;
  font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 750;
  padding-top: 0.55rem; padding-bottom: 0.45rem; border-bottom-color: transparent;
}
.ppic-mod-table tr.ppic-mod-section td strong { color: #fff; font-weight: 750; }
.ppic-mod-table td.ppic-mod-label { padding-left: 1.05rem; font-weight: 650; color: var(--ink); }
.ppic-mod-table tbody tr:not(.ppic-mod-section):hover td { background: var(--t-teal-soft); }
.ppic-mod-table tbody tr:not(.ppic-mod-section) td:has(input:checked) {
  background: rgba(15, 122, 108, 0.08);
}
.ppic-mod-wrap { max-height: min(58vh, 560px); }
.users-list-wrap { margin-top: 0.15rem; }
.users-list-wrap .table-wrap { max-height: none; }

.ap-list-toolbar .toolbar-grow input { width: 100%; }
.ap-list-section {
  margin-bottom: 1rem; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16,24,32,0.04), 0 10px 24px rgba(16,24,32,0.03);
}
.ap-list-section > h2 { display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.25rem; }
.ap-list-section > .muted { margin: 0 0 0.7rem; }
.ap-list-section .table-wrap { max-height: min(52vh, 640px); border-color: #dde3e8; }
.ap-list-unit {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin: 0.85rem 0 0.45rem; padding: 0.2rem 0.55rem;
  background: var(--t-green-soft); color: var(--t-green-deep);
  border-radius: 999px; font-size: 0.86rem; font-weight: 750;
}

.ap-stage-lock { color: #b45309; background: #fff7ed; border: 1px solid #fdba74; padding: 0.55rem 0.7rem; border-radius: 6px; }
.ap-eta-auto { color: #c2410c; font-weight: 650; }
.ap-recv-banner { background: #ecfdf3; color: #166534; border: 1px solid #86efac; padding: 0.55rem 0.75rem; border-radius: 6px; font-weight: 650; }
.ap-stage-card h2 { margin-top: 0.15rem; }


/* Amorphous plan / stage redesign */
.ap-stage-done { background: #f0fdf4; border-color: #86efac; }
.ap-stage-partial { background: #fffbeb; border-color: #fcd34d; }
.ap-coil-need-msg { color: #b91c1c !important; background: #fef2f2 !important; border-color: #fca5a5 !important; }
.ap-hide-global-recv { display: none !important; }
.ap-eta-auto { color: #c2410c; font-weight: 600; }


/* Amorphous plan flow: quiet Identity card */
.ap-identity-compact h2 { font-size: 0.95rem; color: #6b7280; }
.ap-identity-compact .form-grid label:not(:has(.mono)) .hint { display: none; }
.ap-identity-compact { opacity: 0.92; }
.ap-stage-partial { border-color: #fbbf24; background: #fffbeb; }


/* Coil chart: received vs pending tables */
.ap-coil-split { margin-top: 0.9rem; }
.ap-coil-split-head { margin: 0 0 0.35rem; font-size: 0.95rem; }
.ap-coil-table-recv { background: #e8f5e9; }
.ap-coil-table-recv thead th { background: #c8e6c9; }
.ap-coil-table-recv tbody tr { background: #e8f5e9; }
.ap-coil-table-recv tbody tr:nth-child(even) { background: #dff0e1; }
.ap-coil-split.ap-coil-table-recv { border: 1px solid #a5d6a7; border-radius: 8px; padding: 0.6rem 0.75rem 0.75rem; background: #f1f8f2; }
.ap-coil-split.ap-coil-table-pending { border: 1px solid var(--border, #ddd); border-radius: 8px; padding: 0.6rem 0.75rem 0.75rem; }

/* Partially received lot (purchase list) */
.ap-list-table tbody tr.ap-row-partial-recv { background: #ffe0b2; }
.ap-list-table tbody tr.ap-row-partial-recv:hover { background: #ffcc80; }
.ap-badge-partial-recv {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #ef6c00;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.stock-pivot tr.stock-partial-recv > td { background: #ffe0b2 !important; }
.chip-partial { background: #ffe0b2; color: #e65100; border: 1px solid #ffb74d; }

.ap-list-table tbody tr.ap-row-preplan { background: #fffde7; }
.ap-list-table tbody tr.ap-row-preplan:hover { background: #fff9c4; }
.ap-legend-chip.ap-row-preplan { background: #fffde7; color: #f57f17; }


/* PO family / deferment */
.po-additional-badge { background: #e8eefc; border-color: #b7c6ef; color: #2a3270; margin-left: 0.35rem; }
.po-child-row td:first-child { padding-left: 1.25rem; }
.po-indent { color: var(--t-indigo); font-weight: 700; margin-right: 0.2rem; }
.po-child-line { margin-top: 0.2rem; font-size: 0.92em; }
.po-deferred-row { background: #fff8e8; }
.po-bucket-deferred { color: #8a5a00; }
.po-bucket-completed { color: var(--ok); }
.po-bucket-production { color: var(--t-navy-deep); }
.po-position-matrix th { white-space: nowrap; font-size: 0.85rem; }
.po-position-matrix td { vertical-align: top; font-size: 0.9rem; }

/* Amorphous allocation report */
.aa-banner {
  background: #434343;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.aa-section-title {
  background: #3c78d8;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
}
.aa-sec-bti .aa-section-title { background: #38761d; }
.aa-report-table { font-family: Verdana, Segoe UI, sans-serif; font-size: 0.78rem; width: 100%; }
.aa-report-table th {
  background: #d9e1f2;
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.aa-sec-bti .aa-report-table th { background: #d9ead3; }
.aa-report-table td { vertical-align: top; }
.aa-report-table tr.aa-shifted td { background: #fff2cc; }
.aa-report-table td.aa-late,
.aa-report-table td.aa-shortage {
  background: #f8cecc !important;
  color: #cc0000;
  font-weight: 700;
}
.aa-sub { font-size: 0.7rem; color: #666; }
.aa-table-wrap { max-height: min(70vh, 900px); overflow: auto; }

/* Help centre */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.help-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.help-card:hover { box-shadow: 0 4px 14px rgba(22,24,27,0.08); border-color: #9eb6d4; }
.help-video-list { list-style: none; padding: 0; margin: 0; }
.help-video-list li { padding: 0.65rem 0; border-bottom: 1px solid #e8ecf0; }

/* Admin View as (impersonation for testing) */
.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.85rem;
  background: #fff3cd;
  border: 1px solid #e0c08a;
  border-left: 4px solid var(--warn, #b78103);
  border-radius: var(--radius);
  color: #7a5b00;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16,24,32,0.04);
}
.view-as-banner-text { flex: 1 1 auto; min-width: 12rem; }
.view-as-exit-form { margin: 0; flex: 0 0 auto; }
.view-as-form.inline-form { display: inline; margin: 0; }
.row-actions .view-as-form { display: inline-flex; }
