/** Simulador de Excel — estilos */

.excel-sim {
  font-family: 'Segoe UI', 'Calibri', sans-serif;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  margin: 1rem 0;
}

.excel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--grey-100);
  border-bottom: 1px solid var(--grey-200);
}

.excel-ref {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  min-width: 36px;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem;
}

.excel-formula-bar {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.excel-formula-bar:focus {
  outline: none;
  border-color: var(--blue-mid);
}

.excel-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.excel-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  table-layout: fixed;
  min-width: 400px;
}

.excel-grid thead th {
  background: var(--grey-100);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.3rem;
  border: 1px solid var(--grey-200);
  text-align: center;
  width: 80px;
}

.excel-grid thead th:first-child {
  width: 32px;
  background: var(--grey-100);
}

.excel-grid tbody th {
  background: var(--grey-100);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.3rem;
  border: 1px solid var(--grey-200);
  text-align: center;
  width: 32px;
}

.excel-grid td {
  border: 1px solid #e2e8f0;
  padding: 0.3rem 0.4rem;
  height: 28px;
  min-width: 80px;
  cursor: cell;
  background: var(--white);
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-grid td:hover {
  background: #f0f9ff;
}

.excel-grid td.selected {
  box-shadow: inset 0 0 0 2px var(--blue);
  background: #eff6ff;
  z-index: 1;
}

.excel-grid td.has-formula {
  color: var(--blue-dark);
}

.excel-grid td.readonly {
  background: var(--grey-100);
  color: var(--text-dim);
  cursor: not-allowed;
}

.excel-grid td.editing {
  padding: 0;
  background: #fff;
}

.excel-inline-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 0.3rem 0.4rem;
  font-family: 'Segoe UI', 'Calibri', sans-serif;
  font-size: 0.82rem;
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
  min-height: 28px;
}

.excel-inline-input:focus {
  box-shadow: inset 0 0 0 2px var(--blue);
}

@media (max-width: 640px) {
  .excel-grid td, .excel-grid thead th {
    font-size: 0.75rem;
    padding: 0.2rem;
    min-width: 60px;
  }
}
