:root {
  --bg: #f6f7f9;
  --sidebar: #0b1f3a;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --text: #172033;
  --muted: #687386;
  --line: #dfe5ec;
  --panel: #ffffff;
  --warn: #b45309;
  --ok: #047857;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: #eef2f7;
  padding: 20px;
}

.login-screen.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.backend-rule-fields,
.technical-quote-field {
  display: none !important;
}

.readonly-value {
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #f8fafc;
  color: var(--muted);
}

.derived-size {
  border: 1px solid #cfe4df;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f7fbfa;
}

.derived-size-title {
  color: #0f3f35;
  font-weight: 700;
  margin-bottom: 10px;
}

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

.derived-size-grid span {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.derived-size-grid b {
  color: var(--muted);
  font-size: 11px;
}

.wizard-section {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #f8fbfa;
}

.wizard-section strong {
  color: #0f3f35;
  font-size: 14px;
}

.wizard-section span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.material-price-linkage {
  margin-top: 8px;
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 9px 10px;
}

.material-price-recommended {
  display: grid;
  gap: 3px;
}

.material-price-recommended span,
.material-price-drawer small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.material-price-recommended strong {
  color: #0f3f35;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}

.material-price-drawer {
  margin-top: 7px;
}

.material-price-drawer summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.material-price-drawer select {
  margin-top: 7px;
}

.material-derived-gsm {
  color: #526070;
}

.library-filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}

.library-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d9e5e2;
  border-radius: 999px;
  background: #fff;
  color: #263445;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.library-filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.library-filter-chip.active {
  border-color: var(--primary);
  background: #eaf6f2;
  color: #0f3f35;
}

.library-filter-chip span {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eef3f6;
  color: #526070;
  font-size: 12px;
}

.library-filter-chip.active span {
  background: #0f7f72;
  color: #fff;
}

.library-filter-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

[data-bulk-select],
[data-bulk-select-all],
[data-v5-select],
[data-v5-select-all] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.bulk-count {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.bulk-count.active {
  border-color: var(--primary);
  background: #eaf6f2;
  color: #0f3f35;
}

tr.bulk-select-attention {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
  background: #fff7ed;
}

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

.version-card {
  display: grid;
  grid-template-columns: 28px minmax(260px, 1.1fr) minmax(220px, 0.75fr) minmax(420px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.version-select {
  display: flex;
  align-items: center;
  justify-content: center;
}

.version-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.version-title strong {
  color: #142033;
  font-size: 15px;
  line-height: 1.35;
}

.version-title span {
  border-radius: 999px;
  background: #eef6f3;
  color: #0f5f53;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
}

.version-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.version-meta span {
  max-width: 260px;
  overflow-wrap: anywhere;
}

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

.version-money div {
  min-width: 0;
  border: 1px solid #e3ece9;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 9px 10px;
}

.version-money span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.version-money strong {
  display: block;
  color: #172033;
  font-size: 15px;
  white-space: nowrap;
}

.version-actions {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.version-actions .small-select {
  width: 116px;
  min-width: 0;
  height: 36px;
  padding: 0 28px 0 10px;
  font-size: 13px;
}

.version-actions .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.version-actions .ghost.small {
  padding: 7px 10px;
  min-height: 34px;
  font-size: 13px;
  line-height: 1.1;
}

.empty-state {
  border: 1px dashed #cbd9d5;
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.master-custom-input {
  margin-top: 8px;
}

@media (max-width: 1360px) {
  .version-card {
    grid-template-columns: 28px minmax(280px, 1fr);
  }

  .version-money,
  .version-actions {
    grid-column: 2;
  }
}

@media (max-width: 820px) {
  .version-card {
    grid-template-columns: 1fr;
  }

  .version-select,
  .version-money,
  .version-actions {
    grid-column: auto;
  }

  .version-actions,
  .version-money {
    grid-template-columns: 1fr;
  }
}

.material-library-drawer {
  margin-top: 7px;
}

.material-library-drawer summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.material-library-price-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  min-width: 260px;
}

.material-library-price-list span {
  display: grid;
  gap: 2px;
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.45;
}

.material-library-price-list b {
  color: #0f3f35;
}

.material-library-price-list small {
  color: var(--muted);
}

.material-price-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.material-master-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.material-master-summary div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 10px 12px;
}

.material-master-summary span {
  color: var(--muted);
  font-size: 11px;
}

.material-master-summary strong {
  color: #0f3f35;
  overflow-wrap: anywhere;
}

.price-version-list {
  display: grid;
  gap: 8px;
}

.price-version-list div {
  display: grid;
  grid-template-columns: minmax(140px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
}

.price-version-list span {
  color: var(--muted);
}

.price-version-table th,
.price-version-table td {
  min-width: 112px;
  font-size: 12px;
  white-space: nowrap;
}

.table-actions {
  min-width: 250px;
}

.table-actions .small {
  margin: 2px;
}

.danger-action {
  color: #9f1239;
}

.legacy-process-details {
  margin-top: 14px;
}

.legacy-process-details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 2px;
}

.legacy-process-panel {
  margin-top: 8px;
}

.customer-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid #d7efe9;
  border-radius: 8px;
  background: #f5fbf9;
  padding: 10px;
}

.customer-context span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbe7e3;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 6px 9px;
  font-size: 12px;
}

.customer-context b {
  color: #0f3f35;
  font-weight: 700;
}

.login-panel {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  padding: 26px;
}

.login-panel h1 {
  margin: 22px 0 16px;
}

.login-panel .brand {
  color: var(--text);
}

.login-panel .brand span {
  color: var(--muted);
}

.login-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-error {
  margin: 12px 0 0;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.login-error.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.mfa-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.mfa-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  padding: 22px;
}

.mfa-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.mfa-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.mfa-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 18px;
  letter-spacing: 0;
}

