:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f9fafd;
  --line: #e5e8ee;
  --line-strong: #e9ebef;
  --text: #131b2c;
  --muted: #6c768b;
  --muted-strong: #3f485a;
  --teal: #126437;
  --teal-dark: #0f4f2c;
  --teal-soft: #e7f7ed;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #e8f0ff;
  --violet: #6c5ce7;
  --violet-soft: #f4f2ff;
  --green: #168847;
  --green-soft: #e4f8eb;
  --orange: #d97706;
  --orange-soft: #fff1d8;
  --rose: #d94668;
  --rose-soft: #ffe7ee;
  --amber: #b86f16;
  --amber-soft: #fff3dc;
  --red: #b94736;
  --shadow: 0 12px 30px rgba(19, 27, 44, 0.07), 0 2px 5px rgba(19, 27, 44, 0.04);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.manual-line-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.manual-line-modes button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.manual-line-modes button.is-active {
  color: #315eea;
  border-color: #8ca9ff;
  background: #eef4ff;
}

.manual-line-modes svg,
.manual-source-selected svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 6px;
}

.manual-source-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid #9ddfc8;
  background: #edfbf5;
}

.manual-source-selected div,
.manual-source-selected span,
.manual-source-selected small {
  display: block;
}

.pervasive-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border-left: 4px solid #f3a11a;
  background: #fff8e8;
  color: #5c410d;
}

.pervasive-warning svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

.pervasive-warning strong,
.pervasive-warning span {
  display: block;
}

.pervasive-warning span {
  margin-top: 3px;
  color: #765b27;
}

.pervasive-toolbar {
  grid-template-columns: minmax(320px, 1fr) 140px 140px auto;
}

.pervasive-loading .batch-analysis-loading-steps {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.pervasive-elapsed {
  display: block;
  margin-top: 14px;
  color: #53627b;
}

.pervasive-item {
  display: grid;
  grid-template-columns: 42px minmax(260px, 1.5fr) minmax(170px, .7fr) minmax(190px, .8fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.pervasive-item > div > strong,
.pervasive-item > div > small,
.pervasive-item > div > em,
.pervasive-item > div > span {
  display: block;
}

.pervasive-item > div > em {
  margin-top: 5px;
  color: #52627b;
  font-style: normal;
  font-size: 12px;
}

.percentage-analysis-intro {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid #cbd8ee;
  background: #f4f8ff;
}

.percentage-analysis-intro span,
.percentage-analysis-intro strong,
.percentage-analysis-intro small {
  display: block;
}

.percentage-analysis-intro strong {
  font-size: 24px;
}

.percentage-analysis-table {
  margin-top: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.percentage-analysis-header,
.percentage-analysis-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) 130px 160px minmax(210px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
}

.percentage-analysis-header {
  background: #edf2f8;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.percentage-analysis-row {
  border-top: 1px solid var(--line);
}

.percentage-analysis-row small {
  display: block;
  margin-top: 3px;
  color: #65738a;
}

.percentage-value i {
  display: block;
  height: 7px;
  margin-top: 6px;
  overflow: hidden;
  background: #e7edf6;
}

.percentage-value i span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3977ec, #7a4cf5);
}

.percentage-analysis-total {
  display: flex;
  justify-content: flex-end;
  gap: 32px;
  padding: 15px 16px;
  border-top: 2px solid #93a6c4;
  background: #f7f9fc;
}

@media (max-width: 1000px) {
  .pervasive-toolbar,
  .pervasive-item,
  .percentage-analysis-intro,
  .percentage-analysis-header,
  .percentage-analysis-row {
    grid-template-columns: 1fr;
  }

  .pervasive-loading .batch-analysis-loading-steps {
    grid-template-columns: 1fr;
  }
}

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

.app-shell.is-sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: #fbfcfc;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
}

.app-shell.is-sidebar-collapsed .sidebar {
  padding: 16px 12px;
  overflow: visible;
}

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

.sidebar-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  flex: 0 0 34px;
}

.sidebar-toggle span {
  display: block;
  width: 15px;
  height: 2px;
  background: var(--muted-strong);
  border-radius: 999px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #16683a, #0d4d2b);
  font-size: 23px;
  font-weight: 850;
  box-shadow: 0 6px 14px rgba(18, 100, 55, 0.2);
}

.app-shell.is-sidebar-collapsed .brand {
  flex-direction: column;
  gap: 10px;
}

.app-shell.is-sidebar-collapsed .brand-copy,
.app-shell.is-sidebar-collapsed .sidebar-context,
.app-shell.is-sidebar-collapsed .module-label {
  display: none;
}

.brand h1,
.topbar h2,
.panel-title h3,
.modal-header h3,
.lina-chat-head h3 {
  margin: 0;
}

.brand h1 {
  font-size: 1rem;
  line-height: 1.2;
}

.source-badge {
  display: inline-flex;
  margin-top: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.module-nav {
  display: grid;
  gap: 8px;
}

.module-link {
  min-height: 42px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  font-weight: 750;
  text-align: left;
}

.module-link:hover {
  background: var(--surface-soft);
}

.module-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 0.8rem;
  color: inherit;
}

.module-link.is-active {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 4px 10px rgba(18, 100, 55, 0.2);
}

.module-link.is-active .module-icon {
  color: #fff;
}

.app-shell.is-sidebar-collapsed .module-link {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 7px;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.side-controls,
.top-actions,
.target-actions,
.modal-footer,
.component-editor-head,
.table-toolbar,
.table-actions,
.status-row,
.selected-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: 1.65rem;
  letter-spacing: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  border-top: 4px solid var(--teal);
}

