:root {
  --bg: #eef2f4;
  --panel: #ffffff;
  --panel-soft: #f7f9fa;
  --ink: #172025;
  --muted: #64727a;
  --line: #d9e0e4;
  --accent: #087c7b;
  --accent-dark: #075f5e;
  --accent-soft: #e2f4f2;
  --warning: #9b641b;
  --warning-soft: #fff2dc;
  --danger: #aa3d3d;
  --danger-soft: #ffe9e9;
  --ok: #1d7a4d;
  --ok-soft: #e7f5ec;
  --shadow: 0 14px 40px rgba(23, 32, 37, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* BOM cost workspace */
.bom-cost-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, .7fr) minmax(260px, 1.4fr) minmax(220px, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 18px;
}

.bom-cost-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted, #66736d);
  font-size: 12px;
  font-weight: 650;
}

.bom-cost-controls input,
.bom-cost-controls select {
  width: 100%;
}

.bom-cost-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.bom-cost-metrics article {
  display: grid;
  gap: 7px;
  min-height: 116px;
  padding: 18px 20px;
  border: 1px solid rgba(25, 80, 65, .11);
  border-radius: 16px;
  background: linear-gradient(145deg, #fff 20%, #f4faf7);
  box-shadow: 0 8px 24px rgba(24, 65, 54, .05);
}

.bom-cost-metrics span,
.bom-cost-metrics small {
  color: var(--muted, #66736d);
}

.bom-cost-metrics strong {
  color: #123f34;
  font-size: clamp(22px, 2vw, 31px);
  letter-spacing: -.03em;
}

.bom-cost-panel {
  padding: 0;
  overflow: hidden;
}

.bom-cost-table-head,
.bom-cost-row {
  display: grid;
  grid-template-columns: minmax(290px, 2.1fr) minmax(58px, .4fr) minmax(112px, .7fr) minmax(112px, .66fr) minmax(118px, .78fr) minmax(100px, .6fr) minmax(178px, .9fr);
  gap: 8px;
  align-items: center;
}

.bom-cost-table-head {
  min-height: 36px;
  padding: 7px 12px;
  color: #718079;
  background: #f3f7f5;
  border-bottom: 1px solid #dfe8e3;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
}

.bom-cost-row {
  min-height: 42px;
  padding: 4px 12px;
  border-bottom: 1px solid #edf1ef;
  background: #fff;
  font-size: 12px;
}

.bom-cost-row:hover { background: #f8fbfa; }
.bom-cost-row.assembly { background: #fbfdfc; }
.bom-cost-row.assembly > strong { color: #0c6b57; }
.bom-cost-row.excluded { opacity: .58; background: #f7f8f7; }

.bom-cost-name {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding-left: calc(var(--bom-cost-depth) * 18px);
}

.bom-cost-name > button {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 1px solid #cfddd7;
  border-radius: 7px;
  color: #176956;
  background: #fff;
  cursor: pointer;
}

.bom-cost-toggle-spacer { flex: 0 0 22px; }
.bom-cost-name-copy { display: flex; align-items: baseline; min-width: 0; gap: 7px; white-space: nowrap; }
.bom-cost-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bom-cost-name small { flex: 1 1 auto; overflow: hidden; color: #7a8781; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.bom-cost-price-input {
  display: flex;
  align-items: center;
  max-width: 140px;
  border: 1px solid #cfdcd6;
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.bom-cost-price-input span { padding-left: 9px; color: #77847e; }
.bom-cost-price-input input { width: 100%; min-width: 0; padding: 5px 7px 5px 3px; border: 0; outline: 0; background: transparent; font-size: 12px; }
.bom-cost-price-input:focus-within { border-color: #19856e; box-shadow: 0 0 0 3px rgba(25, 133, 110, .1); }
.bom-cost-rollup { color: #738079; font-size: 12px; }
.bom-cost-leaf-label { color: #87928d; font-size: 11px; }
.bom-cost-valuation-select {
  width: 118px;
  height: 28px;
  padding: 2px 22px 2px 7px;
  border: 1px solid #cfddd7;
  border-radius: 8px;
  color: #3e5d53;
  background: #fff;
  font-size: 11px;
}
.bom-cost-source { overflow: hidden; color: #64726c; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.bom-cost-source.manual { color: #8a5a16; }
.bom-cost-source.missing { color: #ad4f43; }

.bom-cost-domestic {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.bom-cost-domestic.domestic { color: #08705a; background: #e4f5ee; }
.bom-cost-domestic.partial { color: #67520b; background: #fff6c9; }
.bom-cost-domestic.imported { color: #89521a; background: #fff0dd; }
.bom-cost-domestic.unknown { color: #6d7772; background: #edf1ef; }
.bom-cost-domestic-editor { display: inline-flex; align-items: center; gap: 5px; }
.bom-cost-domestic-select {
  width: 88px;
  height: 28px;
  padding: 2px 24px 2px 8px;
  border: 1px solid #cfddd7;
  border-radius: 999px;
  color: #4f5f58;
  background-color: #f7faf8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.bom-cost-domestic-select.domestic { color: #08705a; border-color: #b9dfd1; background-color: #e4f5ee; }
.bom-cost-domestic-select.partial { color: #67520b; border-color: #e5d278; background-color: #fff6c9; }
.bom-cost-domestic-select.imported { color: #89521a; border-color: #efd1aa; background-color: #fff0dd; }
.bom-cost-domestic-select:disabled { cursor: wait; opacity: .65; }
.bom-cost-domestic-rate { display: inline-flex; align-items: center; width: 66px; height: 28px; border: 1px solid #e5d278; border-radius: 8px; background: #fffdf0; overflow: hidden; }
.bom-cost-domestic-rate input { width: 45px; min-width: 0; padding: 3px 2px 3px 6px; border: 0; outline: 0; color: #67520b; background: transparent; font-size: 11px; }
.bom-cost-domestic-rate span { color: #806d28; font-size: 11px; }
.bom-cost-footnote { margin: 12px 2px 0; color: #75817b; font-size: 12px; line-height: 1.6; }

@media (max-width: 1500px) {
  .bom-cost-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bom-cost-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bom-cost-panel { overflow-x: auto; }
  .bom-cost-table-head, .bom-cost-row { min-width: 960px; }
}

@media (max-width: 720px) {
  .bom-cost-controls, .bom-cost-metrics { grid-template-columns: 1fr; }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-size: 11px;
}

html.modal-scroll-locked,
body.modal-scroll-locked {
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input,
select {
  max-width: 100%;
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 14px 12px 330px;
  background: #142226;
  color: #edf7f7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  color: #0f2225;
  background: #8be0d8;
  font-weight: 800;
}

.brand-name {
  font-size: 13px;
  font-weight: 760;
}

.brand-subtitle {
  color: #9fb3b7;
  font-size: 10px;
  margin-top: 2px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(100vh - 416px);
  margin-top: 18px;
  padding-bottom: 8px;
  overflow-y: auto;
}

.nav-group {
  display: block;
  border-radius: 8px;
}

.nav-group > summary {
  display: flex;
  min-height: 26px;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  color: #82999d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group > summary::after {
  content: "›";
  color: #789094;
  font-size: 16px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.nav-group[open] > summary::after {
  transform: rotate(90deg);
}

.nav-group:has(.nav-item.active) > summary {
  color: #a9ddd8;
}

.nav-group-items {
  display: grid;
  gap: 3px;
  padding: 1px 0 5px 5px;
}

.nav-group-items .nav-item {
  min-height: 27px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  color: #cddbdd;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-badge {
  display: inline-grid;
  flex: 0 0 auto;
  box-sizing: border-box;
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  border: 2px solid #203735;
  color: #ffffff;
  background: #ff3b30;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.nav-badge[hidden] {
  display: none;
}

.nav-icon {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: #91ddd5;
}

.sidebar-footer {
  position: fixed;
  left: 12px;
  bottom: 14px;
  z-index: 30;
  display: grid;
  gap: 8px;
  width: 184px;
  max-height: calc(100vh - 28px);
  margin-top: 0;
  overflow-y: auto;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #c7d5d8;
  font-size: 10px;
}

.role-switcher {
  display: grid;
  gap: 4px;
  color: #8ea2a6;
}

.role-select {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 26px 0 8px;
  border: 1px solid rgba(145, 221, 213, 0.28);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23edf8f7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  color: #edf8f7;
  font: inherit;
  font-weight: 700;
}

.role-select option {
  color: #142023;
}

.role-select:disabled {
  cursor: not-allowed;
  opacity: 0.86;
}

.responsibility-domain-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.responsibility-domain-option {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
}

.responsibility-domain-option input {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: 0;
}

.responsibility-domain-option span {
  min-width: 0;
  white-space: nowrap;
}

.sidebar-domain-list {
  padding: 7px;
  border: 1px solid rgba(145, 221, 213, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-domain-list .responsibility-domain-option {
  border-color: rgba(145, 221, 213, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #edf8f7;
  font-weight: 700;
}

.responsibility-domain-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.responsibility-domain-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid rgba(145, 221, 213, 0.32);
  border-radius: 999px;
  background: rgba(145, 221, 213, 0.12);
  color: #edf8f7;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.responsibility-domain-checklist.disabled {
  cursor: not-allowed;
  opacity: 0.86;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(237, 244, 245, 0.82);
  backdrop-filter: blur(10px);
}

.login-gate[hidden] {
  display: none;
}

.login-panel {
  display: grid;
  width: min(440px, 100%);
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.login-panel h1 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.login-panel p,
.login-panel small {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

.form-field input {
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.form-field input:focus {
  border-color: var(--teal);
  outline: 2px solid rgba(15, 139, 134, 0.14);
}

.form-message {
  min-height: 20px;
  color: #b23b3b;
  font-weight: 800;
}

.login-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.login-divider::before,
.login-divider::after {
  height: 1px;
  background: var(--line);
  content: "";
}

.login-panel > .ghost-button,
.login-panel > .primary-button,
.login-form .primary-button {
  width: 100%;
  min-height: 44px;
}

.auth-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(145, 221, 213, 0.2);
  border-radius: 8px;
  background: rgba(8, 124, 123, 0.12);
  overflow: hidden;
}

.auth-card span,
.auth-card small {
  min-width: 0;
  overflow: hidden;
  color: #9fb3b7;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-card strong {
  min-width: 0;
  overflow: hidden;
  color: #edf8f7;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-actions {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin-top: 4px;
}

.auth-actions .ghost-button {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 0 8px;
  border-color: rgba(145, 221, 213, 0.3);
  color: #edf8f7;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-actions .ghost-button:hover {
  border-color: rgba(145, 221, 213, 0.58);
  background: rgba(255, 255, 255, 0.1);
}

.auth-actions .logout-button {
  border-color: rgba(255, 185, 185, 0.36);
  color: #ffe4e4;
  background: rgba(170, 61, 61, 0.2);
}

.auth-actions .logout-button:hover {
  border-color: rgba(255, 185, 185, 0.62);
  background: rgba(170, 61, 61, 0.3);
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #58d394;
}

.deploy-note {
  color: #8ea2a6;
}

.main {
  min-width: 0;
  padding: 14px 16px 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 12px;
  letter-spacing: 0;
}

h3 {
  font-size: 14px;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.online-presence {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  min-height: 28px;
  margin-right: 4px;
}

.online-presence-stack {
  display: flex;
  align-items: center;
  min-width: 0;
}

.online-avatar {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  margin-left: -7px;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--bg);
  border-radius: 999px;
  color: #ffffff;
  background: var(--avatar-color, var(--accent));
  box-shadow: 0 2px 8px rgba(23, 32, 37, 0.12);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.online-avatar:first-child {
  margin-left: 0;
}

.online-avatar:hover,
.online-avatar.selected,
.online-avatar:focus-visible {
  z-index: 2;
  transform: translateY(-1px);
}

.online-avatar img,
.online-presence-row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.online-avatar-more {
  width: auto;
  min-width: 32px;
  padding: 0 7px;
  color: var(--accent-dark);
  background: #e8f5f3;
}

.online-presence-count {
  height: 28px;
  margin-left: 4px;
  padding: 0 9px;
  border: 1px solid #cfe2e0;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #f7fbfb;
  font-weight: 800;
}

.online-presence-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(300px, calc(100vw - 32px));
  max-height: min(420px, calc(100vh - 96px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.online-presence-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px 8px 12px;
  border-bottom: 1px solid var(--line);
}

.online-presence-popover-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.online-presence-close {
  flex: 0 0 auto;
}

.online-presence-list {
  display: grid;
  gap: 2px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
}

.online-presence-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 6px;
  border-radius: 8px;
}

.online-presence-row:hover {
  background: var(--panel-soft);
}

.online-presence-row-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  color: #ffffff;
  background: var(--avatar-color, var(--accent));
  font-size: 10px;
  font-weight: 800;
}

.online-presence-row-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.online-presence-row-body strong,
.online-presence-row-body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-presence-row-body strong {
  font-size: 12px;
}

.online-presence-row-body span,
.online-presence-row small {
  color: var(--muted);
}

.online-presence-row small {
  white-space: nowrap;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-actions .select {
  min-width: 150px;
}

.node-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.node-actions .primary-button,
.node-actions .ghost-button {
  width: 100%;
  padding-inline: 10px;
}

.primary-button,
.ghost-button,
.danger-button,
.text-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 8px;
  white-space: nowrap;
}

.primary-button {
  padding: 0 11px;
  border: 1px solid var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
}

.danger-button {
  padding: 0 10px;
  border: 1px solid var(--danger);
  color: #ffffff;
  background: var(--danger);
}

.danger-button:hover {
  background: #8f3030;
}

.primary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button.is-disabled,
.primary-button.is-disabled:hover {
  cursor: not-allowed;
  opacity: 0.55;
  background: var(--accent);
}

.action-feedback-bubble {
  position: fixed;
  z-index: 14000;
  max-width: min(360px, calc(100vw - 24px));
  padding: 8px 11px;
  border: 1px solid rgba(27, 79, 76, 0.18);
  border-radius: 8px;
  color: #ffffff;
  background: #294f4d;
  box-shadow: 0 8px 24px rgba(12, 22, 25, 0.2);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
  pointer-events: none;
  transform: translate(-50%, -100%);
  animation: action-feedback-bubble-in 0.16s ease-out;
}

.action-feedback-bubble::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #294f4d;
  content: "";
  transform: translate(-50%, -50%) rotate(45deg);
}

@keyframes action-feedback-bubble-in {
  from { opacity: 0; transform: translate(-50%, calc(-100% + 4px)); }
  to { opacity: 1; transform: translate(-50%, -100%); }
}

.text-button {
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  font-weight: 700;
}

.text-button.danger-link {
  color: var(--danger);
}

.text-button.muted-link,
.text-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.68;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 28px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.share-button {
  color: var(--accent-dark);
  font-weight: 800;
}

.node-status-group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 10px;
}

.metric {
  display: grid;
  gap: 4px;
  min-height: 68px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-label,
.metric-note,
.panel-header p {
  color: var(--muted);
  font-size: 10px;
}

.metric strong {
  font-size: 18px;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 10px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.change-module-grid {
  align-items: start;
}

.dashboard-card {
  display: grid;
  gap: 9px;
  padding: 10px;
}

.module-panel {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
  padding: 10px;
}

.permissions-layout {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

#permissionsView .permissions-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#permissionsView .permissions-layout > .module-panel {
  width: 100%;
}

.permission-users-panel {
  min-height: 0;
}

.permission-matrix-panel {
  grid-column: 1 / -1;
}

.permission-matrix-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.permission-user-search-row {
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto;
  align-items: end;
  gap: 10px;
}

.permission-user-search-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.permission-user-search-row .item-meta {
  padding-bottom: 7px;
  white-space: nowrap;
}

.todo-list,
.scope-list,
.record-list,
.permission-matrix {
  display: grid;
  gap: 8px;
}

.todo-list div,
.scope-list span,
.record-item,
.permission-matrix div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.todo-list strong {
  display: block;
  margin-bottom: 4px;
}

.todo-list span,
.scope-list span {
  color: var(--muted);
  line-height: 1.45;
}

.record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.clickable-record {
  cursor: pointer;
}

.clickable-record:hover {
  border-color: var(--accent);
  background: #fbfefe;
}

.record-title-button {
  display: inline;
  width: fit-content;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 760;
  text-align: left;
  cursor: pointer;
}

.record-title-button:hover {
  color: var(--accent-dark);
}

.product-record {
  display: grid;
  gap: 12px;
}

.record-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.record-fields div {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.record-fields div.wide {
  grid-column: 1 / -1;
}

.record-fields span {
  color: var(--muted);
  font-size: 12px;
}

.record-fields strong {
  font-size: 14px;
}

.record-fields strong.multiline-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.file-record {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.permission-matrix strong {
  display: block;
  margin-bottom: 4px;
}

.permission-matrix span {
  color: var(--muted);
  line-height: 1.45;
}

.permission-editor {
  max-height: min(68vh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.permission-editor table {
  width: max(100%, 1450px);
  min-width: 1450px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
}

.permission-role-column {
  width: 260px;
}

.permission-action-column {
  width: 132px;
}

.permission-editor th,
.permission-editor td {
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.permission-editor th {
  padding: 14px 12px;
  text-align: center;
}

.permission-editor td {
  height: 76px;
  padding: 12px;
  text-align: center;
}

.permission-editor th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 800;
  box-shadow: 0 1px 0 var(--line), 0 8px 14px rgba(23, 32, 37, 0.04);
}

.permission-editor tbody tr:hover td {
  background: #fbfdfd;
}

.permission-editor tr:last-child td {
  border-bottom: 0;
}

.permission-role-heading,
.permission-role-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid var(--line);
  text-align: left;
}

.permission-editor .permission-role-heading {
  top: 0;
  z-index: 5;
}

.permission-role-cell {
  background: var(--panel);
  box-shadow: 12px 0 18px rgba(23, 32, 37, 0.04);
}

.permission-editor tbody tr:hover .permission-role-cell {
  background: #fbfdfd;
}

.permission-action-heading {
  height: 88px;
  line-height: 1.28;
}

.permission-action-heading span {
  display: inline-block;
  max-width: 100%;
  color: #5f6e76;
  font-size: 14px;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
}

.permission-role-name {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.permission-role-name strong {
  font-size: 14px;
}

.permission-role-name span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.permission-user-list {
  align-self: start;
  display: grid;
  gap: 4px;
  max-height: 440px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.permission-user-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.15fr) minmax(136px, 0.72fr) minmax(360px, 1.7fr) auto minmax(132px, 0.6fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.permission-user-row.has-unsaved-config {
  border-color: rgba(42, 111, 219, 0.34);
  background: rgba(42, 111, 219, 0.035);
}

.permission-user-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.permission-user-main {
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 7px;
}

.permission-user-main strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-user-cell span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
}

.permission-user-main code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-user-row .permission-user-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.permission-user-field > span,
.permission-user-updated span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.permission-user-select {
  min-width: 0;
}

.permission-domain-list {
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  padding: 0 1px 2px;
  scrollbar-width: thin;
}

.permission-domain-list .responsibility-domain-option {
  min-height: 22px;
  padding: 2px 6px;
  font-size: 11px;
}

.permission-domain-list .responsibility-domain-option input {
  width: 13px;
  height: 13px;
}

.permission-user-status {
  white-space: nowrap;
}

.permission-user-updated {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.permission-user-updated strong {
  color: var(--ink);
  font-weight: 700;
}

.permission-user-actions {
  text-align: right;
  white-space: nowrap;
}

.permission-save-button.is-dirty {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.permission-save-button.is-dirty:hover {
  background: var(--accent-dark);
}

.permission-tool-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 6px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.preconfigured-user-form.permission-tool-form {
  grid-template-columns:
    minmax(120px, 0.6fr)
    minmax(180px, 0.9fr)
    minmax(220px, 1fr)
    minmax(140px, 0.65fr)
    minmax(560px, 2.3fr)
    132px;
  align-items: end;
}

.preconfigured-domain-field {
  min-width: 0;
}

.preconfigured-user-form [data-preconfigured-domain-group] {
  min-height: 30px;
  max-height: 64px;
  overflow: auto;
  align-content: start;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preconfigured-user-form [data-preconfigured-domain-group] .responsibility-domain-option {
  min-height: 22px;
  padding: 2px 6px;
}

.preconfigured-user-form [data-preconfigured-domain-group] .responsibility-domain-option input {
  width: 13px;
  height: 13px;
}

.preconfigured-user-form button[type="submit"] {
  align-self: end;
  width: 100%;
  min-height: 32px;
}

.permission-tool-form label {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.permission-tool-form .responsibility-domain-option {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
  color: var(--ink);
  font-size: 11px;
}

.owner-transfer-form {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.owner-transfer-form .primary-button {
  width: 100%;
  min-height: 28px;
  white-space: nowrap;
}

.owner-transfer-preview {
  display: grid;
  gap: 10px;
}

.owner-transfer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.owner-transfer-summary label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 700;
}

.owner-transfer-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.owner-transfer-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.owner-transfer-table th,
.owner-transfer-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.owner-transfer-table th {
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 800;
}

.owner-transfer-table th:first-child,
.owner-transfer-table td:first-child {
  width: 112px;
}

.owner-transfer-table-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.owner-transfer-table input[type="checkbox"],
.owner-transfer-summary input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.owner-transfer-table tr:last-child td {
  border-bottom: 0;
}

.owner-transfer-table td span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.role-template-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
}

.role-template-modal .modal-body {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.role-template-list {
  align-content: start;
}

.compact-title-row {
  align-items: center;
}

.permission-cell {
  text-align: center;
}

.permission-check {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
}

.permission-check input {
  display: grid;
  width: 16px;
  height: 16px;
  margin: 0;
  place-items: center;
  appearance: none;
  border: 1.2px solid #7c858b;
  border-radius: 4px;
  background: #ffffff;
}

.permission-check input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.permission-check input:checked::after {
  content: "";
  width: 4px;
  height: 8px;
  margin-top: -1px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.permission-check input:disabled {
  cursor: not-allowed;
}

.permission-check input:disabled:checked {
  border-color: #cfd3d6;
  background: #cfd3d6;
}
}

.coding-rule-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 12px;
  align-items: stretch;
}

.coding-rule-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.coding-rule-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.coding-preview-card {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
}

.coding-preview-card span,
.coding-preview-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.coding-preview-card strong {
  color: var(--accent-dark);
  font-size: 24px;
  letter-spacing: 0;
}

.classification-rule-list {
  display: grid;
  gap: 12px;
}

.classification-rule-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.classification-rule-summary.compact {
  margin-bottom: 12px;
}

.classification-rule-summary div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.classification-rule-summary span,
.classification-rule-summary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.classification-rule-summary strong {
  font-size: 16px;
}

.classification-rule-summary.compact strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coding-rule-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.coding-rule-actions span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.classification-rule-modal {
  width: min(1520px, calc(100vw - 32px));
}

.classification-rule-modal-body {
  max-height: calc(100vh - 140px);
  overflow: auto;
  padding: 18px;
}

.classification-rule-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.classification-rule-modal-toolbar div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.classification-rule-modal-toolbar span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.classification-rule-edit-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}

.classification-rule-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.classification-rule-edit-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.classification-rule-edit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.classification-rule-edit-actions .form-message {
  margin: 0;
}

.classification-edit-tree {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 12px;
  min-height: 560px;
}

.classification-editor-nav,
.classification-editor-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.classification-editor-nav {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 64vh;
  overflow: auto;
  padding: 12px;
}

.classification-editor-nav-head,
.classification-editor-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.classification-editor-nav-head span,
.classification-editor-detail-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.classification-nav-group {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.classification-nav-group:last-child {
  border-bottom: 0;
}

.classification-nav-level,
.classification-nav-category {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.classification-nav-level {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.classification-nav-level span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.classification-nav-categories {
  display: grid;
  gap: 4px;
  margin-left: 10px;
}

.classification-nav-category {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
}

.classification-nav-category span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.classification-nav-category strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classification-nav-level:hover,
.classification-nav-category:hover,
.classification-nav-level.active,
.classification-nav-category.active {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.classification-editor-detail {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 14px;
}

.classification-editor-detail-head strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classification-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.classification-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.classification-detail-metrics div,
.classification-empty-detail {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.classification-detail-metrics span,
.classification-empty-detail span,
.classification-use-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.classification-detail-form {
  display: grid;
  grid-template-columns: 120px minmax(180px, 1fr) 120px minmax(180px, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.classification-detail-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.classification-edit-input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 750;
}

.classification-edit-input.code-input {
  text-align: center;
  text-transform: uppercase;
}

.classification-detail-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.classification-detail-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.classification-detail-table th,
.classification-detail-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.classification-detail-table th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 900;
}

.classification-detail-table tr:last-child td {
  border-bottom: 0;
}

.classification-detail-table tr.used td {
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
}

.classification-detail-table td:first-child {
  width: 120px;
}

.classification-detail-table td:nth-child(3) {
  width: 130px;
  color: var(--accent-dark);
}

.classification-detail-table td:nth-child(4),
.classification-detail-table td:nth-child(5) {
  width: 120px;
}

.secondary-danger {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: #ffffff;
  color: var(--danger);
}

.empty-table-cell {
  color: var(--muted);
  text-align: center !important;
}

@media (max-width: 980px) {
  .classification-edit-tree {
    grid-template-columns: 1fr;
  }

  .classification-editor-nav {
    max-height: 280px;
  }

  .classification-detail-form,
  .classification-detail-metrics {
    grid-template-columns: 1fr;
  }
}

.danger-text {
  color: var(--danger);
}

.classification-level-list {
  display: grid;
  gap: 12px;
}

.classification-level-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.classification-level-head,
.classification-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.classification-level-head div,
.classification-category-head {
  min-width: 0;
}

.classification-level-head strong,
.classification-category-head strong {
  display: block;
}

.classification-level-head span:not(.state),
.classification-category-head span {
  color: var(--muted);
  font-size: 12px;
}

.classification-category-list {
  display: grid;
  gap: 10px;
}

.classification-category-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.classification-subcategory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.classification-subcategory-chip {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.classification-subcategory-chip.used {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}

.classification-subcategory-chip strong {
  color: var(--accent-dark);
  font-size: 13px;
}

.classification-subcategory-chip em {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classification-subcategory-chip small {
  color: var(--muted);
  font-size: 11px;
}

.coding-policy-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.backup-import {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #f0c7c7;
  border-radius: 8px;
  background: #fff8f8;
}

.backup-import span {
  display: grid;
  gap: 4px;
}

.backup-import small {
  color: var(--muted);
  line-height: 1.4;
}

.backup-import input {
  max-width: 260px;
}

.backup-record {
  align-items: start;
}

.backup-record .item-meta {
  overflow-wrap: anywhere;
}

.backup-list-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.compact-link {
  text-decoration: none;
}

.section-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.portfolio-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px 14px;
}

.product-search {
  max-width: 360px;
}

.product-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-chip,
.material-chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
}

.type-chip.active,
.type-chip:hover,
.material-chip.active,
.material-chip:hover {
  color: var(--accent-dark);
  border-color: #a7d6d2;
  background: var(--accent-soft);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}

.product-grid.is-grouped {
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.product-group {
  display: grid;
  align-content: start;
  align-self: start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.product-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-group-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-group-header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.product-group-list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 188px;
  overflow-y: auto;
}

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.product-card:hover,
.product-card.active {
  border-color: #87c9c4;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(8, 124, 123, 0.1);
}

.product-card-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-card-tags {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 96px;
}

.product-card-side {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.product-card-detail {
  padding: 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  font: inherit;
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
}

.product-card-detail:hover,
.product-card-detail:focus-visible {
  text-decoration: underline;
}

.product-card strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-code,
.product-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-panel {
  min-width: 0;
  padding: 14px;
}

.view-section {
  display: block;
}

.view-section[hidden] {
  display: none;
}

.material-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.material-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(680px, 100%);
}

.material-toolbar .search-input {
  min-width: 260px;
}

.material-filter-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.material-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.material-filter-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.material-filter-head > .material-filter-actions {
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.material-filter-head strong {
  color: var(--ink);
  font-size: 13px;
}

.material-filter-head span {
  color: var(--muted);
  font-size: 12px;
}

.material-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.material-filter-grid label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.material-filter-grid .select {
  width: 100%;
  min-height: 34px;
  padding-block: 5px;
  color: var(--ink);
  background: #ffffff;
  font-size: 12px;
}

.material-table-wrap .data-table {
  min-width: 1200px;
  table-layout: fixed;
}

.material-select-col { width: 42px; }
.material-code-col { width: 135px; }
.material-name-col { width: 170px; }
.material-model-col { width: 150px; }
.material-type-col { width: 135px; }
.material-version-col { width: 60px; }
.material-status-col { width: 60px; }
.material-supply-col { width: 80px; }
.material-owner-col { width: 85px; }
.material-drawing-col { width: 90px; }
.material-created-col { width: 95px; }
.material-updated-col { width: 105px; }

.material-model-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.table-sort-button span {
  color: var(--muted);
  font-size: 11px;
}

[data-material-sort-column][aria-sort]:not([aria-sort="none"]) .table-sort-button {
  color: var(--accent);
}

.table-sort-button:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.material-date-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1180px) {
  .material-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .material-filter-head,
  .material-filter-head > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .material-filter-grid {
    grid-template-columns: 1fr;
  }
}

.bulk-bom-form {
  align-content: start;
}

.node-edit-form.bulk-edit-form.form-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(320px, 1fr) auto auto;
  width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

.bulk-edit-form .bulk-bom-preview {
  min-height: 0;
}

.bulk-edit-form .bulk-bom-preview-body {
  max-height: min(68vh, 760px);
}

.bulk-edit-form .compact-fields.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bulk-paste-input {
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
  resize: vertical;
}

.excel-upload-card {
  display: flex;
  align-items: center;
  grid-template-columns: none;
  gap: 12px;
  min-height: 78px;
  padding: 14px 16px;
  border: 1px dashed #9fbfbc;
  border-radius: 12px;
  background: #f8fbfa;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.form-grid .excel-upload-card,
.bulk-bom-form .excel-upload-card {
  display: flex;
}

.excel-upload-card:hover,
.excel-upload-card.dragging,
.excel-upload-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 109, 105, 0.11);
  transform: translateY(-1px);
}

.excel-upload-card.has-file {
  border-style: solid;
  border-color: #5ba29c;
  background: #f2faf8;
}

.excel-upload-card.upload-error {
  border-color: #c96666;
  background: #fff7f7;
}

.excel-upload-card.is-reading {
  opacity: 0.72;
  pointer-events: none;
}

.excel-upload-card input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.excel-upload-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid #b8d6d1;
  border-radius: 10px;
  background: #eaf5f2;
  color: #08766d;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.excel-upload-copy {
  display: grid;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
}

.excel-upload-copy strong {
  color: var(--text);
  font-size: 15px;
}

.excel-upload-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-upload-action {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid #a7bfbc;
  border-radius: 8px;
  background: #fff;
  color: #315c57;
  font-size: 12px;
  font-weight: 800;
}

.bulk-recognize-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.bulk-recognize-row span {
  flex: 1 1 260px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.bulk-template-download {
  box-shadow: 0 3px 10px rgba(0, 109, 105, 0.18);
  font-weight: 800;
}

.bulk-template-legacy {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.bulk-bom-defaults {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.bulk-bom-defaults summary {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.bulk-bom-default-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 10px 10px;
}

.bulk-bom-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bulk-bom-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.bulk-bom-preview-head strong {
  min-width: 0;
  font-size: 12px;
}

.bulk-bom-preview-head span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.bulk-bom-preview-body {
  max-height: 260px;
  overflow: auto;
}

.bulk-bom-table {
  width: 100%;
  min-width: 1600px;
  border-collapse: collapse;
}

.bulk-bom-table th,
.bulk-bom-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.bulk-bom-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f8faf9;
  font-size: 10px;
  font-weight: 800;
}

.bulk-bom-table td {
  font-size: 12px;
}

.bulk-edit-table {
  min-width: 1920px;
  table-layout: fixed;
}

.bulk-edit-table th:nth-child(1),
.bulk-edit-table td:nth-child(1) {
  width: 42px;
}

.bulk-edit-table th:nth-child(2),
.bulk-edit-table td:nth-child(2) {
  width: 128px;
}

.bulk-edit-table th:nth-child(3),
.bulk-edit-table td:nth-child(3) {
  width: 210px;
}

.bulk-edit-table th:nth-child(4),
.bulk-edit-table td:nth-child(4) {
  width: 118px;
}

.bulk-edit-table th:nth-child(5),
.bulk-edit-table td:nth-child(5) {
  width: 300px;
}

.bulk-edit-table th:nth-child(6),
.bulk-edit-table td:nth-child(6) {
  width: 160px;
}

.bulk-edit-table th:nth-child(7),
.bulk-edit-table td:nth-child(7) {
  width: 190px;
}

.bulk-edit-table th:nth-child(8),
.bulk-edit-table td:nth-child(8) {
  width: 240px;
}

.bulk-edit-table th:nth-child(9),
.bulk-edit-table td:nth-child(9) {
  width: 170px;
}

.bulk-edit-table th:nth-child(10),
.bulk-edit-table td:nth-child(10) {
  width: 180px;
}

.bulk-edit-table th:nth-child(11),
.bulk-edit-table td:nth-child(11) {
  width: 132px;
}

.bulk-edit-table th:nth-child(-n + 3),
.bulk-edit-table td:nth-child(-n + 3) {
  position: sticky;
  background: #ffffff;
}

.bulk-edit-table th:nth-child(-n + 3) {
  z-index: 5;
  background: #f8faf9;
}

.bulk-edit-table td:nth-child(-n + 3) {
  z-index: 3;
}

.bulk-edit-table th:nth-child(1),
.bulk-edit-table td:nth-child(1) {
  left: 0;
}

.bulk-edit-table th:nth-child(2),
.bulk-edit-table td:nth-child(2) {
  left: 42px;
}

.bulk-edit-table th:nth-child(3),
.bulk-edit-table td:nth-child(3) {
  left: 170px;
  box-shadow: 8px 0 12px -12px rgba(23, 32, 37, 0.34);
}

.bulk-edit-table .disabled-row {
  background: #fafafa;
  color: var(--muted);
}

.bulk-edit-table .disabled-row td:nth-child(-n + 3) {
  background: #fafafa;
}

.bulk-bom-cell-input {
  width: 100%;
  min-width: 88px;
  height: 30px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.bulk-bom-cell-input.wide {
  min-width: 240px;
}

.bulk-bom-cell-input.compact {
  min-width: 76px;
}

.bulk-bom-check-cell {
  text-align: center !important;
}

.bulk-bom-check-cell input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.bulk-bom-source {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  background: #eef2f6;
}

.bulk-bom-source.existing {
  color: #0f766e;
  background: #dff3ef;
}

.bulk-bom-cell-input:disabled {
  color: #475569;
  background: #f1f5f9;
  cursor: not-allowed;
}

.compact-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
}

.bulk-edit-permission {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-edit-permission.ok {
  color: var(--accent);
  font-weight: 750;
}

.bulk-edit-permission.denied {
  color: var(--danger);
}

.bulk-bom-errors {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--danger);
  background: #fff7f7;
  font-size: 12px;
}

.bulk-bom-errors p {
  margin: 0;
}

.bulk-bom-empty {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}

.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  align-items: start;
  gap: 16px;
}

.config-layout > .module-panel {
  align-content: start;
}

.config-layout .product-type-row {
  align-items: center;
  align-content: flex-start;
}

.configuration-list {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 12px;
  margin-top: 14px;
}

.configuration-product-group {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.configuration-product-head,
.configuration-product-cards {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.configuration-product-head h3 { margin: 3px 0 0; }

.configuration-product-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-items: stretch;
}

.configuration-card {
  display: grid;
  gap: 10px;
  align-content: start;
  width: 100%;
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  background: #ffffff;
  text-align: left;
}

.configuration-card:hover,
.configuration-card.active {
  border-color: #8bd4ce;
  box-shadow: 0 8px 28px rgba(20, 70, 74, 0.08);
}

.configuration-card-head,
.configuration-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.configuration-card strong {
  font-size: 16px;
}

.configuration-open-hint {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.configuration-card:hover .configuration-open-hint { opacity: 1; }

.configuration-default-pill {
  margin-left: 6px;
  color: #8a5a00;
  background: #fff4cf;
  border-color: #ecd17a;
}

.configuration-default-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-left: 8px;
  padding: 0 10px;
  border: 1px solid #e1b94f;
  border-radius: 999px;
  color: #704800;
  background: linear-gradient(135deg, #fff6ce, #ffe39a);
  box-shadow: 0 3px 10px rgba(139, 93, 0, 0.14);
  font-size: 11px;
  font-weight: 900;
}

.configuration-card:has(.configuration-default-badge) {
  border: 2px solid #dcb64d;
  background: linear-gradient(180deg, #fffdf5, #ffffff);
}

.configuration-default-toggle .checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--ink);
  font-weight: 600;
}

.required-mark { color: #b74632; font-size: 11px; }

.configuration-detail-backdrop { z-index: 80; }

.configuration-detail-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1080px, calc(100vw - 48px));
  height: min(820px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
}

.configuration-detail-page {
  grid-template-columns: 1fr;
  min-height: 0;
  overflow: auto;
  padding: 4px 18px 18px;
}

.configuration-detail-page .config-kv { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.product-configuration-detail { display: grid; gap: 14px; align-content: start; }
.product-configuration-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 2px 0 12px; border-bottom: 1px solid var(--line); }
.product-configuration-detail-head h3 { margin: 10px 0 4px; font-size: 22px; }
.product-configuration-kv { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.product-configuration-packages { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.product-configuration-selected-package { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.product-configuration-selected-package > span:first-child { display: grid; gap: 3px; min-width: 0; margin-right: auto; }
.product-configuration-selected-package small { color: var(--muted); }
.product-configuration-effective-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.product-configuration-effective-summary div { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.product-configuration-effective-summary strong { color: var(--accent-dark); font-size: 22px; }
.product-configuration-effective-summary span { color: var(--muted); font-size: 12px; }
.product-configuration-notes { padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.product-configuration-notes p { margin: 6px 0 0; color: var(--muted); line-height: 1.6; }
@media (max-width: 760px) { .product-configuration-kv, .product-configuration-effective-summary { grid-template-columns: 1fr; } .product-configuration-detail-head { display: grid; } }

.modal.configuration-workspace-modal {
  width: min(1500px, calc(100vw - 32px));
  height: min(920px, calc(100vh - 32px));
  max-width: none;
  max-height: none;
  overflow: hidden;
}

.form-grid.configuration-workspace-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: calc(100vh - 170px);
  overflow: auto;
  padding-right: 6px;
}

.form-grid.configuration-workspace-form > label:first-of-type,
.configuration-form-wide,
.configuration-workspace-form > .form-message,
.configuration-workspace-form > .modal-actions { grid-column: 1 / -1; }

.form-grid.configuration-workspace-form > label:first-of-type { grid-column: span 2; }

.configuration-tree-editor {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.configuration-tree-editor-head,
.config-edit-root-title,
.config-tree-branch summary,
.config-tree-leaf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.configuration-tree-editor-head h3 { margin: 3px 0; }
.configuration-tree-editor-head p { margin: 0; color: var(--muted); font-size: 12px; }

.configuration-edit-tree {
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.config-tree-branch summary,
.config-tree-leaf {
  min-height: 48px;
  padding: 8px 12px 8px calc(12px + var(--tree-depth, 0) * 24px);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
}

.config-tree-branch summary::-webkit-details-marker { display: none; }
.config-tree-branch summary::before { content: "›"; color: var(--accent-dark); font-size: 20px; transform: rotate(0); }
.config-tree-branch[open] > summary::before { transform: rotate(90deg); }
.config-tree-node-main { display: grid; gap: 2px; margin-right: auto; }
.config-tree-node-main small { color: var(--muted); }

.config-edit-root-title {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f4f9f9;
}
.config-accessory-root-toggle { border: 0; color: var(--ink); text-align: left; cursor: pointer; }

.config-edit-root-title small { margin-left: auto; color: var(--muted); }
.tree-caret { color: var(--accent-dark); }

.config-edit-row {
  display: grid;
  grid-template-columns: 22px minmax(180px, 1.4fr) minmax(160px, 1fr) 110px 110px 34px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.config-replacement-row { grid-template-columns: 22px minmax(190px, 1.2fr) minmax(130px, .8fr) 24px minmax(130px, .8fr) 130px minmax(150px, 1fr) 34px; }
.config-node-picker-trigger { min-width: 0; min-height: 42px; display: grid; gap: 2px; padding: 5px 10px; border: 1px solid #83aeb0; border-radius: 8px; background: #f4fbfb; color: var(--ink); text-align: left; cursor: pointer; }
.config-node-picker-trigger:hover { border-color: var(--accent-dark); background: #eaf6f6; }
.config-node-picker-trigger strong, .config-node-picker-trigger small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.config-node-picker-trigger small { color: var(--muted); }
.config-replacement-scope { font-size: 12px; }
.config-accessory-node { display: grid; grid-template-columns: 22px minmax(240px, 620px) 110px 80px auto; align-items: center; justify-content: start; gap: 8px; min-height: 52px; padding: 6px 12px 6px calc(12px + var(--accessory-depth, 0) * 24px); border-bottom: 1px solid var(--line); background: #fff; }
.config-accessory-node:has(+ .config-accessory-node) { border-bottom-color: var(--line); }
.config-accessory-material { width: 100%; }
.config-accessory-toggle { width: 22px; height: 32px; padding: 0; border: 0; background: transparent; color: var(--teal-dark); font-size: 20px; cursor: pointer; }
.config-accessory-qty { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.config-accessory-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.config-accessory-actions .small-button { min-height: 30px; padding: 4px 8px; white-space: nowrap; }
.config-accessory-child-count { grid-column: 2; color: var(--muted); font-size: 11px; }
.config-accessory-parent-link { grid-column: 2 / -1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 10px; border: 1px dashed var(--line-strong); border-radius: 9px; background: var(--surface-soft); color: var(--muted); text-align: left; cursor: pointer; }
.config-accessory-parent-link:hover, .config-accessory-parent-link.has-selection { border-color: var(--teal); background: var(--teal-soft); }
.config-accessory-parent-link span { font-size: 11px; }
.config-accessory-parent-link strong { color: var(--ink); }
.config-accessory-parent-link strong { white-space: nowrap; }
.config-accessory-parent-link small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.configuration-node-picker-backdrop { z-index: 95; }
.modal-backdrop.nested-material-create { z-index: 105; }
.configuration-node-picker { width: min(820px, calc(100vw - 40px)); max-height: min(820px, calc(100vh - 40px)); }
#configurationBomNodeDialog .configuration-node-picker { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; width: min(960px, calc(100vw - 40px)); height: min(720px, calc(100vh - 40px)); max-height: none; }
#configurationBomNodeDialog .configuration-node-picker-tree { min-height: 0; max-height: none; }
.configuration-node-picker-toolbar { display: flex; align-items: center; gap: 12px; padding: 0 20px 12px; }
.configuration-node-picker-toolbar .search-input { flex: 1; }
.configuration-node-picker-tree { margin: 0 20px; max-height: calc(100vh - 260px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.configuration-node-tree-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; padding-left: calc(8px + var(--picker-depth, 0) * 22px); border-bottom: 1px solid var(--line); background: #fff; }
.configuration-node-tree-row:hover { background: #eff8f8; }
.configuration-node-tree-row.selected { background: var(--teal-soft); box-shadow: inset 3px 0 0 var(--teal); }
.configuration-node-toggle { width: 26px; height: 32px; border: 0; background: transparent; color: var(--teal-dark); font-size: 20px; cursor: pointer; }
.configuration-node-toggle-spacer { width: 26px; }
.configuration-node-option { width: 100%; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.configuration-node-option:hover { background: #eff8f8; }
.configuration-node-option strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.configuration-node-option > small:first-of-type { margin-left: auto; white-space: nowrap; color: var(--muted); }
.configuration-node-option-main { display: grid; gap: 3px; min-width: 0; margin-right: auto; }
.configuration-node-option-main small, .configuration-node-option > small { color: var(--muted); }
.product-configuration-composer { width: min(980px, calc(100vw - 40px)); }
.product-configuration-package-list { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.product-configuration-package-option { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.product-configuration-package-option:has(input:checked) { border-color: var(--accent-dark); background: #eff8f8; }
.product-configuration-package-option.has-warning { border-color: #d9b66f; }
.product-configuration-package-option > span:nth-child(2) { display: grid; gap: 3px; }
.product-configuration-package-option small { color: var(--muted); }
.configuration-group-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 8px; color: var(--muted); font-size: 12px; }
.configuration-group-label strong { color: var(--ink); font-size: 13px; }
.configuration-group-label.primary { margin-top: 4px; }
.compact-package-library { margin-top: 4px; border-top: 1px solid var(--line); }
.compact-package-library summary { display: flex; align-items: center; gap: 10px; padding: 12px 2px 4px; cursor: pointer; color: var(--muted); list-style: none; }
.compact-package-library summary::-webkit-details-marker { display: none; }
.compact-package-library summary::before { content: "›"; color: var(--accent-dark); font-size: 18px; }
.compact-package-library[open] summary::before { transform: rotate(90deg); }
.compact-package-library summary span { margin-left: auto; font-size: 12px; }
.compact-package-list { display: grid; gap: 6px; padding-top: 8px; }
.compact-package-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.compact-package-row:hover, .compact-package-row.active { border-color: #8bd4ce; background: #f3fbfa; }
.compact-package-row > span:first-child { display: grid; gap: 2px; min-width: 0; margin-right: auto; }
.compact-package-row small { color: var(--muted); }
.configuration-package-warning { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid #d9b66f; border-radius: 10px; background: #fff8e8; color: #76510b; }
.configuration-package-warning small { color: #8a6a2c; }
.config-package-adjustment-row { grid-template-columns: 22px 92px 145px minmax(130px, 1fr) 24px minmax(130px, 1fr) 100px minmax(160px, 1fr) 34px; }
.tree-connector { width: 16px; height: 18px; border-left: 1px solid #a9c7c8; border-bottom: 1px solid #a9c7c8; }
.replacement-arrow { text-align: center; color: var(--accent-dark); font-weight: 900; }
.config-edit-row .search-input, .config-edit-row .select { min-width: 0; }

.config-detail-tree {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.config-detail-tree-root,
.config-detail-tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.config-detail-tree-root { background: #f4f9f9; }
.config-detail-tree-root small { margin-left: auto; color: var(--muted); }
.config-detail-tree-node > span:nth-child(2) { display: grid; gap: 2px; }
.config-detail-tree-node > span:nth-child(2) small { color: var(--muted); }
.config-detail-tree-node .pill { margin-left: auto; }

@media (max-width: 1050px) {
  .configuration-workspace-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .config-edit-row, .config-replacement-row { grid-template-columns: 22px 1fr; }
  .config-edit-row .icon-button { grid-column: 2; }
  .config-accessory-node { grid-template-columns: 22px minmax(0, 1fr); padding-left: calc(12px + var(--accessory-depth, 0) * 18px); }
  .config-accessory-node > :not(.tree-connector):not(.config-accessory-material) { grid-column: 2; }
  .config-accessory-parent-link { flex-wrap: wrap; }
}

.configuration-detail {
  display: grid;
  gap: 14px;
}

.configuration-type-manager {
  display: grid;
  gap: 8px;
  margin-top: -2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.configuration-type-editor {
  display: flex;
  gap: 8px;
}

.configuration-type-editor .search-input {
  min-width: 0;
}

.configuration-type-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.configuration-type-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.configuration-type-token .icon-button {
  width: 24px;
  min-height: 24px;
  border-radius: 6px;
}

.configuration-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.config-detail-panel {
  align-content: start;
}

.config-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.config-kv div,
.config-section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.config-kv span,
.config-section span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.config-kv strong {
  display: block;
  margin-top: 4px;
}

.config-section {
  display: grid;
  gap: 8px;
}

.config-line-list {
  display: grid;
  gap: 8px;
}

.config-line {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 8px;
  background: #ffffff;
}

.config-line strong {
  font-size: 14px;
}

.configuration-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.configuration-chip.active {
  border-color: #9ddbd7;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.config-layout .product-type-row,
.configuration-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  align-content: flex-start;
  min-height: 0;
}

.config-layout .configuration-chip,
.configuration-filter-row .configuration-chip {
  width: auto;
  max-width: max-content;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.material-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #ffffff;
}

.data-table th,
.data-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

/* Entity identifiers are atomic values. Keep material, BOM, order, batch and
   other primary codes intact; table wrappers provide horizontal overflow. */
.entity-code,
.data-table td > strong,
.pmc-material-cell > strong,
.pmc-material-link > strong,
.inventory-aging-material-identity > strong,
.iqc-material-inline > strong,
.product-code {
  overflow-wrap: normal;
  word-break: keep-all;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.data-table .select-column {
  width: 32px;
  min-width: 32px;
  text-align: center;
}

.data-table .select-column input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.data-table th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 10px;
  font-weight: 800;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: var(--accent-soft);
}

.table-empty {
  color: var(--muted);
  text-align: center !important;
}

.insight-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header,
.panel-title-row,
.tree-heading,
.node-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.select,
.permission-user-select,
.pmc-plan-form select,
.search-input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background-color: #ffffff;
}

.select,
.permission-user-select,
.pmc-plan-form select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 26px 0 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23172025' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  line-height: 1.2;
}

.select:disabled,
.permission-user-select:disabled,
.pmc-plan-form select:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.owner-search-select {
  position: relative;
  display: block;
  width: 100%;
}

.owner-search-select .owner-source-select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.owner-search-trigger {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 26px 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23172025' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.owner-search-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.owner-search-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-search-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  max-height: 340px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.owner-search-panel[hidden] {
  display: none;
}

.owner-search-input {
  min-height: 32px;
}

.owner-search-options {
  display: grid;
  max-height: 260px;
  overflow: auto;
}

.search-input {
  width: 100%;
  padding: 0 8px;
}

.text-area {
  min-height: 68px;
  padding: 6px 8px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  margin: 8px 0 10px;
}

.segmented {
  display: flex;
  height: 28px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.segment {
  min-width: 72px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segment.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(23, 32, 37, 0.08);
}

.bom-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  align-items: start;
  gap: 12px;
}

.tree-card,
.node-card {
  min-width: 0;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.tree-card {
  position: relative;
  height: clamp(1040px, calc(200vh - 720px), 1520px);
  overflow: hidden;
  resize: vertical;
}

.tree-heading {
  height: 44px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 750;
}

.bom-tree {
  height: calc(100% - 44px);
  min-height: 280px;
  overflow: auto;
  padding: 6px 10px;
  cursor: default;
}

.tree-node {
  margin: 1px 0;
}

.tree-row {
  display: grid;
  grid-template-columns: 24px 18px minmax(0, 1fr) auto auto;
  align-items: center;
  min-height: 32px;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: default;
  user-select: none;
}

.tree-main {
  cursor: pointer;
}

.tree-main[draggable="true"] {
  cursor: grab;
}

.tree-row.dragging {
  opacity: 0.48;
  cursor: grabbing;
}

.bom-selection-marquee {
  position: fixed;
  z-index: 10000;
  border: 1px solid #128c83;
  background: rgba(18, 140, 131, 0.12);
  pointer-events: none;
}

.tree-row.drop-before,
.tree-row.drop-after {
  position: relative;
  border-color: #129188;
  background: #ffffff;
}

.tree-row.drop-before::before,
.tree-row.drop-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  border-radius: 999px;
  background: #129188;
}

.tree-row.drop-before::before {
  top: -3px;
}

.tree-row.drop-after::after {
  bottom: -3px;
}

.bom-tree.drag-active .tree-row {
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.tree-row:hover,
.tree-row.selected {
  border-color: #b9d9d6;
  background: #ffffff;
}

.tree-row.multi-selected {
  border-color: #79bcb7;
  background: #edf8f7;
}

.bom-node-check {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #128c83;
  cursor: pointer;
}

.bom-selection-summary {
  margin: 12px 0 8px;
  padding: 8px 10px;
  border: 1px solid #b9d9d6;
  border-radius: 8px;
  color: #246d68;
  background: #edf8f7;
  font-size: 13px;
  line-height: 1.45;
}

.bom-context-menu {
  position: fixed;
  z-index: 10020;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 36px rgb(24 52 58 / 20%);
}

.bom-context-menu > button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.bom-context-menu > button:hover,
.bom-context-menu > button:focus-visible {
  outline: none;
  background: #edf8f7;
}

.bom-context-menu > button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.bom-context-clipboard {
  margin-top: 5px;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.bom-context-clipboard small {
  display: block;
  margin-top: 2px;
}

.toggle {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.tree-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.tree-meta {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tree-meta span {
  display: inline-flex;
  gap: 3px;
}

.tree-meta small {
  color: var(--muted-light, #8a969d);
  font-size: 11px;
}

.tree-children {
  margin-left: 24px;
}

.badge {
  min-width: 52px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  text-align: center;
}

.source-status-badge {
  min-width: 76px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.source-status-badge.update {
  color: #8a4c10;
  background: #fff1d4;
}

.source-status-badge.draft {
  color: #5e6475;
  background: #eef1f5;
}

.source-status-badge.loading {
  color: #315b75;
  background: #e8f3f8;
}

.source-status-badge.missing,
.source-status-badge.error {
  color: #9b1c1c;
  background: #fee2e2;
}

.release-mismatch-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding: 4px 2px;
}

.release-mismatch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.release-mismatch-row .item-title {
  font-weight: 850;
}

.release-mismatch-row .item-meta {
  margin-top: 4px;
}

.node-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.pill,
.state {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.pill {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.state.released {
  color: var(--ok);
  background: var(--ok-soft);
}

.state.review {
  color: var(--warning);
  background: var(--warning-soft);
}

.state.draft {
  color: var(--muted);
  background: #ecf0f2;
}

.state.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 720;
}

.asset-preview-grid {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.asset-preview-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.asset-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.asset-preview-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.asset-preview-head span {
  color: var(--muted);
  font-size: 12px;
}

.asset-preview-head strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-preview-head a {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.asset-preview-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.asset-preview-action {
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(14, 129, 122, 0.24);
  border-radius: 999px;
  color: var(--accent-dark);
  background: #ffffff;
  font-size: 12px;
  font-weight: 820;
}

.asset-preview-action:hover {
  background: #eef8f7;
}

.asset-preview-body {
  display: grid;
  min-height: 132px;
  place-items: center;
  background: var(--panel-soft);
}

.asset-preview-body img,
.asset-preview-body object,
.asset-image-preview,
.pdf-inline-preview-shell {
  display: block;
  width: 100%;
  height: 180px;
  border: 0;
  background: #ffffff;
}

.asset-image-preview {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.pdf-inline-preview-shell {
  display: grid;
  position: relative;
  place-items: center;
  overflow: hidden;
}

.pdf-inline-preview-shell canvas,
.pdf-large-preview canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.pdf-preview-status {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(224, 245, 242, 0.92);
  font-size: 11px;
  font-weight: 800;
}

.pdf-preview-status.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.asset-preview-body img,
.asset-preview-body object {
  object-fit: contain;
}

.asset-empty,
.asset-image-error,
.asset-file-preview {
  display: grid;
  width: 100%;
  min-height: 132px;
  place-items: center;
  gap: 8px;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.asset-empty p,
.asset-image-error p,
.asset-file-preview p {
  max-width: 260px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.asset-image-error {
  display: none;
}

.asset-image-preview.is-error img {
  display: none;
}

.asset-image-preview.is-error .asset-image-error {
  display: grid;
}

.asset-file-type {
  display: grid;
  width: 58px;
  height: 46px;
  place-items: center;
  border: 1px solid #badbd8;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 850;
}

.asset-file-preview.model .asset-file-type {
  color: #4c5e68;
  border-color: #cdd7dc;
  background: #eef3f5;
}

.model-preview {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 180px;
  overflow: hidden;
  background: #f8fbfb;
}

.model-preview canvas {
  display: block;
  width: 100%;
  height: 180px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.model-preview canvas:active {
  cursor: grabbing;
}

.model-preview.is-error canvas {
  opacity: 0;
  pointer-events: none;
}

.model-preview.is-error .model-preview-status,
.model-preview.is-error .model-preview-help {
  display: none;
}

.model-preview-fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 22px;
  text-align: center;
}

.model-preview-fallback > div {
  display: grid;
  max-width: min(420px, 100%);
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid rgba(183, 62, 62, 0.18);
  border-radius: 10px;
  background: #fffafa;
  box-shadow: 0 12px 30px rgba(104, 32, 32, 0.08);
}

.model-preview-fallback strong {
  color: var(--danger);
  font-size: 15px;
}

.model-preview-fallback span {
  color: #4c5e68;
  line-height: 1.55;
}

.model-preview-fallback small {
  color: var(--muted);
  line-height: 1.45;
}

.model-preview-status,
.model-preview-help {
  position: absolute;
  left: 10px;
  z-index: 1;
  pointer-events: none;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.model-preview-status {
  right: 10px;
  bottom: 10px;
  color: var(--accent-dark);
  background: rgba(224, 245, 242, 0.92);
  text-align: center;
}

.model-preview-status.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.model-preview-help {
  top: 10px;
  color: #4c5e68;
  background: rgba(255, 255, 255, 0.88);
}

.model-preview-expand {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(14, 129, 122, 0.22);
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 850;
}

.model-preview-modal-backdrop,
.pdf-preview-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 28px;
  background: rgba(12, 24, 26, 0.42);
}

.model-preview-modal {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr);
  width: min(1080px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(12, 24, 26, 0.28);
}

.pdf-preview-modal {
  display: grid;
  grid-template-rows: auto minmax(520px, 1fr);
  width: min(1180px, calc(100vw - 56px));
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(12, 24, 26, 0.28);
}

.model-preview-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.model-preview-modal-head strong,
.model-preview-modal-head span {
  display: block;
}

.model-preview-modal-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.model-preview-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-button {
  min-height: 32px;
  padding-inline: 12px;
  font-size: 12px;
}

.model-preview-large {
  min-height: min(68vh, 640px);
  border-radius: 0;
}

.model-preview-large canvas {
  height: min(68vh, 640px);
}

.pdf-large-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #ffffff;
}

.model-preview-large .model-preview-status {
  left: 50%;
  right: auto;
  max-width: min(620px, calc(100% - 32px));
  transform: translateX(-50%);
}

.history-list {
  display: grid;
  gap: 10px;
}

.bom-version-manager {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bom-version-head,
.bom-version-actions,
.bom-version-row-main,
.bom-version-row-main > div:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bom-version-head,
.bom-version-actions,
.bom-version-row-main {
  justify-content: space-between;
}

.bom-version-head h3 {
  margin: 2px 0;
  font-size: 22px;
}

.bom-version-head p,
.bom-version-actions span,
.bom-version-row span,
.bom-version-input span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.bom-version-actions {
  align-items: flex-start;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.bom-version-actions button {
  min-width: 148px;
  white-space: nowrap;
}

.bom-version-input {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.bom-version-input .search-input {
  min-height: 36px;
  padding: 8px 10px;
}

.bom-version-list {
  display: grid;
  gap: 6px;
}

.bom-version-row {
  display: grid;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.bom-version-row.current {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.bom-version-row-main > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bom-version-diff {
  display: grid;
  gap: 7px;
  padding-top: 8px;
  border-top: 1px solid rgba(100, 116, 139, 0.14);
}

.bom-version-diff.muted {
  color: var(--muted);
  font-size: 12px;
}

.bom-version-diff-counts,
.bom-version-diff-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diff-count,
.bom-version-diff-examples span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.diff-count.added,
.bom-version-diff-examples .added {
  color: var(--ok);
  background: var(--ok-soft);
}

.diff-count.removed,
.bom-version-diff-examples .removed {
  color: var(--danger);
  background: var(--danger-soft);
}

.diff-count.changed,
.bom-version-diff-examples .changed {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.mbom-diff-summary,
.mbom-diff-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mbom-diff-summary span,
.mbom-diff-help,
.mbom-diff-legend article {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mbom-diff-summary strong {
  color: var(--text);
}

.mbom-diff-help {
  background: var(--panel-soft);
}

.mbom-diff-legend article {
  flex: 1 1 260px;
  background: var(--panel-soft);
}

.mbom-diff-legend strong,
.mbom-diff-legend span {
  display: block;
}

.mbom-diff-legend strong {
  margin-bottom: 4px;
  color: var(--ink);
}

.mbom-diff-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mbom-diff-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

.mbom-diff-table th,
.mbom-diff-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.mbom-diff-table th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 850;
}

.mbom-diff-table tbody tr:last-child td {
  border-bottom: 0;
}

.mbom-diff-row {
  cursor: pointer;
}

.mbom-diff-row:hover {
  background: #fbfefe;
}

.mbom-diff-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.mbom-diff-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bom-version-diff-examples .more {
  color: var(--muted);
  background: #eef3f5;
}

.bom-version-diff-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bom-version-overview {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mbom-source-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mbom-source-panel.behind {
  border-color: rgba(196, 139, 37, 0.35);
  background: #fffaf0;
}

.mbom-source-panel.synced {
  border-color: rgba(11, 130, 118, 0.22);
  background: #f4fbfa;
}

.mbom-source-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mbom-source-head h3 {
  margin: 2px 0 4px;
  font-size: 20px;
}

.mbom-source-head p,
.mbom-source-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.bom-version-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.bom-version-overview-head h3 {
  margin: 2px 0 4px;
  font-size: 22px;
}

.bom-version-overview-head p {
  color: var(--muted);
  font-size: 13px;
}

.bom-version-diff-table-wrap.overview .bom-version-diff-table {
  min-width: 960px;
}

.bom-version-diff-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.mbom-source-impact-table {
  min-width: 900px;
}

.bom-version-diff-table th,
.bom-version-diff-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.bom-version-diff-table th {
  color: var(--muted);
  font-weight: 800;
  background: var(--panel-soft);
}

.bom-version-diff-table tr:last-child td {
  border-bottom: 0;
}

.bom-version-diff-table td:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 220px;
}

.bom-version-diff-table td:nth-child(2) span {
  max-width: 520px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bom-version-diff-table .text-button {
  font-size: 12px;
  white-space: nowrap;
}

.muted-text,
.table-footnote {
  color: var(--muted);
  font-size: 12px;
}

.table-footnote {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}

.bom-version-snapshot {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bom-version-snapshot summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.bom-version-snapshot summary small {
  color: var(--muted);
  font-size: 12px;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.history-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.history-card summary::-webkit-details-marker {
  display: none;
}

.history-card summary::before {
  content: ">";
  display: inline-grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
  transition: transform 0.15s ease;
}

.history-card[open] summary::before {
  transform: rotate(90deg);
}

.history-card summary span:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.history-card summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-card summary em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.history-tags {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px;
  padding: 0 12px 10px;
}

.history-tag {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.history-tag.added {
  color: var(--ok);
  background: var(--ok-soft);
}

.history-tag.changed {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.history-tag.removed {
  color: var(--danger);
  background: var(--danger-soft);
}

.history-linked-changes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 12px 10px;
}

.history-linked-changes > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-linked-changes .text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.history-linked-changes small {
  color: var(--muted);
  font-weight: 750;
}

.history-change {
  display: inline-grid;
  gap: 3px;
  max-width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 750;
}

.history-change span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-change.asset {
  flex: 1 1 260px;
  width: 100%;
}

.history-asset-diff {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: min(560px, 100%);
}

.history-asset-diff div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.62);
}

.history-asset-diff span,
.history-asset-diff em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.history-asset-diff strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-asset-diff a {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.snapshot-browser {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.snapshot-browser-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
  color: var(--ink);
  font-size: 12px;
}

.snapshot-browser-title.subtle {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.snapshot-browser-title span {
  color: var(--muted);
  font-weight: 750;
}

.snapshot-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.snapshot-overview div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.snapshot-overview span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.snapshot-overview strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-edit-form {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.node-edit-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.classification-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.classification-fields.full-span {
  grid-column: 1 / -1;
}

.classification-fields label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.node-edit-form.form-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 40;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow:
    0 0 0 100vmax rgba(20, 34, 38, 0.32),
    0 24px 80px rgba(23, 32, 37, 0.24);
  transform: translate(-50%, -50%);
}

.dialog-form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-form-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.dialog-form-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.asset-uploader {
  position: relative;
  display: grid !important;
  place-items: center;
  align-content: center;
  gap: 8px !important;
  min-height: 132px;
  padding: 18px 16px;
  border: 2px dashed #aebdc4;
  border-radius: 8px;
  color: var(--ink) !important;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 251, 251, 0.94)),
    #ffffff;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.asset-uploader:hover,
.asset-uploader.dragging {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(240, 251, 250, 0.98), rgba(229, 246, 245, 0.98)),
    var(--accent-soft);
  box-shadow: 0 10px 28px rgba(8, 124, 123, 0.12);
}

.asset-uploader.dragging {
  transform: translateY(-1px);
}

.asset-drop-active .asset-uploader {
  border-color: rgba(8, 124, 123, 0.52);
  background:
    linear-gradient(180deg, rgba(240, 251, 250, 0.96), rgba(255, 255, 255, 0.96)),
    #ffffff;
}

.asset-uploader::before {
  content: "";
  position: relative;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(8, 124, 123, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(var(--accent), var(--accent)) center 10px / 2px 13px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center 10px / 13px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center 23px / 16px 2px no-repeat,
    #f3fbfa;
}

.asset-uploader-title {
  position: relative;
  z-index: 2;
  font-size: 14px;
  font-weight: 850;
}

.asset-uploader-hint,
.asset-uploader-file {
  position: relative;
  z-index: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.asset-uploader-file {
  width: 100%;
  max-width: 100%;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-uploader.has-file .asset-uploader-file {
  border-color: rgba(8, 124, 123, 0.24);
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 750;
}

.asset-uploader-status {
  position: relative;
  z-index: 2;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.asset-uploader.is-uploading .asset-uploader-status {
  color: #9a6818;
}

.asset-uploader.upload-error {
  border-color: rgba(188, 62, 62, 0.62);
  background: #fff7f7;
}

.asset-uploader.upload-error .asset-uploader-status {
  color: var(--danger);
}

.asset-remove-button {
  position: relative;
  z-index: 3;
  display: none;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #e1b9b9;
  border-radius: 999px;
  color: var(--danger);
  background: #fff7f7;
  font-size: 12px;
  font-weight: 750;
}

.asset-uploader.has-file .asset-remove-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.asset-uploader input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.asset-uploader input[type="hidden"] {
  display: none;
}

.supplier-attachment-field {
  display: grid !important;
  grid-column: 1 / -1;
  gap: 8px !important;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.recommended-supplier-field {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) minmax(180px, 1fr);
  gap: 10px 14px;
  padding: 14px;
  border: 1px solid var(--line, #dfe7e2);
  border-radius: 12px;
  background: #f8fbf9;
}

.recommended-supplier-field > select[multiple] {
  min-height: 112px;
  grid-row: span 2;
}

.recommended-supplier-field > button {
  justify-self: start;
}

.supplier-suggestion-queue {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.supplier-suggestion-queue > strong {
  color: #8a5a13;
  font-size: 13px;
}

.supplier-suggestion-queue > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border: 1px solid #efd8aa;
  border-radius: 9px;
  background: #fffaf0;
}

.supplier-suggestion-queue span,
.supplier-suggestion-queue small {
  display: block;
}

.supplier-suggestion-queue button {
  margin-left: 4px;
}

@media (max-width: 760px) {
  .recommended-supplier-field {
    grid-template-columns: 1fr;
  }
}

.supplier-attachment-drop {
  position: relative;
  display: grid !important;
  gap: 6px !important;
  min-height: 104px;
  padding: 16px;
  border: 1px dashed #b7c5cb;
  border-radius: 8px;
  color: var(--ink) !important;
  background: #ffffff;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.supplier-attachment-field.dragging .supplier-attachment-drop,
.supplier-attachment-drop:hover {
  border-color: var(--accent);
  background: #f5fbfb;
  box-shadow: 0 8px 22px rgba(8, 124, 123, 0.08);
}

.supplier-attachment-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.supplier-attachment-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.supplier-attachment-drop input[type="file"],
.supplier-attachment-field input[type="hidden"] {
  display: none;
}

.supplier-attachment-list {
  display: grid;
  gap: 6px;
}

.supplier-attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.supplier-attachment-item a {
  min-width: 0;
  overflow: hidden;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-attachment-item span,
.supplier-attachment-empty,
.supplier-attachment-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.supplier-attachment-status {
  min-height: 18px;
}

.supplier-attachment-field[data-upload-status="uploading"] .supplier-attachment-status {
  color: #9a6818;
}

.supplier-attachment-field[data-upload-status="error"] .supplier-attachment-status {
  color: var(--danger);
}

.supplier-attachment-view {
  display: grid;
  gap: 6px;
}

.form-section-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.compact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px !important;
}

.checkbox-line input {
  width: 15px;
  height: 15px;
}

.child-form {
  margin-top: 2px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.tab {
  min-height: 46px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.tab:last-child {
  border-right: 0;
}

.tab.active {
  color: var(--accent-dark);
  background: #ffffff;
}

.tab-panel {
  display: none;
  padding: 18px;
}

.tab-panel.active {
  display: grid;
  gap: 16px;
}

.compare-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compare-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.diff-list,
.change-list,
.file-list,
.role-grid {
  display: grid;
  gap: 10px;
}

.change-context-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.change-context-box textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.5;
}

.diff-item,
.change-item,
.file-item,
.role-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.diff-item {
  display: grid;
  gap: 6px;
}

.diff-type {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.diff-type.added {
  color: var(--ok);
  background: var(--ok-soft);
}

.diff-type.changed {
  color: var(--warning);
  background: var(--warning-soft);
}

.diff-type.removed {
  color: var(--danger);
  background: var(--danger-soft);
}

.item-title {
  font-weight: 760;
}

.item-meta,
.role-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
}

.bom-empty-state {
  display: grid;
  min-height: 260px;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.bom-empty-state strong {
  color: var(--ink);
}

.bom-empty-state p {
  max-width: 360px;
  margin: 0;
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px;
  background: rgba(12, 22, 25, 0.46);
}

.modal-backdrop[hidden] {
  display: none;
}

.unsaved-changes-backdrop {
  z-index: 12000;
}

.backup-progress-backdrop {
  z-index: 13000;
  cursor: wait;
}

.global-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 12900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 18, 21, 0.38);
  backdrop-filter: blur(1.5px);
  cursor: wait;
}

.global-busy-overlay[hidden] {
  display: none;
}

.global-busy-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: min(380px, 100%);
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 22px 70px rgba(5, 16, 19, 0.28);
}

.global-busy-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.global-busy-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.global-busy-spinner {
  width: 32px;
  height: 32px;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: backup-progress-spin 0.8s linear infinite;
}

.backup-progress-dialog {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 22px;
  outline: none;
}

.backup-progress-dialog h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.backup-progress-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.backup-progress-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: backup-progress-spin 0.8s linear infinite;
}

@keyframes backup-progress-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .backup-progress-spinner {
    animation-duration: 1.6s;
  }
}

.unsaved-changes-dialog {
  padding-bottom: 18px;
}

.unsaved-changes-dialog .modal-actions {
  padding: 0 18px;
}

.modal {
  width: min(620px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(12, 22, 25, 0.22);
}

.app-update-backdrop {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px;
  background: rgba(12, 22, 25, 0.56);
}

.app-update-backdrop[hidden] {
  display: none;
}

.app-update-dialog {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  width: min(560px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(12, 22, 25, 0.28);
}

.app-update-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 20px;
  font-weight: 800;
}

.app-update-content {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.app-update-content h2 {
  margin: 0;
  font-size: 18px;
}

.app-update-content p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.app-update-meta {
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
}

.app-update-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.compact-modal {
  width: min(560px, 100%);
}

.move-node-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(960px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
}

.wide-modal {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  overscroll-behavior: contain;
}

.bom-item-compare-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.bom-item-compare-body {
  min-height: 0;
  overflow: auto;
}

.bom-item-compare-selectors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.bom-item-compare-selectors label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bom-item-compare-selectors .select {
  width: 100%;
  background: #ffffff;
}

.bom-item-compare-arrow {
  padding-bottom: 10px;
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
}

.bom-item-compare-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 10px;
}

.bom-item-compare-note {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(196, 139, 37, 0.35);
  border-radius: 8px;
  color: #7a5818;
  background: #fffaf0;
  font-size: 12px;
}

.bom-item-compare-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bom-item-compare-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  font-size: 12px;
}

.bom-item-compare-table th,
.bom-item-compare-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.bom-item-compare-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: var(--panel-soft);
}

.bom-item-compare-table tr:last-child td {
  border-bottom: 0;
}

.bom-item-compare-table td:nth-child(2) {
  min-width: 250px;
}

.bom-item-compare-table td:nth-child(4),
.bom-item-compare-table td:nth-child(5) {
  min-width: 180px;
  max-width: 320px;
  overflow-wrap: anywhere;
}

.bom-item-compare-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 400;
}

.bom-item-compare-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.reference-compare-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1560px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: min(920px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.reference-compare-body {
  min-height: 0;
  overflow: auto;
}

.reference-compare-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(196, 139, 37, 0.35);
  border-radius: 10px;
  background: #fffaf0;
}

.reference-compare-overview > div {
  display: grid;
  gap: 4px;
}

.reference-compare-overview span,
.reference-compare-overview small {
  color: var(--muted);
  font-size: 12px;
}

.reference-compare-overview strong {
  font-size: 17px;
}

.reference-compare-direction {
  color: var(--accent) !important;
  font-size: 24px !important;
  font-weight: 800;
}

.reference-compare-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(280px, 1fr);
  gap: 12px;
  margin: 14px 0 0;
}

.reference-compare-actions {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 5px 15px rgba(27, 45, 51, 0.06);
}

.reference-compare-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.reference-compare-toolbar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reference-compare-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px;
}

.reference-compare-result-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.reference-compare-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.reference-compare-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 12px;
}

.reference-compare-table th,
.reference-compare-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.reference-compare-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: var(--panel-soft);
}

.reference-compare-table tr:last-child td {
  border-bottom: 0;
}

.reference-compare-table td:nth-child(2) {
  min-width: 290px;
}

.reference-compare-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.reference-compare-table .compare-value {
  min-width: 220px;
  max-width: 380px;
  overflow-wrap: anywhere;
}

.reference-compare-table tr:not(.same) .old-value {
  color: #9b3d3d;
  background: rgba(194, 74, 74, 0.05);
}

.reference-compare-table tr:not(.same) .new-value {
  color: #176b5f;
  background: rgba(16, 137, 123, 0.06);
}

.diff-count.same {
  color: var(--muted);
  background: var(--panel-soft);
}

@media (max-width: 720px) {
  .reference-compare-overview,
  .reference-compare-toolbar {
    grid-template-columns: 1fr;
  }

  .reference-compare-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .reference-compare-direction {
    display: none;
  }
}

@media (max-width: 720px) {
  .bom-item-compare-selectors {
    grid-template-columns: 1fr;
  }

  .bom-item-compare-arrow {
    display: none;
  }
}

#classificationRuleDialog .classification-rule-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

#classificationRuleDialog .classification-rule-modal-body {
  max-height: calc(100vh - 132px);
  overflow: auto;
  overscroll-behavior: contain;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.modal-header p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 18px;
  overscroll-behavior: contain;
}

.move-node-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  min-height: 0;
}

.move-parent-list {
  min-height: min(56vh, 540px);
  max-height: calc(100vh - 270px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}

.move-parent-option {
  display: grid;
  grid-template-columns: 22px 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 3px 10px 3px calc(8px + var(--depth, 0) * 20px);
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.move-parent-option:hover {
  border-color: rgba(15, 131, 125, 0.24);
  background: #f2fbfa;
}

.move-parent-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.move-parent-option.disabled {
  color: var(--muted);
  background: #eef3f3;
  cursor: not-allowed;
}

.move-parent-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.move-parent-main strong,
.move-parent-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-parent-main strong {
  min-width: 0;
  font-size: 13px;
}

.move-parent-main small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.move-parent-toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.move-parent-toggle:hover:not(:disabled) {
  background: var(--accent-soft);
}

.move-parent-toggle:disabled {
  cursor: default;
}

@media (max-width: 760px) {
  .move-node-modal {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .move-parent-list {
    min-height: 45vh;
  }
}

.material-detail-layout {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  align-items: start;
}

.product-detail-modal {
  width: min(980px, calc(100vw - 48px));
}

.product-detail-layout {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  align-items: start;
}

.product-detail-side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 0;
  min-width: 0;
}

.product-detail-side h3 {
  margin: 0;
  font-size: 20px;
}

.product-detail-side > strong {
  color: var(--muted);
  font-size: 14px;
}

.product-detail-form .form-section-title {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
}

.material-detail-side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 0;
  min-width: 0;
}

.material-detail-side h3 {
  margin: 0;
  font-size: 20px;
}

.material-detail-side > strong {
  color: var(--muted);
  font-size: 14px;
}

.mini-stack {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
  line-height: 1.45;
}

.permission-note {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #b9ddd9;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 13px;
}

.permission-note.readonly {
  border-color: var(--line);
  color: var(--muted);
  background: var(--panel-soft);
}

.material-detail-side h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.material-usage-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.material-usage-heading h4 {
  margin-bottom: 3px;
}

.material-usage-heading .item-meta {
  display: block;
}

.usage-list.compact {
  display: grid;
  gap: 8px;
}

.usage-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.usage-row:hover {
  border-color: #9ddbd7;
  background: var(--accent-soft);
}

.usage-row span {
  color: var(--muted);
  font-size: 12px;
}

.where-used-modal {
  width: min(1080px, calc(100vw - 40px));
}

.where-used-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.where-used-overview > div {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.where-used-overview span {
  color: var(--muted);
  font-size: 12px;
}

.where-used-overview strong {
  font-size: 20px;
}

.where-used-list {
  display: grid;
  gap: 12px;
}

.where-used-record {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.where-used-record-head,
.where-used-record-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.where-used-path {
  display: flex;
  align-items: stretch;
  gap: 7px;
  padding: 10px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--panel-soft);
}

.where-used-path-step {
  display: grid;
  flex: 0 0 auto;
  gap: 2px;
  min-width: 100px;
  max-width: 190px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.where-used-path-step strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.where-used-path-step small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.where-used-path-step.product,
.where-used-path-step.target {
  border-color: #9ddbd7;
  background: var(--accent-soft);
}

.where-used-path-step.bom {
  min-width: 74px;
}

.where-used-path-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 20px;
}

@media (max-width: 760px) {
  .where-used-overview {
    grid-template-columns: 1fr;
  }

  .where-used-record-head {
    align-items: flex-start;
  }
}

.material-detail-form {
  padding: 0;
}

.material-form-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.material-form-section + .material-form-section {
  margin-top: 2px;
}

.material-form-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.material-form-section-head h3,
.material-form-section-head p {
  margin: 0;
}

.material-form-section-head h3 {
  font-size: 15px;
}

.material-form-section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.section-permission-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
}

.section-permission-badge.readonly {
  color: var(--muted);
  background: var(--panel-soft);
}

.material-form-section.readonly-section {
  background: var(--panel-soft);
}

.recommended-supplier-field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.recommended-supplier-head,
.recommended-supplier-head span {
  display: block;
}

.recommended-supplier-head,
.recommended-supplier-search,
.recommended-supplier-results,
.recommended-supplier-selected,
.recommended-supplier-notes {
  grid-column: 1 / -1;
}

.recommended-supplier-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.recommended-supplier-search {
  display: grid;
  gap: 6px;
}

.recommended-supplier-results,
.recommended-supplier-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.recommended-supplier-result-head,
.recommended-supplier-selected-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.recommended-supplier-result-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  font-weight: 700;
}

.recommended-supplier-selected {
  display: grid;
  gap: 7px;
}

.recommended-supplier-result-row,
.recommended-supplier-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
}

.recommended-supplier-result-row + .recommended-supplier-result-row,
.recommended-supplier-row + .recommended-supplier-row {
  border-top: 1px solid var(--line);
}

.recommended-supplier-result-row > span,
.recommended-supplier-identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.recommended-supplier-result-row small,
.recommended-supplier-identity span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommended-supplier-row {
  grid-template-columns: minmax(0, 1fr) auto 34px;
}

.recommended-supplier-row.is-primary {
  background: color-mix(in srgb, var(--accent-soft) 48%, var(--panel));
}

.recommended-supplier-primary {
  min-width: 104px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
}

.recommended-supplier-primary.active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 700;
}

.recommended-supplier-remove {
  min-width: 32px;
  min-height: 32px;
}

.recommended-supplier-search-hint,
.recommended-supplier-empty {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 12px;
}

.recommended-supplier-notes {
  display: grid;
  gap: 6px;
}

.recommended-supplier-notes textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
}

#materialDetailDialog .wide-modal {
  width: min(1440px, calc(100vw - 40px));
}

.material-assets-section {
  display: grid;
  min-width: 0;
  gap: 14px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.material-assets-section > * {
  grid-column: 1 / -1;
}

.material-assets-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.material-assets-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.material-assets-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.material-asset-preview > .asset-preview-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-bottom: 0;
  border-bottom: 0;
}

.material-asset-preview .asset-preview-body,
.material-asset-preview .asset-empty,
.material-asset-preview .asset-image-error,
.material-asset-preview .asset-file-preview {
  min-height: 180px;
}

.material-asset-preview .asset-preview-body img,
.material-asset-preview .asset-preview-body object,
.material-asset-preview .asset-image-preview,
.material-asset-preview .pdf-inline-preview-shell,
.material-asset-preview .model-preview canvas {
  height: 200px;
}

.material-asset-preview .model-preview {
  min-height: 200px;
}

.material-asset-editors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.material-asset-editor {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.material-detail-form .material-asset-requirement {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.material-detail-form .material-asset-requirement .select {
  width: 104px;
  min-height: 34px;
  padding-block: 5px;
  background: #ffffff;
}

.material-asset-editor .asset-uploader {
  min-height: 126px;
  padding: 14px 12px;
}

.material-asset-editor .asset-uploader::before {
  width: 30px;
  height: 30px;
  background:
    linear-gradient(var(--accent), var(--accent)) center 8px / 2px 12px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center 8px / 12px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center 21px / 15px 2px no-repeat,
    #f3fbfa;
}

.material-asset-editor .asset-uploader-title {
  font-size: 13px;
}

@media (max-width: 1100px) {
  .material-detail-layout {
    grid-template-columns: 1fr;
  }

  .material-detail-side {
    position: static;
  }

  .product-detail-layout {
    grid-template-columns: 1fr;
  }

  .product-detail-side {
    position: static;
  }
}

@media (max-width: 760px) {
  .product-detail-modal {
    width: 100%;
  }

  .material-asset-preview > .asset-preview-grid,
  .material-asset-editors,
  .material-form-section,
  .recommended-supplier-grid {
    grid-template-columns: 1fr;
  }

  .recommended-supplier-row {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .recommended-supplier-primary {
    grid-column: 1;
    justify-self: start;
  }
}

#nodeHomeDialog .modal {
  width: min(1560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

#nodeHomeDialog .modal-body {
  max-height: calc(100vh - 134px);
  overflow: hidden;
  padding: 0;
}

.bom-unsaved-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  color: #ffffff;
  background: #c62828;
  box-shadow: inset 0 -1px 0 rgba(103, 15, 15, 0.3);
}

.bom-unsaved-notice[hidden] {
  display: none;
}

.bom-unsaved-notice strong {
  font-size: 14px;
}

.bom-unsaved-notice span {
  font-size: 12px;
  opacity: 0.92;
}

#nodeHomeDialog .modal:has(.bom-unsaved-notice:not([hidden])) .modal-body,
#nodeHomeDialog .modal:has(.bom-unsaved-notice:not([hidden])) .node-home-layout,
#nodeHomeDialog .modal:has(.bom-unsaved-notice:not([hidden])) .node-home-subtree,
#nodeHomeDialog .modal:has(.bom-unsaved-notice:not([hidden])) .node-home-summary,
#nodeHomeDialog .modal:has(.bom-unsaved-notice:not([hidden])) .node-home-detail {
  max-height: calc(100vh - 174px);
}

#nodeHomeDialog .modal:has(.bom-unsaved-notice:not([hidden])) .node-home-layout {
  height: calc(100vh - 174px);
}

.node-home-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100vh - 134px);
  min-height: 0;
}

.node-home-layout.has-subtree {
  grid-template-columns: minmax(300px, 370px) minmax(280px, 340px) minmax(440px, 1fr);
}

.node-home-subtree,
.node-home-summary,
.node-home-detail {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 18px;
}

.node-home-command-bar {
  position: relative;
  z-index: 8;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 5px 16px rgba(23, 48, 52, 0.06);
}

.node-home-command-bar.editing {
  background: #f4fbfa;
}

.node-home-command-context {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.node-home-command-context strong,
.node-home-command-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-home-command-context span {
  color: var(--muted);
  font-size: 11px;
}

.node-home-command-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.node-home-action-menu {
  position: relative;
}

.node-home-action-menu > summary {
  list-style: none;
  cursor: pointer;
}

.node-home-action-menu > summary::-webkit-details-marker {
  display: none;
}

.node-home-action-menu[open] > summary {
  border-color: #8ccac6;
  background: var(--accent-soft);
}

.node-home-action-menu-panel {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 12;
  display: grid;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 44px rgba(23, 48, 52, 0.18);
}

.node-home-action-menu-panel.align-right {
  right: 0;
  left: auto;
}

.node-home-action-menu-panel button {
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.node-home-action-menu-panel button:hover:not(:disabled) {
  background: var(--panel-soft);
}

.node-home-action-menu-panel button.danger-text {
  color: #b3261e;
}

.node-home-subtree {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.node-home-subtree-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.node-home-subtree-head > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.node-home-subtree-head strong,
.node-home-subtree-head small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-home-subtree-head small,
.node-home-tree-meta {
  color: var(--muted);
  font-size: 11px;
}

.node-home-tree-search .search-input {
  width: 100%;
}

.node-home-tree {
  min-height: 260px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.node-home-tree-row {
  display: grid;
  grid-template-columns: 22px 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  margin: 2px 0;
  padding: 3px 7px 3px calc(6px + var(--node-home-depth, 0) * 18px);
  border: 1px solid transparent;
  border-radius: 8px;
}

.node-home-tree-row.multi-selected {
  border-color: #8ccac6;
  background: #f2fbfa;
}

.reference-impact-backdrop {
  z-index: 70;
}

.reference-impact-modal {
  width: min(1120px, calc(100vw - 32px));
}

.reference-impact-body {
  display: grid;
  gap: 14px;
}

.reference-impact-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.reference-impact-summary > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.reference-impact-summary span,
.reference-impact-summary small {
  color: var(--muted);
  font-size: 11px;
}

.reference-impact-summary strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-impact-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reference-impact-list {
  display: grid;
  gap: 8px;
  max-height: min(52vh, 560px);
  overflow: auto;
  padding: 2px;
}

.reference-impact-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.reference-impact-row.inspecting {
  grid-template-columns: minmax(0, 1fr) auto;
}

.reference-impact-row.inspecting > .badge {
  align-self: start;
  white-space: nowrap;
}

.reference-impact-row:has(input:checked) {
  border-color: #77c3be;
  background: #f1fbfa;
}

.reference-impact-row.blocked {
  opacity: 0.68;
  background: var(--panel-soft);
}

.reference-impact-row.blocked input[type="checkbox"] {
  cursor: not-allowed;
  filter: grayscale(1);
}

.reference-impact-row-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.reference-impact-row-main small {
  color: var(--muted);
  line-height: 1.5;
}

.reference-impact-row-main em {
  color: #a15c00;
  font-size: 11px;
  font-style: normal;
}

.bom-reference-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 4px 12px;
  padding: 11px 12px;
  border: 1px solid #efc36f;
  border-radius: 8px;
  color: #744600;
  background: #fff8e8;
}

.bom-reference-warning > div {
  display: grid;
  gap: 3px;
}

.bom-reference-warning span {
  font-size: 11px;
}

.node-home-tree-row:hover,
.node-home-tree-row.selected {
  border-color: #b9d9d6;
  background: #ffffff;
}

.node-home-tree-row.selected {
  box-shadow: inset 3px 0 0 var(--accent);
}

.node-home-tree-toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.node-home-tree-toggle:hover:not(:disabled) {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.node-home-tree-toggle:disabled {
  cursor: default;
}

.node-home-tree-main {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 2px 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.node-home-tree-name,
.node-home-tree-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-home-tree-name {
  font-weight: 750;
}

.node-home-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1100px) {
  .node-home-layout.has-subtree {
    grid-template-columns: minmax(240px, 270px) minmax(250px, 290px) minmax(360px, 1fr);
  }
}

@media (max-width: 900px) {
  #nodeHomeDialog .modal-body {
    overflow: auto;
  }

  .node-home-layout.has-subtree {
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
    height: auto;
  }

  .node-home-layout.has-subtree .node-home-subtree {
    grid-column: 1 / -1;
    grid-row: 1;
    height: min(360px, 42vh);
  }

  .node-home-layout.has-subtree .node-home-summary {
    grid-column: 1;
    grid-row: 2;
    max-height: none;
  }

  .node-home-layout.has-subtree .node-home-detail {
    grid-column: 2;
    grid-row: 2;
    max-height: none;
  }
}

@media (max-width: 760px) {
  #nodeHomeDialog .modal {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .node-home-layout,
  .node-home-layout.has-subtree {
    grid-template-columns: 1fr;
    height: auto;
  }

  .node-home-command-bar,
  .reference-impact-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .node-home-command-actions {
    justify-content: flex-start;
  }

  .reference-impact-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .node-home-layout.has-subtree .node-home-subtree,
  .node-home-layout.has-subtree .node-home-summary,
  .node-home-layout.has-subtree .node-home-detail {
    position: static;
    grid-column: 1;
    grid-row: auto;
    width: auto;
    height: auto;
    max-height: none;
  }

  .node-home-subtree {
    min-height: 360px;
  }
}

.node-home-summary {
  border-right: 1px solid var(--line);
  background: var(--panel-soft);
}

.node-home-detail {
  display: grid;
  align-content: start;
  gap: 14px;
}

.node-home-title {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.node-home-title h3 {
  margin: 0;
}

.node-home-title p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.record-fields.compact {
  grid-template-columns: 1fr;
}

.record-fields.compact strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.node-home-edit-fields {
  display: grid;
  gap: 10px;
}

.node-home-edit-fields .classification-fields {
  grid-template-columns: 1fr;
}

.node-home-edit-field {
  display: grid;
  gap: 5px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.node-home-readonly-value {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #eef2f4;
  font-size: 14px;
  line-height: 20px;
  user-select: text;
}

.node-home-edit-field.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 0;
  color: var(--ink);
}

.node-home-edit-field.checkbox input {
  width: 18px;
  height: 18px;
}

.node-home-edit-field.wide {
  grid-column: 1 / -1;
}

.node-home-edit-field textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.45;
}

.mbom-process-editor,
.mbom-process-view {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mbom-process-view > div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.mbom-process-view > div.wide {
  grid-column: 1 / -1;
}

.mbom-process-view span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mbom-process-view strong {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.text-link {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.mbom-source-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mbom-source-card.behind {
  border-color: rgba(194, 118, 29, 0.38);
  background: #fffaf1;
}

.mbom-source-card.synced {
  border-color: rgba(14, 129, 122, 0.3);
  background: #f3fbfa;
}

.mbom-source-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mbom-source-card h3 {
  margin: 4px 0 0;
  font-size: 18px;
}

.mbom-source-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.mbom-source-kv {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mbom-source-kv > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.mbom-source-kv span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mbom-source-kv strong {
  overflow-wrap: anywhere;
}

.mbom-asset-note {
  padding: 10px 12px;
  border: 1px dashed rgba(14, 129, 122, 0.28);
  border-radius: 8px;
  color: var(--muted);
  background: #f7fbfb;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
}

.node-home-asset-editors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  align-items: stretch;
  gap: 10px;
}

.node-home-asset-editor {
  display: grid;
  grid-template-rows: auto minmax(150px, 1fr);
  gap: 8px;
  min-width: 0;
}

.node-home-asset-editor > label:not(.asset-uploader) {
  display: grid;
  align-content: start;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.node-home-asset-editor > label:not(.asset-uploader) .select {
  width: 100%;
  min-height: 42px;
}

.node-home-asset-editor .asset-uploader {
  min-height: 150px;
}

#nodeHomeEditForm .node-home-summary {
  background: #ffffff;
}

#nodeHomeEditForm .node-home-detail {
  background: var(--panel-soft);
}

.node-version-summary {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.version-summary-head,
.version-summary-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.version-summary-head span,
.version-summary-current span,
.node-version-summary p,
.version-mini-list span {
  color: var(--muted);
  font-size: 12px;
}

.version-summary-head strong {
  color: var(--accent-dark);
  font-size: 18px;
}

.version-summary-current strong {
  font-size: 15px;
}

.node-version-summary p {
  margin: 0;
  line-height: 1.45;
}

.version-mini-list {
  display: grid;
  gap: 6px;
}

.version-mini-list div {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.version-mini-list strong {
  font-size: 13px;
}

#nodeHomeDialog .node-home-detail > .asset-preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card:nth-child(3) {
  grid-column: 1 / -1;
}

#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .asset-preview-body {
  min-height: 240px;
}

#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .asset-preview-body img,
#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .asset-preview-body object,
#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .asset-preview-body .asset-image-preview,
#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .asset-preview-body .pdf-inline-preview-shell {
  height: 260px;
}

#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .asset-empty,
#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .asset-image-error,
#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .asset-file-preview {
  min-height: 240px;
}

#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card:nth-child(3) .asset-preview-body,
#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card:nth-child(3) .asset-empty,
#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card:nth-child(3) .asset-image-error,
#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card:nth-child(3) .asset-file-preview {
  min-height: 320px;
}

#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .model-preview {
  min-height: 320px;
}

#nodeHomeDialog .node-home-detail > .asset-preview-grid > .asset-preview-card .model-preview canvas {
  height: 320px;
}

.asset-comments-panel {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.asset-comment-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.asset-comment-textarea-wrap {
  position: relative;
  min-width: 0;
}

.asset-comment-form textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
}

.mention-suggestion-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  display: grid;
  max-height: 248px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #bad9d4;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(20, 36, 37, 0.18);
}

.mention-suggestion-menu[hidden] {
  display: none;
}

.mention-menu-item {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.mention-menu-item:hover,
.mention-menu-item.active {
  background: #e9f8f4;
}

.mention-menu-item strong {
  color: #14685f;
  font-size: 13px;
}

.mention-menu-item span,
.mention-menu-empty {
  color: var(--muted);
  font-size: 12px;
}

.mention-menu-empty {
  padding: 8px 10px;
}

.asset-comment-actions,
.asset-comment-form .form-message {
  grid-column: 1 / -1;
}

.asset-comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.asset-thread-list {
  display: grid;
  gap: 10px;
}

.message-list {
  display: grid;
  gap: 10px;
}

.message-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.message-item.unread {
  border-color: #95d9ce;
  box-shadow: inset 3px 0 0 #33b8a6;
}

.message-item.bom-change.unread {
  border-color: #efc36f;
  box-shadow: inset 3px 0 0 #d58a16;
}

.message-item.read {
  background: #f8faf9;
}

.message-item-main {
  min-width: 0;
}

.message-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.message-item-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.message-item-head > span:last-child {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.message-item p {
  margin: 8px 0;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.asset-thread-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.asset-thread-marker {
  display: grid;
  min-height: 64px;
  place-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.asset-thread-body {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.asset-thread-head,
.asset-thread-foot,
.asset-thread-file-diff {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.asset-thread-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.asset-thread-head strong,
.asset-thread-file-diff span {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-thread-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.asset-thread-body p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-wrap;
}

.asset-version-node .asset-thread-marker {
  color: var(--accent-dark);
  background: #eef8f7;
}

.asset-version-node .asset-thread-body {
  border-color: rgba(14, 129, 122, 0.24);
  background: #f7fbfb;
}

.asset-thread-item.addressed .asset-thread-body {
  background: #fafafa;
}

.asset-thread-item.addressed p {
  color: var(--muted);
}

#nodeHomeDialog .snapshot-browser .asset-preview-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

#nodeHomeDialog .snapshot-browser .asset-preview-body {
  min-height: 140px;
}

#nodeHomeDialog .snapshot-browser .asset-preview-body img,
#nodeHomeDialog .snapshot-browser .asset-preview-body object,
#nodeHomeDialog .snapshot-browser .asset-preview-body .asset-image-preview,
#nodeHomeDialog .snapshot-browser .asset-preview-body .pdf-inline-preview-shell {
  height: 160px;
}

#nodeHomeDialog .snapshot-browser .asset-empty,
#nodeHomeDialog .snapshot-browser .asset-image-error,
#nodeHomeDialog .snapshot-browser .asset-file-preview {
  min-height: 140px;
}

#nodeHomeDialog .snapshot-browser .model-preview {
  min-height: 160px;
}

#nodeHomeDialog .snapshot-browser .model-preview canvas {
  height: 160px;
}

#nodeHomeDialog .node-home-history-compact {
  display: grid;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

#nodeHomeDialog .history-list.compact {
  gap: 8px;
}

#nodeHomeDialog .history-list.compact .history-card summary {
  padding: 10px 12px;
}

#nodeHomeDialog .history-list.compact .history-card:not([open]) {
  background: var(--panel-soft);
}

#nodeHomeDialog .history-list.compact .history-card:not([open]) summary strong {
  font-size: 13px;
}

#nodeHomeDialog .history-list.compact .history-card:not([open]) summary em {
  font-size: 11px;
}

#nodeHomeDialog .history-list.compact .state {
  font-size: 11px;
}

.modal-section-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid label:first-child {
  grid-column: 1 / -1;
}

.form-grid .full-span {
  grid-column: 1 / -1;
}

.bom-source-combobox {
  position: relative;
  display: block;
}

.checkbox-field {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  width: auto;
}

.form-message {
  grid-column: 1 / -1;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: #16805a;
}

.danger-summary {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  background: var(--danger-soft);
}

.danger-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.danger-summary strong {
  color: var(--ink);
  font-size: 18px;
}

.danger-summary code {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--danger);
  background: #ffffff;
  font-family: inherit;
  font-weight: 800;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

input[readonly] {
  color: var(--muted);
  background: #eef2f4;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions.stacked {
  display: grid;
  justify-content: stretch;
  margin-top: 14px;
}

#deleteEcrButton {
  margin-right: auto;
}

.change-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.change-record-body {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.change-record-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.change-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ecr-modal {
  width: min(1040px, calc(100vw - 40px));
}

.mbom-wizard-modal {
  width: min(980px, calc(100vw - 40px));
}

.mbom-wizard-form {
  gap: 18px;
}

.mbom-wizard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px;
}

.mbom-wizard-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.mbom-wizard-card label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.mbom-strategy-section {
  display: grid;
  gap: 12px;
}

.mbom-upgrade-note {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(11, 130, 118, 0.22);
  border-radius: 8px;
  background: #f4fbfa;
}

.mbom-upgrade-note strong {
  color: var(--ink);
  font-size: 13px;
}

.mbom-upgrade-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mbom-wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mbom-wizard-steps article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mbom-wizard-steps strong {
  font-size: 13px;
}

.mbom-wizard-steps span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ecr-form {
  display: grid;
  gap: 14px;
}

.ecr-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.ecr-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ecr-document-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.ecr-document-link-row .ghost-button {
  height: 36px;
}

.ecr-doc-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.ecr-info-summary {
  display: grid;
  gap: 10px;
}

.ecr-info-card,
.ecr-info-summary-grid > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.ecr-info-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ecr-info-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.ecr-info-summary-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.ecr-impact-list {
  display: grid;
  gap: 10px;
}

.ecr-impact-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ecr-impact-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ecr-impact-section-head strong,
.ecr-impact-section-head span {
  display: block;
}

.ecr-impact-section-head > div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ecr-impact-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ecr-bom-link {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f8fbfb;
}

.ecr-impact-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ecr-impact-add-row .field-help {
  margin: 0;
}

.ecr-pending-impact-list {
  display: grid;
  gap: 8px;
}

.ecr-pending-empty {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.ecr-pending-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ecr-pending-rows {
  display: grid;
  gap: 8px;
}

.ecr-pending-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ecr-pending-row strong,
.ecr-pending-row span,
.ecr-pending-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecr-pending-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ecr-pending-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.bom-node-combobox {
  position: relative;
}

.change-combobox,
.material-reference-combobox {
  position: relative;
  display: block;
}

.combobox-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
}

.combobox-option {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.combobox-option:hover,
.combobox-option.active {
  background: var(--accent-soft);
}

.combobox-option strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
}

.combobox-option span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.combobox-empty {
  display: block;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ecr-impact-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ecr-impact-table {
  min-width: 760px;
}

.ecr-impact-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 650;
}

.bom-version-linked-changes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.bom-version-linked-changes > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bom-version-linked-changes .text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.bom-version-linked-changes small {
  color: var(--muted);
  font-weight: 750;
}

.file-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
}

.file-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 800;
}

@media (max-width: 1380px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1520px) {
  .preconfigured-user-form.permission-tool-form {
    grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1fr) minmax(220px, 1.1fr) minmax(140px, 0.7fr) 132px;
  }

  .preconfigured-domain-field {
    grid-column: 1 / -2;
  }

  .preconfigured-user-form button[type="submit"] {
    grid-column: -2 / -1;
  }
}

@media (max-width: 1180px) {
  .bom-layout,
  .config-layout,
  .summary-grid,
  .dashboard-grid,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .preconfigured-user-form.permission-tool-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preconfigured-domain-field,
  .preconfigured-user-form button[type="submit"] {
    grid-column: auto;
  }

  .preconfigured-user-form button[type="submit"] {
    width: 100%;
  }

  .permission-user-row {
    grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.8fr) minmax(240px, 1.2fr);
  }

  .permission-user-actions {
    text-align: left;
  }

  .ecr-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tree-card,
  .node-card {
    min-height: auto;
  }

  #nodeHomeDialog .asset-preview-grid {
    grid-template-columns: 1fr;
  }

  .node-home-asset-editors {
    grid-template-columns: 1fr;
  }

  .mbom-process-editor,
  .mbom-process-view {
    grid-template-columns: 1fr;
  }

  .mbom-source-kv {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding-bottom: 22px;
    overflow: visible;
  }

  .sidebar-footer {
    position: static;
    width: auto;
    max-height: none;
    margin-top: 14px;
    overflow: visible;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
  }

  .main {
    padding: 18px;
  }

  .preconfigured-user-form.permission-tool-form,
  .permission-user-row {
    grid-template-columns: 1fr;
  }

  .permission-user-main {
    grid-template-columns: 1fr;
  }

  .permission-user-search-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .permission-user-search-row .item-meta {
    padding-bottom: 0;
  }

  .asset-comment-form,
  .asset-thread-item {
    grid-template-columns: 1fr;
  }

  .asset-thread-marker {
    min-height: auto;
    justify-items: start;
  }

  .asset-thread-head,
  .asset-thread-foot,
  .asset-thread-file-diff {
    align-items: flex-start;
    flex-direction: column;
  }

  .asset-thread-actions {
    justify-content: flex-start;
  }

  .topbar,
  .toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar-actions,
  .panel-header,
  .segmented,
  .compare-box {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .online-presence {
    justify-content: flex-start;
    width: 100%;
    margin-right: 0;
  }

  .online-presence-popover {
    right: auto;
    left: 0;
  }

  .backup-import {
    grid-template-columns: 1fr;
  }

  .backup-import input {
    max-width: 100%;
  }

  .permission-tool-form,
  .owner-transfer-form {
    grid-template-columns: 1fr;
  }

  .panel-header {
    display: grid;
  }

  .product-search,
  .product-grid {
    max-width: none;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-grid.is-grouped {
    grid-template-columns: 1fr;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .product-card {
    grid-template-columns: 1fr;
  }

  .product-card-tags {
    justify-content: flex-start;
    min-width: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  #nodeHomeDialog .modal {
    width: calc(100vw - 20px);
  }

  .node-home-layout {
    grid-template-columns: 1fr;
  }

  .node-home-summary {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .record-fields {
    grid-template-columns: 1fr;
  }

  .segmented {
    height: auto;
    display: grid;
  }
}

.pmc-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.metric-card {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(145deg, #ffffff, #f7fafb);
  box-shadow: 0 4px 14px rgb(19 43 48 / 5%);
}

.metric-card > span,
.metric-card > small {
  color: var(--muted);
  font-size: 11px;
}

.metric-card > strong {
  overflow: hidden;
  color: var(--text);
  font-size: 19px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-supply-page][hidden],
[data-supply-pages][hidden] {
  display: none !important;
}

.supply-capability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.supply-capability-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 4px 14px rgb(19 43 48 / 5%);
}

.supply-capability-card > span {
  display: inline-grid;
  min-width: 28px;
  height: 24px;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  color: #176963;
  background: #e3f5f2;
  font-size: 11px;
  font-weight: 900;
}

.supply-capability-card h3 {
  margin: 10px 0 5px;
  font-size: 14px;
}

.supply-capability-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.supply-process-strip {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 10px;
  overflow-x: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.supply-process-strip span {
  position: relative;
  flex: 1 0 max-content;
  min-width: 105px;
  padding: 8px 24px 8px 12px;
  border-radius: 7px;
  color: var(--muted);
  background: #f4f7f8;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.supply-process-strip button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 13px;
}

.supply-process-strip button.active {
  background: #e9f7ef;
  color: #19764a;
  box-shadow: inset 0 0 0 1px #bfe5cf;
}

.purchase-document-grid {
  display: grid;
  gap: 14px;
}

.purchase-order-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.purchase-order-table { min-width: 1020px; }
.purchase-order-table th,
.purchase-order-table td { padding: 10px 12px; white-space: nowrap; }
.purchase-order-row { cursor: pointer; transition: background 140ms ease; }
.purchase-order-row:hover { background: #f1f8f6; }
.purchase-order-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: #eef8f6; }
.purchase-order-detail-link { color: var(--accent-dark); font-weight: 800; }

.procurement-filter-panel {
  margin: 0 0 10px;
}

.procurement-filter-dialog {
  width: min(900px, calc(100vw - 32px));
}

.procurement-filter-dialog-body {
  display: grid;
  min-height: 380px;
  grid-template-columns: minmax(0, 1fr) 300px;
  overflow: auto;
}

.procurement-filter-dialog-body > section {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px;
}

.procurement-filter-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.procurement-filter-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.procurement-filter-preview {
  align-content: start;
}

@media (max-width: 720px) {
  .procurement-filter-dialog-body { grid-template-columns: 1fr; }
  .procurement-filter-preview { border-top: 1px solid var(--line); border-left: 0; }
  .procurement-filter-fields { grid-template-columns: 1fr; }
}

.purchase-document-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.purchase-document-head,
.purchase-document-meta,
.purchase-document-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.purchase-document-head {
  justify-content: space-between;
  padding: 17px 18px 10px;
}

.purchase-document-head h3 { margin: 0; }
.purchase-document-head p { margin: 3px 0 0; color: var(--muted); }
.purchase-plan-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.purchase-request-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.purchase-request-toolbar .select { width: auto; min-width: 132px; }
.purchase-request-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.purchase-request-table { min-width: 1080px; }
.purchase-request-table td { vertical-align: middle; }
.purchase-request-table td:first-child strong,
.purchase-request-table td:nth-child(2) strong,
.purchase-request-table td:nth-child(3) strong { display: block; }
.purchase-request-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.purchase-request-row-actions { display: flex; align-items: center; gap: 10px; }
.purchase-request-row-actions .primary-button,
.purchase-request-row-actions .ghost-button,
.purchase-request-row-actions .danger-button { padding: 7px 10px; white-space: nowrap; }
.purchase-request-row { cursor: pointer; transition: background 160ms ease; }
.purchase-request-row:hover,
.purchase-request-row:focus-visible { background: #f5f9ff; outline: none; }
.purchase-request-detail-dialog { width: min(1180px, calc(100vw - 36px)); }
.purchase-request-detail-summary > div { align-content: start; }
.purchase-request-detail-summary small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.purchase-request-links { display: flex; gap: 10px; flex-wrap: wrap; }
.purchase-request-lines-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.purchase-request-lines-table table { min-width: 980px; }
.purchase-request-attachments { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.purchase-request-attachments > div { display: flex; gap: 8px; flex-wrap: wrap; }
.purchase-request-history-filters { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, auto)) auto; align-items: center; gap: 10px; margin-bottom: 14px; }
.purchase-request-history-filters .select { width: 100%; }
.purchase-request-history-list { min-height: 0; overflow: auto; }
.purchase-request-reject-dialog { width: min(560px, calc(100vw - 36px)); }
.purchase-request-reject-reason { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.purchase-request-reject-reason textarea { resize: vertical; }
.purchase-request-rejection { padding: 14px; border: 1px solid #efc3c3; border-radius: 10px; background: #fff7f7; }
.purchase-request-rejection strong { color: var(--danger); }
.purchase-request-rejection p { margin: 8px 0; white-space: pre-wrap; }
.purchase-request-rejection small { color: var(--muted); }
.purchase-request-order-dialog { width: min(1180px, calc(100vw - 36px)); height: min(880px, calc(100dvh - 36px)); }
.purchase-request-order-notice { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 13px 15px; border: 1px solid #b9dcef; border-radius: 10px; background: #eff9ff; }
.purchase-request-order-notice strong { flex: 0 0 auto; color: #17638a; }
.purchase-request-order-notice span { color: #466775; line-height: 1.5; }
.purchase-request-order-context { display: grid; gap: 13px; margin-bottom: 18px; padding: 16px; border: 1px solid #cfe1d9; border-radius: 12px; background: #f9fcfa; }
.purchase-request-order-context-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.purchase-request-order-context-head h3,
.purchase-request-order-context-head p { margin: 0; }
.purchase-request-order-context-head p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.purchase-request-order-context-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.purchase-request-order-context-grid > div { display: grid; align-content: start; gap: 5px; min-height: 66px; padding: 11px 12px; background: #fff; }
.purchase-request-order-context-grid span,
.purchase-request-order-context-notes span,
.purchase-request-order-snapshot span { color: var(--muted); font-size: 11px; font-weight: 800; }
.purchase-request-order-context-grid strong { overflow-wrap: anywhere; }
.purchase-request-order-context-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.purchase-request-order-context-notes > div { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.purchase-request-order-context-notes p { margin: 6px 0 0; white-space: pre-wrap; }
.purchase-request-order-snapshot { border-top: 1px solid var(--line); padding-top: 10px; }
.purchase-request-order-snapshot summary { cursor: pointer; color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.purchase-request-order-snapshot > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin-top: 10px; }
.purchase-request-order-snapshot p { display: grid; gap: 3px; margin: 0; }
.purchase-request-order-snapshot strong { overflow-wrap: anywhere; }
.purchase-request-order-context-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.purchase-request-order-lines-head { margin: 22px 0 10px; }
.purchase-request-order-lines-head h3,
.purchase-request-order-lines-head p { margin: 0; }
.purchase-request-order-lines-head p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.purchase-request-order-lines { display: grid; gap: 12px; }
.purchase-request-order-line { display: grid; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #f7f8f8; opacity: .68; }
.purchase-request-order-line.is-selected { border-color: #b9d9cb; background: #fbfffd; opacity: 1; }
.purchase-request-order-line-head { display: flex; align-items: center; gap: 12px; }
.purchase-request-order-line-head > div { display: grid; gap: 3px; }
.purchase-request-order-line-head small { color: var(--muted); }
.purchase-request-order-check { display: flex; align-items: center; gap: 7px; color: var(--accent-dark); font-weight: 800; white-space: nowrap; }
.purchase-request-order-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.purchase-request-order-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.purchase-request-order-field-wide { grid-column: span 2; }
@media (max-width: 900px) {
  .purchase-request-history-filters { grid-template-columns: 1fr 1fr; }
  .purchase-request-order-context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-request-order-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .purchase-request-history-filters { grid-template-columns: 1fr; }
  .purchase-request-order-context-grid,
  .purchase-request-order-context-notes,
  .purchase-request-order-snapshot > div { grid-template-columns: 1fr; }
  .purchase-request-order-fields { grid-template-columns: 1fr; }
  .purchase-request-order-field-wide { grid-column: auto; }
}
.purchase-plan-table { min-width: 900px; }
.purchase-plan-table th,
.purchase-plan-table td { padding: 11px 12px; }
.purchase-plan-table td:first-child { white-space: nowrap; }
.purchase-plan-table .purchase-plan-actions-column { text-align: right; }
.purchase-plan-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.purchase-document-meta { padding: 0 18px 14px; color: var(--muted); font-size: 13px; }
.purchase-document-meta strong { color: var(--text); }
.purchase-document-actions { padding: 12px 18px 16px; border-top: 1px solid var(--line); }

.purchase-order-detail-dialog { width: min(1120px, calc(100vw - 48px)); height: min(760px, calc(100dvh - 48px)); }
.purchase-order-detail-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.purchase-order-detail-summary > div { display: grid; gap: 5px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.purchase-order-detail-summary span { color: var(--muted); font-size: 11px; }
.purchase-order-detail-summary strong { min-width: 0; overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.purchase-order-detail-summary strong .state { color: inherit; }
.purchase-order-detail-notes { display: grid; gap: 5px; margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #fff8df; }
.purchase-order-detail-notes p { color: var(--muted); line-height: 1.5; }
.purchase-order-detail-lines { margin-top: 18px; }
.purchase-order-lines-table { margin-top: 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.purchase-order-detail-actions { flex-wrap: wrap; }
.purchase-order-action-spacer { flex: 1; }

.purchase-dialog { width: min(1000px, calc(100vw - 36px)); }
.purchase-plan-dialog {
  width: min(1240px, calc(100vw - 48px));
  max-width: none;
  height: min(820px, calc(100dvh - 48px));
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(41, 64, 56, .16);
  border-radius: 20px;
  color: var(--text);
  background: #f7faf8;
  box-shadow: 0 28px 80px rgba(19, 37, 32, .24);
}
.purchase-plan-dialog::backdrop { background: rgba(20, 31, 29, .48); backdrop-filter: blur(2px); }
.purchase-plan-dialog .dialog-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
}
.purchase-plan-dialog .dialog-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
}
.purchase-plan-dialog .dialog-header h2 { margin: 3px 0 4px; font-size: 21px; line-height: 1.25; }
.purchase-plan-dialog .dialog-header p { margin: 0; color: var(--muted); font-size: 13px; }
.purchase-plan-dialog .dialog-header .icon-button { flex: 0 0 auto; margin-top: 1px; }
.purchase-plan-dialog-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px 24px;
  scrollbar-gutter: stable;
}
.purchase-plan-dialog .dialog-actions {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -8px 22px rgba(28, 47, 40, .04);
}
.purchase-plan-dialog .dialog-actions button { min-width: 92px; }
.purchase-plan-dialog.purchase-request-history-dialog {
  width: min(1120px, calc(100vw - 48px));
  height: min(680px, calc(100dvh - 48px));
}
.purchase-plan-dialog.purchase-request-history-dialog.is-empty { height: min(440px, calc(100dvh - 48px)); }
.purchase-request-history-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 18px 20px;
}
.purchase-request-history-list > .empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, .56);
}
#iqcPolicyDialog,
#iqcInspectionDialog { width: min(1000px, calc(100vw - 36px)); }
#iqcHistoryDialog { width: min(1380px, calc(100vw - 36px)); }
.iqc-history-dialog-body { padding: 16px 20px; }
.iqc-history-dialog .pmc-table-wrap {
  max-height: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.iqc-history-table { min-width: 1120px; }
.iqc-history-table th { position: sticky; top: 0; z-index: 1; background: var(--panel-soft); }
.iqc-history-table td { vertical-align: middle; }
.purchase-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.purchase-form-grid label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
.purchase-form-grid input, .purchase-form-grid select,
.purchase-line-input { min-height: 39px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; }
.purchase-form-wide { grid-column: 1 / -1; }
.wechat-field { display: flex; align-items: center; gap: 10px; }
.wechat-field > input { min-width: 0; flex: 1; }
.wechat-field > span { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.purchase-form-grid .wechat-field input[type="checkbox"] { width: 16px; min-height: 16px; margin: 0; padding: 0; }
.purchase-receiving-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.purchase-receiving-field > label { min-width: 0; }
.purchase-receiving-field > button { min-height: 39px; white-space: nowrap; }
.receiving-info-dialog { width: min(920px, calc(100vw - 48px)); height: min(660px, calc(100dvh - 48px)); }
.receiving-info-dialog-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr); gap: 20px; }
.receiving-info-dialog-body > section { min-width: 0; }
.warehouse-settings-dialog { height: min(620px, calc(100dvh - 48px)); }
.warehouse-settings-dialog-body { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); align-items: start; }
.warehouse-settings-dialog-body > aside { position: sticky; top: 0; min-width: 0; }
.receiving-info-list { display: grid; align-content: start; gap: 10px; margin-top: 12px; }
.receiving-info-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.receiving-info-card > div:first-child { display: grid; gap: 4px; min-width: 0; }
.receiving-info-card span { color: var(--muted); font-size: 12px; }
.receiving-info-card p { margin: 3px 0 0; color: var(--text); line-height: 1.5; overflow-wrap: anywhere; }
.receiving-info-card-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.receiving-info-form { display: grid; align-content: start; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.receiving-info-form h3 { margin: 3px 0 0; }
.receiving-info-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.receiving-info-form input, .receiving-info-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: #fff; resize: vertical; }
.receiving-info-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.warehouse-master-card { align-items: center; }
.warehouse-master-card p { color: var(--muted); font-size: 12px; }
.warehouse-master-workspace { display: grid; gap: 16px; }
.warehouse-master-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.warehouse-master-summary article { display: grid; gap: 4px; min-width: 0; padding: 17px 18px; border: 1px solid #d7e5e1; border-radius: 14px; background: linear-gradient(145deg, #fff, #f5faf8); box-shadow: 0 8px 24px rgba(33, 69, 61, .05); }
.warehouse-master-summary span { color: var(--muted); font-size: 12px; font-weight: 700; }
.warehouse-master-summary strong { color: var(--accent-dark); font-size: 26px; line-height: 1.1; }
.warehouse-master-summary small { color: var(--muted); }
.warehouse-master-selector-panel,
.warehouse-master-panel { display: grid; gap: 14px; }
.warehouse-master-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 22px; }
.warehouse-master-toolbar h2 { margin: 4px 0; }
.warehouse-master-toolbar p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.55; }
.warehouse-master-warehouse-list { display: grid; grid-auto-columns: minmax(210px, 250px); grid-auto-flow: column; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; overscroll-behavior-inline: contain; scrollbar-width: thin; }
.warehouse-master-warehouse-option { display: grid; gap: 5px; min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: #fff; text-align: left; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.warehouse-master-warehouse-option:hover { border-color: #9fc6bd; background: #f8fcfb; }
.warehouse-master-warehouse-option.is-selected { border-color: var(--accent); background: #edf8f5; box-shadow: inset 0 0 0 1px var(--accent), 0 7px 18px rgba(8, 124, 123, .1); }
.warehouse-option-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.warehouse-option-top b { color: var(--accent-dark); font-size: 12px; }
.warehouse-option-top em { padding: 2px 6px; border-radius: 999px; color: #52736a; background: #eaf4f1; font-size: 10px; font-style: normal; }
.warehouse-master-warehouse-option > strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.warehouse-master-warehouse-option > small { color: var(--muted); }
.warehouse-option-metrics { display: flex; gap: 9px; margin-top: 4px; padding-top: 7px; border-top: 1px solid #e5eeeb; color: var(--muted); font-size: 10px; white-space: nowrap; }
.warehouse-master-detail-tools { display: flex; align-items: end; gap: 10px; }
.warehouse-master-search { display: grid; flex: 0 0 min(360px, 34vw); gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.warehouse-master-search input { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; }
.warehouse-master-search input:disabled { color: #8c9995; background: #f1f4f3; cursor: not-allowed; }
.warehouse-master-content { display: grid; gap: 16px; }
.warehouse-overview-actions { display: flex; gap: 8px; }
.warehouse-master-unselected { display: grid; justify-items: center; gap: 6px; min-height: 220px; padding: 46px 20px; place-content: center; border: 1px dashed #cddbd7; border-radius: 12px; color: var(--muted); background: #fafcfb; text-align: center; }
.warehouse-master-unselected > span { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 12px; color: var(--accent-dark); background: var(--accent-soft); font-size: 21px; }
.warehouse-master-unselected strong { margin-top: 4px; color: var(--text); }
.warehouse-master-unselected p { max-width: 520px; margin: 0; line-height: 1.55; }
.warehouse-location-long-list { display: grid; gap: 8px; }
.warehouse-location-long-row { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.warehouse-location-long-head { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 50px; padding: 8px 12px; background: #f8fbfa; }
.warehouse-location-index { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 7px; color: var(--accent-dark); background: #e4f2ee; font-size: 10px; font-weight: 800; }
.warehouse-location-long-head > div { display: grid; gap: 2px; min-width: 0; }
.warehouse-location-long-head > div > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warehouse-location-long-head > div > span { color: var(--muted); font-size: 11px; }
.warehouse-overview-materials { border-top: 1px solid var(--line); }
.warehouse-overview-material-row { display: grid; grid-template-columns: minmax(180px, 1.5fr) minmax(110px, .55fr) minmax(180px, 1fr); align-items: center; gap: 14px; min-height: 38px; padding: 7px 52px; border-top: 1px solid #edf2f0; font-size: 12px; }
.warehouse-overview-material-row:first-child { border-top: 0; }
.warehouse-overview-material-row > span:first-child { display: grid; gap: 2px; min-width: 0; }
.warehouse-overview-material-row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.warehouse-overview-material-row > span:last-child { display: flex; flex-wrap: wrap; gap: 4px; }
.warehouse-overview-material-row em { padding: 3px 6px; border-radius: 999px; color: #45645c; background: #eaf4f1; font-size: 11px; font-style: normal; white-space: nowrap; }
.warehouse-overview-material-row.is-heading { color: var(--muted); background: #f7faf9; font-size: 11px; font-weight: 750; }
.warehouse-overview-empty { padding: 11px 52px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.warehouse-locations-dialog { width: min(1160px, calc(100vw - 48px)); height: min(860px, calc(100dvh - 32px)); }
.warehouse-locations-dialog-body { display: grid; align-content: start; gap: 16px; }
.warehouse-location-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.warehouse-location-summary > div { display: grid; gap: 4px; padding: 13px 15px; border: 1px solid #d9e6e2; border-radius: 12px; background: #f7fbfa; }
.warehouse-location-summary span { color: var(--muted); font-size: 12px; }
.warehouse-location-summary strong { color: var(--accent-dark); font-size: 21px; }
.warehouse-location-create-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 12px; }
.compact-location-form { padding: 14px; }
.compact-location-form > div:first-of-type p { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.location-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.location-form-fields label { min-width: 0; }
.location-form-fields input,
.location-form-fields select,
.receiving-info-form select { width: 100%; min-height: 39px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; }
.warehouse-location-list-section { display: grid; gap: 12px; min-width: 0; }
.warehouse-location-search { display: grid; gap: 5px; min-width: min(320px, 40vw); color: var(--muted); font-size: 12px; font-weight: 700; }
.warehouse-location-search input { min-height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; }
.warehouse-location-list { display: grid; gap: 10px; }
.location-inventory-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.location-inventory-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: #f8fbfa; }
.location-inventory-head > div { display: grid; gap: 3px; }
.location-inventory-head span { color: var(--muted); font-size: 12px; }
.location-material-table { border-top: 1px solid var(--line); }
.location-material-row { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(130px, .55fr) minmax(220px, 1fr); align-items: center; gap: 14px; padding: 10px 14px; border-top: 1px solid #edf1f0; font-size: 13px; }
.location-material-row:first-child { border-top: 0; }
.location-material-row > span:first-child { display: grid; gap: 2px; }
.location-material-row small { color: var(--muted); }
.location-material-header { color: var(--muted); background: #fbfcfc; font-size: 11px; font-weight: 750; }
.location-empty-stock { padding: 16px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.warehouse-location-import { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.warehouse-location-import > summary { padding: 13px 15px; cursor: pointer; color: var(--accent-dark); font-weight: 750; }
.warehouse-location-import > section { margin: 0 12px 12px; }
.purchase-order-form-sections { display: grid; gap: 12px; }
.purchase-form-section { min-width: 0; margin: 0; padding: 10px 12px 12px; border: 1px solid #dce7e2; border-radius: 12px; background: rgba(255, 255, 255, .74); }
.purchase-form-section legend { padding: 0 7px; color: var(--accent-dark); font-size: 12px; font-weight: 850; letter-spacing: .02em; }
#purchaseRequestOrderDialog .supplier-contact-grid,
#purchaseOrderDialog .supplier-contact-grid { grid-template-columns: minmax(185px, 1.25fr) minmax(135px, .85fr) minmax(145px, .9fr) minmax(210px, 1.25fr) minmax(175px, 1fr); gap: 8px 10px; }
#purchaseRequestOrderDialog .order-details-grid,
#purchaseOrderDialog .order-details-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; }
.purchase-form-span-2 { grid-column: span 2; }
#purchaseOrderDialog .order-details-grid .purchase-receiving-field { grid-column: span 2; }
#purchaseOrderDialog .order-details-grid .purchase-form-wide { grid-column: 1 / -1; }
.purchase-consumable-tip { margin: 12px 0 0; padding: 11px 13px; border-radius: 10px; color: #6c5521; background: #fff8df; font-size: 13px; }
.purchase-request-type-notice { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid #cfe5df; border-radius: 10px; color: #46645d; background: #edf8f5; font-size: 13px; }
.purchase-request-type-notice strong { flex: 0 0 auto; color: var(--accent-dark); }
.warehouse-mro-panel { border-top: 3px solid #77afa2; }
.warehouse-mro-panel .pmc-material-cell span,
.warehouse-mro-panel td small { display: block; max-width: 320px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.warehouse-receipt-history-panel { border-top: 3px solid #527f74; }
.warehouse-receipt-history-tools { display: flex; align-items: center; gap: 10px; }
.warehouse-receipt-history-tools input { width: min(360px, 36vw); min-width: 240px; }
.warehouse-receipt-history-table table { min-width: 980px; }
.warehouse-receipt-history-table tbody tr { cursor: pointer; }
.warehouse-receipt-history-table tbody tr:hover,
.warehouse-receipt-history-table tbody tr:focus-visible { background: #f1f8f5; outline: none; }
.warehouse-receipt-row-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.warehouse-receipt-history-dialog { width: min(1180px, calc(100vw - 48px)); }
@media (max-width: 760px) {
  .warehouse-receipt-history-panel .panel-header { align-items: stretch; }
  .warehouse-receipt-history-tools { width: 100%; }
  .warehouse-receipt-history-tools input { width: 100%; min-width: 0; }
}
.asset-mro-receipt-table { min-width: 1840px; table-layout: fixed; }
.expense-mro-receipt-table { min-width: 1080px; table-layout: fixed; }
.asset-mro-receipt-table th:nth-child(1), .asset-mro-receipt-table td:nth-child(1),
.expense-mro-receipt-table th:nth-child(1), .expense-mro-receipt-table td:nth-child(1) { width: 64px; }
.asset-mro-receipt-table th:nth-child(2), .asset-mro-receipt-table td:nth-child(2),
.expense-mro-receipt-table th:nth-child(2), .expense-mro-receipt-table td:nth-child(2) { width: 250px; }
.asset-mro-receipt-table th:nth-child(3), .asset-mro-receipt-table td:nth-child(3),
.expense-mro-receipt-table th:nth-child(3), .expense-mro-receipt-table td:nth-child(3) { width: 135px; }
.expense-mro-receipt-table th:nth-child(4), .expense-mro-receipt-table td:nth-child(4) { width: 140px; }
.asset-mro-receipt-table th:nth-child(4), .asset-mro-receipt-table td:nth-child(4),
.asset-mro-receipt-table th:nth-child(5), .asset-mro-receipt-table td:nth-child(5),
.asset-mro-receipt-table th:nth-child(6), .asset-mro-receipt-table td:nth-child(6),
.asset-mro-receipt-table th:nth-child(7), .asset-mro-receipt-table td:nth-child(7),
.asset-mro-receipt-table th:nth-child(8), .asset-mro-receipt-table td:nth-child(8),
.asset-mro-receipt-table th:nth-child(9), .asset-mro-receipt-table td:nth-child(9),
.asset-mro-receipt-table th:nth-child(10), .asset-mro-receipt-table td:nth-child(10) { width: 200px; }
.expense-mro-receipt-table th:nth-child(5), .expense-mro-receipt-table td:nth-child(5),
.expense-mro-receipt-table th:nth-child(6), .expense-mro-receipt-table td:nth-child(6) { width: 210px; }
.asset-mro-receipt-table input, .asset-mro-receipt-table select,
.expense-mro-receipt-table input, .expense-mro-receipt-table select { width: 100%; min-width: 0; }
.purchase-select-cell { width: 42px; text-align: center; }
.purchase-document-table { margin: 0; }
.purchase-document-table th:first-child, .purchase-document-table td:first-child { padding-left: 18px; }
.purchase-document-table th:last-child, .purchase-document-table td:last-child { padding-right: 18px; }

.purchase-plan-picker {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) 44px minmax(500px, 1.2fr);
  height: 440px;
  min-height: 430px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f4f8f6;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(36, 60, 51, .05);
}

.purchase-plan-source,
.purchase-plan-target {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}

.purchase-plan-picker-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #f0f7f3;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  font-size: 20px;
  font-weight: 800;
}

.purchase-plan-pane-head {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfc;
}

.purchase-plan-pane-head > div { display: grid; gap: 3px; }
.purchase-plan-pane-head strong { font-size: 15px; }
.purchase-plan-pane-head span:not(.state) { color: var(--muted); font-size: 12px; }
.purchase-plan-bom-filters { display: grid; grid-template-columns: 1fr 120px; gap: 10px; padding: 12px 14px 8px; }
.purchase-plan-bom-filters label,
.purchase-plan-search { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.purchase-plan-bom-filters select,
.purchase-plan-search input { min-width: 0; min-height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: #fff; color: var(--text); }
.purchase-plan-search { padding: 0 14px 10px; }
.purchase-order-selection-tools { display: flex; gap: 8px; padding: 0 14px 10px; }
.purchase-order-selection-tools .ghost-button { min-height: 32px; padding: 5px 10px; font-size: 11px; }
.purchase-plan-bom-tree,
.purchase-plan-draft-lines { flex: 1; min-height: 0; overflow: auto; }
.purchase-plan-bom-tree {
  padding: 4px 8px 12px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.purchase-plan-tree-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 52px;
  padding: 6px 7px 6px calc(7px + var(--purchase-tree-depth) * 15px);
  border-radius: 9px;
}
.purchase-plan-tree-row:hover { background: #f4f8f5; }
.purchase-plan-tree-row.is-added { background: #edf8f1; }
.purchase-order-bom-group + .purchase-order-bom-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.purchase-order-bom-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 9px; color: var(--muted); font-size: 11px; }
.purchase-order-bom-title strong { color: var(--text); font-size: 12px; }
.purchase-plan-tree-toggle,
.purchase-plan-tree-spacer { width: 24px; height: 24px; }
.purchase-plan-tree-toggle { border: 0; border-radius: 6px; background: #edf2ef; color: var(--text); cursor: pointer; }
.purchase-plan-tree-copy { display: grid; min-width: 0; gap: 2px; }
.purchase-plan-tree-copy strong,
.purchase-plan-tree-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-plan-tree-copy strong { font-size: 13px; }
.purchase-plan-tree-copy span { color: var(--muted); font-size: 11px; }
.purchase-plan-whole-badge { display: inline-flex; margin-left: 7px; padding: 2px 6px; border-radius: 999px; background: #dff3e7; color: #23764a; font-size: 10px; font-style: normal; vertical-align: 1px; }
.purchase-plan-add { min-height: 30px; padding: 5px 9px; font-size: 11px; white-space: nowrap; }
.purchase-plan-add:disabled { opacity: .65; }
.purchase-plan-line-list { display: grid; }
.purchase-plan-line {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) minmax(145px, .7fr) minmax(120px, .55fr) 32px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.purchase-plan-line-main { display: grid; min-width: 0; gap: 3px; }
.purchase-plan-line-main strong,
.purchase-plan-line-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-plan-line-main span,
.purchase-plan-line > small { color: var(--muted); font-size: 11px; }
.purchase-plan-line label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.purchase-plan-quantity { display: flex; align-items: center; }
.purchase-plan-quantity input { min-width: 0; width: 100%; border-radius: 9px 0 0 9px; }
.purchase-plan-quantity em { display: grid; min-width: 42px; min-height: 39px; place-items: center; padding: 0 8px; border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0; background: #f4f7f5; color: var(--text); font-style: normal; }
.purchase-plan-remove { color: #a23c35; }
.purchase-plan-empty { display: grid; min-height: 100%; place-content: center; gap: 7px; padding: 30px; text-align: center; }
.purchase-plan-empty span { color: var(--muted); font-size: 13px; }

/* Purchase orders are selected primarily in the BOM picker. Keep the order
   metadata compact so the picker is already prominent when the dialog opens. */
#purchaseOrderDialog .dialog-header { padding: 14px 20px 12px; }
#purchaseOrderDialog .dialog-header h2 { font-size: 19px; }
#purchaseOrderDialog .purchase-plan-dialog-body { padding: 12px 20px 16px; }
#purchaseOrderDialog .purchase-form-grid { gap: 8px 12px; }
#purchaseOrderDialog .purchase-form-grid label { gap: 4px; font-size: 12px; }
#purchaseOrderDialog .purchase-form-grid input,
#purchaseOrderDialog .purchase-form-grid select {
  min-height: 34px;
  padding-block: 5px;
}
#purchaseOrderDialog .purchase-order-picker { margin-top: 10px; }
#purchaseOrderDialog .purchase-receiving-field { grid-column: 1 / -1; }
#purchaseOrderDialog .purchase-plan-pane-head { min-height: 54px; padding-block: 9px; }
#purchaseOrderDialog .purchase-plan-search input { min-height: 34px; }

@media (min-width: 981px) {
  #purchaseOrderDialog .purchase-form-grid {
    grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(145px, .8fr) minmax(145px, .8fr);
  }

  #purchaseOrderDialog .purchase-form-wide { grid-column: 3 / -1; }
}

@media (min-width: 981px) and (min-height: 761px) {
  #purchaseOrderDialog {
    width: min(1500px, calc(100vw - 32px));
    height: min(1080px, calc(100dvh - 32px));
  }

  #purchaseOrderDialog .purchase-plan-dialog-body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  #purchaseOrderDialog .purchase-form-grid {
    grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(145px, .8fr) minmax(145px, .8fr);
    gap: 8px 12px;
  }

  #purchaseOrderDialog .purchase-form-wide { grid-column: 3 / -1; }
  #purchaseOrderDialog .purchase-form-grid label { gap: 4px; }
  #purchaseOrderDialog .purchase-form-grid input,
  #purchaseOrderDialog .purchase-form-grid select { min-height: 34px; padding-block: 5px; }
  #purchaseOrderDialog .purchase-order-picker { height: auto; min-height: 0; margin-top: 10px; }
  #purchaseOrderDialog .purchase-plan-pane-head { min-height: 54px; padding-block: 9px; }
  #purchaseOrderDialog .purchase-plan-search { padding-bottom: 8px; }
  #purchaseOrderDialog .purchase-order-selection-tools { padding-bottom: 8px; }
}

@media (max-height: 760px) {
  .purchase-plan-dialog { height: calc(100dvh - 28px); }
  .purchase-plan-dialog.purchase-request-history-dialog { height: calc(100dvh - 28px); }
  .purchase-plan-dialog .dialog-header { padding-block: 15px 14px; }
  .purchase-plan-dialog-body { padding-block: 16px; }
  .purchase-plan-picker { height: 315px; min-height: 315px; }

  /* Keep the BOM chooser usable on short/zoomed desktop viewports. The dialog
     body can scroll, but the tree itself must retain enough room for browsing. */
  #purchaseOrderDialog .purchase-order-picker {
    height: 460px;
    min-height: 460px;
  }
}

@media (min-width: 981px) and (max-height: 760px) {
  #purchaseOrderDialog .purchase-form-grid {
    grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(145px, .8fr) minmax(145px, .8fr);
    gap: 8px 12px;
  }

  #purchaseOrderDialog .purchase-form-wide { grid-column: 3 / -1; }
  #purchaseOrderDialog .purchase-form-grid label { gap: 4px; }
  #purchaseOrderDialog .purchase-form-grid input,
  #purchaseOrderDialog .purchase-form-grid select {
    min-height: 34px;
    padding-block: 5px;
  }
}

@media (max-width: 980px) {
  .purchase-plan-dialog { width: calc(100vw - 28px); }
  .purchase-plan-dialog.purchase-request-history-dialog { width: calc(100vw - 28px); }
  .purchase-plan-picker { grid-template-columns: 1fr; height: auto; }
  .purchase-plan-source,
  .purchase-plan-target { min-height: 390px; }
  .purchase-plan-picker-arrow { min-height: 40px; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(90deg); }
}

@media (max-width: 720px) {
  .purchase-plan-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); border-radius: 14px; }
  .purchase-plan-dialog.purchase-request-history-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .purchase-plan-dialog .dialog-header { padding: 16px; }
  .purchase-plan-dialog .dialog-header p { display: none; }
  .purchase-plan-dialog-body { padding: 14px; }
  .purchase-plan-dialog .dialog-actions { padding: 12px 14px; }
  .purchase-form-grid { grid-template-columns: 1fr; }
  .purchase-form-wide { grid-column: auto; }
  .purchase-receiving-field { grid-template-columns: 1fr; align-items: stretch; }
  .receiving-info-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .receiving-info-dialog-body { grid-template-columns: 1fr; }
  .warehouse-settings-dialog-body > aside { position: static; }
  .warehouse-locations-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .warehouse-location-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warehouse-location-create-grid { grid-template-columns: 1fr; }
  .location-form-fields { grid-template-columns: 1fr; }
  .warehouse-location-list-section .panel-title-row { align-items: stretch; }
  .warehouse-location-search { min-width: 0; width: 100%; }
  .location-material-row { grid-template-columns: minmax(0, 1fr) auto; }
  .location-material-row > span:last-child { grid-column: 1 / -1; }
  .location-material-header { display: none; }
  .receiving-info-card { display: grid; }
  .receiving-info-card-actions { justify-content: flex-end; }
  .warehouse-master-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warehouse-master-toolbar { align-items: stretch; flex-direction: column; }
  .warehouse-master-detail-tools { align-items: stretch; flex-direction: column; }
  .warehouse-master-search { flex-basis: auto; width: 100%; }
  .warehouse-overview-actions { justify-content: flex-end; }
  .warehouse-overview-material-row { grid-template-columns: minmax(0, 1fr) auto; }
  .warehouse-overview-material-row,
  .warehouse-overview-empty { padding-right: 12px; padding-left: 52px; }
  .warehouse-overview-material-row > span:last-child { grid-column: 1 / -1; }
  .warehouse-overview-material-row.is-heading { display: none; }
  .purchase-plan-line { grid-template-columns: minmax(0, 1fr) minmax(135px, .8fr) 32px; }
  .purchase-plan-line > small { display: none; }
}

.supply-process-strip span + span {
  margin-left: 18px;
}

.supply-process-strip span + span::before {
  position: absolute;
  top: 50%;
  left: -18px;
  content: "→";
  color: #8ba0a4;
  transform: translateY(-50%);
}

.supply-process-strip span.active {
  color: #155f5a;
  background: #def3ef;
}

.inventory-balance-full,
.inventory-transaction-full {
  max-height: 520px;
}

.pmc-section {
  margin-bottom: 10px;
}

.pmc-plan-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

#pmcPlanForm {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
}

#pmcPlanForm .pmc-plan-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#pmcPlanForm > button {
  justify-self: end;
  min-width: 136px;
}

.pmc-plan-fields {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(210px, 0.9fr) minmax(120px, 0.55fr) minmax(145px, 0.65fr) minmax(145px, 0.65fr) minmax(210px, 0.95fr);
  gap: 6px;
  align-items: end;
}

.pmc-plan-form button {
  min-width: 112px;
  height: 28px;
}

.pmc-plan-list {
  margin-top: 8px;
}

.planning-split-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #e7c57e;
  border-radius: 9px;
  color: #76510b;
  background: var(--warning-soft);
}

.planning-split-warning strong {
  flex: 0 0 auto;
}

.planning-split-warning span {
  font-size: 11px;
}

.planning-plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.planning-product-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 14px rgb(19 43 48 / 5%);
}

.planning-product-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.planning-product-card-header > div {
  display: grid;
  gap: 2px;
}

.planning-product-card-header > div:last-child {
  grid-auto-flow: column;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  text-align: right;
}

.planning-product-card-header > div:first-child strong {
  font-size: 15px;
}

.planning-product-card-header span {
  color: var(--muted);
  font-size: 11px;
}

.planning-product-card-header > div:last-child strong {
  color: var(--text);
  font-size: 14px;
}

.planning-product-table-wrap {
  overflow-x: auto;
}

.planning-product-table {
  min-width: 1400px;
}

.planning-product-table th,
.planning-product-table td {
  vertical-align: middle;
}

.planning-product-table tbody tr.is-editing {
  background: #f3faf8;
}

.planning-product-table tbody tr.has-unbatched:not(.is-editing) {
  background: #fffdf8;
}

.planning-product-table .planning-plan-identity {
  min-width: 210px;
}

.planning-plan-identity small,
.planning-cell-subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.planning-plan-note-input {
  min-width: 190px;
  margin-top: 6px;
}

.planning-plan-quantity-input {
  min-width: 92px;
}

.planning-plan-date-input {
  min-width: 142px;
}

.planning-plan-reserve-input {
  min-width: 78px;
}

.planning-plan-row-actions {
  display: flex;
  min-width: 242px;
  gap: 5px;
}

.planning-unbatched-cell {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-width: 72px;
}

.planning-unbatched-cell .state {
  padding: 3px 7px;
  font-size: 9px;
}

.planning-bypass-split-button {
  color: #76510b;
  border-color: #e2bf78;
  background: #fffaf0;
}

.work-order-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr));
  gap: 9px;
}

#workOrderMessage:empty {
  display: none;
}

.work-order-card {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 10px;
  border: 2px solid #9acbc7;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 12px rgb(19 43 48 / 6%);
}

.work-order-card.priority-t0 {
  border-color: #d7776b;
  box-shadow: 0 4px 14px rgb(180 70 55 / 10%);
}

.work-order-card.priority-t1 {
  border-color: #55aaa4;
}

.work-order-card.priority-t2 {
  border-color: #aebbc0;
}

.work-order-card-header,
.work-order-product,
.work-order-actions,
.work-order-trace,
.work-order-issue-list > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.work-order-card-header,
.work-order-product,
.work-order-trace {
  justify-content: space-between;
}

.work-order-card-header > div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 6px;
}

.work-order-card-header > div small {
  grid-column: 2;
  color: var(--muted);
}

.work-order-due {
  display: grid;
  justify-items: end;
  gap: 1px;
}

.work-order-due small,
.work-order-product span,
.work-order-trace span,
.work-order-issue-list span,
.work-order-no-issue {
  color: var(--muted);
  font-size: 10px;
}

.work-order-product {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafb;
}

.work-order-product > div {
  display: grid;
  gap: 2px;
}

.work-order-product > div:last-child {
  justify-items: end;
}

.work-order-product > div:first-child strong {
  font-size: 13px;
}

.work-order-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.work-order-status-grid > div {
  display: grid;
  justify-items: start;
  gap: 3px;
  padding: 6px;
}

.work-order-status-grid > div + div {
  border-left: 1px solid var(--line);
}

.work-order-status-grid > div > span:first-child {
  color: var(--muted);
  font-size: 10px;
}

.work-order-status-grid .state {
  padding: 3px 6px;
  font-size: 9px;
}

.work-order-trace {
  padding: 5px 7px;
  border-radius: 6px;
  color: #285e5a;
  background: #edf7f6;
}

.work-order-issue-list {
  display: grid;
  gap: 4px;
  max-height: 190px;
  overflow: auto;
}

.work-order-issue-list > div {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr) auto auto;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.issue-order-link {
  padding: 0;
  border: 0;
  color: #176f69;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: transparent;
  cursor: pointer;
}

.issue-order-actions {
  display: flex;
  gap: 4px;
}

.issue-order-actions button {
  min-height: 24px;
  padding: 3px 6px;
}

.danger-link:not(:disabled) {
  color: #a74235;
  border-color: #e3b7b1;
}

.work-order-no-issue {
  padding: 6px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  text-align: center;
}

.work-order-actions {
  justify-content: flex-end;
}

.work-order-actions button {
  min-height: 28px;
  padding: 5px 9px;
}

.material-issue-modal {
  width: min(1180px, calc(100vw - 36px));
  max-width: 1180px;
}

.material-issue-form {
  display: grid;
  gap: 8px;
  padding: 12px 18px 14px;
}

.material-issue-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(110px, 0.45fr) minmax(190px, 0.9fr) minmax(220px, 1.2fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafb;
}

.material-issue-toolbar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.material-issue-toolbar input,
.material-issue-toolbar select {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font: inherit;
}

.material-issue-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.material-issue-picker-toolbar > input {
  max-width: 340px;
  height: 32px;
}

.material-issue-picker-toolbar > div {
  display: flex;
  gap: 5px;
}

.material-issue-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  height: clamp(320px, 50vh, 470px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.material-issue-tree-panel,
.material-issue-preview-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.material-issue-preview-panel {
  border-left: 1px solid var(--line);
  background: #fafcfc;
}

.material-issue-preview-panel .panel-title-row > div {
  display: grid;
  gap: 2px;
}

.material-issue-preview-panel .panel-title-row small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.material-issue-selection-summary {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 7px;
  color: #285e5a;
  background: #edf7f6;
}

.material-issue-selection-summary span {
  color: var(--muted);
}

.material-issue-selection-summary em {
  color: #a45d12;
  font-style: normal;
  font-weight: 800;
}

.material-issue-tree,
.material-issue-preview {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
}

.material-issue-tree-row {
  display: grid;
  grid-template-columns: 20px 16px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 29px;
  gap: 5px;
  padding: 1px 6px 1px calc(6px + var(--issue-depth, 0) * 16px);
  border: 1px solid transparent;
  border-radius: 7px;
}

.material-issue-tree-row:hover,
.material-issue-tree-row.selected {
  border-color: #b9d9d6;
  background: #f3faf8;
}

.material-issue-tree-toggle,
.material-issue-tree-toggle-spacer {
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  place-items: center;
  background: transparent;
}

.material-issue-tree-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.material-issue-tree-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  text-align: left;
  background: transparent;
}

.material-issue-tree-main strong,
.material-issue-tree-main span,
.material-issue-tree-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-issue-tree-main span,
.material-issue-tree-main small,
.material-issue-tree-row > small {
  color: var(--muted);
  font-size: 9px;
}

.material-issue-tree-main strong {
  flex: 1 1 auto;
}

.material-issue-tree-main span {
  flex: 0 0 auto;
}

.material-issue-tree-main small {
  flex: 0 1 auto;
}

.material-issue-preview table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.material-issue-preview .issue-material-col { width: 46%; }
.material-issue-preview .issue-per-set-col { width: 12%; }
.material-issue-preview .issue-demand-col { width: 11%; }
.material-issue-preview .issue-allocation-col { width: 20%; }
.material-issue-preview .issue-shortage-col { width: 11%; }

.material-issue-preview th,
.material-issue-preview td {
  padding: 4px 6px;
  line-height: 1.2;
  white-space: nowrap;
}

.material-issue-item-inline,
.material-issue-allocation {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
}

.material-issue-item-inline strong,
.material-issue-item-inline span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-issue-item-inline strong {
  flex: 0 0 auto;
}

.material-issue-item-inline span {
  flex: 1 1 auto;
}

.material-issue-allocation small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-issue-preview thead {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #fafcfc;
}

.material-issue-tree,
.material-issue-preview {
  scrollbar-color: #8eb8b4 #edf3f3;
  scrollbar-width: auto;
}

.material-issue-tree::-webkit-scrollbar,
.material-issue-preview::-webkit-scrollbar {
  width: 12px;
}

.material-issue-tree::-webkit-scrollbar-thumb,
.material-issue-preview::-webkit-scrollbar-thumb {
  border: 3px solid #edf3f3;
  border-radius: 999px;
  background: #8eb8b4;
}

.material-issue-preview td:first-child span,
.material-issue-preview td small {
  margin-top: 0;
  color: var(--muted);
  font-size: 9px;
}

.material-issue-preview tr.has-shortage {
  background: #fff8e8;
}

.material-issue-preview tr.has-over-demand {
  background: #fff0ee;
}

.material-issue-preview tr.has-over-demand td:nth-child(3) strong {
  color: var(--danger);
}

.material-issue-preview tr.has-shortage td:last-child strong {
  color: #a45d12;
}

.planning-plan-card {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 14px rgb(19 43 48 / 5%);
}

.planning-plan-card-header,
.planning-plan-actions,
.planning-plan-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.planning-plan-card-header {
  justify-content: space-between;
}

.planning-plan-card-header > div {
  display: grid;
  gap: 2px;
}

.planning-plan-card-header .planning-plan-statuses {
  display: flex;
  grid-auto-flow: column;
  gap: 6px;
}

.tracking-number {
  color: #155f5a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.planning-plan-card-header small,
.planning-plan-product span,
.planning-plan-notes {
  color: var(--muted);
  font-size: 11px;
}

.planning-plan-product {
  display: grid;
  gap: 2px;
}

.planning-plan-product strong {
  font-size: 15px;
}

.planning-plan-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.planning-plan-stats > div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.planning-plan-stats > div + div {
  border-left: 1px solid var(--line);
}

.planning-plan-stats span {
  color: var(--muted);
  font-size: 10px;
}

.planning-plan-stats strong {
  font-size: 13px;
}

.planning-inline-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #adc9c6;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.planning-inline-input:focus {
  border-color: var(--accent);
  outline: 2px solid rgb(15 139 133 / 13%);
}

.planning-plan-editor {
  display: grid;
  grid-template-columns: minmax(160px, 0.35fr) minmax(260px, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid #c9dedb;
  border-radius: 8px;
  background: #f3faf8;
}

.planning-plan-editor label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.planning-plan-meta {
  flex-wrap: wrap;
}

.planning-plan-meta > span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #50666a;
  background: #eef3f4;
  font-size: 10px;
  font-weight: 800;
}

.planning-plan-meta label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.planning-plan-meta select {
  min-width: 100px;
  height: 28px;
}

.planning-plan-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.planning-batch-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(120px, 0.55fr) minmax(150px, 0.7fr) minmax(240px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 4px;
  padding: 12px;
  border: 1px solid #c9dedb;
  border-radius: 9px;
  background: #f3faf8;
}

.planning-batch-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.planning-batch-form input,
.planning-batch-form select {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.planning-batch-actions {
  display: flex;
  min-width: 178px;
  gap: 5px;
}

.planning-priority-select {
  width: 72px;
  min-width: 72px;
  height: 30px;
  border-radius: 999px;
  font-weight: 900;
}

.planning-quantity-input {
  min-width: 82px;
}

.planning-notes-input {
  min-width: 160px;
}

.planning-batch-section .form-message {
  min-height: 18px;
  margin-bottom: 4px;
}

.pmc-header-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.pmc-search-input {
  width: min(340px, 36vw);
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.pmc-search-input::placeholder {
  color: var(--muted);
}

.pmc-plan-table-wrap {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pmc-table-wrap {
  overflow-x: auto;
}

.pmc-scroll-table {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pmc-result-table {
  max-height: 520px;
}

#pmcPurchaseTable.pmc-result-table {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.procurement-pagination {
  position: sticky;
  left: 0;
  display: flex;
  width: 100%;
  min-width: min(100%, 720px);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
}

.procurement-pagination > div { display: flex; gap: 8px; }
.procurement-pagination button { min-height: 30px; padding: 5px 10px; }

@media (max-width: 720px) {
  .purchase-order-detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-order-action-spacer { display: none; }
}

.pmc-table {
  min-width: 1380px;
  border-collapse: separate;
  border-spacing: 0;
}

.pmc-plan-table {
  min-width: 1500px;
}

.pmc-table th,
.pmc-table td {
  vertical-align: middle;
  padding: 6px 8px;
  line-height: 1.35;
}

.pmc-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafb;
  box-shadow: 0 1px 0 var(--line);
}

.pmc-table input {
  width: 100%;
  min-width: 72px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.pmc-table select {
  width: 100%;
  min-width: 104px;
  min-height: 28px;
  padding: 0 26px 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23172025' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  font: inherit;
}

.pmc-table .compact-link {
  min-height: 32px;
  padding: 6px 10px;
}

.pmc-table td span {
  color: var(--muted);
}

.pmc-material-cell {
  min-width: 150px;
}

.pmc-material-cell strong,
.pmc-material-cell span {
  display: block;
}

.pmc-material-link {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.pmc-material-link:hover strong,
.pmc-material-link:focus-visible strong,
.pmc-material-link:hover span,
.pmc-material-link:focus-visible span {
  color: var(--accent-strong);
  text-decoration: underline;
}

.pmc-source-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.inventory-kpi-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 82px;
  gap: 2px;
  padding: 10px 11px 9px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 14px rgb(19 43 48 / 5%);
  text-align: left;
}

.inventory-kpi-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--inventory-kpi-color, var(--accent));
}

.inventory-kpi-card::after {
  position: absolute;
  top: -26px;
  right: -24px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  content: "";
  background: var(--inventory-kpi-soft, var(--accent-soft));
  opacity: 0.72;
}

.inventory-kpi-card:hover,
.inventory-kpi-card.is-active {
  border-color: var(--inventory-kpi-color, var(--accent));
  transform: translateY(-1px);
}

.inventory-kpi-card.is-active {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--inventory-kpi-color, var(--accent)) 20%, transparent);
}

.inventory-kpi-card > span,
.inventory-kpi-card > strong,
.inventory-kpi-card > small {
  position: relative;
  z-index: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-kpi-card > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.inventory-kpi-card > strong {
  color: var(--inventory-kpi-color, var(--accent));
  font-size: 23px;
  line-height: 1.2;
}

.inventory-kpi-card > small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.inventory-kpi-card.is-healthy {
  --inventory-kpi-color: #16805a;
  --inventory-kpi-soft: #daf3e6;
}

.inventory-kpi-card.is-critical {
  --inventory-kpi-color: #c54444;
  --inventory-kpi-soft: #fde1e1;
}

.inventory-kpi-card.is-warning {
  --inventory-kpi-color: #bc7b1f;
  --inventory-kpi-soft: #fff0cf;
}

.inventory-kpi-card.is-restricted {
  --inventory-kpi-color: #7353a6;
  --inventory-kpi-soft: #eee5fb;
}

.inventory-kpi-card.is-overdue {
  --inventory-kpi-color: #d2672f;
  --inventory-kpi-soft: #ffe6d8;
}

.inventory-kpi-card.is-dormant {
  --inventory-kpi-color: #65727a;
  --inventory-kpi-soft: #e8edf0;
}

.inventory-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 10px;
  margin-bottom: 10px;
}

.inventory-dashboard-card {
  min-height: 222px;
  overflow: hidden;
}

.inventory-dashboard-card .panel-header {
  min-height: 36px;
}

.inventory-dashboard-card .panel-header h2,
.inventory-health-detail-section h2,
.inventory-policy-section h2 {
  margin: 0;
}

.inventory-live-badge,
.inventory-policy-hint {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.inventory-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.inventory-live-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1d9a67;
  box-shadow: 0 0 0 4px #e2f5eb;
}

.inventory-health-chart,
.inventory-health-groups {
  display: grid;
  gap: 9px;
}

.inventory-health-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 7px;
  background: #f7f9fa;
}

.inventory-health-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.inventory-health-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--inventory-health-color);
}

.inventory-health-group {
  display: grid;
  grid-template-columns: minmax(90px, 0.28fr) minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.inventory-health-group > div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.inventory-health-group strong,
.inventory-health-group span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-health-group span {
  color: var(--muted);
  font-size: 9px;
}

.inventory-health-distribution {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.inventory-health-bar {
  display: flex;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f2;
  box-shadow: inset 0 0 0 1px rgb(31 47 52 / 5%);
}

.inventory-health-bar i {
  min-width: 3px;
  height: 100%;
  background: var(--inventory-health-color);
}

.inventory-health-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
}

.inventory-health-counts span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  overflow: visible;
  font-size: 8px;
}

.inventory-health-counts i {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--inventory-health-color, #a7b0b5);
}

.inventory-health-legend .is-healthy,
.inventory-health-bar .is-healthy {
  --inventory-health-color: #2a9a6b;
}

.inventory-health-legend .is-low,
.inventory-health-bar .is-low {
  --inventory-health-color: #e2ad3b;
}

.inventory-health-legend .is-shortage,
.inventory-health-bar .is-shortage {
  --inventory-health-color: #d34c4c;
}

.inventory-health-legend .is-restricted,
.inventory-health-bar .is-restricted {
  --inventory-health-color: #8260b6;
}

.inventory-health-legend .is-dormant,
.inventory-health-bar .is-dormant,
.inventory-health-counts .is-dormant {
  --inventory-health-color: #879198;
}

.inventory-health-counts .is-healthy {
  --inventory-health-color: #2a9a6b;
}

.inventory-health-counts .is-low {
  --inventory-health-color: #e2ad3b;
}

.inventory-health-counts .is-shortage {
  --inventory-health-color: #d34c4c;
}

.inventory-health-counts .is-restricted {
  --inventory-health-color: #8260b6;
}

.inventory-alert-list {
  display: grid;
  max-height: 166px;
  gap: 5px;
  overflow: auto;
  padding-right: 2px;
}

.inventory-alert-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--inventory-alert-color);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.inventory-alert-item:hover {
  background: var(--inventory-alert-soft);
}

.inventory-alert-item > span {
  padding: 3px 5px;
  border-radius: 999px;
  color: var(--inventory-alert-color);
  background: var(--inventory-alert-soft);
  font-size: 8px;
  font-weight: 900;
}

.inventory-alert-item div,
.inventory-alert-item strong,
.inventory-alert-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-alert-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.inventory-alert-item > b {
  color: var(--inventory-alert-color);
  font-size: 17px;
}

.inventory-alert-item.is-t0 {
  --inventory-alert-color: #c54444;
  --inventory-alert-soft: #fff0f0;
}

.inventory-alert-item.is-t1 {
  --inventory-alert-color: #c87924;
  --inventory-alert-soft: #fff6e8;
}

.inventory-alert-item.is-t2 {
  --inventory-alert-color: #68757c;
  --inventory-alert-soft: #f0f3f4;
}

.inventory-alert-empty {
  display: grid;
  min-height: 146px;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}

.inventory-alert-empty span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #16805a;
  background: #e3f5eb;
  font-size: 18px;
  font-weight: 900;
}

.inventory-alert-empty small {
  font-size: 9px;
}

.inventory-aging-chart {
  display: grid;
  min-height: 180px;
  align-content: end;
}

.inventory-aging-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inventory-pending-inspection-badge {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 2px 6px;
  padding: 6px 9px;
  border: 1px solid #eccb82;
  border-radius: 9px;
  color: #8a5b16;
  background: #fff8e9;
  text-align: left;
  cursor: pointer;
}

.inventory-pending-inspection-badge:hover:not(:disabled),
.inventory-pending-inspection-badge:focus-visible {
  border-color: #d6a94a;
  box-shadow: 0 0 0 3px rgb(214 169 74 / 14%);
}

.inventory-pending-inspection-badge:disabled {
  opacity: .55;
  cursor: default;
}

.inventory-pending-inspection-badge span,
.inventory-pending-inspection-badge small {
  color: inherit;
  font-size: 9px;
}

.inventory-pending-inspection-badge strong {
  font-size: 11px;
}

.inventory-pending-inspection-badge small {
  grid-column: 1 / -1;
}

.inventory-pending-inspection-badge.is-overdue {
  border-color: #e7a4a0;
  color: #a5423d;
  background: #fff1f0;
}

.inventory-aging-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
}

.inventory-aging-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.inventory-aging-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.inventory-aging-legend .is-qualified i,
.inventory-aging-stack .is-qualified { background: #35a675; }
.inventory-aging-legend .is-pending i,
.inventory-aging-stack .is-pending { background: #d7a83a; }
.inventory-aging-legend .is-restricted i,
.inventory-aging-stack .is-restricted { background: #c9635b; }

.inventory-aging-bars {
  display: grid;
  height: 132px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
}

.inventory-aging-column {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(60px, 1fr) auto;
  justify-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.inventory-aging-column:hover .inventory-aging-stack,
.inventory-aging-column:focus-visible .inventory-aging-stack {
  box-shadow: 0 0 0 3px rgb(53 166 117 / 16%);
}

.inventory-aging-column:hover .inventory-aging-stack i,
.inventory-aging-column:focus-visible .inventory-aging-stack i {
  filter: saturate(1.12) brightness(.94);
}

.inventory-aging-column:focus-visible {
  border-radius: 6px;
  outline: 2px solid #35a675;
  outline-offset: 3px;
}

.inventory-aging-track {
  display: flex;
  width: min(42px, 80%);
  height: 100%;
  align-items: end;
  background: #f0f3f4;
  border-radius: 6px 6px 2px 2px;
}

.inventory-aging-stack {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  min-height: 3px;
  overflow: hidden;
  border-radius: 6px 6px 2px 2px;
}

.inventory-aging-stack i {
  display: block;
  width: 100%;
  min-height: 2px;
}

.inventory-aging-column span,
.inventory-aging-chart > p {
  color: var(--muted);
  font-size: 9px;
}

.inventory-aging-chart > p {
  margin: 7px 0 0;
  text-align: center;
}

.inventory-aging-modal {
  width: min(1040px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
}

.inventory-aging-modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.inventory-aging-dialog-body {
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 14px 18px 20px;
}

.inventory-aging-material-list {
  display: grid;
  gap: 7px;
}

.inventory-aging-material-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.35fr) minmax(100px, .75fr) minmax(90px, .7fr) 88px minmax(190px, 1.15fr) minmax(110px, .8fr) 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #e1e9e7;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.inventory-aging-material-row:hover,
.inventory-aging-material-row:focus-visible {
  border-color: #83b8af;
  background: #f6fbf9;
  box-shadow: 0 3px 12px rgb(23 72 67 / 8%);
}

.inventory-aging-material-row > span,
.inventory-aging-material-row strong,
.inventory-aging-material-row small {
  min-width: 0;
}

.inventory-aging-material-row strong,
.inventory-aging-material-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-aging-material-row small {
  color: var(--muted);
  font-size: 10px;
}

.inventory-aging-material-row > span > small:first-child {
  margin-bottom: 3px;
}

.inventory-aging-material-identity > strong {
  color: var(--accent-strong);
  font-size: 14px;
}

.inventory-aging-material-identity > small {
  margin-top: 3px;
  font-size: 11px;
}

.inventory-aging-material-row > b {
  color: var(--accent-strong);
  font-size: 22px;
}

@media (max-width: 900px) {
  .inventory-aging-material-row {
    grid-template-columns: minmax(160px, 1.3fr) repeat(3, minmax(85px, .7fr)) 18px;
  }

  .inventory-aging-material-row > span:nth-child(2),
  .inventory-aging-material-row > span:nth-child(3) {
    display: none;
  }
}

.inventory-risk-timeline {
  display: grid;
  max-height: 164px;
  gap: 3px;
  overflow: auto;
  padding-right: 2px;
}

.inventory-risk-batch {
  display: grid;
  grid-template-columns: 36px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 7px;
  background: #f8fafb;
}

.inventory-risk-batch time,
.inventory-risk-batch > b {
  color: var(--inventory-risk-color);
  font-size: 9px;
  font-weight: 900;
}

.inventory-risk-batch > i {
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--inventory-risk-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--inventory-risk-color) 24%, transparent);
}

.inventory-risk-batch div,
.inventory-risk-batch strong,
.inventory-risk-batch span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-risk-batch span {
  color: var(--muted);
  font-size: 9px;
}

.inventory-risk-batch.is-healthy { --inventory-risk-color: #25885f; }
.inventory-risk-batch.is-warning { --inventory-risk-color: #b87b25; }
.inventory-risk-batch.is-critical { --inventory-risk-color: #c54444; }

.inventory-health-detail-header {
  align-items: end;
}

.inventory-health-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inventory-health-tools .select {
  width: 112px;
}

#inventoryMaterialScope {
  width: 132px;
}

.inventory-kind-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #44606c;
  background: #edf2f4;
  font-size: 11px;
  font-weight: 700;
}

.inventory-kind-badge.is-semi_finished {
  color: #7a5417;
  background: #fff0cf;
}

.inventory-health-data-table {
  min-width: 1120px;
}

.inventory-health-data-table tbody tr {
  border-left: 3px solid transparent;
}

.inventory-health-state {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--inventory-state-color) !important;
  background: var(--inventory-state-soft);
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.inventory-health-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--inventory-state-color);
}

.inventory-health-state.is-healthy { --inventory-state-color: #1c8159; --inventory-state-soft: #e5f5ec; }
.inventory-health-state.is-low { --inventory-state-color: #a96d18; --inventory-state-soft: #fff2d9; }
.inventory-health-state.is-shortage { --inventory-state-color: #bd3f3f; --inventory-state-soft: #fde9e9; }
.inventory-health-state.is-restricted { --inventory-state-color: #7251a2; --inventory-state-soft: #eee8f8; }
.inventory-health-state.is-dormant { --inventory-state-color: #67747b; --inventory-state-soft: #edf0f2; }
.inventory-health-state.is-unmanaged { --inventory-state-color: #7a858b; --inventory-state-soft: #f0f2f3; }

.inventory-structure {
  display: grid;
  min-width: 170px;
  gap: 4px;
}

.inventory-structure-bar {
  display: flex;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f3;
}

.inventory-structure-bar i { height: 100%; }
.inventory-structure-bar .is-available { background: #32a373; }
.inventory-structure-bar .is-reserved { background: #3f8fca; }
.inventory-structure-bar .is-pending { background: #e3b23f; }
.inventory-structure-bar .is-restricted { background: #855fb1; }

.inventory-structure-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.inventory-structure-labels span,
.inventory-structure-empty {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.inventory-coverage-cell {
  display: grid;
  min-width: 130px;
  gap: 4px;
}

.inventory-coverage-cell > span {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f2;
}

.inventory-coverage-cell > span i {
  display: block;
  height: 100%;
  background: #2d9a6d;
}

.inventory-coverage-cell > span i.is-low { background: #dfa833; }
.inventory-coverage-cell > span i.is-shortage { background: #d34c4c; }
.inventory-coverage-cell > span i.is-restricted { background: #8260b6; }
.inventory-coverage-cell > span i.is-dormant { background: #879198; }

.inventory-coverage-cell small,
.inventory-quantity-pair span,
.inventory-age-cell span {
  color: var(--muted);
  font-size: 9px;
}

.inventory-quantity-pair strong,
.inventory-quantity-pair span,
.inventory-age-cell strong,
.inventory-age-cell span {
  display: block;
  white-space: nowrap;
}

.inventory-balance-pair {
  display: grid;
  min-width: 155px;
  gap: 3px;
}

.inventory-balance-pair > span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  white-space: nowrap;
}

.inventory-balance-pair > span strong {
  color: var(--ink);
}

.inventory-balance-pair > small {
  padding-top: 3px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.inventory-future-gap {
  display: inline-flex !important;
  min-width: 70px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-weight: 900;
  white-space: nowrap;
}

.inventory-future-gap.is-covered {
  color: #1c8159;
  background: #e5f5ec;
}

.inventory-future-gap.is-shortage {
  color: #bd3f3f;
  background: #fde9e9;
}

.inventory-risk-tags {
  display: flex;
  min-width: 160px;
  flex-wrap: wrap;
  gap: 3px;
}

.inventory-risk-tag {
  display: inline-flex !important;
  padding: 3px 5px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.inventory-risk-tag.is-healthy { color: #1c8159 !important; background: #e5f5ec; }
.inventory-risk-tag.is-warning { color: #a96d18 !important; background: #fff2d9; }
.inventory-risk-tag.is-critical { color: #bd3f3f !important; background: #fde9e9; }
.inventory-risk-tag.is-overdue { color: #bc5e2d !important; background: #ffeadf; }
.inventory-risk-tag.is-restricted { color: #7251a2 !important; background: #eee8f8; }
.inventory-risk-tag.is-dormant { color: #67747b !important; background: #edf0f2; }
.inventory-risk-tag.is-unmanaged { color: #6e7980 !important; background: #f0f2f3; }

.inventory-scope-filter-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 9px;
  padding: 10px 12px;
  border: 1px solid #cddedc;
  border-radius: 9px;
  background: #f6faf9;
}

.inventory-scope-filter-copy {
  display: grid;
  gap: 2px;
}

.inventory-scope-filter-copy strong {
  color: var(--ink);
  font-size: 11px;
}

.inventory-scope-filter-copy span,
.inventory-scope-filter-actions > span {
  color: var(--muted);
  font-size: 9px;
}

.inventory-scope-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.inventory-scope-rule-chips {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.inventory-scope-rule-chip {
  display: inline-flex;
  max-width: 280px;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid #c9dcda;
  border-radius: 999px;
  color: #244d4b;
  background: #fff;
  font-size: 9px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-scope-rule-chip small {
  color: #6c8583;
  font-size: 8px;
}

.inventory-scope-rule-empty {
  color: var(--muted);
  font-size: 10px;
}

.inventory-scope-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 70;
  display: grid;
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
  border: 1px solid #c8d6d9;
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  box-shadow:
    0 0 0 100vmax rgb(18 32 36 / 46%),
    0 26px 90px rgb(18 32 36 / 28%);
  transform: translate(-50%, -50%);
}

.inventory-scope-dialog[hidden] {
  display: none;
}

.inventory-scope-dialog-header,
.inventory-scope-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.inventory-scope-dialog-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfd, #f6f9f9);
}

.inventory-dialog-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.inventory-scope-dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

.inventory-scope-dialog-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.inventory-scope-dialog-body {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 330px;
  overflow: hidden;
}

.inventory-bom-filter-panel,
.inventory-rule-filter-panel {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 12px;
  padding: 16px 18px;
}

.inventory-rule-filter-panel {
  border-left: 1px solid var(--line);
  background: #f8fafb;
}

.inventory-dialog-section-heading > div,
.inventory-rule-filter-panel > label,
.inventory-bom-filter-controls label,
.inventory-bom-tree-search {
  display: grid;
  gap: 5px;
}

.inventory-dialog-section-heading strong {
  font-size: 13px;
}

.inventory-dialog-section-heading span,
.inventory-rule-filter-panel > label,
.inventory-bom-filter-controls label,
.inventory-bom-tree-search {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.inventory-bom-filter-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(150px, 0.6fr);
  gap: 10px;
}

.inventory-bom-filter-controls .select,
.inventory-rule-filter-panel .select,
.inventory-bom-tree-search input {
  width: 100%;
}

.inventory-bom-tree-search input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.inventory-filter-bom-tree {
  min-height: 330px;
  max-height: min(52vh, 560px);
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfc;
}

.inventory-filter-tree-row {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: max-content;
  padding-left: calc(var(--tree-depth) * 22px);
  border-radius: 6px;
}

.inventory-filter-tree-row:hover,
.inventory-filter-tree-row.is-selected,
.inventory-filter-tree-all:hover,
.inventory-filter-tree-all.is-selected {
  background: #e7f2f1;
}

.inventory-filter-tree-row.is-selected,
.inventory-filter-tree-all.is-selected {
  box-shadow: inset 3px 0 #23847f;
}

.inventory-filter-tree-toggle,
.inventory-filter-tree-leaf {
  display: grid;
  width: 25px;
  height: 32px;
  flex: 0 0 25px;
  place-items: center;
}

.inventory-filter-tree-check {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0 4px;
  accent-color: #23847f;
  cursor: pointer;
}

.inventory-filter-tree-toggle {
  border: 0;
  color: #66817f;
  background: transparent;
  font-size: 15px;
  font-weight: 800;
}

.inventory-filter-tree-node {
  display: flex;
  min-width: 390px;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 9px 7px 4px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.inventory-filter-tree-node > span {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.inventory-filter-tree-node strong {
  font-size: 11px;
}

.inventory-filter-tree-node small,
.inventory-filter-tree-node em,
.inventory-filter-tree-all small {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.inventory-filter-tree-node em {
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2f3;
}

.inventory-filter-tree-all {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.inventory-filter-tree-all > span {
  flex: 1;
  margin-left: 4px;
  text-align: left;
}

.inventory-filter-tree-empty {
  display: grid;
  min-height: 250px;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.inventory-filter-tree-empty strong {
  color: var(--ink);
  font-size: 12px;
}

.inventory-filter-tree-empty span {
  max-width: 330px;
  font-size: 10px;
}

.inventory-rule-preview {
  display: grid;
  gap: 7px;
  padding-top: 4px;
}

.inventory-rule-preview > span,
.inventory-filter-result-preview > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.inventory-filter-result-preview {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid #c8dcda;
  border-radius: 9px;
  background: #eff7f6;
}

.inventory-filter-result-preview strong {
  color: #176d68;
  font-size: 22px;
}

.inventory-filter-result-preview small {
  color: var(--muted);
  font-size: 9px;
}

.inventory-scope-dialog-footer {
  border-top: 1px solid var(--line);
  background: #fff;
}

.inventory-scope-dialog-footer > div {
  display: flex;
  gap: 8px;
}

.inventory-policy-section {
  border-top: 3px solid #bfd7d5;
}

.warehouse-operation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.warehouse-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}

.warehouse-metric-card {
  --warehouse-metric-color: #347e78;
  --warehouse-metric-soft: #e8f4f2;
  display: grid;
  min-width: 0;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 92px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--warehouse-metric-color);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 5px 16px rgb(19 43 48 / 6%);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.warehouse-metric-card:hover,
.warehouse-metric-card:focus-visible {
  border-color: var(--warehouse-metric-color);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--warehouse-metric-color) 16%, transparent);
  transform: translateY(-1px);
}

.warehouse-metric-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  color: var(--warehouse-metric-color);
  background: var(--warehouse-metric-soft);
  font-size: 12px;
  font-weight: 900;
}

.warehouse-metric-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.warehouse-metric-copy small,
.warehouse-metric-copy em {
  overflow: hidden;
  color: var(--muted);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-metric-copy small {
  font-size: 9px;
  font-weight: 900;
}

.warehouse-metric-copy strong {
  color: var(--warehouse-metric-color);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.warehouse-metric-copy strong b {
  font-size: 23px;
}

.warehouse-metric-copy em {
  font-size: 9px;
  font-weight: 700;
}

.warehouse-metric-arrow {
  color: var(--warehouse-metric-color);
  font-size: 12px;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.warehouse-metric-card:hover .warehouse-metric-arrow,
.warehouse-metric-card:focus-visible .warehouse-metric-arrow {
  opacity: 1;
  transform: translateX(0);
}

.warehouse-metric-card.is-overdue { --warehouse-metric-color: #bb5f34; --warehouse-metric-soft: #fff0e8; }
.warehouse-metric-card.is-inspection { --warehouse-metric-color: #b27a22; --warehouse-metric-soft: #fff3dc; }
.warehouse-metric-card.is-issue { --warehouse-metric-color: #416f96; --warehouse-metric-soft: #eaf1f7; }
.warehouse-metric-card.is-return { --warehouse-metric-color: #7b5b9e; --warehouse-metric-soft: #f0eafa; }
.warehouse-metric-card.is-throughput { --warehouse-metric-color: #477c65; --warehouse-metric-soft: #e7f2ec; }

.warehouse-iqc-panel {
  border-top: 4px solid #4b8f88;
}

.iqc-policy-workbench {
  border-top: 4px solid #5b8f89;
}

.iqc-policy-metrics .metric-card.is-exempt {
  border-top: 3px solid #6a9f89;
}

.iqc-policy-metrics .metric-card.is-sampling {
  border-top: 3px solid #c49a4b;
}

.iqc-policy-metrics .metric-card.is-full {
  border-top: 3px solid #b96a64;
}

.iqc-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 0.7fr)) minmax(220px, 1.4fr);
  gap: 12px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f7faf9;
}

.iqc-filter-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.iqc-filter-bar select,
.iqc-filter-bar input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.iqc-selection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.iqc-selection-actions > span {
  color: #176d68;
  font-size: 12px;
  font-weight: 900;
}

.iqc-bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
}

.iqc-bulk-action-bar > strong {
  flex: 0 0 auto;
  color: #176d68;
  font-size: 12px;
}

.iqc-bulk-action-bar > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.iqc-bulk-scope,
.iqc-bulk-quick-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.iqc-bulk-scope button,
.iqc-bulk-quick-actions button,
.iqc-clear-selection {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.iqc-bulk-scope button.active {
  border-color: #6eaaa4;
  color: #176d68;
  background: #e7f3f1;
}

.iqc-bulk-quick-actions button:hover:not(:disabled) {
  border-color: #6eaaa4;
  color: #176d68;
  background: #eff7f6;
}

.iqc-bulk-scope button:disabled,
.iqc-bulk-quick-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.iqc-bulk-quick-actions {
  padding-left: 4px;
  border-left: 1px solid var(--line);
}

.iqc-clear-selection {
  margin-left: auto;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.iqc-policy-table-wrap {
  max-height: min(62vh, 680px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.iqc-policy-material-table {
  width: 100%;
  min-width: 1120px;
  table-layout: fixed;
}

.iqc-policy-material-table th,
.iqc-policy-material-table td {
  padding-block: 4px;
}

.iqc-policy-material-table tbody tr {
  height: 42px;
}

.iqc-policy-material-table .iqc-select-column {
  width: 34px;
}

.iqc-policy-material-table .iqc-material-column {
  width: 32%;
}

.iqc-policy-material-table .iqc-type-column {
  width: 18%;
}

.iqc-policy-material-table .iqc-strategy-column {
  width: 132px;
}

.iqc-policy-material-table .iqc-supplier-column {
  width: 150px;
}

.iqc-policy-material-table .iqc-sampling-column {
  width: 180px;
}

.iqc-policy-material-table .iqc-version-column {
  width: 230px;
}

.iqc-policy-material-table thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  background: #f6f8f8;
  box-shadow: 0 1px 0 var(--line), 0 5px 12px rgb(20 50 54 / 5%);
}

.iqc-policy-material-table th:first-child,
.iqc-policy-material-table td:first-child {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  padding-inline: 4px;
  text-align: center;
}

.iqc-policy-material-table input[type="checkbox"] {
  display: inline-grid;
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  margin: 0;
  padding: 0 !important;
  place-content: center;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #839293;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

.iqc-policy-material-table input[type="checkbox"]::after {
  width: 3px;
  height: 6px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  content: "";
  transform: translateY(-1px) rotate(45deg) scale(0);
}

.iqc-policy-material-table input[type="checkbox"]:checked {
  border-color: #197970;
  background: #197970;
}

.iqc-policy-material-table input[type="checkbox"]:checked::after {
  transform: translateY(-1px) rotate(45deg) scale(1);
}

.iqc-policy-material-table input[type="checkbox"]:focus-visible {
  outline: 2px solid rgb(25 121 112 / 28%);
  outline-offset: 2px;
}

.iqc-material-inline {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.pmc-material-cell .iqc-material-inline strong {
  display: inline;
  flex: 0 0 auto;
}

.pmc-material-cell .iqc-material-inline span {
  display: inline;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iqc-inline-strategy {
  width: 94px;
  min-width: 94px;
  height: 28px;
  min-height: 28px;
  padding: 0 26px 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.iqc-inline-strategy:hover,
.iqc-inline-strategy:focus {
  border-color: #8ebdb7;
  outline: none;
}

.iqc-inline-strategy.iqc-exempt {
  color: #286d58;
  background-color: #e6f4ed;
}

.iqc-inline-strategy.iqc-sampling {
  color: #80601f;
  background-color: #faf0d4;
}

.iqc-inline-strategy.iqc-full {
  color: #934740;
  background-color: #f8e5e3;
}

.iqc-default-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.iqc-policy-material-table td:nth-child(4) .iqc-default-note {
  display: inline;
  margin: 0 0 0 6px;
  vertical-align: middle;
}

.iqc-policy-version-cell {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.iqc-policy-version-cell > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iqc-policy-version-cell a,
.iqc-policy-version-cell button {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  color: #17736d;
  background: transparent;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.iqc-policy-version-cell a:hover,
.iqc-policy-version-cell button:hover {
  text-decoration: underline;
}

.iqc-policy-version-cell button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  text-decoration: none;
}

.state.iqc-exempt {
  color: #286d58;
  background: #e6f4ed;
}

.state.iqc-sampling {
  color: #80601f;
  background: #faf0d4;
}

.state.iqc-full {
  color: #934740;
  background: #f8e5e3;
}

.iqc-policy-selection-summary {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid #bad7d3;
  border-radius: 9px;
  background: #eef7f5;
}

.iqc-policy-selection-summary strong {
  color: #176d68;
}

.iqc-policy-selection-summary span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.iqc-policy-supplier-scope {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 60px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f6f9f8;
}

.iqc-policy-supplier-scope span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.iqc-policy-supplier-scope strong {
  color: var(--text);
  font-size: 13px;
}

.iqc-policy-supplier-scope small {
  color: var(--muted);
  font-size: 9px;
}

[data-iqc-sampling] > small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.warehouse-operation-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 4px solid #8fbfba;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 7px 22px rgb(19 43 48 / 7%);
}

.warehouse-operation-card.is-outbound {
  border-top-color: #7e9fb7;
}

.warehouse-operation-card.is-return {
  border-top-color: #c4a265;
}

.warehouse-operation-card.is-tools {
  border-top-color: #9aa5b1;
}

.warehouse-operation-card-head,
.warehouse-operation-hint,
.warehouse-operation-actions,
.warehouse-operation-card > .primary-button {
  grid-column: 1 / -1;
}

.warehouse-operation-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.warehouse-operation-card-head > span {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: #176963;
  background: #e3f5f2;
  font-size: 16px;
  font-weight: 900;
}

.warehouse-operation-card.is-outbound .warehouse-operation-card-head > span {
  color: #315f7a;
  background: #e7f0f6;
}

.warehouse-operation-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.warehouse-operation-card-head p,
.warehouse-operation-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.warehouse-operation-card label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.warehouse-document-combobox { position: relative; }
.warehouse-document-suggestions {
  top: 100%;
  right: 0;
  left: auto;
  z-index: 40;
  width: calc(200% + 12px);
  max-height: 320px;
  margin-top: 2px;
}

.warehouse-document-suggestions .combobox-option > span {
  white-space: normal;
  line-height: 1.45;
}

.warehouse-document-option {
  gap: 5px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 7px;
}

.warehouse-document-option:last-child { border-bottom-color: transparent; }

.warehouse-document-option-head,
.warehouse-document-option-facts,
.warehouse-document-option-materials {
  display: flex;
  min-width: 0;
}

.warehouse-document-option-head {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.warehouse-document-option-head strong { color: var(--text); }

.warehouse-document-option-head em {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e5f4f1;
  color: #176963;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.warehouse-document-option-meta {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.warehouse-document-option-facts {
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--muted);
  font-size: 11px;
}

.warehouse-document-option-facts i,
.warehouse-document-option-materials i { font-style: normal; }

.warehouse-document-option-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  padding-top: 5px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
}

.warehouse-document-option-materials b {
  flex: 0 0 100%;
  color: var(--muted);
  font-size: 10px;
}

.warehouse-document-option-materials i:not(:last-child)::after {
  margin-left: 8px;
  color: var(--line-strong);
  content: "|";
}

.warehouse-operation-card input,
.warehouse-operation-card select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.warehouse-operation-card > .primary-button {
  min-height: 38px;
  justify-self: start;
}

.warehouse-operation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-operation-detail {
  width: min(1120px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(41, 64, 56, .16);
  border-top: 4px solid var(--accent);
  border-radius: 18px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 28px 80px rgba(19, 37, 32, .24);
}

.inventory-operation-detail::backdrop,
.warehouse-line-dialog::backdrop {
  background: rgba(20, 31, 29, .48);
  backdrop-filter: blur(2px);
}

.inventory-operation-detail > .panel-header {
  position: sticky;
  z-index: 3;
  top: 0;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
}

.inventory-operation-detail > .inventory-transaction-form {
  margin: 20px 24px 12px;
}

.inventory-operation-detail > .form-message {
  margin: 0 24px 20px;
}

.opening-inventory-import-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.opening-inventory-import-summary span { padding: 6px 10px; border-radius: 999px; background: #eef5f2; color: var(--muted); font-size: 12px; font-weight: 800; }
.opening-inventory-import-preview { min-height: 190px; }
.opening-inventory-import-results { min-height: 145px; max-height: min(48vh, 520px); overflow: auto; }
.opening-inventory-import-results table { min-width: 820px; }
.opening-inventory-import-results .is-error { color: #a33; }
.opening-inventory-import-results .is-warning { color: #9a6200; }

.inventory-transaction-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.inventory-transaction-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inventory-transaction-form input,
.inventory-transaction-form select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.inventory-transaction-notes {
  grid-column: span 2;
}

.inventory-transaction-form .primary-button {
  min-height: 30px;
}

.inventory-return-context {
  display: grid;
  grid-column: span 3;
  gap: 3px;
  min-height: 30px;
  align-content: center;
  padding: 7px 10px;
  border: 1px solid rgba(13, 139, 136, .2);
  border-radius: 8px;
  background: rgba(13, 139, 136, .07);
  color: var(--muted);
  font-size: 12px;
}

.inventory-return-context strong {
  color: var(--text);
}

.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] [data-inventory-batch-field] { order: 1; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] .inventory-return-context { order: 2; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] [data-inventory-material-field] { order: 3; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] [data-inventory-lot-field] { order: 4; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] [data-inventory-quantity-field] { order: 5; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] [data-inventory-date-field] { order: 6; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] [data-inventory-to-field] { order: 7; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] [data-inventory-reference-field] { order: 8; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] .inventory-transaction-notes { order: 9; }
.inventory-transaction-form[data-operation-type="PRODUCTION_RETURN"] .primary-button { order: 10; }

.warehouse-line-dialog {
  width: min(1280px, calc(100vw - 48px));
}

.warehouse-line-dialog-body {
  display: grid;
  align-content: start;
  gap: 14px;
}

.warehouse-line-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f7faf9;
}

.warehouse-line-search {
  display: grid;
  flex: 1;
  max-width: 520px;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.warehouse-line-search input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.warehouse-line-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.warehouse-line-actions > span {
  min-width: 70px;
  color: #176d68;
  font-size: 11px;
  font-weight: 900;
  text-align: right;
}

.warehouse-line-actions > button {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
}

.warehouse-line-list,
.warehouse-line-dialog .purchase-plan-draft-lines {
  min-height: 180px;
  max-height: min(48vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  scrollbar-gutter: stable;
}

.warehouse-selectable-table {
  width: 100%;
  min-width: 980px;
}

.warehouse-selectable-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #f4f7f6;
  box-shadow: 0 1px 0 var(--line);
}

.warehouse-selectable-table th:first-child,
.warehouse-selectable-table td:first-child {
  width: 54px;
  text-align: center;
}

.warehouse-selectable-table input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #18756e;
}

.warehouse-selectable-table tbody tr {
  transition: background .15s ease, box-shadow .15s ease;
}

.warehouse-selectable-table tbody tr.is-selected {
  background: #edf8f6;
  box-shadow: inset 3px 0 #22877f;
}

.warehouse-selectable-table input[type="number"],
.warehouse-selectable-table input:not([type]) {
  width: 100%;
  min-width: 110px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
}

.asset-mro-receipt-table td,
.expense-mro-receipt-table td {
  padding-top: 10px;
  padding-bottom: 10px;
  vertical-align: middle;
}

.asset-mro-receipt-table th:last-child,
.asset-mro-receipt-table td:last-child {
  padding-right: 8px;
}

.asset-mro-receipt-table input:not([type="checkbox"]),
.asset-mro-receipt-table select,
.expense-mro-receipt-table input:not([type="checkbox"]),
.expense-mro-receipt-table select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #fff;
  color: var(--text);
  font: inherit;
  line-height: 34px;
}

.asset-mro-receipt-table select,
.expense-mro-receipt-table select {
  padding-right: 30px;
  background-position: right 10px center;
}

.warehouse-demand-cell {
  min-width: 180px;
}

.warehouse-demand-cell span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.warehouse-no-stock {
  color: var(--danger);
}

.warehouse-source-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.warehouse-source-summary span {
  display: grid;
  min-width: 150px;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #cfe0dd;
  border-radius: 9px;
  color: var(--muted);
  background: #f1f7f6;
  font-size: 10px;
}

.warehouse-source-summary strong {
  color: var(--text);
  font-size: 12px;
}

.warehouse-issue-context {
  padding-top: 4px;
}

.inventory-ledger-section > .form-message {
  min-height: 18px;
  margin: 6px 0 0;
}

.inventory-ledger-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 10px;
  margin-top: 8px;
}

.inventory-ledger-grid > div {
  min-width: 0;
}

.inventory-ledger-grid .panel-title-row {
  margin-bottom: 6px;
}

.inventory-ledger-grid h3 {
  margin: 0;
  font-size: 14px;
}

.inventory-ledger-table {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.inventory-ledger-table .pmc-table {
  min-width: 720px;
}

.inventory-flow-cell {
  min-width: 180px;
}

.inventory-flow-cell span {
  padding: 0 6px;
}

.pmc-table input[readonly] {
  color: var(--muted);
  border-color: transparent;
  background: var(--panel-soft);
}

@media (max-width: 1180px) {
  .pmc-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .supply-capability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pmc-plan-form {
    grid-template-columns: 1fr;
  }

  #pmcPlanForm .pmc-plan-fields,
  .planning-batch-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planning-plan-grid {
    grid-template-columns: 1fr;
  }

  .planning-batch-form button {
    justify-self: end;
  }

  .pmc-plan-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pmc-header-tools,
  .pmc-section .panel-header {
    align-items: stretch;
  }

  .pmc-header-tools {
    flex-direction: column;
  }

  .pmc-search-input {
    width: 100%;
  }

  .inventory-transaction-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-return-context {
    grid-column: span 1;
  }

  .warehouse-operation-grid {
    grid-template-columns: 1fr;
  }

  .warehouse-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .iqc-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .iqc-bulk-action-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .inventory-ledger-grid {
    grid-template-columns: 1fr;
  }

  .material-issue-layout {
    grid-template-columns: 1fr;
  }

  .material-issue-preview-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 980px) {
  .warehouse-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .inventory-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .inventory-scope-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-scope-dialog-body {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

@media (max-width: 760px) {
  .warehouse-metrics {
    grid-template-columns: 1fr;
  }

  .warehouse-metric-card {
    min-height: 78px;
  }

  .pmc-metric-grid {
    grid-template-columns: 1fr;
  }

  .inventory-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-health-detail-header,
  .inventory-health-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-health-tools,
  .inventory-health-tools .select,
  .inventory-health-tools .pmc-search-input {
    width: 100%;
  }

  .inventory-scope-filter-heading,
  .inventory-scope-filter-heading > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-scope-filter-grid {
    grid-template-columns: 1fr;
  }

  .inventory-scope-filter-panel {
    grid-template-columns: 1fr;
  }

  .inventory-scope-filter-actions {
    justify-content: space-between;
  }

  .inventory-scope-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .inventory-scope-dialog-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .inventory-rule-filter-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .inventory-bom-filter-controls {
    grid-template-columns: 1fr;
  }

  .inventory-filter-bom-tree {
    min-height: 280px;
  }

  .supply-capability-grid {
    grid-template-columns: 1fr;
  }

  .pmc-plan-fields {
    grid-template-columns: 1fr;
  }

  #pmcPlanForm .pmc-plan-fields,
  .planning-batch-form,
  .planning-plan-stats,
  .planning-plan-editor {
    grid-template-columns: 1fr;
  }

  .planning-plan-stats > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .planning-plan-meta label {
    width: 100%;
    margin-left: 0;
  }

  .inventory-transaction-form {
    grid-template-columns: 1fr;
  }

  .warehouse-operation-card {
    grid-template-columns: 1fr;
  }

  .warehouse-operation-card > * {
    grid-column: 1;
  }

  .warehouse-document-suggestions { width: 100%; }

  .warehouse-line-dialog,
  .inventory-operation-detail {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }

  .warehouse-line-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .warehouse-line-search {
    max-width: none;
  }

  .warehouse-line-actions {
    justify-content: flex-start;
  }

  .warehouse-line-actions > span {
    text-align: left;
  }

  .inventory-transaction-notes {
    grid-column: auto;
  }

  .planning-split-warning {
    align-items: flex-start;
    flex-direction: column;
  }

  .work-order-status-grid,
  .material-issue-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .work-order-card-grid {
    grid-template-columns: 1fr;
  }

  .material-issue-picker-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .material-issue-picker-toolbar > input {
    max-width: none;
  }
}
.collaboration-notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  max-width: min(440px, calc(100vw - 48px));
  padding: 12px 16px;
  border: 1px solid #b8d8d5;
  border-radius: 10px;
  background: #effaf8;
  color: #174b49;
  box-shadow: 0 10px 30px rgb(20 50 60 / 18%);
  font-size: 14px;
}

.collaboration-notice[data-tone="warning"] {
  border-color: #e6c877;
  background: #fff9e8;
  color: #6f5310;
}

.inventory-balance-search {
  position: relative;
  min-width: min(420px, 42vw);
}

.inventory-balance-search > input {
  width: 100%;
  min-height: 40px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364777d' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat 13px center;
  color: var(--text);
}

.inventory-balance-search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: min(520px, 80vw);
  max-height: 360px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgb(37 58 63 / 18%);
}

.inventory-balance-search-results > button {
  display: grid;
  grid-template-columns: 130px minmax(140px, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.inventory-balance-search-results > button:hover {
  background: #eef7f5;
}

.inventory-balance-search-results span,
.inventory-balance-search-results small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-health-data-table tbody tr {
  cursor: pointer;
}

.inventory-health-data-table tbody tr:hover {
  background: #f1f8f7;
}

.inventory-policy-schedule {
  display: grid;
  grid-template-columns: 78px minmax(138px, 1fr);
  gap: 6px;
}

.inventory-balance-backdrop {
  z-index: 1200;
  padding: 20px;
}

.inventory-balance-modal {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
}

.inventory-balance-modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.inventory-balance-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: #f7faf9;
  color: var(--muted);
  font-size: 13px;
}

.inventory-balance-horizons {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #e9efed;
}

.inventory-balance-horizons button {
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #59696c;
  cursor: pointer;
}

.inventory-balance-horizons button.is-active {
  background: #fff;
  color: #126b5f;
  box-shadow: 0 1px 5px rgb(34 62 65 / 14%);
  font-weight: 700;
}

.inventory-balance-dialog-body {
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 20px 24px 26px;
}

.inventory-balance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.inventory-balance-summary article {
  padding: 13px 14px;
  border: 1px solid #dfe8e5;
  border-radius: 11px;
  background: #fbfdfc;
}

.inventory-balance-summary span,
.inventory-balance-summary small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.inventory-balance-summary strong {
  display: inline-block;
  margin: 7px 5px 1px 0;
  color: #223b3d;
  font-size: 23px;
}

.inventory-balance-summary article.is-warning { border-color: #edcf91; background: #fff9ec; }
.inventory-balance-summary article.is-warning strong { color: #a56814; }
.inventory-balance-summary article.is-critical { border-color: #efb1b1; background: #fff2f2; }
.inventory-balance-summary article.is-critical strong { color: #bd3e3e; }
.inventory-balance-summary article.is-healthy strong { color: #16805a; }
.inventory-balance-summary article.is-physical { border-color: #8bc8bd; background: #f0faf7; }
.inventory-balance-summary article.is-physical strong { color: var(--accent-strong); }

.inventory-balance-warning {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.inventory-balance-warning span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff0d5;
  color: #8a5b16;
  font-size: 12px;
}

.inventory-balance-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 20px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.inventory-balance-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.inventory-balance-chart-legend i { width: 18px; height: 3px; border-radius: 2px; background: #16805a; }
.inventory-balance-chart-legend .is-receipt i { background: #2b83d5; }
.inventory-balance-chart-legend .is-demand i { background: #dc6159; }
.inventory-balance-chart-legend .is-safety i { height: 0; border-top: 2px dashed #d09025; background: transparent; }

.inventory-balance-chart {
  overflow-x: auto;
  border: 1px solid #e2eae8;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdfd, #fff);
}

.inventory-balance-chart svg { display: block; min-width: 720px; width: 100%; }
.inventory-balance-grid line { stroke: #e7edeb; stroke-width: 1; }
.inventory-balance-grid text { fill: #7a898b; font-size: 11px; }
.inventory-balance-grid .inventory-balance-quantity-tick line { stroke: #dfe7e5; }
.inventory-balance-grid .inventory-balance-quantity-tick text { fill: #607174; font-variant-numeric: tabular-nums; }
.inventory-balance-grid .inventory-balance-y-axis { stroke: #bac8c6; }
.inventory-balance-axis-title { fill: #607174; font-size: 10px; font-weight: 700; }
.inventory-safety-line { stroke: #d09025; stroke-width: 2; stroke-dasharray: 7 6; }
.inventory-safety-label { fill: #a46b14; font-size: 11px; font-weight: 700; }
.inventory-balance-line { fill: none; stroke: #16805a; stroke-width: 3.5; stroke-linejoin: round; }
.inventory-event-bars line { stroke-width: 8; stroke-linecap: round; opacity: .78; }
.inventory-event-bars .is-receipt { stroke: #2b83d5; }
.inventory-event-bars .is-demand { stroke: #dc6159; }
.inventory-balance-chart circle { fill: #fff; stroke: #16805a; stroke-width: 2.5; }
.inventory-balance-chart circle.is-receipt { stroke: #2b83d5; }
.inventory-balance-chart circle.is-demand { stroke: #dc6159; }

.inventory-balance-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, .7fr);
  gap: 18px;
  margin-top: 18px;
}

.inventory-balance-detail-grid > section,
.inventory-balance-detail-grid > aside {
  padding: 16px;
  border: 1px solid #e0e8e6;
  border-radius: 12px;
}

.inventory-balance-detail-grid h3 { margin: 0; font-size: 15px; }
.inventory-balance-detail-grid aside { background: #f7faf9; }
.inventory-balance-detail-grid aside p { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.inventory-balance-events { max-height: 260px; overflow: auto; margin-top: 10px; }
.inventory-balance-events > div { display: grid; grid-template-columns: 92px 60px 120px minmax(0, 1fr); gap: 9px; align-items: center; padding: 9px 4px; border-top: 1px solid #edf1f0; font-size: 13px; }
.inventory-balance-events time { color: var(--muted); }
.inventory-balance-events > div > span { padding: 3px 7px; border-radius: 999px; text-align: center; white-space: nowrap; }
.inventory-balance-events .is-receipt > span { background: #e5f2fc; color: #276b9f; }
.inventory-balance-events .is-demand > span { background: #fde9e7; color: #a5423d; }
.inventory-balance-events .is-receipt > strong { color: #2675b2; }
.inventory-balance-events .is-demand > strong { color: #bd4c45; }
.inventory-balance-events b, .inventory-balance-events small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inventory-balance-events small { margin-top: 3px; color: var(--muted); }

@media (max-width: 900px) {
  .inventory-balance-search { min-width: 100%; }
  .inventory-balance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-balance-detail-grid { grid-template-columns: 1fr; }
  .inventory-balance-toolbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .inventory-balance-horizons { width: 100%; }
  .inventory-balance-horizons button { flex: 1; padding-inline: 7px; }
  .inventory-balance-events > div { grid-template-columns: 80px 60px 100px minmax(0, 1fr); }
}
.supplier-workspace {
  display: block;
}

.supplier-toolbar,
.supplier-detail-head,
.supplier-detail-actions,
.supplier-status-actions,
.supplier-registry-search {
  display: flex;
  align-items: center;
  gap: 10px;
}

.supplier-toolbar { flex-wrap: wrap; margin-bottom: 14px; }
.supplier-toolbar .search-input { flex: 1; min-width: 200px; }
.supplier-list { min-width: 0; }
.supplier-table-wrap { overflow: auto; }
.supplier-key-table { min-width: 1080px; }
.supplier-key-table tbody tr { cursor: pointer; }
.supplier-key-table tbody tr:hover,
.supplier-key-table tbody tr:focus-visible { background: #f2f8f5; outline: 0; }
.supplier-key-table td { vertical-align: middle; }
.supplier-key-table td strong,
.supplier-key-table td small { display: block; }
.supplier-key-table td small { max-width: 280px; margin-top: 4px; color: var(--muted, #68756f); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supplier-purchase-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.supplier-purchase-amount span { display: block; font-weight: 700; color: #185f4b; }
.supplier-list-item {
  width: 100%;
  border: 1px solid var(--line, #dfe7e2);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}
.supplier-list-item:hover,
.supplier-list-item.is-active { border-color: #497d63; background: #f2f8f5; }
.supplier-list-item > span { display: grid; gap: 5px; }
.supplier-list-item > span:last-child { justify-items: end; }
.supplier-list-item small { color: var(--muted, #68756f); }
.supplier-detail-head { justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line, #dfe7e2); padding-bottom: 15px; }
.supplier-detail-head h2 { margin: 3px 0; }
.supplier-detail-actions { flex-wrap: wrap; justify-content: flex-end; }
.supplier-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.supplier-metric-grid button { appearance: none; width: 100%; border: 1px solid transparent; background: #f6f9f7; border-radius: 12px; padding: 12px; display: grid; gap: 5px; text-align: left; color: inherit; cursor: pointer; }
.supplier-metric-grid button:hover,
.supplier-metric-grid button:focus-visible { border-color: #497d63; background: #eef7f2; box-shadow: 0 0 0 3px rgba(73, 125, 99, 0.1); outline: 0; }
.supplier-metric-grid strong { font-size: 1.35rem; }
.supplier-metric-grid span,
.supplier-metric-grid small,
.supplier-profile-grid span { color: var(--muted, #68756f); }
.supplier-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.supplier-profile-grid > div { border: 1px solid var(--line, #dfe7e2); border-radius: 10px; padding: 10px; display: grid; gap: 4px; }
.supplier-profile-grid .full { grid-column: 1 / -1; }
.supplier-section { margin-top: 18px; }
.supplier-status-actions { flex-wrap: wrap; }
.supplier-timeline { display: grid; gap: 8px; }
.supplier-timeline > div { display: grid; grid-template-columns: 125px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line, #dfe7e2); }
.supplier-timeline span,
.supplier-timeline small,
.muted { color: var(--muted, #68756f); }
.supplier-business-list { display: grid; gap: 8px; }
.supplier-business-list > button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 70px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line, #dfe7e2);
  border-radius: 11px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.supplier-business-list > button:hover,
.supplier-business-list > button:focus-visible { border-color: #497d63; background: #f2f8f5; outline: 0; }
.supplier-business-list > button > span { display: grid; gap: 4px; }
.supplier-business-list small { color: var(--muted, #68756f); }
.supplier-business-list b { font-size: 1rem; }
.supplier-business-list i { color: #2f6b50; font-style: normal; text-align: right; }
.supplier-business-detail-dialog { width: min(1180px, calc(100vw - 40px)); max-height: min(860px, calc(100vh - 40px)); padding: 0; border: 0; border-radius: 16px; overflow: hidden; }
.supplier-business-detail-body { min-height: 220px; max-height: calc(100vh - 230px); padding: 18px; overflow: auto; }
.supplier-business-table-wrap { overflow: auto; }
.supplier-business-table-wrap table { min-width: 900px; }
.supplier-business-table-wrap td { vertical-align: top; }
.supplier-business-table-wrap td small { display: block; margin-top: 4px; color: var(--muted, #68756f); }
.supplier-business-order-row { cursor: pointer; }
.supplier-business-order-row:hover { background: #f2f8f5; }
.supplier-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, calc(100vw - 40px));
  max-height: min(880px, calc(100vh - 40px));
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(11, 31, 26, 0.28);
}

.supplier-detail-summary {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #cfe0d9;
  border-radius: 14px;
  background: linear-gradient(120deg, #f3faf7, #fff);
}
.supplier-detail-summary[hidden] { display: none; }
.supplier-detail-summary > div:first-child { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 5px 10px; }
.supplier-detail-summary > div:first-child small { grid-column: 2; color: var(--muted); }
.supplier-summary-metrics { display: flex; align-items: center; gap: 8px; }
.supplier-summary-metrics span { padding: 7px 10px; border-radius: 9px; color: var(--muted); background: #fff; white-space: nowrap; }
.supplier-summary-metrics b { color: var(--ink); font-size: 15px; }
.supplier-summary-metrics .supplier-summary-amount { display: grid; gap: 2px; color: #185f4b; font-weight: 750; }
.supplier-summary-metrics .supplier-summary-amount small { color: var(--muted); font-size: 10px; font-weight: 500; }
.supplier-detail-summary .supplier-status-actions { grid-column: 1 / -1; }
.supplier-orders-section .supplier-form-section-title { grid-template-columns: auto minmax(0, 1fr) auto; }
.supplier-orders-section .supplier-business-table-wrap { max-height: 360px; }
.supplier-orders-section table { min-width: 820px; }
.supplier-documents-section .supplier-form-section-title { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.supplier-documents-section .supplier-form-section-title > strong { color: #176b52; font-size: 13px; }
.supplier-document-guidance-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.supplier-document-guidance-head > div { display: grid; gap: 3px; }
.supplier-document-guidance-head strong { color: #29463c; font-size: 13px; }
.supplier-document-guidance-head > div > span { color: var(--muted); font-size: 12px; }
.supplier-document-recommendations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 14px; }
.supplier-document-recommendation { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 54px; padding: 9px 10px; border: 1px solid #e1e9e6; border-radius: 10px; background: #fbfcfc; }
.supplier-document-recommendation.is-retained { border-color: #c8dfd5; background: #f3faf7; }
.supplier-document-recommendation > div { display: grid; min-width: 0; gap: 3px; }
.supplier-document-recommendation strong { color: #29463c; font-size: 12px; }
.supplier-document-recommendation small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.supplier-document-upload-status { grid-column: 1 / -1; min-height: 18px; color: var(--muted); font-size: 12px; }
.supplier-document-upload-hint { margin: -4px 0 8px; color: var(--muted); font-size: 12px; }
.supplier-document-empty { padding: 24px; border: 1px dashed #d4dfdb; border-radius: 12px; color: var(--muted); text-align: center; background: #fafcfb; }
.supplier-document-table { min-width: 980px; }
.supplier-document-table td { vertical-align: top; }
.supplier-document-table td:first-child { min-width: 240px; }
.supplier-document-table td:nth-child(2) { min-width: 150px; }
.supplier-document-table td:nth-child(3) { min-width: 210px; }
.supplier-document-table td:nth-child(4) { min-width: 180px; }
.supplier-document-table input,
.supplier-document-table select { width: 100%; min-height: 34px; padding: 6px 8px; }
.supplier-document-table input + input,
.supplier-document-table select + select { margin-top: 6px; }
.supplier-document-link { display: block; max-width: 290px; margin-top: 7px; overflow: hidden; color: #176b52; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.supplier-document-table small { display: block; margin-top: 5px; color: var(--muted); }
.supplier-import-dialog { width: min(1120px, calc(100vw - 40px)); max-height: min(860px, calc(100vh - 40px)); padding: 0; border: 0; border-radius: 16px; overflow: hidden; }
.supplier-import-dialog .dialog-form { max-height: inherit; }
.supplier-import-body { display: grid; gap: 16px; min-height: 360px; max-height: calc(100vh - 230px); padding: 20px; overflow: auto; background: #f6f9f8; }
.supplier-import-body > .excel-upload-card { width: 100%; }
.supplier-import-summary { display: flex; flex-wrap: wrap; gap: 10px; }
.supplier-import-summary span { padding: 8px 11px; border-radius: 9px; color: #41504b; background: #fff; border: 1px solid #dce6e2; }
.supplier-import-summary .is-valid { color: #176b52; background: #edf8f3; border-color: #b9dccd; }
.supplier-import-summary .is-error { color: #a63f39; background: #fff2f1; border-color: #edc4c1; }
.supplier-import-preview-shell { min-height: 190px; }
.supplier-import-preview { min-height: 145px; max-height: min(48vh, 520px); padding: 0; border: 0; border-radius: 0; background: #fff; overflow: auto; }
.supplier-import-table { min-width: 980px; }
.supplier-import-table td { vertical-align: top; }
.supplier-import-table td small { display: block; margin-top: 4px; color: var(--muted); }
.supplier-import-table tr.is-error { background: #fff2f1; }

.supplier-modal-header {
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, #fbfdfc 0%, #f3f8f6 100%);
}

.supplier-modal-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.supplier-modal-heading h2 {
  margin: 2px 0 3px;
  font-size: 22px;
  line-height: 1.2;
}

.supplier-modal-heading p { margin: 0; }

.supplier-modal-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #176b52, #26896b);
  box-shadow: 0 8px 18px rgba(31, 122, 92, 0.2);
  font-size: 18px;
  font-weight: 800;
}

.supplier-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  background: #f5f8f7;
}

.supplier-form-scroll {
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 24px;
  overscroll-behavior: contain;
}

.supplier-registry-card {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(360px, 1.2fr);
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid #cfe0d9;
  border-radius: 14px;
  background: linear-gradient(120deg, #f3faf7, #fff);
}

.supplier-registry-copy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.supplier-registry-copy strong,
.supplier-registry-copy small { display: block; }
.supplier-registry-copy strong { color: #183d31; font-size: 14px; }
.supplier-registry-copy small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.supplier-registry-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #176b52;
  background: #dff0e9;
  font-size: 20px;
  font-weight: 800;
}

.supplier-registry-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.supplier-registry-message {
  grid-column: 2;
  min-height: 0;
  color: var(--muted, #68756f);
  font-size: 12px;
}

.supplier-form-section {
  padding: 18px;
  border: 1px solid #e0e7e4;
  border-radius: 14px;
  background: #fff;
}

.supplier-form-section + .supplier-form-section { margin-top: 14px; }

.supplier-form-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf1ef;
}

.supplier-form-section-title > span {
  color: #238062;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.supplier-form-section-title h3 { margin: 0; font-size: 15px; }
.supplier-form-section-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.supplier-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.supplier-field-grid label {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  color: #3d4b47;
  font-size: 12px;
  font-weight: 650;
}

.supplier-field-grid label > span b { color: #c94b43; }
.supplier-field-grid .full-span { grid-column: 1 / -1; }
.supplier-field-grid .supplier-field-wide { grid-column: span 1; }

.supplier-form input,
.supplier-form select,
.supplier-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #ced9d4;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.supplier-form input,
.supplier-form select { height: 40px; padding: 0 11px; }
.supplier-form textarea { min-height: 66px; padding: 10px 11px; line-height: 1.55; resize: vertical; }

.supplier-form input::placeholder,
.supplier-form textarea::placeholder { color: #9aa7a2; }

.supplier-form input:hover,
.supplier-form select:hover,
.supplier-form textarea:hover { border-color: #9eb8ae; }

.supplier-form input:focus,
.supplier-form select:focus,
.supplier-form textarea:focus {
  border-color: #278165;
  box-shadow: 0 0 0 3px rgba(39, 129, 101, 0.12);
}

.supplier-form .form-message { min-height: 18px; margin: 10px 2px 0; }

.supplier-modal-actions {
  align-items: center;
  padding: 13px 24px;
  border-top: 1px solid #dfe7e3;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -8px 22px rgba(24, 48, 40, 0.04);
}

.supplier-modal-actions > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

.supplier-modal-actions button { min-width: 92px; }

@media (max-width: 1000px) {
  .supplier-workspace { grid-template-columns: 1fr; }
  .supplier-metric-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .supplier-field-grid,
  .supplier-profile-grid,
  .supplier-metric-grid { grid-template-columns: 1fr; }
  .supplier-modal { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .supplier-modal-header { padding: 16px; }
  .supplier-modal-heading p { display: none; }
  .supplier-form-scroll { padding: 14px; }
  .supplier-registry-card { grid-template-columns: 1fr; padding: 14px; }
  .supplier-registry-message { grid-column: 1; }
  .supplier-field-grid .full-span,
  .supplier-field-grid .supplier-field-wide { grid-column: auto; }
  .supplier-modal-actions { padding: 12px 14px; }
  .supplier-modal-actions > span { display: none; }
  .supplier-profile-grid .full { grid-column: auto; }
  .supplier-timeline > div { grid-template-columns: 1fr; }
  .supplier-detail-summary { grid-template-columns: 1fr; }
  .supplier-summary-metrics { overflow-x: auto; }
  .supplier-import-body { padding: 14px; }
  .supplier-document-recommendations { grid-template-columns: 1fr; }
  .supplier-document-guidance-head { align-items: flex-start; flex-direction: column; }
}

/* Compact, grouped metadata used by both PO creation flows. Kept at the end
   so the dialog-specific legacy grid rules cannot expand these fields again. */
#purchaseRequestOrderDialog .supplier-contact-grid,
#purchaseOrderDialog .supplier-contact-grid { grid-template-columns: minmax(185px, 1.25fr) minmax(135px, .85fr) minmax(145px, .9fr) minmax(210px, 1.25fr) minmax(175px, 1fr); }
#purchaseRequestOrderDialog .order-details-grid,
#purchaseOrderDialog .order-details-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#purchaseOrderDialog .order-details-grid .purchase-receiving-field { grid-column: span 2; }
#purchaseOrderDialog .order-details-grid .purchase-form-wide { grid-column: 1 / -1; }

@media (max-width: 1100px) {
  #purchaseRequestOrderDialog .supplier-contact-grid,
  #purchaseOrderDialog .supplier-contact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #purchaseRequestOrderDialog .supplier-contact-grid > label:last-child,
  #purchaseOrderDialog .supplier-contact-grid > label:last-child { grid-column: span 2; }
  #purchaseRequestOrderDialog .order-details-grid,
  #purchaseOrderDialog .order-details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  #purchaseRequestOrderDialog .supplier-contact-grid,
  #purchaseOrderDialog .supplier-contact-grid,
  #purchaseRequestOrderDialog .order-details-grid,
  #purchaseOrderDialog .order-details-grid { grid-template-columns: 1fr; }
  #purchaseRequestOrderDialog .supplier-contact-grid > label:last-child,
  #purchaseOrderDialog .supplier-contact-grid > label:last-child,
  .purchase-form-span-2,
  #purchaseOrderDialog .order-details-grid .purchase-receiving-field { grid-column: auto; }
}