.mfa-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

button,
input,
select {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: var(--sidebar);
  color: #fff;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.login-panel .brand-logo {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
}

.brand span,
.tenant-card span,
.tenant-card small {
  display: block;
  color: #b9c6d8;
  font-size: 12px;
  margin-top: 3px;
}

.nav {
  display: grid;
  gap: 7px;
  overflow: auto;
}

.nav-item {
  color: #dce7f4;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  padding: 11px 12px;
  cursor: pointer;
}

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

.tenant-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
}

.shell {
  margin-left: 260px;
  min-height: 100vh;
  padding: 26px 30px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

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

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

.primary,
.ghost {
  border-radius: 8px;
  padding: 10px 15px;
  cursor: pointer;
}

.primary:disabled,
.ghost:disabled,
button[data-busy="true"] {
  cursor: wait;
  opacity: 0.62;
}

.primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

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

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.ghost:hover {
  border-color: #b7c4d4;
  background: #f8fafc;
}

.small {
  padding: 8px 12px;
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-gap {
  margin-top: 16px;
}

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

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 30px;
  margin: 8px 0 4px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  background: #eef2f7;
  color: #475569;
  white-space: nowrap;
}

.tag.ok {
  background: #dcfce7;
  color: var(--ok);
}

.tag.warn {
  background: #fef3c7;
  color: var(--warn);
}

.rank-list,
.check-list,
.permission-grid,
.activity-list,
.summary-list {
  display: grid;
  gap: 12px;
}

.rank-list div,
.permission-grid div,
.activity-list div,
.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.permission-grid div,
.summary-list div {
  display: grid;
}

.permission-grid span,
.rank-list span,
.activity-list span,
.summary-list span {
  color: var(--muted);
}

.check-list label {
  display: flex;
  gap: 9px;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

#v5PricingHead th,
#v5PricingRows td {
  min-width: 112px;
  max-width: 230px;
  font-size: 13px;
  white-space: nowrap;
}

#v5PricingRows td {
  overflow: hidden;
  text-overflow: ellipsis;
}

#v5PricingRows td:last-child {
  min-width: 315px;
  max-width: 360px;
  white-space: normal;
}

#v5PricingHead th:first-child,
#v5PricingRows td:first-child {
  min-width: 150px;
}

th,
td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
}

th {
  color: #334155;
  background: #f8fafc;
  font-size: 13px;
}

.group-row td {
  background: #eef7f4;
  color: #0f4f46;
  font-weight: 800;
  border-top: 1px solid #cfe5df;
  border-bottom: 1px solid #cfe5df;
}