.metric:nth-child(1) {
  border-top-color: var(--blue);
  background: linear-gradient(180deg, var(--blue-soft) 0%, #ffffff 58%);
}

.metric:nth-child(2) {
  border-top-color: var(--orange);
  background: linear-gradient(180deg, var(--orange-soft) 0%, #ffffff 58%);
}

.metric:nth-child(3) {
  border-top-color: var(--violet);
  background: linear-gradient(180deg, var(--violet-soft) 0%, #ffffff 58%);
}

.metric:nth-child(4) {
  border-top-color: var(--green);
  background: linear-gradient(180deg, var(--green-soft) 0%, #ffffff 58%);
}

.metric:nth-child(5) {
  border-top-color: var(--rose);
  background: linear-gradient(180deg, var(--rose-soft) 0%, #ffffff 58%);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
}

.dashboard-panel {
  overflow: hidden;
}

.dashboard-list {
  display: grid;
}

.dashboard-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(120px, 150px));
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-row:hover {
  background: #f6fbff;
  box-shadow: inset 4px 0 0 var(--blue);
}

.dashboard-row:focus-visible {
  outline: 3px solid rgba(42, 99, 234, 0.24);
  outline-offset: -3px;
}

.dashboard-row strong {
  display: block;
  color: var(--teal-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.dashboard-row span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.dashboard-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.3;
}

.budget-search {
  padding: 0 16px 16px;
}

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

.right-rail {
  display: grid;
  gap: 16px;
}

.batch-launch-panel {
  overflow: hidden;
}

.batch-launch-grid {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.batch-launch {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 108px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(23, 33, 38, 0.05);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.batch-launch:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(23, 33, 38, 0.1);
}

.batch-launch span {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.batch-launch strong {
  font-size: 1.08rem;
}

.batch-launch small {
  color: var(--muted);
  line-height: 1.35;
}

.batch-launch-quantity {
  border-color: #b9ccff;
  background: linear-gradient(180deg, var(--blue-soft) 0%, #ffffff 72%);
}

.batch-launch-quantity span,
.batch-launch-quantity strong {
  color: var(--blue-dark);
}

.batch-launch-replace {
  border-color: #d2c2ff;
  background: linear-gradient(180deg, var(--violet-soft) 0%, #ffffff 72%);
}

.batch-launch-replace span,
.batch-launch-replace strong {
  color: var(--violet);
}

.batch-launch-add {
  border-color: #b8e5c4;
  background: linear-gradient(180deg, var(--green-soft) 0%, #ffffff 72%);
}

.batch-launch-add span,
.batch-launch-add strong {
  color: var(--green);
}

.batch-launch.is-active {
  border-width: 2px;
}

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

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

.structure-header {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.structure-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.structure-title h3 {
  margin: 4px 0 8px;
  font-size: 1.28rem;
  line-height: 1.2;
}

.code,
.order-code {
  color: var(--teal-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-weight: 800;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.simulation-note {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid #b9ccff;
  border-radius: 8px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.structure-details {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.structure-details span,
.structure-details label {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.structure-details small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.structure-details strong,
.price-list-static {
  min-width: 0;
  color: var(--text);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.compact-select {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.82rem;
}

.row-price-list-control {
  display: grid;
  min-width: 160px;
  gap: 5px;
}

.row-price-list-control .compact-select {
  width: 100%;
}

.row-price-list-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #315dce;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1;
}

.row-price-list-status i {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid #c7d5ff;
  border-top-color: #315dce;
  border-radius: 50%;
  animation: row-price-spin .8s linear infinite;
}

@keyframes row-price-spin {
  to { transform: rotate(360deg); }
}

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

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-item strong {
  display: block;
  margin-top: 4px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: white;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.changed {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #efc271;
}

.status-pill.sap {
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-color: #8ccfc5;
}

.table-toolbar {
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.table-toolbar > div:first-child {
  min-width: 250px;
  max-width: 360px;
  flex: 1;
}

.table-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-scroll {
  max-height: calc(100vh - 350px);
  min-height: 390px;
  overflow: auto;
}

.bom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  min-width: 1220px;
  font-size: 0.85rem;
}

.bom-table th:nth-child(1),
.bom-table td:nth-child(1) {
  width: 94px;
}

.bom-table th:nth-child(2),
.bom-table td:nth-child(2) {
  width: 86px;
}

.bom-table th:nth-child(3),
.bom-table td:nth-child(3) {
  width: auto;
}

.bom-table th:nth-child(4),
.bom-table td:nth-child(4) {
  width: 68px;
}

.bom-table th:nth-child(5),
.bom-table td:nth-child(5) {
  width: 62px;
}

.bom-table th:nth-child(6),
.bom-table td:nth-child(6) {
  width: 96px;
}

.bom-table th:nth-child(7),
.bom-table td:nth-child(7) {
  width: 96px;
}

.bom-table th:nth-child(8),
.bom-table td:nth-child(8) {
  width: 112px;
}

.bom-table th:nth-child(9),
.bom-table td:nth-child(9) {
  width: 62px;
}

.bom-table th:nth-child(10),
.bom-table td:nth-child(10) {
  width: 120px;
}

.bom-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3f4;
  color: var(--muted-strong);
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.bom-table td {
  padding: 10px;
  vertical-align: top;
  border-bottom: 1px solid #edf1f2;
  background: white;
}

.bom-table tr.parent-row td {
  background: #f7fbfb;
  border-top: 1px solid var(--line);
  border-bottom-color: #dbe8e9;
}

.bom-table tr.parent-row .code-button,
.bom-table tr.parent-row .description,
.bom-table tr.parent-row .order-code {
  font-weight: 900;
  color: var(--text);
}

.bom-table tr.child-row .item-cell {
  position: relative;
}

.bom-table tr.child-row .item-cell::before {
  content: "";
  position: absolute;
  left: calc(10px + var(--branch-indent, 0px));
  top: 0;
  bottom: 0;
  width: 2px;
  background: #dfe8ea;
}

.bom-table tr.selected-row td {
  background: #eaf7f5;
}

.bom-table tr.changed-row td {
  background: #fffaf0;
}

.bom-table tr.manual-row td {
  background: #fff8ea;
}

.inline-price-input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 0.8rem;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 800;
}

.inline-check input {
  accent-color: var(--green);
}

.tree-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
}

.row-check {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.tree-toggle,
.tree-spacer {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.tree-toggle {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  cursor: pointer;
  position: relative;
}

.tree-toggle::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--teal-dark);
  border-bottom: 2px solid var(--teal-dark);
  transform: rotate(-45deg);
}

.tree-toggle.is-open::before {
  top: 7px;
  transform: rotate(45deg);
}

.level-dot {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
  flex: 0 0 24px;
}

.item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: var(--indent, 0px);
}

.structure-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid #9ad3cb;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.manual-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid #ffd08a;
  border-radius: 999px;
  background: var(--orange-soft);
  color: #8a4b00;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.description {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.line-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  padding-left: var(--indent, 0px);
}

.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.input {
  width: 100%;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: white;
  outline: none;
}

.input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 137, 121, 0.16);
}

.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
  text-transform: uppercase;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.84rem;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  background: linear-gradient(140deg, #178945, #116332);
  box-shadow: 0 7px 16px rgba(18, 100, 55, 0.2);
}

.button-primary:hover {
  background: linear-gradient(140deg, #168847, #126437);
  box-shadow: 0 10px 20px rgba(18, 100, 55, 0.25);
}

.button-secondary,
.button-ghost {
  color: var(--text);
  background: white;
  border-color: var(--line-strong);
}

.button-secondary:hover,
.button-ghost:hover {
  background: var(--surface-soft);
}

.button-ghost {
  font-size: 0.8rem;
}

.button-batch {
  border-color: var(--line);
}

.button-danger {
  color: white;
  background: var(--red);
  border-color: var(--red);
}

.button-danger:hover {
  background: #9f382b;
}

.button-danger:disabled {
  color: var(--muted);
  background: #eef2f3;
  border-color: var(--line);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.side-controls .button-ghost:first-child {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #b9ccff;
}

.side-controls .button-ghost:last-child {
  color: #965000;
  background: var(--orange-soft);
  border-color: #ffd08a;
}

.table-actions .button-secondary:nth-child(1) {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b8e5c4;
}

.table-actions .button-secondary:nth-child(2) {
  color: var(--violet);
  background: var(--violet-soft);
  border-color: #d2c2ff;
}

.table-actions .button-secondary:nth-child(3) {
  color: var(--orange);
  background: var(--orange-soft);
  border-color: #ffd08a;
}

.table-actions .batch-launch-quantity {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #b9ccff;
}

.table-actions .batch-launch-replace {
  color: var(--violet);
  background: var(--violet-soft);
  border-color: #d2c2ff;
}

.table-actions .batch-launch-add {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b8e5c4;
}

.full {
  width: 100%;
}

.link-button,
.code-button,
.quick-questions button {
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.code-button {
  font-family: "Cascadia Mono", Consolas, monospace;
  text-align: left;
}

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

.smart-search-card,
.product-section-title {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.smart-search-card {
  padding: 12px;
  color: var(--muted);
}

.smart-search-card strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.smart-search-card span {
  display: block;
  line-height: 1.35;
}

.smart-search-card.is-waiting {
  border-color: #f3b86b;
  background: #fff7e8;
}

.smart-search-card.is-loading {
  border-color: #8db3ff;
  background: #eef4ff;
}

.smart-search-card.is-error {
  border-color: #f0a29a;
  background: #fff1ef;
}

.smart-progress {
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(184, 111, 22, 0.18);
}

.smart-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--blue));
  transition: width 180ms ease;
}

.product-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-section-title strong {
  color: var(--blue);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.product-row {
  width: 100%;
  padding: 12px;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.product-row:hover,
.product-row.is-active {
  border-color: var(--green);
  background: var(--green-soft);
}

.product-row strong {
  display: block;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.84rem;
}

.product-row span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.3;
}

.product-row small {
  display: block;
  margin-top: 8px;
  color: var(--muted-strong);
  font-weight: 800;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.selected-box {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.selected-head {
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 800;
}

.selected-list {
  display: grid;
  gap: 8px;
  max-height: 150px;
  overflow: auto;
}

.selected-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.selected-chip strong,
.selected-chip small,
.selected-chip em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-chip strong {
  color: var(--teal-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.8rem;
}

.selected-chip small,
.selected-chip em,
.selected-empty {
  color: var(--muted);
  font-size: 0.75rem;
}

.selected-chip em {
  margin-top: 2px;
  font-style: normal;
  font-weight: 800;
}

.selected-chip button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  cursor: pointer;
}

.replace-summary {
  display: grid;
  gap: 8px;
}

.replace-summary:empty {
  display: none;
}

.replace-summary > span {
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.replace-summary > div,
.replacement-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.replace-summary > div {
  grid-template-columns: 1fr;
  background: var(--blue-soft);
  border-color: #b9ccff;
}

.replace-summary strong,
.replace-summary small,
.replacement-chip strong,
.replacement-chip small,
.replacement-chip em {
  display: block;
}

.replace-summary strong,
.replacement-chip strong {
  color: var(--teal-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.replace-summary small,
.replacement-chip small,
.replacement-chip em {
  color: var(--muted);
  line-height: 1.3;
}

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

.replacement-chip {
  background: var(--green-soft);
  border-color: #b8e5c4;
}

.replacement-chip.is-missing {
  background: #fff4f2;
  border-color: #efb2a8;
}

.replacement-chip em {
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.replacement-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #52627b;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  cursor: pointer;
}

.replacement-chip button:hover {
  color: #b33f34;
  border-color: #efb2a8;
  background: #fff4f2;
}

.replacement-chip button svg {
  width: 16px;
  height: 16px;
}

.replace-manual-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 12px;
  border: 1px solid #cfd9eb;
  border-radius: 8px;
  background: #f7f9fd;
  cursor: pointer;
}

.replace-manual-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #4f46e5;
}

.replace-manual-toggle span {
  display: grid;
  gap: 2px;
}

.replace-manual-toggle strong {
  color: #17233e;
  font-size: .82rem;
}

.replace-manual-toggle small {
  color: #67738b;
  font-size: .72rem;
}

.replace-quantity-toggle {
  margin-top: 12px;
  margin-bottom: 0;
}

.replace-quantity-toggle.is-active {
  border-color: #8fb3ff;
  background: #edf4ff;
  box-shadow: inset 3px 0 0 #3478f6;
}

.replace-batch-quantity-fields {
  display: grid;
  gap: 6px;
  padding: 12px;
  margin-top: 8px;
  border: 1px solid #c9d9fb;
  border-radius: 8px;
  background: #f7faff;
}

.replace-batch-quantity-fields.hidden {
  display: none;
}

.replace-manual-fields {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid #f2c879;
  border-radius: 8px;
  background: #fffaf0;
}

.replace-manual-grid {
  display: grid;
  grid-template-columns: minmax(90px, .45fr) minmax(180px, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.replacement-chip.is-manual {
  border-color: #efbd5f;
  background: #fff7e7;
}

.replacement-chip.is-manual strong {
  color: #9a5800;
}

@media (max-width: 720px) {
  .replace-manual-grid {
    grid-template-columns: 1fr;
  }
}

.delete-warning {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #efb2a8;
  border-radius: 8px;
  background: #fff4f2;
}

.delete-warning strong {
  color: var(--red);
}

.delete-warning span {
  color: var(--muted-strong);
  line-height: 1.35;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px;
  background: #f7f9f9;
  border-bottom: 1px solid var(--line);
}

.segment {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: var(--muted-strong);
  font-weight: 800;
}

.segment.is-active {
  color: var(--blue-dark);
  background: white;
  border-color: #b9ccff;
  box-shadow: inset 0 -3px 0 var(--blue);
}

.batch-form {
  display: none;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.batch-form.is-active {
  display: grid;
  gap: 10px;
}

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

.item-lookup-card {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #9ad3cb;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--text);
}

.item-lookup-card.compact {
  padding: 8px 10px;
}

.item-lookup-card.is-empty {
  border-color: var(--line);
  background: #fbfcfc;
}

.item-lookup-card.is-missing {
  border-color: #efb2a8;
  background: #fff4f2;
}

.item-lookup-card span {
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.item-lookup-card strong {
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.25;
}

.item-lookup-card small,
.item-lookup-card em {
  color: var(--muted);
  line-height: 1.3;
}

.item-lookup-card small {
  font-size: 0.76rem;
}

.item-lookup-card em {
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 800;
}

.item-suggestions {
  display: grid;
  gap: 6px;
  margin-top: 5px;
}

.item-suggestions button {
  display: grid;
  gap: 2px;
  padding: 8px;
  text-align: left;
  border: 1px solid #b8d8d3;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.item-suggestions button:hover {
  border-color: var(--teal);
  background: #f4fffc;
}

.item-suggestions small,
.item-suggestions em {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.target-box {
  padding: 14px;
}

.target-actions {
  justify-content: space-between;
  margin-bottom: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.target-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}

.target-row,
.target-note,
.occurrence-row,
.occurrence-group,
.occurrence-summary {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.target-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.target-row strong {
  display: block;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.8rem;
}

.target-row span,
.target-note,
.occurrence-summary {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.occurrence-summary {
  background: var(--teal-soft);
  border-color: #9ad3cb;
  color: var(--teal-dark);
  font-weight: 800;
}

.occurrence-group {
  display: grid;
  gap: 8px;
  background: white;
}

.occurrence-group-title {
  display: grid;
  gap: 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid #edf1f2;
}

.occurrence-group-title small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.occurrence-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 104px;
  gap: 8px;
  align-items: start;
  background: #fbfcfc;
}

.occurrence-row input {
  margin-top: 2px;
  accent-color: var(--teal);
}

.occurrence-row strong,
.occurrence-row small,
.occurrence-row em {
  display: block;
}

.occurrence-row strong {
  color: var(--teal-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
}

.occurrence-row small {
  color: var(--muted-strong);
  margin-top: 2px;
  font-size: 0.75rem;
  line-height: 1.25;
}

.occurrence-row em {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.72rem;
  font-style: normal;
}

.occurrence-qty {
  display: grid;
  gap: 3px;
}

.occurrence-qty small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.occurrence-qty input {
  width: 100%;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 0.78rem;
}

.budget-total-note {
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 900;
}

.manual-line-note {
  padding: 10px 12px;
  border: 1px solid #ffd08a;
  border-radius: 8px;
  color: #8a4b00;
  background: var(--orange-soft);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.lina-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 8px 14px 8px 8px;
  border: 1px solid #9ad3cb;
  border-radius: 999px;
  background: white;
  color: var(--text);
  box-shadow: 0 18px 44px rgba(23, 33, 38, 0.2);
  cursor: pointer;
  font-weight: 800;
}

.lina-launcher img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 50%;
}

.lina-launcher.is-hidden {
  display: none;
}

.lina-chat.hidden {
  display: none;
}

.lina-chat {
  z-index: 220;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 23;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(23, 33, 38, 0.24);
}

.lina-chat-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 36px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfb 100%);
}

.lina-chat-head img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 50%;
}

.lina-chat-head h3 {
  font-size: 1.15rem;
}

.lina-chat-head span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 0.78rem;
  font-weight: 800;
}

.chat-messages {
  height: auto;
  min-height: 170px;
  flex: 1 1 280px;
  padding: 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8faf9;
}

.message {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.38;
  font-size: 0.88rem;
}

.message-text {
  white-space: pre-line;
}

.message.lina {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--line);
}

.message.user {
  align-self: flex-end;
  color: white;
  background: var(--teal);
}

.lina-action-list,
.lina-suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.lina-action-list button,
.lina-suggestion-list button {
  border-radius: 999px;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 7px 9px;
}

.lina-action-list button {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #b9ccff;
}

.lina-suggestion-list button {
  color: var(--teal-dark);
  background: #fff;
}

.quick-questions {
  display: flex;
  gap: 8px;
  padding: 10px 14px 0;
  flex-wrap: wrap;
  background: white;
  max-height: 172px;
  overflow-y: auto;
}

.lina-launcher { z-index: 210; }

.quick-questions button {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 0.75rem;
}

.quick-questions button:nth-child(1),
.quick-questions button:nth-child(4) {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #b9ccff;
}

.quick-questions button:nth-child(2),
.quick-questions button:nth-child(5) {
  color: var(--violet);
  background: var(--violet-soft);
  border-color: #d2c2ff;
}

.quick-questions button:nth-child(3) {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b8e5c4;
}

.quick-questions button:nth-child(n+13) {
  display: none;
}

.training-note {
  padding: 10px 14px;
  color: #965000;
  background: var(--orange-soft);
  border-bottom: 1px solid #ffd08a;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px;
  background: white;
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 40;
  display: none;
  max-width: 400px;
  padding: 12px 14px;
  color: white;
  background: var(--teal-dark);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.toast.is-visible {
  display: block;
}

.toast.is-error {
  background: var(--red);
}

.loading-overlay.hidden {
  display: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 38, 0.36);
  backdrop-filter: blur(4px);
}

.loading-card {
  width: min(440px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 26px 24px;
  text-align: center;
  border: 1px solid #bce1dc;
  border-radius: 8px;
  background: white;
  box-shadow: 0 28px 70px rgba(23, 33, 38, 0.26);
}

.loading-card strong {
  color: var(--text);
  font-size: 1rem;
}

.loading-card small {
  color: var(--muted);
  line-height: 1.35;
}

.loading-spinner {
  width: 46px;
  height: 46px;
  border: 4px solid var(--blue-soft);
  border-top-color: var(--teal);
  border-right-color: var(--amber);
  border-radius: 50%;
  animation: lina-spin 900ms linear infinite;
}

@keyframes lina-spin {
  to {
    transform: rotate(360deg);
  }
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 33, 38, 0.45);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 8px;
  box-shadow: 0 26px 60px rgba(23, 33, 38, 0.24);
}

.batch-modal-panel {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(23, 33, 38, 0.28);
}

.sap-modal-panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(23, 33, 38, 0.28);
}

.structure-preview-panel {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(23, 33, 38, 0.28);
}

.structure-preview-body {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.structure-preview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
  gap: 14px;
  align-items: stretch;
}

.structure-preview-head > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.structure-preview-head .code {
  display: block;
  color: var(--teal-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-weight: 900;
}

.structure-preview-head strong {
  display: block;
  margin-top: 4px;
}

.structure-preview-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.structure-preview-stats span {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: white;
}

.structure-preview-stats small,
.preview-item small,
.preview-item em {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.structure-preview-stats small {
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.structure-preview-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.structure-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 12px;
  background: #eef5f7;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.structure-preview-table td {
  padding: 11px 12px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.structure-preview-table .parent-row td {
  background: #f7fbfa;
}

.structure-preview-table .parent-row .preview-item > strong {
  color: var(--teal-dark);
  font-weight: 950;
}

.preview-item > strong {
  margin-right: 8px;
  font-family: "Cascadia Mono", Consolas, monospace;
}

.preview-item em {
  font-style: normal;
  font-size: 0.72rem;
}

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

.sap-summary > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.sap-summary span,
.sap-summary small {
  display: block;
  color: var(--muted);
  line-height: 1.3;
}

.sap-summary span {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sap-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 1.05rem;
}

.sap-warning {
  padding: 12px;
  border: 1px solid #ffd08a;
  border-radius: 8px;
  color: #965000;
  background: var(--orange-soft);
  font-weight: 800;
  line-height: 1.35;
}

.sap-lines {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.sap-line {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.sap-line strong {
  color: var(--teal-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.sap-line span,
.sap-line em {
  color: var(--muted);
  line-height: 1.3;
}

.sap-line em {
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 800;
}

.batch-modal-panel .modal-header {
  flex: 0 0 auto;
}

.batch-modal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.batch-modal-head-actions span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.78rem;
  font-weight: 900;
}

.batch-modal-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.batch-modal-body .selected-box {
  border-bottom: 1px solid var(--line);
}

.batch-modal-body .selected-list {
  max-height: 116px;
}

.batch-modal-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  overflow: hidden;
}

.batch-form-column {
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #fbfcfc;
  overflow: auto;
}

.batch-modal-grid .segmented {
  position: sticky;
  top: 0;
  z-index: 2;
}

.batch-modal-grid .batch-form {
  border-bottom: 0;
}

.batch-modal-grid .target-box {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px;
  overflow: hidden;
}

.batch-modal-grid .target-list {
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.modal-header,
.modal-footer {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-body {
  padding: 16px;
  overflow: auto;
  display: grid;
  gap: 12px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.component-editor-head {
  justify-content: space-between;
  margin-top: 8px;
  font-weight: 800;
}

.create-rows {
  display: grid;
  gap: 8px;
}

.create-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) 90px 36px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.create-structure-panel {
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.create-structure-body {
  background: #f6f8fc;
  gap: 16px;
}

.create-structure-intro,
.create-config-section,
.create-empty-rows {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.create-structure-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: #233557;
}

.create-structure-intro > svg {
  width: 24px;
  height: 24px;
  color: #386ff0;
}

.create-structure-intro div,
.create-choice-grid button span,
.create-lines-head > div,
.manual-line-processing div,
.pervasive-partial-warning div {
  display: grid;
  gap: 3px;
}

.create-structure-intro span,
.create-choice-grid small,
.create-lines-head small,
.manual-line-processing small,
.pervasive-partial-warning span {
  color: var(--muted);
}

.create-config-section {
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.create-choice-grid > button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.create-choice-grid > button.is-active {
  border-color: #7c9fff;
  background: #eef4ff;
  color: #2559d8;
  box-shadow: inset 0 0 0 1px #b9cbff;
}

.create-source-fields {
  display: grid;
  gap: 8px;
}

.create-lines-head,
.create-line-adder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.create-line-adder .compact-select {
  width: 132px;
}

.create-empty-rows {
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

.create-row {
  grid-template-columns: 112px minmax(190px, 1fr) minmax(240px, 1.3fr) 90px 36px;
  align-items: center;
  background: #fff;
}

.create-row:has(.create-text-field) {
  grid-template-columns: 112px minmax(0, 1fr) 36px;
}

.create-line-type {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  color: #31577c;
}

.create-line-type.is-resource { color: #8159d7; }
.create-line-type.is-text { color: #b06b10; }

.manual-line-processing,
.save-budget-processing,
.batch-processing,
.delete-components-processing,
.pervasive-partial-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #b8d4ff;
  border-radius: 8px;
  background: #eef5ff;
  color: #173b78;
}

.manual-line-processing {
  flex: 1;
  margin-right: auto;
}

.manual-line-processing.hidden,
.save-budget-processing.hidden,
.batch-processing.hidden,
.delete-components-processing.hidden {
  display: none;
}

.save-budget-processing {
  flex: 1;
  gap: 10px;
  min-width: 280px;
  margin-right: auto;
}

.save-budget-processing > div {
  display: grid;
  gap: 2px;
}

.save-budget-processing strong {
  font-size: 0.82rem;
}

.save-budget-processing small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.batch-processing,
.delete-components-processing {
  gap: 10px;
}

.batch-processing > div,
.delete-components-processing > div {
  display: grid;
  gap: 2px;
}

.batch-processing strong,
.delete-components-processing strong {
  font-size: 0.82rem;
}

.batch-processing small,
.delete-components-processing small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.batch-modal-panel.is-updating .selected-box,
.batch-modal-panel.is-updating .segmented,
.batch-modal-panel.is-updating .target-box,
.batch-modal-panel.is-deleting .selected-box,
.batch-modal-panel.is-deleting .segmented,
.batch-modal-panel.is-deleting .target-box,
.batch-modal-panel.is-deleting #deleteForm .delete-warning {
  opacity: .58;
  pointer-events: none;
  user-select: none;
}

.batch-modal-panel.is-updating,
.batch-modal-panel.is-deleting,
.save-budget-panel.is-submitting,
.modal.is-submitting > .modal-backdrop {
  cursor: progress;
}

.batch-modal-panel.is-updating .button:disabled,
.batch-modal-panel.is-updating .icon-button:disabled,
.batch-modal-panel.is-updating .link-button:disabled,
.batch-modal-panel.is-deleting .button:disabled,
.batch-modal-panel.is-deleting .icon-button:disabled,
.batch-modal-panel.is-deleting .link-button:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: .72;
}

.save-budget-panel.is-submitting .modal-body {
  opacity: .62;
  pointer-events: none;
  user-select: none;
}

.save-budget-panel .button:disabled,
.save-budget-panel .icon-button:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: .7;
}

.lina-processing-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  justify-content: center;
}

.lina-processing-mark i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #386ff0;
  animation: lina-processing-pulse 1.1s ease-in-out infinite;
}

.lina-processing-mark i:nth-child(2) { animation-delay: .16s; }
.lina-processing-mark i:nth-child(3) { animation-delay: .32s; }

.button-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lina-spin .75s linear infinite;
}

#manualLineForm.is-submitting .modal-body {
  opacity: .68;
  pointer-events: none;
}

.pervasive-partial-warning {
  margin-bottom: 14px;
  border-color: #f0ce89;
  background: #fff8e8;
  color: #714b0a;
}

@keyframes lina-processing-pulse {
  0%, 100% { transform: translateY(0); opacity: .35; }
  50% { transform: translateY(-5px); opacity: 1; }
}

@keyframes lina-spin { to { transform: rotate(360deg); } }

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1400px) {
  .work-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .bom-table {
    min-width: 0;
  }

  .bom-table th:nth-child(4),
  .bom-table td:nth-child(4) {
    width: 54px;
  }

  .bom-table th:nth-child(5),
  .bom-table td:nth-child(5) {
    width: 46px;
  }

  .bom-table th:nth-child(6),
  .bom-table td:nth-child(6),
  .bom-table th:nth-child(7),
  .bom-table td:nth-child(7),
  .bom-table th:nth-child(8),
  .bom-table td:nth-child(8),
  .bom-table th:nth-child(9),
  .bom-table td:nth-child(9) {
    width: 74px;
    font-size: 0.78rem;
  }

  .bom-table th:nth-child(7),
  .bom-table td:nth-child(7),
  .bom-table th:nth-child(9),
  .bom-table td:nth-child(9) {
    width: 96px;
  }

  .bom-table th:nth-child(1),
  .bom-table td:nth-child(1) {
    width: 86px;
  }

  .bom-table th:nth-child(2),
  .bom-table td:nth-child(2) {
    width: 72px;
  }

  .bom-table th:nth-child(3),
  .bom-table td:nth-child(3) {
    width: auto;
  }

  .line-meta {
    display: block;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .app-shell.is-sidebar-collapsed {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .work-grid {
    grid-template-columns: 1fr;
  }

  .right-rail {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .dashboard-row {
    grid-template-columns: 1fr 1fr;
  }

  .sap-summary {
    grid-template-columns: 1fr;
  }

  .structure-preview-head {
    grid-template-columns: 1fr;
  }

  .batch-modal-grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .batch-form-column {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .batch-modal-grid .target-list {
    max-height: 360px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.is-sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .app-shell.is-sidebar-collapsed .sidebar {
    padding: 14px;
  }

  .app-shell.is-sidebar-collapsed .brand {
    flex-direction: row;
  }

  .app-shell.is-sidebar-collapsed .brand-copy,
  .app-shell.is-sidebar-collapsed .sidebar-context,
  .app-shell.is-sidebar-collapsed .module-label {
    display: block;
  }

  .app-shell.is-sidebar-collapsed .module-link {
    grid-template-columns: 30px minmax(0, 1fr);
    justify-items: stretch;
    padding: 7px 10px;
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .structure-title,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .summary-strip,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-row {
    grid-template-columns: 1fr;
  }

  .batch-modal-panel {
    max-height: calc(100vh - 20px);
  }

  .structure-preview-panel {
    max-height: calc(100vh - 20px);
  }

  .structure-preview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .batch-modal-head-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
  }

  .batch-modal-body .selected-list {
    max-height: 150px;
  }

  .create-row {
    grid-template-columns: 1fr;
  }

  .lina-launcher span {
    display: none;
  }
}


@media (max-width: 900px) {
  .create-choice-grid,
  .create-row,
  .create-row:has(.create-text-field) {
    grid-template-columns: 1fr;
  }

  .create-lines-head,
  .create-line-adder,
  .modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .manual-line-processing,
  .save-budget-processing {
    width: 100%;
  }
}

/* AI-Inspired Loading Screen Styles */
.ai-loading-card {
  padding: 42px 36px;
  text-align: center;
  max-width: 660px;
  margin: 36px auto;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 20px 45px rgba(18, 100, 55, 0.08);
  border: 1px solid rgba(18, 100, 55, 0.15);
  position: relative;
  overflow: hidden;
}

.ai-loading-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #126437, #6c5ce7, #126437);
  background-size: 200% 100%;
  animation: aiGradientMove 2.5s infinite linear;
}

@keyframes aiGradientMove {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.ai-loading-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.ai-sparkle-badge {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, #e7f7ed 0%, #f4f2ff 100%);
  display: grid;
  place-items: center;
  color: #126437;
  box-shadow: 0 8px 20px rgba(18, 100, 55, 0.12);
}

.ai-sparkle-icon {
  color: #126437;
  animation: pulseSparkle 1.8s ease-in-out infinite alternate;
}

@keyframes pulseSparkle {
  0% { transform: scale(0.92); opacity: 0.8; }
  100% { transform: scale(1.12); opacity: 1; filter: drop-shadow(0 0 8px rgba(18, 100, 55, 0.4)); }
}

.ai-loading-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  color: #131b2c;
  letter-spacing: -0.3px;
}

.ai-loading-header p {
  margin: 6px 0 0;
  font-size: 14px;
  color: #6c768b;
}

.ai-loading-animation {
  width: 100%;
  height: 6px;
  background: #eef1f6;
  border-radius: 3px;
  overflow: hidden;
  margin: 22px 0 28px;
}

.ai-progress-pulse {
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, #126437, #6c5ce7);
  border-radius: 3px;
  animation: aiSlidePulse 1.8s infinite ease-in-out;
}

@keyframes aiSlidePulse {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.ai-loading-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  background: #f9fafd;
  padding: 18px 22px;
  border-radius: 14px;
  border: 1px solid #eef1f6;
}

.ai-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #4a5568;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #126437;
  box-shadow: 0 0 0 3px rgba(18, 100, 55, 0.2);
  animation: dotBlink 1.4s infinite alternate;
}

@keyframes dotBlink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Loading Moderno da LINA */
.loading-overlay-modern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.loading-overlay-modern.hidden {
  display: none;
  opacity: 0;
}

.loading-content-modern {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  padding: 3rem 4rem;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  animation: fadeIn 0.4s ease-out;
}

.lina-avatar-pulse {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lina-avatar-pulse img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(18, 100, 55, 0.3);
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #126437;
  opacity: 0;
  animation: pulseRing 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.pulse-ring.delay {
  animation-delay: 0.75s;
}

.loading-text-modern {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a202c;
  background: linear-gradient(90deg, #126437, #2d3748, #126437);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: gradientText 2s linear infinite;
  text-align: center;
  min-width: 250px;
}

@keyframes pulseRing {
  0% { transform: scale(0.8); opacity: 0.8; border-width: 2px; }
  100% { transform: scale(1.6); opacity: 0; border-width: 0px; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gradientText {
  to { background-position: 200% center; }
}

/* Visual refresh 2026-08: workspace moderno, denso e orientado a orçamento. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --line: #e4e8f1;
  --text: #172033;
  --muted: #697386;
  --teal: #0f8a70;
  --teal-dark: #0a6b58;
  --blue: #3478f6;
  --violet: #7c4dff;
  --green: #17a668;
  --orange: #f59e0b;
  --rose: #ec4c78;
  --sidebar: #0c1837;
  --sidebar-soft: #152447;
  --shadow: 0 8px 24px rgba(26, 38, 68, 0.07);
}

body {
  background: var(--bg);
}

.app-shell {
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 16px;
  background: var(--sidebar);
  border-right: 0;
  color: #dbe4ff;
  scrollbar-color: #425276 transparent;
}

.brand {
  padding: 0 4px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand h1 {
  color: #ffffff;
  font-size: 1.02rem;
}

.brand-mark {
  background: linear-gradient(145deg, #6d5dfc, #3478f6);
  box-shadow: 0 8px 20px rgba(52, 120, 246, 0.34);
}

.sidebar-toggle {
  color: #dbe4ff;
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}

.sidebar-toggle span {
  background: #dbe4ff;
}

.source-badge {
  color: #cfe1ff;
  background: rgba(52, 120, 246, 0.18);
  border: 1px solid rgba(105, 159, 255, 0.24);
}

.module-nav {
  gap: 7px;
}

.module-link {
  min-height: 48px;
  color: #aebbd8;
  border: 1px solid transparent;
}

.module-link:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.06);
}

.module-link.is-active {
  color: #ffffff;
  background: linear-gradient(100deg, #7957f6, #e84d8a);
  box-shadow: 0 8px 20px rgba(90, 65, 214, 0.28);
}

.module-icon {
  color: #d8e1fa;
  background: rgba(255,255,255,0.08);
}

.module-link:nth-child(2) .module-icon {
  color: #c7b4ff;
}

.module-link:nth-child(3) .module-icon {
  color: #84e8b7;
}

.sidebar-context {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  min-height: auto;
}

.sidebar .field-label {
  color: #9eacca;
}

.sidebar .input {
  color: #ffffff;
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.15);
}

.sidebar .input::placeholder {
  color: #8290ad;
}

.sidebar .input:focus {
  border-color: #6595ff;
  box-shadow: 0 0 0 3px rgba(52,120,246,0.18);
}

.side-controls .button {
  min-height: 44px;
  color: #eef3ff;
  background: var(--sidebar-soft);
  border-color: #334469;
}

.side-controls .button:first-child {
  color: #ffffff;
  background: #1e376c;
  border-color: #4163a3;
}

.side-controls .button:last-child {
  color: #fff1cf;
  background: #5d421b;
  border-color: #805d29;
}

.product-list {
  padding-right: 3px;
}

.product-row,
.sap-product-result {
  color: #cbd6ed;
  background: rgba(255,255,255,0.045);
  border-color: rgba(255,255,255,0.1);
}

.product-row:hover,
.sap-product-result:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  border-color: rgba(111,157,255,0.45);
}

.product-row.is-active {
  color: #ffffff;
  background: linear-gradient(145deg, rgba(52,120,246,0.32), rgba(124,77,255,0.22));
  border-color: #628eea;
  box-shadow: inset 3px 0 0 #79a1ff;
}

.product-row strong,
.sap-product-result strong {
  color: #ffffff;
}

.sidebar .product-row span,
.sidebar .product-row small,
.sidebar .sap-product-result span,
.sidebar .sap-product-result small {
  color: #aebbd8;
}

.sidebar .product-row.is-active span,
.sidebar .product-row.is-active small {
  color: #e6edff;
}

.smart-search-card {
  color: #cbd6ed;
  background: var(--sidebar-soft);
  border-color: #334469;
}

.workspace {
  padding: 0 22px 28px;
}

.topbar {
  min-height: 76px;
  margin: 0 -22px 18px;
  padding: 14px 22px;
  background: rgba(255,255,255,0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
}

.topbar h2 {
  font-size: 1.5rem;
  white-space: nowrap;
}

.topbar-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 8px 11px;
  color: #406052;
  background: #effaf4;
  border: 1px solid #ccebd9;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 750;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #19a866;
  box-shadow: 0 0 0 4px rgba(25,168,102,0.12);
}

.button {
  border-radius: 7px;
  font-weight: 750;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: #4f46e5;
  border-color: #4f46e5;
  box-shadow: 0 5px 12px rgba(79,70,229,0.2);
}

.metrics {
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 12px;
}

.metric,
.metric:nth-child(n) {
  min-height: 104px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(31,45,78,0.035);
}

.metric-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 850;
}

.metric-blue .metric-icon { background: #3478f6; }
.metric-violet .metric-icon { background: #7c4dff; }
.metric-green .metric-icon { background: #17a668; }
.metric-orange .metric-icon { background: #f59e0b; }
.metric-rose .metric-icon { background: #ec4c78; }
.metric-teal .metric-icon { background: #0f8a70; }

.metric > div > span {
  font-size: 0.68rem;
}

.metric strong {
  margin-top: 5px;
  font-size: 1.22rem;
}

.metric small {
  display: block;
  margin-top: 4px;
  color: #98a0af;
  font-size: 0.67rem;
}

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

.structure-title {
  padding: 20px 22px 12px;
}

.structure-title h3 {
  max-width: 920px;
  font-size: 1.35rem;
}

.summary-strip {
  padding: 0 22px 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.simulation-note {
  grid-column: 1 / -1;
  padding: 10px 12px;
  color: #36547d;
  background: #edf4ff;
  border: 1px solid #ccdcfa;
  border-radius: 7px;
  font-size: 0.78rem;
}

.structure-details {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
}

.structure-details > span,
.structure-details > label,
.summary-item {
  min-height: 72px;
  padding: 11px 12px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.summary-item {
  position: relative;
  overflow: hidden;
}

.summary-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #c8cfdb;
}

.summary-blue::before { background: var(--blue); }
.summary-violet::before { background: var(--violet); }
.summary-green::before { background: var(--green); }
.summary-orange::before { background: var(--orange); }
.summary-rose::before { background: var(--rose); }

.summary-item span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.summary-item em {
  color: #5474aa;
  font-size: 0.58rem;
  font-style: normal;
}

.summary-item strong {
  font-size: 1.02rem;
}

.table-toolbar {
  padding: 14px 18px;
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.table-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bom-table thead th {
  color: #59657a;
  background: #f1f4f9;
  border-bottom: 1px solid #dce2ec;
}

.bom-table tbody tr {
  transition: background 130ms ease, box-shadow 130ms ease;
}

.bom-table tbody tr:hover {
  background: #f8faff;
}

.bom-table tbody tr.parent-row {
  background: #fbfdff;
}

.bom-table tbody tr.parent-row .description {
  color: #202b3e;
  font-weight: 750;
}

.bom-table tbody tr.selected-row {
  background: #eef4ff;
  box-shadow: inset 3px 0 0 #3478f6;
}

@media (max-width: 1400px) {
  .bom-table {
    min-width: 1430px;
  }
}

.bom-table th:nth-child(1), .bom-table td:nth-child(1) { width: 92px; }
.bom-table th:nth-child(2), .bom-table td:nth-child(2) { width: 80px; }
.bom-table th:nth-child(3), .bom-table td:nth-child(3) { width: 330px; }
.bom-table th:nth-child(4), .bom-table td:nth-child(4) { width: 72px; }
.bom-table th:nth-child(5), .bom-table td:nth-child(5) { width: 64px; }
.bom-table th:nth-child(6), .bom-table td:nth-child(6) { width: 110px; }
.bom-table th:nth-child(7), .bom-table td:nth-child(7) { width: 170px; }
.bom-table th:nth-child(8), .bom-table td:nth-child(8) { width: 110px; }
.bom-table th:nth-child(9), .bom-table td:nth-child(9) { width: 105px; }
.bom-table th:nth-child(10), .bom-table td:nth-child(10) { width: 72px; }
.bom-table th:nth-child(11), .bom-table td:nth-child(11) { width: 125px; }

.bom-table .item-main,
.bom-table .description,
.bom-table .line-meta {
  overflow-wrap: anywhere;
}

.structure-badge {
  color: #5e47d5;
  background: #eeeaff;
  border-color: #d7ceff;
}

.sap-value,
.row-total {
  color: #26344d;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-total {
  color: #0b735e;
}

.loading-overlay-modern {
  background: rgba(9, 18, 42, 0.68);
  backdrop-filter: blur(9px);
}

.loading-content-modern {
  width: min(620px, calc(100vw - 32px));
  padding: 30px 34px 26px;
  gap: 18px;
  color: #eef3ff;
  background: #101d40;
  border: 1px solid rgba(139,168,255,0.26);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(2,8,24,0.42);
}

.lina-orbit {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
}

.lina-orbit img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  z-index: 3;
  box-shadow: 0 0 0 5px rgba(80,106,219,0.18), 0 10px 24px rgba(0,0,0,0.26);
}

.orbit {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(118,148,255,0.46);
  border-radius: 50%;
  animation: linaOrbit 3.2s linear infinite;
}

.orbit-two {
  inset: 17px;
  border-color: rgba(236,76,120,0.48);
  animation-direction: reverse;
  animation-duration: 2.4s;
}

.data-node {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #65a1ff;
  box-shadow: 0 0 13px #65a1ff;
  z-index: 2;
}

.node-one { top: 8px; left: 48px; }
.node-two { right: 10px; bottom: 26px; background: #ec4c78; box-shadow: 0 0 13px #ec4c78; }
.node-three { left: 13px; bottom: 24px; background: #39d98a; box-shadow: 0 0 13px #39d98a; }

.loading-copy {
  text-align: center;
}

.ai-kicker {
  color: #8fb4ff;
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.loading-copy h2 {
  max-width: 500px;
  margin: 7px 0 5px;
  color: #ffffff;
  font-size: 1.18rem;
  line-height: 1.35;
}

.loading-copy p {
  margin: 0;
  color: #aebbd8;
  font-size: 0.8rem;
}

.loading-flow {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.loading-flow span {
  padding: 9px 8px;
  color: #7888aa;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  font-size: 0.68rem;
  text-align: center;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.loading-flow span.is-active {
  color: #ffffff;
  background: rgba(52,120,246,0.16);
  border-color: rgba(101,151,255,0.48);
}

.ai-progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
}

.ai-progress-track span {
  display: block;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg, #3478f6, #7c4dff, #ec4c78);
  animation: aiTrack 1.6s ease-in-out infinite;
}

@keyframes linaOrbit {
  to { transform: rotate(360deg); }
}

@keyframes aiTrack {
  from { transform: translateX(-120%); }
  to { transform: translateX(330%); }
}

@media (max-width: 1500px) {
  .metrics { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .structure-details { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}

@media (max-width: 1350px) {
  .topbar-live { display: none; }
  .lina-launcher {
    width: 62px;
    height: 62px;
    padding: 5px;
  }
  .lina-launcher span { display: none; }
}

/* 2026-08-07: LINA independente, conversacional e alinhada ao produto */
.lina-chat {
  width: min(500px, calc(100vw - 28px));
  border: 1px solid #cfd8e8;
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(10, 25, 57, 0.28);
}

.lina-chat-head {
  min-height: 72px;
  padding: 15px 18px;
  color: #ffffff;
  background: #142447;
  border-top: 0;
  border-bottom-color: #263b67;
}

.lina-chat-head h3,
.lina-chat-head span {
  color: #ffffff;
}

.lina-chat-head h3 {
  font-size: 1.16rem;
}

.lina-chat-head span {
  color: #b9c8e5;
  font-weight: 650;
}

.lina-chat-head .icon-button {
  color: #dfe8f8;
  background: #20345e;
  border-color: #405989;
}

.chat-messages {
  min-height: 220px;
  padding: 16px;
  gap: 12px;
  background: #f3f6fb;
}

.message {
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.message.lina {
  border-color: #d8e0ed;
  box-shadow: 0 4px 12px rgba(31, 53, 94, 0.06);
}

.message.user {
  background: #4f46e5;
}

.lina-action-list button,
.lina-suggestion-list button {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 6px;
  letter-spacing: 0;
}

.lina-action-list button {
  color: #274db4;
  background: #edf3ff;
  border-color: #bed0fa;
}

.lina-action-list.is-long {
  max-height: 230px;
  overflow-y: auto;
  align-content: flex-start;
  padding: 8px;
  border: 1px solid #d9e2f1;
  border-radius: 8px;
  background: #f8faff;
  scrollbar-width: thin;
}

.lina-action-list.is-long button {
  flex: 1 1 190px;
  justify-content: flex-start;
  text-align: left;
}

.lina-suggestion-list button {
  color: #166b5c;
  background: #f2fbf8;
  border-color: #bce2d8;
}

.quick-questions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 190px;
  padding: 10px 14px;
  border-top: 1px solid #e2e7f0;
  background: #ffffff;
}

.quick-questions button,
.quick-questions button:nth-child(n) {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  color: #31405a;
  background: #f8faff;
  border: 1px solid #dce3ef;
  border-radius: 6px;
  text-align: left;
  font-weight: 750;
  cursor: pointer;
}

.quick-questions button:hover {
  color: #263fa4;
  background: #eef3ff;
  border-color: #b9c9ef;
}

.quick-questions svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: #526ee1;
}

.chat-form {
  padding: 12px 14px 14px;
  border-top: 1px solid #e1e7f0;
  background: #ffffff;
}

.chat-form .input {
  border-color: #cfd8e8;
}

.chat-thinking {
  color: #334360;
  background: #edf3ff;
  border-color: #c8d6f2;
}

.chat-thinking-dots i {
  background: #4f65dd;
}

.product-no-structure,
.structure-empty-state {
  display: grid;
  gap: 7px;
  padding: 16px;
  color: #34445f;
  background: #fff9ed;
  border: 1px solid #f2d49a;
  border-radius: 8px;
}

.product-no-structure-icon,
.structure-empty-state > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #a46105;
  background: #ffedc8;
  border-radius: 7px;
}

.product-no-structure span,
.product-no-structure small,
.structure-empty-state p,
.structure-empty-state small {
  color: #6f7787;
  line-height: 1.4;
}

.structure-empty-state {
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: start;
  margin: 18px;
  padding: 22px;
}

.structure-empty-state div {
  display: grid;
  gap: 5px;
}

.structure-empty-state h3 {
  color: #17264a;
  font-size: 1.1rem;
}

@media (max-width: 560px) {
  .quick-questions { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .topbar-live { display: none; }
  .summary-strip { grid-template-columns: repeat(2, minmax(145px, 1fr)); }
  .structure-details { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 720px) {
  .workspace { padding: 0 10px 18px; }
  .topbar { margin-inline: -10px; padding-inline: 12px; }
  .metrics { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .summary-strip { padding-inline: 12px; }
  .loading-flow { grid-template-columns: 1fr; }
}

/* Keep the current LINA identity after legacy compatibility rules. */
.lina-chat-head {
  grid-template-columns: minmax(0, 1fr) 36px;
  color: #ffffff;
  background: #142447;
  border-top: 0;
  border-bottom-color: #263b67;
}

.lina-chat-head h3 { color: #ffffff; }
.lina-chat-head span { color: #b9c8e5; }

#productionVarianceModal { z-index: 290; }

.batch-analysis-page {
  min-height: 100%;
}

.batch-analysis-page .topbar > div:first-child > span {
  display: block;
  margin-top: 3px;
  color: #768198;
  font-size: 0.82rem;
}

.batch-analysis-workspace {
  min-height: calc(100vh - 128px);
  margin: 20px;
  overflow: visible;
}

.batch-analysis-toolbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 16px 20px;
  border-bottom: 1px solid #dfe6f1;
  background: #f7f9fd;
}

.batch-analysis-toolbar > label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.batch-analysis-toolbar > label > span {
  color: #64718a;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.batch-analysis-modes {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #ffffff;
}

.batch-analysis-modes button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 39px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  color: #5d6980;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.batch-analysis-modes button svg,
.batch-analysis-toolbar .button svg,
.batch-cause-button svg {
  width: 17px;
  height: 17px;
}

.batch-analysis-modes button.is-active {
  color: #ffffff;
  background: #4f46e5;
  box-shadow: 0 5px 12px rgba(79, 70, 229, 0.2);
}

.batch-project-search {
  position: relative;
}

.batch-project-search .dashboard-search-feedback {
  z-index: 30;
}

.batch-analysis-body {
  overflow: auto;
  min-height: 0;
  padding: 20px;
  background: #f3f6fb;
}

.batch-analysis-welcome,
.batch-analysis-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 360px;
  padding: 40px;
  text-align: left;
}

.batch-analysis-welcome > span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  color: #ffffff;
  border-radius: 8px;
  background: #4f46e5;
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.24);
}

.batch-analysis-welcome svg { width: 27px; height: 27px; }
.batch-analysis-welcome h4,
.batch-analysis-loading h4 { margin: 0 0 7px; color: #17223c; font-size: 1.25rem; }
.batch-analysis-welcome p,
.batch-analysis-loading p { max-width: 680px; margin: 0; color: #66728a; line-height: 1.55; }

.batch-analysis-loading {
  flex-direction: column;
  text-align: center;
}

.batch-analysis-loading > small {
  color: #507cf0;
  font-weight: 900;
  text-transform: uppercase;
}

.batch-analysis-loading-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
  width: min(900px, 100%);
  margin-top: 20px;
}

.batch-analysis-loading-steps span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 10px 12px;
  color: #8a95a9;
  border: 1px solid #dce4f1;
  border-radius: 7px;
  background: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
}

.batch-analysis-loading-steps span.is-active {
  color: #315dd0;
  border-color: #9fbcff;
  background: #edf3ff;
}

.batch-analysis-loading-steps svg { width: 17px; height: 17px; }
.batch-analysis-loading .budget-summary-loading-bar { width: min(900px, 100%); }
.batch-analysis-loading .budget-summary-loading-bar i { transition: width 450ms ease; }

.batch-analysis-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.batch-analysis-kpis > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid #dce4f0;
  border-top: 3px solid #4f79ed;
  border-radius: 7px;
  background: #ffffff;
}

.batch-analysis-kpis span,
.batch-analysis-measures span {
  display: block;
  color: #717d93;
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.batch-analysis-kpis strong {
  display: block;
  margin: 6px 0 3px;
  color: #18233d;
  font-size: 1.22rem;
}

.batch-analysis-kpis small,
.batch-analysis-measures small { color: #8994a8; font-size: 0.72rem; }

.batch-analysis-conversation {
  margin: 12px 0;
}

.batch-analysis-conversation small {
  display: block;
  margin-top: 8px;
  color: #53617b;
}

.batch-analysis-results {
  padding: 18px;
  border: 1px solid #dce4f0;
  border-radius: 8px;
  background: #ffffff;
}

.batch-analysis-item {
  display: grid;
  grid-template-columns: 40px minmax(190px, 0.9fr) minmax(0, 2.4fr);
  gap: 14px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid #e5eaf2;
}

.batch-analysis-rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #315dce;
  border-radius: 7px;
  background: #eaf1ff;
  font-weight: 900;
}

.batch-analysis-identity {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.batch-analysis-identity strong { color: #087866; font-family: var(--font-mono); }
.batch-analysis-identity span { color: #1e2942; font-size: 0.85rem; font-weight: 800; }
.batch-analysis-identity small { color: #7a869b; font-size: 0.72rem; }

.batch-analysis-measures {
  grid-column: 3;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.batch-analysis-measures > div {
  min-width: 0;
  padding: 10px;
  border-left: 2px solid #e0e6f1;
  background: #f9fafd;
}

.batch-analysis-measures strong {
  display: block;
  margin: 5px 0 3px;
  color: #1d2942;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.batch-analysis-measures strong.is-increase,
.batch-analysis-measures strong.is-negative { color: #c84c36; }
.batch-analysis-measures strong.is-decrease,
.batch-analysis-measures strong.is-positive { color: #148160; }

.batch-cause-button {
  grid-column: 3;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
}
.batch-cause-button svg { flex-shrink: 0; }
.batch-sales-product { justify-self: start; padding: 4px 7px; border-radius: 5px; color: #22548c; background: #e9f2ff; font-size: 0.67rem; }

.batch-analysis-item.has-error {
  grid-template-columns: 40px minmax(220px, 1fr) 2fr;
}

.batch-analysis-item-error {
  padding: 10px 12px;
  color: #a33d32;
  border: 1px solid #f2c4bd;
  border-radius: 7px;
  background: #fff1ef;
}

.batch-project-comparisons {
  grid-column: 3;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 7px;
}

.batch-project-comparisons > strong {
  grid-column: 1 / -1;
  color: #526079;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.batch-project-comparisons > div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid #dfe6f1;
  border-radius: 6px;
  background: #f8faff;
}

.batch-project-comparisons span { color: #1f2b46; font-weight: 850; }
.batch-project-comparisons small,
.batch-project-comparisons em { color: #78859a; font-size: 0.7rem; font-style: normal; }
.batch-project-comparisons b { color: #315dce; font-size: 0.74rem; }

@media (max-width: 1180px) {
  .batch-analysis-toolbar { grid-template-columns: 1fr 1fr; }
  .batch-analysis-kpis { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .batch-analysis-item { grid-template-columns: 40px minmax(0, 1fr); }
  .batch-analysis-measures,
  .batch-project-comparisons,
  .batch-cause-button { grid-column: 2; }
}

.project-sales-context { margin: 14px 0 20px; padding: 18px; border: 1px solid #d6e2f2; border-radius: 10px; background: #f8fbff; color: #203650; }
.project-sales-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.project-sales-context h3 { margin: 0; font-size: 14px; }
.project-sales-heading > span, .project-sales-context > p { color: #5d718d; font-size: 12px; }
.project-sales-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 10px; max-height: 330px; overflow-y: auto; }
.project-sale { min-width: 0; padding: 14px; border: 1px solid #dce6f3; border-left: 3px solid #4f75c7; border-radius: 7px; background: #fff; }
.project-sale > small { color: #5b6e88; font-size: 11px; }
.project-sale > strong { display: block; margin: 7px 0 4px; color: #24568b; font-size: 14px; overflow-wrap: anywhere; }
.project-sale > span { display: block; font-size: 12px; line-height: 1.5; }
.project-sale > div { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 12px; }
.project-sale > div > span { display: grid; gap: 3px; color: #60718a; font-size: 11px; }
.project-sale b { color: #203650; font-size: 12px; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .batch-analysis-workspace { margin: 10px; }
  .batch-analysis-toolbar,
  .batch-analysis-kpis { grid-template-columns: 1fr; }
  .batch-analysis-modes { display: grid; grid-template-columns: 1fr 1fr; }
  .batch-analysis-loading-steps,
  .batch-analysis-measures { grid-template-columns: 1fr; }
  .batch-analysis-body { padding: 12px; }
  .batch-analysis-measures,
  .batch-project-comparisons,
  .batch-cause-button { grid-column: 1 / -1; }
}

/* LINA inline analysis and structured answers. */
.lina-working-message {
  border-color: #c8d5ef;
  background: #f7f9fe;
}

.lina-inline-loading {
  display: grid;
  gap: 10px;
}

.lina-inline-loading-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lina-inline-loading-head div {
  display: grid;
  gap: 1px;
}

.lina-inline-loading-head small,
.lina-result-eyebrow {
  color: #52698f;
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.lina-inline-loading-head strong {
  color: #172a50;
  font-size: 0.8rem;
}

.lina-inline-pulse {
  position: relative;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 3px solid #536ee8;
  border-radius: 50%;
}

.lina-inline-pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid #8fa3e8;
  border-radius: 50%;
  animation: lina-inline-pulse 1.4s ease-out infinite;
}

.lina-inline-loading p {
  margin: 0;
  color: #44536d;
  font-size: 0.74rem;
}

.lina-inline-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.lina-inline-steps span {
  padding: 5px 4px;
  color: #758199;
  text-align: center;
  background: #e9edf5;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 800;
}

.lina-inline-steps span.is-active {
  color: #ffffff;
  background: #4561d5;
}

.lina-inline-progress {
  height: 4px;
  overflow: hidden;
  background: #dfe5f0;
  border-radius: 2px;
}

.lina-inline-progress i {
  display: block;
  width: 38%;
  height: 100%;
  background: #546ee8;
  animation: lina-inline-progress 1.25s ease-in-out infinite;
}

.lina-working-message.is-error {
  border-color: #efb8b2;
  background: #fff6f5;
}

.lina-working-message.is-error .lina-inline-pulse,
.lina-working-message.is-error .lina-inline-progress i {
  border-color: #c94a3d;
  background: #c94a3d;
  animation: none;
}

.lina-result {
  display: grid;
  gap: 10px;
}

.lina-result-head {
  display: grid;
  gap: 2px;
}

.lina-result-title {
  color: #142447;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.lina-result-subtitle {
  color: #59677f;
  font-size: 0.72rem;
  line-height: 1.4;
}

.lina-result-metrics {
  display: grid;
  gap: 6px;
}

.lina-result-metric {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  background: #f5f7fb;
  border-left: 3px solid #4c76df;
  border-radius: 4px;
}

.lina-result-metric span {
  color: #65738a;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
}

.lina-result-metric strong {
  color: #162440;
  font-size: 0.88rem;
}

.lina-result-metric small {
  color: #77839a;
  font-size: 0.62rem;
}

.lina-result-metric.tone-violet { border-left-color: #7655df; }
.lina-result-metric.tone-green { border-left-color: #1d9b72; }
.lina-result-metric.tone-navy { color: #ffffff; background: #172a50; border-left-color: #f4b43c; }
.lina-result-metric.tone-navy span,
.lina-result-metric.tone-navy strong,
.lina-result-metric.tone-navy small { color: #ffffff; }

.lina-result-rows {
  display: grid;
  gap: 0;
  border-top: 1px solid #e1e6ef;
}

.lina-result-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #e7ebf2;
}

.lina-result-rank {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #3159bd;
  background: #eaf0fd;
  border-radius: 5px;
  font-size: 0.64rem;
  font-weight: 850;
}

.lina-result-row div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.lina-result-row strong {
  color: #173b63;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.lina-result-row small {
  color: #68758c;
  font-size: 0.62rem;
  line-height: 1.35;
}

.lina-result-row b {
  color: #17233c;
  font-size: 0.68rem;
  white-space: nowrap;
}

.lina-result-note {
  padding: 8px 10px;
  color: #526077;
  background: #f0f4fa;
  border-radius: 4px;
  font-size: 0.67rem;
  line-height: 1.45;
}

@keyframes lina-inline-pulse {
  from { opacity: 0.85; transform: scale(0.7); }
  to { opacity: 0; transform: scale(1.35); }
}

@keyframes lina-inline-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(280%); }
}

/* On-demand intelligent budget summary. */
#budgetSummaryModal {
  z-index: 230;
}

.button-summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #ffffff;
  background: #172a50;
  border-color: #172a50;
}

.button-summary:hover {
  background: #213b6d;
  border-color: #213b6d;
}

.button-summary svg {
  width: 17px;
  height: 17px;
}

.budget-summary-panel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 40px));
  max-height: min(880px, calc(100vh - 40px));
  overflow: hidden;
  background: #f5f7fb;
  border: 1px solid #cfd9e8;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(12, 27, 57, 0.28);
}

.budget-summary-head {
  color: #ffffff;
  background: #142447;
  border-bottom-color: #2b416f;
}

.budget-summary-head h3,
.budget-summary-head .eyebrow {
  color: #ffffff;
}

.budget-summary-head > div > span {
  display: block;
  margin-top: 3px;
  color: #b9c8e5;
  font-size: 0.75rem;
}

.budget-summary-head .icon-button {
  color: #ffffff;
  background: #213966;
  border-color: #3a5588;
}

.budget-summary-head .icon-button svg {
  width: 18px;
  height: 18px;
}

.budget-summary-body {
  min-height: 460px;
  padding: 18px;
  overflow: auto;
}

.budget-summary-loading {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 16px 20px;
  width: min(720px, calc(100% - 32px));
  margin: 90px auto;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(26, 47, 87, 0.12);
}

.summary-intelligence-mark {
  position: relative;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  color: #ffffff;
  background: #172a50;
  border-radius: 50%;
}

.summary-intelligence-mark span {
  position: absolute;
  inset: -7px;
  border: 2px solid #536ee8;
  border-radius: 50%;
  animation: summary-intelligence-ring 1.8s ease-in-out infinite;
}

.summary-intelligence-mark b {
  font-size: 0.78rem;
  letter-spacing: 0;
}

.budget-summary-loading small {
  color: #4562a0;
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.budget-summary-loading h4 {
  margin: 3px 0 5px;
  color: #17233d;
  font-size: 1.05rem;
}

.budget-summary-loading p {
  margin: 0;
  color: #66738b;
  font-size: 0.76rem;
}

.budget-summary-loading-steps {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.budget-summary-loading-steps span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  color: #768299;
  background: #edf1f6;
  border-radius: 5px;
  font-size: 0.67rem;
  font-weight: 800;
}

.budget-summary-loading-steps span.is-active {
  color: #ffffff;
  background: #4561d5;
}

.budget-summary-loading-steps svg {
  width: 14px;
  height: 14px;
}

.budget-summary-loading-bar {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  background: #e2e7f0;
  border-radius: 3px;
}

.budget-summary-loading-bar i {
  display: block;
  width: 32%;
  height: 100%;
  background: #536ee8;
  animation: budget-summary-progress 1.4s ease-in-out infinite;
}

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

.budget-summary-kpis > div {
  display: grid;
  gap: 3px;
  min-height: 92px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-top: 3px solid #4f76df;
  border-radius: 6px;
}

.budget-summary-kpis > div:nth-child(2) { color: #ffffff; background: #172a50; border-color: #172a50; border-top-color: #f0b44b; }
.budget-summary-kpis > div:nth-child(3) { border-top-color: #7a56de; }
.budget-summary-kpis > div:nth-child(4) { border-top-color: #20a174; }
.budget-summary-kpis span { color: #69768c; font-size: 0.64rem; font-weight: 850; text-transform: uppercase; }
.budget-summary-kpis strong { color: #17233e; font-size: 1.2rem; }
.budget-summary-kpis small { color: #7b8799; font-size: 0.66rem; }
.budget-summary-kpis > div:nth-child(2) span,
.budget-summary-kpis > div:nth-child(2) strong,
.budget-summary-kpis > div:nth-child(2) small { color: #ffffff; }

.budget-summary-conversation {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 14px 16px;
  background: #eef3ff;
  border-left: 4px solid #536ee8;
  border-radius: 5px;
}

.summary-lina-label {
  color: #3555ad;
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.budget-summary-conversation p {
  margin: 0;
  color: #33415c;
  font-size: 0.77rem;
  line-height: 1.5;
}

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

.budget-insight-section {
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-radius: 6px;
}

.budget-insight-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid #e3e8f0;
}

.budget-insight-title div {
  display: grid;
  gap: 1px;
}

.budget-insight-title small {
  color: #6f7c92;
  font-size: 0.6rem;
  font-weight: 850;
  text-transform: uppercase;
}

.budget-insight-title h4 {
  color: #17233e;
  font-size: 0.9rem;
}

.budget-insight-title > svg {
  width: 20px;
  height: 20px;
  color: #536ee8;
}

.budget-insight-title > span {
  color: #53637d;
  font-size: 0.68rem;
  font-weight: 800;
}

.budget-bar-chart {
  display: grid;
  padding: 7px 14px 12px;
}

.budget-bar-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 7px 0;
  border-bottom: 1px solid #edf0f5;
}

.budget-bar-row:last-child { border-bottom: 0; }
.budget-bar-row > span { display: grid; place-items: center; width: 24px; height: 24px; color: #355aba; background: #eaf0fd; border-radius: 5px; font-size: 0.63rem; font-weight: 850; }
.budget-bar-row > div { position: relative; display: grid; min-width: 0; gap: 1px; padding-bottom: 7px; }
.budget-bar-row strong { color: #18395e; font-size: 0.68rem; }
.budget-bar-row small { overflow: hidden; color: #727e91; font-size: 0.6rem; text-overflow: ellipsis; white-space: nowrap; }
.budget-bar-row i { position: absolute; bottom: 0; left: 0; height: 4px; background: #536ee8; border-radius: 2px; }
.quantity-bars .budget-bar-row i { background: #24a174; }
.budget-bar-row b { color: #17233e; font-size: 0.68rem; white-space: nowrap; }

.production-insight-section {
  margin-top: 12px;
}

.production-analysis-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  padding: 5px 14px;
}

.production-analysis-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  padding: 9px 0;
  border-bottom: 1px solid #edf0f5;
}

.production-analysis-row > div { display: grid; min-width: 0; gap: 1px; }
.production-analysis-row strong { color: #18395e; font-size: 0.69rem; }
.production-analysis-row small { overflow: hidden; color: #707d92; font-size: 0.6rem; text-overflow: ellipsis; white-space: nowrap; }
.production-analysis-row > span { color: #4f5d75; font-size: 0.65rem; }
.production-analysis-row > b { grid-column: 2; width: fit-content; padding: 3px 6px; color: #187055; background: #e3f6ee; border-radius: 4px; font-size: 0.58rem; }
.production-analysis-row.is-stale > b { color: #9c5d08; background: #fff0d5; }
.production-analysis-row.is-missing > b { color: #a24238; background: #fde9e6; }

.budget-summary-footnote {
  margin: 8px 14px 14px;
  color: #778397;
  font-size: 0.62rem;
}

.budget-summary-error {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: min(620px, calc(100% - 40px));
  margin: 90px auto;
  padding: 20px;
  color: #7f3029;
  background: #fff5f3;
  border: 1px solid #edc2bd;
  border-radius: 7px;
}

.budget-summary-error svg { width: 24px; height: 24px; flex: 0 0 24px; }
.budget-summary-error div { display: grid; gap: 10px; }
.budget-summary-error p { margin: 0; color: #765651; font-size: 0.75rem; }

@keyframes summary-intelligence-ring {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes budget-summary-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(320%); }
}

@media (max-width: 900px) {
  .budget-summary-kpis,
  .budget-summary-grid,
  .production-analysis-list { grid-template-columns: 1fr 1fr; }
  .budget-summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .budget-summary-panel { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .budget-summary-body { padding: 10px; }
  .budget-summary-kpis,
  .production-analysis-list { grid-template-columns: 1fr; }
  .budget-summary-loading { grid-template-columns: 1fr; margin: 30px auto; }
  .summary-intelligence-mark { grid-row: auto; }
  .budget-summary-loading-steps { grid-column: 1; }
  .budget-bar-row { grid-template-columns: 24px minmax(0, 1fr); }
  .budget-bar-row b { grid-column: 2; }
}

.production-history-panel {
  margin-bottom: 14px;
  overflow: hidden;
  background: #ffffff;
}

.budget-sap-comparison-panel {
  margin-bottom: 14px;
  overflow: hidden;
  background: #ffffff;
}

.budget-sap-comparison-panel .panel-title small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.budget-sap-comparison {
  display: grid;
  gap: 14px;
  padding: 8px 16px 18px;
}

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

.comparison-kpis > div {
  min-width: 0;
  padding: 11px 12px;
  background: #f7f9fd;
  border: 1px solid #e1e7f0;
  border-radius: 7px;
}

.comparison-kpis span,
.comparison-kpis strong {
  display: block;
}

.comparison-kpis span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.comparison-kpis strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: #1d2b47;
  font-size: 0.9rem;
}

.comparison-chart-list {
  display: grid;
  overflow: hidden;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
}

.comparison-chart-row {
  display: grid;
  grid-template-columns: minmax(210px, 0.75fr) minmax(180px, 1fr) 130px 150px;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 10px 13px;
  color: inherit;
  text-align: left;
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid #e8edf4;
}

button.comparison-chart-row {
  cursor: pointer;
}

button.comparison-chart-row:hover {
  background: #f8faff;
}

.comparison-chart-row:last-child { border-bottom: 0; }

.comparison-chart-row.is-sap {
  background: #eef5ff;
  border-left: 3px solid #3978ed;
}

.comparison-chart-copy,
.comparison-chart-copy strong,
.comparison-chart-copy small {
  min-width: 0;
}

.comparison-chart-copy strong,
.comparison-chart-copy small {
  display: block;
}

.comparison-chart-copy strong {
  color: #1b2c4b;
  font-size: 0.78rem;
}

.comparison-chart-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-factor {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  margin-top: 5px;
  padding: 3px 7px;
  color: #52627b;
  background: #f1f4f8;
  border: 1px solid #dfe5ee;
  border-radius: 6px;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
}

.comparison-factor svg {
  width: 13px;
  height: 13px;
}

.comparison-factor.has-factor {
  color: #5b3dc2;
  background: #f1edff;
  border-color: #d8ccff;
}

.comparison-factor.no-factor {
  color: #52627b;
  background: #f4f6f9;
}

.comparison-chart-track {
  height: 9px;
  overflow: hidden;
  background: #e8edf5;
  border-radius: 5px;
}

.comparison-chart-track i {
  display: block;
  height: 100%;
  background: #6955ee;
  border-radius: inherit;
}

.is-sap .comparison-chart-track i { background: #3978ed; }

.comparison-chart-row > strong {
  color: #192944;
  font-size: 0.78rem;
  text-align: right;
  white-space: nowrap;
}

.comparison-chart-row > span {
  font-size: 0.68rem;
  font-weight: 800;
  text-align: right;
}

.comparison-chart-row > span.is-above { color: #b54d23; }
.comparison-chart-row > span.is-below { color: #14805f; }
.comparison-chart-row.is-sap > span { color: #315fbe; }

.comparison-empty {
  display: grid;
  grid-template-columns: 44px minmax(160px, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: #f7f9fd;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
}

.comparison-sap-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #3978ed;
  background: #e8f1ff;
  border-radius: 7px;
}

.comparison-empty strong,
.comparison-empty small { display: block; }
.comparison-empty p { margin: 0; color: var(--muted); font-size: 0.76rem; }

@media (max-width: 980px) {
  .comparison-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison-chart-row { grid-template-columns: minmax(180px, 1fr) minmax(140px, 1fr) 110px; }
  .comparison-chart-row > span { grid-column: 2 / 4; }
}

@media (max-width: 640px) {
  .comparison-kpis { grid-template-columns: 1fr; }
  .comparison-chart-row { grid-template-columns: 1fr; gap: 7px; }
  .comparison-chart-row > strong,
  .comparison-chart-row > span { text-align: left; }
  .comparison-chart-row > span { grid-column: auto; }
  .comparison-empty { grid-template-columns: 42px minmax(0, 1fr); }
  .comparison-empty p { grid-column: 1 / -1; }
}

.production-history-panel .panel-title small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.production-history-content {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.45fr);
  gap: 18px;
  padding: 8px 16px 18px;
}

.production-chart {
  display: grid;
  grid-template-columns: repeat(5, minmax(52px, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 210px;
  padding: 18px 16px 12px;
  background: #f7f9fd;
  border: 1px solid #e2e8f2;
  border-radius: 8px;
}

.production-bar {
  display: grid;
  grid-template-rows: auto 132px auto;
  gap: 8px;
  align-items: end;
  min-width: 0;
  text-align: center;
}

.production-bar strong { color: #26344d; font-size: 0.7rem; }
.production-bar small { color: var(--muted); font-size: 0.65rem; }

.production-bar-track {
  position: relative;
  height: 132px;
  overflow: hidden;
  background: #e8eef7;
  border-radius: 5px 5px 2px 2px;
}

.production-bar-track i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 4px;
  background: #4c75ef;
  border-radius: 5px 5px 0 0;
  transition: height 420ms ease;
}

.production-insights {
  display: grid;
  gap: 9px;
  align-content: start;
}

.production-insight {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e1e7f0;
  border-left: 3px solid #6758ed;
  border-radius: 6px;
}

.production-insight span,
.production-insight strong { display: block; }
.production-insight span { color: var(--muted); font-size: 0.67rem; font-weight: 800; text-transform: uppercase; }
.production-insight strong { margin-top: 4px; color: #1a2945; font-size: 0.86rem; }

.production-variance-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  color: #ffffff;
  text-align: left;
  background: #172a50;
  border-color: #172a50;
}

.production-variance-button:hover { background: #213b6d; border-color: #213b6d; }
.production-variance-button > svg { width: 22px; height: 22px; color: #72d8bd; }
.production-variance-button span,
.production-variance-button strong,
.production-variance-button small { display: block; min-width: 0; }
.production-variance-button strong { color: #ffffff; font-size: 0.78rem; }
.production-variance-button small { margin-top: 2px; color: #bed0eb; font-size: 0.64rem; }

#productionVarianceModal { z-index: 235; }
.production-variance-panel { width: min(1240px, calc(100vw - 40px)); }
.production-variance-loading { margin-top: 80px; }

.production-variance-selectors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-radius: 7px;
}

.production-variance-selectors label,
.production-variance-selectors label > span { display: grid; gap: 5px; }
.production-variance-selectors label > span { color: #64728a; font-size: 0.65rem; font-weight: 850; text-transform: uppercase; }
.production-variance-selectors > svg { align-self: center; width: 18px; height: 18px; color: #6577a2; }

.production-variance-unit-note {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  color: #254574;
  background: #edf5ff;
  border: 1px solid #c9ddfb;
  border-radius: 7px;
}

.production-variance-unit-note > svg {
  width: 22px;
  height: 22px;
  margin: auto;
  color: #3978ed;
}

.production-variance-unit-note strong,
.production-variance-unit-note span { display: block; }
.production-variance-unit-note strong { font-size: 0.75rem; }
.production-variance-unit-note span { margin-top: 2px; color: #5e6f89; font-size: 0.69rem; line-height: 1.4; }

.production-variance-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.production-variance-kpis > div {
  min-width: 0;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-top: 3px solid #4f76df;
  border-radius: 6px;
}

.production-variance-kpis > div:nth-child(2) { border-top-color: #7658e8; }
.production-variance-kpis > div:nth-child(4) { border-top-color: #1ca47a; }
.production-variance-kpis > div.is-increase { border-top-color: #d75d43; background: #fff8f6; }
.production-variance-kpis > div.is-decrease { border-top-color: #1d9c72; background: #f3fbf8; }
.production-variance-kpis span,
.production-variance-kpis strong,
.production-variance-kpis small { display: block; }
.production-variance-kpis span { color: #6b778c; font-size: 0.63rem; font-weight: 850; text-transform: uppercase; }
.production-variance-kpis strong { margin-top: 4px; overflow-wrap: anywhere; color: #17233e; font-size: 1.02rem; }
.production-variance-kpis small { margin-top: 3px; color: #7b8799; font-size: 0.67rem; }

.production-variance-conversation { margin-top: 12px; }
.production-order-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.production-order-comparison section {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-left: 3px solid #4f76df;
  border-radius: 6px;
}

.production-order-comparison section:last-child { border-left-color: #7658e8; }
.production-order-comparison small { color: #64728a; font-size: 0.63rem; font-weight: 850; text-transform: uppercase; }
.production-order-comparison strong { color: #17233e; font-size: 0.9rem; }
.production-order-comparison span,
.production-order-comparison em { color: #68768d; font-size: 0.69rem; font-style: normal; }

.production-driver-section {
  margin-top: 12px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-radius: 7px;
}

.production-driver-guide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.production-driver-guide > div {
  padding: 9px 10px;
  border: 1px solid #dbe5f4;
  border-radius: 6px;
  background: #f6f9fe;
}

.production-driver-guide strong,
.production-driver-guide span { display: block; }
.production-driver-guide strong { color: #315da8; font-size: 0.68rem; }
.production-driver-guide span { margin-top: 2px; color: #68768d; font-size: 0.62rem; line-height: 1.35; }

.production-driver-table {
  display: grid;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #e0e6ef;
  border-radius: 6px;
}

.production-driver-head,
.production-driver-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) repeat(3, minmax(175px, 0.85fr)) minmax(145px, 0.65fr);
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
}

.production-driver-head {
  color: #66748c;
  background: #f0f4f9;
  font-size: 0.61rem;
  font-weight: 850;
  text-transform: uppercase;
}

.production-driver-head > span > small {
  display: block;
  margin-top: 2px;
  color: #8994a7;
  font-size: 0.54rem;
  font-weight: 650;
  line-height: 1.25;
  text-transform: none;
}

.production-driver-row { min-height: 82px; border-top: 1px solid #e7ebf2; }
.production-driver-identity strong,
.production-driver-identity small,
.production-driver-identity em { display: block; min-width: 0; }
.production-driver-identity strong { color: #116f61; font-size: 0.7rem; }
.production-driver-identity small { margin-top: 2px; overflow: hidden; color: #56647b; font-size: 0.65rem; text-overflow: ellipsis; white-space: nowrap; }
.production-driver-identity em { width: fit-content; margin-top: 5px; padding: 3px 6px; color: #5b4ab2; background: #f0edff; border-radius: 4px; font-size: 0.58rem; font-style: normal; font-weight: 800; }

.production-driver-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.production-driver-value > span,
.production-driver-value small,
.production-driver-value strong { display: block; min-width: 0; }
.production-driver-value > span { padding: 6px 7px; border: 1px solid #e0e6ef; border-radius: 5px; background: #f9fbfd; }
.production-driver-value > span:last-child { border-color: #d8d0ff; background: #f8f6ff; }
.production-driver-value small { color: #78859a; font-size: 0.52rem; font-weight: 850; text-transform: uppercase; }
.production-driver-value strong { margin-top: 2px; color: #263650; font-size: 0.66rem; overflow-wrap: anywhere; }
.production-driver-value > i { color: #70809a; font-size: 0.72rem; font-style: normal; }

.production-driver-cost > small {
  display: block;
  margin-top: 4px;
  color: #77849a;
  font-size: 0.54rem;
  line-height: 1.25;
}

.production-driver-impact {
  padding: 8px 9px;
  text-align: right;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: #ffffff;
}

.production-driver-impact small,
.production-driver-impact strong { display: block; }
.production-driver-impact small { font-size: 0.56rem; font-weight: 850; text-transform: uppercase; }
.production-driver-impact strong { margin-top: 3px; font-size: 0.7rem; }
.production-driver-impact.is-increase { color: #b94731; background: #fff7f4; }
.production-driver-impact.is-decrease { color: #14795b; background: #f2fbf7; }

@media (max-width: 900px) {
  .production-variance-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-driver-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-driver-table { overflow-x: auto; }
  .production-driver-head,
  .production-driver-row { min-width: 1100px; }
}

@media (max-width: 640px) {
  .production-variance-panel { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .production-variance-selectors { grid-template-columns: 1fr; }
  .production-variance-selectors > svg { transform: rotate(90deg); }
  .production-variance-kpis,
  .production-order-comparison,
  .production-driver-guide { grid-template-columns: 1fr; }
}

.chat-thinking {
  align-self: flex-start;
  display: grid;
  gap: 7px;
  width: min(280px, 86%);
  padding: 11px 12px;
  color: #415273;
  background: #ffffff;
  border: 1px solid #dfe6f1;
  border-radius: 8px;
  font-size: 0.76rem;
}

.chat-thinking-dots { display: flex; gap: 5px; }
.chat-thinking-dots i { width: 6px; height: 6px; background: #5a6fe8; border-radius: 50%; animation: chatThink 1.2s ease-in-out infinite; }
.chat-thinking-dots i:nth-child(2) { animation-delay: 150ms; }
.chat-thinking-dots i:nth-child(3) { animation-delay: 300ms; }
@keyframes chatThink { 50% { transform: translateY(-4px); opacity: 0.45; } }

@media (max-width: 760px) {
  .production-history-content { grid-template-columns: 1fr; }
  .production-chart { gap: 6px; padding-inline: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-thinking-dots i { animation: none; }
}

.session-panel {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 11px;
  background: #eef3fa;
  border: 1px solid #dbe3ef;
  border-radius: 7px;
}

.session-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #ffffff;
  background: #315fae;
  border-radius: 6px;
  font-weight: 800;
}

.session-copy {
  min-width: 0;
}

.session-copy strong,
.session-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-copy strong { color: #17213a; font-size: 13px; }

.session-logout {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #516079;
  background: #ffffff;
  border: 1px solid #d6dfec;
  border-radius: 6px;
  cursor: pointer;
}

.session-logout svg { width: 17px; height: 17px; }

.app-shell.is-sidebar-collapsed .session-panel {
  grid-template-columns: 38px;
  padding: 6px;
}

.app-shell.is-sidebar-collapsed .session-copy,
.app-shell.is-sidebar-collapsed .session-logout {
  display: none;
}

.permission-readonly [data-open-batch],
.permission-readonly #openManualLine,
.permission-readonly #openSaveBudget,
.permission-readonly #openCreateModal,
.permission-readonly #deleteBatchBtn {
  display: none !important;
}

.read-only-badge,
.read-only-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #2457a7;
  font-size: 0.78rem;
  font-weight: 900;
}

.read-only-badge {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #b9d2ff;
  border-radius: 8px;
  background: #edf4ff;
}

.read-only-badge svg,
.read-only-note svg {
  width: 16px;
  height: 16px;
}

.permission-readonly .bom-table input:disabled,
.permission-readonly .bom-table select:disabled,
.permission-readonly .structure-details select:disabled {
  cursor: default;
  opacity: 1;
  color: #334155;
  background: #f1f5f9;
}

.permission-readonly .code-button:disabled {
  cursor: default;
  opacity: 1;
}

.budget-readonly-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.budget-readonly-totals > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-top: 3px solid #4f7df0;
  border-radius: 8px;
  background: #f8fafc;
}

.budget-readonly-totals > div.is-final {
  color: white;
  border-color: #182d58;
  background: #182d58;
}

.budget-readonly-totals span,
.budget-readonly-totals small {
  display: block;
}

.budget-readonly-totals span {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.budget-readonly-totals strong {
  display: block;
  margin: 5px 0 3px;
  font-size: 1.1rem;
}

.budget-readonly-totals small {
  color: var(--muted);
  font-size: 0.72rem;
}

.budget-readonly-totals .is-final small {
  color: #c8d8f5;
}

.budget-readonly-lines {
  min-height: 220px;
}

@media (max-width: 900px) {
  .budget-readonly-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell,
  .app-shell.is-sidebar-collapsed {
    display: block;
    min-width: 0;
  }

  .sidebar,
  .app-shell.is-sidebar-collapsed .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    height: 100vh;
    padding: 18px 14px;
    z-index: 120;
    overflow: auto;
    box-shadow: 14px 0 34px rgba(4,10,28,0.24);
    transition: width 180ms ease, box-shadow 180ms ease;
  }

  .app-shell.is-sidebar-collapsed .sidebar {
    width: 68px;
    padding: 14px 10px;
    overflow: hidden;
    box-shadow: 6px 0 18px rgba(4,10,28,0.14);
  }

  .app-shell.is-sidebar-collapsed .brand {
    flex-direction: column;
    gap: 9px;
  }

  .app-shell.is-sidebar-collapsed .brand-mark {
    width: 42px;
    height: 42px;
  }

  .app-shell.is-sidebar-collapsed .brand-copy,
  .app-shell.is-sidebar-collapsed .sidebar-context,
  .app-shell.is-sidebar-collapsed .module-label {
    display: none;
  }

  .app-shell.is-sidebar-collapsed .module-link {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 7px;
  }

  .workspace {
    width: auto;
    min-width: 0;
    margin-left: 68px;
    padding: 0 10px 20px;
  }

  .topbar {
    margin: 0 -10px 14px;
    padding: 12px;
  }

  .topbar h2 {
    white-space: normal;
  }

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

  .metric,
  .metric:nth-child(n) {
    min-width: 0;
  }

  .panel,
  .structure-panel,
  .table-scroll {
    min-width: 0;
    max-width: 100%;
  }
}

/* 2026-08-06: LINA sem rosto, contraste de icones e filtros inteligentes */
.metric .metric-icon,
.module-link .module-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}

.metric .metric-icon svg,
.module-link .module-icon svg {
  width: 20px;
  height: 20px;
  margin: auto;
  stroke: currentColor !important;
}

.metric .metric-icon {
  color: #ffffff !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}

.metric-blue .metric-icon { background: #5790f7; }
.metric-violet .metric-icon { background: #9170f6; }
.metric-green .metric-icon { background: #36b67d; }
.metric-orange .metric-icon { background: #f5aa2e; }
.metric-rose .metric-icon { background: #ef668b; }
.metric-teal .metric-icon { background: #2aa58f; }

.module-link .module-icon {
  color: #c9d7f5;
  background: rgba(111, 142, 207, 0.2);
}

.module-link:nth-child(2) .module-icon {
  color: #d7c9ff;
  background: rgba(145, 112, 246, 0.2);
}

.module-link:nth-child(3) .module-icon {
  color: #9ce7c4;
  background: rgba(54, 182, 125, 0.18);
}

.module-link.is-active .module-icon {
  color: #ffffff;
  background: rgba(255,255,255,0.2);
}

.lina-launcher {
  min-height: 46px;
  padding: 0 18px;
  gap: 0;
  color: #ffffff;
  background: #17264a;
  border-color: #314875;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(13, 28, 61, 0.2);
  letter-spacing: 0;
}

.lina-wordmark {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0;
}

.lina-chat-head {
  grid-template-columns: minmax(0, 1fr) 36px;
  background: #f7f9fd;
  border-top: 3px solid #5d76e8;
}

.lina-chat-head h3 {
  color: #17264a;
  letter-spacing: 0;
}

.lina-signal strong {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #ffffff;
  background: #1d2f5d;
  border: 1px solid rgba(142, 171, 255, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(83, 113, 221, 0.14), 0 12px 28px rgba(0,0,0,0.22);
  font-size: 0.78rem;
  font-weight: 900;
}

.loading-content-modern {
  color: #f4f7ff;
  background: #142247;
  border-color: #4565a8;
}

.loading-copy p {
  color: #d2dcf2;
}

.loading-flow span {
  color: #aebedf;
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}

.loading-flow span.is-active {
  color: #ffffff;
  background: #294a8d;
  border-color: #7ea2f2;
  box-shadow: 0 0 0 2px rgba(126,162,242,0.12);
}

.dashboard-smart-search {
  position: relative;
}

.dashboard-search-feedback {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #d6deec;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(25, 40, 76, 0.16);
}

.dashboard-search-status {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.dashboard-search-status strong {
  color: #26344d;
  font-size: 0.78rem;
}

.dashboard-search-status span {
  color: #66738b;
  font-size: 0.72rem;
}

.dashboard-search-status.is-loading {
  border-left: 3px solid #5d76e8;
  background: #f3f6ff;
}

.dashboard-search-status.is-error {
  border-left: 3px solid #d84d61;
  background: #fff5f6;
}

.dashboard-search-results {
  max-height: 280px;
  overflow: auto;
  display: grid;
  padding: 6px;
}

.dashboard-search-results button {
  display: grid;
  gap: 3px;
  padding: 10px;
  color: #26344d;
  text-align: left;
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  cursor: pointer;
}

.dashboard-search-results button:hover {
  background: #f3f6ff;
}

.dashboard-search-results button strong {
  color: #0b7668;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
}

.dashboard-search-results button span,
.batch-quantity-help {
  color: #68758d;
  font-size: 0.72rem;
  line-height: 1.35;
}

.occurrence-qty {
  min-width: 150px;
}

.occurrence-qty input::placeholder {
  color: #8a95a8;
}

@media (max-width: 1350px) {
  .lina-launcher {
    width: auto;
    height: 46px;
    padding: 0 16px;
  }
  .lina-launcher .lina-wordmark { display: inline-flex !important; }
}

/* 2026-08-06: operational polish, stable batch layout and cost analytics */
:root {
  --chart-1: #3478f6;
  --chart-2: #7c4dff;
  --chart-3: #17a668;
  --chart-4: #f59e0b;
  --chart-5: #ec4c78;
}

.module-icon svg,
.metric-icon svg,
.activity-icon svg {
  display: block;
  width: 19px;
  height: 19px;
}

.metric-icon svg {
  width: 21px;
  height: 21px;
}

.sidebar .smart-search-card.is-waiting,
.sidebar .smart-search-card.is-loading {
  color: #dbe7ff;
  background: #17264a;
  border-color: #5576be;
  box-shadow: inset 3px 0 0 #6d99ff;
}

.sidebar .smart-search-card.is-waiting strong,
.sidebar .smart-search-card.is-loading strong {
  color: #ffffff;
}

.sidebar .smart-search-card.is-waiting span,
.sidebar .smart-search-card.is-loading span {
  color: #c4d3f2;
}

.sidebar .smart-progress {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar .smart-progress i {
  background: linear-gradient(90deg, #66a1ff, #ab8dff);
}

.table-scroll {
  isolation: isolate;
  scrollbar-gutter: stable;
}

.bom-table thead th {
  height: 44px;
  padding-block: 12px;
  line-height: 1.25;
  z-index: 4;
  box-shadow: 0 1px 0 #dce2ec;
}

.bom-table td {
  line-height: 1.35;
}

.bom-table tr[data-level="1"].child-row .item-cell::before {
  display: none;
}

.bom-table .description {
  padding-left: var(--indent, 0px);
}

.bom-table .item-cell,
.bom-table .item-main,
.bom-table .description,
.bom-table .line-meta,
.bom-table .code-button {
  min-width: 0;
}

.bom-table .code-button,
.bom-table .description,
.bom-table .line-meta {
  position: relative;
  z-index: 1;
}

.batch-modal-panel {
  width: min(1320px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
}

.batch-modal-body .selected-box {
  position: relative;
  z-index: 3;
  background: #ffffff;
}

.batch-modal-body .selected-list {
  max-height: 138px;
}

.batch-modal-grid {
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
}

.batch-modal-grid .target-box {
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 9px;
  align-content: stretch;
}

.batch-modal-grid .target-box > .field-label,
.batch-modal-grid .target-box > .input,
.batch-modal-grid .target-actions {
  position: static;
  min-width: 0;
  margin: 0;
}

.batch-modal-grid .target-actions {
  min-height: 36px;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 14px;
}

.batch-modal-grid .target-list {
  padding-right: 4px;
  align-content: start;
  grid-auto-rows: max-content;
  overflow: auto;
}

.check-row {
  min-width: 0;
  line-height: 1.25;
}

.occurrence-summary,
.occurrence-group,
.occurrence-row,
.occurrence-row > span {
  min-width: 0;
}

.occurrence-summary {
  line-height: 1.35;
}

.occurrence-row strong,
.occurrence-row small,
.occurrence-row em {
  overflow-wrap: anywhere;
}

.dashboard-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  background: #ffffff;
}

.dashboard-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.dashboard-grid .metric {
  min-width: 0;
}

.dashboard-grid .metric strong {
  overflow-wrap: anywhere;
}

.dashboard-insights-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-ranking-panel {
  grid-row: span 2;
}

.dashboard-insight-panel {
  min-width: 0;
  overflow: hidden;
  background: #ffffff;
}

.dashboard-insight-panel .panel-title {
  align-items: flex-start;
}

.dashboard-insight-panel .panel-title small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.cost-ranking,
.group-composition,
.dashboard-activity {
  display: grid;
  padding: 8px 16px 16px;
}

.cost-rank-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f5;
}

.cost-rank-row:last-child,
.activity-row:last-child {
  border-bottom: 0;
}

.rank-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: #315b9f;
  background: #edf4ff;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 800;
}

.rank-copy,
.rank-copy > div {
  min-width: 0;
}

.rank-copy > div:first-child,
.group-cost-row > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rank-copy strong {
  color: #1c2c49;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
}

.impact-kind {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 5px;
  color: #8a5100;
  font-family: inherit;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 850;
  text-transform: uppercase;
  vertical-align: middle;
  background: #fff2d8;
  border: 1px solid #f2c56f;
  border-radius: 5px;
}

.cost-rank-row.is-resource .rank-number {
  color: #8a5100;
  background: #fff2d8;
}

.cost-rank-row.is-resource .rank-track i { background: #e49a1f; }

.rank-copy > div > span,
.group-cost-row strong {
  color: #18243a;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 800;
}

.rank-copy small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-track,
.group-track {
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  background: #edf1f7;
  border-radius: 4px;
}

.rank-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3478f6, #7c4dff);
  border-radius: inherit;
}

.group-cost-row {
  padding: 10px 0;
  border-bottom: 1px solid #edf0f5;
}

.group-cost-row > div > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #344057;
  font-size: 0.75rem;
  font-weight: 700;
}

.group-cost-row > div > span i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  background: var(--group-color);
  border-radius: 50%;
}

.group-track i {
  display: block;
  height: 100%;
  background: var(--group-color);
  border-radius: inherit;
}

.group-cost-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.68rem;
}

.activity-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f5;
}

.activity-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #7355e9;
  background: #f0ecff;
  border-radius: 7px;
}

.activity-icon svg {
  width: 15px;
  height: 15px;
}

.activity-row strong,
.activity-row small {
  display: block;
  min-width: 0;
}

.activity-row strong {
  color: #26344d;
  font-size: 0.76rem;
}

.activity-row small,
.activity-row time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.3;
}

.activity-row time {
  white-space: nowrap;
}

.dashboard-products-panel {
  margin-bottom: 20px;
}

@media (max-width: 1180px) {
  .dashboard-filters,
  .dashboard-insights-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-ranking-panel {
    grid-row: auto;
  }

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

@media (max-width: 1500px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
  }
}

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

@media (max-width: 760px) {
  .batch-modal-grid {
    grid-template-columns: 1fr;
  }

  .batch-form-column {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .batch-modal-grid .target-box {
    min-height: 420px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .activity-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .activity-row time {
    grid-column: 2;
  }
}

.project-search-results {
  gap: 6px;
  padding: 8px;
}

.project-search-group {
  overflow: hidden;
  border: 1px solid #e1e7f0;
  border-radius: 7px;
}

.project-search-group header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: #f4f7fc;
}

.project-search-group header strong {
  color: #243653;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.76rem;
}

.project-search-group header span,
.project-search-group > small {
  color: #6e7b91;
  font-size: 0.7rem;
}

.project-search-group > small {
  display: block;
  padding: 10px;
}

.structure-status-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 460px;
}

.last-production-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 9px;
  color: #5f6d83;
  background: #f4f7fb;
  border: 1px solid #dce4ef;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.last-production-pill.is-ready {
  color: #14664f;
  background: #effaf5;
  border-color: #bfe6d5;
}

.last-production-pill svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.export-modal-panel {
  position: relative;
  z-index: 2;
  width: min(620px, calc(100vw - 32px));
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(12, 28, 61, 0.24);
}

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

.export-format-option {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
  min-height: 126px;
  padding: 16px;
  color: #1d2b45;
  text-align: left;
  background: #ffffff;
  border: 1px solid #dce4ef;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.export-format-option:hover {
  border-color: #8ea6d8;
  box-shadow: 0 10px 24px rgba(35, 55, 96, 0.1);
  transform: translateY(-1px);
}

.export-format-icon {
  grid-row: 1 / 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #ffffff;
  border-radius: 7px;
}

.export-format-option.is-pdf .export-format-icon { background: #e9586d; }
.export-format-option.is-excel .export-format-icon { background: #24a875; }

.export-format-icon svg {
  width: 22px;
  height: 22px;
}

.export-format-option strong {
  font-size: 1rem;
}

.export-format-option small {
  color: #68758d;
  font-size: 0.75rem;
  line-height: 1.45;
}

@media (max-width: 620px) {
  .export-format-grid {
    grid-template-columns: 1fr;
  }
}

.target-row.has-quantity {
  grid-template-columns: auto minmax(0, 1fr) minmax(125px, 150px);
  align-items: center;
}

.target-row.has-quantity .occurrence-qty {
  min-width: 0;
}

/* Cadastro de fatores e valor final do orçamento. */
.side-controls {
  grid-template-columns: 1fr;
}

.module-link:nth-child(4) .module-icon {
  color: #ffd27d;
}

.top-actions .button svg,
.factor-form-heading .icon-button svg,
.factor-actions .icon-button svg {
  width: 17px;
  height: 17px;
}

.top-actions .button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.structure-details {
  grid-template-columns: repeat(5, minmax(135px, 1fr));
}

.summary-item small {
  display: block;
  margin-top: 5px;
  color: #7b879b;
  font-size: 0.66rem;
  line-height: 1.35;
}

.summary-final {
  color: #ffffff;
  background: #213568;
  border-color: #213568;
  box-shadow: 0 8px 20px rgba(33, 53, 104, 0.18);
}

.summary-final::before {
  width: 5px;
  background: #ffcc66;
}

.summary-final span,
.summary-final strong,
.summary-final small,
.summary-final em {
  color: #ffffff;
}

.summary-final em {
  padding: 2px 5px;
  border-radius: 4px;
  color: #213568;
  background: #ffcc66;
}

.factor-form-panel {
  margin-bottom: 14px;
  padding: 18px;
}

.factor-form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.factor-form-heading h3 {
  font-size: 1.08rem;
}

.factor-form-fields {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.7fr) auto;
  align-items: end;
  gap: 12px;
}

.factor-form-fields label {
  display: grid;
  gap: 6px;
}

.factor-form-fields .button {
  min-height: 44px;
}

.factor-list-panel {
  overflow: hidden;
}

.factor-list-panel .panel-title small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.factor-table-head,
.factor-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(130px, 0.65fr) minmax(110px, 0.55fr) minmax(150px, 0.7fr) 120px;
  align-items: center;
  gap: 14px;
}

.factor-table-head {
  padding: 10px 18px;
  color: #6c7890;
  background: #f3f6fa;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.factor-row {
  min-height: 70px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.factor-row:last-child {
  border-bottom: 0;
}

.factor-row.is-inactive {
  color: #8490a5;
  background: #f8f9fb;
}

.factor-name-cell {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.factor-name-cell strong {
  overflow-wrap: anywhere;
}

.factor-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  color: #296b5c;
  background: #dff5ec;
  border-radius: 7px;
}

.factor-mark svg {
  width: 18px;
  height: 18px;
}

.factor-number {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 1rem;
}

.factor-status {
  width: fit-content;
  padding: 4px 8px;
  color: #758196;
  background: #edf0f4;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 850;
}

.factor-status.is-active {
  color: #14714f;
  background: #def5e9;
}

.factor-updated {
  color: #768198;
  font-size: 0.76rem;
}

.factor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.factor-switch {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 24px;
  cursor: pointer;
}

.factor-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.factor-switch span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #cbd2dc;
  transition: background 150ms ease;
}

.factor-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(27, 39, 65, 0.2);
  transition: transform 150ms ease;
}

.factor-switch input:checked + span {
  background: #21a873;
}

.factor-switch input:checked + span::after {
  transform: translateX(18px);
}

.factor-switch input:focus-visible + span {
  outline: 3px solid rgba(52, 120, 246, 0.25);
  outline-offset: 2px;
}

.sap-summary {
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(140px, 1fr));
}

.sap-summary-final {
  color: #ffffff;
  background: #213568 !important;
  border-color: #213568 !important;
}

.sap-summary-final span,
.sap-summary-final strong,
.sap-summary-final small {
  color: #ffffff;
}

@media (max-width: 1050px) {
  .structure-details {
    grid-template-columns: repeat(3, minmax(135px, 1fr));
  }

  .factor-table-head,
  .factor-row {
    grid-template-columns: minmax(210px, 1.3fr) 120px 100px 120px;
  }

  .factor-table-head span:nth-child(4),
  .factor-updated {
    display: none;
  }
}

@media (max-width: 720px) {
  .structure-details,
  .factor-form-fields,
  .sap-summary {
    grid-template-columns: 1fr;
  }

  .factor-table-head {
    display: none;
  }

  .factor-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .factor-row > :nth-child(3),
  .factor-row > :nth-child(4) {
    display: none;
  }
}

/* Final LINA visual contract: must follow all legacy overrides. */
.lina-chat { z-index: 220; }
.lina-launcher { z-index: 210; }

/* Layered analysis dialogs and on-demand pervasive hierarchy. */
#budgetPercentageModal { z-index: 240; }
#pervasiveMovementModal { z-index: 250; }

.percentage-analysis-panel,
.pervasive-movement-panel {
  width: min(1240px, calc(100vw - 40px));
}

.pervasive-product-context {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px 18px;
  color: #fff;
  background: #172a50;
  border-left: 4px solid #65d4b4;
  border-radius: 6px;
}

.pervasive-product-context small,
.pervasive-product-context h3,
.pervasive-product-context span { display: block; }
.pervasive-product-context small { color: #9fb8e0; font-size: .67rem; font-weight: 850; text-transform: uppercase; }
.pervasive-product-context h3 { margin: 4px 0; color: #fff; font-size: 1.08rem; }
.pervasive-product-context span { color: #d7e3f5; font-size: .75rem; }

.pervasive-tree-node {
  position: relative;
}

.pervasive-tree-node + .pervasive-tree-node {
  border-top: 1px solid #e2e8f1;
}

.pervasive-item {
  position: relative;
  border-top: 0;
  border-left: 4px solid #aab7ca;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.pervasive-item.is-critical { border-left-color: #df4b58; background: #fff4f5; }
.pervasive-item.is-warning { border-left-color: #ee9b20; background: #fff9ed; }
.pervasive-item.is-stable { border-left-color: #25a779; background: #f2fbf7; }
.pervasive-item.is-error { border-left-color: #bb3c32; background: #fff0ee; }
.pervasive-item.is-neutral { border-left-color: #8ba0bd; background: #f8fafc; }
.pervasive-item.is-deferred { border-left-color: #5c78a7; background: #f4f7fc; }
.pervasive-item .is-deferred-label { color: #415f90; }

.pervasive-node-leading {
  display: flex;
  gap: 7px;
  align-items: center;
}

.pervasive-expand,
.pervasive-leaf {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: #176f66;
  background: #fff;
  border: 1px solid #cbd7e7;
  border-radius: 5px;
}

.pervasive-expand { cursor: pointer; }
.pervasive-expand:hover { color: #fff; background: #176f66; border-color: #176f66; }
.pervasive-expand svg,
.pervasive-leaf svg { width: 16px; height: 16px; }
.pervasive-expand [data-lucide="loader-circle"] { animation: pervasive-spin 850ms linear infinite; }

.pervasive-identity strong { color: #087568; }
.pervasive-identity small { margin-top: 3px; color: #26344d; }
.pervasive-item .is-increase { color: #c74531; }
.pervasive-item .is-decrease { color: #168564; }

.pervasive-movements {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-top: 7px;
  padding: 6px 8px;
  color: #244a83;
  background: #edf4ff;
  border: 1px solid #c8d9f3;
  border-radius: 5px;
  font: inherit;
  font-size: .7rem;
  font-weight: 800;
  cursor: pointer;
}

.pervasive-movements svg { width: 14px; height: 14px; }
.pervasive-movements:disabled { color: #7d899b; background: #f1f4f8; cursor: default; opacity: .8; }

.pervasive-children {
  margin-left: calc(22px + (var(--tree-depth, 1) * 18px));
  border-left: 2px solid #a9c2e8;
  background: #f7faff;
}

.pervasive-child-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  color: #30486e;
  background: #e9f1ff;
  border-bottom: 1px solid #cfdcf0;
}

.pervasive-child-head span { color: #64738b; font-size: .7rem; }
.pervasive-node-loading {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-left: 44px;
  padding: 11px 14px;
  color: #315a91;
  background: #eef5ff;
}
.pervasive-node-loading svg { width: 17px; height: 17px; animation: pervasive-spin 850ms linear infinite; }

.pervasive-partial-warning {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 11px 13px;
  color: #75520e;
  background: #fff7e5;
  border: 1px solid #f0cf8d;
  border-radius: 6px;
}
.pervasive-partial-warning svg { width: 18px; height: 18px; }
.pervasive-partial-warning strong,
.pervasive-partial-warning span { display: block; }
.pervasive-partial-warning span { margin-top: 2px; font-size: .72rem; }

.pervasive-movement-intro {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  color: #284873;
  background: #edf5ff;
  border-left: 4px solid #4d78ec;
}
.pervasive-movement-intro span { color: #60718c; }
.pervasive-movement-table { overflow: auto; border: 1px solid #d9e1ec; background: #fff; }
.pervasive-movement-row {
  display: grid;
  grid-template-columns: 105px 115px minmax(150px, 1fr) 130px 130px 90px 118px;
  gap: 12px;
  align-items: center;
  min-width: 900px;
  padding: 11px 13px;
  border-top: 1px solid #e3e8ef;
}
.pervasive-movement-row.is-header {
  color: #5a6980;
  background: #eef2f7;
  border-top: 0;
  font-size: .68rem;
  font-weight: 850;
  text-transform: uppercase;
}
.pervasive-movement-row .is-increase { color: #c74531; }
.pervasive-movement-row .is-decrease { color: #168564; }
.pervasive-movement-row .is-neutral { color: #65738a; }
.pervasive-investigate {
  min-height: 34px;
  padding: 7px 10px;
  gap: 6px;
  justify-content: center;
  white-space: nowrap;
}
.pervasive-investigate svg { width: 15px; height: 15px; }

@keyframes pervasive-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1000px) {
  .pervasive-product-context,
  .pervasive-child-head,
  .pervasive-movement-intro { align-items: stretch; flex-direction: column; }
  .pervasive-children { margin-left: 14px; }
}
.lina-chat-head {
  grid-template-columns: minmax(0, 1fr) 36px;
  color: #ffffff;
  background: #142447;
  border-top: 0;
  border-bottom-color: #263b67;
}
.lina-chat-head h3 { color: #ffffff; }
.lina-chat-head span { color: #b9c8e5; }

/* Responsive containment for compact workspaces. */
@media (max-width: 900px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .top-actions {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .top-actions .button {
    min-width: 0;
    flex: 1 1 140px;
    white-space: normal;
  }
}
