/* BIMTRAZA — Herramientas / TABTRAZA */
.bt-htools-backdrop {
  position: fixed;
  inset: 0;
  z-index: 22080;
  background: rgba(3, 15, 26, 0.55);
  backdrop-filter: blur(2px);
}

.bt-htools-panel {
  position: fixed;
  z-index: 22090;
  left: calc(var(--bimtraza-shell-width, 148px) + 10px);
  bottom: 56px;
  width: min(340px, calc(100vw - var(--bimtraza-shell-width, 148px) - 24px));
  background: linear-gradient(180deg, #10253b 0%, #0b1c2e 100%);
  border: 1px solid #1b3a5a;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  color: #e8f1fa;
  padding: 14px;
}

.bt-htools-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.bt-htools-panel__head h2 {
  margin: 0;
  font: 700 0.95rem/1.2 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.02em;
}

.bt-htools-panel__head p {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: #89ceff;
}

.bt-htools-close {
  appearance: none;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.bt-htools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bt-htools-tile {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #1b3a5a;
  background: linear-gradient(180deg, #143049 0%, #0d2236 100%);
  color: #e8f1fa;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.bt-htools-tile:hover {
  border-color: #0ea5e9;
  transform: translateY(-1px);
}

.bt-htools-tile__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font: 800 0.78rem/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.02em;
  background: linear-gradient(145deg, #2242dc 0%, #0ea5e9 100%);
  color: #fff;
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.35);
}

.bt-htools-tile__icon--bim2 {
  background: linear-gradient(145deg, #0b3a6e 0%, #1b4f9c 55%, #0ea5e9 100%);
}

.bt-tab-bar__mark--bim2 {
  background: linear-gradient(145deg, #0b3a6e, #0ea5e9) !important;
}

#bimtraza-bim2-modal {
  position: fixed;
  inset: 0;
  z-index: 22100;
  display: flex;
  flex-direction: column;
  background: #071420;
  color: #e8f1fa;
}

#bimtraza-bim2-modal[hidden],
#bimtraza-bim2-modal.hidden {
  display: none !important;
}

#bimtraza-bim2-modal .bt-tab-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0b1c2e;
}

.bt-htools-tile__name {
  font: 700 0.82rem/1.2 "Segoe UI", system-ui, sans-serif;
}

.bt-htools-tile__desc {
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.35;
}

#bimtraza-tabtraza-modal {
  position: fixed;
  inset: 0;
  z-index: 22100;
  display: flex;
  flex-direction: column;
  background: #071420;
  color: #e8f1fa;
}

#bimtraza-tabtraza-modal[hidden],
#bimtraza-tabtraza-modal.hidden {
  display: none !important;
}

.bt-tab-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #1b3a5a;
  background: #030f1a;
}

.bt-tab-bar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 0.9rem/1 "Segoe UI", system-ui, sans-serif;
}

.bt-tab-bar__mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  background: linear-gradient(145deg, #2242dc, #0ea5e9);
  color: #fff;
}

.bt-tab-bar__proj {
  margin-left: 6px;
  font-size: 0.72rem;
  color: #89ceff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(42vw, 420px);
}

.bt-tab-bar__actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bt-tab-btn {
  appearance: none;
  border: 1px solid #2a4a6a;
  background: linear-gradient(180deg, #143049 0%, #0d2236 100%);
  color: #e8f1fa;
  border-radius: 9px;
  padding: 0.42rem 0.95rem;
  font: 600 0.74rem/1.2 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.bt-tab-btn:hover {
  border-color: #0ea5e9;
  transform: translateY(-1px);
}

.bt-tab-btn--primary {
  background: linear-gradient(180deg, #2242dc, #1a35b0);
  border-color: #3b82f6;
}

/* Fusión TABTRAZA + BIMTRAZA: cierre destacado en azul marca */
.bt-tab-btn--close {
  background: linear-gradient(145deg, #2242dc 0%, #0ea5e9 100%);
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.28);
}

.bt-tab-btn--close:hover {
  border-color: #7dd3fc;
  filter: brightness(1.05);
}

.bt-tab-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: #0b1c2e;
}

.bt-tab-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0b1c2e;
}

.bt-tab-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 8px;
}

.bt-tab-fallback[hidden] {
  display: none !important;
}

.bt-tab-formula {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bt-tab-formula label {
  font: 700 0.7rem/1 mono, ui-monospace, monospace;
  color: #89ceff;
  min-width: 3rem;
}

.bt-tab-formula input {
  flex: 1;
  border: 1px solid #1b3a5a;
  background: #030f1a;
  color: #e8f1fa;
  border-radius: 6px;
  padding: 6px 8px;
  font: 13px/1.2 ui-monospace, monospace;
}

.bt-tab-sheet-scroll {
  flex: 1;
  overflow: auto;
  border: 1px solid #1b3a5a;
  border-radius: 8px;
  background: #fff;
}

.bt-tab-sheet {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 100%;
}

.bt-tab-sheet th,
.bt-tab-sheet td {
  border: 1px solid #cbd5e1;
  width: 96px;
  min-width: 96px;
  height: 26px;
  padding: 0;
  font: 12px/26px "Segoe UI", system-ui, sans-serif;
  color: #0f172a;
  background: #fff;
}

.bt-tab-sheet th {
  background: #e2e8f0;
  color: #334155;
  font-weight: 700;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

.bt-tab-sheet th.bt-tab-corner,
.bt-tab-sheet td.bt-tab-rowhead {
  width: 40px;
  min-width: 40px;
  background: #e2e8f0;
  text-align: center;
  font-weight: 700;
  color: #475569;
  position: sticky;
  left: 0;
  z-index: 1;
}

.bt-tab-sheet th.bt-tab-corner {
  z-index: 3;
}

.bt-tab-sheet td input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  padding: 0 4px;
  background: transparent;
  font: inherit;
  color: inherit;
}

.bt-tab-sheet td.is-active {
  outline: 2px solid #2242dc;
  outline-offset: -2px;
}

.bt-tab-status {
  font-size: 0.68rem;
  color: #94a3b8;
}

.bt-tab-status--bar {
  max-width: min(42vw, 360px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #89ceff;
  margin-right: 4px;
}

.bt-tab-save-chooser {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 15, 26, 0.62);
  backdrop-filter: blur(3px);
  padding: 16px;
}

.bt-tab-save-chooser[hidden] {
  display: none !important;
}

.bt-tab-save-chooser__card {
  width: min(360px, 94vw);
  background: linear-gradient(180deg, #10253b 0%, #0b1c2e 100%);
  border: 1px solid #1b3a5a;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  padding: 16px;
  color: #e8f1fa;
}

.bt-tab-save-chooser__card h3 {
  margin: 0 0 6px;
  font: 700 0.95rem/1.2 "Segoe UI", system-ui, sans-serif;
}

.bt-tab-save-chooser__name {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: #89ceff;
  word-break: break-all;
}

.bt-tab-save-chooser__hint {
  margin: 0 0 10px;
  font-size: 0.74rem;
  color: #94a3b8;
}

.bt-tab-save-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.bt-tab-save-chooser__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 720px) {
  .bt-htools-panel {
    left: 8px;
    right: 8px;
    bottom: 12px;
    width: auto;
  }
  .bt-htools-grid {
    grid-template-columns: 1fr;
  }
}