.group-row span {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

td:last-child,
th:last-child {
  white-space: nowrap;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

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

.form-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-section,
.dynamic-fields {
  grid-column: 1 / -1;
}

.form-section {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px 14px;
}

.form-section strong,
.form-section span {
  display: block;
}

.form-section span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

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

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

.process-options label {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.process-options input {
  width: auto;
  margin-top: 2px;
}

.wide-field {
  grid-column: 1 / -1;
}

select[multiple] {
  min-height: 158px;
  line-height: 1.8;
}

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

.price-source span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  padding: 10px 11px;
  font-size: 12px;
}

label {
  color: #334155;
  font-size: 13px;
}

input,
select {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}

.search {
  width: min(260px, 100%);
  margin-top: 0;
  padding: 8px 11px;
}

.role-select {
  width: auto;
  min-width: 138px;
  margin-top: 0;
  padding: 9px 11px;
}

.small-select {
  width: auto;
  min-width: 92px;
  margin: 0 6px 6px 0;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 12px;
}

.compact-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 160px minmax(150px, 0.8fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 8px 0 14px;
}

.compact-toolbar select,
.compact-toolbar input {
  margin-top: 0;
  min-height: 38px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.inline-check input {
  width: auto;
  margin: 0;
}

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

.version-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.version-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.version-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  color: var(--text);
}

.session-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 8px 11px;
  font-size: 13px;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid #b9d7d0;
  border-radius: 8px;
  background: #e8f4f1;
  color: #0f3f35;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.version-pill.version-mismatch {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

.summary {
  position: sticky;
  top: 20px;
  align-self: start;
}

.price {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}

.price span,
.price small {
  color: var(--muted);
}

.price strong {
  display: block;
  font-size: 30px;
  margin: 8px 0 4px;
}

.cost-lines {
  display: grid;
  gap: 9px;
  margin: 0;
}

.cost-lines div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.cost-lines dt {
  color: var(--muted);
}

.cost-lines dd {
  margin: 0;
  font-weight: 700;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.rule-box {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: #475569;
  font-size: 13px;
}

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

.quote-output {
  display: grid;
  gap: 16px;
}

.quote-output-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--primary);
}

.quote-output-head img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}

.quote-output-head strong,
.quote-output-head span {
  display: block;
}

.quote-output-head span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.quote-customer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.quote-customer-grid div {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.quote-customer-grid div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.quote-customer-grid span,
.quote-customer-grid strong {
  display: block;
}

.quote-customer-grid span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.quote-output-note {
  border-left: 4px solid #c7952d;
  background: #fffbeb;
  color: #475569;
  padding: 12px 14px;
  font-size: 13px;
}

.quote-warning {
  border: 1px solid #f2c36b;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  padding: 10px 12px;
  font-size: 12px;
}

.pallet-diagram {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 14px;
  margin-top: 8px;
}

.pallet-visual {
  position: relative;
  width: 100%;
  max-width: 420px;
  min-height: 230px;
  border-radius: 8px;
  background: #fbfefd;
  border: 1px solid #dbe7e3;
  overflow: visible;
}

.pallet-visual--no-pallet {
  max-width: 320px;
  min-height: 210px;
}

.pallet-base {
  position: absolute;
  left: 16%;
  right: 11%;
  bottom: 36px;
  height: 18px;
  transform: skewX(-28deg);
  background: #d9b56e;
  border: 1px solid #9b7a38;
  box-shadow: 0 8px 12px rgba(15, 23, 42, 0.08);
  z-index: 1;
}

.pallet-base::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -12px;
  height: 10px;
  background: #b98d45;
}

.pallet-base i {
  display: none;
}

.pallet-load {
  position: absolute;
  left: calc(50% - (var(--front-w) / 2) - (var(--depth-w) / 3));
  bottom: 66px;
  width: var(--front-w);
  height: var(--front-h);
  z-index: 3;
}

.pallet-load.single-carton {
  bottom: 58px;
}

.stack-front,
.stack-side,
.stack-top {
  position: absolute;
  display: grid;
  background: rgba(230, 246, 241, 0.7);
  border: 2px solid #0f766e;
}

.stack-front {
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(var(--front-cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--front-rows), minmax(0, 1fr));
}

.stack-side {
  left: 100%;
  bottom: 0;
  width: var(--depth-w);
  height: 100%;
  transform: skewY(-24deg);
  transform-origin: left bottom;
  grid-template-columns: repeat(var(--side-cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--side-rows), minmax(0, 1fr));
  background: rgba(209, 250, 229, 0.58);
}

