/* BIMTRAZA — MRP / OF */
#bimtraza-mrp.bt-mrp {
  position: fixed;
  z-index: 21620;
  top: var(--bimtraza-menubar-h, 38px);
  left: var(--bimtraza-shell-width, 148px);
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background:
    radial-gradient(1100px 380px at 0% -8%, rgba(124, 45, 18, 0.1), transparent 50%),
    linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #0f172a;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}
#bimtraza-mrp.bt-mrp[hidden] {
  display: none !important;
}

.bt-mrp-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border-bottom: 1px solid #cbd5e1;
}
.bt-mrp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}
.bt-mrp-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #c2410c 0%, #9a3412 100%);
  color: #fff7ed;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.bt-mrp-brand h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.15;
}
.bt-mrp-brand p {
  margin: 2px 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
.bt-mrp-project {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  color: #334155;
}
.bt-mrp-project strong {
  color: #0f172a;
}
.bt-mrp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.bt-mrp-btn {
  border: 1px solid #94a3b8;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.bt-mrp-btn:hover {
  background: #e2e8f0;
}
.bt-mrp-btn--primary {
  background: #c2410c;
  border-color: #c2410c;
  color: #fff;
}
.bt-mrp-btn--primary:hover {
  background: #9a3412;
}
.bt-mrp-btn--danger {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}
.bt-mrp-btn--ok {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.bt-mrp-btn--ghost {
  background: transparent;
}

.bt-mrp-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  padding: 8px 14px 0;
  overflow-x: auto;
  border-bottom: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.55);
}
.bt-mrp-tab {
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: #475569;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  white-space: nowrap;
}
.bt-mrp-tab.is-active {
  background: #fff;
  color: #c2410c;
  border-color: #cbd5e1;
}

.bt-mrp-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 14px;
  overflow: hidden;
}
.bt-mrp-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.bt-mrp-panel.is-active {
  display: flex;
}

.bt-mrp-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 1200px) {
  .bt-mrp-kpi-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.bt-mrp-kpi {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 72px;
}
.bt-mrp-kpi span {
  display: block;
  font-size: 11px;
  color: #64748b;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bt-mrp-kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 780;
  color: #0f172a;
  line-height: 1.1;
}
.bt-mrp-kpi.is-ok strong {
  color: #15803d;
}
.bt-mrp-kpi.is-warn strong {
  color: #b45309;
}
.bt-mrp-kpi.is-bad strong {
  color: #b91c1c;
}

.bt-mrp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.bt-mrp-toolbar input[type="search"],
.bt-mrp-toolbar select,
.bt-mrp-editor input,
.bt-mrp-editor select,
.bt-mrp-editor textarea {
  border: 1px solid #94a3b8;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 12px;
  background: #fff;
  color: #0f172a;
  box-sizing: border-box;
}
.bt-mrp-toolbar input[type="search"] {
  min-width: 200px;
  flex: 1 1 180px;
}

.bt-mrp-split {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 10px;
}
@media (max-width: 980px) {
  .bt-mrp-split {
    grid-template-columns: 1fr;
  }
}
.bt-mrp-card {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.bt-mrp-card-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 750;
}
.bt-mrp-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.bt-mrp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.bt-mrp-table th,
.bt-mrp-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}
.bt-mrp-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  z-index: 1;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #475569;
}
.bt-mrp-table tbody tr {
  cursor: pointer;
}
.bt-mrp-table tbody tr:hover {
  background: #fff7ed;
}
.bt-mrp-table tbody tr.is-selected {
  background: #ffedd5;
  outline: 1px solid #fdba74;
  outline-offset: -1px;
}
.bt-mrp-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bt-mrp-muted {
  color: #64748b;
  font-size: 12px;
  padding: 16px;
}
.bt-mrp-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.bt-mrp-badge--draft {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}
.bt-mrp-badge--open {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
}
.bt-mrp-badge--run {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}
.bt-mrp-badge--ok {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.bt-mrp-badge--bad {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.bt-mrp-badge--wait {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde047;
}

.bt-mrp-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}
.bt-mrp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.bt-mrp-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.bt-mrp-form-grid label.full {
  grid-column: 1 / -1;
}
.bt-mrp-lines {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}
.bt-mrp-lines table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.bt-mrp-lines th,
.bt-mrp-lines td {
  border-bottom: 1px solid #e2e8f0;
  padding: 5px 6px;
}
.bt-mrp-lines input,
.bt-mrp-lines select {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 11px;
}
.bt-mrp-editor-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  padding-top: 4px;
}
.bt-mrp-toast {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  max-width: min(360px, 80vw);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  display: none;
}
.bt-mrp-toast.is-on {
  display: block;
}
.bt-mrp-toast.is-err {
  background: #991b1b;
}
.bt-mrp-gantt {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}
.bt-mrp-gantt-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.bt-mrp-gantt-bar-wrap {
  position: relative;
  height: 22px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.bt-mrp-gantt-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 4px;
  background: linear-gradient(90deg, #fb923c, #c2410c);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
}
.bt-mrp-gantt-bar.is-done {
  background: linear-gradient(90deg, #86efac, #16a34a);
}
.bt-mrp-gantt-bar.is-late {
  background: linear-gradient(90deg, #fca5a5, #dc2626);
}
