/* BOQ Creator — tender-style Schedule of Quantities */

.bb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.bb-toolbar__spacer {
  flex: 1;
  min-width: 8px;
}

.bb-meta-card,
.bb-notes-card,
.bb-table-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.bb-step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: var(--space-md);
}

.bb-step-badge {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-top: 2px;
}

.bb-step-sub {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.92em;
}

.bb-card-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--color-navy);
}

.bb-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
}

.bb-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.bb-notes-card__summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: var(--space-sm);
}

.bb-notes-card__summary::-webkit-details-marker {
  display: none;
}

.bb-notes-card__hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.bb-notes {
  width: 100%;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  font-family: inherit;
}

.bb-row-type-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--space-md);
}

.bb-table-hint {
  margin: 4px 0 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.bb-grid-wrap {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.bb-soq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.bb-soq-table thead th {
  background: #2563eb;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  border: none;
}

.bb-soq-table thead th:first-child {
  border-radius: 10px 0 0 0;
}

.bb-soq-table thead th:last-child {
  border-radius: 0 10px 0 0;
  text-align: center;
}

.bb-col-sr { width: 64px; text-align: center; }
.bb-col-qty { width: 88px; text-align: center; }
.bb-col-unit { width: 88px; text-align: center; }
.bb-col-act { width: 52px; text-align: center; }

.bb-soq-table tbody td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px;
  vertical-align: top;
  background: #fff;
}

.bb-soq-table tbody tr:last-child td {
  border-bottom: none;
}

.bb-row--section td,
.bb-row--sub td {
  background: #f8fafc;
  padding: 10px 12px;
}

.bb-row--section .bb-cell--desc {
  font-weight: 700;
  color: #0f2744;
}

.bb-row--sub .bb-cell--desc {
  font-weight: 600;
  font-style: italic;
  color: #334155;
}

.bb-td-sno {
  text-align: center;
  font-weight: 600;
  color: #334155;
  padding-top: 14px !important;
}

.bb-td-desc {
  min-width: 280px;
}

.bb-desc-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bb-desc-input {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  background: #fff;
}

.bb-desc-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.bb-expand-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.bb-expand-btn:hover {
  background: #dbeafe;
}

.bb-expand-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.bb-qty-input,
.bb-unit-input,
.bb-cell--sr-inline {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  font-family: inherit;
  background: #fff;
}

.bb-qty-input:focus,
.bb-unit-input:focus,
.bb-cell--sr-inline:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.bb-cell--desc {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 2.5rem;
}

.bb-cell--desc:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.bb-del {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 6px;
  border-radius: 6px;
}

.bb-del:hover {
  color: #dc2626;
  background: #fef2f2;
}

.bb-add-item-btn {
  margin-top: var(--space-md);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.bb-add-item-btn:hover {
  background: #1d4ed8;
}

.bb-stat {
  margin: var(--space-sm) 0 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Expand description modal */
.bb-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.bb-modal[hidden] {
  display: none !important;
}

.bb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.bb-modal__panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.bb-modal__title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--color-navy);
}

.bb-modal__hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.bb-modal__textarea {
  flex: 1;
  min-height: 320px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.bb-modal__textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.bb-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .bb-col-unit,
  .bb-col-qty {
    width: 72px;
  }

  .bb-td-desc {
    min-width: 180px;
  }
}