.stack-top {
  left: 0;
  bottom: 100%;
  width: 100%;
  height: calc(var(--depth-w) * 0.58);
  transform: skewX(-42deg);
  transform-origin: left bottom;
  grid-template-columns: repeat(var(--top-cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--top-rows), minmax(0, 1fr));
  background: rgba(236, 253, 245, 0.9);
}

.stack-front i,
.stack-side i,
.stack-top i {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid rgba(15, 118, 110, 0.38);
  border-bottom: 1px solid rgba(15, 118, 110, 0.38);
}

.dim {
  position: absolute;
  z-index: 7;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  white-space: nowrap;
}

.dim-l {
  left: 8px;
  bottom: -34px;
}

.dim-w {
  right: calc((var(--depth-w) * -1) - 20px);
  bottom: 20px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dim-h {
  left: -52px;
  top: 6px;
  writing-mode: vertical-rl;
}

.dim-layer {
  left: 50%;
  top: calc((var(--depth-w) * -0.58) - 36px);
  transform: translateX(-50%);
  background: #0f3f35;
}

.pallet-warning {
  color: #b45309;
  font-weight: 700;
}

.pallet-facts {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

.pallet-facts span {
  overflow-wrap: anywhere;
}

.pallet-facts strong {
  color: #0f3f35;
  font-size: 15px;
}

.layout-diagrams {
  display: grid;
  gap: 12px;
  margin: 8px 0;
}

.imposition-card {
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #fbfefd;
  padding: 12px;
  min-width: 0;
}

.layout-plan-card {
  background: #fbfefd;
}

.layout-warning {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 5px 7px;
}

.layout-candidate-table {
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #ffffff;
  overflow: auto;
  padding: 12px;
}

.layout-candidate-table strong {
  display: block;
  color: #0f3f35;
  margin-bottom: 8px;
}

.layout-candidate-table table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.layout-candidate-table th,
.layout-candidate-table td {
  border-bottom: 1px solid #e5ece9;
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
}

.structure-card {
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.imposition-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: #0f3f35;
}

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

.imposition-sheet {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(18px, 1fr));
  grid-template-rows: repeat(var(--rows), 24px);
  gap: 3px;
  border: 2px solid #8aa9a2;
  border-radius: 6px;
  background: #eef8f5;
  padding: 6px;
}

.imposition-sheet span {
  display: grid;
  place-items: center;
  border: 1px solid #b9d7d0;
  border-radius: 4px;
  background: #fff;
  color: #31534c;
  font-size: 10px;
}

.imposition-meta {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.structure-visual {
  position: relative;
  min-height: 130px;
  border-radius: 8px;
  border: 1px solid #e6d7b7;
  background: linear-gradient(180deg, #fff8e8, #ffffff);
  overflow: hidden;
}

.structure-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.structure-stats span {
  display: inline-flex;
  gap: 6px;
  border: 1px solid #e5eadf;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 6px 9px;
  font-size: 12px;
}

.structure-stats b {
  color: #0f3f35;
}

.sig-sheet,
.wire-cover,
.wire-pages,
.spread-window,
.special-page,
.diecut-net,
.rigid-lid,
.rigid-base,
.calendar-pages,
.wall-pages,
.book-cover-spread,
.game-card-stack i,
.game-card-box,
.case-board {
  position: absolute;
  border: 2px solid #0f766e;
  border-radius: 6px;
  background: rgba(20, 184, 166, 0.12);
}

.sig-sheet {
  top: 26px;
  width: 34%;
  height: 78px;
}

.sig-a { left: 14%; transform: skewY(-8deg); }
.sig-b { right: 14%; transform: skewY(8deg); }

.fold-line {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  border-left: 2px dashed #c7952d;
}

.staple {
  position: absolute;
  left: calc(50% - 5px);
  width: 10px;
  height: 24px;
  border-radius: 999px;
  background: #0f3f35;
}

.staple-one { top: 36px; }
.staple-two { bottom: 36px; }

.wire-cover {
  left: 26%;
  top: 22px;
  width: 45%;
  height: 84px;
  background: #fef3c7;
  border-color: #a87416;
}

.wire-pages {
  left: 30%;
  top: 30px;
  width: 45%;
  height: 84px;
  border-color: #b9d7d0;
  background: #fff;
}

.wire-holes {
  position: absolute;
  left: 22%;
  top: 22px;
  display: grid;
  gap: 4px;
}

.wire-holes i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid #0f766e;
  background: #fff;
}

.wire-coil {
  position: absolute;
  left: 18%;
  top: 18px;
  width: 12px;
  height: 98px;
  border-radius: 999px;
  background: repeating-linear-gradient(180deg, #0f766e 0 5px, transparent 5px 10px);
}

.spread-window {
  left: 22%;
  top: 22px;
  width: 56%;
  height: 86px;
  background: #fef3c7;
  border-color: #a87416;
}

.apet-layer {
  position: absolute;
  left: 37%;
  top: 34px;
  width: 28%;
  height: 54px;
  border: 2px solid #38bdf8;
  border-radius: 7px;
  background: rgba(56, 189, 248, 0.18);
}

.thumb-hole,
.hang-hole {
  position: absolute;
  left: 48%;
  bottom: 22px;
  width: 24px;
  height: 12px;
  border-radius: 999px 999px 0 0;
  border: 2px solid #0f766e;
  border-bottom: 0;
  background: #fff;
}

.round-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-top: 3px solid #0f766e;
}

.rc-a { left: 24%; top: 24px; border-left: 3px solid #0f766e; border-radius: 10px 0 0 0; }
.rc-b { right: 24%; top: 24px; border-right: 3px solid #0f766e; border-radius: 0 10px 0 0; }

.game-card-stack i {
  width: 42px;
  height: 62px;
  top: 32px;
  left: calc(28% + var(--offset, 0px));
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 63, 53, 0.12);
}

.game-card-stack i:nth-child(1) { --offset: 0px; transform: rotate(-8deg); }
.game-card-stack i:nth-child(2) { --offset: 22px; transform: rotate(2deg); }
.game-card-stack i:nth-child(3) { --offset: 44px; transform: rotate(8deg); }

.game-card-box {
  right: 21%;
  top: 34px;
  width: 70px;
  height: 58px;
  border-color: #a87416;
  background: #fef3c7;
  transform: skewY(-6deg);
}

.special-page {
  left: 20%;
  top: 22px;
  width: 60%;
  height: 86px;
  background: #fff;
  border-color: #94a3b8;
}

.scratch-zone,
.water-zone {
  position: absolute;
  left: 34%;
  top: 40px;
  width: 32%;
  height: 44px;
  border-radius: 8px;
}

.scratch-zone { background: #111827; }
.water-zone { background: rgba(14, 165, 233, 0.26); border: 2px solid #0284c7; }

.white-lines,
.black-lines {
  position: absolute;
  left: 35%;
  right: 35%;
  bottom: 34px;
  display: grid;
  gap: 4px;
}

.white-lines i,
.black-lines i {
  height: 3px;
  border-radius: 999px;
}

.white-lines i { background: #fff; }
.black-lines i { background: #111827; }

.diecut-net {
  left: 14%;
  top: 28px;
  width: 72%;
  height: 74px;
  border-color: #a87416;
  background: #fff8e1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.diecut-net i {
  border-left: 1px dashed #a87416;
}

.colorbox-net {
  grid-template-columns: repeat(3, 1fr);
}

.glue-flap,
.lock-tab {
  position: absolute;
  background: rgba(199, 149, 45, 0.24);
  border: 1px dashed #a87416;
}

.glue-flap {
  right: 10%;
  top: 36px;
  width: 22px;
  height: 58px;
}

.lock-tab {
  left: 42%;
  top: 18px;
  width: 40px;
  height: 18px;
}

.rigid-lid,
.rigid-base,
.rigid-board {
  border-color: #a87416;
  background: rgba(254, 243, 199, 0.82);
}

.rigid-lid { left: 18%; top: 26px; width: 34%; height: 72px; }
.rigid-base { right: 18%; top: 42px; width: 34%; height: 72px; }
.rigid-board { left: 39%; top: 32px; width: 22%; height: 58px; background: rgba(148, 163, 184, 0.28); }

.calendar-pages,
.wall-pages {
  left: 32%;
  top: 22px;
  width: 38%;
  height: 74px;
  background: #fff;
  border-color: #0f766e;
  box-shadow: 7px 7px 0 rgba(15, 118, 110, 0.15);
}

.calendar-wire,
.hanger-strip {
  position: absolute;
  left: 28%;
  right: 26%;
  top: 18px;
  height: 10px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #0f766e 0 8px, transparent 8px 13px);
}

.calendar-base {
  position: absolute;
  left: 24%;
  right: 20%;
  bottom: 22px;
  height: 28px;
  transform: skewX(-20deg);
  border: 2px solid #a87416;
  background: #facc15;
}

.book-cover-spread {
  left: 18%;
  top: 28px;
  width: 64%;
  height: 78px;
  border-color: #0f766e;
  background: #ecfdf5;
}

.book-spine {
  position: absolute;
  left: 49%;
  top: 26px;
  width: 10px;
  height: 82px;
  background: #0f766e;
  border-radius: 4px;
}

.book-block {
  position: absolute;
  left: 28%;
  right: 28%;
  bottom: 26px;
  height: 16px;
  background: repeating-linear-gradient(180deg, #fff 0 2px, #cbd5e1 2px 3px);
  border: 1px solid #94a3b8;
}

.case-board {
  top: 30px;
  height: 76px;
  border-color: #a87416;
  background: #fef3c7;
}

.left-board { left: 18%; width: 26%; }
.spine-board { left: 47%; width: 8%; background: #e5e7eb; }
.right-board { right: 18%; width: 26%; }

.wrap-edge {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 22px;
  bottom: 16px;
  border: 2px dashed #c7952d;
  border-radius: 8px;
}

.addon-builder {
  grid-column: 1 / -1;
  border: 1px solid #dbe7e3;
  border-radius: 8px;
  background: #fbfefd;
  padding: 12px;
}

.addon-builder:not([open]) {
  padding-bottom: 10px;
}

.addon-builder summary {
  list-style: none;
  cursor: pointer;
}

.addon-builder summary::-webkit-details-marker {
  display: none;
}

.addon-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 0;
}

.addon-builder[open] .addon-head {
  margin-bottom: 12px;
}

.addon-head::before {
  content: "+";
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #e8f4f1;
  color: #0f3f35;
  font-weight: 800;
}

.addon-builder[open] .addon-head::before {
  content: "-";
}

.addon-head strong,
.addon-head span {
  display: block;
}

.addon-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.addon-rows {
  display: grid;
  gap: 12px;
}

.addon-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.addon-row label {
  min-width: 0;
}

.addon-remove {
  align-self: end;
}

.addon-empty {
  border: 1px dashed #b9d7d0;
  border-radius: 8px;
  color: var(--muted);
  padding: 12px;
}

.detail-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.detail-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.master-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.form-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.form-group h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

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

.drawer-grid .wide {
  grid-column: 1 / -1;
}

.drawer-note {
  border-left: 4px solid #0f766e;
  background: #f0fdfa;
  color: #31534c;
  line-height: 1.7;
  padding: 12px 14px;
  border-radius: 8px;
  margin: 16px 0;
}

.process-choice-grid {
  display: grid;
  gap: 10px;
}

.process-choice-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.process-choice-grid strong,
.process-choice-grid span {
  display: block;
}

.process-choice-grid span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.84), #fff 35%);
  padding-top: 14px;
}

.sql {
  white-space: pre-wrap;
  background: #0f172a;
  color: #dbeafe;
  border-radius: 8px;
  padding: 16px;
  overflow: auto;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 32px));
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  background: rgba(15, 23, 42, 0.28);
}

.drawer.open {
  display: block;
}

.drawer-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(520px, 100vw);
  background: #fff;
  box-shadow: -18px 0 36px rgba(15, 23, 42, 0.16);
  padding: 24px;
  overflow: auto;
}

.drawer-close {
  float: right;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .shell {
    margin-left: 0;
    padding: 20px;
  }

  .metric-grid,
  .two-col,
  .quote-layout,
  .form-grid,
  .dynamic-fields,
  .addon-row,
  .material-master-summary,
  .price-version-list div {
    grid-template-columns: 1fr;
  }

  .addon-head,
  .imposition-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-grid,
  .form-grid.compact,
  .drawer-grid,
  .compact-toolbar,
  .version-summary {
    grid-template-columns: 1fr;
  }

  .drawer-grid .wide {
    grid-column: auto;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    overflow-x: auto;
  }

  th,
  td {
    padding: 11px 8px;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }
}
